Webcentive RISC-V Reference

c.flwsp

Load word into floating-point register from stack

Extension
F, C
XLEN
RV32 only
Assembly (riscv-unified-db)
c.flwsp fd, imm(sp)
Length
16-bit (compressed)

Encoding

1513121176210
011uimm[5]rduimm[4:2|7:6]10

Match 0x6002, mask 0xe003. Source: c.flwsp rd c_uimm8sphi c_uimm8splo 1..0=2 15..13=3 in riscv-opcodes/extensions/rv32_c_f.

FieldBitsriscv-opcodes name
uimm[5]12c_uimm8sphi
rd11:7rd
uimm[4:2|7:6]6:2c_uimm8splo

Description

Loads a single-precision floating-point value from memory into floating-point register fd. It computes its effective address by adding the zero-extended offset, scaled by 4, to the stack pointer, x2. It expands to flw fd, offset(x2).

Description from riscv-unified-db, reformatted.

Operation

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

XReg virtual_address = X[2] + imm;

F[fd] = read_memory(32, virtual_address, $encoding);

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

Specification and related pages