234
4
4 Instructions4.6.4 Matrix Rotation and Shift
◆
Function
1) The bit pattern of a matrix composed of n 16-bit data entries in the range [S] to [S + n – 1] is shifted to
the left or right. If M8329 is set to ON, the shift direction is right; if it is set to OFF, the shift direction is
left. The bit position left blank after every shift, which is bit 0 in a left shift or bit (16n – 1) in a right shift,
is lled with the placeholder ag M8328. The bit moved out of the matrix, which is bit (16n – 1) in a left
shift or bit 0 in a right shift, is diverted to the carry ag M8327. The data after shift is stored in elements
from head address [D].
2) The instruction of the pulse execution type (MBSP) is generally used.
◆
Application
Assume that M8329 = OFF. The bit pattern of the following matrix is shifted to the left:
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
01 0 1 0 1 0 1 0 1 0 1 0 1 0 1
01 0 1 0 1 0 1 0 1 0 1 0 1 0 1
01 0 1 0 1 0 1 0 1 0 1 0 1 0 1
D100
D101
D102
Before
execution
D100
D101
D102
0
M8327
Carry flag
0
After
execution
MBS
Placeholder
flag M8328
Placeholder
flag M8328
Assume that M8329 = ON. The bit pattern of the following matrix is shifted to the right:
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
01 0 1 0 1 0 1 0 1 0 1 0 1 0 1
01 0 1 0 1 0 1 0 1 0 1 0 1 0 1
01 0 1 0 1 0 1 0 1 0 1 0 1 0 1
D100
D101
D102
Before execution
D100
D101
D102
1
M8328
Carry flag
M8327
Carry flag
After execution
MBS
1
M8327
Carry flag
●
Flags
M8327: Carry ag of matrix shift output
M8328: Placeholder ag of matrix shift input
M8329: Matrix shift direction ag