Home/Instructions/FCVT-H-LU
FCVT.H.LU

RISC-V FCVT.H.LU Instruction Details

Instruction ManualR-type

Convert an unsigned 64-bit integer to half-precision floating point [RV64]; rm or dynamic frm selects rounding when needed.

Instruction Syntax

fcvt.h.lu rd, rs1, rm
Operand Breakdown
Destination rd: register receiving the operation result.
Source rs1: register holding the first operand.
Source rs2: register holding the second operand.
ZfhFloating-Point Convert

Instruction Behavior

fcvt.h.lu converts an unsigned 64-bit integer source to a half-precision floating-point result. If the value is not exactly representable, the result is rounded according to rm and written to f[rd].

FCVT.H.LU Decode And Execute Animation

Shows the Zfh-extension FCVT flow: decode OP-FP fields, fmt/rs2 conversion selection, the rm rounding field, read the integer source, then write the floating-point destination.

rd
rs1
rm
fcvt.h.lu
,
,
Execution Context
fmt=H (10)
rs2=LU
rounding: RNE nearest-even
fflags: NX
RV64-only
31..27
26..25
24..20
19..15
14..12
11..7
6..0
11010
FCVT.H
10
fmt=H
00011
rs2=LU
01011
rs1
000
rm
01010
rd
1010011
OP-FP
Execution Data Path
instruction
0xD4358553
opcode
1010011 -> OP-FP
funct5/fmt
11010 + 10 -> FCVT.H.LU
rs2
00011 -> LU source
rm
000 -> RNE nearest-even
rd/rs1
fa0(f10) / a1(x11)
read
a1(x11) = 4097
convert
uint64 4097 -> H 4096.0
write
fa0(f10) = 4096.0; NX
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: 0xD4358553
syntax : fcvt.h.lu fa0(f10), a1(x11), rne
result : fa0(f10) = 4096.0; NX

The current 64-bit integer example is not exactly representable as H format, so the rounded example shows NX.

FCVT Conversion View
LU source
4097
conversion
uint64 4097 -> H 4096.0
writeback
fa0(f10) = 4096.0

The current 64-bit integer example is not exactly representable as H format, so the rounded example shows NX.

This animation shows only Zfh-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.h.lu converts an unsigned 64-bit integer source to a half-precision floating-point result. If the value is not exactly representable, the result is rounded according to rm and written to f[rd].

OP-FP opcode is 1010011; funct5=11010 denotes integer-to-FP FCVT and fmt=10 denotes an H destination.
rs2=00011 selects the LU unsigned 64-bit integer source; rs1 is an integer register and rd is an FP register.
L/LU 64-bit integer source forms are RV64-only.
The integer source operand comes from x[rs1], not a floating-point register, so there is no source NaN-boxing requirement.
The floating-point result is NaN-boxed in wider FLEN registers according to the destination format.
NX is set when rounding changes the result; half-precision range overflow also sets OF. rm=111 uses frm and reserved rm encodings are not normal animation input.

Common Usage Scenarios

Floating Point Basic

Understand this scenario with real code like «fcvt.h.lu f0, x10, rne # f0 = (half)(ulong)x10 (RV64)».

Numerical Computing

Understand this scenario with real code like «fcvt.h.lu f0, x10, rne # f0 = (half)(ulong)x10 (RV64)».

Pre-Use Checklist

Syntax Check
  • Verify rd, rs1, rs2 (and rs3) are valid GPRs.
  • Confirm funct3 and funct7 encoding is correct.
Semantic Check
  • Check if the result affects subsequent branches or address calculations.
  • Ensure the rd register is not overwritten by another instruction.

Pitfalls / Common Confusions

L/LU 64-bit integer source forms are RV64-only.
The integer source operand comes from x[rs1], not a floating-point register, so there is no source NaN-boxing requirement.
The floating-point result is NaN-boxed in wider FLEN registers according to the destination format.
If the rounded result differs from the integer source, the conversion sets NX; half-precision range overflow also sets OF. rm=111 uses frm, and reserved rounding encodings have reserved behavior.

FAQ

When does rm matter for fcvt.h.lu?

When the integer value cannot be exactly represented in the destination floating-point format, rm or dynamic frm selects the rounding direction.

How does fcvt.h.lu differ from related FCVT instructions?

It differs by source/destination format, integer signedness, RV64 restriction, and whether rm/frm rounding is needed; this form sets NX when rounding changes the result and OF on half-precision range overflow.