DOUBLE PRECISION MULTIPLY MODE
3 - 18 DATA ARITHMETIC LOGIC UNIT MOTOROLA
cision values and accumulated using regular MAC instructions. Note that the maximum
number of single times double MAC operations in this algorithm are limited to 255 since
overflow may occur (the A2 register is just eight bits long). If a longer sequence is
required, it should be split into sub-sequences each with no more than 255 MAC opera-
tions.
Y:X:
R5
SPiMSPi
LSPi
R1
DP2
DP3
DP1 R0
R0
DP3_DP2_DP1 = MSPi_LSPi x SPi
move #N-1,m5
clr a #0,y0 ;clear a and y0
ori #$40,mr ;enter DP mode
move x:(r1)+,x0 y:(r5)+,y1 ;load LSPi and SPi
rep #N ;0<N<256
mac x0,y1,a x:(r1)+,x0 y:(r5)+,y1 ;LSPi*SPia
andi #$bf,mr ;exit DP mode
move a0,x:(r0)+ ;save DP1
move a1,y0
move a2,a
move y0,a0 ;a2:a1a1:a0
rep #N
mac x0,y1,a x:(r1)+,x0 y:(r5)+,y1 ;load MSPi and SPi
move a,l:(r0)+ ;save DP3_DP2
Figure 3-13 Single × Double Multiply-Accumulate Algorithm