Webcentive RISC-V Reference

flw

Floating-Point Load Single-Precision

Extension
F
XLEN
RV32 and RV64
Assembly (riscv-unified-db)
flw fd, imm(xs1)
Length
32-bit

Encoding

3120191514121176210
imm[11:0]rs1010rd0000111

Match 0x00002007, mask 0x0000707f. Source: flw rd rs1 imm12 14..12=2 6..2=0x01 1..0=3 in riscv-opcodes/extensions/rv_f.

FieldBitsriscv-opcodes name
imm[11:0]31:20imm12
rs119:15rs1
rd11:7rd

Description

The flw instruction loads a single-precision floating-point value from memory at address xs1 + imm into floating-point register fd. It does not modify the bits being transferred; in particular, the payloads of non-canonical NaNs are preserved.

Description from riscv-unified-db, reformatted.

Operation

check_f_ok($encoding);

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

Bits<32> sp_value = read_memory(32, virtual_address, $encoding);

if (implemented?(ExtensionName::D)) {
  F[fd] = nan_box(32, 64, sp_value);
} else {
  F[fd] = sp_value;
}

mark_f_state_dirty();

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

Specification and related pages