18#include <tlm/scc/scv/tlm_extension_recording_registry.h>
23std::array<std::string, 3> cmd_str{
"R",
"W",
"I"};
28 case snoop_e::READ_NO_SNOOP:
29 return "READ_NO_SNOOP";
30 case snoop_e::READ_ONCE:
32 case snoop_e::READ_SHARED:
34 case snoop_e::READ_CLEAN:
36 case snoop_e::READ_NOT_SHARED_DIRTY:
37 return "READ_NOT_SHARED_DIRTY";
38 case snoop_e::READ_UNIQUE:
40 case snoop_e::CLEAN_SHARED:
41 return "CLEAN_SHARED";
42 case snoop_e::CLEAN_INVALID:
43 return "CLEAN_INVALID";
44 case snoop_e::CLEAN_SHARED_PERSIST:
45 return "CLEAN_SHARED_PERSIST";
46 case snoop_e::CLEAN_UNIQUE:
47 return "CLEAN_UNIQUE";
48 case snoop_e::MAKE_UNIQUE:
50 case snoop_e::MAKE_INVALID:
51 return "MAKE_INVALID";
52 case snoop_e::DVM_COMPLETE:
53 return "DVM_COMPLETE";
54 case snoop_e::DVM_MESSAGE:
56 case snoop_e::BARRIER:
58 case snoop_e::WRITE_NO_SNOOP:
59 return "WRITE_NO_SNOOP";
60 case snoop_e::WRITE_UNIQUE:
61 return "WRITE_UNIQUE";
62 case snoop_e::WRITE_LINE_UNIQUE:
63 return "WRITE_LINE_UNIQUE";
64 case snoop_e::WRITE_CLEAN:
66 case snoop_e::WRITE_BACK:
70 case snoop_e::WRITE_EVICT:
72 case snoop_e::CMO_ON_WRITE:
73 return "CMO_ON_WRITE";
74 case snoop_e::WRITE_UNIQUE_PTL_STASH:
75 return "WRITE_UNIQUE_PTL_STASH";
76 case snoop_e::WRITE_UNIQUE_FULL_STASH:
77 return "WRITE_UNIQUE_FULL_STASH";
78 case snoop_e::STASH_ONCE_SHARED:
79 return "STASH_ONCE_SHARED";
80 case snoop_e::STASH_ONCE_UNIQUE:
81 return "STASH_ONCE_UNIQUE";
82 case snoop_e::STASH_TRANSLATION:
83 return "STASH_TRANSLATION";
106 case lock_e::EXLUSIVE:
117 case domain_e::NON_SHAREABLE:
118 return "NON_SHAREABLE";
119 case domain_e::INNER_SHAREABLE:
120 return "INNER_SHAREABLE";
121 case domain_e::OUTER_SHAREABLE:
122 return "OUTER_SHAREABLE";
123 case domain_e::SYSTEM:
132 case bar_e::RESPECT_BARRIER:
133 return "RESPECT_BARRIER";
135 return "MEMORY_BARRIER";
137 return "IGNORE_BARRIER";
139 return "SYNCHRONISATION_BARRIER";
160std::ostream& operator<<(std::ostream& os,
const tlm::tlm_generic_payload& t) {
161 char const* ch = t.get_command() == tlm::TLM_READ_COMMAND ?
"AR" : (t.get_command() == tlm::TLM_WRITE_COMMAND ?
"AW" :
"");
162 os <<
"CMD:" << cmd_str[t.get_command()] <<
", " << ch <<
"ADDR:0x" << std::hex << t.get_address() <<
", TXLEN:0x"
163 << t.get_data_length();
164 if(
auto e = t.get_extension<axi::ace_extension>()) {
165 os <<
", " << ch <<
"ID:" << e->get_id() <<
", " << ch <<
"LEN:0x" << std::hex << static_cast<unsigned>(e->get_length()) <<
", "
166 << ch <<
"SIZE:0x" <<
static_cast<unsigned>(e->get_size()) << std::dec <<
", " << ch <<
"BURST:" <<
to_char(e->get_burst())
167 <<
", " << ch <<
"PROT:" <<
static_cast<unsigned>(e->get_prot()) <<
", " << ch
168 <<
"CACHE:" <<
static_cast<unsigned>(e->get_cache()) <<
", " << ch <<
"QOS:" <<
static_cast<unsigned>(e->get_qos()) <<
", " << ch
169 <<
"REGION:" <<
static_cast<unsigned>(e->get_region()) <<
", " << ch <<
"SNOOP:0x" << std::hex
170 << (
static_cast<unsigned>(e->get_snoop()) & 0xf) << std::dec <<
", " << ch <<
"DOMAIN:" <<
to_char(e->get_domain()) <<
", " << ch
171 <<
"BAR:" <<
to_char(e->get_barrier()) <<
", " << ch <<
"UNIQUE:" << e->get_unique();
172 }
else if(
auto e = t.get_extension<axi::axi4_extension>()) {
173 os <<
", " << ch <<
"ID:" << e->get_id() <<
", " << ch <<
"LEN:0x" << std::hex << static_cast<unsigned>(e->get_length()) <<
", "
174 << ch <<
"SIZE:0x" <<
static_cast<unsigned>(e->get_size()) << std::dec <<
", " << ch <<
"BURST:" <<
to_char(e->get_burst())
175 <<
", " << ch <<
"PROT:" <<
static_cast<unsigned>(e->get_prot()) <<
", " << ch
176 <<
"CACHE:" <<
static_cast<unsigned>(e->get_cache()) <<
", " << ch <<
"QOS:" <<
static_cast<unsigned>(e->get_qos()) <<
", " << ch
177 <<
"REGION:" <<
static_cast<unsigned>(e->get_region());
178 }
else if(
auto e = t.get_extension<axi::axi3_extension>()) {
179 os <<
", " << ch <<
"ID:" << e->get_id() <<
", " << ch <<
"LEN:0x" << std::hex << static_cast<unsigned>(e->get_length()) <<
", "
180 << ch <<
"SIZE:0x" <<
static_cast<unsigned>(e->get_size()) << std::dec <<
", " << ch <<
"BURST:" <<
to_char(e->get_burst())
181 <<
", " << ch <<
"PROT:" <<
static_cast<unsigned>(e->get_prot()) <<
", " << ch
182 <<
"CACHE:" <<
static_cast<unsigned>(e->get_cache()) <<
", " << ch <<
"QOS:" <<
static_cast<unsigned>(e->get_qos()) <<
", " << ch
183 <<
"REGION:" <<
static_cast<unsigned>(e->get_region());
185 os <<
" [ptr:" << &t <<
"]";
190const std::array<std::array<bool, 4>, 16> rd_valid{{
191 {
true,
true,
true,
true},
192 {
false,
true,
true,
false},
193 {
false,
true,
true,
false},
194 {
false,
true,
true,
false},
195 {
false,
true,
true,
false},
196 {
false,
true,
true,
false},
197 {
false,
false,
false,
false},
198 {
false,
true,
true,
false},
199 {
true,
true,
true,
false},
200 {
true,
true,
true,
false},
201 {
false,
true,
true,
false},
202 {
false,
true,
true,
false},
203 {
false,
true,
true,
false},
204 {
true,
true,
true,
false},
205 {
false,
true,
true,
false},
206 {
false,
true,
true,
false}
208const std::array<std::array<bool, 4>, 16> wr_valid{{
209 {
true,
true,
true,
true},
210 {
false,
true,
true,
false},
211 {
true,
true,
true,
false},
212 {
true,
true,
true,
false},
213 {
false,
true,
true,
false},
214 {
true,
true,
true,
false},
215 {
false,
false,
false,
false},
216 {
false,
false,
false,
false},
217 {
true,
true,
true,
false},
218 {
true,
true,
true,
false},
219 {
false,
true,
true,
false},
220 {
false,
false,
false,
false},
221 {
true,
true,
true,
false},
222 {
false,
true,
true,
false},
223 {
false,
true,
true,
false},
224 {
false,
false,
false,
false}
227template <>
char const* is_valid_msg<axi::ace_extension>(axi::ace_extension* ext) {
232 if(!rd_valid[snoop & 0xf][
to_int(domain)])
233 return "illegal read snoop value";
236 return "illegal write snoop value";
238 if(cache < 2 && domain != axi::domain_e::SYSTEM)
239 return "non-cacheable transactions require AXDOMAIN setting of SYSTEM(0x3) based on specification";
240 if(cache > 3 && domain == axi::domain_e::SYSTEM)
241 return "cacheable transaction must not set AXDOMAIN to SYSTEM(0x3) based on specification";
242 if((cache & 2) == 0 && domain != domain_e::NON_SHAREABLE && domain != domain_e::SYSTEM) {
243 if(domain != domain_e::INNER_SHAREABLE)
244 return "illegal AXDOMAIN=INNER_SHAREABLE(0x1) for no non-cacheable access";
245 return "illegal AXDOMAIN=OUTER_SHAREABLE(0x2) for no non-cacheable access";
249 case snoop_e::READ_NO_SNOOP:
250 if(domain != domain_e::NON_SHAREABLE && domain != domain_e::SYSTEM)
251 return "illegal AXDOMAIN for no non-coherent READ_NO_SNOOP access";
253 case snoop_e::WRITE_NO_SNOOP:
254 if(domain != domain_e::NON_SHAREABLE && domain != domain_e::SYSTEM)
255 return "illegal AXDOMAIN for no non-coherent WRITE_NO_SNOOP access";
257 case snoop_e::READ_ONCE:
258 case snoop_e::READ_SHARED:
259 case snoop_e::READ_CLEAN:
260 case snoop_e::READ_NOT_SHARED_DIRTY:
261 case snoop_e::READ_UNIQUE:
262 case snoop_e::MAKE_UNIQUE:
263 case snoop_e::DVM_COMPLETE:
264 case snoop_e::DVM_MESSAGE:
265 case snoop_e::WRITE_UNIQUE:
266 case snoop_e::WRITE_LINE_UNIQUE:
268 if(domain != domain_e::INNER_SHAREABLE && domain != domain_e::OUTER_SHAREABLE) {
269 if(domain != domain_e::NON_SHAREABLE)
270 return "illegal AXDOMAIN=NON_SHAREABLE(0x0) for coherent access";
271 return "illegal AXDOMAIN=SYSTEM(0x3) for coherent access";
274 case snoop_e::CLEAN_SHARED:
275 case snoop_e::CLEAN_INVALID:
276 case snoop_e::MAKE_INVALID:
277 case snoop_e::WRITE_CLEAN:
278 case snoop_e::WRITE_BACK:
279 case snoop_e::WRITE_EVICT:
280 if(domain == domain_e::SYSTEM) {
281 return "illegal AXDOMAIN=SYSTEM(0x3) for coherent access";
288 return "illegal barrier/snoop value combination";
296 return "reserved AxCACHE value";
303template <>
char const* is_valid_msg<axi::axi4_extension>(axi::axi4_extension* ext) {
311 return "reserved AxCACHE value";
316template <>
char const* is_valid_msg<axi::axi3_extension>(axi::axi3_extension* ext) {
324 return "illegal AxCACHE value";
TLM2.0 components modeling AHB.
const char * to_char(E t)
@ MEMORY_BARRIER
Normal access, respecting barriers.
@ SYNCHRONISATION_BARRIER
Normal access, ignoring barriers.
@ IGNORE_BARRIER
Memory barrier.
constexpr ULT to_int(E t)
bar_e get_barrier() const
get the AxBAR value return the barrier value
snoop_e get_snoop() const
get the AxSNOOP value return the snoop value
domain_e get_domain() const
get the AxDOMAIN value return the domain value
uint8_t get_cache() const
get the AxCACHE value as POD