Loop Rewind - Initialization Section - 2022.1 English

Vitis HLS Messaging (UG1448)

Document ID
UG1448
Release Date
2022-06-22
Version
2022.1 English

Description

This message reports that the code is violating loop rewind optimization rules.

Explanation

Loop rewind optimization requires no code from the start of the function and the begin of the loop. The following 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.