API Functions of xf::common::utils_hw

axiToMultiStream

#include "xf_utils_hw/axi_to_multi_stream.hpp"
template <
    int _BurstLen,
    int _WAxi,
    typename _TStrm0,
    typename _TStrm1,
    typename _TStrm2
    >
void axiToMultiStream (
    ap_uint <_WAxi>* rbuf,
    hls::stream <_TStrm0>& ostrm0,
    hls::stream <bool>& e_ostrm0,
    hls::stream <_TStrm1>& ostrm1,
    hls::stream <bool>& e_ostrm1,
    hls::stream <_TStrm2>& ostrm2,
    hls::stream <bool>& e_ostrm2,
    const int len [3],
    const int offset [3]
    )

Loading multiple categories of data from one AXI master to streams.

Transform AXI transaction into multiple data stream.

This primitive assumes the width of AXI port is multiple of alignment width. When alignment width is less than AXI port width, the AXI port bandwidth will not be fully used.

AXI port width and width of each type are assumed to be multiple of 8. It is assumed that the data width in bits is 8 * sizeof(T) , and data type can be casted from raw bits of matching width.

This module assumes the data is tightly packed, so that the begining of Type 2 data may be placed in one AXI port row with the end of Type 1 data.

AXI word [ elements of Type 1 ........................................ ]
AXI word [ elements of Type 1 ..... end | begin elements of Type 2 ... ]
AXI word [ elements of Type 2 ........................................ ]

Notice: argument len and offset requires array_partition pragma at its defination loaction

Parameters:

_BurstLen burst length.
_WAxi width of AXI port, must be power of 2 and between 8 to 512.
_TStrm0 first stream’s type.
_TStrm1 second stream’s type.
_TStrm2 third stream’s type.
rbuf input AXI master port.
ostrm0 output stream of type 0.
e_ostrm0 end flag for output stream of type 0.
ostrm1 output stream of type 1.
e_ostrm1 end flag for output stream of type 1.
ostrm2 output stream of type 2.
e_ostrm2 end flag for output stream of type 2.
len length of data in byte requested for each type.
offset offset for each type, in number of bytes.

axiToStream

#include "xf_utils_hw/axi_to_stream.hpp"
template <
    int _BurstLen = 32,
    int _WAxi,
    typename _TStrm
    >
void axiToStream (
    ap_uint <_WAxi>* rbuf,
    const int num,
    hls::stream <_TStrm>& ostrm,
    hls::stream <bool>& e_ostrm
    )

Loading data elements from AXI master to stream.

This module requires the data elements to align to its size in buffer. In another word, the start offset is specified by element count from the beginning of a vector of AXI port width.

This primitive assumes the width of AXI port is positive integer multiple of data element’s alignment width.

The alignment width is assumed to be multiple of 8-bit char. The AXI master port width is power of two, and no less than 8.

Parameters:

_BurstLen burst length of AXI buffer, default is 32.
_WAxi width of AXI port, must be power of 2 and between 8 to 512.
_TStrm stream’s type, e.g. ap_uint<aligned_width> for a aligned_width stream.
rbuf input AXI port.
num number of data elements to load from AXI port.
ostrm output stream.
e_ostrm end flag for output stream.

axiToCharStream

#include "xf_utils_hw/axi_to_stream.hpp"
template <
    int _BurstLen = 32,
    int _WAxi,
    typename _TStrm
    >
void axiToCharStream (
    ap_uint <_WAxi>* rbuf,
    hls::stream <_TStrm>& ostrm,
    hls::stream <bool>& e_ostrm,
    const int len,
    const int offset = 0
    )

Loading char data from AXI master to stream.

This primitive relaxes the alignment requirement, and actually load data by 8-bit char. The 8-bit chars are packed as output stream wide word. The last word may contain invalid data in high-bits if enough char has already been packed.

The alignment width is assumed to be multiple of 8-bit char. The AXI master port width is power of two, and no less than 8.

+-----------------------------------------------------------------+
| DDR  -> AXI_BUS                           -> FIFO     -> stream |
| XXX1    XXX1234567812345_6781234567812345    XXX12345    1234   |
| ...     ...                                  67812345    5678   |
|                                              ...         ...    |
| 32XX    6780000321XXXXXX_XXXXXXXXXXXXXXXX    21XXXXXX    21XX   |
+-----------------------------------------------------------------+

Parameters:

_BurstLen burst length of AXI buffer, default is 32.
_WAxi width of AXI port, must be power of 2 and between 8 to 512.
_TStrm stream’s type.
rbuf input AXI port.
ostrm output stream.
e_ostrm end flag for output stream.
len number of char to load from AXI port.
offset offset from the beginning of the buffer, in number of char.

axiToStream

#include "xf_utils_hw/axi_to_stream.hpp"
template <
    int _BurstLen = 32,
    int _WAxi,
    typename _TStrm
    >
void axiToStream (
    ap_uint <_WAxi>* rbuf,
    const int num,
    hls::stream <_TStrm>& ostrm
    )

Loading data elements from AXI master to stream.

This module requires the data elements to align to its size in buffer. In another word, the start offset is specified by element count from the beginning of a vector of AXI port width.

This primitive assumes the width of AXI port is positive integer multiple of data element’s alignment width.

The alignment width is assumed to be multiple of 8-bit char. The AXI master port width is power of two, and no less than 8.

Parameters:

_BurstLen burst length of AXI buffer, default is 32.
_WAxi width of AXI port, must be power of 2 and between 8 to 512.
_TStrm stream’s type, e.g. ap_uint<aligned_width> for a aligned_width stream.
rbuf input AXI port.
num number of data elements to load from AXI port.
ostrm output stream.
e_ostrm end flag for output stream.

makeMux

#include "xf_utils_hw/multiplexer.hpp"
template <
    MuxSide S,
    int W
    >
Multiplexer <S, W> makeMux (hls::stream <ap_uint <W>>& p)

Create Multiplexer object with FIFO width inferred.

Parameters:

S side of FIFO, must be provide by user.
W width of FIFO, can be inferred.
p FIFO to be wrapped.

Returns:

Multiplexer object

streamCombine

streamCombine overload (1)

#include "xf_utils_hw/stream_combine.hpp"
template <
    int _WIn,
    int _NStrm
    >
void streamCombine (
    hls::stream <ap_uint <_NStrm>>& select_cfg,
    hls::stream <ap_uint <_WIn>> istrms [_NStrm],
    hls::stream <bool>& e_istrm,
    hls::stream <ap_uint <_WIn*_NStrm>>& ostrm,
    hls::stream <bool>& e_ostrm,
    LSBSideT alg
    )

Combine multiple streams into one, shift selected streams to LSB side.

The first selected stream will be copied to LSB. The data within the stream will not change the bit-order.

Parameters:

_WIn input stream width.
_NStrm number of input streams.
select_cfg one-hot encoded selection, LSB for istrms[0].
istrms input data streams.
e_istrm end flag for all input streams.
ostrm output data stream.
e_ostrm end flag stream for output data.
alg algorithm selector for this function.

streamCombine overload (2)

#include "xf_utils_hw/stream_combine.hpp"
template <
    int _WIn,
    int _NStrm
    >
void streamCombine (
    hls::stream <ap_uint <_NStrm>>& select_cfg,
    hls::stream <ap_uint <_WIn>> istrms [_NStrm],
    hls::stream <bool>& e_istrm,
    hls::stream <ap_uint <_WIn*_NStrm>>& ostrm,
    hls::stream <bool>& e_ostrm,
    MSBSideT alg
    )

Combine multiple streams into one, shift selected streams to MSB side.

The first selected stream will be copied to MSB. The data within the stream will not change the bit-order.

Parameters:

_WIn input stream width.
_NStrm number of input streams.
select_cfg one-hot encoded selection, LSB for istrms[0].
istrms input data streams.
e_istrm end flag for all input streams.
ostrm output data stream.
e_ostrm end flag stream for output data.
alg algorithm selector for this function.

streamCombine overload (3)

#include "xf_utils_hw/stream_combine.hpp"
template <
    int _WIn,
    int _WOut,
    int _NStrm
    >
void streamCombine (
    hls::stream <ap_uint <_WIn>> istrms [_NStrm],
    hls::stream <bool>& e_istrm,
    hls::stream <ap_uint <_WOut>>& ostrm,
    hls::stream <bool>& e_ostrm,
    LSBSideT alg
    )

Combine multiple streams into a wide one, align to LSB.

The first selected stream will be copied to LSB. The data within the stream will not change the bit-order.

If _WOut > _WIn * _NStrm , extra bits will be filled with zeros.

Parameters:

_WIn input stream width.
_WOut output stream width, should be no less than _WIn * _NStrm.
_NStrm number of input streams.
istrms input data streams.
e_istrm end flag for all input streams.
ostrm output data stream.
e_ostrm end flag stream for the output.
alg algorithm selector for this function.

streamCombine overload (4)

#include "xf_utils_hw/stream_combine.hpp"
template <
    int _WIn,
    int _WOut,
    int _NStrm
    >
void streamCombine (
    hls::stream <ap_uint <_WIn>> istrms [_NStrm],
    hls::stream <bool>& e_istrm,
    hls::stream <ap_uint <_WOut>>& ostrm,
    hls::stream <bool>& e_ostrm,
    MSBSideT alg
    )

Combine multiple streams into a wide one, align to MSB.

The first selected stream will be copied to MSB. The data within the stream will not change the bit-order.

If _WOut > _WIn * _NStrm , extra bits will be filled with zeros.

Parameters:

_WIn input stream width.
_WOut output stream width, should be no less than _WIn * _NStrm.
_NStrm number of input streams.
istrms input data streams.
e_istrm end flag for all input streams.
ostrm output data stream.
e_ostrm end flag stream for the output.
alg algorithm selector for this function.

streamDiscard

streamDiscard overload (1)

#include "xf_utils_hw/stream_discard.hpp"
template <
    typename _TIn,
    int _NStrm
    >
void streamDiscard (
    hls::stream <_TIn> istrms [_NStrm],
    hls::stream <bool> e_istrms [_NStrm]
    )

Discard multiple streams with end flag helper for each.

Parameters:

_TIn streams’ type
_NStrm the number of streams
istrms input streams
e_istrms end flag of streams

streamDiscard overload (2)

#include "xf_utils_hw/stream_discard.hpp"
template <
    typename _TIn,
    int _NStrm
    >
void streamDiscard (
    hls::stream <_TIn> istrms [_NStrm],
    hls::stream <bool>& e_istrm
    )

Discard multiple streams synchronized with one end flag.

Parameters:

_TIn streams’ type
_NStrm the number of streams
istrms input streams
e_istrm end flag, which is shared in all input streams

streamDiscard overload (3)

#include "xf_utils_hw/stream_discard.hpp"
template <typename _TIn>
void streamDiscard (
    hls::stream <_TIn>& istrm,
    hls::stream <bool>& e_istrm
    )

Discard one stream with its end flag helper.

Parameters:

_TIn stream’s type
istrm input stream
e_istrm end flag of input stream

streamDup

streamDup overload (1)

#include "xf_utils_hw/stream_dup.hpp"
template <
    typename _TIn,
    int _NStrm
    >
void streamDup (
    hls::stream <_TIn>& istrm,
    hls::stream <bool>& e_istrm,
    hls::stream <_TIn> ostrms [_NStrm],
    hls::stream <bool> e_ostrms [_NStrm]
    )

Duplicate stream.

Parameters:

_TIn input stream width.
_NStrm number of output stream.
istrm input data stream.
e_istrm end flag stream for input data.
ostrms output data streams.
e_ostrms end flag streams, one for each output data stream.

streamDup overload (2)

#include "xf_utils_hw/stream_dup.hpp"
template <
    typename _TIn,
    int _NIStrm,
    int _NDStrm,
    int _NDCopy
    >
void streamDup (
    const unsigned int choose [_NDStrm],
    hls::stream <_TIn> istrm [_NIStrm],
    hls::stream <bool>& e_istrm,
    hls::stream <_TIn> ostrms [_NIStrm],
    hls::stream <_TIn> dstrms [_NDCopy][_NDStrm],
    hls::stream <bool>& e_ostrms
    )

Duplicate stream.

Parameters:

_TIn input stream width.
_NIStrm number of input stream.
_NDStrm number of streams to be duplicated. Should be smaller than _NIStrm.
_NDCopy number of copies of duplicated streams to be generated
choose option to choose which input streams will be duplicated and configure the order of the out duplicated streams.
istrm input data stream.
e_istrm end flag stream for input data.
ostrms output data streams.
dstrms output duplicated streams.
e_ostrms end flag streams.

streamNToOne

streamNToOne overload (1)

#include "xf_utils_hw/stream_n_to_one/load_balance.hpp"
template <
    int _WInStrm,
    int _WOutStrm,
    int _NStrm
    >
void streamNToOne (
    hls::stream <ap_uint <_WInStrm>> istrms [_NStrm],
    hls::stream <bool> e_istrms [_NStrm],
    hls::stream <ap_uint <_WOutStrm>>& ostrm,
    hls::stream <bool>& e_ostrm,
    LoadBalanceT alg
    )

stream distribute, skip to read the empty input streams.

Parameters:

_WInStrm input stream width.
_WOutStrm output stream width.
_NStrm number of input streams.
istrms input data streams.
e_istrms end flag streams for input data.
ostrm output data stream.
e_ostrm end flag stream.
alg algorithm selector.

streamNToOne overload (2)

#include "xf_utils_hw/stream_n_to_one/load_balance.hpp"
template <
    typename _TIn,
    int _NStrm
    >
void streamNToOne (
    hls::stream <_TIn> istrms [_NStrm],
    hls::stream <bool> e_istrms [_NStrm],
    hls::stream <_TIn>& ostrm,
    hls::stream <bool>& e_ostrm,
    LoadBalanceT alg
    )

stream distribute, skip to read the empty input streams.

Parameters:

_TIn the type of stream.
_NStrm number of input streams.
istrms input data streams.
e_istrms end flag streams for input data.
ostrm output data stream.
e_ostrm end flag stream.
alg algorithm selector.

streamNToOne overload (3)

#include "xf_utils_hw/stream_n_to_one/round_robin.hpp"
template <
    int _WInStrm,
    int _WOutStrm,
    int _NStrm
    >
void streamNToOne (
    hls::stream <ap_uint <_WInStrm>> istrms [_NStrm],
    hls::stream <bool> e_istrms [_NStrm],
    hls::stream <ap_uint <_WOutStrm>>& ostrm,
    hls::stream <bool>& e_ostrm,
    RoundRobinT alg
    )

stream distribute, in round-robin order from NStrm input streams.

Parameters:

_WInStrm input stream width.
_WOutStrm output stream width.
_NStrm number of input streams.
istrms input data streams.
e_istrms end flag streams for input data.
ostrm output data stream.
e_ostrm end flag stream.
alg algorithm selector.

streamNToOne overload (4)

#include "xf_utils_hw/stream_n_to_one/round_robin.hpp"
template <
    typename _TIn,
    int _NStrm
    >
void streamNToOne (
    hls::stream <_TIn> istrms [_NStrm],
    hls::stream <bool> e_istrms [_NStrm],
    hls::stream <_TIn>& ostrm,
    hls::stream <bool>& e_ostrm,
    RoundRobinT alg
    )

stream distribute, in round-robin order from NStrm input streams.

Parameters:

_TIn the type of input and output stream.
_NStrm number of input streams.
istrms input data streams.
e_istrms end flag streams for input data.
ostrm output data stream.
e_ostrm end flag stream.
alg algorithm selector.

streamNToOne overload (5)

#include "xf_utils_hw/stream_n_to_one/tag_select.hpp"
template <
    int _WInStrm,
    int _WTagStrm
    >
void streamNToOne (
    hls::stream <ap_uint <_WInStrm>> data_istrms [PowerOf2< _WTagStrm >::value],
    hls::stream <bool> e_data_istrms [PowerOf2< _WTagStrm >::value],
    hls::stream <ap_uint <_WTagStrm>>& tag_istrm,
    hls::stream <bool>& e_tag_istrm,
    hls::stream <ap_uint <_WInStrm>>& data_ostrm,
    hls::stream <bool>& e_data_ostrm,
    TagSelectT alg
    )

This function selects from input streams based on tags.

In this primitive, each tag decides the source of the output. It is assumed that input element has a corresponding channel-selection tag. The output data in data_ostrms only contains the input data. The tag stream is expected to pass the exactly number of tags to distribute the input data elements.

Parameters:

_WInStrm the width of input data
_WTagStrm the width of tag, pow(2, _WTagStrm) is the number of input streams.
data_istrms the input streams
e_data_istrms the end flag of input streams
tag_istrm the tag stream.
e_tag_istrm the end signal of tag stream.
data_ostrm the output stream.
e_data_ostrm the end signals of data_ostrm.
alg algorithm selector

streamNToOne overload (6)

#include "xf_utils_hw/stream_n_to_one/tag_select.hpp"
template <
    typename _TIn,
    int _WTagStrm
    >
void streamNToOne (
    hls::stream <_TIn> data_istrms [PowerOf2< _WTagStrm >::value],
    hls::stream <bool> e_data_istrms [PowerOf2< _WTagStrm >::value],
    hls::stream <ap_uint <_WTagStrm>>& tag_istrm,
    hls::stream <bool>& e_tag_istrm,
    hls::stream <_TIn>& data_ostrm,
    hls::stream <bool>& e_data_ostrm,
    TagSelectT alg
    )

This function selects from input streams based on tags.

In this primitive, each tag decides the source of the output. It is assumed that input element has a corresponding channel-selection tag. The output data in data_ostrms only contains the input data .

Parameters:

_TIn the type of input data
_WTagStrm the width of tag, pow(2, _WTagStrm) is the number of input streams.
data_istrms the input streams
e_data_istrms the end flag of input streams
tag_istrm the tag stream, streams and data_istrm and tag_istrm are synchronous.
e_tag_istrm the end signal stream, true if data_istrms and tag_istrm are ended.
data_ostrm the output stream.
e_data_ostrm the end signals of data_ostrm.
alg algorithm selector

streamOneToN

streamOneToN overload (1)

#include "xf_utils_hw/stream_one_to_n/load_balance.hpp"
template <
    int _WInStrm,
    int _WOutStrm,
    int _NStrm
    >
void streamOneToN (
    hls::stream <ap_uint <_WInStrm>>& istrm,
    hls::stream <bool>& e_istrm,
    hls::stream <ap_uint <_WOutStrm>> ostrms [_NStrm],
    hls::stream <bool> e_ostrms [_NStrm],
    LoadBalanceT alg
    )

stream distribute, using load-balancing algorithm.

The input stream is assumed to be compact data to be splitted into _WOutStrm wide data into output streams.

Parameters:

_WInStrm input stream width.
_WOutStrm output stream width.
_NStrm number of output stream.
istrm input data stream.
e_istrm end flag stream for input data.
ostrms output data streams.
e_ostrms end flag streams, one for each output data stream.
alg algorithm selector.

streamOneToN overload (2)

#include "xf_utils_hw/stream_one_to_n/load_balance.hpp"
template <
    typename _TIn,
    int _NStrm
    >
void streamOneToN (
    hls::stream <_TIn>& istrm,
    hls::stream <bool>& e_istrm,
    hls::stream <_TIn> ostrms [_NStrm],
    hls::stream <bool> e_ostrms [_NStrm],
    LoadBalanceT alg
    )

stream distribute, using load-balancing algorithm.

Parameters:

_TIn the type of input stream.
_NStrm number of output stream.
istrm input data stream.
e_istrm end flag stream for input data.
ostrms output data streams.
e_ostrms end flag streams, one for each output data stream.
alg algorithm selector.

streamOneToN overload (3)

#include "xf_utils_hw/stream_one_to_n/round_robin.hpp"
template <
    int _WInStrm,
    int _WOutStrm,
    int _NStrm
    >
void streamOneToN (
    hls::stream <ap_uint <_WInStrm>>& istrm,
    hls::stream <bool>& e_istrm,
    hls::stream <ap_uint <_WOutStrm>> ostrms [_NStrm],
    hls::stream <bool> e_ostrms [_NStrm],
    RoundRobinT alg
    )

stream distribute, in round-robin order from first output.

The input stream is assumed to be conpact data to be splitted into _WOutStrm wide data into output streams.

Parameters:

_WInStrm input stream width.
_WOutStrm output stream width.
_NStrm number of output stream.
istrm input data stream.
e_istrm end flag stream for input data.
ostrms output data streams.
e_ostrms end flag streams, one for each output data stream.
alg algorithm selector.

streamOneToN overload (4)

#include "xf_utils_hw/stream_one_to_n/round_robin.hpp"
template <
    typename _TIn,
    int _NStrm
    >
void streamOneToN (
    hls::stream <_TIn>& istrm,
    hls::stream <bool>& e_istrm,
    hls::stream <_TIn> ostrms [_NStrm],
    hls::stream <bool> e_ostrms [_NStrm],
    RoundRobinT alg
    )

stream distribute, in round-robin order from first output.

Parameters:

_TIn the type of input stream.
_NStrm number of output stream.
istrm input data stream.
e_istrm end flag stream for input data.
ostrms output data streams.
e_ostrms end flag streams, one for each output data stream.
alg algorithm selector.

streamOneToN overload (5)

#include "xf_utils_hw/stream_one_to_n/tag_select.hpp"
template <
    int _WInStrm,
    int _WTagStrm
    >
void streamOneToN (
    hls::stream <ap_uint <_WInStrm>>& data_istrm,
    hls::stream <bool>& e_data_istrm,
    hls::stream <ap_uint <_WTagStrm>>& tag_istrm,
    hls::stream <bool>& e_tag_istrm,
    hls::stream <ap_uint <_WInStrm>> data_ostrms [PowerOf2< _WTagStrm >::value],
    hls::stream <bool> e_data_ostrms [PowerOf2< _WTagStrm >::value],
    TagSelectT alg
    )

This function send element from one stream to multiple streams based on tags.

In this primitive, the tag is the index of ouput streams. The input data in data_istrms is distributed to the data_ostrm whose index is tag. Each tag is the index of output streams, and data_istrm and tag_istrm are synchronous.

Parameters:

_WInStrm the width of input data
_WTagStrm the width of tag, pow(2, _WTagStrm) is the number of ouput streams.
data_istrm the input stream.
e_data_istrm the end signal of input stream.
tag_istrm the tag stream.
e_tag_istrm the end signal stream of tags.
data_ostrms the output stream.
e_data_ostrms the end signals of data_ostrms.
alg algorithm selector

streamOneToN overload (6)

#include "xf_utils_hw/stream_one_to_n/tag_select.hpp"
template <
    typename _TIn,
    int _WTagStrm
    >
void streamOneToN (
    hls::stream <_TIn>& data_istrm,
    hls::stream <bool>& e_data_istrm,
    hls::stream <ap_uint <_WTagStrm>>& tag_istrm,
    hls::stream <bool>& e_tag_istrm,
    hls::stream <_TIn> data_ostrms [PowerOf2< _WTagStrm >::value],
    hls::stream <bool> e_data_ostrms [PowerOf2< _WTagStrm >::value],
    TagSelectT alg
    )

This function send element from one stream to multiple streams based on tags.

In this primitive, the tag is the index of ouput streams. The input data in data_istrms is distributed to the data_ostrm whose index is tag. Each tag is the index of output streams, and data_istrm and tag_istrm are synchronous.

Parameters:

_TIn the type of input & output data.
_WTagStrm the width of tag, pow(2, _WTagStrm) is the number of ouput streams.
data_istrm the input stream.
e_data_istrm the end signal of input stream.
tag_istrm the tag stream.
e_tag_istrm the end signal of tag stream.
data_ostrms the output stream.
e_data_ostrms the end signals of data_ostrms.
alg algorithm selector.

streamReorder

#include "xf_utils_hw/stream_reorder.hpp"
template <
    typename _TIn,
    int _WindowSize
    >
void streamReorder (
    hls::stream <int>& order_cfg,
    hls::stream <_TIn>& istrm,
    hls::stream <bool>& e_istrm,
    hls::stream <_TIn>& ostrm,
    hls::stream <bool>& e_ostrm
    )

Window-reorder in a stream.

Suppose 8bit RGB values are multiplexed into one stream in R-G-B order, and a process module expects channel values in B-G-R order, then the data needs to be reordered in a window with size 3, and the configuration would be 2, 1, 0 .

It is assumed that the total number of elements passed through this module is multiple of window-size . Otherwise, the module may hang in execution.

The configuration is load once in one invocation, and reused until the end. Totally _WindowSize index integers will be read.

Parameters:

_TIn input type.
_WindowSize size of reorder window.
order_cfg the new order within the window, indexed from 0.
istrm input data stream.
e_istrm end flags for input.
ostrm output data stream.
e_ostrm end flag for output.

streamShuffle

#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.

streamSplit

streamSplit overload (1)

#include "xf_utils_hw/stream_split.hpp"
template <
    int _WIn,
    int _WOut,
    int _NStrm
    >
void streamSplit (
    hls::stream <ap_uint <_WIn>>& istrm,
    hls::stream <bool>& e_istrm,
    hls::stream <ap_uint <_WOut>> ostrms [_NStrm],
    hls::stream <bool>& e_ostrm,
    LSBSideT alg
    )

split one wide stream into multiple streams, start from the LSB.

If _WIn > _WOut * _NStrm , the extra bits will be discarded.

Parameters:

_WIn input stream width, should be no less than _WOut * _NStrm.
_WOut output stream width.
_NStrm number of output stream.
istrm input data stream.
e_istrm end flag for the input.
ostrms output data streams.
e_ostrm end flag streams for all outputs.
alg algorithm selector for this function.

streamSplit overload (2)

#include "xf_utils_hw/stream_split.hpp"
template <
    int _WIn,
    int _WOut,
    int _NStrm
    >
void streamSplit (
    hls::stream <ap_uint <_WIn>>& istrm,
    hls::stream <bool>& e_istrm,
    hls::stream <ap_uint <_WOut>> ostrms [_NStrm],
    hls::stream <bool>& e_ostrm,
    MSBSideT alg
    )

split one wide stream into multiple streams, start from the MSB.

If _WIn > _WOut * _NStrm , the extra bits will be discarded.

Parameters:

_WIn input stream width, should be no less than _WOut * _NStrm.
_WOut output stream width.
_NStrm number of output stream.
istrm input data stream.
e_istrm end flag for the input.
ostrms output data streams.
e_ostrm end flag streams for all outputs.
alg algorithm selector for this function.

streamSync

#include "xf_utils_hw/stream_sync.hpp"
template <
    typename _TIn,
    int _NStrm
    >
void streamSync (
    hls::stream <_TIn> istrms [_NStrm],
    hls::stream <bool> e_istrms [_NStrm],
    hls::stream <_TIn> ostrms [_NStrm],
    hls::stream <bool>& e_ostrm
    )

Synchronize streams for successor module.

This module ensures that elements in different input stream goes into successor stream in locked steps. The end signal is also fused into one. It assumes the input elements in each input stream have the same number , otherwise, it will not terminate.

Parameters:

_TIn input type.
_NStrm number of input streams.
istrms input data streams.
e_istrms end flags for each input.
ostrms output data streams.
e_ostrm end flag for all output.

streamToAxi

#include "xf_utils_hw/stream_to_axi.hpp"
template <
    int _BurstLen = 32,
    int _WAxi,
    int _WStrm
    >
void streamToAxi (
    ap_uint <_WAxi>* wbuf,
    hls::stream <ap_uint <_WStrm>>& istrm,
    hls::stream <bool>& e_istrm
    )

Write elements in burst to AXI master port.

Parameters:

_BurstLen length of a burst, default is 32.
_WAxi width of axi port.
_WStrm width of input stream.
wbuf output AXI port.
istrm input stream.
e_istrm end flag for input stream