scc  2024.06
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_other_allocate(bool = true);
527  bool is_other_allocate() const;
532  void set_allocate(bool = true);
537  bool is_allocate() const;
542  void set_cacheable(bool = true);
547  bool is_cacheable() const;
552  void set_read_allocate(bool = true);
557  bool is_read_allocate() const;
562  void set_write_allocate(bool = true);
567  bool is_write_allocate() const;
568 };
572 struct ace : public axi4 {
578  ace& operator=(const ace& o) {
580  return *this;
581  }
586  void set_domain(domain_e);
591  domain_e get_domain() const;
596  void set_snoop(snoop_e);
601  snoop_e get_snoop() const;
606  void set_barrier(bar_e);
611  bar_e get_barrier() const;
616  void set_unique(bool);
621  bool get_unique() const;
622 };
626 struct response {
627  response() = default;
634  resp = o.resp;
635  return *this;
636  }
640  void reset();
646  static resp_e from_tlm_response_status(tlm::tlm_response_status);
652  static tlm::tlm_response_status to_tlm_response_status(resp_e);
657  void set_resp(resp_e);
662  resp_e get_resp() const;
667  bool is_okay() const;
671  void set_okay();
676  bool is_exokay() const;
680  void set_exokay();
685  bool is_slverr() const;
689  void set_slverr();
694  bool is_decerr() const;
698  void set_decerr();
699 
700 protected:
701  enum { // bit masks for CRESP
702  DATATRANSFER = 1,
703  SNOOPEERROR = 2,
704  PASSDIRTY = 4,
705  ISSHARED = 8,
706  WASUNIQUE = 16
707  };
708  uint8_t resp{static_cast<uint8_t>(resp_e::OKAY)};
709 };
713 struct ace_response : public response {
718  void set_cresp(uint8_t);
723  uint8_t get_cresp() const;
728  bool is_pass_dirty() const;
733  void set_pass_dirty(bool = true);
738  bool is_shared() const;
743  void set_shared(bool = true);
748  // CRRESP[0]
749  bool is_snoop_data_transfer() const;
754  void set_snoop_data_transfer(bool = true);
759  // CRRESP[1]
760  bool is_snoop_error() const;
765  void set_snoop_error(bool = true);
770  // CRRESP[4]
771  bool is_snoop_was_unique() const;
776  void set_snoop_was_unique(bool = true);
777 };
781 template <typename REQ, typename RESP = response>
782 struct axi_extension : public common, // 2x 4byte
783  public REQ, // 11byte + 4byte
784  public RESP // 1byte
785 {
789  axi_extension() = default;
798  virtual ~axi_extension() {}
802  void reset();
807  void reset(const REQ*);
817  const std::vector<response>& get_response_array() const;
822  std::vector<response>& get_response_array();
827  void set_response_array_complete(bool = true);
833 
834 private:
835  std::vector<response> response_arr{};
836  bool response_array_complete{false};
837 };
841 struct axi3_extension : public tlm::tlm_extension<axi3_extension>, public axi_extension<axi3> {
845  axi3_extension() = default;
851  : axi_extension<axi3>(o) {}
856  tlm::tlm_extension_base* clone() const override;
861  void copy_from(tlm::tlm_extension_base const& ext) override;
862 };
866 struct axi4_extension : public tlm::tlm_extension<axi4_extension>, public axi_extension<axi4> {
870  axi4_extension() = default;
876  : axi_extension<axi4>(o) {}
881  tlm::tlm_extension_base* clone() const override;
886  void copy_from(tlm::tlm_extension_base const& ext) override;
887 };
891 struct ace_extension : public tlm::tlm_extension<ace_extension>, public axi_extension<ace, ace_response> {
895  ace_extension() = default;
901  : axi_extension<ace, ace_response>(o) {}
906  tlm::tlm_extension_base* clone() const override;
911  void copy_from(tlm::tlm_extension_base const& ext) override;
912 };
914 using axi_payload = tlm::tlm_generic_payload;
915 using axi_phase = tlm::tlm_phase;
921  typedef axi_payload tlm_payload_type;
922  typedef axi_phase tlm_phase_type;
923 };
927 enum SC_API tlm_phase_enum
928 {
929  UNINITIALIZED_PHASE=0,
930  BEGIN_REQ= tlm::BEGIN_REQ,
931  END_REQ= tlm::END_REQ,
932  BEGIN_RESP= tlm::BEGIN_RESP,
933  END_RESP= tlm::END_RESP
934 };
935 DECLARE_EXTENDED_PHASE(BEGIN_PARTIAL_REQ);
936 DECLARE_EXTENDED_PHASE(END_PARTIAL_REQ);
937 DECLARE_EXTENDED_PHASE(BEGIN_PARTIAL_RESP);
938 DECLARE_EXTENDED_PHASE(END_PARTIAL_RESP);
939 DECLARE_EXTENDED_PHASE(ACK);
943 template <typename TRANS = tlm::tlm_generic_payload>
944 class bw_blocking_transport_if : public virtual sc_core::sc_interface {
945 public:
951  virtual void b_snoop(TRANS& trans, sc_core::sc_time& t) = 0;
952 };
954 template <typename TYPES = axi_protocol_types> using axi_fw_transport_if = tlm::tlm_fw_transport_if<TYPES>;
956 template <typename TYPES = axi_protocol_types> using axi_bw_transport_if = tlm::tlm_bw_transport_if<TYPES>;
958 template <typename TYPES = axi_protocol_types> using ace_fw_transport_if = tlm::tlm_fw_transport_if<TYPES>;
962 template <typename TYPES = axi_protocol_types>
963 class ace_bw_transport_if : public tlm::tlm_bw_transport_if<TYPES>,
965 
966 #if SC_VERSION_MAJOR<3
967  using type_index = sc_core::sc_type_index;
968 #else
969  using type_index = std::type_index;
970 #endif
971 
975 template <unsigned int BUSWIDTH = 32, typename TYPES = axi_protocol_types, int N = 1,
976  sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND>
978 : public tlm::tlm_base_initiator_socket<BUSWIDTH, axi_fw_transport_if<TYPES>, axi_bw_transport_if<TYPES>, N, POL> {
980  using base_type =
981  tlm::tlm_base_initiator_socket<BUSWIDTH, axi_fw_transport_if<TYPES>, axi_bw_transport_if<TYPES>, N, POL>;
986  : base_type() {}
991  explicit axi_initiator_socket(const char* name)
992  : base_type(name) {}
997  const char* kind() const override { return "axi_initiator_socket"; }
998  // not the right version but we assume TLM is always bundled with SystemC
999 #if SYSTEMC_VERSION >= 20181013 // ((TLM_VERSION_MAJOR > 2) || (TLM_VERSION==2 && TLM_VERSION_MINOR>0) ||(TLM_VERSION==2
1000  // && TLM_VERSION_MINOR>0 && TLM_VERSION_PATCH>4))
1001  type_index get_protocol_types() const override { return typeid(TYPES); }
1002 #endif
1003 };
1007 template <unsigned int BUSWIDTH = 32, typename TYPES = axi_protocol_types, int N = 1,
1008  sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND>
1010 : public tlm::tlm_base_target_socket<BUSWIDTH, axi_fw_transport_if<TYPES>, axi_bw_transport_if<TYPES>, N, POL> {
1012  using base_type =
1013  tlm::tlm_base_target_socket<BUSWIDTH, axi_fw_transport_if<TYPES>, axi_bw_transport_if<TYPES>, N, POL>;
1018  : base_type() {}
1023  explicit axi_target_socket(const char* name)
1024  : base_type(name) {}
1029  const char* kind() const override { return "axi_target_socket"; }
1030  // not the right version but we assume TLM is always bundled with SystemC
1031 #if SYSTEMC_VERSION >= 20181013 // ((TLM_VERSION_MAJOR > 2) || (TLM_VERSION==2 && TLM_VERSION_MINOR>0) ||(TLM_VERSION==2
1032  // && TLM_VERSION_MINOR>0 && TLM_VERSION_PATCH>4))
1033  type_index get_protocol_types() const override { return typeid(TYPES); }
1034 #endif
1035 };
1039 template <unsigned int BUSWIDTH = 32, typename TYPES = axi_protocol_types, int N = 1,
1040  sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND>
1042 : public tlm::tlm_base_initiator_socket<BUSWIDTH, ace_fw_transport_if<TYPES>, ace_bw_transport_if<TYPES>, N, POL> {
1044  using base_type =
1045  tlm::tlm_base_initiator_socket<BUSWIDTH, ace_fw_transport_if<TYPES>, ace_bw_transport_if<TYPES>, N, POL>;
1050  : base_type() {}
1055  explicit ace_initiator_socket(const char* name)
1056  : base_type(name) {}
1061  const char* kind() const override { return "axi_initiator_socket"; }
1062 #if SYSTEMC_VERSION >= 20181013 // not the right version but we assume TLM is always bundled with SystemC
1067  type_index get_protocol_types() const override { return typeid(TYPES); }
1068 #endif
1069 };
1073 template <unsigned int BUSWIDTH = 32, typename TYPES = axi_protocol_types, int N = 1,
1074  sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND>
1076 : public tlm::tlm_base_target_socket<BUSWIDTH, ace_fw_transport_if<TYPES>, ace_bw_transport_if<TYPES>, N, POL> {
1078  using base_type =
1079  tlm::tlm_base_target_socket<BUSWIDTH, ace_fw_transport_if<TYPES>, ace_bw_transport_if<TYPES>, N, POL>;
1084  : base_type() {}
1089  explicit ace_target_socket(const char* name)
1090  : base_type(name) {}
1095  const char* kind() const override { return "axi_target_socket"; }
1096  // not the right version but we assume TLM is always bundled with SystemC
1097 #if SYSTEMC_VERSION >= 20181013 // not the right version but we assume TLM is always bundled with SystemC
1102  type_index get_protocol_types() const override { return typeid(TYPES); }
1103 #endif
1104 };
1105 /*****************************************************************************
1106  * free function easing handling of transactions and extensions
1107  *****************************************************************************/
1108 
1109 template <typename EXT> bool is_valid(EXT& ext) { return is_valid(&ext); }
1110 
1111 template <typename EXT> bool is_valid(EXT* ext) { return is_valid_msg(ext) == nullptr; }
1112 
1113 template <typename EXT> char const* is_valid_msg(EXT& ext) { return is_valid_msg(&ext); }
1114 
1115 template <typename EXT> char const* is_valid_msg(EXT* ext);
1116 
1117 inline bool is_dataless(axi::ace_extension const* ext) {
1118  if(!ext)
1119  return false;
1120  auto snp = ext->get_snoop();
1121  return snp == snoop_e::CLEAN_UNIQUE || snp == snoop_e::MAKE_UNIQUE || snp == snoop_e::CLEAN_SHARED ||
1122  snp == snoop_e::CLEAN_INVALID || snp == snoop_e::MAKE_INVALID || snp == snoop_e::EVICT ||
1123  snp == snoop_e::STASH_ONCE_SHARED || snp == snoop_e::STASH_ONCE_UNIQUE;
1124 }
1125 
1126 inline unsigned get_axi_id(axi::axi_protocol_types::tlm_payload_type const& trans) {
1127  if(auto e = trans.get_extension<axi::ace_extension>())
1128  return e->get_id();
1129  if(auto e = trans.get_extension<axi::axi4_extension>())
1130  return e->get_id();
1131  if(auto e = trans.get_extension<axi::axi3_extension>())
1132  return e->get_id();
1133  sc_assert(false && "transaction is not an axi or ace transaction");
1134  return std::numeric_limits<unsigned>::max();
1135 }
1136 
1137 inline unsigned get_axi_id(axi::axi_protocol_types::tlm_payload_type const* trans) { return get_axi_id(*trans); }
1138 
1146 inline bool is_burst(const axi::axi_protocol_types::tlm_payload_type& trans) {
1147  if(auto e = trans.get_extension<axi::ace_extension>())
1148  return e->get_length() > 0;
1149  if(auto e = trans.get_extension<axi::axi4_extension>())
1150  return e->get_length() > 0;
1151  if(auto e = trans.get_extension<axi::axi3_extension>())
1152  return e->get_length() > 0;
1153  sc_assert(false && "transaction is not an axi or ace transaction");
1154  return false;
1155 }
1161 inline bool is_burst(const axi::axi_protocol_types::tlm_payload_type* trans) { return is_burst(*trans); }
1167 inline unsigned get_burst_length(const request& r) { return r.get_length() + 1; }
1173 inline unsigned get_burst_length(const request* r) { return r->get_length() + 1; }
1179 inline unsigned get_burst_length(const axi::axi_protocol_types::tlm_payload_type& trans) {
1180  if(auto e = trans.get_extension<axi::ace_extension>())
1181  return e->get_length() + 1;
1182  if(auto e = trans.get_extension<axi::axi4_extension>())
1183  return e->get_length() + 1;
1184  if(auto e = trans.get_extension<axi::axi3_extension>())
1185  return e->get_length() + 1;
1186  sc_assert(false && "transaction is not an axi or ace transaction");
1187  return 0;
1188 }
1194 inline unsigned get_burst_length(const axi::axi_protocol_types::tlm_payload_type* trans) {
1195  return get_burst_length(*trans);
1196 }
1202 inline unsigned get_burst_size(const request& r) { return 1 << r.get_size(); }
1208 inline unsigned get_burst_size(const request* r) { return 1 << r->get_size(); }
1214 inline unsigned get_burst_size(const axi::axi_protocol_types::tlm_payload_type& trans) {
1215  if(auto e = trans.get_extension<axi::ace_extension>())
1216  return 1 << e->get_size();
1217  if(auto e = trans.get_extension<axi::axi4_extension>())
1218  return 1 << e->get_size();
1219  if(auto e = trans.get_extension<axi::axi3_extension>())
1220  return 1 << e->get_size();
1221  sc_assert(false && "transaction is not an axi or ace transaction");
1222  return 0;
1223 }
1229 inline unsigned get_burst_size(const axi::axi_protocol_types::tlm_payload_type* trans) {
1230  return get_burst_size(*trans);
1231 }
1232 
1233 inline burst_e get_burst_type(const axi::axi_protocol_types::tlm_payload_type& trans) {
1234  if(auto e = trans.get_extension<axi::ace_extension>())
1235  return e->get_burst();
1236  if(auto e = trans.get_extension<axi::axi4_extension>())
1237  return e->get_burst();
1238  if(auto e = trans.get_extension<axi::axi3_extension>())
1239  return e->get_burst();
1240  sc_assert(false && "transaction is not an axi or ace transaction");
1241  return burst_e::FIXED;
1242 }
1243 inline burst_e get_burst_type(const axi::axi_protocol_types::tlm_payload_type* trans) { return get_burst_type(*trans); }
1244 
1245 inline unsigned get_cache(const axi::axi_protocol_types::tlm_payload_type& trans) {
1246  if(auto e = trans.get_extension<axi::ace_extension>())
1247  return e->get_cache();
1248  if(auto e = trans.get_extension<axi::axi4_extension>())
1249  return e->get_cache();
1250  if(auto e = trans.get_extension<axi::axi3_extension>())
1251  return e->get_cache();
1252  sc_assert(false && "transaction is not an axi or ace transaction");
1253  return 0;
1254 }
1255 inline unsigned get_cache(const axi::axi_protocol_types::tlm_payload_type* trans) { return get_cache(*trans); }
1256 
1257 /*****************************************************************************
1258  * Implementation details
1259  *****************************************************************************/
1260 template <> struct enable_for_enum<burst_e> { static const bool enable = true; };
1261 template <> struct enable_for_enum<lock_e> { static const bool enable = true; };
1262 template <> struct enable_for_enum<domain_e> { static const bool enable = true; };
1263 template <> struct enable_for_enum<bar_e> { static const bool enable = true; };
1264 template <> struct enable_for_enum<snoop_e> { static const bool enable = true; };
1265 template <> struct enable_for_enum<resp_e> { static const bool enable = true; };
1266 
1267 template <> inline burst_e into<burst_e>(typename std::underlying_type<burst_e>::type t) {
1268  assert(t <= static_cast<std::underlying_type<burst_e>::type>(burst_e::WRAP));
1269  return static_cast<burst_e>(t);
1270 }
1271 
1272 template <> inline lock_e into<lock_e>(typename std::underlying_type<lock_e>::type t) {
1273  assert(t <= static_cast<std::underlying_type<lock_e>::type>(lock_e::LOCKED));
1274  return static_cast<lock_e>(t);
1275 }
1276 
1277 template <> inline domain_e into<domain_e>(typename std::underlying_type<domain_e>::type t) {
1278  assert(t <= static_cast<std::underlying_type<domain_e>::type>(domain_e::SYSTEM));
1279  return static_cast<domain_e>(t);
1280 }
1281 
1282 template <> inline bar_e into<bar_e>(typename std::underlying_type<bar_e>::type t) {
1283  assert(t <= static_cast<std::underlying_type<bar_e>::type>(bar_e::SYNCHRONISATION_BARRIER));
1284  return static_cast<bar_e>(t);
1285 }
1286 
1287 template <> inline snoop_e into<snoop_e>(typename std::underlying_type<snoop_e>::type t) {
1288  assert(t <= static_cast<std::underlying_type<snoop_e>::type>(snoop_e::WRITE_NO_SNOOP));
1289  return static_cast<snoop_e>(t);
1290 }
1291 
1292 template <> inline resp_e into<resp_e>(typename std::underlying_type<resp_e>::type t) {
1293  assert(t <= static_cast<std::underlying_type<resp_e>::type>(resp_e::DECERR));
1294  return static_cast<resp_e>(t);
1295 }
1296 
1297 inline void common::set_id(unsigned int id) { this->id = id; }
1298 
1299 inline unsigned int common::get_id() const { return id; }
1300 
1301 inline void common::set_user(id_type chnl, unsigned int user) { this->user[static_cast<size_t>(chnl)] = user; }
1302 
1303 inline unsigned int common::get_user(id_type chnl) const { return user[static_cast<size_t>(chnl)]; }
1304 
1305 inline void axi3::set_exclusive(bool exclusive) {
1306  uint8_t t = to_int(lock);
1307  if(exclusive)
1308  t |= EXCL;
1309  else
1310  t &= ~EXCL;
1311  lock = into<lock_e>(t);
1312 }
1313 
1314 inline bool axi3::is_exclusive() const {
1315  uint8_t t = to_int(lock);
1316  return (t & EXCL) != 0;
1317 }
1318 
1319 inline void axi3::set_locked(bool locked) {
1320  uint8_t t = to_int(lock);
1321  if(locked)
1322  t |= LOCKED;
1323  else
1324  t &= ~LOCKED;
1325  lock = into<lock_e>(t);
1326 }
1327 
1328 inline bool axi3::is_locked() const {
1329  uint8_t t = to_int(lock);
1330  return (t & LOCKED) != 0;
1331 }
1332 
1333 inline void axi3::set_bufferable(bool bufferable) {
1334  if(bufferable)
1335  cache |= BUFFERABLE;
1336  else
1337  cache &= ~BUFFERABLE;
1338 }
1339 
1340 inline bool axi3::is_bufferable() const { return (cache & BUFFERABLE) != 0; }
1341 
1342 inline void axi3::set_cacheable(bool cacheable) {
1343  if(cacheable)
1344  cache |= CACHEABLE;
1345  else
1346  cache &= ~CACHEABLE;
1347 }
1348 
1349 inline bool axi3::is_cacheable() const { return (cache & CACHEABLE) != 0; }
1350 
1351 inline void axi3::set_write_allocate(bool wa) {
1352  if(wa)
1353  cache |= WA;
1354  else
1355  cache &= ~WA;
1356 }
1357 
1358 inline bool axi3::is_write_allocate() const { return (cache & WA) != 0; }
1359 
1360 inline void axi3::set_read_allocate(bool ra) {
1361  if(ra)
1362  cache |= RA;
1363  else
1364  cache &= ~RA;
1365 }
1366 
1367 inline bool axi3::is_read_allocate() const { return (cache & RA) != 0; }
1368 
1369 inline void axi4::set_exclusive(bool exclusive) { lock = exclusive ? lock_e::EXLUSIVE : lock_e::NORMAL; }
1370 
1371 inline bool axi4::is_exclusive() const { return lock == lock_e::EXLUSIVE; }
1372 
1373 inline void axi4::set_bufferable(bool bufferable) {
1374  if(bufferable)
1375  cache |= BUFFERABLE;
1376  else
1377  cache &= ~BUFFERABLE;
1378 }
1379 
1380 inline bool axi4::is_bufferable() const { return (cache & BUFFERABLE) != 0; }
1381 
1382 inline void axi4::set_modifiable(bool cacheable) {
1383  if(cacheable)
1384  cache |= CACHEABLE;
1385  else
1386  cache &= ~CACHEABLE;
1387 }
1388 
1389 inline bool axi4::is_modifiable() const { return (cache & CACHEABLE) != 0; }
1390 
1391 inline void axi4::set_allocate(bool roa) {
1392  if(roa)
1393  cache |= WA;
1394  else
1395  cache &= ~WA;
1396 }
1397 
1398 inline bool axi4::is_allocate() const { return (cache & WA) != 0; }
1399 
1400 inline void axi4::set_other_allocate(bool woa) {
1401  if(woa)
1402  cache |= RA;
1403  else
1404  cache &= ~RA;
1405 }
1406 
1407 inline bool axi4::is_other_allocate() const { return (cache & RA) != 0; }
1408 
1409 inline void axi4::set_cacheable(bool cacheable) {
1410  if(cacheable)
1411  cache |= CACHEABLE;
1412  else
1413  cache &= ~CACHEABLE;
1414 }
1415 
1416 inline bool axi4::is_cacheable() const { return (cache & CACHEABLE) != 0; }
1417 
1418 inline void axi4::set_write_allocate(bool roa) {
1419  if(roa)
1420  cache |= WA;
1421  else
1422  cache &= ~WA;
1423 }
1424 
1425 inline bool axi4::is_write_allocate() const { return (cache & WA) != 0; }
1426 
1427 inline void axi4::set_read_allocate(bool woa) {
1428  if(woa)
1429  cache |= RA;
1430  else
1431  cache &= ~RA;
1432 }
1433 
1434 inline bool axi4::is_read_allocate() const { return (cache & RA) != 0; }
1435 
1436 inline void request::reset() {
1437  length = 0;
1438  size = 0;
1439  burst = burst_e::FIXED;
1440  prot = 0;
1441  qos = 0;
1442  region = 0;
1443  domain = domain_e::NON_SHAREABLE;
1444  snoop = snoop_e::READ_NO_SNOOP;
1445  barrier = bar_e::RESPECT_BARRIER;
1446  lock = lock_e::NORMAL;
1447  cache = 0;
1448  unique = false;
1449  atop = 0;
1450 }
1451 
1452 inline void request::set_length(uint8_t length) { this->length = length; }
1453 
1454 inline uint8_t request::get_length() const { return length; }
1455 
1456 inline void request::set_size(uint8_t size) {
1457  assert(size < 10);
1458  this->size = size;
1459 }
1460 
1461 inline uint8_t request::get_size() const { return size; }
1462 
1463 inline void request::set_burst(burst_e burst) { this->burst = burst; }
1464 
1465 inline burst_e request::get_burst() const { return burst; }
1466 
1467 inline void request::set_prot(uint8_t prot) {
1468  assert(prot < 8);
1469  this->prot = prot;
1470 }
1471 
1472 inline uint8_t request::get_prot() const { return prot; }
1473 
1474 inline void request::set_privileged(bool privileged) {
1475  prot &= ~PRIVILEGED;
1476  if(privileged)
1477  prot |= PRIVILEGED;
1478 }
1479 
1480 inline bool request::is_privileged() const { return (prot & PRIVILEGED) != 0; }
1481 
1482 inline void request::set_non_secure(bool non_sec) {
1483  prot &= ~SECURE;
1484  if(non_sec)
1485  prot |= SECURE;
1486 }
1487 
1488 inline bool request::is_non_secure() const { return (prot & SECURE) != 0; }
1489 
1490 inline void request::set_instruction(bool instr) {
1491  prot &= ~INSTRUCTION;
1492  if(instr)
1493  prot |= INSTRUCTION;
1494 }
1495 
1496 inline bool request::is_instruction() const { return (prot & INSTRUCTION) != 0; }
1497 
1498 inline void request::set_qos(uint8_t qos) { this->qos = qos; }
1499 
1500 inline uint8_t request::get_qos() const { return qos; }
1501 
1502 inline void request::set_region(uint8_t region) { this->region = region; }
1503 
1504 inline uint8_t request::get_region() const { return region; }
1505 
1506 inline void request::set_cache(uint8_t cache) {
1507  assert(cache < 16);
1508  this->cache = cache;
1509 }
1510 
1511 inline uint8_t request::get_cache() const { return cache; }
1512 
1513 inline void ace::set_domain(domain_e domain) { this->domain = domain; }
1514 
1515 inline domain_e ace::get_domain() const { return domain; }
1516 
1517 inline void ace::set_snoop(snoop_e snoop) { this->snoop = snoop; }
1518 
1519 inline snoop_e ace::get_snoop() const { return snoop; }
1520 
1521 inline void ace::set_barrier(bar_e bar) { this->barrier = bar; }
1522 
1523 inline bar_e ace::get_barrier() const { return barrier; }
1524 
1525 inline void ace::set_unique(bool uniq) { this->unique = uniq; }
1526 
1527 inline bool ace::get_unique() const { return unique; }
1528 
1529 inline void request::set_atop(uint8_t atop) { this->atop = atop; }
1530 
1531 inline uint8_t request::get_atop() const { return atop; }
1532 
1533 inline void request::set_stash_nid(uint8_t stash_nid) { this->stash_nid = stash_nid; }
1534 
1535 inline uint8_t request::get_stash_nid() const { return stash_nid < 0x800 ? stash_nid : 0; }
1536 
1537 inline bool request::is_stash_nid_en() const { return stash_nid < 0x800; }
1538 
1539 inline void request::set_stash_lpid(uint8_t stash_lpid) { this->stash_lpid = stash_lpid; }
1540 
1541 inline uint8_t request::get_stash_lpid() const { return stash_lpid < 0x20 ? stash_lpid : 0; }
1542 
1543 inline bool request::is_stash_lpid_en() const { return stash_lpid < 0x20; }
1544 
1545 inline void response::reset() { resp = static_cast<uint8_t>(resp_e::OKAY); }
1546 
1547 inline resp_e response::from_tlm_response_status(tlm::tlm_response_status st) {
1548  switch(st) {
1549  case tlm::TLM_OK_RESPONSE:
1550  return resp_e::OKAY;
1551  case tlm::TLM_INCOMPLETE_RESPONSE:
1552  case tlm::TLM_ADDRESS_ERROR_RESPONSE:
1553  return resp_e::DECERR;
1554  default:
1555  return resp_e::SLVERR;
1556  }
1557 }
1558 
1559 inline tlm::tlm_response_status response::to_tlm_response_status(resp_e resp) {
1560  switch(to_int(resp) & 0x3) {
1561  case to_int(resp_e::OKAY):
1562  return tlm::TLM_OK_RESPONSE;
1563  case to_int(resp_e::EXOKAY):
1564  return tlm::TLM_OK_RESPONSE;
1565  case to_int(resp_e::DECERR):
1566  return tlm::TLM_ADDRESS_ERROR_RESPONSE;
1567  default:
1568  return tlm::TLM_GENERIC_ERROR_RESPONSE;
1569  }
1570 }
1571 
1572 inline void response::set_resp(resp_e resp) { this->resp = static_cast<uint8_t>(resp); }
1573 
1574 inline resp_e response::get_resp() const { // @suppress("No return")
1575  switch(resp & 0x3) {
1576  case 0:
1577  return resp_e::OKAY;
1578  case 1:
1579  return resp_e::EXOKAY;
1580  case 2:
1581  return resp_e::SLVERR;
1582  default:
1583  return resp_e::DECERR;
1584  }
1585 }
1586 
1587 inline bool response::is_okay() const { return resp == static_cast<uint8_t>(resp_e::OKAY); }
1588 
1589 inline void response::set_okay() { resp = static_cast<uint8_t>(resp_e::OKAY); }
1590 
1591 inline bool response::is_exokay() const { return resp == static_cast<uint8_t>(resp_e::EXOKAY); }
1592 
1593 inline void response::set_exokay() { resp = static_cast<uint8_t>(resp_e::EXOKAY); }
1594 
1595 inline bool response::is_slverr() const { return resp == static_cast<uint8_t>(resp_e::SLVERR); }
1596 
1597 inline void response::set_slverr() { resp = static_cast<uint8_t>(resp_e::SLVERR); }
1598 
1599 inline bool response::is_decerr() const { return resp == static_cast<uint8_t>(resp_e::DECERR); }
1600 
1601 inline void response::set_decerr() { resp = static_cast<uint8_t>(resp_e::DECERR); }
1602 
1603 inline void ace_response::set_cresp(uint8_t resp) { this->resp = resp & 0x1f; }
1604 
1605 inline uint8_t ace_response::get_cresp() const { return resp; }
1606 
1607 inline bool ace_response::is_pass_dirty() const { return (resp & PASSDIRTY) != 0; }
1608 
1609 inline void ace_response::set_pass_dirty(bool dirty) {
1610  if(dirty)
1611  resp |= PASSDIRTY;
1612  else
1613  resp &= ~PASSDIRTY;
1614 }
1615 
1616 inline bool ace_response::is_shared() const { return (resp & ISSHARED) != 0; }
1617 
1618 inline void ace_response::set_shared(bool shared) {
1619  if(shared)
1620  resp |= ISSHARED;
1621  else
1622  resp &= ~ISSHARED;
1623 }
1624 
1625 inline bool ace_response::is_snoop_data_transfer() const { return (resp & DATATRANSFER) != 0; }
1626 
1627 inline void ace_response::set_snoop_data_transfer(bool snoop_data) {
1628  if(snoop_data)
1629  resp |= DATATRANSFER;
1630  else
1631  resp &= ~DATATRANSFER;
1632 }
1633 
1634 inline bool ace_response::is_snoop_error() const { return (resp & SNOOPEERROR) != 0; }
1635 
1636 inline void ace_response::set_snoop_error(bool err) {
1637  if(err)
1638  resp |= SNOOPEERROR;
1639  else
1640  resp &= ~SNOOPEERROR;
1641 }
1642 
1643 inline bool ace_response::is_snoop_was_unique() const { return (resp & WASUNIQUE) != 0; }
1644 
1645 inline void ace_response::set_snoop_was_unique(bool uniq) {
1646  if(uniq)
1647  resp |= WASUNIQUE;
1648  else
1649  resp &= ~WASUNIQUE;
1650 }
1651 
1652 template <typename REQ, typename RESP> axi_extension<REQ, RESP>::axi_extension(const axi_extension<REQ, RESP>* ext) {
1653  static_cast<common&>(*this) = *ext;
1654  static_cast<REQ&>(*this) = *ext;
1655  static_cast<response&>(*this) = *ext;
1656 }
1657 
1658 template <typename REQ, typename RESP> void axi_extension<REQ, RESP>::reset() {
1659  common::reset();
1660  REQ::reset();
1661  response::reset();
1662 }
1663 
1664 template <typename REQ, typename RESP> void axi_extension<REQ, RESP>::reset(const REQ* control) {
1665  common::reset();
1666  static_cast<REQ&>(*this) = *control;
1667  response::reset();
1668 }
1669 
1670 template <typename REQ, typename RESP> inline void axi_extension<REQ, RESP>::add_to_response_array(response& arr) {
1671  response_arr.push_back(arr);
1672 }
1673 
1674 template <typename REQ, typename RESP>
1675 inline const std::vector<response>& axi_extension<REQ, RESP>::get_response_array() const {
1676  return response_arr;
1677 }
1678 
1679 template <typename REQ, typename RESP> inline std::vector<response>& axi_extension<REQ, RESP>::get_response_array() {
1680  return response_arr;
1681 }
1682 
1683 template <typename REQ, typename RESP>
1685  response_array_complete = complete;
1686 }
1687 
1688 template <typename REQ, typename RESP> inline bool axi_extension<REQ, RESP>::is_response_array_complete() {
1689  return response_array_complete;
1690 }
1691 
1692 inline tlm::tlm_extension_base* axi3_extension::clone() const { return new axi3_extension(this); }
1693 
1694 inline void axi3_extension::copy_from(const tlm::tlm_extension_base& bext) {
1695  auto const* ext = dynamic_cast<const axi3_extension*>(&bext);
1696  assert(ext);
1697  static_cast<common&>(*this) = *ext;
1698  static_cast<axi_extension<axi3>&>(*this) = *ext;
1699  static_cast<response&>(*this) = *ext;
1700 }
1701 
1702 inline tlm::tlm_extension_base* axi4_extension::clone() const { return new axi4_extension(this); }
1703 
1704 inline void axi4_extension::copy_from(const tlm::tlm_extension_base& bext) {
1705  auto const* ext = dynamic_cast<const axi4_extension*>(&bext);
1706  assert(ext);
1707  static_cast<common&>(*this) = *ext;
1708  static_cast<axi_extension<axi4>&>(*this) = *ext;
1709  static_cast<response&>(*this) = *ext;
1710 }
1711 
1712 inline tlm::tlm_extension_base* ace_extension::clone() const { return new ace_extension(this); }
1713 
1714 inline void ace_extension::copy_from(const tlm::tlm_extension_base& bext) {
1715  auto const* ext = dynamic_cast<const ace_extension*>(&bext);
1716  assert(ext);
1717  static_cast<common&>(*this) = *ext;
1718  static_cast<axi_extension<ace, ace_response>&>(*this) = *ext;
1719  static_cast<response&>(*this) = *ext;
1720 }
1721 
1722 } // 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:1167
domain_e
Definition: axi_tlm.h:85
tlm::tlm_generic_payload axi_payload
aliases for payload and phase types
Definition: axi_tlm.h:914
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:956
burst_e
Definition: axi_tlm.h:73
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:954
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:1146
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:1202
tlm::tlm_fw_transport_if< TYPES > ace_fw_transport_if
alias declaration for the ACE forward interface
Definition: axi_tlm.h:958
ace_extension()=default
the default constructor
ace_extension(const ace_extension *o)
the copy constructor
Definition: axi_tlm.h:900
tlm::tlm_extension_base * clone() const override
the clone function to create deep copies of
Definition: axi_tlm.h:1712
void copy_from(tlm::tlm_extension_base const &ext) override
deep copy all values from ext
Definition: axi_tlm.h:1714
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:1045
const char * kind() const override
get the kind of this sc_object
Definition: axi_tlm.h:1061
ace_initiator_socket(const char *name)
constructor with instance name
Definition: axi_tlm.h:1055
ace_initiator_socket()
default constructor using a generated instance name
Definition: axi_tlm.h:1049
void set_snoop_was_unique(bool=true)
set the response status bit WasUnique
Definition: axi_tlm.h:1645
bool is_snoop_data_transfer() const
check the response status bit DataTransfer
Definition: axi_tlm.h:1625
void set_cresp(uint8_t)
set the coherent response status
Definition: axi_tlm.h:1603
bool is_snoop_was_unique() const
check the response status bit WasUnique
Definition: axi_tlm.h:1643
void set_snoop_error(bool=true)
set the response status bit Error
Definition: axi_tlm.h:1636
void set_pass_dirty(bool=true)
set the response status bit PassDirty
Definition: axi_tlm.h:1609
uint8_t get_cresp() const
get the coherent response status
Definition: axi_tlm.h:1605
bool is_pass_dirty() const
check the response status bit PassDirty (CRESP[2])
Definition: axi_tlm.h:1607
bool is_shared() const
check the response status bit IsShared (CRESP[3])
Definition: axi_tlm.h:1616
void set_shared(bool=true)
set the response status bit IsShared
Definition: axi_tlm.h:1618
bool is_snoop_error() const
check the response status bit Error
Definition: axi_tlm.h:1634
void set_snoop_data_transfer(bool=true)
set the response status bit DataTransfer
Definition: axi_tlm.h:1627
ace_target_socket()
default constructor using a generated instance name
Definition: axi_tlm.h:1083
const char * kind() const override
get the kind of this sc_object
Definition: axi_tlm.h:1095
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:1079
ace_target_socket(const char *name)
constructor with instance name
Definition: axi_tlm.h:1089
void set_barrier(bar_e)
set the AxBAR value
Definition: axi_tlm.h:1521
bool get_unique() const
get the AxUNIQUE value return the unique value
Definition: axi_tlm.h:1527
void set_domain(domain_e)
set the AxDOMAIN value
Definition: axi_tlm.h:1513
bar_e get_barrier() const
get the AxBAR value return the barrier value
Definition: axi_tlm.h:1523
void set_unique(bool)
set the AxUNIQUE value
Definition: axi_tlm.h:1525
ace & operator=(const ace &o)
Definition: axi_tlm.h:578
snoop_e get_snoop() const
get the AxSNOOP value return the snoop value
Definition: axi_tlm.h:1519
domain_e get_domain() const
get the AxDOMAIN value return the domain value
Definition: axi_tlm.h:1515
void set_snoop(snoop_e)
set the AxSNOOP value
Definition: axi_tlm.h:1517
axi3_extension(const axi3_extension *o)
the copy constructor
Definition: axi_tlm.h:850
tlm::tlm_extension_base * clone() const override
the clone function to create deep copies of
Definition: axi_tlm.h:1692
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:1694
bool is_bufferable() const
get the bufferable bit of AxCACHE (AxCACHE[0]) return the bufferable bit
Definition: axi_tlm.h:1340
void set_cacheable(bool=true)
set the cacheable bit of AxCACHE (AxCACHE[1])
Definition: axi_tlm.h:1342
void set_write_allocate(bool=true)
set the write_allocate bit of AxCACHE (AxCACHE[2])
Definition: axi_tlm.h:1351
bool is_read_allocate() const
get the read_allocate bit of AxCACHE (AxCACHE[3]) return the read_allocate bit
Definition: axi_tlm.h:1367
void set_locked(bool=true)
get the locked bit of AxLOCK (AxLOCK[1])
Definition: axi_tlm.h:1319
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:1305
void set_read_allocate(bool=true)
set the read_allocate bit of AxCACHE (AxCACHE[3])
Definition: axi_tlm.h:1360
void set_bufferable(bool=true)
set the bufferable bit of AxCACHE (AxCACHE[0])
Definition: axi_tlm.h:1333
bool is_exclusive() const
get the exclusive bit of AxLOCK (AxLOCK[0]) return the exclusive bit
Definition: axi_tlm.h:1314
bool is_write_allocate() const
get the write_allocate bit of AxCACHE (AxCACHE[2]) return the write_allocate bit
Definition: axi_tlm.h:1358
bool is_cacheable() const
get the cacheable bit of AxCACHE (AxCACHE[1]) return the cacheable bit
Definition: axi_tlm.h:1349
bool is_locked() const
get the locked bit of AxLOCK (AxLOCK[1]) return the locked bit
Definition: axi_tlm.h:1328
axi4_extension()=default
the default constructor
axi4_extension(const axi4_extension *o)
the copy constructor
Definition: axi_tlm.h:875
void copy_from(tlm::tlm_extension_base const &ext) override
deep copy all values from ext
Definition: axi_tlm.h:1704
tlm::tlm_extension_base * clone() const override
the clone function to create deep copies of
Definition: axi_tlm.h:1702
void set_allocate(bool=true)
set the write allocate/read other allocate bit of AxCACHE (AxCACHE[3])
Definition: axi_tlm.h:1391
bool is_modifiable() const
get the modifiable bit of AxCACHE (AxCACHE[1]) return the modifiable bit
Definition: axi_tlm.h:1389
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:1369
bool is_allocate() const
get the write allocate/read other allocate bit of AxCACHE (AxCACHE[3]) return the write_other_allocat...
Definition: axi_tlm.h:1398
void set_modifiable(bool=true)
set the modifiable bit of AxCACHE (AxCACHE[1])
Definition: axi_tlm.h:1382
void set_other_allocate(bool=true)
set the read allocate/write other allocate bit of AxCACHE (AxCACHE[2])
Definition: axi_tlm.h:1400
bool is_bufferable() const
get the bufferable bit of AxCACHE (AxCACHE[0]) return the bufferable bit
Definition: axi_tlm.h:1380
bool is_exclusive() const
get the exclusive bit of AxLOCK (AxLOCK[0]) return the exclusive bit
Definition: axi_tlm.h:1371
bool is_write_allocate() const
get the write allocate/read other allocate bit of AxCACHE (AxCACHE[3]) return the write_other_allocat...
Definition: axi_tlm.h:1425
bool is_read_allocate() const
get the read allocate/write other allocate bit of AxCACHE (AxCACHE[2]) return the read_other_allocate...
Definition: axi_tlm.h:1434
bool is_other_allocate() const
get the read allocate/write other allocate bit of AxCACHE (AxCACHE[2]) return the read_other_allocate...
Definition: axi_tlm.h:1407
bool is_cacheable() const
get the modifiable bit of AxCACHE (AxCACHE[1]) return the modifiable bit
Definition: axi_tlm.h:1416
void set_bufferable(bool=true)
set the bufferable bit of AxCACHE (AxCACHE[0])
Definition: axi_tlm.h:1373
void set_write_allocate(bool=true)
set the write allocate/read other allocate bit of AxCACHE (AxCACHE[3])
Definition: axi_tlm.h:1418
void set_read_allocate(bool=true)
set the read allocate/write other allocate bit of AxCACHE (AxCACHE[2])
Definition: axi_tlm.h:1427
void set_cacheable(bool=true)
set the modifiable bit of AxCACHE (AxCACHE[1])
Definition: axi_tlm.h:1409
bool is_response_array_complete()
Definition: axi_tlm.h:1688
axi_extension(const axi_extension< REQ, RESP > *)
the copy constructor
Definition: axi_tlm.h:1652
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:1675
std::vector< response > & get_response_array()
return the read response array
Definition: axi_tlm.h:1679
void reset(const REQ *)
reset the common and response part, reset response using the given reset value
Definition: axi_tlm.h:1664
void set_response_array_complete(bool=true)
set the flag indicating the all read responses are collected
Definition: axi_tlm.h:1684
void add_to_response_array(response &)
add a read response to the response array
Definition: axi_tlm.h:1670
void reset()
reset all data member to their default
Definition: axi_tlm.h:1658
virtual ~axi_extension()
Definition: axi_tlm.h:798
axi_initiator_socket()
default constructor using a generated instance name
Definition: axi_tlm.h:985
axi_initiator_socket(const char *name)
constructor with instance name
Definition: axi_tlm.h:991
const char * kind() const override
get the kind of this sc_object
Definition: axi_tlm.h:997
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:981
The AXI protocol traits class. Since the protocoll defines additional non-ignorable phases a dedicate...
Definition: axi_tlm.h:920
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:1013
axi_target_socket(const char *name)
constructor with instance name
Definition: axi_tlm.h:1023
axi_target_socket()
default constructor using a generated instance name
Definition: axi_tlm.h:1017
const char * kind() const override
get the kind of this sc_object
Definition: axi_tlm.h:1029
void reset()
reset all data member to their default
void set_id(unsigned int value)
Definition: axi_tlm.h:1297
unsigned int get_user(id_type chnl) const
Definition: axi_tlm.h:1303
void set_user(id_type chnl, unsigned int value)
Definition: axi_tlm.h:1301
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:1299
void set_instruction(bool=true)
set the instruction bit of the AxPROT (AxPROT[2])
Definition: axi_tlm.h:1490
uint8_t get_atop() const
get the raw AWATOP value return the unique value
Definition: axi_tlm.h:1531
void set_length(uint8_t)
set the AxLEN value of the transaction, the value denotes the burst length - 1
Definition: axi_tlm.h:1452
bool is_stash_lpid_en() const
check if AWSTASHLPID is valid return the valid value
Definition: axi_tlm.h:1543
void set_qos(uint8_t)
set the AxQOS (quality of service) value
Definition: axi_tlm.h:1498
uint8_t get_stash_lpid() const
get the raw AWSTASHLPID value return the unique value
Definition: axi_tlm.h:1541
void set_cache(uint8_t)
set the AxCACHE value as POD, only value from 0..15 are allowed
Definition: axi_tlm.h:1506
request & operator=(const request &o)
Definition: axi_tlm.h:356
void set_region(uint8_t)
set the AxREGION value
Definition: axi_tlm.h:1502
bool is_instruction() const
set the instruction bit of the AxPROT (AxPROT[2])
Definition: axi_tlm.h:1496
burst_e get_burst() const
get the AxBURST value,
Definition: axi_tlm.h:1465
uint8_t get_length() const
get the AxLEN value of the transaction, the value denotes the burst length - 1
Definition: axi_tlm.h:1454
bool is_privileged() const
get the privileged bit of the AxPROT (AxPROT[0])
Definition: axi_tlm.h:1480
void set_non_secure(bool=true)
set the non-secure bit of the AxPROT (AxPROT[1])
Definition: axi_tlm.h:1482
void set_stash_lpid(uint8_t)
set the raw AWSTASHLPID value
Definition: axi_tlm.h:1539
void set_burst(burst_e)
set the AxBURST value,
Definition: axi_tlm.h:1463
bool is_non_secure() const
set the non-secure bit of the AxPROT (AxPROT[1])
Definition: axi_tlm.h:1488
uint8_t get_region() const
get the AxREGION value
Definition: axi_tlm.h:1504
void set_privileged(bool=true)
set the privileged bit of the AxPROT (AxPROT[0])
Definition: axi_tlm.h:1474
bool is_stash_nid_en() const
check if AWSTASHNID is valid return the valid value
Definition: axi_tlm.h:1537
void reset()
reset all data member to their default
Definition: axi_tlm.h:1436
uint8_t get_qos() const
get the AxQOS (quality of service) value
Definition: axi_tlm.h:1500
uint8_t get_stash_nid() const
get the raw AWSTASHNID value return the unique value
Definition: axi_tlm.h:1535
void set_atop(uint8_t)
set the raw AWATOP value
Definition: axi_tlm.h:1529
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:1456
request()=default
the default constructor
uint8_t get_cache() const
get the AxCACHE value as POD
Definition: axi_tlm.h:1511
uint8_t get_prot() const
set the AxPROT value as POD, only values from 0...7 are allowed
Definition: axi_tlm.h:1472
void set_prot(uint8_t)
set the AxPROT value as POD, only values from 0...7 are allowed
Definition: axi_tlm.h:1467
void set_stash_nid(uint8_t)
set the raw AWSTASHNID value
Definition: axi_tlm.h:1533
uint8_t get_size() const
set the AxSIZE value of the transaction
Definition: axi_tlm.h:1461
resp_e get_resp() const
get the response status as POD
Definition: axi_tlm.h:1574
void set_okay()
set the response status to OKAY
Definition: axi_tlm.h:1589
void set_decerr()
set the response status to DECERR
Definition: axi_tlm.h:1601
bool is_decerr() const
check if the response status is DECERR
Definition: axi_tlm.h:1599
void set_resp(resp_e)
set the response status as POD
Definition: axi_tlm.h:1572
bool is_exokay() const
check if the response status is EXOKAY
Definition: axi_tlm.h:1591
bool is_slverr() const
check if the response status is SLVERR
Definition: axi_tlm.h:1595
void set_slverr()
set the response status to SLVERR
Definition: axi_tlm.h:1597
bool is_okay() const
check if the response status is OKAY
Definition: axi_tlm.h:1587
response & operator=(const response &o)
assignment operator
Definition: axi_tlm.h:633
void reset()
reset all data member to their default
Definition: axi_tlm.h:1545
static tlm::tlm_response_status to_tlm_response_status(resp_e)
converts a
Definition: axi_tlm.h:1559
void set_exokay()
set the response status to EXOKAY
Definition: axi_tlm.h:1593
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:1547