The
config_compile -pipeline_loops
command enables loops to be
pipelined automatically based on the iteration count. All loops with a trip count
greater than the specified limit are automatically pipelined. The default limit is
64.
Given the following example code:
loop1: for (i = 0; i < 5; i++) {
// do something 5 times ...
}
If the -pipeline_loops
option is set to 4,
the for
loop (loop1
) will be
pipelined. This is equivalent to adding the PIPELINE pragma as shown in the
following code snippet:
loop1: for (i = 0; i < 5; i++) {
#pragma HLS PIPELINE II=1
// do something 5 times ...
}
However, for nested loops, the tool starts at the innermost loop, and
determines if it can be pipelined, and then moves up the loop nest. In the example
below, the -pipeline_loops
threshold is still 4,
and the inner most loop (loop1
) is marked to be
pipelined. Then the tool evaluates the parent loop of the loop pair (loop2
) and finds that it can also be pipelined. In
this case, the tool unrolls loop1
into loop2
, and marks loop2
to be pipelined. Then it moves up to the parent loop (loop3
) and repeats the analysis.
loop3: for (y = 0; y < 480; y++) {
loop2: for (x = 0; x < 640; x++) {
loop1: for (i = 0; i < 5; i++) {
// do something 5 times ...
}
}
}
If there are loops in the design for which you do not want to use
automatic pipelining, apply the PIPELINE directive with the off
option to that loop. The off
option prevents automatic loop pipelining.
config_compile
-pipeline_loops
command after performing all user-specified directives.
For example, if Vitis HLS applies a
user-specified UNROLL directive to a loop, the loop is first unrolled, and automatic
loop pipelining cannot be applied.