Python - Python - 2026.1 English - UG1864

Vitis Functional Simulation User Guide (UG1864)

Document_ID
UG1864
Release_Date
2026-06-23
Version
2026.1 English

run_hls_simple.py:

"""Simple HLS VFS example: sum_of_four kernel (sums each block of 4 inputs)."""
from pathlib import Path
import vfs
import varray as va
import numpy as np

here = Path(__file__).resolve().parent
myfunc = vfs.hlsKernel(
    hls_function="sum_of_four",
    input_files=str(here / "kernels.cpp"),
)

din = va.array(np.arange(1, 9, dtype=np.int32))
dout = myfunc.run(din)

print("Input :", np.arange(1, 9))
print("Output:", np.asarray(dout))
assert np.all(np.asarray(dout) == np.array([10, 26]))

Run it using the following command:

cd hls_example
python run_hls_simple.py