Using a functional model of the Vitis HLS kernel during hardware emulation is an advanced use case that enables compilation of kernels in functional mode that generates the XO with the SystemC wrapper around the C code.
HW Emulation is mainly targeted for hardware kernel debug with detailed, cycle-accurate view of kernel activity. The functional (TLM) model speeds up emulation by compiling the kernel of interest in functional mode rather than as RTL code. This provides faster compile time for the kernel as it does not need full C to RTL synthesis, and faster execution time as C-code is simulated instead of RTL simulation. You can also mix and match of C and RTL kernels in hardware emulation for faster debug of RTL blocks.
The functional model feature supports modeling AXI4-Stream interfaces (axis
) only.
However, with this approach, the kernel will be purely functional without latency
information, unlike cycle-accurate models.
The user HLS function is wrapped into a SystemC module with TLM interfaces and IP is created out of the generated code which will allow generating HW_EMU compatible XO that can be used in IP integrator for stitching v++ link designs in HW Emulation flows. This also allows the Wrapper IP to talk to other RTL and SystemC models. So, the HLS C/C++ kernels compiled in functional mode will have TLM transactions during simulation and users can see traffic between the memory models (e.g. DDR) and the TLM kernels.
XO Generation with Functional Model
During the v++
compile step, while
creating the hardware emulation (hw_emu) XO files, you can provide a switch
describing the intention to do a functional simulation that will generate XO with
the SystemC wrapper on the C code. You need to provide an --advanced.param
option during compilation. This can be done by adding
the compiler option --advanced.param
compiler.emulationMode=func
as described in --advanced Options.
The generated XO is linked using the v++
--link
command same as the regular XO. For an example refer to https://github.com/Xilinx/Vitis_Accel_Examples/tree/master/emulation/stream_func_mode