3.6.6.3 Pragmas

Vitis HLS / Vivado HLSSmartHLS
aggregate, data_packSee the 3.6.1.21 Struct Variable/Argument Packing pragmas.
allocation

A global constraint of operation resources can be set via 3.6.2.2.8 set_resource_constraint; constraining the operation resource within a function, a loop or a block of code is not yet available.

Functions that are not inlined (automatically by SmartHLS tool or specified via the 3.6.1.5 Inline Function pragma) always have a single RTL module instance in hardware, and it is shared by all callers. Replication of a function instance in hardware can be achieved by the 3.6.1.7 Replicate Function and 3.6.1.5 Inline Function pragmas. In the case of multi-threading, each thread of a function creates an instance of the corresponding RTL module.

array_partition

See the 3.6.1.23 Partition Top-Level Interface and 3.6.1.22 Partition Memory pragmas.

If the variable is globally/locally declared variable, move the pragma to right before the variable declaration.

If the variable is a top-level function argument, add the pragma to the beginning of the function definition block.

Example:

VHLS: #pragma HLS array_partition variable=<VAR> <TYPE> dim=<DIM>

If <VAR> is a global/local declared variable, use #pragma HLS memory partition variable(<VAR>) type(<TYPE>) dim(<DIM>) + move it to right before the <VAR> variable declaration.

If <VAR> is a top-level function argument, use #pragma HLS memory partition argument(<VAR>) type(<TYPE>) dim(<DIM>) + add it add the beginning of the function definition block.

SmartHLS supports complete memory partitioning in either 1 or all dimensions, while Vitis HLS can apply complete memory partitioning in more than 1 discrete dimensions. To port such case, users may need to reshape the array. Below is an example.

VHLS:

ap_uint<12> buffer[DIM_X][DIM_Y][DIM_Z];
#pragma HLS_ARRAY_PARTITION variable=buffer complete dim=1
#pragma HLS_ARRAY_PARTITION variable=buffer complete dim=2
// Access macro of 'buffer'
#define BUFFER(x,y,z)  (buffer[x][y][z])
SHLS:
#pragma HLS memory partition variable(buffer) type(complete) dim(1)
ap_uint<12> buffer[DIM_X*DIM_Y][DIM_Z];
// Access macro of 'buffer'
#define BUFFER(x,y,z)  (buffer[(x)*DIM_Y+(y)][z])
dataflowData Flow Parallelism and Multi-threading can be used to implement a task-level (dataflow) pipeline.
disaggregateSee the struct_fields option of the 3.6.1.23 Partition Top-Level Interface pragma.
expression_balanceSee 3.6.2.4.2 LATENCY_REDUCTION Tcl settings to control the expression balance optimization.
function_instantiateThe equivalent optimization can be achieved with the 3.6.1.5 Inline Function pragma or C++ template functions.
inlineSee the 3.6.1.5 Inline Function pragma.
inline offSee the 3.6.1.6 Noinline Function pragma.
interfaceSee Top-Level RTL Interface for details about supported interfaces and corresponding pragmas.
loop_tripcount

See the 3.6.1.4 Bound Loop pragma, and lift it out of the loop. Note that SmartHLS does not capture the average number of loop iterations.

Example:

VHLS: #pragma HLS loop_tripcount min=<MIN> max=<MAX> avg=<AVG>

SHLS: #pragma HLS loop bounds lower(<MIN>) upper(<MAX>) + lift outside the loop

pipeline, pipeline II=<II>

See 3.6.1.10 Pipeline Function and 3.6.1.2 Pipeline Loop pragmas.

If inside a loop, the pragma should be lifted outside the loop.

If inside a function, add the pragma to the beginning of the function definition block.

pipeline offRemove since pipelining is not applied by default.
stableSee the stable option of the 3.6.1.13 Scalar Argument Interface pragma.
streamStreaming interface is implemented via the hls::FIFO Argument.
topSee the 3.6.1.9 Set Top-Level Function pragma.
unrollSee the 3.6.1.3 Unroll Loop pragma, and lift it outside the loop.

The SmartHLS tool currently does not support the following Vitis/Vivado HLS pragmas:

  • array_map
  • array_reshape
  • bind_op
  • bind_storage
  • dependence
  • disaggregate
  • latency
  • loop_flatten
  • loop_merge
  • occurrence
  • protocol
  • reset
  • shared