Motorola DSP96002 User Manual

Page 568

Advertising
background image

MOTOROLA

DSP96002 USER’S MANUAL

B-49

Totals: 10 10

The following code assumes a rotating model of the form:

In this model, the carry does not participate in the rotations. The carry assumes the value of the bit that was

rotated around the end of the register.

1.

Static rotate left 0-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. The resulting carry
is the value of the least significant bit of the register after rotation.

In the special case of a zero shift count, the resulting carry is the most significant bit. In the
special case of a 32 shift count, the resulting carry is the least significant bit. In both cases, the
register shifted is unchanged.

Program

ICycles

Words

move d0.l,d1.l ;copy input 1 1 lsr

#32-N,d0 ;shift first part 1 1 lsl #N,d1

;shift other part 1 1 or d1,d0 ;merge

bits together 1 1

--- ---

Totals: 4 4

2.

Static rotate right 0-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. The resulting
carry is the value of the most significant bit of the register after rotation.

In the special case of a zero shift count, the resulting carry is the least significant bit. In the
special case of a 32 shift count, the resulting carry is the most significant bit. In both cases, the
register shifted is unchanged.

Program

ICycles

Words

move d0.l,d1.l ;copy input 1 1 lsl

#32-N,d0 ;shift first part 1 1 lsr #N,d1

31

0

C

Advertising