3.6.3.15 SHLS-27

Message

Error:   (SHLS-27) Dataflow function/subfunction '{function}' does not have void return type.
                   Dataflow functions currently must be of void type with outputs passed by pointer or reference.
/*****************************************************************
 *  This example is expected to result in
 *  - Code  : SHLS-27
 *  - Type  : Error
 *  - Cause : Non-void return type dataflow function
 *****************************************************************/
#define NELEM 10
int DUT(int s[NELEM], int v) {
#pragma HLS function top dataflow

  for (int i = 1; i < NELEM; i++) {
    if (s[i] < v)
      s[i] += s[i-1];
  }
  return s[NELEM-1];
}

Since a dataflow function or subfunction must have a void return type, it is recommended that users return values to the caller by using an additional pointer or reference argument. For instance, the previous example can be modified as shown below:

#define NELEM 10
void DUT(int s[NELEM], int v, int &result) {
#pragma HLS function top dataflow

  for (int i = 1; i < NELEM; i++) {
    if (s[i] < v)
      s[i] += s[i-1];
  }
  result = s[NELEM-1];
}

Related to: Data Flow Parallelism