Description
Transforms loops by creating multiples copies of the loop body.
The loop induction variable specifies the number of iterations the loop executes. Logic inside the loop body (for example, break or modifications to any loop exit variable) also impacts the number of iterations. A block of logic representing the loop body implements the loop in RTL. The logic executes for the same number of iterations.
The syn.directive.unroll command allows partial or
full unrolling of the loop. Fully unrolling the loop creates as many copies of the
loop body in the RTL as there are loop iterations. Partially unrolling a loop by a
factor N, creates N copies of the loop body and adjusting the loop iteration
accordingly.
If factor N for partial unrolling is not an integer multiple of the original loop iteration count, check the original exit condition after each loop body's unrolled fragment.
To unroll a loop completely, the loop bounds must be known at compile time. This is not required for partial unrolling.
Syntax
syn.directive.unroll=[OPTIONS] <location>
-
<location>is the location of the loop (in theformat function[/label]) to be unrolled.
Options
-
factor=<integer> - Specifies a non-zero integer indicating that partial
unrolling is requested.
The loop body repeats the integer number of times. The iteration information adjusts accordingly.
-
skip_exit_check - Effective only if a factor is specified (partial unrolling).
- Fixed bounds
Does not perform exit condition check if the iteration count is a multiple of the factor.
If the iteration count is not an integer multiple of the factor, the tool:
- Prevents unrolling.
- Issues a warning that the exit check is required to proceed.
- Variable bounds
The exit condition check is removed. You must ensure that:
- The variable bounds is an integer multiple of the factor.
- Requires no exit check.
- Fixed bounds
-
off=true - Disables unroll for the specified loop.
Examples
Unrolls loop L1 in function foo. Places the pragma in the body of loop L1.
syn.directive.unroll=foo/L1
Specifies an unroll factor of 4 on loop L2 of function foo. Removes
the exit check. Place the pragma in the body of loop L2.
syn.directive.unroll=skip_exit_check factor=4 foo/L2