An AXI4-Stream is used without
side-channels when the function argument, ap_axis or
ap_axiu data type, does not contain any AXI4 side-channel elements (that is, when the WUser, WId, and WDest parameters are set to 0). In the following example,
both interfaces are implemented using an AXI4-Stream:
#include "ap_axi_sdata.h"
#include "hls_stream.h"
typedef ap_axiu<32, 0, 0, 0> trans_pkt;
void example(hls::stream< trans_pkt > &A, hls::stream< trans_pkt > &B)
{
#pragma HLS INTERFACE mode=axis port=A
#pragma HLS INTERFACE mode=axis port=B
trans_pkt tmp;
A.read(tmp);
tmp.data += 5;
B.write(tmp);
}
After synthesis, both arguments are implemented with a data port (TDATA) and the standard AXI4-Stream protocol ports, TVALID,
TREADY, TKEEP,
TLAST, and TSTRB,
as shown in the following figure.
hls::stream object with a data type other than ap_axis or ap_axiu, the
tool will infer an AXI4-Stream interface without the
TLAST signal, or any of the side-channel signals.
This implementation of the AXI4-Stream interface
consumes fewer device resources, but offers no visibility into when the stream is
ending.Multiple variables can be combined into the same AXI4-Stream interface by using a struct, which is aggregated by Vitis HLS by default. Aggregating the elements of a struct into a single wide-vector, allows all elements of the struct to be implemented in the same AXI4-Stream interface.