Loop Rewind - Initialization Section - 2020.2 English

Vitis HLS Messaging (UG1448)

Document ID
UG1448
Release Date
2020-11-24
Version
2020.2 English

Description

This message is to inform the user that the code is violating loop rewind optimization rules.

Explanation

For the loop rewind optimization to take place there should be no code from the start of the function and the begin of the loop. As shown in the below this will fail optimization.

void decoderInput(hls::stream<mag_type> &inputStream, hls::stream<dataPair> &pairedData)
{
    static count_type cnt;
    mag_type val, val_next = 0;
    dataPair tempData;
    int n=0;
        decoderInput_whileloop:while(1)
        {
    #pragma HLS PIPELINE II=1 rewind
            if(!inputStream.empty())
            {
                ...
                ...
                ...

Solution

Non-trivial code should not exist in-between Function entry and the for a loop -rewind optimization, Move this code inside the loop.