Webcentive RISC-V Reference

fcvtmod.w.d

Floating-Point Convert Double-Precision to Word with Modulo

Extension
D, Zfa
XLEN
RV32 and RV64
Assembly (riscv-unified-db)
fcvtmod.w.d xd, fs1, rm
Length
32-bit

Encoding

312726252420191514121176210
110000101000rs1001rd1010011

Match 0xc2801053, mask 0xfff0707f. Source: fcvtmod.w.d rd rs1 24..20=8 31..27=0x18 14..12=1 26..25=1 6..2=0x14 1..0=3 in riscv-opcodes/extensions/rv_d_zfa.

FieldBitsriscv-opcodes name
rs119:15rs1
rd11:7rd

Description

The fcvtmod.w.d instruction always rounds towards zero. Bits 31:0 are taken from the rounded, unbounded two's complement result, then sign-extended to XLEN bits and written to integer register xd. ±∞ and NaN are converted to zero.

Floating-point exception flags are raised the same as they would be for fcvt.w.d with the same input operand.

This instruction is only provided if the D extension is implemented. It is encoded like fcvt.w.d, but with the xs2 field set to 8 and the rm field set to 1 (RTZ). Other rm values are reserved.

Description from riscv-unified-db, reformatted.

Specification and related pages