Create and run a HLS project - 2023.1 English

Vitis Tutorials: Getting Started with Vitis and Vitis HLS

Document ID
XD098
Release Date
2023-06-20
Version
2023.1 English

In this step, we are going to create a HLS project by using the files provided in the 1Dfix_impluse example of L1 Vitis dsp library. The source files and script file are all located under this folder. Here, it is assumed that you have cloned the Vitis Libraries into /home/project/Vitis_Libraries directory.

  1. Go into the /home/project/Vitis_libraries/dsp/L1/examples/1Dfix_impluse folder and run the following command to create the HLS project.

 make run CSIM=1 CSYNTH=1 COSIM=1 XPART=xcvu9p-flgc2104-2-e

By executing the command, it runs through project creation, C synthesis, C simulation, and Co-simulation flow. You can modify the parameter to skip certain steps. Here, the xcvu9p part is used as an example, you can change it to other FPGA parts. Or you can use DEVICE keyword to specify an acceleration platform such as u250 Alveo platform. At the end of the flow, console window prints out the input and output data value and show PASS at the end of simulation.

...

===============================================================
--Input Impulse:
(1,0)
(0,0)
(0,0)
(0,0)
(0,0)
(0,0)
(0,0)
(0,0)
(0,0)
(0,0)
(0,0)
(0,0)
(0,0)
(0,0)
(0,0)
(0,0)
===============================================================
===============================================================
--Output Step fuction:
(1,0)
(1,0)
(1,0)
(1,0)
(1,0)
(1,0)
(1,0)
(1,0)
(1,0)
(1,0)
(1,0)
(1,0)
(1,0)
(1,0)
(1,0)
(1,0)
===============================================================
INFO: [COSIM 212-1000] *** C/RTL co-simulation finished: PASS ***

...

The testbench uses a single pulse signal as input to the FFT and the output should be a step signal. And these can be verified by looking at the values printed out to the screen.

  1. Open the project in Vitis HLS GUI. Enter the following command in /home/project/Vitis_libraries/dsp/L1/examples/1Dfix_impluse directory:

vitis_hls -p prj_impulse_test.prj &

You may browse into the source files, synthesis report, or waveform viewer by simply selecting them from the ‘Explorer’ window and ‘Flow Navigator’ window.

The top_module.cpp calls the FFT library and the parameters are defined in the data_path.hpp file. For detailed instructions on using the FFT library, refer to the Vitis Library Doc Portal.

  1. Export IP in HLS project

Now we have verified that the library IP is working properly and we will export it to an AMD Vivado™ IP. To do so, click the Export RTL from IMPLEMENTATION item in Flow Navigator. In the pop-up window, leave every setting unchanged and click OK to export the IP. By default, the IP is exported to the <project folder>/solutionN/impl, in this case, it is in following directory:

/home/project/Vitis_Libraries/dsp/L1/examples/1Dfix_impluse/prj_impulse_test.prj/solution1/impl

However, you can customize the path in the export pop-up menu.

In the next step, launch Vivado and create a top-level design to instantiate the exported IP. You can now close the Vitis HLS GUI.

  1. View Co-Simulation Waveform (optional)

You could modify the co-simulation related command lines in file ./run_hls.tcl (around line 48) as below to turn-on the xsim waveform dump switch:

...
if {$COSIM == 1} {
  cosim_design -wave_debug
}
...

Then re-run the command:

 make run COSIM=1 XPART=xcvu9p-flgc2104-2-e

In this way, you get the simulation waveform, such as the following example for a single SSR stream port:

../../_images/cosim_wave.png

Use the interface signals behavior in co-simulation waveform as a reference for the following Vivado simulation testbench.