When does rm matter for fcvt.h.wu?
When the integer value cannot be exactly represented in the destination floating-point format, rm or dynamic frm selects the rounding direction.
Convert an unsigned 32-bit integer to half-precision FP, rounding according to rm or frm.
rd selects FP f0–f31, including writable f0; rs1 selects integer x0–x31, reading the low 32 bits with x0 always zero; rs2 is a format selector, not a second source register.
32-bit OP-FP: funct5=11010, fmt=10, rs2=00001, opcode=1010011; no immediate.
RV32/RV64 Zfh; enable required extensions and FP state. Optional rm defaults to dyn, using frm; static 101/110 and dynamic frm=101–111 have reserved behavior.
Integer sources need no NaN-boxing. An H result gets upper ones when FLEN>16. Applicable exceptions accrue in fflags; setting a flag does not itself cause an FP trap.
fcvt.h.wu converts the unsigned 32-bit integer in x[rs1] to a half-precision result in f[rd]. Its OP-FP encoding uses funct5=11010, fmt=H (10), and rs2=WU (00001); an inexact result rounds according to rm or dynamic frm and records applicable fflags.
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.
Leave rm empty for the assembly default dyn (111); this DYN example fixes frm=RNE. Use lowercase rne/rtz/rdn/rup/rmm/dyn only.
Assume required extensions and FP state are enabled, applicable source NaN-boxing is valid, and initial fflags=0. Results preview the current input; Writeback represents commit.
The word is split as an R-type OP-FP instruction; FCVT uses opcode 1010011.
The current 32-bit integer example overflows the half-precision finite range; rm selects infinity or the same-sign maximum finite value, and the example sets OF|NX.
The current 32-bit integer example overflows the half-precision finite range; rm selects infinity or the same-sign maximum finite value, and the example sets OF|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.
fcvt.h.wu converts an unsigned 32-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].
Understand this scenario with real code like «fcvt.h.wu f10, x11, rne # f10 = 4096; NX; Zfh/FP state enabled; x11 = 4097».
When the integer value cannot be exactly represented in the destination floating-point format, rm or dynamic frm selects the rounding direction.
Round according to rm/frm and set NX. Overflow produces a signed infinity or maximum finite value according to the rounding direction and sets OF|NX. The H result is NaN-boxed.