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.cpptab 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 view displayed in the
dct.cppsource file.When you change the
ARRAY_PARTITIONdirective for thecol_inbufvariable, the tool will return a Warning indicating that it cannot find thecol_inbufvariable, 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.cppfile after the definition of thecol_inbufvariable 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.cppcode is now portable and carries the optimizations you have completed within the code.To save the
dct.cppfile with the pragmas into the./vitis_hls_analysis/reference-filesfolder, select File > Save As. You can use the file in the next lab.