HLS Wrapper XO Generator

This is an example of systemC TLM wrapper and XO generation for a given HLS kernel function.

KEY CONCEPTS: SystemC

KEYWORDS: create_sc_xo, ap_ctrl_none

The HLS kernel systemC wrapper enables TLM emulation using an existing HLS kernel. This utility generates the XO file (containing TLM wrappers) for the HLS kernel code.

Wrapper XO generation flow

  1. The user provides HLS code and corresponding JSON data for the HLS kernel

  2. During XO generation

    1. based on the kernel JSON data, hls2tlm.py util generates the TLM source files (which have TLM based implementation of HLS stream class)

    2. systemcwrapper2json util generates JSON data for packaging the wrapper

    3. gen_ip_package and gen_xo package the XO

  3. The packaged XO is generated

Input from the user

HLS Kernel Code - The user can provide the kernel code which follows XSC xtlm_ap_ctrl_none protocol and stream-type arguments (currently supports hls::stream, support for others to be added)

HLS Kernel JSON data - To define the HLS kernel in JSON spec fields like name of the kernel, argument name, argument size, argument type, etc are required.

Generating XO and TLM wrappers

To generate the TLM wrapper source and its XO do:

#create_sc_xo command in Makefile
cd xo_build
create_sc_xo <path-to-hls-kernel.cpp> <path-to-hls-kernel.json>

EXCLUDED PLATFORMS:

  • All Platforms with 2018 Version

  • AWS VU9P F1

  • Samsung U.2 SmartSSD

  • Embedded ZC702

  • All NoDMA Platforms, i.e u50 nodma etc

DESIGN FILES

Application code is located in the src directory. Accelerator binary files will be compiled to the xclbin directory. The xclbin directory is required by the Makefile and its contents will be filled during compilation. A listing of all the files in this example is shown below

src/host.cpp
src/increment.cpp
src/increment.h
src/mem_read.cpp
src/mem_write.cpp

Access these files in the github repo by clicking here.

COMMAND LINE ARGUMENTS

Once the environment has been configured, the application can be executed by

./hls_wrapper_xo_gen <krnl_incr XCLBIN>