Datasheet

Hardware Multiplier Operation
www.ti.com
11.2.2.1 MACS Underflow and Overflow
The multiplier does not automatically detect underflow or overflow in the MACS mode. The accumulator
range for positive numbers is 0 to 7FFF FFFFh and for negative numbers is 0FFFF FFFFh to 8000 0000h.
An underflow occurs when the sum of two negative numbers yields a result that is in the range for a
positive number. An overflow occurs when the sum of two positive numbers yields a result that is in the
range for a negative number. In both of these cases, the SUMEXT register contains the sign of the result,
0FFFFh for overflow and 0000h for underflow. User software must detect and handle these conditions
appropriately.
11.2.3 Software Examples
Examples for all multiplier modes follow. All 8x8 modes use the absolute address for the registers
because the assembler will not allow .B access to word registers when using the labels from the standard
definitions file.
There is no sign extension necessary in software. Accessing the multiplier with a byte instruction during a
signed operation will automatically cause a sign extension of the byte within the multiplier module.
; 16x16 Unsigned Multiply
MOV #01234h,&MPY ; Load first operand
MOV #05678h,&OP2 ; Load second operand
; ... ; Process results
; 8x8 Unsigned Multiply. Absolute addressing.
MOV.B #012h,&0130h ; Load first operand
MOV.B #034h,&0138h ; Load 2nd operand
; ... ; Process results
; 16x16 Signed Multiply
MOV #01234h,&MPYS ; Load first operand
MOV #05678h,&OP2 ; Load 2nd operand
; ... ; Process results
; 8x8 Signed Multiply. Absolute addressing.
MOV.B #012h,&0132h ; Load first operand
MOV.B #034h,&0138h ; Load 2nd operand
; ... ; Process results
; 16x16 Unsigned Multiply Accumulate
MOV #01234h,&MAC ; Load first operand
MOV #05678h,&OP2 ; Load 2nd operand
; ... ; Process results
; 8x8 Unsigned Multiply Accumulate. Absolute addressing
MOV.B #012h,&0134h ; Load first operand
MOV.B #034h,&0138h ; Load 2nd operand
; ... ; Process results
; 16x16 Signed Multiply Accumulate
MOV #01234h,&MACS ; Load first operand
MOV #05678h,&OP2 ; Load 2nd operand
; ... ; Process results
; 8x8 Signed Multiply Accumulate. Absolute addressing
MOV.B #012h,&0136h ; Load first operand
MOV.B #034h,R5 ; Temp. location for 2nd operand
MOV R5,&OP2 ; Load 2nd operand
; ... ; Process results
352
Hardware Multiplier SLAU144JDecember 2004Revised July 2013
Submit Documentation Feedback
Copyright © 2004–2013, Texas Instruments Incorporated