21 #include <connections/connections.h>
22 #include <connections/connections_utils.h>
24 #include "auto_gen_fields.h"
26 #include <nvhls_connections.h>
27 #include <nvhls_assert.h>
28 #include <nvhls_message.h>
29 #include <nvhls_module.h>
31 #include <UIntOrEmpty.h>
33 #include <axi/axi4_encoding.h>
34 #include <axi/axi4_configs.h>
63 template <
typename Cfg>
69 DATA_WIDTH = Cfg::dataWidth,
70 ADDR_WIDTH = Cfg::addrWidth,
71 ID_WIDTH = Cfg::idWidth,
72 BID_WIDTH = (Cfg::useWriteResponses == 0 ? 0 : Cfg::idWidth),
75 ASIZE_WIDTH = (Cfg::useVariableBeatSize != 0 ? 3 : 0),
76 LAST_WIDTH = (Cfg::useLast != 0 ? 1 : 0),
77 CACHE_WIDTH = (Cfg::useCache != 0 ? Enc::ARCACHE::_WIDTH : 0),
78 BURST_WIDTH = ((Cfg::useBurst != 0 &&
79 (Cfg::useFixedBurst != 0 || Cfg::useWrapBurst != 0))
80 ? Enc::AXBURST::_WIDTH
82 WSTRB_WIDTH = (Cfg::useWriteStrobes != 0 ? (DATA_WIDTH >> 3) : 0),
83 RESP_WIDTH = Enc::XRESP::_WIDTH,
88 AUSER_WIDTH = Cfg::aUserWidth,
89 WUSER_WIDTH = Cfg::wUserWidth,
90 BUSER_WIDTH = (Cfg::useWriteResponses == 0 ? 0 : Cfg::bUserWidth),
91 RUSER_WIDTH = Cfg::rUserWidth,
94 typedef NVUINTW(ADDR_WIDTH) Addr;
95 typedef NVUINTW(DATA_WIDTH) Data;
96 typedef typename nvhls::UIntOrEmpty<ID_WIDTH>::T Id;
97 typedef typename nvhls::UIntOrEmpty<BID_WIDTH>::T BId;
98 typedef typename nvhls::UIntOrEmpty<ALEN_WIDTH>::T BeatNum;
99 typedef typename nvhls::UIntOrEmpty<ASIZE_WIDTH>::T BeatSize;
100 typedef typename nvhls::UIntOrEmpty<LAST_WIDTH>::T Last;
101 typedef typename nvhls::UIntOrEmpty<WSTRB_WIDTH>::T Wstrb;
102 typedef typename nvhls::UIntOrEmpty<CACHE_WIDTH>::T Cache;
103 typedef typename nvhls::UIntOrEmpty<BURST_WIDTH>::T Burst;
104 typedef NVUINTW(RESP_WIDTH) Resp;
106 typedef typename nvhls::UIntOrEmpty<AUSER_WIDTH>::T AUser;
107 typedef typename nvhls::UIntOrEmpty<WUSER_WIDTH>::T WUser;
108 typedef typename nvhls::UIntOrEmpty<BUSER_WIDTH>::T BUser;
109 typedef typename nvhls::UIntOrEmpty<RUSER_WIDTH>::T RUser;
252 template <Connections::connections_port_t PortType = AUTO_PORT>
255 typedef Connections::Combinational<AddrPayload, PortType> ARChan;
256 typedef Connections::Combinational<ReadPayload, PortType> RChan;
261 chan(
const char *name)
270 template <Connections::connections_port_t PortType = AUTO_PORT>
273 typedef Connections::Out<AddrPayload, PortType> ARPort;
274 typedef Connections::In<ReadPayload, PortType> RPort;
294 void operator()(C &c) {
303 template <Connections::connections_port_t PortType = AUTO_PORT>
306 typedef Connections::In<AddrPayload, PortType> ARPort;
307 typedef Connections::Out<ReadPayload, PortType> RPort;
322 bool nb_aread(
AddrPayload &addr) {
return ar.PopNB(addr); }
324 void rwrite(
const ReadPayload &data) { r.Push(data); }
326 bool nb_rwrite(
const ReadPayload &data) {
return r.PushNB(data); }
329 void operator()(C &c) {
347 template <Connections::connections_port_t PortType = AUTO_PORT>
350 typedef Connections::Combinational<AddrPayload, PortType> AWChan;
351 typedef Connections::Combinational<WritePayload, PortType> WChan;
352 typedef Connections::Combinational<WRespPayload, PortType> BChan;
358 chan(
const char *name)
369 template <Connections::connections_port_t PortType = AUTO_PORT>
372 typedef Connections::Out<AddrPayload, PortType> AWPort;
373 typedef Connections::Out<WritePayload, PortType> WPort;
374 typedef Connections::In<WRespPayload, PortType> BPort;
399 void operator()(C &c) {
409 template <Connections::connections_port_t PortType = AUTO_PORT>
412 typedef Connections::In<AddrPayload, PortType> AWPort;
413 typedef Connections::In<WritePayload, PortType> WPort;
414 typedef Connections::Out<WRespPayload, PortType> BPort;
442 if (!aw.PopNB(addr)) {
462 bool nb_bwrite(
const WRespPayload &resp) {
return b.PushNB(resp); }
465 void operator()(C &c) {
Hardcoded values associated with the AXI4 standard.
The AXI read channel, used for connecting an AXI manager and AXI subordinate.
The AXI read manager port. This port has an AR request channel as output and an R response channel as...
The AXI read subordinate port. This port has an AR request channel as input and an R response channel...
The AXI write channel, used for connecting an AXI manager and AXI subordinate.
The AXI write manager port. This port has AW and W request channels as outputs and a B response chann...
The AXI write subordinate port. This port has AW and W request channels as inputs and a B response ch...
The base axi4 class parameterized according a valid config.
#define nvhls_concat(s1, s2)
nvhls_concat define: Concatenate two strings, separate with an underscore.
The axi namespace contains classes and definitions related to the AXI standard.
A struct composed of the signals associated with AXI read and write requests.
A struct composed of the signals associated with an AXI read response.
A struct composed of the signals associated with an AXI write response.
A struct composed of the signals associated with AXI write data.
Compute Celing of log2 of a constant.