What is the difference between LWU and LW in RV64I?
Both load a 32-bit word. LWU zero-extends it to 64 bits, while LW sign-extends bit 31 into the upper 32 bits.
Load a 32-bit word from memory, zero-extend it to 64 bits, and write rd
LWU is an RV64I-only I-type instruction (opcode=0000011, funct3=110). It reads a 32-bit word from the effective byte address rs1 plus a sign-extended 12-bit offset, zero-extends it to 64 bits, and writes rd. A naturally aligned address is a multiple of 4; the EEI defines completion, address-misaligned exception, or access-fault behavior for a misaligned access. Unlike LW, LW sign-extends the 32-bit value to 64 bits in RV64I.
Starts with machine-code field decoding, then shows operand reads, instruction-specific execution, and ISA-visible state update.
This example uses fixed initial register values and PC=0x2000; instruction fetch succeeds, with no asynchronous interrupt or extra extension checks. Exception branches stop ordinary commit; post-trap PC and handler state are EEI-dependent.
Assumes readable ordinary memory, with the displayed sample value at each selected effective address. Only misaligned EEI outcomes are modeled, not permissions or device side effects. Byte accesses are always naturally aligned; successful loads advance PC by 4, while exceptions stop ordinary writeback.
This EEI branch applies only when the effective address is not divisible by 4; a naturally aligned access must not raise an address-misaligned exception.
The machine code is split by the current instruction format; the animation starts from encoding/decode.
This animation shows ISA-visible decode and state changes, not any specific CPU pipeline, cache, prediction, or timing implementation.
LWU is RV64I-only: it forms an effective byte address from rs1 plus a sign-extended 12-bit offset, then zero-extends the 32-bit memory value to 64 bits in rd.
Understand this scenario with real code like «lwu x10, 0(x11) # load unsigned 32-bit value, x10 = zero-extend(*x11)».
Both load a 32-bit word. LWU zero-extends it to 64 bits, while LW sign-extends bit 31 into the upper 32 bits.
No. LWU is defined by RV64I and is absent from RV32I.