Getting Started with HLS - 2023.2 English

Vitis Libraries

Release Date
2023-12-20
Version
2023.2 English

The Vitis vision library can be used to build applications in Vitis HLS. This section of the document provides steps on how to run a single library component through the Vitis HLS 2023.1 flow which includes, C-simulation, C-synthesis, C/RTL co-simulation, and exporting the RTL as an IP.

All the functions under L1 folder of the Vitis Vision library can be built through Vitis HLS flow in the following two modes:

  1. Command line Mode
  2. GUI Mode

Command line Mode

Each configuration of all functions in L1 are provided with a Makefile which can be run to create HLS project.

Open a terminal and run the following commands to set the environment and build :

source < path-to-Vitis-installation-directory >/settings64.sh

source < part-to-XRT-installation-directory >/setup.sh

export PLATFORM=< path-to-platform-directory >/< platform >.xpfm

export OPENCV_INCLUDE=< path-to-opencv-include-folder >

export OPENCV_LIB=< path-to-opencv-lib-folder >

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:< path-to-opencv-lib-folder >

make run TARGET=< csim / csynth / cosim/ vivado-impl >

GUI Mode

Use the following steps to operate the HLS Standalone Mode using GUI:

  1. Open a terminal and update the LD_LIBRARY_PATH to point to OpenCV lib folder.
  2. From the same terminal, open Vitis HLS in GUI mode and create a new project
  3. Specify the name of the project. For example - Dilation.
  4. Click Browse to enter a workspace folder used to store your projects.
  5. Click Next.
  6. Under the source files section, add the accel.cpp file which can be found in the examples folder. Also, fill the top function name (here it is dilation_accel).
  7. Click Next.
  8. Under the test bench section add tb.cpp.
  9. Click Next.
  10. Select the clock period to the required value (10ns in example).
  11. Select the suitable part. For example, xczu9eg-ffvb1156-2-i.
  12. Click Finish.
  13. Right click on the created project and select Project Settings.
  14. In the opened tab, select Simulation.
  15. Files added under the Test Bench section will be displayed. Select a file and click Edit CFLAGS.
  16. Enter -I<path-to-L1-include-directory> -std=c++0x -I<path-to-opencv-include-folder>.
  17. In the Linker Flags section, enter the opencv libs and path to the opencv libs -L<path-to-opencv-lib-folder> -lopencv_core -lopencv_imgcodecs -lopencv_imgproc
  18. Select Synthesis and repeat the above step for all the displayed files. Do not add opencv include path here.
  19. Click OK.
  20. Run the C Simulation, select Clean Build and specify the required input arguments.
  21. Click OK.
  22. All the generated output files/images will be present in the solution1->csim->build.
  23. Run C synthesis.
  24. Run co-simulation by specifying the proper input arguments.
  25. The status of co-simulation can be observed on the console.

Constraints for Co-simulation

There are few limitations in performing co-simulation of the Vitis vision functions. They are:

  1. Functions with multiple accelerators are not supported.
  2. Compiler and simulator are default in HLS (gcc, xsim).
  3. Since HLS does not support multi-kernel integration, the current flow also does not support multi-kernel integration. Hence, the Pyramidal Optical flow and Canny Edge Detection functions and examples are not supported in this flow.
  4. The maximum image size (HEIGHT and WIDTH) set in config.h file should be equal to the actual input image size.