c.lhu
Load unsigned halfword, 16-bit encoding
- Extension
- Zcb
- XLEN
- RV32 and RV64
- Assembly (riscv-unified-db)
c.lhu xd, imm(xs1)- Length
- 16-bit (compressed)
Encoding
| 1513 | 1210 | 97 | 6 | 5 | 42 | 10 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 100 | 001 | rs1′ | 0 | c_uimm1 | rd′ | 00 | |||||||||
Match 0x8400, mask 0xfc43. Source: c.lhu rd_p rs1_p c_uimm1 1..0=0 15..13=4 12..10=1 6=0 in riscv-opcodes/extensions/rv_zcb.
| Field | Bits | riscv-opcodes name |
|---|---|---|
| rs1′ | 9:7 | rs1_p |
| c_uimm1 | 5 | c_uimm1 |
| rd′ | 4:2 | rd_p |
Description
Loads a 16-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 lhu 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(16, virtual_address, $encoding);Pseudocode in riscv-unified-db’s IDL, quoted unchanged.