memory addressing
Summary
Endianness
- Big-endian -> most significant byte in lowest address
- Little-endian -> least significant byte in lowest address
affects the order of bytes within a multi-byte word, within the byte nothing changes
Register addressing
- R-type
- operand is specified in registers
Immediate addressing
- I-type
- operand is specified in the instruction
Displacement addressing
- I-type - load/store
- operand is in memory
Concept
Addressing modes
- ways to specify an operand
| Addressing mode | Example | Meaning |
|---|---|---|
| Register | add r1, r2 | r1 <- r1 + r2 |
| Immediate | add r1, 3 | r1 <- r1 + 3 |
| Displacement | add r1, 8(r2) | r1 <- r1 + mem[r2+8] |
| Register indirect | add r1, (r2) | r1 <- r1 + mem[r2] |
| Indexed/Base | add r1, (r2+r3) | r1 <- r1 + mem[r2+r3] |
| Direct/Absolute | add r1, (100) | r1 <- r1 + mem[100] |
| Memory indirect | add r1, @(r2) | r1 <- r1 + mem[mem[r2]] |
| Auto-increment | add r1, (r2)+ | r1 <- r1 + mem[r2]r2 <- r2 + x |
| Auto-decrement | add r1, -(r2) | r2 <- r2 - xr1 <- r1 + mem[r2] |
| Scaled | add r1, 100(r2)[r3] | r1 <- r1 + mem[100+r2+r3*x] |