MPY32 Operation
283
SLAU367P – October 2012 – Revised April 2020
Copyright © 2012–2020, Texas Instruments Incorporated
32-Bit Hardware Multiplier (MPY32)
5.2.6 Indirect Addressing of Result Registers
When using indirect or indirect autoincrement addressing mode to access the result registers and the
multiplier requires three cycles until result availability according to
, at least one instruction is
needed between loading the second operand and accessing the result registers:
; Access multiplier 16x16 results with indirect addressing
MOV
#RES0,R5
; RES0 address in R5 for indirect
MOV
&OPER1,&MPY
; Load 1st operand
MOV
&OPER2,&OP2
; Load 2nd operand
NOP
; Need one cycle
MOV
@R5+,&xxx
; Move RES0
MOV
@R5,&xxx
; Move RES1
In case of a 32×16 multiplication, there is also one instruction required between reading the first result
register RES0 and the second result register RES1:
; Access multiplier 32x16 results with indirect addressing
MOV
#RES0,R5
; RES0 address in R5 for indirect
MOV
&OPER1L,&MPY32L
; Load low word of 1st operand
MOV
&OPER1H,&MPY32H
; Load high word of 1st operand
MOV
&OPER2,&OP2
; Load 2nd operand (16 bits)
NOP
; Need one cycle
MOV
@R5+,&xxx
; Move RES0
NOP
; Need one additional cycle
MOV
@R5,&xxx
; Move RES1
; No additional cycles required!
MOV
@R5,&xxx
; Move RES2
5.2.7 Using Interrupts
If an interrupt occurs after writing OP, but before writing OP2, and the multiplier is used in servicing that
interrupt, the original multiplier mode selection is lost and the results are unpredictable. To avoid this,
disable interrupts before using the MPY32, do not use the MPY32 in interrupt service routines, or use the
save and restore functionality of the MPY32.
; Disable interrupts before using the hardware multiplier
DINT
; Disable interrupts
NOP
; Required for DINT
MOV
#xxh,&MPY
; Load 1st operand
MOV
#xxh,&OP2
; Load 2nd operand
EINT
; Interrupts may be enabled before
; processing results if result
; registers are stored and restored in
; interrupt service routines