|Original||Shift Left Two|
|0110 1111||1011 1100|
If the original 8-bit pattern represented an integer, then shifting left by two positions is probably a mistake because a significant bit has been lost.
This program does the shift you just performed in the question. It does it with 32-bit patterns, but for the right-most eight bits the result is the same.
## shiftTwo.asm ## ## Program to logical shift left a pattern .text .globl main main: ori $8, $0, 0x6F # put bit pattern into register $8 sll $9, $8, 2 # shift left logical by two ## End of file
Running the program does the following. Since this time the shift was done with 32 bits, the high order one-bit was not lost.
The register display in SPIM has been set to "binary" in the above.
Do you think it would be OK to shift the contents of register
$8 and put the
result back in register
ori $8, $0, 0x6F # put bit pattern into register $8 sll $8, $8, 2 # shift left logical by two