First-in-first-out (FIFO) channels allow the producer to write data to the channel, which can then be read by the consumer. FIFO’s only support sequential data transfer, while non-sequential data requires a different channel type.
In C/C++ code, the hls::stream behaves like an infinite-depth
FIFO. The class offers accessor functions to write to and read from the buffer. They are
templated to provide support for a wide variety of data types from simple data types
like integers and floating-point types, to complex data types such as arbitrary
precision or even user-defined structures. In addition, hls::stream
provides for the optional capability to define side-channel signals. The following code
example uses hls::stream. During synthesis, Vitis HLS infers a FIFO buffer for the channel.
void funcA(hls::stream<data_t> &in,
hls::stream<data_t> &out1
hls::stream<data_t> &out2 {
data_t t = in.read();
out1.write(t);
out2.write(t);
}