23std::array<std::string, 3> cmd_str{
"R",
"W",
"I"};
25std::array<char const*, 103> opc2str = {
45 "CleanSharedPersistSep",
58 "WriteUniqueFullStash",
59 "WriteUniquePtlStash",
62 "ReadOnceCleanInvalid",
63 "ReadOnceMakeInvalid",
106 "WriteNoSnpFullCleanSh",
107 "WriteNoSnpFullCleanInv",
108 "WriteNoSnpFullCleanShPerSep",
110 "WriteUniqueFullCleanSh",
112 "WriteUniqueFullCleanShPerSep",
114 "WriteBackFullCleanSh",
115 "WriteBackFullCleanInv",
116 "WriteBackFullCleanShPerSep",
118 "WriteCleanFullCleanSh",
120 "WriteCleanFullCleanShPerSep",
122 "WriteNoSnpPtlCleanSh",
123 "WriteNoSnpPtlCleanInv",
124 "WriteNoSnpPtlCleanShPerSep",
126 "WriteUniquePtlCleanSh",
128 "WriteUniquePtlCleanShPerSep",
131 auto idx =
static_cast<unsigned>(v);
132 if(idx < opc2str.size())
140 case dat_optype_e::DataLCrdReturn:
141 return "DataLCrdReturn";
142 case dat_optype_e::SnpRespData:
143 return "SnpRespData";
144 case dat_optype_e::CopyBackWrData:
145 return "CopyBackWrData";
146 case dat_optype_e::NonCopyBackWrData:
147 return "NonCopyBackWrData";
148 case dat_optype_e::CompData:
150 case dat_optype_e::SnpRespDataPtl:
151 return "SnpRespDataPtl";
152 case dat_optype_e::SnpRespDataFwded:
153 return "SnpRespDataFwded";
154 case dat_optype_e::WriteDataCancel:
155 return "WriteDataCancel";
156 case dat_optype_e::DataSepResp:
157 return "DataSepResp";
158 case dat_optype_e::NCBWrDataCompAck:
159 return "NCBWrDataCompAck";
161 return "UNKNOWN_dat_optype_e";
167 case rsp_optype_e::RespLCrdReturn:
168 return "RespLCrdReturn";
169 case rsp_optype_e::SnpResp:
171 case rsp_optype_e::CompAck:
173 case rsp_optype_e::RetryAck:
175 case rsp_optype_e::Comp:
177 case rsp_optype_e::CompDBIDResp:
178 return "CompDBIDResp";
179 case rsp_optype_e::DBIDResp:
181 case rsp_optype_e::PCrdGrant:
183 case rsp_optype_e::ReadReceipt:
184 return "ReadReceipt";
185 case rsp_optype_e::SnpRespFwded:
186 return "SnpRespFwded";
187 case rsp_optype_e::TagMatch:
189 case rsp_optype_e::RespSepData:
190 return "RespSepData";
191 case rsp_optype_e::Persist:
193 case rsp_optype_e::CompPersist:
194 return "CompPersist";
195 case rsp_optype_e::DBIDRespOrd:
196 return "DBIDRespOrd";
197 case rsp_optype_e::StashDone:
199 case rsp_optype_e::CompStashDone:
200 return "CompStashDone";
201 case rsp_optype_e::CompCMO:
203 case rsp_optype_e::INVALID:
206 return "UNKNOWN_rsp_optype_e";
212 case snp_optype_e::SnpLCrdReturn:
213 return "SnpLCrdReturn";
214 case snp_optype_e::SnpShared:
216 case snp_optype_e::SnpClean:
218 case snp_optype_e::SnpOnce:
220 case snp_optype_e::SnpNotSharedDirty:
221 return "SnpNotSharedDirty";
222 case snp_optype_e::SnpUniqueStash:
223 return "SnpUniqueStash";
224 case snp_optype_e::SnpMakeInvalidStash:
225 return "SnpMakeInvalidStash";
226 case snp_optype_e::SnpUnique:
228 case snp_optype_e::SnpCleanShared:
229 return "SnpCleanShared";
230 case snp_optype_e::SnpCleanInvalid:
231 return "SnpCleanInvalid";
232 case snp_optype_e::SnpMakeInvalid:
233 return "SnpMakeInvalid";
234 case snp_optype_e::SnpStashUnique:
235 return "SnpStashUnique";
236 case snp_optype_e::SnpStashShared:
237 return "SnpStashShared";
238 case snp_optype_e::SnpDVMOp:
240 case snp_optype_e::SnpSharedFwd:
241 return "SnpSharedFwd";
242 case snp_optype_e::SnpCleanFwd:
243 return "SnpCleanFwd";
244 case snp_optype_e::SnpOnceFwd:
246 case snp_optype_e::SnpNotSharedDirtyFwd:
247 return "SnpNotSharedDirtyFwd";
248 case snp_optype_e::SnpUniqueFwd:
249 return "SnpUniqueFwd";
251 return "UNKNOWN_snp_optype_e";
266 case dat_resptype_e::CompData_UD_PD:
267 return "CompData_UD_PD";
268 case dat_resptype_e::CompData_SD_PD:
269 return "CompData_SD_PD";
270 case dat_resptype_e::Comp_I:
272 case dat_resptype_e::Comp_UC:
274 case dat_resptype_e::Comp_SC:
284 return "UNKNOWN_dat_resptype_e";
290 case rsp_resptype_e::SnpResp_I:
292 case rsp_resptype_e::SnpResp_SC:
294 case rsp_resptype_e::SnpResp_UC:
297 case rsp_resptype_e::SnpResp_SD:
300 return "UNKNOWN_rsp_resptype_e";
306 case rsp_resperrtype_e::OK:
308 case rsp_resperrtype_e::EXOK:
310 case rsp_resperrtype_e::DERR:
312 case rsp_resperrtype_e::NDERR:
315 return "rsp_resperrtype_e";
321 case credit_type_e::LINK:
323 case credit_type_e::REQ:
325 case credit_type_e::RESP:
327 case credit_type_e::DATA:
330 return "credit_type_e";
334std::ostream& operator<<(std::ostream& os,
const tlm::tlm_generic_payload& t) {
335 char const* ch = t.get_command() == tlm::TLM_READ_COMMAND ?
"AR" : (t.get_command() == tlm::TLM_WRITE_COMMAND ?
"AW" :
"");
336 os <<
"CMD:" << cmd_str[t.get_command()] <<
", " << ch <<
"ADDR:0x" << std::hex << t.get_address() <<
", TXLEN:0x"
337 << t.get_data_length();
339 os <<
", TXNID:" << ext->get_txn_id();
342 os <<
", TXNID:" << ext->get_txn_id();
345 os <<
" [ptr:" << &t <<
"]";
348template <>
const char* is_valid_msg<chi::chi_ctrl_extension>(
chi_ctrl_extension* ext) {
349 auto sz = ext->req.get_size();
351 return "Illegal size setting, maximum is 6";
352 switch(ext->req.get_opcode()) {
353 case req_optype_e::ReadNoSnp:
354 case req_optype_e::ReadNoSnpSep:
355 case req_optype_e::WriteNoSnpPtl:
356 case req_optype_e::WriteUniquePtl:
357 case req_optype_e::WriteUniquePtlStash:
360 if(!is_dataless(ext) && sz < 6)
361 return "Coherent transactions allow only cache line size data transfers";
385 chi_ctrl_ext_record() {
recordBegin = &chi_ctrl_ext_record::record; }
387 static void record(SCVNS scv_tr_handle& handle, tlm::tlm_extension_base* e, std::string
const& prefix) {
389 handle.record_attribute(fmt::format(
"{}qos", prefix).c_str(), ext->get_qos());
390 handle.record_attribute(fmt::format(
"{}src_id", prefix).c_str(), ext->get_src_id());
391 handle.record_attribute(fmt::format(
"{}txn_id", prefix).c_str(), ext->get_txn_id());
392 handle.record_attribute(fmt::format(
"{}tgt_id", prefix).c_str(), ext->req.get_tgt_id());
393 handle.record_attribute(fmt::format(
"{}lp_id", prefix).c_str(), ext->req.get_lp_id());
394 handle.record_attribute(fmt::format(
"{}return_txn_id", prefix).c_str(), ext->req.get_return_txn_id());
395 handle.record_attribute(fmt::format(
"{}stash_lp_id", prefix).c_str(), ext->req.get_stash_lp_id());
396 handle.record_attribute(fmt::format(
"{}size", prefix).c_str(), ext->req.get_size());
397 handle.record_attribute(fmt::format(
"{}mem_attr", prefix).c_str(), ext->req.get_mem_attr());
398 handle.record_attribute(fmt::format(
"{}req.pcrd_type", prefix).c_str(), ext->req.get_pcrd_type());
399 handle.record_attribute(fmt::format(
"{}order", prefix).c_str(), ext->req.get_order());
400 handle.record_attribute(fmt::format(
"{}endian", prefix).c_str(), ext->req.is_endian());
401 handle.record_attribute(fmt::format(
"{}req.trace_tag", prefix).c_str(), ext->req.is_trace_tag());
402 handle.record_attribute(fmt::format(
"{}return_n_id", prefix).c_str(), ext->req.get_return_n_id());
403 handle.record_attribute(fmt::format(
"{}stash_n_id", prefix).c_str(), ext->req.get_stash_n_id());
404 handle.record_attribute(fmt::format(
"{}opcode", prefix).c_str(), std::string(
to_char(ext->req.get_opcode())));
405 handle.record_attribute(fmt::format(
"{}stash_nnode_id_valid", prefix).c_str(), ext->req.is_stash_n_id_valid());
406 handle.record_attribute(fmt::format(
"{}stash_lp_id_valid", prefix).c_str(), ext->req.is_stash_lp_id_valid());
407 handle.record_attribute(fmt::format(
"{}non_secure", prefix).c_str(), ext->req.is_non_secure());
408 handle.record_attribute(fmt::format(
"{}exp_comp_ack", prefix).c_str(), ext->req.is_exp_comp_ack());
409 handle.record_attribute(fmt::format(
"{}allow_retry", prefix).c_str(), ext->req.is_allow_retry());
410 handle.record_attribute(fmt::format(
"{}snp_attr", prefix).c_str(), ext->req.is_snp_attr());
411 handle.record_attribute(fmt::format(
"{}excl", prefix).c_str(), ext->req.is_excl());
412 handle.record_attribute(fmt::format(
"{}snoop_me", prefix).c_str(), ext->req.is_snoop_me());
413 handle.record_attribute(fmt::format(
"{}likely_shared", prefix).c_str(), ext->req.is_likely_shared());
414 handle.record_attribute(fmt::format(
"{}txn_rsvdc", prefix).c_str(), ext->req.get_rsvdc());
415 handle.record_attribute(fmt::format(
"{}tag_op", prefix).c_str(), ext->req.get_tag_op());
416 handle.record_attribute(fmt::format(
"{}tag_group_id", prefix).c_str(), ext->req.get_tag_group_id());
417 handle.record_attribute(fmt::format(
"{}mpam", prefix).c_str(), ext->req.get_mpam());
418 handle.record_attribute(fmt::format(
"{}rsp.db_id", prefix).c_str(), ext->resp.get_db_id());
419 handle.record_attribute(fmt::format(
"{}rsp.pcrd_type", prefix).c_str(), ext->resp.get_pcrd_type());
420 handle.record_attribute(fmt::format(
"{}rsp.resp_err", prefix).c_str(), std::string(
to_char(ext->resp.get_resp_err())));
421 handle.record_attribute(fmt::format(
"{}rsp.fwd_state", prefix).c_str(), ext->resp.get_fwd_state());
422 handle.record_attribute(fmt::format(
"{}rsp.data_pull", prefix).c_str(), ext->resp.get_data_pull());
423 handle.record_attribute(fmt::format(
"{}rsp.opcode", prefix).c_str(), std::string(
to_char(ext->resp.get_opcode())));
424 handle.record_attribute(fmt::format(
"{}rsp.resp", prefix).c_str(), std::string(
to_char(ext->resp.get_resp())));
425 handle.record_attribute(fmt::format(
"{}rsp.tgt_id", prefix).c_str(), ext->resp.get_tgt_id());
426 handle.record_attribute(fmt::format(
"{}rsp.trace_tag", prefix).c_str(), ext->resp.is_trace_tag());
427 handle.record_attribute(fmt::format(
"{}rsp.tag_op", prefix).c_str(), ext->resp.get_tag_op());
428 handle.record_attribute(fmt::format(
"{}rsp.tag_group_id", prefix).c_str(), ext->resp.get_tag_group_id());
447 static void record(SCVNS scv_tr_handle& handle, tlm::tlm_extension_base* e, std::string
const& prefix) {
449 handle.record_attribute(fmt::format(
"{}qos", prefix).c_str(), ext->get_qos());
450 handle.record_attribute(fmt::format(
"{}src_id", prefix).c_str(), ext->get_src_id());
451 handle.record_attribute(fmt::format(
"{}txn_id", prefix).c_str(), ext->get_txn_id());
452 handle.record_attribute(fmt::format(
"{}db_id", prefix).c_str(), ext->dat.get_db_id());
453 handle.record_attribute(fmt::format(
"{}resp_err", prefix).c_str(), std::string(
to_char(ext->dat.get_resp_err())));
454 handle.record_attribute(fmt::format(
"{}resp", prefix).c_str(), std::string(
to_char(ext->dat.get_resp())));
455 handle.record_attribute(fmt::format(
"{}fwd_state", prefix).c_str(), ext->dat.get_fwd_state());
456 handle.record_attribute(fmt::format(
"{}data_pull", prefix).c_str(), ext->dat.get_data_pull());
457 handle.record_attribute(fmt::format(
"{}data_source", prefix).c_str(), ext->dat.get_data_source());
458 handle.record_attribute(fmt::format(
"{}cc_id", prefix).c_str(), ext->dat.get_cc_id());
459 handle.record_attribute(fmt::format(
"{}data_id", prefix).c_str(), ext->dat.get_data_id());
460 handle.record_attribute(fmt::format(
"{}poison", prefix).c_str(), ext->dat.get_poison());
461 handle.record_attribute(fmt::format(
"{}tgt_id", prefix).c_str(), ext->dat.get_tgt_id());
462 handle.record_attribute(fmt::format(
"{}home_node_id", prefix).c_str(), ext->dat.get_home_n_id());
463 handle.record_attribute(fmt::format(
"{}opcode", prefix).c_str(), std::string(
to_char(ext->dat.get_opcode())));
464 handle.record_attribute(fmt::format(
"{}rsvdc", prefix).c_str(), ext->dat.get_rsvdc());
465 handle.record_attribute(fmt::format(
"{}data_check", prefix).c_str(), ext->dat.get_data_check());
466 handle.record_attribute(fmt::format(
"{}trace_tag", prefix).c_str(), ext->dat.is_trace_tag());
467 handle.record_attribute(fmt::format(
"{}tag_op", prefix).c_str(), ext->dat.get_tag_op());
468 handle.record_attribute(fmt::format(
"{}tag", prefix).c_str(), ext->dat.get_tag());
469 handle.record_attribute(fmt::format(
"{}tu", prefix).c_str(), ext->dat.get_tu());
488 static void record(SCVNS scv_tr_handle& handle, tlm::tlm_extension_base* e, std::string
const& prefix) {
490 handle.record_attribute(fmt::format(
"{}qos", prefix).c_str(), ext->get_qos());
491 handle.record_attribute(fmt::format(
"{}src_id", prefix).c_str(), ext->get_src_id());
492 handle.record_attribute(fmt::format(
"{}txn_id", prefix).c_str(), ext->get_txn_id());
493 handle.record_attribute(fmt::format(
"{}fwd_txn_id", prefix).c_str(), ext->req.get_fwd_txn_id());
494 handle.record_attribute(fmt::format(
"{}stash_lp_id", prefix).c_str(), ext->req.get_stash_lp_id());
495 handle.record_attribute(fmt::format(
"{}vm_id_ext", prefix).c_str(), ext->req.get_vm_id_ext());
496 handle.record_attribute(fmt::format(
"{}stash_lp_id_valid", prefix).c_str(), ext->req.is_stash_lp_id_valid());
497 handle.record_attribute(fmt::format(
"{}opcode", prefix).c_str(), std::string(
to_char(ext->req.get_opcode())));
498 handle.record_attribute(fmt::format(
"{}fwd_n_id", prefix).c_str(), ext->req.get_fwd_n_id());
499 handle.record_attribute(fmt::format(
"{}non_secure", prefix).c_str(), ext->req.is_non_secure());
500 handle.record_attribute(fmt::format(
"{}do_not_goto_sd", prefix).c_str(), ext->req.is_do_not_goto_sd());
501 handle.record_attribute(fmt::format(
"{}do_not_data_pull", prefix).c_str(), ext->req.is_do_not_data_pull());
502 handle.record_attribute(fmt::format(
"{}ret_to_src", prefix).c_str(), ext->req.is_ret_to_src());
503 handle.record_attribute(fmt::format(
"{}trace_tag", prefix).c_str(), ext->req.is_trace_tag());
504 handle.record_attribute(fmt::format(
"{}rsp.db_id", prefix).c_str(), ext->resp.get_db_id());
505 handle.record_attribute(fmt::format(
"{}rsp.pcrd_type", prefix).c_str(), ext->resp.get_pcrd_type());
506 handle.record_attribute(fmt::format(
"{}rsp.resp_err", prefix).c_str(), std::string(
to_char(ext->resp.get_resp_err())));
507 handle.record_attribute(fmt::format(
"{}rsp.fwd_state", prefix).c_str(), ext->resp.get_fwd_state());
508 handle.record_attribute(fmt::format(
"{}rsp.data_pull", prefix).c_str(), ext->resp.get_data_pull());
509 handle.record_attribute(fmt::format(
"{}rsp.opcode", prefix).c_str(), std::string(
to_char(ext->resp.get_opcode())));
510 handle.record_attribute(fmt::format(
"{}rsp.resp", prefix).c_str(), std::string(
to_char(ext->resp.get_resp())));
511 handle.record_attribute(fmt::format(
"{}rsp.tgt_id", prefix).c_str(), ext->resp.get_tgt_id());
512 handle.record_attribute(fmt::format(
"{}rsp.trace_tag", prefix).c_str(), ext->resp.is_trace_tag());