Loop Rewind - Exit Condition

Description

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

Explanation

Loop rewind optimization requires the loop to have only a single return statement. The following code shows a violation:

Top (...)
...
    decoderInput_whileloop:while(1)
        {
    #pragma HLS PIPELINE II=1 rewind
            if(!inputStream.empty())
            {
                if(cnt==0)
                {
                     tempData.even = inputStream.read();
                     cnt =1;
                }
                else
                {
                    tempData.odd=inputStream.read();
                    pairedData.write(tempData);
                    cnt=0;
                    return 0;
                }
            }
            else
            {
                return 1;
 
            }
        }
...
}

Solution

The user code should only have a single return statement for the complete loop. Please rewrite the code which has a single return statement.