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:
- Tcl Script Mode
- GUI Mode
Tcl Script Mode
Each configuration of all functions in L1 are provided with TCL script which can be run through the available Makefile.
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 CSIM=< 1/0 > CSYNTH=< 1/0 > COSIM=< 1/0 > VIVADO_IMPL=< 1/0 >
GUI Mode
Use the following steps to operate the HLS Standalone Mode using GUI:
- Open a terminal and update the LD_LIBRARY_PATH to point to OpenCV lib folder.
- From the same terminal, open Vitis HLS in GUI mode and create a new project
- Specify the name of the project. For example - Dilation.
- Click Browse to enter a workspace folder used to store your projects.
- Click Next.
- 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).
- Click Next.
- Under the test bench section add tb.cpp.
- Click Next.
- Select the clock period to the required value (10ns in example).
- Select the suitable part. For example,
xczu9eg-ffvb1156-2-i
. - Click Finish.
- Right click on the created project and select Project Settings.
- In the opened tab, select Simulation.
- Files added under the Test Bench section will be displayed. Select a file and click Edit CFLAGS.
- Enter
-I<path-to-L1-include-directory> -std=c++0x -I<path-to-opencv-include-folder>
. - 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
- Select Synthesis and repeat the above step for all the displayed files. Do not add opencv include path here.
- Click OK.
- Run the C Simulation, select Clean Build and specify the required input arguments.
- Click OK.
- All the generated output files/images will be present in the solution1->csim->build.
- Run C synthesis.
- Run co-simulation by specifying the proper input arguments.
- 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:
- Functions with multiple accelerators are not supported.
- Compiler and simulator are default in HLS (gcc, xsim).
- 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.
- The maximum image size (HEIGHT and WIDTH) set in config.h file should be equal to the actual input image size.