The syn.compile.pipeline_loops
configuration
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 syn.compile.pipeline_loops
command
is set to 4, the for
loop (loop1
) is 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 syn.compile.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.
syn.compile.pipeline_loops
command after performing
all user-specified directives. For example, if a user-specified UNROLL directive to
a loop is applied, the loop is first unrolled and automatic loop pipelining can not
be applied as the loop is eliminated.pipeline_loops
threshold is set to 0, will turn off all
auto-pipelining (unless a pragma is added to a loop which overwrites that setting.)
And the examples shown always auto-pipeline regardless of the threshold setting.
When the tool does/does not auto-pipeline. - If a loop is innermost with an unknown trip count or tripcount >= threshold (or > I don't remember) or no loop above, it gets pipeline unless there is pipeline off.
- If a loop has a known tripcount < threshold and a loop above, check if it can be pipelined from above: for that, the loop above must only contain subloops that will also be unrolled (For example, with tripcount < threshold). If yes, the pipeline will be placed in this loop above.
- Actually, the same happens for the loop above, the cumulative tripcount is what counts. For example, the number of iterations that were unrolled, multiplied by the current tripcount, and this goes up until the threshold is reached.