#include "xf_utils_hw/stream_shuffle.hpp"
template < int _INStrm, int _ONstrm, typename _TIn > void streamShuffle ( hls::stream <ap_uint <8*_ONstrm>>& order_cfg, hls::stream <_TIn> istrms [_INStrm], hls::stream <bool>& e_istrm, hls::stream <_TIn> ostrms [_ONstrm], hls::stream <bool>& e_ostrm )
Shuffle the contents from an array of streams to another.
Suppose we have an array of 3 streams for R-G-B channels correspondingly, and it is needed to shuffle B to Stream 0, R to Stream 1 and G to Stream 2. This module can bridge this case with the configuration 2, 0, 1
. Here, 2
is the source index for data B at destination index 0
, and 0
is the source index for data R at destination index 1
, and 1
is the source index for data G at destination index 2
.
The configuration is load once in one invocation, and reused until the end. This module supports up to 128 input streams, and works efficiently within 16.
If minus value is used as the source index, the corresponding stream will be filled with zero.
If a source index is specified twice, the behavior is undefined.
Parameters:
_INStrm | number of input stream. |
_ONstrm | number of output stream. |
_TIn | input type. |
order_cfg | the new order within the window. Each 8bit specifies the source stream for the corresponding output stream, starting from the stream with new order 0. |
istrms | input data streams. |
e_istrm | end flags for input. |
ostrms | output data streams. |
e_ostrm | end flag for output. |