Load Instructions
-
lb/lh/lw/ld (Load Byte/Halfword/Word/Doubleword):
- Loads a byte/halfword/word/double-word from memory, sign-extending to fill the register.
- Example:
lb x5, 0(x6)
loads the byte at addressx6 + 0
into registerx5
.- x6 register is referred to as the base address. (Contains the memory address)
-
lbu/lhu/lwu (Load Byte Unsigned/Halfword Unsigned):
- Loads a byte or halfword without sign-extension.
- Example:
lbu x5, 0(x6)
loads the unsigned byte atx6 + 0
into registerx5
.
*Note: There is no ldu because it would work the same as ld
Store Instructions
- sb/sh/sw/sd (Store Byte/Halfword/Word/Doubleword):
- Stores the lower 8 bits/16 bits/32 bits/64 bits of a register to memory.
- Example:
sb x5, 8(x6)
stores the least significant byte ofx5
to the address `x6 + 8