Maxim-integrated DS4830 Optical Microcontroller User Manual Page 145

  • Download
  • Add to my manuals
  • Print
  • Page
    / 227
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 144
DS4830 User’s Guide
145
18.6 Hardware Multiplier Examples
The following are code examples of multiplier operations.
;Unsigned Multiply 16-bit x 16-bit
move MCNT, #21h ; CLD=1, SUS=1 (unsigned)
move MA, #0FFFh ; MC2:0=0000_0000_0000h
move MB, #1001h ; MC1R:MC0R= 00FF_FFFFh
; MC2:0=0000_00FF_FFFFh
;Signed Multiply 16-bit x 16-bit
move MCNT, #20h ; CLD=1, SUS=0 (signed)
move MA, #F001h ; MC2:0=0000_0000_0000h
move MB, #1001h ; MC1R:MC0R= FF00_0001h
; MC2:0=FFFF_FF00_0001h
;Unsigned Multiply-Accumulate 16-bit x 16-bit
; MC2:0=0000_0100_0001h
move MCNT, #03h ; MMAC=1, SUS=1 (unsigned)
move MA, #0FFFh ;
move MB, #1001h ;
; MC1R:MC0R=02FF_FFFFh
; MC2:0=0000_0200_0000h
;Signed Multiply-Accumulate 16-bit x 16-bit
; MC2:0=0000_0100_0001h
move MCNT, #02h ; SUS=0 (signed)
move MA, #F001h ;
move MB, #1001h ;
; MC1R:MC0R= FF00_0003h
; MC2:0=0000_0000_0002h
;Unsigned Multiply-Subtract 16-bit x 16-bit
; MC2:0=0000_0100_0001h
move MCNT, #07h ; MMAC=1, MSUB=1, SUS=1 (unsigned)
move MA, #0FFFh ;
move MB, #1001h ;
; MC1R:MC0R=FF00_0003h
; MC2:0=0000_0000_0002h
;Signed Multiply-Subtract 16-bit x 16-bit
; MC2:0=0000_0100_0001h
move MCNT, #06h ; MMAC=1, MSUB=1, SUS=0 (signed)
move MA, #F001h ;
move MB, #1001h ;
; MC1R:MC0R= 02FF_FFFFh
; MC2:0=0000_0200_0000h
;Signed Multiply Negate 16-bit x 16-bit
move MCNT, #24h ; CLD=1, MSUB=1, SUS=0 (signed)
move MA, #F001h ; MC2:0=0000_0000_0000h
move MB, #1001h ; MC1R:MC0R =00FF_FFFFh
; MC2:0=0000_00FF_FFFFh
Page view 144
1 2 ... 140 141 142 143 144 145 146 147 148 149 150 ... 226 227

Comments to this Manuals

No comments