FDIV.Q

RISC-V FDIV.Q Instruction Details

Instruction ManualR-type

Quad-precision floating-point division: rd = rs1 / rs2.

Instruction Syntax

fdiv.q rd, rs1, rs2[, rm]

32-bit OP-FP: opcode=1010011, funct5=00011, fmt=11; bits14:12 hold rm.

rd, rs1, rs2 are f0–f31 or ABI names; f0 is writable and rd may overlap a source. Optional rm defaults to dyn; rm=111 uses frm. Static 101/110 and dynamic frm=101–111 have reserved behavior.

RV32/RV64 Q (requires D and F), FLEN=128; enable required extensions and FP state. Sources narrower than FLEN require valid NaN-boxing, otherwise use canonical qNaN.

Divide quad-precision rs1 by rs2 and round with rm; the animation supports only nonzero finite exact whitelisted examples. fflags accrues NV/DZ/OF/UF/NX without a base FP exception trap on flag setting.

One source register must have one initial value. The animation starts with fflags=0; teaching steps are not hardware cycles.

QFloating-Point Arithmetic

Instruction Behavior

FDIV.Q is a Q-extension quad-precision floating-point divide, and Q depends on D. It rounds the result according to the rm field or dynamic frm, then writes rd. Special values, NaNs, infinities, divide-by-zero cases, and exception flags follow the IEEE 754 rules adopted by the RISC-V floating-point extensions. rd, rs1, and rs2 are f0–f31; f0 is writable. Optional rm defaults to dyn in assembly.

FDIV.Q Decode And Execute Animation

Shows the Q-extension quad-precision OP-FP flow: decode fields, read FP operands, perform FDIV semantics, then write rd.

rd
rs1
rs2
rm
fdiv.q
,
,
,

Leave rm empty to use the assembly default dyn encoding and fcsr.frm below.

Execution Context
FLEN=128 / fmt=Q (11)
rounding: RNE nearest-even
fflags: initial 0
31..27
26..25
24..20
19..15
14..12
11..7
6..0
00011
FDIV
11
fmt=Q
01100
rs2
01011
rs1
000
rm
01010
rd
1010011
OP-FP
Execution Data Path
instruction
0x1EC58553
opcode
1010011 -> OP-FP
funct5/fmt
00011 + Q(11) -> FDIV.Q
rm
000 -> RNE nearest-even
rd/rs
fa0(f10) / fa1(f11) / fa2(f12)
read
Source registers not read yet
FP op
Awaiting Execute
write
Not written yet; initial fflags=0
Current Step

Fetch: show the 32-bit OP-FP encoding

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

encoding: 0x1EC58553
syntax : fdiv.q fa0(f10), fa1(f11), fa2(f12), rne
result : Not written yet; initial fflags=0

The default example 3.0 / 1.5 = 2.0 is exactly representable, so example fflags remains 0.

Quad-precision Calculation
rs1
fa1(f11) = 3.0
rs2
fa2(f12) = 1.5
result
Awaiting Execute

The default example 3.0 / 1.5 = 2.0 is exactly representable, so example fflags remains 0.

Assumes the extension is available, FS enabled, correctly NaN-boxed inputs, and initial fflags=0. Only nonzero finite exact whitelisted inputs and nonzero whitelisted results are accepted; zero and rounding/exception boundaries are outside this animation. One source register must have one initial value; rd may overlap a source, and f0 accepts writeback. Steps are teaching views.

This animation shows only Q-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

FDIV.Q is a Q-extension quad-precision floating-point division; Q depends on D. It uses OP-FP encoding with funct5=00011 and fmt=Q(11), reads two quad-precision FP operands, rounds according to rm or dynamic frm, writes rd, and records applicable FP exceptions in fflags.

In OP-FP, opcode=1010011, funct5=00011 selects FDIV, and fmt=11 selects the Q quad-precision format.
Q depends on D; a Q implementation has FLEN=128 for quad-precision operands.
The rm field selects a static rounding mode; rm=111 uses dynamic frm, while rm=101/110 and reserved frm values have reserved behavior.
The animation computes only finite exactly checkable teaching examples; full quad-precision rounding, NaN, infinity, divide-by-zero, and overflow paths follow the official FP rules.
Available on RV32/RV64 with Q (requires D and F); required extensions and FP state must be enabled. rd may overlap a source; one source register has one initial value.
The animation uses nonzero finite exact whitelisted values with initial fflags=0. Invalid or unsupported inputs stop execution without substituting defaults.

Common Usage Scenarios

Floating Point Basic

Understand this scenario with real code like «fdiv.q f0, f1, f2, rne # f0 = f1/f2».

Numerical Computing

Understand this scenario with real code like «fdiv.q f0, f1, f2, rne # f0 = f1/f2».

Pre-Use Checklist

Syntax Check
  • rd: destination floating-point register receiving the formatted result.
  • rs1/rs2: source floating-point registers; arithmetic/rounding forms with rm use rm or dynamic frm for 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

Rounding comes from the rm field; rm=111 uses the dynamic frm rounding mode.
rm=101 and rm=110 are reserved; with rm=111, a reserved frm value also has reserved behavior.
Floating-point exceptions are recorded in fflags, not as integer branch conditions or integer traps.
0/0, nonzero divided by zero, NaNs, and infinities follow IEEE 754/RISC-V floating-point result rules.

FAQ

Does the FDIV.Q animation model full quad-precision hardware?

No. The animation shows ISA-visible encoding, field decode, operand reads, example calculation, and fflags relationship; it does not show FPU pipelines, latency, or full quad-precision implementation details.

Where is the FDIV.Q divide-by-zero result recorded?

The result is written to FP destination rd, and FP exception flags accrue in fflags. Divide-by-zero does not become an integer exception or an integer branch condition.