Blocking Read Methods - 2023.2 English

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
Release Date
2023.2 English

This method reads from the head of the stream and assigns the values to the variable dst_var.

// Usage of void read(T &rdata)

hls::stream<int> my_stream;
int dst_var;;

Alternatively, the next object in the stream can be read by assigning (using for example =, +=) the stream to an object on the left-hand side:

// Usage of T read(void)

hls::stream<int> my_stream;

int dst_var =;

The >> operator is overloaded to allow use similar to the stream extraction operator for C++ stream (for example, iostreams and filestreams). The hls::stream is supplied as the LHS argument and the destination variable the RHS.

// Usage of void operator >> (T & rdata)

hls::stream<int> my_stream;
int dst_var;

my_stream >> dst_var;