Webcentive RISC-V Reference

c.lbu

Load unsigned byte, 16-bit encoding

Extension
Zcb
XLEN
RV32 and RV64
Assembly (riscv-unified-db)
c.lbu xd, imm(xs1)
Length
16-bit (compressed)

Encoding

1513121097654210
100000rs1′c_uimm2rd′00

Match 0x8000, mask 0xfc03. Source: c.lbu rd_p rs1_p c_uimm2 1..0=0 15..13=4 12..10=0 in riscv-opcodes/extensions/rv_zcb.

FieldBitsriscv-opcodes name
rs1′9:7rs1_p
c_uimm26:5c_uimm2
rd′4:2rd_p

Description

Loads a 8-bit value from memory into register xd. It computes an effective address by adding the zero-extended offset, to the base address in register xs1. It expands to lbu xd, offset(xs1).

Description from riscv-unified-db, reformatted.

Operation

if (implemented?(ExtensionName::C) && MISA_CSR_IMPLEMENTED && (CSR[misa].C == 1'b0)) {
  reserved_instruction($encoding);
}

XReg virtual_address = X[creg2reg(xs1)] + imm;

X[creg2reg(xd)] = read_memory(8, virtual_address, $encoding);

Pseudocode in riscv-unified-db’s IDL, quoted unchanged.

Specification and related pages