
I Format Coding |
Branch Coding |
Load instructions are similar to the immediate instructions.
The offset replaces the immediate value. Consider:
lw $s4, 12($sp)
- Look up the values of the registers:
$s4 is 20 = 101002, $sp is 29 = 111012.
- Convert the offset
to binary: 12 = 11002.
- Look up the instruction to find its type and format.
(You'll find it on p. A-66.)
Plug the numbers into the format,
being careful to get the registers in the right places,
and pad the offset to 16 bits:
| 100011 | 11101 | 10100 | 0000000000001100 | |
- Regroup the bits.
| 1000 | 1111 | 1011 | 0100 | 0000 | 0000 | 0000 | 1100 | |
- Represent as a hex number: 8FB4000C
I Format Coding |
Branch Coding |