Loop Rewind - Initialization Section - 2023.2 English

Vitis HLS Messaging (UG1448)

Document ID
UG1448
Release Date
2023-10-18
Version
2023.2 English

Description

Warning: [200-959] Unable to rewind loop %s: initialization section preceding the loop contains control flow.
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.