FROUND.D

RISC-V FROUND.D Instruction Details

Instruction ManualR-type

Round a double-precision floating-point value to an integral value in the same FP format, without setting NX.

Instruction Syntax

fround.d rd, rs1, rm
Operand Breakdown
rd: destination floating-point register receiving the rounded result in the same format.
rs1: the only source floating-point register; the encoded rs2 field is fixed to 00100 (decimal 4), not a second source floating-point register.
rm: rounding-mode field; rm=111 uses the dynamic frm rounding mode.
ZfaDFP Precision

Instruction Behavior

FROUND.D rounds the double-precision FP value in f[rs1] to an integral value according to rm and writes it in D format to f[rd]. Zero and infinity are copied unchanged; a signaling NaN sets NV and no other exception flags. Unlike FROUNDNX, FROUND does not set NX.

FROUND.D Decode And Execute Animation

Shows the Zfa + D-extension double-precision OP-FP flow: decode fields, read FP operands, perform FROUND semantics, then write rd.

rd
rs1
rm
fround.d
,
,
Execution Context
FLEN=>=64 / fmt=D (01)
rounding: RNE nearest-even
fflags: FROUND example leaves fflags clear
31..27
26..25
24..20
19..15
14..12
11..7
6..0
01000
FROUND
01
fmt=D
00100
rs2=4 (roundToIntegral)
01011
rs1
000
rm
01010
rd
1010011
OP-FP
Execution Data Path
instruction
0x42458553
opcode
1010011 -> OP-FP
funct5/fmt
01000 + D(01) -> FROUND.D
rm
000 -> RNE nearest-even
rd/rs
fa0(f10) / fa1(f11) / rs2=00100 (fixed)
read
1.5
FP op
roundToIntegral(1.5, RNE nearest-even) = 2.0
write
fa0(f10) = 2.0; FROUND example leaves fflags clear
Current Step

Fetch: show the 32-bit OP-FP encoding

The word is split as an R-type OP-FP instruction; double-precision OP-FP instructions use opcode 1010011.

encoding: 0x42458553
syntax : fround.d fa0(f10), fa1(f11), rne
result : fa0(f10) = 2.0; FROUND example leaves fflags clear

This bounded teaching model computes whitelisted finite examples plus zero, infinity, and NaN; FROUND.D writes the integral value in D format. Zero and infinity are copied. FROUND does not set NX and sets no exception flags other than NV.

Double-precision Calculation
rs1
fa1(f11) = 1.5
rs2
ft4(f4) = 0.0
result
roundToIntegral(1.5, RNE nearest-even) = 2.0

This bounded teaching model computes whitelisted finite examples plus zero, infinity, and NaN; FROUND.D writes the integral value in D format. Zero and infinity are copied. FROUND does not set NX and sets no exception flags other than NV.

This animation shows only Zfa + D-extension ISA-visible OP-FP encoding, example numeric results, and fflags relationship; it does not model FPU pipelines, latency, every IEEE 754 corner case, or microarchitecture.

Quick Understanding & Search Notes

FROUND.D differs from FCVT by output type: FROUND.D still writes a floating-point register, with the value rounded to an integral value. FROUND deliberately does not report inexact NX.

Its OP-FP encoding is funct5=01000, fmt=01 (D), rs2=00100, rs1, rm, rd, and opcode=1010011.
rm selects the rounding direction; rm=111 selects dynamic rounding from frm.
Zero and infinity are copied unchanged; a signaling NaN sets NV, while FROUND sets neither NX nor any other exception flag.

Common Usage Scenarios

Floating-Point Rounding

Understand this scenario with real code like «fround.d f10, f11, rup ; round f11 toward +∞».

Numeric Format Handling

Understand this scenario with real code like «fround.d f10, f11, rup ; round f11 toward +∞».

Pre-Use Checklist

Syntax Check
  • rd: destination floating-point register receiving the rounded result in the same format.
  • rs1: the only source floating-point register; the encoded rs2 field is fixed to 00100 (decimal 4), not a second source floating-point register.
  • rm: rounding-mode field; rm=111 uses the dynamic frm rounding mode.
Semantic Check
  • Confirm the floating-point format suffix (.H/.S/.D/.Q) matches the data width.
  • Decide whether software must inspect fflags for NV, DZ, OF, UF, or NX.

Pitfalls / Common Confusions

FROUND does not set NX; use FROUNDNX when inexact reporting is needed.
The result is still floating-point, not an integer-register result; use FCVT for an integer result.
rm controls the direction for rounding to an integral value.

FAQ

Does FROUND.D write an integer register?

No. The result is written to floating-point register f[rd]; the floating-point value is integral.

How does FROUND.D differ from the other FROUND form?

FROUND does not set NX; FROUNDNX sets NX only when the input differs from the rounded result and is not NaN.