The Vitis HLS tool lets you specify C/C++ code for synthesis into Vitis core development kit kernels (
.xo) or RTL IP for implementation in the PL region of AMD devices. The first step in creating a new project is identifying the C/C++ source code for synthesis.
In this tutorial, you are working with a simple discrete cosine transform (DCT) algorithm that processes an input matrix of values, applies fixed coefficients, and returns a matrix of modified values. In the
reference_files/src folder, the
dct.cpp contains the top-level DCT function.
Enter the following command to launch Vitis HLS in GUI mode.
Vitis HLS opens.
Select File > New Project.
The New Vitis HLS Project wizard is displayed.
Create the Vitis HLS project type:
In the Project name field, enter
In the Location field, click Browse to select the location for the project.
The Add/Remove Files page of the New Project wizard displays.
Make the following selections:
Select Add Files to specify source files for the project.
Navigate to the ./reference-files/src folder location, and select dct.cpp.
In the Top Function field at the top of the New Project wizard, select the Browse… button to open the Select Top Function dialog box, as shown below.
Select the dct (dct.cpp) function and click OK.
The Add/Remove Testbench Files page of the New Project wizard displays.
Writing a good testbench can greatly increase your productivity because C functions execute in orders of magnitude faster than RTL simulations. Using C to develop and validate the algorithm before synthesis is much faster than developing and debugging RTL code. For more information, refer to Writing a Testbench in the Vitis HLS Flow of the Vitis Unified Software Platform Documentation (UG1416).
Select Add Files to specify the testbench, and additional files for the project.
Navigate to the
./reference-files/srcfolder, and select dct_test.cpp, in.dat and out.golden.dat.
dct_test.cppis a test bench for the design that iterates through the kernel multiple times.
in.datprovides the input values to be processed by the kernel.
out.golden.datprovides known output results to use for comparing the output of the dct function against.
The Solution Configuration page of the New Project wizard is opened as shown below.
The Solution Configuration creates and defines a solution which is a specific build configuration that the tool uses to build against. The solution includes definitions for the clock period, and clock uncertainty, and specifies a platform, with an AMD device, to build against. The solution provides you a framework for building your RTL code, and testing different optimizations by using different directives (possibly in different solutions).
Make the following selections:
Specify the Solution Name, or use the default name.
Specify the Period for the clock as the default period of 10 ns.
Leave the clock uncertainty blank. The default clock uncertainty, when it is not specified, is 27% of the clock period. For more information, refer to Specifying the Clock Frequency in the Vitis HLS Flow of the Vitis Unified Software Platform Documentation (UG1416).
For Part Selection accept the default value.
For Flow Target select the Vitis Kernel Flow Target from the dropdown menu.
This enables the creation of a Vitis application acceleration hardware kernel (.xo) as an output for the project. For more information on how enabling the Vitis kernel flow configures the default behavior of the tool, refer to Vitis HLS Flow Overview in the Vitis HLS Flow of the Vitis Unified Software Platform Documentation (UG1416).
With your project settings now configured, click Finish. Vitis HLS opens the new project in the default view.
You created the DCT project, targeted your AMD device or board, and configured the solution characteristics. You are ready to move to the next lab, Running Simulation, Synthesis and Analyzing Results.
Return to Main Page — Return to Start of Tutorial
Copyright © 2020–2023 Advanced Micro Devices, Inc