Now that you have your optimized design, you can transfer the directives from a Tcl script, which the Vitis HLS tool runs, to pragmas in the source code which can be shared to other users or design teams, and used within the Vitis unified software platform. Select the directives in the Directive view, and change them to pragmas using the following process.
Select the
dct.cpp
tab to make the Code Editor active, or open the source code if needed.Scroll through the Directives view, right-click any directives you see, and select the Modify Directive. This displays the Vitis HLS Directive Editor.
In the Directive Editor, change the Destination to Source File, and click OK. This changes the directive to a pragma written to the source code files, which you can see displayed in the
dct.cpp
source file.When you change the
ARRAY_PARTITION
directive for thecol_inbuf
variable, the tool will return a Warning indicating that it cannot find thecol_inbuf
variable, and will insert the pragma at the first line of the function. Select OK to insert the pragma as indicated.You must manually correct the placement of the pragma by cutting and pasting the
#pragma HLS ARRAY_PARTITION...
line into thedct.cpp
file after the definition of thecol_inbuf
variable on line 42. The pragma must be defined after the variable in order to be associated correctly by the compiler. If this is not done, Vitis HLS will return an error when trying to compile the code.With the directives converted to pragmas, the
dct.cpp
code is now portable and carries the optimizations you have completed within the code.To save the
dct.cpp
file with the pragmas into the./vitis_hls_analysis/reference-files
folder, select File > Save As. You can use the file in the next lab.