In the HLS Directive editor you can specify either of the following Destination settings:
- Source File
- The Vitis unified IDE inserts the directive directly into the C source file as a pragma.
- Config File
- The IDE inserts the directive into the HLS config file.
The following table describes the advantages and disadvantages of both approaches.
Directive Format | Advantages | Disadvantages |
---|---|---|
HLS Config File |
The Source code remains unchanged, while design exploration is handled through the config file entries. This approach is ideal for design exploration. |
If the C source files are transferred to a third-party or archived, the directives.tcl file must be included. The |
Source Code Pragma |
The optimization directives are embedded into the C source code. Ideal when the C sources files are shipped to a third-party as C IP. No other files are required to recreate the same results. Useful approach for directives that are unlikely to change, such as TRIPCOUNT and INTERFACE. |
If the optimization directives are embedded in the code, they are automatically applied to every HLS component that references that source code. |
When specifying values for pragma arguments, you can use literal values (for example, 1, 55, 3.14), or pass a macro using #define. The following example shows a pragma with literal values:
#pragma HLS ARRAY_PARTITION variable=k_matrix_val type=cyclic factor=5
This example uses defined macros:
#define E 5
#pragma HLS ARRAY_PARTITION variable=k_matrix_val type=cyclic factor=E