18#include <fmt/format.h>
19#include <tilelink/tl_tlm.h>
20#include <tlm/scc/scv/tlm_extension_recording_registry.h>
21#include <util/ities.h>
25const std::array<std::string, 3> cmd_str{
"R",
"W",
"I"};
32 case opcode_e::AccessAckData:
33 return "AccessAckData";
34 case opcode_e::PutFullData:
36 case opcode_e::PutPartialData:
37 return "PutPartialData";
38 case opcode_e::AccessAck:
40 case opcode_e::ArithmeticData:
41 return "ArithmeticData";
42 case opcode_e::LogicalData:
44 case opcode_e::Intent:
46 case opcode_e::HintAck:
48 case opcode_e::AcquireBlock:
49 return "AcquireBlock";
50 case opcode_e::AcquirePerm:
54 case opcode_e::GrantData:
56 case opcode_e::GrantAck:
58 case opcode_e::ProbeBlock:
60 case opcode_e::ProbePerm:
62 case opcode_e::ProbeAck:
64 case opcode_e::ProbeAckData:
65 return "ProbeAckData";
66 case opcode_e::Release:
68 case opcode_e::ReleaseData:
70 case opcode_e::ReleaseAck:
85 case param_e::GROW_N2B:
86 return "Grow:N2B (0)";
87 case param_e::GROW_N2T:
88 return "Grow:N2T (1)";
89 case param_e::GROW_B2T:
90 return "Grow:B2T (2)";
91 case param_e::PRUNE_T2B:
92 return "Prune:T2B (0)";
93 case param_e::PRUNE_T2N:
94 return "Prune:T2N (1)";
95 case param_e::PRUNE_B2N:
96 return "Prune:B2N (2)";
97 case param_e::REP_T2T:
98 return "Report:T2T (0)";
99 case param_e::REP_B2B:
100 return "Report:B2B (1)";
101 case param_e::REP_N2N:
102 return "Report:N2N (2)";
108std::ostream& operator<<(std::ostream& os,
const tlm::tlm_generic_payload& t) {
109 os <<
"CMD:" << cmd_str[t.get_command()] <<
", "
110 <<
"ADDR:0x" << std::hex << t.get_address() <<
", TXLEN:0x" << t.get_data_length();
111 if(
auto e = t.get_extension<tilelink::tilelink_extension>()) {
113 <<
"OPC:0x" << std::hex << static_cast<unsigned>(e->get_opcode()) <<
"PARAM:" << e->get_param();
115 os <<
" [ptr:" << &t <<
"]";
119using namespace tlm::scc::scv;
123 tlc_ext_record() {
recordBegin = &tlc_ext_record::recordBeginTx; }
125 static void recordBeginTx(SCVNS scv_tr_handle& handle, tlm::tlm_extension_base* e, std::string
const& prefix) {
127 handle.record_attribute(fmt::format(
"{}opcode", prefix).c_str(), std::string(
to_char(ext->get_opcode())));
128 handle.record_attribute(fmt::format(
"{}param", prefix).c_str(), std::string(
to_char(ext->get_param())));
129 handle.record_attribute(fmt::format(
"{}source", prefix).c_str(), ext->get_source());
130 handle.record_attribute(fmt::format(
"{}sink", prefix).c_str(), ext->get_sink());
131 handle.record_attribute(fmt::format(
"{}corrupt", prefix).c_str(), ext->is_corrupt());
132 handle.record_attribute(fmt::format(
"{}denied", prefix).c_str(), ext->is_denied());
139 tlc_ext_recording() { recordBegin = &tlc_ext_recording::recordBeginTx; }
141 static void recordBeginTx(SCVNS scv_tr_handle& handle, tl_protocol_types::tlm_payload_type& trans) {
150__attribute__((constructor))
152bool register_extensions() {
154 tlm_extension_recording_registry<tilelink::tl_protocol_types>::get().register_ext_rec(ext.ID,
155 util::make_unique<tlc_ext_recording>());
156 tlm_extension_record_registry::get().register_ext_rec(ext.ID, util::make_unique<tlc_ext_record>());
159bool registered = register_extensions();
SCV components for AXI/ACE.
const char * to_char(E t)
opcode_e
opcodes of Tilelink.. The encode the opcode (opcode_e[2:0]) and the applicable channels (opcode_e[8] ...
SCC SCV4TLM classes and functions.
util::delegate< void(SCVNS scv_tr_handle &, tlm::tlm_extension_base *, std::string const &)> recordBegin
recording attributes in extensions at the beginning, it is intended to be overload as it does nothing
The TLM transaction extensions recorder interface.
void recordBeginTx(SCVNS scv_tr_handle &h, typename TYPES::tlm_payload_type &trans)
recording attributes in extensions at the beginning, it is intended to be overload as it does nothing