scc  2022.4.0
SystemC components library
chi_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 chi {
29 template <typename Enum> struct enable_for_enum { static const bool value = false; };
35 template <typename E> inline E into(typename std::underlying_type<E>::type t);
41 template <
42 typename E, typename ULT = typename std::underlying_type<E>::type,
43 typename X = typename std::enable_if<std::is_enum<E>::value && !std::is_convertible<E, ULT>::value, bool>::type>
44 inline constexpr ULT to_int(E t) {
45  return static_cast<typename std::underlying_type<E>::type>(t);
46 }
52 template <typename E> const char* to_char(E t);
59 template <typename E, typename std::enable_if<enable_for_enum<E>::value, bool>::type>
60 inline std::ostream& operator<<(std::ostream& os, E e) {
61  os << to_char(e);
62  return os;
63 }
64 
65 // REQ channel request type enumeration class
66 enum class req_optype_e : uint8_t {
67  // Table 12-14 REQ channel opcodes and Page No:318
68  ReqLCrdReturn = 0x00,
69  ReadShared = 0x01,
70  ReadClean = 0x02,
71  ReadOnce = 0x03,
72  ReadNoSnp = 0x04,
73  PCrdReturn = 0x05,
74  Reserved = 0x06,
75  ReadUnique = 0x07,
76  CleanShared = 0x08,
77  CleanInvalid = 0x09,
78  MakeInvalid = 0x0A,
79  CleanUnique = 0x0B,
80  MakeUnique = 0x0C,
81  Evict = 0x0D,
82  EOBarrier = 0x0E,
83  ECBarrier = 0x0F,
84  // RESERVED 0x10
85  ReadNoSnpSep = 0x11, //CHI-E
86  // RESERVED 0x12
87  CleanSharedPersistSep = 0x13, //CHI-E
88  DVMOp = 0x14,
89  WriteEvictFull = 0x15,
90  WriteCleanPtl = 0x16, // As per CHI issue-A
91  WriteCleanFull = 0x17,
92  WriteUniquePtl = 0x18,
93  WriteUniqueFull = 0x19,
94  WriteBackPtl = 0x1A,
95  WriteBackFull = 0x1B,
96  WriteNoSnpPtl = 0x1C,
97  WriteNoSnpFull = 0x1D,
98  // RESERVED 0x1E-0x1F
99  WriteUniqueFullStash = 0x20,
100  WriteUniquePtlStash = 0x21,
101  StashOnceShared = 0x22,
102  StashOnceUnique = 0x23,
103  ReadOnceCleanInvalid = 0x24,
104  ReadOnceMakeInvalid = 0x25,
105  ReadNotSharedDirty = 0x26,
106  CleanSharedPersist = 0x27,
107  AtomicStoreAdd = 0x28,
108  AtomicStoreClr = 0x29,
109  AtomicStoreEor = 0x2A,
110  AtomicStoreSet = 0x2B,
111  AtomicStoreSmax = 0x2C,
112  AtomicStoreSmin = 0x2D,
113  AtomicStoreUmax = 0x2E,
114  AtomicStoreUmin = 0x2F,
115  AtomicLoadAdd = 0x30,
116  AtomicLoadClr = 0x31,
117  AtomicLoadEor = 0x32,
118  AtomicLoadSet = 0x33,
119  AtomicLoadSmax = 0x34,
120  AtomicLoadSmin = 0x35,
121  AtomicLoadUmax = 0x36,
122  AtomicLoadUmin = 0x37,
123  AtomicSwap = 0x38,
124  AtomicCompare = 0x39,
125  PrefetchTgt = 0x3A,
126  // RESERVED = 0x3B to 0x40
127  // all CHI-E from here on
128  MakeReadUnique = 0x41,
129  WriteEvictOrEvict = 0x42,
130  WriteUniqueZero = 0x43,
131  WriteNoSnpZero = 0x44,
132  // RESERVED = 0x45 to 0x46
133  StashOnceSepShared = 0x47,
134  StashOnceSepUnique = 0x48,
135  // RESERVED = 0x49 to 0x4b
136  ReadPreferUnique = 0x4c,
137  // RESERVED = 0x4d to 0x4F
138  WriteNoSnpFullCleanSh = 0x50,
139  WriteNoSnpFullCleanInv = 0x51,
140  WriteNoSnpFullCleanShPerSep = 0x52,
141  // RESERVED = 0x52
142  WriteUniqueFullCleanSh = 0x54,
143  // RESERVED = 0x55
144  WriteUniqueFullCleanShPerSep = 0x56,
145  // RESERVED = 0x57
146  WriteBackFullCleanSh = 0x58,
147  WriteBackFullCleanInv = 0x59,
148  WriteBackFullCleanShPerSep = 0x5A,
149  // RESERVED = 0x5B
150  WriteCleanFullCleanSh = 0x5c,
151  // RESERVED = 0x5d
152  WriteCleanFullCleanShPerSep = 0x5e,
153  // RESERVED = 0x3f
154  WriteNoSnpPtlCleanSh = 0x60,
155  WriteNoSnpPtlCleanInv = 0x61,
156  WriteNoSnpPtlCleanShPerSep = 0x62,
157  // RESERVED = 0x63
158  WriteUniquePtlCleanSh = 0x64,
159  // RESERVED = 0x3B to 0x40
160  WriteUniquePtlCleanShPerSep = 0x66,
161  // RESERVED = 0x67 to 0x7f
162  ILLEGAL = 0xFF
163 };
164 
165 // the Snp_Req channel request type enumeration class acc. Table 12-17 SNP channel opcodes and Page No:321
166 enum class snp_optype_e : uint8_t {
167  SnpLCrdReturn = 0x00,
168  SnpShared = 0x01,
169  SnpClean = 0x02,
170  SnpOnce = 0x03,
171  SnpNotSharedDirty = 0x04,
172  SnpUniqueStash = 0x05,
173  SnpMakeInvalidStash = 0x06,
174  SnpUnique = 0x07,
175  SnpCleanShared = 0x08,
176  SnpCleanInvalid = 0x09,
177  SnpMakeInvalid = 0x0A,
178  SnpStashUnique = 0x0B,
179  SnpStashShared = 0x0c,
180  SnpDVMOp = 0x0D,
181  SnpQuery = 0x10,
182  SnpSharedFwd = 0x11,
183  SnpCleanFwd = 0x12,
184  SnpOnceFwd = 0x13,
185  SnpNotSharedDirtyFwd = 0x14,
186  SnpPreferUnique = 0x15,
187  SnpPreferUniqueFwd = 0x16,
188  SnpUniqueFwd = 0x17,
189  // Reserved = 0x0E-0x0F
190  // Reserved = 0x18-0x1F
191  ILLEGAL = 0x20
192 };
193 
194 // the Dat type enumeration class acc. Table 12-18 DAT channel opcodes and Page No:322
195 enum class dat_optype_e : uint8_t {
196  DataLCrdReturn = 0x0,
197  SnpRespData = 0x1,
198  CopyBackWrData = 0x2,
199  NonCopyBackWrData = 0x3,
200  CompData = 0x4,
201  SnpRespDataPtl = 0x5,
202  SnpRespDataFwded = 0x6,
203  WriteDataCancel = 0x7,
204  DataSepResp = 0xB,
205  NCBWrDataCompAck = 0xC,
206  // Reserved = 0x8-0xA
207  // Reserved = 0xD-0xF
208  // Table 4-9 Permitted Non-forward type data opcode
209  SnpRespData_I = 0x1,
210  SnpRespData_UC = 0x1,
211  SnpRespData_UD = 0x1,
212  SnpRespData_SC = 0x1,
213  SnpRespData_SD = 0x1,
214  SnpRespData_I_PD = 0x1,
215  SnpRespData_UC_PD = 0x1,
216  SnpRespData_SC_PD = 0x1,
217  SnpRespDataPtl_I_PD = 0x5,
218  SnpRespDataPtl_UD = 0x5,
219  // Table 4-10 Permitted Forward data opcode
220  SnpRespData_I_Fwded_SC = 0x6,
221  SnpRespData_I_Fwded_SD_PD = 0x6,
222  SnpRespData_SC_Fwded_SC = 0x6,
223  SnpRespData_SC_Fwded_SD_PD = 0x6,
224  SnpRespData_SD_Fwded_SC = 0x6,
225  SnpRespData_I_PD_Fwded_I = 0x6,
226  SnpRespData_I_PD_Fwded_SC = 0x6,
227  SnpRespData_SC_PD_Fwded_I = 0x6,
228  SnpRespData_SC_PD_Fwded_SC = 0x6
229 };
230 
231 // the dat response 'resp' field type enumeration class acc. sec 4.5 Response types
232 enum class dat_resptype_e : uint8_t {
233  // Read and Atomic Completion
234  CompData_I = 0b000, // Copy of cacheline cannot be kept
235  CompData_SC = 0b001,
236  CompData_UC = 0b010, // Final state of cacheline can be UC or UCE or SC or I
237  CompData_UD_PD = 0b110,
238  CompData_SD_PD = 0b111,
239  DataSepResp_I = 0b000,
240  DataSepResp_SC = 0b001,
241  DataSepResp_UC = 0b010,
242  RespSepData_I = 0b000, // Not applicable
243  RespSepData_SC = 0b001,
244  RespSepData_UC = 0b010,
245  // Table 4-9 Permitted Non-forward type snoop responses with data(Dat opcode =0x1)
246  SnpRespData_I = 0b000,
247  SnpRespData_UC = 0b010,
248  SnpRespData_UD = 0b010,
249  SnpRespData_SC = 0b001,
250  SnpRespData_SD = 0b011,
251  SnpRespData_I_PD = 0b100,
252  SnpRespData_UC_PD = 0b110,
253  SnpRespData_SC_PD = 0b101,
254  SnpRespDataPtl_I_PD = 0b100,
255  SnpRespDataPtl_UD = 0b010,
256 
257  // Dataless transactions
258  Comp_I = 0b000, // final state must be I
259  Comp_UC = 0b010, // final state can be UC, UCE,SC or I
260  Comp_SC = 0b001, // final state SC or I
261  // Write and Atomic completion
262  CopyBackWrData_I = 0b000, // if cache state when data sent is I
263  CopyBackWrData_UC = 0b010, // Cache line = UC
264  CopyBackWrData_SC = 0b001,
265  CopyBackWrData_UD_PD = 0b110, // cacheline state UD or UDP
266  CopyBackWrData_SD_PD = 0b111,
267  NonCopyBackWrData = 0b000,
268  NCBWrDataCompAck = 0b000
269 };
270 
271 // response type enumeration class according to Table 12-16 RSP channel opcodes and Page No :320
272 enum class rsp_optype_e : uint8_t {
273  RespLCrdReturn = 0x0,
274  SnpResp = 0x1,
275  CompAck = 0x2,
276  RetryAck = 0x3,
277  Comp = 0x4,
278  CompDBIDResp = 0x5,
279  DBIDResp = 0x6,
280  PCrdGrant = 0x7,
281  ReadReceipt = 0x8,
282  SnpRespFwded = 0x9,
283  TagMatch = 0xA,
284  RespSepData = 0xB,
285  Persist =0xC,
286  CompPersist = 0xD,
287  DBIDRespOrd = 0xE,
288  // Reserved = 0xF
289  StashDone = 0x10,
290  CompStashDone = 0x11,
291  // Reserved = 0x12-0x13
292  CompCMO = 0x14,
293  // Reserved = 0x15-0x1f
294  INVALID = 0x20
295 };
296 
297 enum class rsp_resptype_e : uint8_t {
298  // Table 4-7 Permitted Non-forward type snoop responses without data
299  SnpResp_I = 0b000,
300  SnpResp_SC = 0b001,
301  SnpResp_UC = 0b010,
302  SnpResp_UD = 0b010,
303  SnpResp_SD = 0b011,
304  // Table 4-7 Permitted Dataless transaction completion
305  Comp_I = 0b000, // final state must be I
306  Comp_UC = 0b010, // final state can be UC, UCE,SC or I
307  Comp_SC = 0b001, // final state SC or I
308  Comp_UD_PD = 0b110, // final state SC or I
309  // Table 4-11 Permitted Non-forward type snoop responses with data
310  SnpRespData_I = 0b000, // dat opcode =0x1 Snoop response with data.
311  SnpRespData_UC = 0b010,
312  SnpRespData_UD = 0b010, // dat opcode = 0x1 Snoop response with data. Cache line state is UC or UD.
313  SnpRespData_SC = 0b001, // dat opcode = 0x1 Snoop response with data. Cache line state is SC.
314  SnpRespData_SD = 0b011, // dat opcode = 0x1 Snoop response with data. Cache line state is SD.
315  SnpRespData_I_PD = 0b100, // dat opcode = 0x1 Snoop response with data. Cache line state is I. Responsibility for updating the memory is passed to the Home.
316  SnpRespData_UC_PD = 0b110, // dat opcode = 0x1 Snoop response with data. Cache line state is UC. Responsibility for updating the memory is passed to the Home.
317  SnpRespData_SC_PD = 0b101, // dat opcode = 0x1 Snoop response with data. Cache line state is SC. Responsibility for updating the memory is passed to the Home.
318  SnpRespDataPtl_I_PD = 0b100, // dat opcode = 0x5 Snoop response with partial data. Cache line state is I. Responsibility for updating the memory is passed to the Home.
319  SnpRespDataPtl_UD = 0b010, // dat opcode = 0x5 Snoop response with partial data.
320 };
321 
322 enum class rsp_resperrtype_e : uint8_t {
323  OK = 0b00,
324  EXOK = 0b01,
325  DERR = 0b10,
326  NDERR = 0b11
327 };
328 
329 enum class credit_type_e : uint8_t {
330  LINK,
331  REQ, // RN->HN: snoop, HN->RN: req
332  RESP, // RN->HN: cresp, HN->RN: sresp
333  DATA, // RN->HN: rxdata, HN->RN: txdata
334 };
335 
336 enum class dvm_e {
337  DVMOpSize = 0x3,
338  PacketNumShift = 3, // In the request's address
339 
340  // DVM operations
341  TLBI = 0x0,
342  BranchPredictorInvalidate = 0x1,
343  PICI = 0x2,
344  VICI = 0x3,
345  Sync = 0x4,
346 
347  //
348  // Address bits with information [40:4] (37 bits), 8.2.2 [1]
349  //
350  AddressBits = 37,
351 
352  DVMOpMask = 0x7,
353  DVMOpShift = 11,
354 
355  DVMVAValidMask = 0x1,
356  DVMVAValidShift = 4,
357 };
358 
363 struct common {
364 public:
365  void reset();
366 
368  common() = default;
370 
375  common& operator=(const common& o) {
376  qos = o.qos;
377  txn_id = o.txn_id;
378  src_id = o.src_id;
379  return *this;
380  }
381 
384  // A transaction request includes a TxnID that is used to identify the transaction from a given Requester
385  void set_txn_id(unsigned int);
386 
389  unsigned int get_txn_id() const;
390 
393  void set_src_id(unsigned int);
394 
397  unsigned int get_src_id() const;
398 
401  void set_qos(uint8_t qos);
402 
405  unsigned int get_qos() const;
406 
407 private:
408  uint32_t qos{0};
409  uint16_t src_id{0};
410  uint16_t txn_id{0};
411 };
412 
417 struct request {
418  // request() { }
419  // A transaction request includes a TgtID that identifies the target node
420  void set_tgt_id(uint8_t);
421  uint8_t get_tgt_id() const;
422  /*Logical Processor ID. Used in conjunction with the SrcID field to uniquely
423  identify the logical processor that generated the request. */
424  void set_lp_id(uint8_t);
425  uint8_t get_lp_id() const;
426  /*Return Transaction ID. The unique transaction ID that conveys the value of
427  TxnID in the data response from the Slave*/
428  void set_return_txn_id(uint8_t);
429  uint8_t get_return_txn_id() const;
430  // Stash Logical Processor ID. The ID of the logical processor at the Stash target.
431  void set_stash_lp_id(uint8_t);
432  uint8_t get_stash_lp_id() const;
433  /*Data size. Specifies the size of the data associated with the transaction. This
434  determines the number of data packets within the transaction */
435  void set_size(uint8_t);
436  uint8_t get_size() const;
437  /*Max number of flits in current transaction. The number is determined based on data length and bus width
438  * The number is required to identify the last flit in data transaction. */
439  void set_max_flit(uint8_t data_id);
440  uint8_t get_max_flit() const;
441  /* Memory attribute. Determines the memory attributes associated with the transaction. */
442  void set_mem_attr(uint8_t);
443  uint8_t get_mem_attr() const;
444  /* Device memory type must be used for locations that exhibit side-effects. */
445  void set_device(bool is_device);
446  bool is_device() const;
447  /* EWA indicates whether the write completion response for a transaction */
448  void set_ewa(bool is_device);
449  bool is_ewa() const;
450  /* The Allocate attribute is a an allocation hint. It indicates the recommended allocation policy for a transaction */
451  void set_allocate(bool is_device);
452  bool is_allocate() const;
453  /* The Cacheable attribute indicates if a transaction must perform a cache lookup */
454  void set_cacheable(bool is_device);
455  bool is_cacheable() const;
456  /* Protocol Credit Type. Indicates the type of Protocol Credit being used by a
457  request that has the AllowRetry field deasserted */
458  void set_pcrd_type(uint8_t);
459  uint8_t get_pcrd_type() const;
460  // Endianness. Indicates the endianness of Data in the Data packet.
461  void set_endian(bool);
462  bool is_endian() const;
463  /*Order requirement. Determines the ordering requirement for this request with
464  respect to other transactions from the same agent.*/
465  void set_order(uint8_t);
466  uint8_t get_order() const;
467  /*Trace Tag. Provides additional support for the debugging, tracing, and
468  performance measurement of systems. */
469  void set_trace_tag(bool tg = true);
470  bool is_trace_tag() const;
471  void set_opcode(chi::req_optype_e op);
472  chi::req_optype_e get_opcode() const;
473  // Return Node ID. The node ID that the response with Data is to be sent to.
474  void set_return_n_id(uint16_t);
475  uint16_t get_return_n_id() const;
476  // Stash Node ID is the node ID of the Stash target.
477  void set_stash_n_id(uint16_t);
478  uint16_t get_stash_n_id() const;
479  /* Stash Node ID Valid. Indicates that the StashNID field has a valid Stash target
480  value. */
481  void set_stash_n_id_valid(bool = true);
482  bool is_stash_n_id_valid() const;
483  /*Stash Logical Processor ID. The ID of the logical processor at the Stash target.*/
484  void set_stash_lp_id_valid(bool = true);
485  bool is_stash_lp_id_valid() const;
486  /*Secure and Non-secure transactions are defined to support Secure and
487  Non-secure operating states.*/
488  void set_non_secure(bool = true);
489  bool is_non_secure() const;
490  /* Expect CompAck. Indicates that the transaction will include a Completion
491  Acknowledge message*/
492  void set_exp_comp_ack(bool = true);
493  bool is_exp_comp_ack() const;
494  /* Allow Retry determines if the target is permitted to give a Retry response.*/
495  void set_allow_retry(bool = true);
496  bool is_allow_retry() const;
497  /* Snoop attribute specifies the snoop attributes associated with the transaction.*/
498  void set_snp_attr(bool = true);
499  bool is_snp_attr() const;
500  /*Exclusive access. Indicates that the corresponding transaction is an Exclusive
501  access transaction.*/
502  void set_excl(bool = true);
503  bool is_excl() const;
504  /* Snoop Me. Indicates that Home must determine whether to send a snoop to the
505  Requester.*/
506  void set_snoop_me(bool = true);
507  bool is_snoop_me() const;
508  /*The LikelyShared attribute is a cache allocation hint. When asserted this attribute indicates
509  that the requested data is likely to be shared by other Request Nodes within the system */
510  void set_likely_shared(bool = true);
511  bool is_likely_shared() const;
512  /* Indicates the operation to be performed on the tags present in
513  the corresponding DAT channel */
514  void set_tag_op(uint8_t);
515  uint8_t get_tag_op() const;
516  /* Precise contents are IMPLEMENTATION DEFINED. Typically
517  expected to contain Exception Level, TTBR value, and CPU identifier */
518  void set_tag_group_id(uint32_t);
519  uint32_t get_tag_group_id() const;
520  /* Memory System Performance Resource Partitioning and Monitoring.
521  Efficiently utilizes the memory resources among users and monitors their use */
522  void set_mpam(uint16_t);
523  uint16_t get_mpam() const;
524  /* Reserved for customer use. Any value is valid in a Protocol flit. Propagation of this field through the
525  interconnect is IMPLEMENTATION DEFINED.*/
526  void set_rsvdc(uint32_t);
527  uint32_t get_rsvdc() const; // Reserved for customer use.
528 
529 private:
530  uint8_t tgt_id{0}, lp_id{0}, return_txn_id{0}, stash_lp_id{0}, size{0}, max_flit{0}, mem_attr{0}, pcrd_type{0},
531  order{0};
532  bool endian{false}, trace_tag{false};
533  uint16_t return_n_id{0}, stash_n_id{0};
534  req_optype_e opcode{req_optype_e::ReqLCrdReturn};
535  bool stash_n_id_valid{false}, stash_lp_id_valid{false}, ns{false}, exp_comp_ack{false}, allow_retry{false},
536  snp_attr{false}, excl{false}, snoop_me{false}, likely_shared{false};
537  uint32_t rsvdc{0}, tag_group_id{0};
538  uint16_t mpam{0};
539  uint8_t tag_op{0};
540 };
541 
546 struct snp_request {
547  /*Forward Transaction ID. The transaction ID used in the Request by the original
548  Requester.*/
549  void set_fwd_txn_id(uint8_t);
550  uint8_t get_fwd_txn_id() const;
551  /*Stash Logical Processor ID. The ID of the logical processor at the Stash target.*/
552  void set_stash_lp_id(uint8_t);
553  uint8_t get_stash_lp_id() const;
554  /* Stash Node ID Valid. Indicates that the StashNID field has a valid Stash target
555  value. */
556  void set_stash_lp_id_valid(bool = true);
557  bool is_stash_lp_id_valid() const;
558  /* Virtual Machine ID Extension use in DVM Operation types*/
559  void set_vm_id_ext(uint8_t);
560  uint8_t get_vm_id_ext() const;
561  /* Set the opcode of Snoop Request */
562  void set_opcode(snp_optype_e opcode);
563  snp_optype_e get_opcode() const;
564  /*Forward Node ID is Node ID of the original Requester */
565  void set_fwd_n_id(uint16_t);
566  uint16_t get_fwd_n_id() const;
567  /*Secure and Non-secure transactions are defined to support Secure and
568  Non-secure operating states.*/
569  void set_non_secure(bool = true); // NS bit
570  bool is_non_secure() const; // NS bit
571  /* Do Not Go To SD state controls Snoopee use of SD state.It specifies that
572  the Snoopee must not transition to SD state as a result of the Snoop request.*/
573  void set_do_not_goto_sd(bool = true);
574  bool is_do_not_goto_sd() const;
575  /*Do Not Data Pull. Instructs the Snoopee that it is not permitted to use the
576  Data Pull feature associated with Stash requests*/
577  void set_do_not_data_pull(bool = true);
578  bool is_do_not_data_pull() const;
579  /*Return to Source. Instructs the receiver of the snoop to return Data with
580  the Snoop response.*/
581  void set_ret_to_src(bool);
582  bool is_ret_to_src() const;
583  /*Trace Tag. Provides additional support for the debugging, tracing, and
584  performance measurement of systems*/
585  void set_trace_tag(bool = true);
586  bool is_trace_tag() const;
587 
588 private:
589  uint8_t fwd_txn_id{0}, stash_lp_id{0}, vm_id_ext{0};
590  bool stash_lp_id_valid{false};
591  snp_optype_e opcode;
592  uint16_t fwd_n_id{0};
593  bool ns{false}, do_not_goto_sd{false}, do_not_data_pull{false}, ret_to_src{false}, trace_tag{false};
594 };
595 
601 struct data {
602  /* Data Buffer ID. The ID provided to be used as the TxnID in the response to this message*/
603  void set_db_id(uint8_t);
604  uint8_t get_db_id() const;
605  /* Set the opcode of Data packet */
606  void set_opcode(dat_optype_e opcode);
607  dat_optype_e get_opcode() const;
608  /*Response Error status. Indicates the error status associated with a data transfer*/
609  void set_resp_err(rsp_resperrtype_e);
610  rsp_resperrtype_e get_resp_err() const;
611  /*Response status. Indicates the cache line state associated with a data transfer*/
612  void set_resp(dat_resptype_e);
613  dat_resptype_e get_resp() const;
614  /*Forward State. Indicates the cache line state associated with a data transfer
615  to the Requester from the receiver of the snoop*/
616  void set_fwd_state(uint8_t);
617  uint8_t get_fwd_state() const;
618  /*Data Pull. Indicates the inclusion of an implied Read request in the Data
619  response*/
620  void set_data_pull(uint8_t);
621  uint8_t get_data_pull() const;
622  /* Data Source. The value indicates the source of the data in a read Data
623  response*/
624  void set_data_source(uint8_t);
625  uint8_t get_data_source() const;
626  /* Critical Chunk Identifier. Replicates the address offset of the original
627  transaction reques*/
628  void set_cc_id(uint8_t);
629  uint8_t get_cc_id() const;
630  /*Data Identifier. Provides the address offset of the data provided in the packet*/
631  void set_data_id(uint8_t);
632  uint8_t get_data_id() const;
633  /*Poison. Indicates that a set of data bytes has previously been corrupted*/
634  void set_poison(uint8_t);
635  uint8_t get_poison() const;
636  /*A transaction request includes a TgtID that identifies the target node*/
637  void set_tgt_id(uint16_t);
638  uint16_t get_tgt_id() const;
639  /*Home Node ID. The Node ID of the target of the CompAck response to be
640  sent from the Requester*/
641  void set_home_n_id(uint16_t);
642  uint16_t get_home_n_id() const;
643  /*Reserved for customer use. Any value is valid in a Protocol flit. Propagation of this field through the
644  interconnect is IMPLEMENTATION DEFINED*/
645  void set_rsvdc(uint32_t);
646  uint32_t get_rsvdc() const;
647  /*Data Check. Detects data errors in the DAT packet*/
648  void set_data_check(uint64_t);
649  uint64_t get_data_check() const;
650  /*Trace Tag. Provides additional support for the debugging, tracing, and
651  performance measurement of systems*/
652  void set_trace_tag(bool);
653  bool is_trace_tag() const;
654  /* Indicates the operation to be performed on the tags present in
655  the corresponding DAT channel */
656  void set_tag_op(uint8_t);
657  uint8_t get_tag_op() const;
658  /* Provides up to 8 sets of 4-bit tags, each associated with a 16-byte, aligned address location. */
659  void set_tag(uint64_t);
660  uint64_t get_tag() const;
661  /* Indicates which of the Allocation Tags must be updated*/
662  void set_tu(uint16_t);
663  uint16_t get_tu() const;
664 
665 private:
666  uint8_t db_id{0};
667  rsp_resperrtype_e resp_err{rsp_resperrtype_e::OK};
668  dat_resptype_e resp{dat_resptype_e::CompData_I};
669  uint8_t fwd_state{0}, data_pull{0}, data_source{0}, cc_id{0}, data_id{0}, poison{0};
670  uint16_t tgt_id{0}, home_n_id{0};
671  dat_optype_e opcode{dat_optype_e::DataLCrdReturn};
672  uint32_t rsvdc{0};
673  uint64_t data_check{0};
674  uint64_t tag{0};
675  uint16_t tu{0};
676  uint8_t tag_op{0};
677  bool trace_tag{false};
678 };
679 
684 struct response {
685  /* Data Buffer ID. The ID provided to be used as the TxnID in the response to
686  this message*/
687  void set_db_id(uint8_t);
688  uint8_t get_db_id() const;
689  /*The PCrdType field indicates the credit type associated with the request*/
690  void set_pcrd_type(uint8_t);
691  uint8_t get_pcrd_type() const;
692  /* Set the opcode of response packet */
693  void set_opcode(rsp_optype_e opcode);
694  rsp_optype_e get_opcode() const;
695  /*Response Error status. Indicates the error status associated with request*/
696  void set_resp_err(rsp_resperrtype_e);
697  rsp_resperrtype_e get_resp_err() const;
698  /*Response status. Indicates the response associated with a request*/
699  void set_resp(rsp_resptype_e);
700  rsp_resptype_e get_resp() const;
701  /*Forward State. Indicates the cache line state associated with a data transfer
702  to the Requester from the receiver of the snoop*/
703  void set_fwd_state(uint8_t);
704  uint8_t get_fwd_state() const;
705  /*Data Pull. Indicates the inclusion of an implied Read request in the Data response*/
706  void set_data_pull(bool);
707  bool get_data_pull() const;
708  /*A transaction request includes a TgtID that identifies the target node*/
709  void set_tgt_id(uint16_t);
710  uint16_t get_tgt_id() const;
711  /* Indicates the operation to be performed on the tags present in
712  the corresponding DAT channel */
713  void set_tag_op(uint8_t);
714  uint8_t get_tag_op() const;
715  /* Precise contents are IMPLEMENTATION DEFINED. Typically
716  expected to contain Exception Level, TTBR value, and CPU identifier */
717  void set_tag_group_id(uint32_t);
718  uint32_t get_tag_group_id() const;
719  /*Trace Tag. Provides additional support for the debugging, tracing, and performance measurement of systems*/
720  void set_trace_tag(bool);
721  bool is_trace_tag() const;
722 
723 private:
724  uint8_t db_id{0}, pcrd_type{0}, fwd_state{0};
725  rsp_resperrtype_e resp_err{rsp_resperrtype_e::OK};
726  bool data_pull{false};
727  rsp_optype_e opcode{rsp_optype_e::INVALID};
728  rsp_resptype_e resp{rsp_resptype_e::SnpResp_I};
729  uint32_t tag_group_id{0};
730  uint16_t tgt_id{0};
731  uint8_t tag_op{0};
732  bool trace_tag{false};
733 };
734 
735 struct credit {
736  credit() = default;
737  credit(short unsigned count, chi::credit_type_e type)
738  : count(count)
739  , type(type) {}
740  unsigned short count{1};
741  credit_type_e type{credit_type_e::LINK};
742 };
743 
744 struct chi_ctrl_extension : public tlm::tlm_extension<chi_ctrl_extension> {
748  chi_ctrl_extension() = default;
758  tlm::tlm_extension_base* clone() const { return new chi_ctrl_extension(*this); }
763  void copy_from(tlm::tlm_extension_base const& ext) {
764  *this = static_cast<const chi_ctrl_extension&>(ext);
765  } // use assignment operator
766 
767  void set_txn_id(unsigned int id) { cmn.set_txn_id(id); }
768 
769  unsigned int get_txn_id() const { return cmn.get_txn_id(); }
770 
771  void set_src_id(unsigned int id) { cmn.set_src_id(id); }
772 
773  unsigned int get_src_id() const { return cmn.get_src_id(); }
774 
775  void set_qos(uint8_t qos) { cmn.set_qos(qos); }
776 
777  unsigned int get_qos() const { return cmn.get_qos(); }
778 
779  common cmn;
780  request req;
781  response resp;
782 };
783 
784 struct chi_snp_extension : public tlm::tlm_extension<chi_snp_extension> {
788  chi_snp_extension() = default;
798  tlm::tlm_extension_base* clone() const { return new chi_snp_extension(*this); };
803  void copy_from(tlm::tlm_extension_base const& ext) { *this = static_cast<const chi_snp_extension&>(ext); }
804 
805  void set_txn_id(unsigned int id) { cmn.set_txn_id(id); }
806 
807  unsigned int get_txn_id() const { return cmn.get_txn_id(); }
808 
809  void set_src_id(unsigned int id) { cmn.set_src_id(id); }
810 
811  unsigned int get_src_id() const { return cmn.get_src_id(); }
812 
813  void set_qos(uint8_t qos) { cmn.set_qos(qos); }
814 
815  unsigned int get_qos() const { return cmn.get_qos(); }
816 
817  common cmn;
818  snp_request req;
819  response resp;
820 };
821 
822 struct chi_data_extension : public tlm::tlm_extension<chi_data_extension> {
826  chi_data_extension() = default;
836  tlm::tlm_extension_base* clone() const { return new chi_data_extension(*this); }
841  void copy_from(tlm::tlm_extension_base const& ext) {
842  *this = static_cast<const chi_data_extension&>(ext);
843  } // use assignment operator
844 
845  void set_txn_id(unsigned int id) { cmn.set_txn_id(id); }
846 
847  unsigned int get_txn_id() const { return cmn.get_txn_id(); }
848 
849  void set_src_id(unsigned int id) { cmn.set_src_id(id); }
850 
851  unsigned int get_src_id() const { return cmn.get_src_id(); }
852 
853  void set_qos(uint8_t qos) { cmn.set_qos(qos); }
854 
855  unsigned int get_qos() const { return cmn.get_qos(); }
856 
857  common cmn{};
858  data dat{};
859 };
860 
861 struct chi_credit_extension : public tlm::tlm_extension<chi_credit_extension>, public credit {
865  chi_credit_extension() = default;
866 
867  chi_credit_extension(credit_type_e type, unsigned short count = 1)
868  : credit(count, type) {}
878  tlm::tlm_extension_base* clone() const { return new chi_credit_extension(*this); };
883  void copy_from(tlm::tlm_extension_base const& ext) {
884  *this = static_cast<const chi_credit_extension&>(ext);
885  } // use assignment operator
886 };
887 
889 using chi_payload = tlm::tlm_generic_payload;
890 using chi_phase = tlm::tlm_phase;
896  typedef chi_payload tlm_payload_type;
897  typedef chi_phase tlm_phase_type;
898 };
899 
903 DECLARE_EXTENDED_PHASE(BEGIN_PARTIAL_DATA);
904 DECLARE_EXTENDED_PHASE(END_PARTIAL_DATA);
905 DECLARE_EXTENDED_PHASE(BEGIN_DATA);
906 DECLARE_EXTENDED_PHASE(END_DATA);
908 
910 template <typename TYPES = chi::chi_protocol_types> using chi_fw_transport_if = tlm::tlm_fw_transport_if<TYPES>;
912 // template <typename TYPES = chi::chi_protocol_types> using chi_bw_transport_if = tlm::tlm_bw_transport_if<TYPES>;
913 
917 template <typename TRANS = tlm::tlm_generic_payload>
918 class bw_blocking_transport_if : public virtual sc_core::sc_interface {
919 public:
925  virtual void b_snoop(TRANS& trans, sc_core::sc_time& t) = 0;
926 };
927 
931 template <typename TYPES = chi::chi_protocol_types>
932 class chi_bw_transport_if : public tlm::tlm_bw_transport_if<TYPES>,
934 
939 template <unsigned int BUSWIDTH = 32, typename TYPES = chi_protocol_types, int N = 1,
940  sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND>
942  : public tlm::tlm_base_initiator_socket<BUSWIDTH, chi_fw_transport_if<TYPES>, chi_bw_transport_if<TYPES>, N, POL> {
944  using base_type =
945  tlm::tlm_base_initiator_socket<BUSWIDTH, chi_fw_transport_if<TYPES>, chi_bw_transport_if<TYPES>, N, POL>;
950  : base_type() {}
955  explicit chi_initiator_socket(const char* name)
956  : base_type(name) {}
961  const char* kind() const override { return "chi_trx_initiator_socket"; }
962 #if SYSTEMC_VERSION >= 20181013 // not the right version but we assume TLM is always bundled with SystemC
967  sc_core::sc_type_index get_protocol_types() const override { return typeid(TYPES); }
968 #endif
969 };
970 
975 template <unsigned int BUSWIDTH = 32, typename TYPES = chi_protocol_types, int N = 1,
976  sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND>
978  : public tlm::tlm_base_target_socket<BUSWIDTH, chi_fw_transport_if<TYPES>, chi_bw_transport_if<TYPES>, N, POL> {
980  using base_type =
981  tlm::tlm_base_target_socket<BUSWIDTH, chi_fw_transport_if<TYPES>, chi_bw_transport_if<TYPES>, N, POL>;
986  : base_type() {}
991  explicit chi_target_socket(const char* name)
992  : base_type(name) {}
997  const char* kind() const override { return "chi_trx_target_socket"; }
998 #if SYSTEMC_VERSION >= 20181013
1003  sc_core::sc_type_index get_protocol_types() const override { return typeid(TYPES); }
1004 #endif
1005 };
1006 /*****************************************************************************
1007  * free function easing handling of transactions and extensions
1008  *****************************************************************************/
1009 
1010 template <typename EXT> inline bool is_valid(EXT& ext) { return is_valid(&ext); }
1011 
1012 template <typename EXT> bool is_valid(EXT* ext);
1013 
1014 inline bool is_dataless(const chi::chi_ctrl_extension* req_e) {
1015  switch(req_e->req.get_opcode()) {
1016  case chi::req_optype_e::CleanUnique:
1017  case chi::req_optype_e::MakeUnique:
1018  case chi::req_optype_e::Evict :
1019  case chi::req_optype_e::StashOnceUnique:
1020  case chi::req_optype_e::StashOnceSepUnique:
1021  case chi::req_optype_e::StashOnceShared:
1022  case chi::req_optype_e::StashOnceSepShared:
1023  case chi::req_optype_e::CleanShared:
1024  case chi::req_optype_e::CleanSharedPersist:
1025  case chi::req_optype_e::CleanSharedPersistSep:
1026  case chi::req_optype_e::CleanInvalid:
1027  case chi::req_optype_e::MakeInvalid:
1028  case chi::req_optype_e::WriteNoSnpZero:
1029  case chi::req_optype_e::WriteUniqueZero:
1030  return true;
1031  case chi::req_optype_e::MakeReadUnique:
1032  switch(req_e->resp.get_opcode()) {
1033  case chi::rsp_optype_e::Comp: // Response to dataless MakeReadUnique request (4.5.1 Completion response of IHI0050E
1034  case chi::rsp_optype_e::CompPersist:
1035  case chi::rsp_optype_e::CompCMO:
1036  case chi::rsp_optype_e::CompStashDone:
1037  return true;
1038  }
1039  }
1040  return false;
1041 }
1042 
1043 inline bool is_atomic(const chi::chi_ctrl_extension* req_e) {
1044  return req_e->req.get_opcode()>=chi::req_optype_e::AtomicStoreAdd && req_e->req.get_opcode()<=chi::req_optype_e::AtomicCompare;
1045 }
1046 
1047 inline bool is_request_order(const chi::chi_ctrl_extension* req_e) {
1048  if(req_e->req.get_order()==2) {
1049  switch(req_e->req.get_opcode()) {
1050  case chi::req_optype_e::ReadNoSnp:
1051  case chi::req_optype_e::ReadNoSnpSep:
1052  case chi::req_optype_e::ReadOnce :
1053  case chi::req_optype_e::ReadOnceCleanInvalid:
1054  case chi::req_optype_e::ReadOnceMakeInvalid:
1055  case chi::req_optype_e::WriteNoSnpFull:
1056  case chi::req_optype_e::WriteNoSnpFullCleanInv:
1057  case chi::req_optype_e::WriteNoSnpFullCleanSh:
1058  case chi::req_optype_e::WriteNoSnpFullCleanShPerSep:
1059  case chi::req_optype_e::WriteNoSnpPtl:
1060  case chi::req_optype_e::WriteNoSnpPtlCleanInv:
1061  case chi::req_optype_e::WriteNoSnpPtlCleanSh:
1062  case chi::req_optype_e::WriteNoSnpPtlCleanShPerSep:
1063  case chi::req_optype_e::WriteUniqueFull:
1064  case chi::req_optype_e::WriteUniqueFullCleanSh:
1065  case chi::req_optype_e::WriteUniqueFullCleanShPerSep:
1066  case chi::req_optype_e::WriteUniqueFullStash:
1067  case chi::req_optype_e::WriteUniquePtl:
1068  case chi::req_optype_e::WriteUniquePtlCleanSh:
1069  case chi::req_optype_e::WriteUniquePtlCleanShPerSep:
1070  case chi::req_optype_e::WriteUniquePtlStash:
1071  case chi::req_optype_e::WriteUniqueZero:
1072  return true;
1073  }
1074  return is_atomic(req_e);
1075  } else
1076  return false;
1077 }
1078 /*****************************************************************************
1079  * Implementation details
1080  *****************************************************************************/
1081 template <> struct enable_for_enum<req_optype_e> { static const bool enable = true; };
1082 template <> struct enable_for_enum<snp_optype_e> { static const bool enable = true; };
1083 template <> struct enable_for_enum<dat_optype_e> { static const bool enable = true; };
1084 template <> struct enable_for_enum<dat_resptype_e> { static const bool enable = true; };
1085 template <> struct enable_for_enum<rsp_optype_e> { static const bool enable = true; };
1086 template <> struct enable_for_enum<rsp_resptype_e> { static const bool enable = true; };
1087 template <> struct enable_for_enum<rsp_resperrtype_e> { static const bool enable = true; };
1088 
1089 template <> inline req_optype_e into<req_optype_e>(typename std::underlying_type<req_optype_e>::type t) {
1090  assert(t <= static_cast<std::underlying_type<req_optype_e>::type>(req_optype_e::ILLEGAL));
1091  return static_cast<req_optype_e>(t);
1092 }
1093 
1094 template <> inline snp_optype_e into<snp_optype_e>(typename std::underlying_type<snp_optype_e>::type t) {
1095  assert(t <= static_cast<std::underlying_type<snp_optype_e>::type>(snp_optype_e::ILLEGAL));
1096  return static_cast<snp_optype_e>(t);
1097 }
1098 
1099 template <> inline dat_optype_e into<dat_optype_e>(typename std::underlying_type<dat_optype_e>::type t) {
1100  assert(t <= static_cast<std::underlying_type<dat_optype_e>::type>(dat_optype_e::NCBWrDataCompAck));
1101  return static_cast<dat_optype_e>(t);
1102 }
1103 
1104 template <> inline dat_resptype_e into<dat_resptype_e>(typename std::underlying_type<dat_resptype_e>::type t) {
1105  assert(t <= static_cast<std::underlying_type<dat_resptype_e>::type>(dat_resptype_e::CopyBackWrData_SD_PD));
1106  return static_cast<dat_resptype_e>(t);
1107 }
1108 
1109 template <> inline rsp_optype_e into<rsp_optype_e>(typename std::underlying_type<rsp_optype_e>::type t) {
1110  assert(t >= static_cast<typename std::underlying_type<rsp_optype_e>::type>(rsp_optype_e::RespLCrdReturn) &&
1111  t < static_cast<std::underlying_type<rsp_optype_e>::type>(rsp_optype_e::INVALID));
1112  return static_cast<rsp_optype_e>(t);
1113 }
1114 
1115 template <> inline rsp_resptype_e into<rsp_resptype_e>(typename std::underlying_type<rsp_resptype_e>::type t) {
1116  assert(t <= static_cast<std::underlying_type<rsp_resptype_e>::type>(rsp_resptype_e::SnpResp_SD));
1117  return static_cast<rsp_resptype_e>(t);
1118 }
1119 
1120 template <> inline rsp_resperrtype_e into<rsp_resperrtype_e>(typename std::underlying_type<rsp_resperrtype_e>::type t) {
1121  assert(t <= static_cast<std::underlying_type<rsp_resperrtype_e>::type>(rsp_resperrtype_e::NDERR));
1122  return static_cast<rsp_resperrtype_e>(t);
1123 }
1124 
1125 // [1] Implementation of 'request' structure member functions
1126 
1129 // A transaction request includes a TxnID that is used to identify the transaction from a given Requester
1130 inline void common::set_txn_id(unsigned int txn_id) {
1131  sc_assert(txn_id <= 1024); // TxnID field is defined to accommodate up to 1024 outstanding transactions.
1132  this->txn_id = txn_id;
1133 }
1134 
1137 inline unsigned int common::get_txn_id() const { return txn_id; }
1138 
1141 inline void common::set_src_id(unsigned int src_id) { this->src_id = src_id; }
1142 
1145 inline unsigned int common::get_src_id() const { return src_id; }
1146 
1149 inline void common::set_qos(uint8_t qos) { this->qos = qos; }
1150 
1153 inline unsigned int common::get_qos() const { return qos; }
1154 
1155 // [1] End of Implementation of 'common'
1156 
1157 // [2] Implementation of 'request' structure member functions
1158 
1159 // A transaction request includes a TgtID that identifies the target node
1160 inline void request::set_tgt_id(uint8_t id) { tgt_id = id; }
1161 inline uint8_t request::get_tgt_id() const { return tgt_id; }
1162 
1163 /*Logical Processor ID. Used in conjunction with the SrcID field to uniquely
1164 identify the logical processor that generated the request. */
1165 inline void request::set_lp_id(uint8_t id) { lp_id = id; }
1166 inline uint8_t request::get_lp_id() const { return lp_id; }
1167 
1168 /*Return Transaction ID. The unique transaction ID that conveys the value of
1169 TxnID in the data response from the Slave*/
1170 inline void request::set_return_txn_id(uint8_t id) { return_txn_id = id; }
1171 inline uint8_t request::get_return_txn_id() const { return return_txn_id; }
1172 
1173 // Stash Logical Processor ID. The ID of the logical processor at the Stash target.
1174 inline void request::set_stash_lp_id(uint8_t id) { stash_lp_id = id; }
1175 inline uint8_t request::get_stash_lp_id() const { return stash_lp_id; }
1176 
1177 /*Data size. Specifies the size of the data associated with the transaction. This
1178  determines the number of data packets within the transaction */
1179 inline void request::set_size(uint8_t sz) {
1180  assert(sz <= 8);
1181  size = sz;
1182 }
1183 inline uint8_t request::get_size() const { return size; }
1184 
1185 /*Max number of flits in current transaction. The number determined based on data length and bus width*/
1186 inline void request::set_max_flit(uint8_t data_id) { max_flit = data_id; }
1187 inline uint8_t request::get_max_flit() const { return max_flit; }
1188 
1189 /* Memory attribute. Determines the memory attributes associated with the
1190 transaction. */
1191 inline void request::set_mem_attr(uint8_t mem_attr) {
1192  assert(mem_attr < 16);
1193  this->mem_attr = mem_attr;
1194 }
1195 inline uint8_t request::get_mem_attr() const { return mem_attr; }
1196 
1197 inline void request:: set_device(bool is_device) {if(is_device) this->mem_attr |= 2 ; else this->mem_attr &= ~2U;}
1198 inline bool request::is_device() const { return this->mem_attr & 2; }
1199 inline void request:: set_ewa(bool is_device) {if(is_device) this->mem_attr |= 1 ; else this->mem_attr &= ~1U;}
1200 inline bool request::is_ewa() const { return this->mem_attr & 1; }
1201 inline void request:: set_allocate(bool is_device) {if(is_device) this->mem_attr |= 8 ; else this->mem_attr &= ~8U;}
1202 inline bool request::is_allocate() const { return this->mem_attr & 8; }
1203 inline void request:: set_cacheable(bool is_device) {if(is_device) this->mem_attr |= 4 ; else this->mem_attr &= ~4U;}
1204 inline bool request::is_cacheable() const { return this->mem_attr & 4; }
1205 
1206 /* Protocol Credit Type. Indicates the type of Protocol Credit being used by a
1207  request that has the AllowRetry field deasserted */
1208 inline void request::set_pcrd_type(uint8_t pcrd_type) { this->pcrd_type = pcrd_type; }
1209 inline uint8_t request::get_pcrd_type() const { return pcrd_type; }
1210 
1211 // Endianness. Indicates the endianness of Data in the Data packet.
1212 inline void request::set_endian(bool endian) { this->endian = endian; }
1213 inline bool request::is_endian() const { return this->endian; }
1214 
1215 /*Order requirement. Determines the ordering requirement for this request with
1216  respect to other transactions from the same agent.*/
1217 inline void request::set_order(uint8_t order) { this->order = order; }
1218 inline uint8_t request::get_order() const { return this->order; }
1219 
1220 /*Trace Tag. Provides additional support for the debugging, tracing, and
1221  performance measurement of systems. */
1222 inline void request::set_trace_tag(bool trace_tag) { this->trace_tag = trace_tag; }
1223 inline bool request::is_trace_tag() const { return trace_tag; }
1224 
1225 inline void request::set_opcode(req_optype_e opcode) { this->opcode = opcode; }
1226 inline req_optype_e request::get_opcode() const { return opcode; }
1227 
1228 // Return Node ID. The node ID that the response with Data is to be sent to.
1229 inline void request::set_return_n_id(uint16_t return_n_id) { this->return_n_id = return_n_id; }
1230 inline uint16_t request::get_return_n_id() const { return return_n_id; }
1231 
1232 // Stash Node ID is the node ID of the Stash target.
1233 inline void request::set_stash_n_id(uint16_t stash_n_id) { this->stash_n_id = stash_n_id; }
1234 inline uint16_t request::get_stash_n_id() const { return stash_n_id; }
1235 
1236 /* Stash Node ID Valid. Indicates that the StashNID field has a valid Stash target
1237 value. */
1238 inline void request::set_stash_n_id_valid(bool stash_n_id_valid) { this->stash_n_id_valid = stash_n_id_valid; }
1239 inline bool request::is_stash_n_id_valid() const { return stash_n_id_valid; }
1240 
1241 /*Stash Logical Processor ID. The ID of the logical processor at the Stash target.*/
1242 inline void request::set_stash_lp_id_valid(bool stash_lp_id_valid) { this->stash_lp_id_valid = stash_lp_id_valid; }
1243 inline bool request::is_stash_lp_id_valid() const { return stash_lp_id_valid; }
1244 
1245 /*Secure and Non-secure transactions are defined to support Secure and
1246 Non-secure operating states.*/
1247 inline void request::set_non_secure(bool ns) { this->ns = ns; }
1248 inline bool request::is_non_secure() const { return ns; }
1249 
1250 /* Expect CompAck. Indicates that the transaction will include a Completion
1251  Acknowledge message*/
1252 inline void request::set_exp_comp_ack(bool exp_comp_ack) { this->exp_comp_ack = exp_comp_ack; }
1253 inline bool request::is_exp_comp_ack() const { return exp_comp_ack; }
1254 
1255 /* Allow Retry determines if the target is permitted to give a Retry response.*/
1256 inline void request::set_allow_retry(bool allow_retry) { this->allow_retry = allow_retry; }
1257 inline bool request::is_allow_retry() const { return allow_retry; }
1258 
1259 /* Snoop attribute specifies the snoop attributes associated with the transaction.*/
1260 inline void request::set_snp_attr(bool snp_attr) { this->snp_attr = snp_attr; }
1261 inline bool request::is_snp_attr() const { return snp_attr; }
1262 
1263 /*Exclusive access. Indicates that the corresponding transaction is an Exclusive
1264  access transaction.*/
1265 inline void request::set_excl(bool excl) { this->excl = excl; }
1266 inline bool request::is_excl() const { return this->excl; }
1267 
1268 /* Snoop Me. Indicates that Home must determine whether to send a snoop to the
1269 Requester.*/
1270 inline void request::set_snoop_me(bool snoop_me) { this->snoop_me = snoop_me; }
1271 inline bool request::is_snoop_me() const { return snoop_me; }
1272 
1273 /*The LikelyShared attribute is a cache allocation hint. When asserted this attribute indicates
1274 that the requested data is likely to be shared by other Request Nodes within the system */
1275 inline void request::set_likely_shared(bool likely_shared) { this->likely_shared = likely_shared; }
1276 inline bool request::is_likely_shared() const { return likely_shared; }
1277 
1278 /* Reserved for customer use. Any value is valid in a Protocol flit. Propagation of this field through the interconnect
1279  is IMPLEMENTATION DEFINED.*/
1280 inline void request::set_rsvdc(uint32_t rsvdc) { this->rsvdc = rsvdc; }
1281 inline uint32_t request::get_rsvdc() const { return rsvdc; }
1282 
1283 inline void request::set_tag_op(uint8_t tag_op){ this->tag_op = tag_op; }
1284 inline uint8_t request::get_tag_op() const { return tag_op; }
1285 inline void request::set_tag_group_id(uint32_t tag_group_id){ this->tag_group_id = tag_group_id; }
1286 inline uint32_t request::get_tag_group_id() const { return tag_group_id; }
1287 inline void request::set_mpam(uint16_t mpam){ this->mpam = mpam; }
1288 inline uint16_t request::get_mpam() const { return mpam; }
1289 
1290 //===== End of [2] request
1291 
1292 //==== [3] Starting of snp_request
1293 
1294 inline void snp_request::set_fwd_txn_id(uint8_t fwd_txn_id) { this->fwd_txn_id = fwd_txn_id; }
1295 inline uint8_t snp_request::get_fwd_txn_id() const { return fwd_txn_id; }
1296 
1297 /*Stash Logical Processor ID. The ID of the logical processor at the Stash target.*/
1298 inline void snp_request::set_stash_lp_id(uint8_t stash_lp_id) { this->stash_lp_id = stash_lp_id; }
1299 inline uint8_t snp_request::get_stash_lp_id() const { return stash_lp_id; }
1300 
1301 /* Stash Node ID Valid. Indicates that the StashNID field has a valid Stash target value. */
1302 inline void snp_request::set_stash_lp_id_valid(bool stash_lp_id_valid) { this->stash_lp_id_valid = stash_lp_id_valid; }
1303 inline bool snp_request::is_stash_lp_id_valid() const { return stash_lp_id_valid; }
1304 
1305 /* Virtual Machine ID Extension use in DVM Operation types*/
1306 inline void snp_request::set_vm_id_ext(uint8_t vm_id_ext) { this->vm_id_ext = vm_id_ext; }
1307 inline uint8_t snp_request::get_vm_id_ext() const { return vm_id_ext; }
1308 
1309 /*Forward Node ID is Node ID of the original Requester */
1310 inline void snp_request::set_fwd_n_id(uint16_t fwd_n_id) { this->fwd_n_id = fwd_n_id; }
1311 inline uint16_t snp_request::get_fwd_n_id() const { return fwd_n_id; }
1312 
1313 inline void snp_request::set_opcode(snp_optype_e opcode) {
1314  // Check opcode validity
1315  this->opcode = opcode;
1316 }
1317 inline snp_optype_e snp_request::get_opcode() const { return opcode; }
1318 
1319 /*Secure and Non-secure transactions are defined to support Secure and
1320 Non-secure operating states.*/
1321 inline void snp_request::set_non_secure(bool non_secure) // NS bit
1322 {
1323  this->ns = non_secure;
1324 }
1325 inline bool snp_request::is_non_secure() const // NS bit
1326 {
1327  return ns;
1328 }
1329 
1330 /* Do Not Go To SD state controls Snoopee use of SD state.It specifies that
1331 the Snoopee must not transition to SD state as a result of the Snoop request.*/
1332 inline void snp_request::set_do_not_goto_sd(bool do_not_goto_sd) { this->do_not_goto_sd = do_not_goto_sd; }
1333 inline bool snp_request::is_do_not_goto_sd() const { return do_not_goto_sd; }
1334 
1335 /*Do Not Data Pull. Instructs the Snoopee that it is not permitted to use the
1336 Data Pull feature associated with Stash requests*/
1337 inline void snp_request::set_do_not_data_pull(bool do_not_data_pull) { this->do_not_data_pull = do_not_data_pull; }
1338 inline bool snp_request::is_do_not_data_pull() const { return do_not_data_pull; }
1339 
1340 /*Return to Source. Instructs the receiver of the snoop to return Data with
1341 the Snoop response.*/
1342 inline void snp_request::set_ret_to_src(bool ret_to_src) { this->ret_to_src = ret_to_src; }
1343 inline bool snp_request::is_ret_to_src() const { return ret_to_src; }
1344 
1345 /*Trace Tag. Provides additional support for the debugging, tracing, and
1346 performance measurement of systems*/
1347 inline void snp_request::set_trace_tag(bool trace_tag) { this->trace_tag = trace_tag; }
1348 inline bool snp_request::is_trace_tag() const { return trace_tag; }
1349 
1350 //===== End of [3] snp_request
1351 
1352 //==== [4] Starting of structure 'data' member functions
1353 
1354 /* Data Buffer ID. The ID provided to be used as the TxnID in the response to
1355 this message*/
1356 inline void data::set_db_id(uint8_t db_id) { this->db_id = db_id; }
1357 inline uint8_t data::get_db_id() const { return db_id; }
1358 
1359 /*Response Error status. Indicates the error status associated with a data
1360  transfer*/
1361 inline void data::set_resp_err(rsp_resperrtype_e resp_err) { this->resp_err = resp_err; }
1362 inline rsp_resperrtype_e data::get_resp_err() const { return resp_err; }
1363 
1364 /*Response status. Indicates the cache line state associated with a data transfer*/
1365 inline void data::set_resp(dat_resptype_e resp) { this->resp = resp; }
1366 inline dat_resptype_e data::get_resp() const { return resp; }
1367 /*Forward State. Indicates the cache line state associated with a data transfer
1368  to the Requester from the receiver of the snoop*/
1369 inline void data::set_fwd_state(uint8_t fwd_state) { this->fwd_state = fwd_state; }
1370 inline uint8_t data::get_fwd_state() const { return fwd_state; }
1371 
1372 /*Data Pull. Indicates the inclusion of an implied Read request in the Data
1373  response*/
1374 inline void data::set_data_pull(uint8_t data_pull) { this->data_pull = data_pull; }
1375 inline uint8_t data::get_data_pull() const { return data_pull; }
1376 /* Data Source. The value indicates the source of the data in a read Data
1377  response*/
1378 inline void chi::data::set_data_source(uint8_t data_source) { this->data_source = data_source; }
1379 inline uint8_t data::get_data_source() const { return data_source; }
1380 
1381 /* Critical Chunk Identifier. Replicates the address offset of the original
1382  transaction reques*/
1383 inline void data::set_cc_id(uint8_t cc_id) { this->cc_id = cc_id; }
1384 inline uint8_t data::get_cc_id() const { return cc_id; }
1385 /*Data Identifier. Provides the address offset of the data provided in the packet*/
1386 
1387 inline void data::set_data_id(uint8_t data_id) { this->data_id = data_id; }
1388 inline uint8_t data::get_data_id() const { return data_id; }
1389 
1390 /*Poison. Indicates that a set of data bytes has previously been corrupted*/
1391 inline void data::set_poison(uint8_t poison) { this->poison = poison; }
1392 inline uint8_t data::get_poison() const { return poison; }
1393 
1394 /*A transaction request includes a TgtID that identifies the target node*/
1395 inline void data::set_tgt_id(uint16_t tgt_id) { this->tgt_id = tgt_id; }
1396 inline uint16_t data::get_tgt_id() const { return tgt_id; }
1397 
1398 /*Home Node ID. The Node ID of the target of the CompAck response to be
1399  sent from the Requester*/
1400 inline void data::set_home_n_id(uint16_t home_n_id) { this->home_n_id = home_n_id; }
1401 inline uint16_t data::get_home_n_id() const { return home_n_id; }
1402 
1403 /*Reserved for customer use. Any value is valid in a Protocol flit. Propagation of this field through the interconnect
1404  is IMPLEMENTATION DEFINED*/
1405 inline void data::set_rsvdc(uint32_t rsvdc) { this->rsvdc = rsvdc; }
1406 inline uint32_t data::get_rsvdc() const { return rsvdc; }
1407 
1408 /*Data Check. Detects data errors in the DAT packet*/
1409 inline void data::set_data_check(uint64_t data_check) { this->data_check = data_check; }
1410 inline uint64_t data::get_data_check() const { return data_check; }
1411 
1412 inline void data::set_opcode(dat_optype_e opcode) { this->opcode = opcode; }
1413 inline dat_optype_e data::get_opcode() const { return opcode; }
1414 
1415 /*Trace Tag. Provides additional support for the debugging, tracing, and
1416  performance measurement of systems*/
1417 inline void data::set_trace_tag(bool trace_tag) { this->trace_tag = trace_tag; }
1418 inline bool data::is_trace_tag() const { return trace_tag; }
1419 
1420 inline void data::set_tag_op(uint8_t tag_op) { this->tag_op = tag_op; }
1421 inline uint8_t data::get_tag_op() const { return tag_op; }
1422 inline void data::set_tag(uint64_t tag) { this->tag = tag; }
1423 inline uint64_t data::get_tag() const { return tag; }
1424 inline void data::set_tu(uint16_t tu) { this->tu = tu; }
1425 inline uint16_t data::get_tu() const { return tu; }
1426 
1427 //===== End of [4] data
1428 
1429 //==== [5] Starting of structure 'response' member functions
1430 
1431 /* Data Buffer ID. The ID provided to be used as the TxnID in the response to
1432  this message*/
1433 inline void response::set_db_id(uint8_t db_id) { this->db_id = db_id; }
1434 inline uint8_t response::get_db_id() const { return db_id; }
1435 
1436 /*The PCrdType field indicates the credit type associated with the request*/
1437 inline void response::set_pcrd_type(uint8_t pcrd_type) { this->pcrd_type = pcrd_type; }
1438 inline uint8_t response::get_pcrd_type() const { return pcrd_type; }
1439 
1440 /*Response Error status. Indicates the error status associated with a data
1441 transfer*/
1442 inline void response::set_resp_err(rsp_resperrtype_e resp_err) { this->resp_err = resp_err; }
1443 inline rsp_resperrtype_e response::get_resp_err() const { return resp_err; }
1444 
1445 /*Response status. Indicates the cache line state associated with a data transfer*/
1446 inline void response::set_resp(rsp_resptype_e resp) { this->resp = resp; }
1447 inline rsp_resptype_e response::get_resp() const { return resp; }
1448 /*Forward State. Indicates the cache line state associated with a data transfer
1449 to the Requester from the receiver of the snoop*/
1450 inline void response::set_fwd_state(uint8_t fwd_state) { this->fwd_state = fwd_state; }
1451 inline uint8_t response::get_fwd_state() const { return fwd_state; }
1452 
1453 /*Data Pull. Indicates the inclusion of an implied Read request in the Data
1454 response*/
1455 inline void response::set_data_pull(bool data_pull) { this->data_pull = data_pull; }
1456 inline bool response::get_data_pull() const { return data_pull; }
1457 
1458 /*A transaction request includes a TgtID that identifies the target node*/
1459 inline void response::set_tgt_id(uint16_t tgt_id) { this->tgt_id = tgt_id; }
1460 inline uint16_t response::get_tgt_id() const { return tgt_id; }
1461 inline void response::set_opcode(rsp_optype_e opcode) { this->opcode = opcode; }
1462 inline rsp_optype_e response::get_opcode() const { return opcode; }
1463 
1464 inline void response::set_tag_op(uint8_t tag_op) { this->tag_op = tag_op; }
1465 inline uint8_t response::get_tag_op() const{ return tag_op; }
1466 inline void response::set_tag_group_id(uint32_t tag_group_id) { this->tag_group_id = tag_group_id; }
1467 inline uint32_t response::get_tag_group_id() const{ return tag_group_id; }
1468 /*Trace Tag. Provides additional support for the debugging, tracing, and
1469 performance measurement of systems*/
1470 inline void response::set_trace_tag(bool trace_tag) { this->trace_tag = trace_tag; }
1471 inline bool response::is_trace_tag() const { return trace_tag; }
1472 
1473 //===== End of [5] response
1474 
1475 } // end of namespace chi
virtual void b_snoop(TRANS &trans, sc_core::sc_time &t)=0
snoop access to a snooped master
TLM2.0 components modeling CHI.
Definition: chi_tlm.cpp:21
constexpr ULT to_int(E t)
Definition: chi_tlm.h:44
DECLARE_EXTENDED_PHASE(BEGIN_PARTIAL_DATA)
E into(typename std::underlying_type< E >::type t)
tlm::tlm_fw_transport_if< TYPES > chi_fw_transport_if
alias declaration for the forward interface
Definition: chi_tlm.h:910
tlm::tlm_generic_payload chi_payload
aliases for payload and phase types
Definition: chi_tlm.h:889
const char * to_char(E t)
std::ostream & operator<<(std::ostream &os, E e)
Definition: chi_tlm.h:60
void copy_from(tlm::tlm_extension_base const &ext)
deep copy all values from ext
Definition: chi_tlm.h:883
chi_credit_extension()=default
the default constructor
tlm::tlm_extension_base * clone() const
the copy constructor
Definition: chi_tlm.h:878
chi_ctrl_extension()=default
the default constructor
chi_ctrl_extension(const chi_ctrl_extension &o)=default
the copy constructor
tlm::tlm_extension_base * clone() const
the clone function to create deep copies of
Definition: chi_tlm.h:758
void copy_from(tlm::tlm_extension_base const &ext)
deep copy all values from ext
Definition: chi_tlm.h:763
void copy_from(tlm::tlm_extension_base const &ext)
deep copy all values from ext
Definition: chi_tlm.h:841
tlm::tlm_extension_base * clone() const
the copy constructor
Definition: chi_tlm.h:836
chi_data_extension()=default
the default constructor
chi_initiator_socket()
default constructor using a generated instance name
Definition: chi_tlm.h:949
tlm::tlm_base_initiator_socket< BUSWIDTH, chi_fw_transport_if< TYPES >, chi_bw_transport_if< TYPES >, N, POL > base_type
base type alias
Definition: chi_tlm.h:945
chi_initiator_socket(const char *name)
constructor with instance name
Definition: chi_tlm.h:955
const char * kind() const override
get the kind of this sc_object
Definition: chi_tlm.h:961
The AXI protocol traits class. Since the protocoll defines additional non-ignorable phases a dedicate...
Definition: chi_tlm.h:895
void copy_from(tlm::tlm_extension_base const &ext)
deep copy all values from ext
Definition: chi_tlm.h:803
chi_snp_extension()=default
the default constructor
tlm::tlm_extension_base * clone() const
the copy constructor
Definition: chi_tlm.h:798
const char * kind() const override
get the kind of this sc_object
Definition: chi_tlm.h:997
chi_target_socket()
default constructor using a generated instance name
Definition: chi_tlm.h:985
tlm::tlm_base_target_socket< BUSWIDTH, chi_fw_transport_if< TYPES >, chi_bw_transport_if< TYPES >, N, POL > base_type
base type alias
Definition: chi_tlm.h:981
chi_target_socket(const char *name)
constructor with instance name
Definition: chi_tlm.h:991
void set_src_id(unsigned int)
Definition: chi_tlm.h:1141
unsigned int get_src_id() const
Definition: chi_tlm.h:1145
common & operator=(const common &o)
reset all data member to their default
Definition: chi_tlm.h:375
common()=default
the constructori
void set_txn_id(unsigned int)
Definition: chi_tlm.h:1130
void set_qos(uint8_t qos)
Definition: chi_tlm.h:1149
unsigned int get_qos() const
Definition: chi_tlm.h:1153
unsigned int get_txn_id() const
Definition: chi_tlm.h:1137