LHU

Load Halfword Unsigned

LHU rd, offset(rs1)

Loads a 16-bit halfword from memory and zero-extends it.

Details

LHU loads a halfword (16 bits) from memory at address rs1+sext(offset), zero-extends it to XLEN bits, and writes it to rd.

Pseudocode Operation

R[rd] = zext(M[R[rs1] + sext(offset)][15:0]);

Example

LHU x5, 4(x10)

Encoding

Binary Layout
imm[11:0]
31:20
rs1
19:15
101
14:12
rd
11:7
0000011
6:0
 
Format I-Type
Opcode 0x03
Extension RV32I

Operands

  • rd
    Destination Register
  • rs1
    Base Address
  • offset
    Byte Offset