flw
Floating-Point Load Single-Precision
- Extension
- F
- XLEN
- RV32 and RV64
- Assembly (riscv-unified-db)
flw fd, imm(xs1)- Length
- 32-bit
Encoding
| 3120 | 1915 | 1412 | 117 | 62 | 10 | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| imm[11:0] | rs1 | 010 | rd | 00001 | 11 | ||||||||||||||||||||||||||
Match 0x00002007, mask 0x0000707f. Source: flw rd rs1 imm12 14..12=2 6..2=0x01 1..0=3 in riscv-opcodes/extensions/rv_f.
| Field | Bits | riscv-opcodes name |
|---|---|---|
| imm[11:0] | 31:20 | imm12 |
| rs1 | 19:15 | rs1 |
| rd | 11:7 | rd |
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.