PIPO and hls::Stream_of_Blocks - PIPO and hls::Stream_of_Blocks - WP554

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

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

In the situations where the data is being transferred is not purely sequential, Parallel-in-parallel-out (PIPOs) allow data to be passed between a producer and consumer in any order. Two buffers large enough to store the data are used for the data transfer. The producer obtains access to one of the buffers, writes to it, then cedes control of the buffer. The consumer then can use the same process to read the data from the buffer. By swapping control of the two buffers back and forth, the computation can continue without stalling.

Figure 1. Parallel In Parallel Out Channel

The hls::Stream_of_blocks library can be used instead of the hls::stream library for processing non-sequential data. As seen in the following code example, the stream of blocks channel is divided into fixed size blocks, which can be accessed through read and write.

void funcB(hls::stream_of_blocks<block_data_t> &in, 
      hls::stream_of_blocks<block_data_t> &out) {
for(int i = 0; i <N/NUM_BLOCKS; i++) {
  hls::read_lock<block_data_t> inL(in);
  hls::write_lock<block_data_t> outL(out);
  for (unsigned int j = 0; j <NUM_BLOCKS; j++)
   outL[inL[j]] = j + 25;
  }
}