3.6.3.22 SHLS-41

Message

Error:   (SHLS-41) The dataflow subfunction '{function}' cannot both read and write to FIFO '{variable}'.
/*****************************************************************
 *  This example is expected to result in
 *  - Code  : SHLS-41
 *  - Type  : Error
 *  - Cause : The dataflow fifo channel 'tmp' in DUT() will be
 *            both read and written by the first invocation of
 *            subfunction subf().
 *****************************************************************/    
#define NELEM 10  

void subf(int in[NELEM], int out[NELEM]) {
#pragma HLS loop pipeline
    for (int i = 0; i < NELEM; i++) {
        // read from 'in'
        out[i] = in[i] + 1;
    }
    // write to 'in'
    in[0] = 0;
}

void DUT(int in[NELEM], int out[NELEM]) {
#pragma HLS function top dataflow

#pragma HLS dataflow_channel variable(tmp) type(fifo)
    int tmp[NELEM];

    subf(in, tmp);
    subf(tmp, out);
}

Related to: Data Flow Parallelism, Streaming Library