2 Computational Units
2 – 30
2.4.2.3 Immediate Shifts
An immediate shift simply shifts the input bit pattern to the right
(downshift) or left (upshift) by a given number of bits. Immediate shift
instructions use the data value in the instruction itself to control the
amount and direction of the shifting operation. (See the chapter
“Instruction Set Overview” for an example of this instruction.) The data
value controlling the shift is an 8-bit signed number. The SE register is not
used or changed by an immediate shift.
The following example shows the input value downshifted relative to the
upper half of SR (SR1). This is the (HI) version of the shift:
SI=0xB6A3;
SR=LSHIFT SI BY –5 (HI);
Input:
10110110 10100011
Shift value:
–5
SR:
00000101 10110101 00011 000 000000
Here is the same input value shifted in the other direction, referenced to
the lower half (LO) of SR:
SI=0xB6A3;
SR=LSHIFT SI BY 5 (LO);
Input:
10110110 10100011
Shift value:
+5
SR:
00000000 000 10110 11010100 011 00000