scc  2022.4.0
SystemC components library
axi_tlm.h
1 /*
2  * Copyright 2020 Arteris IP
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 #pragma once
18 
19 #include <array>
20 #include <cstdint>
21 #include <tlm>
22 #include <type_traits>
23 
25 namespace axi {
26 
27 enum class flavor_e { AXI, ACEL, ACE };
28 
32 template <typename Enum> struct enable_for_enum { static const bool value = false; };
38 template <typename E> inline E into(typename std::underlying_type<E>::type t);
44 template <
45  typename E, typename ULT = typename std::underlying_type<E>::type,
46  typename X = typename std::enable_if<std::is_enum<E>::value && !std::is_convertible<E, ULT>::value, bool>::type>
47 inline constexpr ULT to_int(E t) {
48  return static_cast<typename std::underlying_type<E>::type>(t);
49 }
55 template <typename E> const char* to_char(E t);
62 template <typename E, typename std::enable_if<enable_for_enum<E>::value, bool>::type>
63 inline std::ostream& operator<<(std::ostream& os, E e) {
64  os << to_char(e);
65  return os;
66 }
67 
68 std::ostream& operator<<(std::ostream& os, tlm::tlm_generic_payload const& t);
69 
73 enum class burst_e : uint8_t {
74  FIXED = 0,
75  INCR = 1,
76  WRAP = 2
77 };
81 enum class lock_e : uint8_t { NORMAL = 0x0, EXLUSIVE = 0x1, LOCKED = 0x2 };
85 enum class domain_e : uint8_t { NON_SHAREABLE = 0x0, INNER_SHAREABLE = 0x1, OUTER_SHAREABLE = 0x2, SYSTEM = 0x3 };
89 enum class bar_e : uint8_t {
90  RESPECT_BARRIER = 0x0,
91  MEMORY_BARRIER = 0x1,
92  IGNORE_BARRIER = 0x2,
94 };
95 
99 enum class snoop_e : uint8_t {
100  // clang-format off
101  // non-snooping (domain==0 || domain==3, bar==0)
102  READ_NO_SNOOP = 0x10,
103  // Coherent (domain==1 || domain==2, bar==0)
104  READ_ONCE = 0x0,
105  READ_SHARED = 0x1,
106  READ_CLEAN = 0x2,
107  READ_NOT_SHARED_DIRTY = 0x3,
108  READ_ONCE_CLEAN_INVALID = 0x4, // ACE5
109  READ_ONCE_MAKE_INVALID = 0x5, // ACE5
110  READ_UNIQUE = 0x7,
111  CLEAN_UNIQUE = 0xb,
112  MAKE_UNIQUE = 0xc,
113  // Cache maintenance (domain==0 || domain==1 || domain==2, bar==0)
114  CLEAN_SHARED = 0x8,
115  CLEAN_INVALID = 0x9,
116  CLEAN_SHARED_PERSIST = 0xa, // ACE5
117  MAKE_INVALID = 0xd,
118  // DVM (domain==1 || domain==2, bar==0)
119  DVM_COMPLETE = 0xe,
120  DVM_MESSAGE = 0xf,
121  // Barrier (bar==1)
122  BARRIER = 0x40,
123  // non-snooping (domain==0 || domain==3, bar==0)
124  WRITE_NO_SNOOP = 0x30,
125  // Coherent (domain==1 || domain==2, bar==0)
126  WRITE_UNIQUE = 0x20,
127  WRITE_LINE_UNIQUE = 0x21,
128  // Memory update (domain==0 || domain==1 || domain==2, bar==0)
129  WRITE_CLEAN = 0x22,
130  WRITE_BACK = 0x23,
131  // (domain==1 || domain==2)
132  EVICT = 0x24,
133  WRITE_EVICT = 0x25,
134  CMO_ON_WRITE = 0x26, // ACE5Lite
135  // Cache Stash Transactions, ACE5Lite
136  WRITE_UNIQUE_PTL_STASH = 0x28,
137  WRITE_UNIQUE_FULL_STASH = 0x29,
138  STASH_ONCE_SHARED = 0x2c,
139  STASH_ONCE_UNIQUE = 0x2d,
140  STASH_TRANSLATION = 0x2e
141  // clang-format on
142 };
143 
144 enum class atop_low_e { ADD = 0x0, CLR = 0x1, EOR = 0x2, SET = 0x3, SMAX = 0x4, SMIN = 0x5, UMAX = 0x6, UMIN = 0x7 };
145 
146 enum class atop_enc_e {
147  NonAtomic = 0x00,
148  AtomicStore = 0x10,
149  AtomicLoad = 0x20,
150  AtomicSwap = 0x30,
151  AtomicCompare = 0x31,
152 };
156 enum class resp_e : uint8_t { OKAY = 0x0, EXOKAY = 0x1, SLVERR = 0x2, DECERR = 0x3 };
160 struct common {
162  common() = default;
164  void reset();
170  common& operator=(const common& o) {
171  id = o.id;
172  user = o.user;
173  return *this;
174  }
178  enum class id_type { CTRL, DATA, RESP };
181  void set_id(unsigned int value);
184  unsigned int get_id() const;
188  void set_user(id_type chnl, unsigned int value);
191  unsigned int get_user(id_type chnl) const;
192 
193 protected:
194  unsigned id{0};
195  std::array<unsigned, 3> user{{0, 0, 0}};
196 };
204 struct request {
206  request() = default;
208  void reset();
213  void set_length(uint8_t);
218  uint8_t get_length() const;
223  void set_size(uint8_t);
228  uint8_t get_size() const;
233  void set_burst(burst_e);
238  burst_e get_burst() const;
243  void set_prot(uint8_t);
248  uint8_t get_prot() const;
253  void set_privileged(bool = true);
258  bool is_privileged() const;
263  void set_non_secure(bool = true);
268  bool is_non_secure() const;
273  void set_instruction(bool = true);
278  bool is_instruction() const;
283  void set_cache(uint8_t);
288  uint8_t get_cache() const;
293  void set_qos(uint8_t);
298  uint8_t get_qos() const;
303  void set_region(uint8_t);
308  uint8_t get_region() const;
313  void set_atop(uint8_t);
318  uint8_t get_atop() const;
323  void set_stash_nid(uint8_t);
328  uint8_t get_stash_nid() const;
333  bool is_stash_nid_en() const;
338  void set_stash_lpid(uint8_t);
343  uint8_t get_stash_lpid() const;
348  bool is_stash_lpid_en() const;
349 
350 protected:
356  request& operator=(const request& o) {
357  length = o.length;
358  size = o.size;
359  burst = o.burst;
360  prot = o.prot;
361  qos = o.qos;
362  region = o.region;
363  domain = o.domain;
364  snoop = o.snoop;
365  barrier = o.barrier;
366  lock = o.lock;
367  cache = o.cache;
368  unique = o.unique;
369  atop = o.atop;
370  return *this;
371  }
372 
373  enum { // bit masks
374  BUFFERABLE = 1,
375  CACHEABLE = 2,
376  RA = 4,
377  WA = 8,
378  EXCL = 1,
379  LOCKED = 2,
380  PRIVILEGED = 1,
381  SECURE = 2,
382  INSTRUCTION = 4
383  };
384  bool unique{false};
385  // sums up to sizeof(bool) +11 bytes + sizeof(response)= 16bytes
386  uint8_t length{0};
387  uint8_t size{0};
388  burst_e burst{burst_e::FIXED};
389  uint8_t prot{0};
390  uint8_t qos{0};
391  uint8_t region{0};
392  domain_e domain{domain_e::NON_SHAREABLE};
393  snoop_e snoop{snoop_e::READ_NO_SNOOP};
394  bar_e barrier{bar_e::RESPECT_BARRIER};
395  lock_e lock{lock_e::NORMAL};
396  uint8_t cache{0};
397  uint8_t atop{0};
398  uint16_t stash_nid{std::numeric_limits<uint16_t>::max()};
399  uint8_t stash_lpid{std::numeric_limits<uint8_t>::max()};
400 };
404 struct axi3 : public request {
410  axi3& operator=(const axi3& o) {
412  return *this;
413  }
418  void set_exclusive(bool = true);
423  bool is_exclusive() const;
428  void set_locked(bool = true);
433  bool is_locked() const;
438  void set_bufferable(bool = true);
443  bool is_bufferable() const;
448  void set_cacheable(bool = true);
453  bool is_cacheable() const;
458  void set_write_allocate(bool = true);
463  bool is_write_allocate() const;
468  void set_read_allocate(bool = true);
473  bool is_read_allocate() const;
474 };
478 struct axi4 : public request {
484  axi4& operator=(const axi4& o) {
486  return *this;
487  }
492  void set_exclusive(bool = true);
497  bool is_exclusive() const;
502  void set_bufferable(bool = true);
507  bool is_bufferable() const;
512  void set_modifiable(bool = true);
517  bool is_modifiable() const;
522  void set_read_other_allocate(bool = true);
527  bool is_read_other_allocate() const;
532  void set_write_other_allocate(bool = true);
537  bool is_write_other_allocate() const;
538 };
542 struct ace : public axi4 {
548  ace& operator=(const ace& o) {
550  return *this;
551  }
556  void set_domain(domain_e);
561  domain_e get_domain() const;
566  void set_snoop(snoop_e);
571  snoop_e get_snoop() const;
576  void set_barrier(bar_e);
581  bar_e get_barrier() const;
586  void set_unique(bool);
591  bool get_unique() const;
592 };
596 struct response {
597  response() = default;
604  resp = o.resp;
605  return *this;
606  }
610  void reset();
616  static resp_e from_tlm_response_status(tlm::tlm_response_status);
622  static tlm::tlm_response_status to_tlm_response_status(resp_e);
627  void set_resp(resp_e);
632  resp_e get_resp() const;
637  bool is_okay() const;
641  void set_okay();
646  bool is_exokay() const;
650  void set_exokay();
655  bool is_slverr() const;
659  void set_slverr();
664  bool is_decerr() const;
668  void set_decerr();
669 
670 protected:
671  enum { // bit masks for CRESP
672  DATATRANSFER = 1,
673  SNOOPEERROR = 2,
674  PASSDIRTY = 4,
675  ISSHARED = 8,
676  WASUNIQUE = 16
677  };
678  uint8_t resp{static_cast<uint8_t>(resp_e::OKAY)};
679 };
683 struct ace_response : public response {
688  void set_cresp(uint8_t);
693  uint8_t get_cresp() const;
698  bool is_pass_dirty() const;
703  void set_pass_dirty(bool = true);
708  bool is_shared() const;
713  void set_shared(bool = true);
718  // CRRESP[0]
719  bool is_snoop_data_transfer() const;
724  void set_snoop_data_transfer(bool = true);
729  // CRRESP[1]
730  bool is_snoop_error() const;
735  void set_snoop_error(bool = true);
740  // CRRESP[4]
741  bool is_snoop_was_unique() const;
746  void set_snoop_was_unique(bool = true);
747 };
751 template <typename REQ, typename RESP = response>
752 struct axi_extension : public common, // 2x 4byte
753  public REQ, // 11byte + 4byte
754  public RESP // 1byte
755 {
759  axi_extension() = default;
768  virtual ~axi_extension() {}
772  void reset();
777  void reset(const REQ*);
787  const std::vector<response>& get_response_array() const;
792  std::vector<response>& get_response_array();
797  void set_response_array_complete(bool = true);
803 
804 private:
805  std::vector<response> response_arr{};
806  bool response_array_complete{false};
807 };
811 struct axi3_extension : public tlm::tlm_extension<axi3_extension>, public axi_extension<axi3> {
815  axi3_extension() = default;
821  : axi_extension<axi3>(o) {}
826  tlm::tlm_extension_base* clone() const override;
831  void copy_from(tlm::tlm_extension_base const& ext) override;
832 };
836 struct axi4_extension : public tlm::tlm_extension<axi4_extension>, public axi_extension<axi4> {
840  axi4_extension() = default;
846  : axi_extension<axi4>(o) {}
851  tlm::tlm_extension_base* clone() const override;
856  void copy_from(tlm::tlm_extension_base const& ext) override;
857 };
861 struct ace_extension : public tlm::tlm_extension<ace_extension>, public axi_extension<ace, ace_response> {
865  ace_extension() = default;
871  : axi_extension<ace, ace_response>(o) {}
876  tlm::tlm_extension_base* clone() const override;
881  void copy_from(tlm::tlm_extension_base const& ext) override;
882 };
884 using axi_payload = tlm::tlm_generic_payload;
885 using axi_phase = tlm::tlm_phase;
891  typedef axi_payload tlm_payload_type;
892  typedef axi_phase tlm_phase_type;
893 };
897 DECLARE_EXTENDED_PHASE(BEGIN_PARTIAL_REQ);
898 DECLARE_EXTENDED_PHASE(END_PARTIAL_REQ);
899 DECLARE_EXTENDED_PHASE(BEGIN_PARTIAL_RESP);
900 DECLARE_EXTENDED_PHASE(END_PARTIAL_RESP);
905 template <typename TRANS = tlm::tlm_generic_payload>
906 class bw_blocking_transport_if : public virtual sc_core::sc_interface {
907 public:
913  virtual void b_snoop(TRANS& trans, sc_core::sc_time& t) = 0;
914 };
916 template <typename TYPES = axi_protocol_types> using axi_fw_transport_if = tlm::tlm_fw_transport_if<TYPES>;
918 template <typename TYPES = axi_protocol_types> using axi_bw_transport_if = tlm::tlm_bw_transport_if<TYPES>;
920 template <typename TYPES = axi_protocol_types> using ace_fw_transport_if = tlm::tlm_fw_transport_if<TYPES>;
924 template <typename TYPES = axi_protocol_types>
925 class ace_bw_transport_if : public tlm::tlm_bw_transport_if<TYPES>,
930 template <unsigned int BUSWIDTH = 32, typename TYPES = axi_protocol_types, int N = 1,
931  sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND>
933 : public tlm::tlm_base_initiator_socket<BUSWIDTH, axi_fw_transport_if<TYPES>, axi_bw_transport_if<TYPES>, N, POL> {
935  using base_type =
936  tlm::tlm_base_initiator_socket<BUSWIDTH, axi_fw_transport_if<TYPES>, axi_bw_transport_if<TYPES>, N, POL>;
941  : base_type() {}
946  explicit axi_initiator_socket(const char* name)
947  : base_type(name) {}
952  const char* kind() const override { return "axi_initiator_socket"; }
953  // not the right version but we assume TLM is always bundled with SystemC
954 #if SYSTEMC_VERSION >= 20181013 // ((TLM_VERSION_MAJOR > 2) || (TLM_VERSION==2 && TLM_VERSION_MINOR>0) ||(TLM_VERSION==2
955  // && TLM_VERSION_MINOR>0 && TLM_VERSION_PATCH>4))
956  sc_core::sc_type_index get_protocol_types() const override { return typeid(TYPES); }
957 #endif
958 };
962 template <unsigned int BUSWIDTH = 32, typename TYPES = axi_protocol_types, int N = 1,
963  sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND>
965 : public tlm::tlm_base_target_socket<BUSWIDTH, axi_fw_transport_if<TYPES>, axi_bw_transport_if<TYPES>, N, POL> {
967  using base_type =
968  tlm::tlm_base_target_socket<BUSWIDTH, axi_fw_transport_if<TYPES>, axi_bw_transport_if<TYPES>, N, POL>;
973  : base_type() {}
978  explicit axi_target_socket(const char* name)
979  : base_type(name) {}
984  const char* kind() const override { return "axi_target_socket"; }
985  // not the right version but we assume TLM is always bundled with SystemC
986 #if SYSTEMC_VERSION >= 20181013 // ((TLM_VERSION_MAJOR > 2) || (TLM_VERSION==2 && TLM_VERSION_MINOR>0) ||(TLM_VERSION==2
987  // && TLM_VERSION_MINOR>0 && TLM_VERSION_PATCH>4))
988  sc_core::sc_type_index get_protocol_types() const override { return typeid(TYPES); }
989 #endif
990 };
994 template <unsigned int BUSWIDTH = 32, typename TYPES = axi_protocol_types, int N = 1,
995  sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND>
997 : public tlm::tlm_base_initiator_socket<BUSWIDTH, ace_fw_transport_if<TYPES>, ace_bw_transport_if<TYPES>, N, POL> {
999  using base_type =
1000  tlm::tlm_base_initiator_socket<BUSWIDTH, ace_fw_transport_if<TYPES>, ace_bw_transport_if<TYPES>, N, POL>;
1005  : base_type() {}
1010  explicit ace_initiator_socket(const char* name)
1011  : base_type(name) {}
1016  const char* kind() const override { return "axi_initiator_socket"; }
1017 #if SYSTEMC_VERSION >= 20181013 // not the right version but we assume TLM is always bundled with SystemC
1022  sc_core::sc_type_index get_protocol_types() const override { return typeid(TYPES); }
1023 #endif
1024 };
1028 template <unsigned int BUSWIDTH = 32, typename TYPES = axi_protocol_types, int N = 1,
1029  sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND>
1031 : public tlm::tlm_base_target_socket<BUSWIDTH, ace_fw_transport_if<TYPES>, ace_bw_transport_if<TYPES>, N, POL> {
1033  using base_type =
1034  tlm::tlm_base_target_socket<BUSWIDTH, ace_fw_transport_if<TYPES>, ace_bw_transport_if<TYPES>, N, POL>;
1039  : base_type() {}
1044  explicit ace_target_socket(const char* name)
1045  : base_type(name) {}
1050  const char* kind() const override { return "axi_target_socket"; }
1051  // not the right version but we assume TLM is always bundled with SystemC
1052 #if SYSTEMC_VERSION >= 20181013 // not the right version but we assume TLM is always bundled with SystemC
1057  sc_core::sc_type_index get_protocol_types() const override { return typeid(TYPES); }
1058 #endif
1059 };
1060 /*****************************************************************************
1061  * free function easing handling of transactions and extensions
1062  *****************************************************************************/
1063 
1064 template <typename EXT> bool is_valid(EXT& ext) { return is_valid(&ext); }
1065 
1066 template <typename EXT> bool is_valid(EXT* ext) { return is_valid_msg(ext) == nullptr; }
1067 
1068 template <typename EXT> char const* is_valid_msg(EXT& ext) { return is_valid_msg(&ext); }
1069 
1070 template <typename EXT> char const* is_valid_msg(EXT* ext);
1071 
1072 inline bool is_dataless(axi::ace_extension const* ext) {
1073  if(!ext)
1074  return false;
1075  auto snp = ext->get_snoop();
1076  return snp == snoop_e::CLEAN_UNIQUE || snp == snoop_e::MAKE_UNIQUE || snp == snoop_e::CLEAN_SHARED ||
1077  snp == snoop_e::CLEAN_INVALID || snp == snoop_e::MAKE_INVALID || snp == snoop_e::EVICT ||
1078  snp == snoop_e::STASH_ONCE_SHARED || snp == snoop_e::STASH_ONCE_UNIQUE;
1079 }
1080 
1081 inline unsigned get_axi_id(axi::axi_protocol_types::tlm_payload_type const& trans) {
1082  if(auto e = trans.get_extension<axi::ace_extension>())
1083  return e->get_id();
1084  if(auto e = trans.get_extension<axi::axi4_extension>())
1085  return e->get_id();
1086  if(auto e = trans.get_extension<axi::axi3_extension>())
1087  return e->get_id();
1088  sc_assert(false && "transaction is not an axi or ace transaction");
1089  return std::numeric_limits<unsigned>::max();
1090 }
1091 
1092 inline unsigned get_axi_id(axi::axi_protocol_types::tlm_payload_type const* trans) { return get_axi_id(*trans); }
1093 
1101 inline bool is_burst(const axi::axi_protocol_types::tlm_payload_type& trans) {
1102  if(auto e = trans.get_extension<axi::ace_extension>())
1103  return e->get_length() > 0;
1104  if(auto e = trans.get_extension<axi::axi4_extension>())
1105  return e->get_length() > 0;
1106  if(auto e = trans.get_extension<axi::axi3_extension>())
1107  return e->get_length() > 0;
1108  sc_assert(false && "transaction is not an axi or ace transaction");
1109  return false;
1110 }
1116 inline bool is_burst(const axi::axi_protocol_types::tlm_payload_type* trans) { return is_burst(*trans); }
1122 inline unsigned get_burst_length(const request& r) { return r.get_length() + 1; }
1128 inline unsigned get_burst_length(const request* r) { return r->get_length() + 1; }
1134 inline unsigned get_burst_length(const axi::axi_protocol_types::tlm_payload_type& trans) {
1135  if(auto e = trans.get_extension<axi::ace_extension>())
1136  return e->get_length() + 1;
1137  if(auto e = trans.get_extension<axi::axi4_extension>())
1138  return e->get_length() + 1;
1139  if(auto e = trans.get_extension<axi::axi3_extension>())
1140  return e->get_length() + 1;
1141  sc_assert(false && "transaction is not an axi or ace transaction");
1142  return 0;
1143 }
1149 inline unsigned get_burst_length(const axi::axi_protocol_types::tlm_payload_type* trans) {
1150  return get_burst_length(*trans);
1151 }
1157 inline unsigned get_burst_size(const request& r) { return 1 << r.get_size(); }
1163 inline unsigned get_burst_size(const request* r) { return 1 << r->get_size(); }
1169 inline unsigned get_burst_size(const axi::axi_protocol_types::tlm_payload_type& trans) {
1170  if(auto e = trans.get_extension<axi::ace_extension>())
1171  return 1 << e->get_size();
1172  if(auto e = trans.get_extension<axi::axi4_extension>())
1173  return 1 << e->get_size();
1174  if(auto e = trans.get_extension<axi::axi3_extension>())
1175  return 1 << e->get_size();
1176  sc_assert(false && "transaction is not an axi or ace transaction");
1177  return 0;
1178 }
1184 inline unsigned get_burst_size(const axi::axi_protocol_types::tlm_payload_type* trans) {
1185  return get_burst_size(*trans);
1186 }
1187 
1188 inline burst_e get_burst_type(const axi::axi_protocol_types::tlm_payload_type& trans) {
1189  if(auto e = trans.get_extension<axi::ace_extension>())
1190  return e->get_burst();
1191  if(auto e = trans.get_extension<axi::axi4_extension>())
1192  return e->get_burst();
1193  if(auto e = trans.get_extension<axi::axi3_extension>())
1194  return e->get_burst();
1195  sc_assert(false && "transaction is not an axi or ace transaction");
1196  return burst_e::FIXED;
1197 }
1198 inline burst_e get_burst_type(const axi::axi_protocol_types::tlm_payload_type* trans) { return get_burst_type(*trans); }
1199 
1200 inline unsigned get_cache(const axi::axi_protocol_types::tlm_payload_type& trans) {
1201  if(auto e = trans.get_extension<axi::ace_extension>())
1202  return e->get_cache();
1203  if(auto e = trans.get_extension<axi::axi4_extension>())
1204  return e->get_cache();
1205  if(auto e = trans.get_extension<axi::axi3_extension>())
1206  return e->get_cache();
1207  sc_assert(false && "transaction is not an axi or ace transaction");
1208  return 0;
1209 }
1210 inline unsigned get_cache(const axi::axi_protocol_types::tlm_payload_type* trans) { return get_cache(*trans); }
1211 
1212 /*****************************************************************************
1213  * Implementation details
1214  *****************************************************************************/
1215 template <> struct enable_for_enum<burst_e> { static const bool enable = true; };
1216 template <> struct enable_for_enum<lock_e> { static const bool enable = true; };
1217 template <> struct enable_for_enum<domain_e> { static const bool enable = true; };
1218 template <> struct enable_for_enum<bar_e> { static const bool enable = true; };
1219 template <> struct enable_for_enum<snoop_e> { static const bool enable = true; };
1220 template <> struct enable_for_enum<resp_e> { static const bool enable = true; };
1221 
1222 template <> inline burst_e into<burst_e>(typename std::underlying_type<burst_e>::type t) {
1223  assert(t <= static_cast<std::underlying_type<burst_e>::type>(burst_e::WRAP));
1224  return static_cast<burst_e>(t);
1225 }
1226 
1227 template <> inline lock_e into<lock_e>(typename std::underlying_type<lock_e>::type t) {
1228  assert(t <= static_cast<std::underlying_type<lock_e>::type>(lock_e::LOCKED));
1229  return static_cast<lock_e>(t);
1230 }
1231 
1232 template <> inline domain_e into<domain_e>(typename std::underlying_type<domain_e>::type t) {
1233  assert(t <= static_cast<std::underlying_type<domain_e>::type>(domain_e::SYSTEM));
1234  return static_cast<domain_e>(t);
1235 }
1236 
1237 template <> inline bar_e into<bar_e>(typename std::underlying_type<bar_e>::type t) {
1238  assert(t <= static_cast<std::underlying_type<bar_e>::type>(bar_e::SYNCHRONISATION_BARRIER));
1239  return static_cast<bar_e>(t);
1240 }
1241 
1242 template <> inline snoop_e into<snoop_e>(typename std::underlying_type<snoop_e>::type t) {
1243  assert(t <= static_cast<std::underlying_type<snoop_e>::type>(snoop_e::WRITE_NO_SNOOP));
1244  return static_cast<snoop_e>(t);
1245 }
1246 
1247 template <> inline resp_e into<resp_e>(typename std::underlying_type<resp_e>::type t) {
1248  assert(t <= static_cast<std::underlying_type<resp_e>::type>(resp_e::DECERR));
1249  return static_cast<resp_e>(t);
1250 }
1251 
1252 inline void common::set_id(unsigned int id) { this->id = id; }
1253 
1254 inline unsigned int common::get_id() const { return id; }
1255 
1256 inline void common::set_user(id_type chnl, unsigned int user) { this->user[static_cast<size_t>(chnl)] = user; }
1257 
1258 inline unsigned int common::get_user(id_type chnl) const { return user[static_cast<size_t>(chnl)]; }
1259 
1260 inline void axi3::set_exclusive(bool exclusive) {
1261  uint8_t t = to_int(lock);
1262  if(exclusive)
1263  t |= EXCL;
1264  else
1265  t &= ~EXCL;
1266  lock = into<lock_e>(t);
1267 }
1268 
1269 inline bool axi3::is_exclusive() const {
1270  uint8_t t = to_int(lock);
1271  return (t & EXCL) != 0;
1272 }
1273 
1274 inline void axi3::set_locked(bool locked) {
1275  uint8_t t = to_int(lock);
1276  if(locked)
1277  t |= LOCKED;
1278  else
1279  t &= ~LOCKED;
1280  lock = into<lock_e>(t);
1281 }
1282 
1283 inline bool axi3::is_locked() const {
1284  uint8_t t = to_int(lock);
1285  return (t & LOCKED) != 0;
1286 }
1287 
1288 inline void axi3::set_bufferable(bool bufferable) {
1289  if(bufferable)
1290  cache |= BUFFERABLE;
1291  else
1292  cache &= ~BUFFERABLE;
1293 }
1294 
1295 inline bool axi3::is_bufferable() const { return (cache & BUFFERABLE) != 0; }
1296 
1297 inline void axi3::set_cacheable(bool cacheable) {
1298  if(cacheable)
1299  cache |= CACHEABLE;
1300  else
1301  cache &= ~CACHEABLE;
1302 }
1303 
1304 inline bool axi3::is_cacheable() const { return (cache & CACHEABLE) != 0; }
1305 
1306 inline void axi3::set_write_allocate(bool wa) {
1307  if(wa)
1308  cache |= WA;
1309  else
1310  cache &= ~WA;
1311 }
1312 
1313 inline bool axi3::is_write_allocate() const { return (cache & WA) != 0; }
1314 
1315 inline void axi3::set_read_allocate(bool ra) {
1316  if(ra)
1317  cache |= RA;
1318  else
1319  cache &= ~RA;
1320 }
1321 
1322 inline bool axi3::is_read_allocate() const { return (cache & RA) != 0; }
1323 
1324 inline void axi4::set_exclusive(bool exclusive) { lock = exclusive ? lock_e::EXLUSIVE : lock_e::NORMAL; }
1325 
1326 inline bool axi4::is_exclusive() const { return lock == lock_e::EXLUSIVE; }
1327 
1328 inline void axi4::set_bufferable(bool bufferable) {
1329  if(bufferable)
1330  cache |= BUFFERABLE;
1331  else
1332  cache &= ~BUFFERABLE;
1333 }
1334 
1335 inline bool axi4::is_bufferable() const { return (cache & BUFFERABLE) != 0; }
1336 
1337 inline void axi4::set_modifiable(bool cacheable) {
1338  if(cacheable)
1339  cache |= CACHEABLE;
1340  else
1341  cache &= ~CACHEABLE;
1342 }
1343 
1344 inline bool axi4::is_modifiable() const { return (cache & CACHEABLE) != 0; }
1345 
1346 inline void axi4::set_read_other_allocate(bool roa) {
1347  if(roa)
1348  cache |= WA;
1349  else
1350  cache &= ~WA;
1351 }
1352 
1353 inline bool axi4::is_read_other_allocate() const { return (cache & WA) != 0; }
1354 
1355 inline void axi4::set_write_other_allocate(bool woa) {
1356  if(woa)
1357  cache |= RA;
1358  else
1359  cache &= ~RA;
1360 }
1361 
1362 inline bool axi4::is_write_other_allocate() const { return (cache & RA) != 0; }
1363 
1364 inline void request::reset() {
1365  length = 0;
1366  size = 0;
1367  burst = burst_e::FIXED;
1368  prot = 0;
1369  qos = 0;
1370  region = 0;
1371  domain = domain_e::NON_SHAREABLE;
1372  snoop = snoop_e::READ_NO_SNOOP;
1373  barrier = bar_e::RESPECT_BARRIER;
1374  lock = lock_e::NORMAL;
1375  cache = 0;
1376  unique = false;
1377  atop = 0;
1378 }
1379 
1380 inline void request::set_length(uint8_t length) { this->length = length; }
1381 
1382 inline uint8_t request::get_length() const { return length; }
1383 
1384 inline void request::set_size(uint8_t size) {
1385  assert(size < 10);
1386  this->size = size;
1387 }
1388 
1389 inline uint8_t request::get_size() const { return size; }
1390 
1391 inline void request::set_burst(burst_e burst) { this->burst = burst; }
1392 
1393 inline burst_e request::get_burst() const { return burst; }
1394 
1395 inline void request::set_prot(uint8_t prot) {
1396  assert(prot < 8);
1397  this->prot = prot;
1398 }
1399 
1400 inline uint8_t request::get_prot() const { return prot; }
1401 
1402 inline void request::set_privileged(bool privileged) {
1403  prot &= ~PRIVILEGED;
1404  if(privileged)
1405  prot |= PRIVILEGED;
1406 }
1407 
1408 inline bool request::is_privileged() const { return (prot & PRIVILEGED) != 0; }
1409 
1410 inline void request::set_non_secure(bool non_sec) {
1411  prot &= ~SECURE;
1412  if(non_sec)
1413  prot |= SECURE;
1414 }
1415 
1416 inline bool request::is_non_secure() const { return (prot & SECURE) != 0; }
1417 
1418 inline void request::set_instruction(bool instr) {
1419  prot &= ~INSTRUCTION;
1420  if(instr)
1421  prot |= INSTRUCTION;
1422 }
1423 
1424 inline bool request::is_instruction() const { return (prot & INSTRUCTION) != 0; }
1425 
1426 inline void request::set_qos(uint8_t qos) { this->qos = qos; }
1427 
1428 inline uint8_t request::get_qos() const { return qos; }
1429 
1430 inline void request::set_region(uint8_t region) { this->region = region; }
1431 
1432 inline uint8_t request::get_region() const { return region; }
1433 
1434 inline void request::set_cache(uint8_t cache) {
1435  assert(cache < 16);
1436  this->cache = cache;
1437 }
1438 
1439 inline uint8_t request::get_cache() const { return cache; }
1440 
1441 inline void ace::set_domain(domain_e domain) { this->domain = domain; }
1442 
1443 inline domain_e ace::get_domain() const { return domain; }
1444 
1445 inline void ace::set_snoop(snoop_e snoop) { this->snoop = snoop; }
1446 
1447 inline snoop_e ace::get_snoop() const { return snoop; }
1448 
1449 inline void ace::set_barrier(bar_e bar) { this->barrier = bar; }
1450 
1451 inline bar_e ace::get_barrier() const { return barrier; }
1452 
1453 inline void ace::set_unique(bool uniq) { this->unique = uniq; }
1454 
1455 inline bool ace::get_unique() const { return unique; }
1456 
1457 inline void request::set_atop(uint8_t atop) { this->atop = atop; }
1458 
1459 inline uint8_t request::get_atop() const { return atop; }
1460 
1461 inline void request::set_stash_nid(uint8_t stash_nid) { this->stash_nid = stash_nid; }
1462 
1463 inline uint8_t request::get_stash_nid() const { return stash_nid < 0x800 ? stash_nid : 0; }
1464 
1465 inline bool request::is_stash_nid_en() const { return stash_nid < 0x800; }
1466 
1467 inline void request::set_stash_lpid(uint8_t stash_lpid) { this->stash_lpid = stash_lpid; }
1468 
1469 inline uint8_t request::get_stash_lpid() const { return stash_lpid < 0x20 ? stash_lpid : 0; }
1470 
1471 inline bool request::is_stash_lpid_en() const { return stash_lpid < 0x20; }
1472 
1473 inline void response::reset() { resp = static_cast<uint8_t>(resp_e::OKAY); }
1474 
1475 inline resp_e response::from_tlm_response_status(tlm::tlm_response_status st) {
1476  switch(st) {
1477  case tlm::TLM_OK_RESPONSE:
1478  return resp_e::OKAY;
1479  case tlm::TLM_INCOMPLETE_RESPONSE:
1480  case tlm::TLM_ADDRESS_ERROR_RESPONSE:
1481  return resp_e::DECERR;
1482  default:
1483  return resp_e::SLVERR;
1484  }
1485 }
1486 
1487 inline tlm::tlm_response_status response::to_tlm_response_status(resp_e resp) {
1488  switch(to_int(resp) & 0x3) {
1489  case to_int(resp_e::OKAY):
1490  return tlm::TLM_OK_RESPONSE;
1491  case to_int(resp_e::EXOKAY):
1492  return tlm::TLM_OK_RESPONSE;
1493  case to_int(resp_e::DECERR):
1494  return tlm::TLM_ADDRESS_ERROR_RESPONSE;
1495  default:
1496  return tlm::TLM_GENERIC_ERROR_RESPONSE;
1497  }
1498 }
1499 
1500 inline void response::set_resp(resp_e resp) { this->resp = static_cast<uint8_t>(resp); }
1501 
1502 inline resp_e response::get_resp() const { // @suppress("No return")
1503  switch(resp & 0x3) {
1504  case 0:
1505  return resp_e::OKAY;
1506  case 1:
1507  return resp_e::EXOKAY;
1508  case 2:
1509  return resp_e::SLVERR;
1510  default:
1511  return resp_e::DECERR;
1512  }
1513 }
1514 
1515 inline bool response::is_okay() const { return resp == static_cast<uint8_t>(resp_e::OKAY); }
1516 
1517 inline void response::set_okay() { resp = static_cast<uint8_t>(resp_e::OKAY); }
1518 
1519 inline bool response::is_exokay() const { return resp == static_cast<uint8_t>(resp_e::EXOKAY); }
1520 
1521 inline void response::set_exokay() { resp = static_cast<uint8_t>(resp_e::EXOKAY); }
1522 
1523 inline bool response::is_slverr() const { return resp == static_cast<uint8_t>(resp_e::SLVERR); }
1524 
1525 inline void response::set_slverr() { resp = static_cast<uint8_t>(resp_e::SLVERR); }
1526 
1527 inline bool response::is_decerr() const { return resp == static_cast<uint8_t>(resp_e::DECERR); }
1528 
1529 inline void response::set_decerr() { resp = static_cast<uint8_t>(resp_e::DECERR); }
1530 
1531 inline void ace_response::set_cresp(uint8_t resp) { this->resp = resp & 0x1f; }
1532 
1533 inline uint8_t ace_response::get_cresp() const { return resp; }
1534 
1535 inline bool ace_response::is_pass_dirty() const { return (resp & PASSDIRTY) != 0; }
1536 
1537 inline void ace_response::set_pass_dirty(bool dirty) {
1538  if(dirty)
1539  resp |= PASSDIRTY;
1540  else
1541  resp &= ~PASSDIRTY;
1542 }
1543 
1544 inline bool ace_response::is_shared() const { return (resp & ISSHARED) != 0; }
1545 
1546 inline void ace_response::set_shared(bool shared) {
1547  if(shared)
1548  resp |= ISSHARED;
1549  else
1550  resp &= ~ISSHARED;
1551 }
1552 
1553 inline bool ace_response::is_snoop_data_transfer() const { return (resp & DATATRANSFER) != 0; }
1554 
1555 inline void ace_response::set_snoop_data_transfer(bool snoop_data) {
1556  if(snoop_data)
1557  resp |= DATATRANSFER;
1558  else
1559  resp &= ~DATATRANSFER;
1560 }
1561 
1562 inline bool ace_response::is_snoop_error() const { return (resp & SNOOPEERROR) != 0; }
1563 
1564 inline void ace_response::set_snoop_error(bool err) {
1565  if(err)
1566  resp |= SNOOPEERROR;
1567  else
1568  resp &= ~SNOOPEERROR;
1569 }
1570 
1571 inline bool ace_response::is_snoop_was_unique() const { return (resp & WASUNIQUE) != 0; }
1572 
1573 inline void ace_response::set_snoop_was_unique(bool uniq) {
1574  if(uniq)
1575  resp |= WASUNIQUE;
1576  else
1577  resp &= ~WASUNIQUE;
1578 }
1579 
1580 template <typename REQ, typename RESP> axi_extension<REQ, RESP>::axi_extension(const axi_extension<REQ, RESP>* ext) {
1581  static_cast<common&>(*this) = *ext;
1582  static_cast<REQ&>(*this) = *ext;
1583  static_cast<response&>(*this) = *ext;
1584 }
1585 
1586 template <typename REQ, typename RESP> void axi_extension<REQ, RESP>::reset() {
1587  common::reset();
1588  REQ::reset();
1589  response::reset();
1590 }
1591 
1592 template <typename REQ, typename RESP> void axi_extension<REQ, RESP>::reset(const REQ* control) {
1593  common::reset();
1594  static_cast<REQ&>(*this) = *control;
1595  response::reset();
1596 }
1597 
1598 template <typename REQ, typename RESP> inline void axi_extension<REQ, RESP>::add_to_response_array(response& arr) {
1599  response_arr.push_back(arr);
1600 }
1601 
1602 template <typename REQ, typename RESP>
1603 inline const std::vector<response>& axi_extension<REQ, RESP>::get_response_array() const {
1604  return response_arr;
1605 }
1606 
1607 template <typename REQ, typename RESP> inline std::vector<response>& axi_extension<REQ, RESP>::get_response_array() {
1608  return response_arr;
1609 }
1610 
1611 template <typename REQ, typename RESP>
1613  response_array_complete = complete;
1614 }
1615 
1616 template <typename REQ, typename RESP> inline bool axi_extension<REQ, RESP>::is_response_array_complete() {
1617  return response_array_complete;
1618 }
1619 
1620 inline tlm::tlm_extension_base* axi3_extension::clone() const { return new axi3_extension(this); }
1621 
1622 inline void axi3_extension::copy_from(const tlm::tlm_extension_base& bext) {
1623  auto const* ext = dynamic_cast<const axi3_extension*>(&bext);
1624  assert(ext);
1625  static_cast<common&>(*this) = *ext;
1626  static_cast<axi_extension<axi3>&>(*this) = *ext;
1627  static_cast<response&>(*this) = *ext;
1628 }
1629 
1630 inline tlm::tlm_extension_base* axi4_extension::clone() const { return new axi4_extension(this); }
1631 
1632 inline void axi4_extension::copy_from(const tlm::tlm_extension_base& bext) {
1633  auto const* ext = dynamic_cast<const axi4_extension*>(&bext);
1634  assert(ext);
1635  static_cast<common&>(*this) = *ext;
1636  static_cast<axi_extension<axi4>&>(*this) = *ext;
1637  static_cast<response&>(*this) = *ext;
1638 }
1639 
1640 inline tlm::tlm_extension_base* ace_extension::clone() const { return new ace_extension(this); }
1641 
1642 inline void ace_extension::copy_from(const tlm::tlm_extension_base& bext) {
1643  auto const* ext = dynamic_cast<const ace_extension*>(&bext);
1644  assert(ext);
1645  static_cast<common&>(*this) = *ext;
1646  static_cast<axi_extension<ace, ace_response>&>(*this) = *ext;
1647  static_cast<response&>(*this) = *ext;
1648 }
1649 
1650 } // namespace axi
virtual void b_snoop(TRANS &trans, sc_core::sc_time &t)=0
snoop access to a snooped master
TLM2.0 components modeling AHB.
Definition: axi_initiator.h:30
unsigned get_burst_length(const request &r)
Definition: axi_tlm.h:1122
domain_e
Definition: axi_tlm.h:85
tlm::tlm_generic_payload axi_payload
aliases for payload and phase types
Definition: axi_tlm.h:884
E into(typename std::underlying_type< E >::type t)
bar_e
Definition: axi_tlm.h:89
@ MEMORY_BARRIER
Normal access, respecting barriers.
@ SYNCHRONISATION_BARRIER
Normal access, ignoring barriers.
@ IGNORE_BARRIER
Memory barrier.
const char * to_char(E t)
tlm::tlm_bw_transport_if< TYPES > axi_bw_transport_if
alias declaration for the backward interface:
Definition: axi_tlm.h:918
burst_e
Definition: axi_tlm.h:73
DECLARE_EXTENDED_PHASE(BEGIN_PARTIAL_REQ)
snoop_e
Definition: axi_tlm.h:99
tlm::tlm_fw_transport_if< TYPES > axi_fw_transport_if
alias declaration for the forward interface
Definition: axi_tlm.h:916
constexpr ULT to_int(E t)
Definition: axi_tlm.h:47
bool is_burst(const axi::axi_protocol_types::tlm_payload_type &trans)
Definition: axi_tlm.h:1101
lock_e
Definition: axi_tlm.h:81
resp_e
Definition: axi_tlm.h:156
unsigned get_burst_size(const request &r)
Definition: axi_tlm.h:1157
tlm::tlm_fw_transport_if< TYPES > ace_fw_transport_if
alias declaration for the ACE forward interface
Definition: axi_tlm.h:920
ace_extension()=default
the default constructor
ace_extension(const ace_extension *o)
the copy constructor
Definition: axi_tlm.h:870
tlm::tlm_extension_base * clone() const override
the clone function to create deep copies of
Definition: axi_tlm.h:1640
void copy_from(tlm::tlm_extension_base const &ext) override
deep copy all values from ext
Definition: axi_tlm.h:1642
tlm::tlm_base_initiator_socket< BUSWIDTH, ace_fw_transport_if< TYPES >, ace_bw_transport_if< TYPES >, N, POL > base_type
base type alias
Definition: axi_tlm.h:1000
const char * kind() const override
get the kind of this sc_object
Definition: axi_tlm.h:1016
ace_initiator_socket(const char *name)
constructor with instance name
Definition: axi_tlm.h:1010
ace_initiator_socket()
default constructor using a generated instance name
Definition: axi_tlm.h:1004
void set_snoop_was_unique(bool=true)
set the response status bit WasUnique
Definition: axi_tlm.h:1573
bool is_snoop_data_transfer() const
check the response status bit DataTransfer
Definition: axi_tlm.h:1553
void set_cresp(uint8_t)
set the coherent response status
Definition: axi_tlm.h:1531
bool is_snoop_was_unique() const
check the response status bit WasUnique
Definition: axi_tlm.h:1571
void set_snoop_error(bool=true)
set the response status bit Error
Definition: axi_tlm.h:1564
void set_pass_dirty(bool=true)
set the response status bit PassDirty
Definition: axi_tlm.h:1537
uint8_t get_cresp() const
get the coherent response status
Definition: axi_tlm.h:1533
bool is_pass_dirty() const
check the response status bit PassDirty (CRESP[2])
Definition: axi_tlm.h:1535
bool is_shared() const
check the response status bit IsShared (CRESP[3])
Definition: axi_tlm.h:1544
void set_shared(bool=true)
set the response status bit IsShared
Definition: axi_tlm.h:1546
bool is_snoop_error() const
check the response status bit Error
Definition: axi_tlm.h:1562
void set_snoop_data_transfer(bool=true)
set the response status bit DataTransfer
Definition: axi_tlm.h:1555
ace_target_socket()
default constructor using a generated instance name
Definition: axi_tlm.h:1038
const char * kind() const override
get the kind of this sc_object
Definition: axi_tlm.h:1050
tlm::tlm_base_target_socket< BUSWIDTH, ace_fw_transport_if< TYPES >, ace_bw_transport_if< TYPES >, N, POL > base_type
base type alias
Definition: axi_tlm.h:1034
ace_target_socket(const char *name)
constructor with instance name
Definition: axi_tlm.h:1044
void set_barrier(bar_e)
set the AxBAR value
Definition: axi_tlm.h:1449
bool get_unique() const
get the AxUNIQUE value return the unique value
Definition: axi_tlm.h:1455
void set_domain(domain_e)
set the AxDOMAIN value
Definition: axi_tlm.h:1441
bar_e get_barrier() const
get the AxBAR value return the barrier value
Definition: axi_tlm.h:1451
void set_unique(bool)
set the AxUNIQUE value
Definition: axi_tlm.h:1453
ace & operator=(const ace &o)
Definition: axi_tlm.h:548
snoop_e get_snoop() const
get the AxSNOOP value return the snoop value
Definition: axi_tlm.h:1447
domain_e get_domain() const
get the AxDOMAIN value return the domain value
Definition: axi_tlm.h:1443
void set_snoop(snoop_e)
set the AxSNOOP value
Definition: axi_tlm.h:1445
axi3_extension(const axi3_extension *o)
the copy constructor
Definition: axi_tlm.h:820
tlm::tlm_extension_base * clone() const override
the clone function to create deep copies of
Definition: axi_tlm.h:1620
axi3_extension()=default
the default constructor
void copy_from(tlm::tlm_extension_base const &ext) override
deep copy all values from ext
Definition: axi_tlm.h:1622
bool is_bufferable() const
get the bufferable bit of AxCACHE (AxCACHE[0]) return the bufferable bit
Definition: axi_tlm.h:1295
void set_cacheable(bool=true)
set the cacheable bit of AxCACHE (AxCACHE[1])
Definition: axi_tlm.h:1297
void set_write_allocate(bool=true)
set the write_allocate bit of AxCACHE (AxCACHE[2])
Definition: axi_tlm.h:1306
bool is_read_allocate() const
get the read_allocate bit of AxCACHE (AxCACHE[3]) return the read_allocate bit
Definition: axi_tlm.h:1322
void set_locked(bool=true)
get the locked bit of AxLOCK (AxLOCK[1])
Definition: axi_tlm.h:1274
axi3 & operator=(const axi3 &o)
Definition: axi_tlm.h:410
void set_exclusive(bool=true)
get the exclusive bit of AxLOCK (AxLOCK[0])
Definition: axi_tlm.h:1260
void set_read_allocate(bool=true)
set the read_allocate bit of AxCACHE (AxCACHE[3])
Definition: axi_tlm.h:1315
void set_bufferable(bool=true)
set the bufferable bit of AxCACHE (AxCACHE[0])
Definition: axi_tlm.h:1288
bool is_exclusive() const
get the exclusive bit of AxLOCK (AxLOCK[0]) return the exclusive bit
Definition: axi_tlm.h:1269
bool is_write_allocate() const
get the write_allocate bit of AxCACHE (AxCACHE[2]) return the write_allocate bit
Definition: axi_tlm.h:1313
bool is_cacheable() const
get the cacheable bit of AxCACHE (AxCACHE[1]) return the cacheable bit
Definition: axi_tlm.h:1304
bool is_locked() const
get the locked bit of AxLOCK (AxLOCK[1]) return the locked bit
Definition: axi_tlm.h:1283
axi4_extension()=default
the default constructor
axi4_extension(const axi4_extension *o)
the copy constructor
Definition: axi_tlm.h:845
void copy_from(tlm::tlm_extension_base const &ext) override
deep copy all values from ext
Definition: axi_tlm.h:1632
tlm::tlm_extension_base * clone() const override
the clone function to create deep copies of
Definition: axi_tlm.h:1630
bool is_modifiable() const
get the modifiable bit of AxCACHE (AxCACHE[1]) return the modifiable bit
Definition: axi_tlm.h:1344
axi4 & operator=(const axi4 &o)
Definition: axi_tlm.h:484
void set_exclusive(bool=true)
get the exclusive bit of AxLOCK (AxLOCK[0])
Definition: axi_tlm.h:1324
void set_modifiable(bool=true)
set the modifiable bit of AxCACHE (AxCACHE[1])
Definition: axi_tlm.h:1337
void set_read_other_allocate(bool=true)
set the read allocate/write other allocate bit of AxCACHE (AxCACHE[2])
Definition: axi_tlm.h:1346
bool is_bufferable() const
get the bufferable bit of AxCACHE (AxCACHE[0]) return the bufferable bit
Definition: axi_tlm.h:1335
bool is_exclusive() const
get the exclusive bit of AxLOCK (AxLOCK[0]) return the exclusive bit
Definition: axi_tlm.h:1326
bool is_write_other_allocate() const
get the write allocate/read other allocate bit of AxCACHE (AxCACHE[3]) return the write_other_allocat...
Definition: axi_tlm.h:1362
bool is_read_other_allocate() const
get the read allocate/write other allocate bit of AxCACHE (AxCACHE[2]) return the read_other_allocate...
Definition: axi_tlm.h:1353
void set_write_other_allocate(bool=true)
set the write allocate/read other allocate bit of AxCACHE (AxCACHE[3])
Definition: axi_tlm.h:1355
void set_bufferable(bool=true)
set the bufferable bit of AxCACHE (AxCACHE[0])
Definition: axi_tlm.h:1328
bool is_response_array_complete()
Definition: axi_tlm.h:1616
axi_extension(const axi_extension< REQ, RESP > *)
the copy constructor
Definition: axi_tlm.h:1580
axi_extension()=default
the default constructor
const std::vector< response > & get_response_array() const
return the read response array for constant instances
Definition: axi_tlm.h:1603
std::vector< response > & get_response_array()
return the read response array
Definition: axi_tlm.h:1607
void reset(const REQ *)
reset the common and response part, reset response using the given reset value
Definition: axi_tlm.h:1592
void set_response_array_complete(bool=true)
set the flag indicating the all read responses are collected
Definition: axi_tlm.h:1612
void add_to_response_array(response &)
add a read response to the response array
Definition: axi_tlm.h:1598
void reset()
reset all data member to their default
Definition: axi_tlm.h:1586
virtual ~axi_extension()
Definition: axi_tlm.h:768
axi_initiator_socket()
default constructor using a generated instance name
Definition: axi_tlm.h:940
axi_initiator_socket(const char *name)
constructor with instance name
Definition: axi_tlm.h:946
const char * kind() const override
get the kind of this sc_object
Definition: axi_tlm.h:952
tlm::tlm_base_initiator_socket< BUSWIDTH, axi_fw_transport_if< TYPES >, axi_bw_transport_if< TYPES >, N, POL > base_type
base type alias
Definition: axi_tlm.h:936
The AXI protocol traits class. Since the protocoll defines additional non-ignorable phases a dedicate...
Definition: axi_tlm.h:890
tlm::tlm_base_target_socket< BUSWIDTH, axi_fw_transport_if< TYPES >, axi_bw_transport_if< TYPES >, N, POL > base_type
base type alias
Definition: axi_tlm.h:968
axi_target_socket(const char *name)
constructor with instance name
Definition: axi_tlm.h:978
axi_target_socket()
default constructor using a generated instance name
Definition: axi_tlm.h:972
const char * kind() const override
get the kind of this sc_object
Definition: axi_tlm.h:984
void reset()
reset all data member to their default
void set_id(unsigned int value)
Definition: axi_tlm.h:1252
unsigned int get_user(id_type chnl) const
Definition: axi_tlm.h:1258
void set_user(id_type chnl, unsigned int value)
Definition: axi_tlm.h:1256
common & operator=(const common &o)
copy assignment operator
Definition: axi_tlm.h:170
common()=default
the constructor
unsigned int get_id() const
Definition: axi_tlm.h:1254
void set_instruction(bool=true)
set the instruction bit of the AxPROT (AxPROT[2])
Definition: axi_tlm.h:1418
uint8_t get_atop() const
get the raw AWATOP value return the unique value
Definition: axi_tlm.h:1459
void set_length(uint8_t)
set the AxLEN value of the transaction, the value denotes the burst length - 1
Definition: axi_tlm.h:1380
bool is_stash_lpid_en() const
check if AWSTASHLPID is valid return the valid value
Definition: axi_tlm.h:1471
void set_qos(uint8_t)
set the AxQOS (quality of service) value
Definition: axi_tlm.h:1426
uint8_t get_stash_lpid() const
get the raw AWSTASHLPID value return the unique value
Definition: axi_tlm.h:1469
void set_cache(uint8_t)
set the AxCACHE value as POD, only value from 0..15 are allowed
Definition: axi_tlm.h:1434
request & operator=(const request &o)
Definition: axi_tlm.h:356
void set_region(uint8_t)
set the AxREGION value
Definition: axi_tlm.h:1430
bool is_instruction() const
set the instruction bit of the AxPROT (AxPROT[2])
Definition: axi_tlm.h:1424
burst_e get_burst() const
get the AxBURST value,
Definition: axi_tlm.h:1393
uint8_t get_length() const
get the AxLEN value of the transaction, the value denotes the burst length - 1
Definition: axi_tlm.h:1382
bool is_privileged() const
get the privileged bit of the AxPROT (AxPROT[0])
Definition: axi_tlm.h:1408
void set_non_secure(bool=true)
set the non-secure bit of the AxPROT (AxPROT[1])
Definition: axi_tlm.h:1410
void set_stash_lpid(uint8_t)
set the raw AWSTASHLPID value
Definition: axi_tlm.h:1467
void set_burst(burst_e)
set the AxBURST value,
Definition: axi_tlm.h:1391
bool is_non_secure() const
set the non-secure bit of the AxPROT (AxPROT[1])
Definition: axi_tlm.h:1416
uint8_t get_region() const
get the AxREGION value
Definition: axi_tlm.h:1432
void set_privileged(bool=true)
set the privileged bit of the AxPROT (AxPROT[0])
Definition: axi_tlm.h:1402
bool is_stash_nid_en() const
check if AWSTASHNID is valid return the valid value
Definition: axi_tlm.h:1465
void reset()
reset all data member to their default
Definition: axi_tlm.h:1364
uint8_t get_qos() const
get the AxQOS (quality of service) value
Definition: axi_tlm.h:1428
uint8_t get_stash_nid() const
get the raw AWSTASHNID value return the unique value
Definition: axi_tlm.h:1463
void set_atop(uint8_t)
set the raw AWATOP value
Definition: axi_tlm.h:1457
void set_size(uint8_t)
get the AxSIZE value of the transaction, the length is 2^size. It needs to be less than 10 (512 bit w...
Definition: axi_tlm.h:1384
request()=default
the default constructor
uint8_t get_cache() const
get the AxCACHE value as POD
Definition: axi_tlm.h:1439
uint8_t get_prot() const
set the AxPROT value as POD, only values from 0...7 are allowed
Definition: axi_tlm.h:1400
void set_prot(uint8_t)
set the AxPROT value as POD, only values from 0...7 are allowed
Definition: axi_tlm.h:1395
void set_stash_nid(uint8_t)
set the raw AWSTASHNID value
Definition: axi_tlm.h:1461
uint8_t get_size() const
set the AxSIZE value of the transaction
Definition: axi_tlm.h:1389
resp_e get_resp() const
get the response status as POD
Definition: axi_tlm.h:1502
void set_okay()
set the response status to OKAY
Definition: axi_tlm.h:1517
void set_decerr()
set the response status to DECERR
Definition: axi_tlm.h:1529
bool is_decerr() const
check if the response status is DECERR
Definition: axi_tlm.h:1527
void set_resp(resp_e)
set the response status as POD
Definition: axi_tlm.h:1500
bool is_exokay() const
check if the response status is EXOKAY
Definition: axi_tlm.h:1519
bool is_slverr() const
check if the response status is SLVERR
Definition: axi_tlm.h:1523
void set_slverr()
set the response status to SLVERR
Definition: axi_tlm.h:1525
bool is_okay() const
check if the response status is OKAY
Definition: axi_tlm.h:1515
response & operator=(const response &o)
assignment operator
Definition: axi_tlm.h:603
void reset()
reset all data member to their default
Definition: axi_tlm.h:1473
static tlm::tlm_response_status to_tlm_response_status(resp_e)
converts a
Definition: axi_tlm.h:1487
void set_exokay()
set the response status to EXOKAY
Definition: axi_tlm.h:1521
static resp_e from_tlm_response_status(tlm::tlm_response_status)
converts the response status of a generic payload to a
Definition: axi_tlm.h:1475