FADD.S

RISC-V FADD.S Instruction Details

Instruction ManualR-type

Performs single-precision floating-point addition: rd = rs1 + rs2, rounded by the rm field or dynamic frm.

Instruction Syntax

fadd.s rd, rs1, rs2, rm
Operand Breakdown
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.
FFloating-Point Arithmetic

Instruction Behavior

FADD.S adds single-precision values in rs1 and rs2; result to rd. R-type using OP-FP opcode. Rounding by rm (static or dynamic from frm). IEEE 754 subnormal arithmetic supported.

FADD.S Decode And Execute Animation

Shows the F-extension single-precision OP-FP flow: decode fields, read FP operands, perform FADD semantics, then write rd.

rd
rs1
rs2
rm
fadd.s
,
,
,
Execution Context
FLEN=32 / fmt=S (00)
rounding: RNE nearest-even
fflags: example fflags remains 0
31..27
26..25
24..20
19..15
14..12
11..7
6..0
00000
FADD
00
fmt=S
01100
rs2
01011
rs1
000
rm
01010
rd
1010011
OP-FP
Execution Data Path
instruction
0x00C58553
opcode
1010011 -> OP-FP
funct5/fmt
00000 + S(00) -> FADD.S
rm
000 -> RNE nearest-even
rd/rs
fa0(f10) / fa1(f11) / fa2(f12)
read
1.5, 2.25
FP op
1.5 + 2.25 = 3.75
write
fa0(f10) = 3.75; example fflags remains 0
Current Step

Fetch: show the 32-bit OP-FP encoding

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

encoding: 0x00C58553
syntax : fadd.s fa0(f10), fa1(f11), fa2(f12), rne
result : fa0(f10) = 3.75; example fflags remains 0

The animation displays a teaching result from editable example values; final rounding and fflags follow the official RISC-V F rules.

Single-precision Calculation
rs1
fa1(f11) = 1.5
rs2
fa2(f12) = 2.25
result
1.5 + 2.25 = 3.75

The animation displays a teaching result from editable example values; final rounding and fflags follow the official RISC-V F rules.

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

FADD.S is an OP-FP arithmetic instruction from the RISC-V F extension. It reads two single-precision FP registers, rounds by rm/frm, writes the result to FP register rd, and records FP exceptions in fflags.

The .S suffix denotes the 32-bit single-precision floating-point format, using the F-extension OP-FP encoding.
The rm field selects a static rounding mode; rm=111 uses the dynamic frm rounding mode.
The add result may set fflags for invalid operation, overflow, underflow, or inexact results; NaN propagation itself follows the floating-point rules.

Common Usage Scenarios

Floating-point arithmetic

Understand this scenario with real code like «fadd.s f0, f1, f2 # f0 = f1+f2 (RNE)».

Numerical computing

Understand this scenario with real code like «fadd.s f0, f1, f2 # f0 = f1+f2 (RNE)».

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

rd, rs1, and rs2 are floating-point registers, not integer x registers.
The rm field or dynamic frm selects rounding; do not treat one exact example as a proof for every rounding mode.
Floating-point exceptions are recorded in fflags; integer-style arithmetic overflow traps are not used.

FAQ

Does it use integer or floating-point registers?

rd, rs1, and rs2 are floating-point register fields. Integer registers interact with FP data through conversion, move, or load/store instructions.

How does rm affect the result?

rm selects the rounding mode, or uses frm for the dyn encoding. For inexact results, the rounding mode affects the written value and may set fflags.

Do floating-point exceptions trap like integer exceptions?

The F extension records floating-point exception flags in fflags; this page does not describe them as integer condition codes or integer overflow traps.