Intel® High Level Synthesis Compiler Pro Edition: Reference Manual
A newer version of this document is available. Customers should click here to go to the newest version.
Visible to Intel only — GUID: hsi1468861028556
Ixiasoft
Visible to Intel only — GUID: hsi1468861028556
Ixiasoft
6.4. Loop Unrolling (unroll Pragma)
Example code:
#pragma unroll <N> for (int i = 0; i < M; ++i) { // Some useful work }
In this example, <N> specifies the unroll factor, that is, the number of copies of the loop that the HLS compiler generates. If you do not specify an unroll factor, the HLS compiler unrolls the loop fully when the number of loop iterations is known at compile time.
hls_register float data[N];
#pragma unroll 3
for (int i = 0; i < N; i++)
{
data[i] = function(i, a);
}
hls_register float data[N]; for (int i = 0; i < N; i += 3) { data[i + 0] = function(i + 0, a); if (i + 1 < N) { data[i + 1] = function(i + 1, a); } if (i + 2 < N) { data[i + 2] = function(i + 2, a); } }
You can find the unroll status of each loop in the high level design report (report.html).