Advanced Function Instruction
7-29
FUN 54 D P
ROTR
ROTATE RIGHT
FUN 54 D P
ROTR
D : Register to be rotated
N : Number of bits to be rotated
D, N may combine with V, Z, P0~P9 to serve
indirect address application
WX WY WM WS TMR CTR HR IR OR SR ROR DR K XR
Range
Ope-
rand
WX0
∣
WX240
WY0
∣
WY240
WM0
∣
WM1896
WS0
∣
WS984
T0
∣
T255
C0
∣
C255
R0
∣
R3839
R3840
∣
R3903
R3904
∣
R3967
R3968
∣
R4167
R5000
∣
R8071
D0
∣
D4095
1 1
∣ or ∣
16 32
V、Z
P0~P9
D ○ ○ ○ ○ ○ ○ ○ ○* ○* ○ ○
N ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
z When rotate control "EN" = 1 or "EN↑" ( P instruction) has a transition from 0 to 1, will rotate the bit data of
D register towards the right by N successive bits (in descending order, ie. in a 16-bit instruction, B15→B14,
B14→B13, .... , B1→B0, B0→B15. In a 32-bit instruction, B31→B30, B30→B29, .... , B1→B0, B0→B31). At
the same time, the status of the rotated out B0 bits will appear at the rotate-out bit "OTB".
z If the operand is 16 bit, the effective range of N is 1~16. For 32 bits ( D instruction) operand, it is 1~32.
Beyond this range, will set the N value error flag "ERR" to 1, and do not carry out this instruction.
X0
EN
D :
N :
R 0
OTB
Y0
ERR
54P.ROTR
8
z The instruction at left rotates data from R0 register
towards the right 8 successive bits. The results are
shown below.
B15
R0 B0
1 1 1 1 0 0 0 0
10101010
*
Y0
Ø
X0=
B15
R0 B0
1 0 1 0 101011110000
*
Y01
*