MATLAB - MATLAB - 2026.2 English - UG1864

Vitis Functional Simulation User Guide (UG1864)

Document_ID
UG1864
Release_Date
2026-11-11
Version
2026.2 English

run_hls_simple.m

% Simple HLS VFS example: sum_of_four kernel (sums each block of 4 inputs).
here = fileparts(mfilename('fullpath'));

myfunc = vfs.hlsKernel( ...
    input_files=fullfile(here, "kernels.cpp"), ...
    hls_function="sum_of_four");

din  = varray.int32(int32(1:8));
dout = myfunc.run(din);

disp(int32(dout));                       % Expected: [10; 26]
assert(all(int32(dout) == [10; 26]));

Run it using the following command:

cd hls_example
source <Vitis_install_path>/settings64.csh
matlab -batch run_hls_simple