Motorola DSP96002 User Manual page 567

32-bit digital signal processor
Table of Contents

Advertisement

Totals:
2.
Static rotate right 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 N-1 of the register. For example, if N=3 (three
bit rotate right), then the resulting carry will be the value of bit 2 of the register.
ror
lsr
lsl
or
Totals:
3.
Dynamic rotate left 0-32 bits. The 32 bit integer to be rotated is in d0.l. The number of bits to
rotate is in d2.l. In the following example, the code for checking if the shift count is zero may
be eliminated if it is known that the shift count is greater than zero.
tst
jeq
rol
dec
sub
lsl
lsr
or
_done
4.
Dynamic rotate right 0-32 bits. The 32 bit integer to be rotated is in d0.l. The number of bits
to rotate is in d2.l. In the following example, the code for checking if the shift is zero count may
be eliminated if it is known that the shift count is greater than zero.
tst
d2
_done
d0.l,d1.l ;shift in carry, copy input 1
;dec shift count, get 32
32-shift, move count
move shift count
carry
1
1
B-48
4
4
d0
d0.l,d1.l
#N-1,d0
#33-N,d1
d1,d0
4
4
d2
_done
d0
d0.l,d1.l
d2
#32,d3.l
d2,d3
d2.l,d0.h
d0,d0
d3.l,d1.h
d1,d1
d1,d0
;yes, done
1
1
1
1
1
or
_done
DSP96002 USER'S MANUAL
--- ---
;shift in carry, copy input 1
;shift up, pad with zeros
;shift down, set carry
;put numbers back together
--- ---
;see if shift count is zero
;yes, done
;shift in carry, copy input
;dec shift count, get 32
;get 32-shift, move count
;shift, move shift count
;shift, set carry
;or bits together
;see if shift count is zero
1
2
2
sub
1
lsr
d0,d0
lsl
d1,d1
d1,d0
Program ICycles
Words
1
1
1
Program ICycles
Words
1
2
1
2
1
1
1
1
---
Totals:
10
Program ICycles
Words
1
1
2
2
ror
d0
dec
d2
#32,d3.l
d2,d3
d2.l,d0.h
d3.l,d1.h
;shift, set
;or bits together
1
1
1
1
1
2
1
2
1
1
1
1
---
10
jeq
;get
;shift,
---
---
MOTOROLA

Advertisement

Table of Contents
loading

Table of Contents