set_directive_loop_tripcount

Description

The loop tripcount is the total number of iterations performed by a loop. Vitis HLS reports the total latency of each loop (the number of cycles to execute all iterations of the loop). This loop latency is therefore a function of the tripcount (number of loop iterations).

IMPORTANT: The LOOP_TRIPCOUNT pragma or directive is for analysis only, and does not impact the results of synthesis.

The tripcount can be a constant value. It may depend on the value of variables used in the loop expression (for example, x<y) or control statements used inside the loop.

Vitis HLS cannot determine the tripcount in some cases. These cases include, for example, those in which the variables used to determine the tripcount are:

  • Input arguments, or
  • Variables calculated by dynamic operation

In those cases, the loop latency might be unknown.

To help with design analysis that drives optimization, the set_directive_loop_tripcount command allows you to specify minimum, maximum, and average tripcounts for a loop. This allows you to see how the loop latency contributes to the total design latency in the reports.

Syntax

set_directive_loop_tripcount [OPTIONS] <location>
  • <location> is the location of the loop (in the format function[/label]) at which the tripcount is specified.

Options

-avg <integer>

Specifies the average number of iterations.

-max <integer>

Specifies the maximum number of iterations.

-min <integer>

Specifies the minimum number of iterations.

Examples

loop_1 in function foo is specified to have a minimum tripcount of 12, and a maximum tripcount of 16:
set_directive_loop_tripcount -min 12 -max 16 -avg 14 foo/loop_1

See Also