FCVT.S.H

RISC-V FCVT.S.H Instruction Details

Instruction ManualOP-FP

Convert half-precision FP to single-precision FP; widening conversion is exact and does not use rm.

Instruction Syntax

fcvt.s.h rd, rs1
Operand Breakdown
This is a OP-FP-format instruction. Confirm operand positions based on the assembly syntax.
ZfhZfhminFloating-Point Convert

Instruction Behavior

fcvt.s.h reads a half-precision source value from FP register rs1, converts it to a single-precision FP result, and writes FP register rd. In the OP-FP encoding, fmt=S (00) denotes the destination format and rs2=H (10) denotes the source format; this widening conversion is exact and has no rm assembly operand.

FCVT.S.H Decode And Execute Animation

Shows the Zfhmin-extension FCVT flow: decode OP-FP fields, fmt/rs2 conversion selection, an rm=000 encoding example, read the floating-point source, then write the floating-point destination.

rd
rs1
fcvt.s.h
,
Execution Context
fmt=S (00)
rs2=H
rounding: example rm=000; conversion never rounds
fflags: 0
31..27
26..25
24..20
19..15
14..12
11..7
6..0
01000
FCVT.S
00
fmt=S
00010
rs2=H
01011
rs1
000
rm=000 example
01010
rd
1010011
OP-FP
Execution Data Path
instruction
0x40258553
opcode
1010011 -> OP-FP
funct5/fmt
01000 + 00 -> FCVT.S.H
rs2
00010 -> H source
rm
000 -> example encoding; conversion never rounds
rd/rs1
fa0(f10) / fa1(f11)
read
fa1(f11) = H 1.25 (0x3D00)
convert
H 1.25 -> S 1.25
write
fa0(f10) = S 1.25 (0x3FA00000); 0
Current Step

Fetch: show the 32-bit OP-FP encoding

The word is split as an R-type OP-FP instruction; FCVT uses opcode 1010011.

encoding: 0x40258553
syntax : fcvt.s.h fa0(f10), fa1(f11)
result : fa0(f10) = S 1.25 (0x3FA00000); 0

H-to-S is a floating-point widening conversion; the current finite example is exact, does not need rm rounding, and leaves example fflags at 0.

FCVT Conversion View
H FP source
H 1.25 (0x3D00)
conversion
H 1.25 -> S 1.25
writeback
fa0(f10) = S 1.25 (0x3FA00000)

H-to-S is a floating-point widening conversion; the current finite example is exact, does not need rm rounding, and leaves example fflags at 0.

This animation shows only Zfhmin-extension FCVT ISA-visible encoding, source/destination register direction, rounding field, and example fflags; it does not model FPU pipelines, exception handling, NaN payloads, or microarchitecture.

Quick Understanding & Search Notes

fcvt.s.h is an FP-to-FP format conversion: rd and rs1 are FP registers, fmt encodes destination S, and rs2 encodes source H. The widening conversion is exact and does not use rm.

OP-FP opcode is 1010011; funct5=01000 denotes FP-to-FP format FCVT.
fmt=00 selects destination S (single-precision); rs2=10 selects source H (half-precision).
rd and rs1 are both FP registers; the rs2 field is a source-format selector, not an assembly operand.
The widening conversion is exact, requires no rounding, and has no rm in assembly syntax.
NaN-boxing applies to source checking and destination writeback in wider FLEN registers; the animation does not enumerate every NaN payload or special-value combination.

Common Usage Scenarios

Floating-Point Format Conversion

Understand this scenario with real code like «fcvt.s.h f0, f1 # f0 = (single-precision)(f1 as half-precision)».

Type Conversion

Understand this scenario with real code like «fcvt.s.h f0, f1 # f0 = (single-precision)(f1 as half-precision)».

Pre-Use Checklist

Syntax Check
  • Confirm the current instruction format is OP-FP.
  • Confirm the operand order matches the example.
Semantic Check
  • Ensure the destination register usage is compatible with the calling convention.
  • Confirm this is not the lower-level form of a pseudo-instruction expansion.

Pitfalls / Common Confusions

fmt=S selects the destination single-precision format; rs2=H selects the source half-precision format and is not a second source register.
This is a floating-point widening conversion with exact official semantics; do not add an rm operand in assembly syntax.
The FP source in a wider FLEN register must satisfy NaN-boxing; the result is NaN-boxed according to the destination format.
The animation shows finite checkable examples only; NaNs, infinities, overflow, underflow, and payload details follow the official manual text.

FAQ

Is rs2 a source register in fcvt.s.h?

No. The assembly syntax has rd, rs1 only; the encoded rs2 field selects the source H FP format.

When does fcvt.s.h use rm?

It does not. This widening conversion is exact and has no rm assembly operand.

How is fcvt.s.h different from integer FCVT forms?

In this form, both rd and rs1 are FP registers; W/WU/L/LU forms convert between integer and FP registers.