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]))
次のコマンドを使用して実行します。
cd hls_example
python run_hls_simple.py