Fixed Point (fi, cfi) - Fixed Point (fi, cfi) - 2026.2 English - UG1864

Vitis Functional Simulation User Guide (UG1864)

Document_ID
UG1864
Release_Date
2026-11-11
Version
2026.2 English
# Signature: va.fi(sign=0, width=32, fraction=0)
#   sign     : 0 (unsigned) or 1 (signed)
#   width    : total bit width
#   fraction : number of fractional bits
fi_type  = va.fi(sign=1, width=16, fraction=8)
data     = va.array([1.5, 2.25, -3.75], dtype=fi_type)

# String form (same arguments):
data     = va.array([1.5, 2.25, -3.75], dtype="fi(1, 16, 8)")

# Defaults (signed=0, width=32, fraction=0):
data     = va.array([1, 2, 3], dtype=va.fi)     # bare, no call
data     = va.array([1, 2, 3], dtype="fi")      # string, no args

# Complex fixed-point:
cfi_type = va.cfi(sign=1, width=16, fraction=8)
cdata    = va.array([1.5+2j, 2.25+3.5j], dtype=cfi_type)

fi.itemsize is the smallest power-of-two byte width that holds width bits, so va.fi(1, 17, 0).itemsize is 4 bytes (not 3). cfi.itemsize is 2 * fi.itemsize for the same width. Read a.dtype.itemsize at runtime for the exact value, or use va.itemsize(...) to look it up directly from a dtype string.

This power-of-two itemsize is the storage size, and it is what the bytes property reports. It can exceed the logical width: fi(0, 48, 0) holds 48 logical bits (6 bytes of information) but .bytes returns 8 bytes. Refer to Array Properties for details.