|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Instructions: Data
Transfer |
|
|
|
|
Byte operations |
|
|
lb $rt, offset($rs) |
Load sign-extended byte |
|
|
|
|
|
|
from memory location to
register |
|
|
lbu $rt, offset($rs) |
Load zero-extended (unsigned)
byte |
|
|
|
|
|
|
from memory location to
register |
|
|
sb $rt, offset($rs) |
Store the least significant
byte of a |
|
|
|
|
register to memory
location |
|
|
What about sbu? |
|
|
For lb, the address is computed the same way as lw, |
|
|
|
but the address does not
have to be word aligned. |
|
|
Addr <-- R[s] + (IR15)16::IR15-0 |
|
|
|
R[t] <-- (M1[ Addr ]7)24::M1[ Addr ] |
|
|
|
|
Since the value is
interpreted as 2C, the fetched byte is sign-extended to 32 bits. |
|
|
lbu is
just like lb except the
byte is zero-extended in the register |
|
|
|
sb is similar to sw: |
|
|
|
|
|
M1[ Addr ] <-- R[t]7-0 |
|
|
|
|
|
The least significant
byte of register t is copied to the address in memory. |
|
|
Do we really need to
have separate instructions to load, store bytes? |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|