Streaming - 2022.2 English - UG1448

Vitis HLS Messaging (UG1448)

Document ID
UG1448
Release Date
2022-12-16
Version
2022.2 English

Description

Warning: ERROR: [HLS 214-244] in function 'toplevel(ap_uint<32>*, axis_stream*)': Failed to implement stream interface on variable 's'. Each array element of 's' must: (a) be accessed only once, (b) read or write the whole array element in one operation and (c) be accessed in sequential order. (test.cpp:16:14)

Explanation

Accessing and modifying parts of a stream element can cause Vitis HLS to issue this error. Consider the following example where parts of the stream element are directly accessed.

//////////// ORIGINAL ////////////
struct axis_stream{
  ap_uint<32> data;
  ap_uint<1> user;
  ap_uint<1> last;
};

void toplevel(ap_uint<32> in[4], axis_stream* s)
{
  #pragma HLS INTERFACE axis port=s

  for(int i=0; i < 4; i++){
    s->data = in[i];
    s->user = (i == 0)?1:0;
    s->last = (i == 3)?1:0;
    s++;
  }
}

//////////// RESOLUTION ///////////
// Use a temporary variable to do the setting and write the entire temporary element to the stream.
void toplevel(ap_uint<32> in[4], axis_stream* s)
{
    #pragma HLS INTERFACE axis port=s

    for(int i=0; i < 4; i++){
      axis_stream tmp;
      tmp.data = in[i];
      tmp.user = (i == 0)?1:0;
      tmp.last = (i == 3)?1:0;
      s[i] = tmp; 
    }
}