HLS half vs. float16 - HLS half vs. float16 - 2026.1 English - UG1864

Vitis Functional Simulation User Guide (UG1864)

Document_ID
UG1864
Release_Date
2026-06-23
Version
2026.1 English

va.half / va.chalf mirror the Vitis HLS half C++ type. Use them when your HLS kernel declares ports as half or std::complex<half>. va.float16 is generic IEEE 754 binary16 for kernels that take ap_fixed or similar storage types. The two go through different conversion paths and might differ by ±1 ULP on edge cases.

input_data = np.array(range(-15, 16), dtype=np.float16)
va.array(input_data, va.half)    # for HLS 'half' ports

re = np.array(range(-15, 16), dtype=np.float16)
im = np.array(range(1, 32), dtype=np.float16)
va.array((re + 1j * im).astype(np.complex64), va.chalf)