FMV.H.X

RISC-V FMV.H.X Instruction Details

Instruction ManualR-type

Bit-copy low integer-register bits into a half-precision floating-point register.

Instruction Syntax

fmv.h.x rd, rs1
Operand Breakdown
rd: FP register f0–f31; f0 is writable.
rs1: the only integer source x0–x31; x0 reads zero. No immediate or rm operand.
Encoded rs2=00000 is a fixed selector, not a second source; equally numbered x/f registers belong to different register files.
ZfhZfhminFloating-Point Bit Move

Extension condition: RV32/RV64; requires Zfh 1.0 or Zfhmin 1.0 (both depend on F). In the standard privileged architecture, accessing FP state with FS=Off raises an illegal-instruction exception.

Instruction Behavior

Provided by Zfh or Zfhmin (each depends on F), FMV.H.X bit-copies the low 16 bits of x[rs1] into f[rd] and NaN-boxes the half-precision result in the floating-point register. This is a bit move, not a numeric conversion.

FMV.H.X Decode And Execute Animation

Shows the Zfh/Zfhmin-extension FMV.H.X bit-pattern move: decode OP-FP fields, read the source bit pattern, then write the destination without numeric conversion.

rd
rs1
fmv.h.x
,
Execution Context
fmt=H (10)
FLEN>=32; H payload=16

Assumes required extensions and enabled FP state. Integer input covers XLEN bits; FP input supplies only the selected format's bit slice, ignoring upper NaN-box bits.

31..27
26..25
24..20
19..15
14..12
11..7
6..0
11110
funct5=to-f
10
fmt=H
00000
rs2=00000
01011
rs1
000
funct3=000
01010
rd
1010011
OP-FP
Execution Data Path
instruction
0xF4058553
opcode
1010011 -> OP-FP
funct5/fmt
11110 + 10 -> funct7 1111010
rs2
00000 fixed for FMV.H.X
rd/rs1
fa0(f10) / a1(x11)
read bits
a1(x11) = 0x0000C100
bit move
copy low 16 bits -> 0xC100; NaN-box upper 16 bits to all 1s
write
Not written yet
Current Step

Fetch: show the 32-bit OP-FP encoding

The word is split as an R-type OP-FP instruction; FMV bit moves use opcode 1010011.

encoding: 0xF4058553
syntax : fmv.h.x fa0(f10), a1(x11)
result : Not written yet
Bit-Pattern Move View
integer low bits
0x0000C100
unchanged payload
0xC100
writeback
Not written yet

FMV.H.X takes only the low 16 integer-source bits and NaN-boxes the half-precision result in the FP register.

This animation shows only Zfh/Zfhmin-extension FMV ISA-visible encoding and bit-pattern movement; it does not model FPU pipelines, numeric FP interpretation, exception handling, or microarchitecture.

Quick Understanding & Search Notes

FMV.H.X's core idea is bit-pattern movement. Use FCVT for numeric conversion and rounding; use FMV forms when preserving NaN payloads or inspecting raw encodings.

32-bit OP-FP encoding: funct7=1111010, rs2=00000, funct3=000, opcode=1010011; rs2 is a fixed selector, not an assembly operand.
FMV.H.X is provided by Zfh or Zfhmin; each depends on F.
FMV instructions do not use an rm field.
A bit move does not canonicalize NaNs or change the input according to numeric value.
FP transfers out ignore upper NaN-box bits; transfers in set all upper bits to 1 when FLEN exceeds the payload width.

Common Usage Scenarios

Floating-Point Bit Move

Understand this scenario with real code like «fmv.h.x f0, x10 # x10=0x1234C100; FLEN=64 -> f0=0xFFFFFFFFFFFFC100».

Debugging Bit Patterns

Understand this scenario with real code like «fmv.h.x f0, x10 # x10=0x1234C100; FLEN=64 -> f0=0xFFFFFFFFFFFFC100».

Pre-Use Checklist

Syntax Check
  • rd: FP register f0–f31; f0 is writable.
  • rs1: the only integer source x0–x31; x0 reads zero. No immediate or rm operand.
  • Encoded rs2=00000 is a fixed selector, not a second source; equally numbered x/f registers belong to different register files.
Semantic Check
  • Confirm this is bit copying, not floating/integer numeric conversion.
  • Confirm destination direction, sign-extension, or NaN-boxing rules for this FMV variant.

Pitfalls / Common Confusions

This is a bit copy, not an FCVT numeric conversion.
It does not use rm and does not set fflags.
The integer source provides only the low bits needed by the destination format.

FAQ

How is FMV.H.X different from FCVT?

FMV copies the bit pattern; FCVT performs numeric conversion, can round, and can set exception flags.

Does FMV.H.X set fflags?

No. It is neither arithmetic nor numeric conversion.