Home/Instructions/FCVT-LU-S
FCVT.LU.S

RISC-V FCVT.LU.S Instruction Details

Instruction ManualR-type

RV64 single precision-to-unsigned 64-bit integer conversion, rounded by rm/frm and written to integer rd.

Instruction Syntax

fcvt.lu.s 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.
FFloating-Point Convert

Instruction Behavior

FCVT.LU.S is an RV64-only floating-point-to-integer conversion. It rounds the single precision value in f[rs1] according to rm to an unsigned 64-bit integer and writes x[rd]; inexact conversion sets NX, while NaN, infinity, or out-of-range input sets NV by the official invalid-conversion rule.

FCVT.LU.S Decode And Execute Animation

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

rd
rs1
rm
fcvt.lu.s
,
,
Execution Context
fmt=LU (00)
rs2=LU
rounding: RNE nearest-even
fflags: NX
31..27
26..25
24..20
19..15
14..12
11..7
6..0
11000
FCVT.LU
00
fmt=LU
00011
rs2=LU
01011
rs1
000
rm
01010
rd
1010011
OP-FP
Execution Data Path
instruction
0xC0358553
opcode
1010011 -> OP-FP
funct5/fmt
11000 + 00 -> FCVT.LU.S
rs2
00011 -> LU target
rm
000 -> RNE nearest-even
rd/rs1
a0(x10) / fa1(f11)
read
fa1(f11) = 42.75
convert
42.75 -> uint64 0x0000002B (43)
write
a0(x10) = 0x0000002B (43); NX
Current Step

Fetch: show the 32-bit OP-FP encoding

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

encoding: 0xC0358553
syntax : fcvt.lu.s a0(x10), fa1(f11), rne
result : a0(x10) = 0x0000002B (43); NX

The current example rounds to a 64-bit integer according to rm and shows NX because the source has a fractional part.

FCVT Conversion View
S FP source
42.75
conversion
42.75 -> uint64 0x0000002B (43)
writeback
a0(x10) = 0x0000002B (43)

The current example rounds to a 64-bit integer according to rm and shows NX because the source has a fractional part.

This animation shows only F-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.lu.s is an RV64-only FCVT.LU.S form: it reads a single precision FP register, rounds according to rm/frm to an unsigned 64-bit integer, and writes integer rd.

OP-FP opcode is 1010011; funct5=11000 denotes FP-to-integer FCVT.
fmt=00 denotes the single precision source format; rs2=00011 selects LU as the integer target, not a normal second source register.
rd is an integer register and rs1 is an FP register; NaN, infinity, or out-of-range inputs set NV by the official invalid-conversion rule.
This L/LU form is RV64-only; RV32 pages should not present it as an available instruction.

Common Usage Scenarios

Type Conversion

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

Pre-Use Checklist

Syntax Check
  • Confirm the current instruction format is R-type.
  • 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

L/LU forms are RV64-only; do not use them on RV32.
rd is an integer register and rs1 is an FP register; the rs2 field only selects the L/LU format.
NaN, infinity, or out-of-range input does not wrap like integer overflow; it sets NV by the official invalid-conversion rule.
NX is set when a fractional FP source is rounded to a different integer value.

FAQ

Is FCVT.LU.S available on RV32?

No. The official F/D conversion rules define the L/LU 64-bit integer forms as RV64-only.

Which register classes do rd and rs1 use in FCVT.LU.S?

This is an FP-to-integer conversion: rd is an integer register and rs1 is an FP register.

What does the rs2 field mean in FCVT.LU.S?

The rs2 field selects the LU unsigned 64-bit integer format; it is not a second source operand in assembly syntax.