FMV.X.W

RISC-V FMV.X.W Instruction Details

Instruction ManualR-type

Bit-copy a single-precision floating-point encoding to an integer register.

Instruction Syntax

fmv.x.w rd, rs1
Operand Breakdown
rd: integer register x0–x31; x0 discards writes.
rs1: the only FP source f0–f31. 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.
FFloating-Point Bit Move

Extension condition: RV32/RV64; requires F 2.2. In the standard privileged architecture, accessing FP state with FS=Off raises an illegal-instruction exception.

Instruction Behavior

FMV.X.W bit-copies the single-precision floating-point encoding in f[rs1] into x[rd]; on RV64, bit 31 is copied into the upper 32 bits of the integer register. This is a bit move, not a floating-point-to-integer numeric conversion; it does not round and sets no floating-point exception flags.

FMV.X.W Decode And Execute Animation

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

rd
rs1
fmv.x.w
,
Execution Context
fmt=S (00)
FLEN>=32

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
11100
funct5=to-x
00
fmt=S
00000
rs2=00000
01011
rs1
000
funct3=000
01010
rd
1010011
OP-FP
Execution Data Path
instruction
0xE0058553
opcode
1010011 -> OP-FP
funct5/fmt
11100 + 00 -> funct7 1110000
rs2
00000 fixed for FMV.X.W
rd/rs1
a0(x10) / fa1(f11)
read bits
fa1(f11) = 0x40490FDB
bit move
copy 32-visible bits -> 0x40490FDB
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: 0xE0058553
syntax : fmv.x.w a0(x10), fa1(f11)
result : Not written yet
Bit-Pattern Move View
FP source bits
0x40490FDB
unchanged payload
0x40490FDB
writeback
Not written yet

On RV32, FMV.X.W writes the unchanged 32-bit encoding without numeric conversion.

This animation shows only F-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.X.W takes the 32-bit single-precision encoding from an FP register and writes it to an integer register. It preserves the raw bit pattern; on RV64 the integer result is filled in the upper 32 bits with bit 31, not zero-extended.

32-bit OP-FP encoding: funct7=1110000, rs2=00000, funct3=000, opcode=1010011; rs2 is a fixed selector, not an assembly operand.
The OP-FP encoding uses fmt=S and fixed fields to select the FMV.X.W bit-move form.
This is a bit-pattern move: it does not use rm, round, or set floating-point exception flags.
On RV64, the upper 32 bits of x[rd] are filled from source single-precision bit 31.
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

FP bit inspection

Understand this scenario with real code like «fmv.x.w x10, f0 # f0[31:0]=0x80000000 -> RV32: 0x80000000; RV64: 0xFFFFFFFF80000000».

NaN payload preservation

Understand this scenario with real code like «fmv.x.w x10, f0 # f0[31:0]=0x80000000 -> RV32: 0x80000000; RV64: 0xFFFFFFFF80000000».

raw encoding debugging

Understand this scenario with real code like «fmv.x.w x10, f0 # f0[31:0]=0x80000000 -> RV32: 0x80000000; RV64: 0xFFFFFFFF80000000».

Pre-Use Checklist

Syntax Check
  • rd: integer register x0–x31; x0 discards writes.
  • rs1: the only FP source f0–f31. 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 destination holds the encoding bit pattern; on RV64 the upper bits are sign-extended from bit 31, not a rounded integer value.

FAQ

Does FMV.X.W convert a float to an integer?

No. It copies the single-precision encoding bits; use FCVT.W.S or related FCVT instructions for numeric conversion.

What are the upper 32 bits on RV64?

The official rule copies source bit 31 into the upper 32 bits of the integer register, so the result can look like a sign-extended 64-bit bit pattern.