ISARef Multi-ISA & Silicon Reference
45,419 ISA items · 105,907 timings · 1,823 microarchs · 16,083 chips · 105 sources
Arch:
Tier:

fcvtmod.w.d

T1 riscv fp insn
Floating-Point Convert Double-Precision to Word with Modulo
SourceRISC-V Official Unified Database (riscv-unified-db) (riscv_unified_db)
Reliability TierT1 — Official Specification
ISA / Silicon ScopeRV32/RV64 D, Zfa
RV32 / RV64 (Ratified & Standard Extensions)
License & VersionApache-2.0 / CC-BY-4.0
main
Upstreamhttps://github.com/riscv/riscv-unified-db
Privilegeuser
ExtensionsD, Zfa

Summary

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.

Syntax / Encoding

fcvtmod.w.d xd, fs1, rm | 110000101000xxxxxxxxxxxxx1010011 (mask=0xfff0007f match=0xc2800053)

Binary Encodings (1)

WidthFormatBit PatternMask / Match
32RV110000101000xxxxxxxxxxxxx10100110xfff0007f / 0xc2800053

Operands

NameDescription
fs1bits [19:15]
rmbits [14:12], not [0, 2, 3, 4, 5, 6, 7]
xdbits [11:7]

Reference Notes

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.