FIFO and hls::stream - FIFO and hls::stream - WP554

Vitis HLS: High-Performance Design Using Task-level Parallelism (WP554)

Document_ID
WP554
Release_Date
2023-08-23
Revision
v1.0 English

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.

Figure 1. First-In-First-Out Channel

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);
}