Vitis HLS pragmas and directives let you configure the synthesis results for your code.
- HLS Pragmas are added to the source code to enable the optimization or change in the original source code. Every time the code is synthesized, it is implemented according to the specified pragmas.
Optimization Directives, or the
set_directivecommands, can be specified as Tcl commands that are associated with a specific solution, or set of solutions. Allowing you to customize the synthesis results for the same code base across different solutions.
To add pragmas or directives to your project:
- In the Explorer view of the Vitis HLS IDE, double-click the code file under the Source folder to open the Code Editor dialog box, the Outline view, and the Directive view.
- Use the Directive view to add pragmas to your source code. This
view helps you add and manage pragmas and directives for your project, and it
ensures that the pragmas are correct and applied in the proper location. To use this
Note: To view information related to a selected directive, click Help.
- With your source code open, select the Directive view tab to locate the function, loop, or feature
of the code to add a pragma or directive to.
Vitis HLS applies directives to the appropriate scope for the object currently selected in the Directive view.
- Right-click an object in the Directive view to use the Insert Directive command. The
Vitis HLS Directive
Editor opens, as shown in the following
- Review the Vitis HLS
Directive Editor dialog box. It includes the
- Specifies the directive or pragma to apply. This is a drop-down menu that lets you choose from the list of available directives.
- Specifies that a pragma should be added to the source file, or that a
set_directivecommand should be added to a Tcl script, the directive file, associated with the active solution.Tip: If your project only has one solution then it is always active. However, if you have multiple solutions you will need to ensure the desired solution is active in the project. Right-click the solution in the Explorer view of the project and click the Set Active Solution command. Refer to Creating Additional Solutions for details on adding solutions.
- Lists various configurable options associated with the currently selected directive.
- Click OK to apply the pragma or directive.
- With your source code open, select the Directive view tab to locate the function, loop, or feature of the code to add a pragma or directive to.