What offset range does LB use?
The sign-extended 12-bit byte offset ranges from -2048 through 2047.
Load an 8-bit byte from memory, sign-extend it to XLEN, and write rd
LB is an RV32I/RV64I I-type load (opcode=0000011, funct3=000). Its effective address is rs1 plus a sign-extended 12-bit offset; it reads 8 bits there, sign-extends the value to XLEN, and writes rd. A byte access is naturally aligned at every byte address; the EEI defines legal addresses and other access restrictions.
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.
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.
LB reads an 8-bit byte from the effective address formed by rs1 plus a signed 12-bit offset, then sign-extends the value into rd.
Understand this scenario with real code like «lb x5, 0(x10) # x5 = sign_ext(mem[x10+0][7:0])».
Understand this scenario with real code like «lb x5, 0(x10) # x5 = sign_ext(mem[x10+0][7:0])».
The sign-extended 12-bit byte offset ranges from -2048 through 2047.
LB/LH/LW sign-extend the loaded value to XLEN; LBU/LHU zero-extend. On RV64, use LWU when a 32-bit word should be zero-extended.