scc  2022.4.0
SystemC components library
signal_if.h
1 /*******************************************************************************
2  * Copyright 2021 MINRES Technologies GmbH
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *******************************************************************************/
16 
17 #ifndef _BUS_AXI_SIGNAL_IF_H_
18 #define _BUS_AXI_SIGNAL_IF_H_
19 
20 #include <scc/signal_opt_ports.h>
21 #include <systemc>
22 
23 namespace axi {
24 
25 const sc_core::sc_time CLK_DELAY = 1_ps;
26 
27 struct master_types {
28  template <typename T> using m2s_t = sc_core::sc_out<T>;
29  template <typename T> using s2m_t = sc_core::sc_in<T>;
30  template <typename T> using m2s_full_t = sc_core::sc_out<T>;
31  template <typename T> using s2m_full_t = sc_core::sc_in<T>;
32  template <typename T> using m2s_opt_t = scc::sc_out_opt<T>;
33  template <typename T> using s2m_opt_t = scc::sc_in_opt<T>;
34 };
35 
37  template <typename T> using m2s_t = sc_core::sc_out<T>;
38  template <typename T> using s2m_t = sc_core::sc_in<T>;
39  template <typename T> using m2s_full_t = scc::sc_out_opt<T>;
40  template <typename T> using s2m_full_t = scc::sc_in_opt<T>;
41  template <typename T> using m2s_opt_t = scc::sc_out_opt<T>;
42  template <typename T> using s2m_opt_t = scc::sc_in_opt<T>;
43 };
44 
45 struct slave_types {
46  template <typename T> using m2s_t = sc_core::sc_in<T>;
47  template <typename T> using s2m_t = sc_core::sc_out<T>;
48  template <typename T> using m2s_full_t = sc_core::sc_in<T>;
49  template <typename T> using s2m_full_t = sc_core::sc_out<T>;
50  template <typename T> using m2s_opt_t = scc::sc_in_opt<T>;
51  template <typename T> using s2m_opt_t = scc::sc_out_opt<T>;
52 };
53 
55  template <typename T> using m2s_t = sc_core::sc_in<T>;
56  template <typename T> using s2m_t = sc_core::sc_out<T>;
57  template <typename T> using m2s_full_t = scc::sc_in_opt<T>;
58  template <typename T> using s2m_full_t = scc::sc_out_opt<T>;
59  template <typename T> using m2s_opt_t = scc::sc_in_opt<T>;
60  template <typename T> using s2m_opt_t = scc::sc_out_opt<T>;
61 };
62 
63 struct signal_types {
64  template <typename T> using m2s_t = sc_core::sc_signal<T>;
65  template <typename T> using s2m_t = sc_core::sc_signal<T>;
66  template <typename T> using m2s_full_t = sc_core::sc_signal<T>;
67  template <typename T> using s2m_full_t = sc_core::sc_signal<T>;
68  template <typename T> using m2s_opt_t = sc_core::sc_signal<T>;
69  template <typename T> using s2m_opt_t = sc_core::sc_signal<T>;
70 };
71 
72 template <bool Cond, class T, class S> struct select_if { typedef S type; };
73 template <class T, class S> struct select_if<true, T, S> { typedef T type; };
74 
75 template <unsigned int BUSWDTH = 32, unsigned int ADDRWDTH = 32, unsigned int IDWDTH = 32, unsigned int USERWDTH = 1> struct axi4_cfg {
76  static_assert(BUSWDTH > 0, "BUSWIDTH shall be larger than 0");
77  static_assert(ADDRWDTH > 0, "ADDRWDTH shall be larger than 0");
78  static_assert(IDWDTH > 0, "IDWDTH shall be larger than 0");
79  constexpr static bool IS_LITE = false;
80  constexpr static unsigned int BUSWIDTH = BUSWDTH;
81  constexpr static unsigned int ADDRWIDTH = ADDRWDTH;
82  constexpr static unsigned int IDWIDTH = IDWDTH;
83  constexpr static unsigned int USERWIDTH = USERWDTH;
84  using data_t = typename select_if<BUSWDTH <= 64, sc_dt::sc_uint<BUSWIDTH>, sc_dt::sc_biguint<BUSWIDTH>>::type;
87 };
88 
89 template <unsigned int BUSWDTH = 32, unsigned int ADDRWDTH = 32> struct axi4_lite_cfg {
90  static_assert(BUSWDTH > 0, "BUSWIDTH shall be larger than 0");
91  static_assert(ADDRWDTH > 0, "ADDRWDTH shall be larger than 0");
92  constexpr static bool IS_LITE = true;
93  constexpr static unsigned int BUSWIDTH = BUSWDTH;
94  constexpr static unsigned int ADDRWIDTH = ADDRWDTH;
95  constexpr static unsigned int IDWIDTH = 0;
96  constexpr static unsigned int USERWIDTH = 1;
97  using data_t = typename select_if<BUSWDTH <= 64, sc_dt::sc_uint<BUSWIDTH>, sc_dt::sc_biguint<BUSWIDTH>>::type;
100 };
111 template <unsigned int BUSWDTH = 32, unsigned int ADDRWDTH = 32, unsigned int IDWDTH = 32, unsigned int USERWDTH = 1,
112  unsigned int AWSNOOPWDTH = 3, unsigned int RESPWDTH = 4>
113 struct ace_cfg {
114 
115  static_assert(BUSWDTH > 0, "BUSWIDTH shall be larger than 0");
116  // static_assert(CACHELINE > 0);
117  static_assert(ADDRWDTH > 0, "ADDRWDTH shall be larger than 0");
118  static_assert(IDWDTH > 0, "IDWDTH shall be larger than 0");
119  constexpr static bool IS_LITE = false;
120  constexpr static unsigned int BUSWIDTH = BUSWDTH;
121  constexpr static unsigned int ADDRWIDTH = ADDRWDTH;
122  constexpr static unsigned int IDWIDTH = IDWDTH;
123  constexpr static unsigned int USERWIDTH = USERWDTH;
124  constexpr static unsigned int AWSNOOPWIDTH = AWSNOOPWDTH;
125  constexpr static unsigned int RESPWIDTH = RESPWDTH;
126  using data_t = typename select_if<BUSWDTH <= 64, sc_dt::sc_uint<BUSWIDTH>, sc_dt::sc_biguint<BUSWIDTH>>::type;
129 };
130 
131 inline std::string concat(const char* prefix, const char* name) { return std::string(prefix) + name; }
132 
134 template <typename CFG, typename TYPES = master_types> struct aw_axi_lite;
135 template <typename CFG, typename TYPES = master_types> struct aw_axi {
136  typename TYPES::template m2s_full_t<sc_dt::sc_uint<CFG::IDWIDTH>> aw_id{"aw_id"};
137  typename TYPES::template m2s_t<sc_dt::sc_uint<CFG::ADDRWIDTH>> aw_addr{"aw_addr"};
138  typename TYPES::template s2m_t<bool> aw_ready{"aw_ready"};
139  typename TYPES::template m2s_full_t<bool> aw_lock{"aw_lock"}; // AXI3 has 2 bits while AXI4 has 1 bit
140  typename TYPES::template m2s_t<bool> aw_valid{"aw_valid"};
141  typename TYPES::template m2s_t<sc_dt::sc_uint<3>> aw_prot{"aw_prot"};
142  typename TYPES::template m2s_full_t<sc_dt::sc_uint<3>> aw_size{"aw_size"};
143  typename TYPES::template m2s_full_t<sc_dt::sc_uint<4>> aw_cache{"aw_cache"};
144  typename TYPES::template m2s_full_t<sc_dt::sc_uint<2>> aw_burst{"aw_burst"};
145  typename TYPES::template m2s_full_t<sc_dt::sc_uint<4>> aw_qos{"aw_qos"};
146  typename TYPES::template m2s_full_t<sc_dt::sc_uint<4>> aw_region{"aw_region"};
147  typename TYPES::template m2s_full_t<sc_dt::sc_uint<8>> aw_len{"aw_len"};
148  typename TYPES::template m2s_opt_t<sc_dt::sc_uint<CFG::USERWIDTH>> aw_user{"aw_user"};
149 
150  aw_axi() = default;
151  aw_axi(const char* prefix)
152  : aw_id{concat(prefix, "aw_id").c_str()}
153  , aw_addr{concat(prefix, "aw_addr").c_str()}
154  , aw_ready{concat(prefix, "aw_ready").c_str()}
155  , aw_lock{concat(prefix, "aw_lock").c_str()}
156  , aw_valid{concat(prefix, "aw_valid").c_str()}
157  , aw_prot{concat(prefix, "aw_prot").c_str()}
158  , aw_size{concat(prefix, "aw_size").c_str()}
159  , aw_cache{concat(prefix, "aw_cache").c_str()}
160  , aw_burst{concat(prefix, "aw_burst").c_str()}
161  , aw_qos{concat(prefix, "aw_qos").c_str()}
162  , aw_region{concat(prefix, "aw_region").c_str()}
163  , aw_len{concat(prefix, "aw_len").c_str()}
164  , aw_user{concat(prefix, "aw_user").c_str()} {}
165 
166  template <typename OTYPES> void bind_aw(aw_axi<CFG, OTYPES>& o) {
167  aw_id.bind(o.aw_id);
168  aw_addr.bind(o.aw_addr);
169  aw_ready.bind(o.aw_ready);
170  aw_lock.bind(o.aw_lock); // only AXI3
171  aw_valid.bind(o.aw_valid);
172  aw_prot.bind(o.aw_prot);
173  aw_size.bind(o.aw_size);
174  aw_cache.bind(o.aw_cache);
175  aw_burst.bind(o.aw_burst);
176  aw_qos.bind(o.aw_qos);
177  aw_region.bind(o.aw_region);
178  aw_len.bind(o.aw_len);
179  aw_user.bind(o.aw_user);
180  }
181  template <typename OTYPES> void bind_aw(aw_axi_lite<CFG, OTYPES>& o);
182 };
183 
185 template <typename CFG, typename TYPES = master_types> struct wdata_axi_lite;
186 template <typename CFG, typename TYPES = master_types> struct wdata_axi {
187  typename TYPES::template m2s_opt_t<sc_dt::sc_uint<CFG::IDWIDTH>> w_id{"w_id"};
188  typename TYPES::template m2s_t<typename CFG::data_t> w_data{"w_data"};
189  typename TYPES::template m2s_t<sc_dt::sc_uint<CFG::BUSWIDTH / 8>> w_strb{"w_strb"};
190  typename TYPES::template m2s_full_t<bool> w_last{"w_last"};
191  typename TYPES::template m2s_t<bool> w_valid{"w_valid"};
192  typename TYPES::template s2m_t<bool> w_ready{"w_ready"};
193  typename TYPES::template m2s_opt_t<sc_dt::sc_uint<CFG::USERWIDTH>> w_user{"w_user"};
194  typename TYPES::template m2s_full_t<bool> w_ack{"w_ack"}; // only ACE
195  typename TYPES::template m2s_opt_t<bool> w_trace{"w_trace"};
196 
197  wdata_axi() = default;
198  wdata_axi(const char* prefix)
199  : w_id{concat(prefix, "w_id").c_str()}
200  , w_data{concat(prefix, "w_data").c_str()}
201  , w_strb{concat(prefix, "w_strb").c_str()}
202  , w_last{concat(prefix, "w_last").c_str()}
203  , w_valid{concat(prefix, "w_valid").c_str()}
204  , w_ready{concat(prefix, "w_ready").c_str()}
205  , w_user{concat(prefix, "w_user").c_str()}
206  , w_ack{concat(prefix, "w_ack").c_str()} // only ACE
207  , w_trace{concat(prefix, "w_trace").c_str()} {}
208 
209  template <typename OTYPES> void bind_w(wdata_axi<CFG, OTYPES>& o) {
210  w_id.bind(o.w_id);
211  w_data.bind(o.w_data);
212  w_strb.bind(o.w_strb);
213  w_last.bind(o.w_last);
214  w_valid.bind(o.w_valid);
215  w_ready.bind(o.w_ready);
216  w_user.bind(o.w_user);
217  w_ack.bind(o.w_ack); // only ACE
218  w_trace.bind(o.w_trace);
219  }
220  template <typename OTYPES> void bind_wdata(wdata_axi<CFG, OTYPES>& o) { bind_w(o); }
221  template <typename OTYPES> void bind_w(wdata_axi_lite<CFG, OTYPES>& o);
222  template <typename OTYPES> void bind_wdata(wdata_axi_lite<CFG, OTYPES>& o) { bind_w(o); }
223 };
224 
226 template <typename CFG, typename TYPES = master_types> struct b_axi_lite;
227 template <typename CFG, typename TYPES = master_types> struct b_axi {
228  typename TYPES::template s2m_t<bool> b_valid{"b_valid"};
229  typename TYPES::template m2s_t<bool> b_ready{"b_ready"};
230  typename TYPES::template s2m_full_t<sc_dt::sc_uint<CFG::IDWIDTH>> b_id{"b_id"};
231  typename TYPES::template s2m_t<sc_dt::sc_uint<2>> b_resp{"b_resp"};
232  typename TYPES::template s2m_opt_t<sc_dt::sc_uint<CFG::USERWIDTH>> b_user{"b_user"};
233  typename TYPES::template s2m_opt_t<bool> b_trace{"b_trace"};
234 
235  b_axi() = default;
236  b_axi(const char* prefix)
237  : b_valid{concat(prefix, "b_valid").c_str()}
238  , b_ready{concat(prefix, "b_ready").c_str()}
239  , b_id{concat(prefix, "b_id").c_str()}
240  , b_resp{concat(prefix, "b_resp").c_str()}
241  , b_user{concat(prefix, "b_user").c_str()}
242  , b_trace{concat(prefix, "b_trace").c_str()} {}
243 
244  template <typename OTYPES> void bind_b(b_axi<CFG, OTYPES>& o) {
245  b_valid.bind(o.b_valid);
246  b_ready.bind(o.b_ready);
247  b_id.bind(o.b_id);
248  b_resp.bind(o.b_resp);
249  b_user.bind(o.b_user);
250  b_trace.bind(o.b_trace);
251  }
252  template <typename OTYPES> void bind_b(b_axi_lite<CFG, OTYPES>& o);
253 };
254 
256 template <typename CFG, typename TYPES = master_types> struct ar_axi_lite;
257 template <typename CFG, typename TYPES = master_types> struct ar_axi {
258  typename TYPES::template m2s_full_t<sc_dt::sc_uint<CFG::IDWIDTH>> ar_id{"ar_id"};
259  typename TYPES::template m2s_t<sc_dt::sc_uint<CFG::ADDRWIDTH>> ar_addr{"ar_addr"};
260  typename TYPES::template m2s_full_t<sc_dt::sc_uint<8>> ar_len{"ar_len"};
261  typename TYPES::template m2s_full_t<sc_dt::sc_uint<3>> ar_size{"ar_size"};
262  typename TYPES::template m2s_full_t<sc_dt::sc_uint<2>> ar_burst{"ar_burst"};
263  typename TYPES::template m2s_full_t<bool> ar_lock{"ar_lock"}; // AXI3 has 2 bits while AXI4 has i bit
264  typename TYPES::template m2s_full_t<sc_dt::sc_uint<4>> ar_cache{"ar_cache"};
265  typename TYPES::template m2s_t<sc_dt::sc_uint<3>> ar_prot{"ar_prot"};
266  typename TYPES::template m2s_full_t<sc_dt::sc_uint<4>> ar_qos{"ar_qos"};
267  typename TYPES::template m2s_full_t<sc_dt::sc_uint<4>> ar_region{"ar_region"};
268  typename TYPES::template m2s_t<bool> ar_valid{"ar_valid"};
269  typename TYPES::template s2m_t<bool> ar_ready{"ar_ready"};
270  typename TYPES::template m2s_opt_t<sc_dt::sc_uint<CFG::USERWIDTH>> ar_user{"ar_user"};
271 
272  ar_axi() = default;
273  ar_axi(const char* prefix)
274  : ar_id{concat(prefix, "ar_id").c_str()}
275  , ar_addr{concat(prefix, "ar_addr").c_str()}
276  , ar_len{concat(prefix, "ar_len").c_str()}
277  , ar_size{concat(prefix, "ar_size").c_str()}
278  , ar_burst{concat(prefix, "ar_burst").c_str()}
279  , ar_lock{concat(prefix, "ar_lock").c_str()} // only AXI3
280  , ar_cache{concat(prefix, "ar_cache").c_str()}
281  , ar_prot{concat(prefix, "ar_prot").c_str()}
282  , ar_qos{concat(prefix, "ar_qos").c_str()}
283  , ar_region{concat(prefix, "ar_region").c_str()}
284  , ar_valid{concat(prefix, "ar_valid").c_str()}
285  , ar_ready{concat(prefix, "ar_ready").c_str()}
286  , ar_user{concat(prefix, "ar_user").c_str()} {}
287 
288  template <typename OTYPES> void bind_ar(ar_axi<CFG, OTYPES>& o) {
289  ar_id.bind(o.ar_id);
290  ar_addr.bind(o.ar_addr);
291  ar_len.bind(o.ar_len);
292  ar_size.bind(o.ar_size);
293  ar_burst.bind(o.ar_burst);
294  ar_lock.bind(o.ar_lock); // only AXI3
295  ar_cache.bind(o.ar_cache);
296  ar_prot.bind(o.ar_prot);
297  ar_qos.bind(o.ar_qos);
298  ar_region.bind(o.ar_region);
299  ar_valid.bind(o.ar_valid);
300  ar_ready.bind(o.ar_ready);
301  ar_user.bind(o.ar_user);
302  }
303  template <typename OTYPES> void bind_ar(ar_axi_lite<CFG, OTYPES>& o);
304 };
305 
307 template <typename CFG, typename TYPES = master_types> struct rresp_axi_lite;
308 template <typename CFG, typename TYPES = master_types> struct rresp_axi {
309  typename TYPES::template s2m_full_t<sc_dt::sc_uint<CFG::IDWIDTH>> r_id{"r_id"};
310  typename TYPES::template s2m_t<typename CFG::data_t> r_data{"r_data"};
311  typename TYPES::template s2m_t<sc_dt::sc_uint<2>> r_resp{"r_resp"};
312  typename TYPES::template s2m_full_t<bool> r_last{"r_last"};
313  typename TYPES::template s2m_t<bool> r_valid{"r_valid"};
314  typename TYPES::template m2s_t<bool> r_ready{"r_ready"};
315  typename TYPES::template s2m_opt_t<sc_dt::sc_uint<CFG::USERWIDTH>> r_user{"r_user"};
316  typename TYPES::template s2m_opt_t<bool> r_trace{"r_trace"};
317 
318  rresp_axi() = default;
319  rresp_axi(const char* prefix)
320  : r_id{concat(prefix, "r_id").c_str()}
321  , r_data{concat(prefix, "r_data").c_str()}
322  , r_resp{concat(prefix, "r_resp").c_str()}
323  , r_last{concat(prefix, "r_last").c_str()}
324  , r_valid{concat(prefix, "r_valid").c_str()}
325  , r_ready{concat(prefix, "r_ready").c_str()}
326  , r_user{concat(prefix, "r_user").c_str()}
327  , r_trace{concat(prefix, "r_trace").c_str()} {}
328 
329  template <typename OTYPES> void bind_r(rresp_axi<CFG, OTYPES>& o) {
330  r_id.bind(o.r_id);
331  r_data.bind(o.r_data);
332  r_resp.bind(o.r_resp);
333  r_last.bind(o.r_last);
334  r_valid.bind(o.r_valid);
335  r_ready.bind(o.r_ready);
336  r_user.bind(o.r_user);
337  r_trace.bind(o.r_trace);
338  }
339  template <typename OTYPES> void bind_rresp(rresp_axi<CFG, OTYPES>& o) { bind_r(o); }
340  template <typename OTYPES> void bind_r(rresp_axi_lite<CFG, OTYPES>& o);
341  template <typename OTYPES> void bind_rresp(rresp_axi_lite<CFG, OTYPES>& o) { bind_r(o); }
342 };
343 
344 template <typename CFG, typename TYPES = master_types> struct rresp_ace {
345  typename TYPES::template s2m_full_t<sc_dt::sc_uint<CFG::IDWIDTH>> r_id{"r_id"};
346  typename TYPES::template s2m_t<typename CFG::data_t> r_data{"r_data"};
347  typename TYPES::template s2m_t<sc_dt::sc_uint<CFG::RESPWIDTH>> r_resp{"r_resp"}; // ACE5-Lite has only 2
348  typename TYPES::template s2m_full_t<bool> r_last{"r_last"};
349  typename TYPES::template s2m_t<bool> r_valid{"r_valid"};
350  typename TYPES::template m2s_t<bool> r_ready{"r_ready"};
351  typename TYPES::template s2m_opt_t<sc_dt::sc_uint<CFG::USERWIDTH>> r_user{"r_user"};
352  typename TYPES::template s2m_opt_t<bool> r_trace{"r_trace"}; // ACE5
353  typename TYPES::template m2s_t<bool> r_ack{"r_ack"}; // only ACE
354 
355  rresp_ace() = default;
356  rresp_ace(const char* prefix)
357  : r_id{concat(prefix, "r_id").c_str()}
358  , r_data{concat(prefix, "r_data").c_str()}
359  , r_resp{concat(prefix, "r_resp").c_str()}
360  , r_last{concat(prefix, "r_last").c_str()}
361  , r_valid{concat(prefix, "r_valid").c_str()}
362  , r_ready{concat(prefix, "r_ready").c_str()}
363  , r_user{concat(prefix, "r_user").c_str()}
364  , r_trace{concat(prefix, "r_trace").c_str()}
365  , r_ack{concat(prefix, "r_ack").c_str()} {}
366 
367  template <typename OTYPES> void bind_r(rresp_ace<CFG, OTYPES>& o) {
368  r_id.bind(o.r_id);
369  r_data.bind(o.r_data);
370  r_resp.bind(o.r_resp);
371  r_last.bind(o.r_last);
372  r_valid.bind(o.r_valid);
373  r_ready.bind(o.r_ready);
374  r_user.bind(o.r_user);
375  r_ack.bind(o.r_ack); // only ACE,not for Lite
376  r_trace.bind(o.r_trace);
377  }
378  template <typename OTYPES> void bind_rresp(rresp_ace<CFG, OTYPES>& o) { bind_r(o); }
379 };
380 
382 template <typename CFG, typename TYPES> struct aw_axi_lite {
383  typename TYPES::template m2s_t<sc_dt::sc_uint<CFG::ADDRWIDTH>> aw_addr{"aw_addr"};
384  typename TYPES::template s2m_t<bool> aw_ready{"aw_ready"};
385  typename TYPES::template m2s_t<bool> aw_valid{"aw_valid"};
386  typename TYPES::template m2s_t<sc_dt::sc_uint<3>> aw_prot{"aw_prot"};
387 
388  aw_axi_lite() = default;
389  aw_axi_lite(const char* prefix)
390  : aw_addr{concat(prefix, "aw_addr").c_str()}
391  , aw_ready{concat(prefix, "aw_ready").c_str()}
392  , aw_valid{concat(prefix, "aw_valid").c_str()}
393  , aw_prot{concat(prefix, "aw_prot").c_str()} {}
394 
395  template <typename OTYPES> void bind_aw(aw_axi<CFG, OTYPES>& o) {
396  aw_addr.bind(o.aw_addr);
397  aw_ready.bind(o.aw_ready);
398  aw_valid.bind(o.aw_valid);
399  aw_prot.bind(o.aw_prot);
400  }
401 };
402 
404 template <typename CFG, typename TYPES> struct wdata_axi_lite {
405  typename TYPES::template m2s_t<typename CFG::data_t> w_data{"w_data"};
406  typename TYPES::template m2s_t<sc_dt::sc_uint<CFG::BUSWIDTH / 8>> w_strb{"w_strb"};
407  typename TYPES::template m2s_t<bool> w_valid{"w_valid"};
408  typename TYPES::template s2m_t<bool> w_ready{"w_ready"};
409 
410  wdata_axi_lite() = default;
411  wdata_axi_lite(const char* prefix)
412  : w_data{concat(prefix, "w_data").c_str()}
413  , w_strb{concat(prefix, "w_strb").c_str()}
414  , w_valid{concat(prefix, "w_valid").c_str()}
415  , w_ready{concat(prefix, "w_ready").c_str()} {}
416 
417  template <typename OTYPES> void bind_w(wdata_axi<CFG, OTYPES>& o) {
418  w_data.bind(o.w_data);
419  w_strb.bind(o.w_strb);
420  w_valid.bind(o.w_valid);
421  w_ready.bind(o.w_ready);
422  }
423 };
424 
426 template <typename CFG, typename TYPES> struct b_axi_lite {
427  typename TYPES::template s2m_t<bool> b_valid{"b_valid"};
428  typename TYPES::template m2s_t<bool> b_ready{"b_ready"};
429  typename TYPES::template s2m_t<sc_dt::sc_uint<2>> b_resp{"b_resp"};
430 
431  b_axi_lite() = default;
432  b_axi_lite(const char* prefix)
433  : b_valid{concat(prefix, "b_valid").c_str()}
434  , b_ready{concat(prefix, "b_ready").c_str()}
435  , b_resp{concat(prefix, "b_resp").c_str()} {}
436 
437  template <typename OTYPES> void bind_b(b_axi<CFG, OTYPES>& o) {
438  b_valid.bind(o.b_valid);
439  b_ready.bind(o.b_ready);
440  b_resp.bind(o.b_resp);
441  }
442 };
443 
445 template <typename CFG, typename TYPES> struct ar_axi_lite {
446  typename TYPES::template m2s_t<sc_dt::sc_uint<CFG::ADDRWIDTH>> ar_addr{"ar_addr"};
447  typename TYPES::template m2s_t<sc_dt::sc_uint<3>> ar_prot{"ar_prot"};
448  typename TYPES::template m2s_t<bool> ar_valid{"ar_valid"};
449  typename TYPES::template s2m_t<bool> ar_ready{"ar_ready"};
450 
451  ar_axi_lite() = default;
452  ar_axi_lite(const char* prefix)
453  : ar_addr{concat(prefix, "ar_addr").c_str()}
454  , ar_prot{concat(prefix, "ar_prot").c_str()}
455  , ar_valid{concat(prefix, "ar_valid").c_str()}
456  , ar_ready{concat(prefix, "ar_ready").c_str()} {}
457 
458  template <typename OTYPES> void bind_ar(ar_axi<CFG, OTYPES>& o) {
459  ar_addr.bind(o.ar_addr);
460  ar_prot.bind(o.ar_prot);
461  ar_valid.bind(o.ar_valid);
462  ar_ready.bind(o.ar_ready);
463  }
464 };
465 
467 template <typename CFG, typename TYPES> struct rresp_axi_lite {
468  typename TYPES::template s2m_t<typename CFG::data_t> r_data{"r_data"};
469  typename TYPES::template s2m_t<sc_dt::sc_uint<2>> r_resp{"r_resp"};
470  typename TYPES::template s2m_t<bool> r_valid{"r_valid"};
471  typename TYPES::template m2s_t<bool> r_ready{"r_ready"};
472 
473  rresp_axi_lite() = default;
474  rresp_axi_lite(const char* prefix)
475  : r_data{concat(prefix, "r_data").c_str()}
476  , r_resp{concat(prefix, "r_resp").c_str()}
477  , r_valid{concat(prefix, "r_valid").c_str()}
478  , r_ready{concat(prefix, "r_ready").c_str()} {}
479 
480  template <typename OTYPES> void bind_r(rresp_axi<CFG, OTYPES>& o) {
481  r_data.bind(o.r_data);
482  r_resp.bind(o.r_resp);
483  r_valid.bind(o.r_valid);
484  r_ready.bind(o.r_ready);
485  }
486 };
487 
488 template <typename CFG, typename TYPES = master_types> struct ar_ace {
489  typename TYPES::template m2s_full_t<sc_dt::sc_uint<CFG::IDWIDTH>> ar_id{"ar_id"};
490  typename TYPES::template m2s_t<sc_dt::sc_uint<CFG::ADDRWIDTH>> ar_addr{"ar_addr"};
491  typename TYPES::template m2s_full_t<sc_dt::sc_uint<8>> ar_len{"ar_len"};
492  typename TYPES::template m2s_full_t<sc_dt::sc_uint<3>> ar_size{"ar_size"};
493  typename TYPES::template m2s_full_t<sc_dt::sc_uint<2>> ar_burst{"ar_burst"};
494  typename TYPES::template m2s_t<bool> ar_lock{"ar_lock"};
495  typename TYPES::template m2s_full_t<sc_dt::sc_uint<4>> ar_cache{"ar_cache"};
496  typename TYPES::template m2s_t<sc_dt::sc_uint<3>> ar_prot{"ar_prot"};
497  typename TYPES::template m2s_full_t<sc_dt::sc_uint<4>> ar_qos{"ar_qos"};
498  typename TYPES::template m2s_full_t<sc_dt::sc_uint<4>> ar_region{"ar_region"};
499  typename TYPES::template m2s_t<bool> ar_valid{"ar_valid"};
500  typename TYPES::template s2m_t<bool> ar_ready{"ar_ready"};
501  typename TYPES::template m2s_full_t<sc_dt::sc_uint<2>> ar_domain{"ar_domain"};
502  typename TYPES::template m2s_full_t<sc_dt::sc_uint<4>> ar_snoop{"ar_snoop"};
503  typename TYPES::template m2s_full_t<sc_dt::sc_uint<2>> ar_bar{"ar_bar"};
504  typename TYPES::template m2s_opt_t<sc_dt::sc_uint<CFG::USERWIDTH>> ar_user{"ar_user"};
505  typename TYPES::template m2s_opt_t<bool> ar_trace{"ar_trace"};
506  typename TYPES::template m2s_opt_t<sc_dt::sc_uint<4>> ar_vmidext{"ar_vmidext"}; // ACE5
507 
508  ar_ace() = default;
509  ar_ace(const char* prefix)
510  : ar_id{concat(prefix, "ar_id").c_str()}
511  , ar_addr{concat(prefix, "ar_addr").c_str()}
512  , ar_len{concat(prefix, "ar_len").c_str()}
513  , ar_size{concat(prefix, "ar_size").c_str()}
514  , ar_burst{concat(prefix, "ar_burst").c_str()}
515  , ar_lock{concat(prefix, "ar_lock").c_str()} // only AXI3
516  , ar_cache{concat(prefix, "ar_cache").c_str()}
517  , ar_prot{concat(prefix, "ar_prot").c_str()}
518  , ar_qos{concat(prefix, "ar_qos").c_str()}
519  , ar_region{concat(prefix, "ar_region").c_str()}
520  , ar_valid{concat(prefix, "ar_valid").c_str()}
521  , ar_ready{concat(prefix, "ar_ready").c_str()}
522  , ar_domain{concat(prefix, "ar_domain").c_str()}
523  , ar_snoop{concat(prefix, "ar_snoop").c_str()}
524  , ar_bar{concat(prefix, "ar_bar").c_str()}
525  , ar_user{concat(prefix, "ar_user").c_str()}
526  , ar_trace{concat(prefix, "ar_trace").c_str()}
527  , ar_vmidext{concat(prefix, "ar_vmidext").c_str()} {}
528 
529  template <typename OTYPES> void bind_ar(ar_ace<CFG, OTYPES>& o) {
530  ar_id.bind(o.ar_id);
531  ar_addr.bind(o.ar_addr);
532  ar_len.bind(o.ar_len);
533  ar_size.bind(o.ar_size);
534  ar_burst.bind(o.ar_burst);
535  ar_lock.bind(o.ar_lock); // only AXI3
536  ar_cache.bind(o.ar_cache);
537  ar_prot.bind(o.ar_prot);
538  ar_qos.bind(o.ar_qos);
539  ar_region.bind(o.ar_region);
540  ar_valid.bind(o.ar_valid);
541  ar_ready.bind(o.ar_ready);
542  ar_domain.bind(o.ar_domain);
543  ar_snoop.bind(o.ar_snoop);
544  ar_bar.bind(o.ar_bar); //
545  ar_user.bind(o.ar_user);
546  ar_trace.bind(o.ar_trace);
547  }
548 };
549 
550 template <typename CFG, typename TYPES = master_types> struct aw_ace {
551  typename TYPES::template m2s_full_t<sc_dt::sc_uint<CFG::IDWIDTH>> aw_id{"aw_id"};
552  typename TYPES::template m2s_t<sc_dt::sc_uint<CFG::ADDRWIDTH>> aw_addr{"aw_addr"};
553  typename TYPES::template s2m_t<bool> aw_ready{"aw_ready"};
554  typename TYPES::template m2s_t<bool> aw_lock{"aw_lock"};
555  typename TYPES::template m2s_t<bool> aw_valid{"aw_valid"};
556  typename TYPES::template m2s_t<sc_dt::sc_uint<3>> aw_prot{"aw_prot"};
557  typename TYPES::template m2s_full_t<sc_dt::sc_uint<3>> aw_size{"aw_size"};
558  typename TYPES::template m2s_full_t<sc_dt::sc_uint<4>> aw_cache{"aw_cache"};
559  typename TYPES::template m2s_full_t<sc_dt::sc_uint<2>> aw_burst{"aw_burst"};
560  typename TYPES::template m2s_full_t<sc_dt::sc_uint<4>> aw_qos{"aw_qos"};
561  typename TYPES::template m2s_full_t<sc_dt::sc_uint<4>> aw_region{"aw_region"};
562  typename TYPES::template m2s_full_t<sc_dt::sc_uint<8>> aw_len{"aw_len"};
563  typename TYPES::template m2s_full_t<sc_dt::sc_uint<2>> aw_domain{"aw_domain"}; // ace
564  typename TYPES::template m2s_full_t<sc_dt::sc_uint<CFG::AWSNOOPWIDTH>> aw_snoop{"aw_snoop"}; // ace5-lite has 4 bits
565  typename TYPES::template m2s_full_t<sc_dt::sc_uint<2>> aw_bar{"aw_bar"}; // ace
566  typename TYPES::template m2s_t<bool> aw_unique{"aw_unique"}; // ace, not for lite
567  typename TYPES::template m2s_full_t<sc_dt::sc_uint<CFG::USERWIDTH>> aw_user{"aw_user"};
568  typename TYPES::template m2s_t<bool> aw_stashniden{"aw_stashniden"}; // stash only for ACE5L
569  typename TYPES::template m2s_full_t<sc_dt::sc_uint<11>> aw_stashnid{"aw_stashnid"};
570  typename TYPES::template m2s_t<bool> aw_stashlpiden{"aw_stashlpiden"};
571  typename TYPES::template m2s_full_t<sc_dt::sc_uint<5>> aw_stashlpid{"aw_stashlpid"};
572  typename TYPES::template m2s_opt_t<sc_dt::sc_uint<6>> aw_atop{"aw_atop"}; // only for ace lite
573  typename TYPES::template m2s_opt_t<bool> aw_trace{"aw_trace"};
574 
575  aw_ace() = default;
576  aw_ace(const char* prefix)
577  : aw_id{concat(prefix, "aw_id").c_str()}
578  , aw_addr{concat(prefix, "aw_addr").c_str()}
579  , aw_ready{concat(prefix, "aw_ready").c_str()}
580  , aw_lock{concat(prefix, "aw_lock").c_str()}
581  , aw_valid{concat(prefix, "aw_valid").c_str()}
582  , aw_prot{concat(prefix, "aw_prot").c_str()}
583  , aw_size{concat(prefix, "aw_size").c_str()}
584  , aw_cache{concat(prefix, "aw_cache").c_str()}
585  , aw_burst{concat(prefix, "aw_burst").c_str()}
586  , aw_qos{concat(prefix, "aw_qos").c_str()}
587  , aw_region{concat(prefix, "aw_region").c_str()}
588  , aw_len{concat(prefix, "aw_len").c_str()}
589  , aw_domain{concat(prefix, "aw_domain").c_str()}
590  , aw_snoop{concat(prefix, "aw_snoop").c_str()}
591  , aw_bar{concat(prefix, "aw_bar").c_str()}
592  , aw_unique{concat(prefix, "aw_unique").c_str()}
593  , aw_user{concat(prefix, "aw_user").c_str()}
594  , aw_stashniden{concat(prefix, "aw_stashniden").c_str()}
595  , aw_stashnid{concat(prefix, "aw_stashnid").c_str()}
596  , aw_stashlpiden{concat(prefix, "aw_stashlpiden").c_str()}
597  , aw_stashlpid{concat(prefix, "aw_stashlpid").c_str()}
598  , aw_atop{concat(prefix, "aw_atop").c_str()}
599  , aw_trace{concat(prefix, "aw_trace").c_str()} {}
600 
601  template <typename OTYPES> void bind_aw(aw_ace<CFG, OTYPES>& o) {
602  aw_id.bind(o.aw_id);
603  aw_addr.bind(o.aw_addr);
604  aw_ready.bind(o.aw_ready);
605  aw_lock.bind(o.aw_lock); // only AXI3
606  aw_valid.bind(o.aw_valid);
607  aw_prot.bind(o.aw_prot);
608  aw_size.bind(o.aw_size);
609  aw_cache.bind(o.aw_cache);
610  aw_burst.bind(o.aw_burst);
611  aw_qos.bind(o.aw_qos);
612  aw_region.bind(o.aw_region);
613  aw_len.bind(o.aw_len);
614  aw_domain.bind(o.aw_domain);
615  aw_snoop.bind(o.aw_snoop);
616  aw_bar.bind(o.aw_bar);
617  aw_unique.bind(o.aw_unique);
618  aw_user.bind(o.aw_user);
619  aw_stashniden.bind(o.aw_stashniden);
620  aw_stashnid.bind(o.aw_stashnid);
621  aw_stashlpiden.bind(o.aw_stashlpiden);
622  aw_stashlpid.bind(o.aw_stashlpid);
623  aw_atop.bind(o.aw_atop);
624  aw_trace.bind(o.aw_trace);
625  }
626 };
627 
629 template <typename CFG, typename TYPES = master_types> struct ac_ace {
630  typename TYPES::template s2m_t<bool> ac_valid{"ac_valid"};
631  typename TYPES::template m2s_t<bool> ac_ready{"ac_ready"};
632  typename TYPES::template s2m_t<sc_dt::sc_uint<CFG::ADDRWIDTH>> ac_addr{"ac_addr"};
633  typename TYPES::template s2m_full_t<sc_dt::sc_uint<4>> ac_snoop{"ac_snoop"};
634  typename TYPES::template s2m_full_t<sc_dt::sc_uint<3>> ac_prot{"ac_prot"};
635  typename TYPES::template s2m_opt_t<sc_dt::sc_uint<4>> ac_vmidext{"ac_vmidext"}; // ACE5
636  typename TYPES::template s2m_opt_t<bool> ac_trace{"ac_trace"}; // ACE5
637 
638  ac_ace() = default;
639  ac_ace(const char* prefix)
640  : ac_valid{concat(prefix, "ac_valid").c_str()}
641  , ac_ready{concat(prefix, "ac_ready").c_str()}
642  , ac_addr{concat(prefix, "ac_addr").c_str()}
643  , ac_snoop{concat(prefix, "ac_snoop").c_str()}
644  , ac_prot{concat(prefix, "ac_prot").c_str()}
645  , ac_vmidext{concat(prefix, "ac_vmidext").c_str()}
646  , ac_trace{concat(prefix, "ac_trace").c_str()} {}
647 
648  template <typename OTYPES> void bind_ac(ac_ace<CFG, OTYPES>& o) {
649  ac_valid.bind(o.ac_valid);
650  ac_ready.bind(o.ac_ready);
651  ac_addr.bind(o.ac_addr);
652  ac_snoop.bind(o.ac_snoop);
653  ac_prot.bind(o.ac_prot);
654  }
655 };
656 
658 template <typename CFG, typename TYPES = master_types> struct cd_ace {
659  typename TYPES::template m2s_t<bool> cd_valid{"cd_valid"};
660  typename TYPES::template s2m_t<bool> cd_ready{"cd_ready"};
661  typename TYPES::template m2s_t<typename CFG::data_t> cd_data{"cd_data"};
662  typename TYPES::template m2s_full_t<bool> cd_last{"cd_last"};
663 
664  cd_ace() = default;
665  cd_ace(const char* prefix)
666  : cd_valid{concat(prefix, "cd_valid").c_str()}
667  , cd_ready{concat(prefix, "cd_ready").c_str()}
668  , cd_data{concat(prefix, "cd_data").c_str()}
669  , cd_last{concat(prefix, "cd_last").c_str()} {}
670 
671  template <typename OTYPES> void bind_cd(cd_ace<CFG, OTYPES>& o) {
672  cd_valid.bind(o.cd_valid);
673  cd_ready.bind(o.cd_ready);
674  cd_data.bind(o.cd_data);
675  cd_last.bind(o.cd_last);
676  }
677 };
678 
680 template <typename CFG, typename TYPES = master_types> struct cr_ace {
681  typename TYPES::template m2s_t<bool> cr_valid{"cr_valid"};
682  typename TYPES::template s2m_t<bool> cr_ready{"cr_ready"};
683  typename TYPES::template m2s_t<sc_dt::sc_uint<5>> cr_resp{"cr_resp"};
684  typename TYPES::template m2s_opt_t<bool> cr_trace{"cr_trace"}; // ACE5
685 
686  cr_ace() = default;
687  cr_ace(const char* prefix)
688  : cr_valid{concat(prefix, "cr_valid").c_str()}
689  , cr_ready{concat(prefix, "cr_ready").c_str()}
690  , cr_resp{concat(prefix, "cr_resp").c_str()}
691  , cr_trace{concat(prefix, "cr_trace").c_str()} {}
692 
693  template <typename OTYPES> void bind_cr(cr_ace<CFG, OTYPES>& o) {
694  cr_valid.bind(o.cr_valid);
695  cr_ready.bind(o.cr_ready);
696  cr_resp.bind(o.cr_resp);
697  }
698 };
700 template <typename CFG, typename TYPES = master_types> using wdata_ace = wdata_axi<CFG, TYPES>;
701 template <typename CFG, typename TYPES = master_types> using b_ace = b_axi<CFG, TYPES>;
702 template <typename CFG, typename TYPES = master_types> using wdata_ace_lite = wdata_axi<CFG, TYPES>;
703 template <typename CFG, typename TYPES = master_types> using b_ace_lite = b_axi<CFG, TYPES>;
704 template <typename CFG, typename TYPES = master_types> using rresp_ace_lite = rresp_axi<CFG, TYPES>;
705 template <typename CFG, typename TYPES = master_types> using aw_ace_lite = aw_ace<CFG, TYPES>;
706 template <typename CFG, typename TYPES = master_types> using ar_ace_lite = ar_ace<CFG, TYPES>;
707 
708 template <typename CFG, typename TYPES> template <typename OTYPES> inline void ar_axi<CFG, TYPES>::bind_ar(ar_axi_lite<CFG, OTYPES>& o) {
709  ar_addr.bind(o.ar_addr);
710  ar_prot.bind(o.ar_prot);
711  ar_valid.bind(o.ar_valid);
712  ar_ready.bind(o.ar_ready);
713 }
714 
715 template <typename CFG, typename TYPES>
716 template <typename OTYPES>
717 inline void rresp_axi<CFG, TYPES>::bind_r(rresp_axi_lite<CFG, OTYPES>& o) {
718  r_data.bind(o.r_data);
719  r_resp.bind(o.r_resp);
720  r_valid.bind(o.r_valid);
721  r_ready.bind(o.r_ready);
722 }
723 
724 template <typename CFG, typename TYPES> template <typename OTYPES> inline void aw_axi<CFG, TYPES>::bind_aw(aw_axi_lite<CFG, OTYPES>& o) {
725  aw_addr.bind(o.aw_addr);
726  aw_ready.bind(o.aw_ready);
727  aw_valid.bind(o.aw_valid);
728  aw_prot.bind(o.aw_prot);
729 }
730 
731 template <typename CFG, typename TYPES>
732 template <typename OTYPES>
733 inline void wdata_axi<CFG, TYPES>::bind_w(wdata_axi_lite<CFG, OTYPES>& o) {
734  w_data.bind(o.w_data);
735  w_strb.bind(o.w_strb);
736  w_valid.bind(o.w_valid);
737  w_ready.bind(o.w_ready);
738 }
739 
740 template <typename CFG, typename TYPES> template <typename OTYPES> inline void b_axi<CFG, TYPES>::bind_b(b_axi_lite<CFG, OTYPES>& o) {
741  b_valid.bind(o.b_valid);
742  b_ready.bind(o.b_ready);
743  b_resp.bind(o.b_resp);
744 }
745 
746 } // namespace axi
747 #endif /* _BUS_AXI_SIGNAL_IF_H_ */
TLM2.0 components modeling AHB.
Definition: axi_initiator.h:30
snoop address(AC) channel signals
Definition: signal_if.h:629
read address channel signals
Definition: signal_if.h:445
Write address channel signals.
Definition: signal_if.h:382
write response channel signals
Definition: signal_if.h:426
snoop data(cd) channel signals
Definition: signal_if.h:658
snoop response(cr) channel signals
Definition: signal_if.h:680
Read data channel signals.
Definition: signal_if.h:467
write data channel signals
Definition: signal_if.h:404