Webcentive RISC-V Reference

fsh

Half-precision floating-point store

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

Encoding

31252420191514121176210
imm[11:5]rs2rs1001imm[4:0]0100111

Match 0x00001027, mask 0x0000707f. Source: fsh imm12hi rs1 rs2 imm12lo 14..12=1 6..2=0x09 1..0=3 in riscv-opcodes/extensions/rv_zfhmin.

FieldBitsriscv-opcodes name
imm[11:5]31:25imm12hi
rs224:20rs2
rs119:15rs1
imm[4:0]11:7imm12lo

Description

The fsh instruction stores a half-precision floating-point value from floating-point register fs2 to memory at address xs1 + imm.

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

fsh ignores all but the lower 16 bits in fs2.

fsh 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 = F[fs2][15:0];

write_memory(16, virtual_address, hp_value, $encoding);

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

Specification and related pages