namespace utils_hw

// namespaces

namespace xf::common::utils_hw::details

axi_to_stream

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

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

+--------------------------------------------------------+
| DDR  -> AXI_BUS  -> FIFO     -> stream(aligned to 16b) |
| XXaa    XXaabbcc    XXaabbcc    aa                     |
| bbcc    ddXX0000    ddXX0000    bb                     |
| ddXX                            cc                     |
|                                 dd                     |
+--------------------------------------------------------+

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.
offset_num offset from the beginning of the buffer, by num of element.

axi_to_char_stream

#include "axi_to_stream.hpp"
template <
    int _BurstLen = 32,
    int _WAxi,
    typename _TStrm
    >
void axi_to_char_stream (
    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.