Webcentive RISC-V Reference

flh

Half-precision floating-point load

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

Encoding

3120191514121176210
imm[11:0]rs1001rd0000111

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

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

Description

The flh instruction loads a half-precision floating-point value from memory at address xs1 + imm into floating-point register fd.

flh does not modify the bits being transferred; in particular, the payloads of non-canonical NaNs are preserved.

flh is only guaranteed to execute atomically if the effective address is naturally aligned.

Description from riscv-unified-db, reformatted.

Operation

check_f_ok($encoding);

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

Bits<16> hp_value = read_memory(16, virtual_address, $encoding);

F[fd] = nan_box(16, FLEN, hp_value);

mark_f_state_dirty();

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

Specification and related pages