Advanced Function Instruction
7-112
FUN129 P
MBROT
MATRIX BIT ROTATE
FUN129 P
MBROT
Ms : Starting register of source matrix
Md : Starting register of destination matrix
L : Length of matrix (Ms and Md)
Ms, Md 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
2
∣
256
V、Z
P0~P9
Ms ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Md ○ ○ ○ ○ ○ ○ ○ ○* ○* ○ ○
L ○* ○ ○
L
Ms Md
Rotate
left
1 bit
OTB
L/R=1
z When rotate control "EN" = 1 or "EN↑" ( P instruction)
has a transition from 0 to 1, matrix Ms will be
completely retrieved and rotated by one bit towards
the left (when L/R = 1) or to the right (when L/R = 0).
The space created by the rotation (with a left rotation it
will be M0, and with a right rotation it will be M
16L-1
) will
be replaced by the status of the rotated-out bit (with a
left rotation it will be M
16L-1
, and with a right rotation it
will be M0). The rotated-out bit will not only be used to
fill the above-mentioned space, it will also be
transferred to rotated-out bit "OTB".
L
Ms Md
Shift
right
1 bit
OTB
L/R=0
X0
EN
L :
Md :
5
OTBMs :
R 0
R 0
L/R
129P.MBROT
z In the program at left, Ms and Md are the same matrix.
When X0 goes from 0
→1, then the whole of Ms is
retrieved and rotated right (because L/R = 0) by 1 bit. It is
then stored back into Ms itself (because in this example
Ms and Md are the same matrix). The results are shown
at right in the diagram below.
Ms15
↓
Ms
Ms0
↓
Md15
↓
Md
Md0
↓
R0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 R0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 R1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
R2 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 R2 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0
R3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 R3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 R4 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
↑
Ms79
↑
Ms64
X0=
Ö
↑
Md79
↑
Md64
Before execution After execution
OT
0