Motorola DSP96002 User Manual
Page 566
MOTOROLA
DSP96002 USER’S MANUAL
B-47
Program
ICycles
Words
fseedd d5,d4 1 1
fmpy.s d5,d4,d5 #2.0,d2.s 2 2
fmpy d0,d4,d0 fsub.s d5,d2 d2.s,d3.s 1 1
fmpy.s d5,d2,d5 d2.s,d4.s 1 1
fmpy d0,d4,d0 fsub.s d5,d3 1 1
fmpy.s d0,d3,d0 1 1
--- ---
Totals: 7 7
Operation table:
d0 (dividend)
/
0.0 number infinity / d5 (divisor)
------------------------------------/
NaN NaN NaN 0.0
0.0 number infinity number
NaN NaN NaN infinity
B.1.27 Multibit Rotates
This describes how to perform multibit rotates using the logical barrel shifts. Both the static case (rotate by
a fixed constant) and the dynamic case (rotate by a value in a register) are presented.
The following code assumes a rotating model of the form:
In this type of rotate, the carry participates in the bit rotations. Bits rotated out of the register go into the
carry bit; the previous value of the carry bit goes into the register.
1.
Static rotate left 1-32 bits. The 32 bit integer to be rotated is in d0.l. The number of bits to rotate
is N. The resulting carry is the value of bit 32-N of the register. For example, if N=3 (three bit
rotate left), then the resulting carry will be the value of bit 29 of the register.
Program ICycles
Words
rol d0 d0.l,d1.l ;shift in carry, copy input 1 1
lsl #N-1,d0 ;shift up, pad with zeros 1 1
lsr #33-N,d1 ;shift down, set carry 1 1
or d1,d0 ;put numbers back together 1 1
31
0
C