gem5 v24.1.0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
utils.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are
16 * met: redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer;
18 * redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution;
21 * neither the name of the copyright holders nor the names of its
22 * contributors may be used to endorse or promote products derived from
23 * this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
37
39
40#include "base/bitfield.hh"
41#include "base/logging.hh"
42
43namespace gem5 {
44
45namespace tlm::chi {
46
47namespace {
48
49using namespace ARM::CHI;
50using namespace ruby::CHI;
51
52std::string
53reqOpcodeToName(ReqOpcode req_opcode)
54{
55 switch (req_opcode) {
56 case REQ_OPCODE_REQ_LCRD_RETURN: return "ReqLCrdReturn";
57 case REQ_OPCODE_READ_SHARED: return "ReadShared";
58 case REQ_OPCODE_READ_CLEAN: return "ReadClean";
59 case REQ_OPCODE_READ_ONCE: return "ReadOnce";
60 case REQ_OPCODE_READ_NO_SNP: return "ReadNoSnp";
61 case REQ_OPCODE_PCRD_RETURN: return "PCrdReturn";
62 case REQ_OPCODE_READ_UNIQUE: return "ReadUnique";
63 case REQ_OPCODE_CLEAN_SHARED: return "CleanShared";
64 case REQ_OPCODE_CLEAN_INVALID: return "CleanInvalid";
65 case REQ_OPCODE_MAKE_INVALID: return "MakeInvalid";
66 case REQ_OPCODE_CLEAN_UNIQUE: return "CleanUnique";
67 case REQ_OPCODE_MAKE_UNIQUE: return "MakeUnique";
68 case REQ_OPCODE_EVICT: return "Evict";
69 case REQ_OPCODE_EO_BARRIER: return "EoBarrier";
70 case REQ_OPCODE_EC_BARRIER: return "EcBarrier";
71 case REQ_OPCODE_READ_NO_SNP_SEP: return "ReadNoSnpSep";
72 case REQ_OPCODE_CLEAN_SHARED_PERSIST_SEP: return "CleanSharedPersistSep";
73 case REQ_OPCODE_DVM_OP: return "DvmOp";
74 case REQ_OPCODE_WRITE_EVICT_FULL: return "WriteEvictFull";
75 case REQ_OPCODE_WRITE_CLEAN_PTL: return "WriteCleanPtl";
76 case REQ_OPCODE_WRITE_CLEAN_FULL: return "WriteCleanFull";
77 case REQ_OPCODE_WRITE_UNIQUE_PTL: return "WriteUniquePtl";
78 case REQ_OPCODE_WRITE_UNIQUE_FULL: return "WriteUniqueFull";
79 case REQ_OPCODE_WRITE_BACK_PTL: return "WriteBackPtl";
80 case REQ_OPCODE_WRITE_BACK_FULL: return "WriteBackFull";
81 case REQ_OPCODE_WRITE_NO_SNP_PTL: return "WriteNoSnpPtl";
82 case REQ_OPCODE_WRITE_NO_SNP_FULL: return "WriteNoSnpFull";
83 case REQ_OPCODE_WRITE_UNIQUE_FULL_STASH: return "WriteUniqueFullStash";
84 case REQ_OPCODE_WRITE_UNIQUE_PTL_STASH: return "WriteUniquePtlStash";
85 case REQ_OPCODE_STASH_ONCE_SHARED: return "StashOnceShared";
86 case REQ_OPCODE_STASH_ONCE_UNIQUE: return "StashOnceUnique";
87 case REQ_OPCODE_READ_ONCE_CLEAN_INVALID: return "ReadOnceCleanInvalid";
88 case REQ_OPCODE_READ_ONCE_MAKE_INVALID: return "ReadOnceMakeInvalid";
89 case REQ_OPCODE_READ_NOT_SHARED_DIRTY: return "ReadNotSharedDirty";
90 case REQ_OPCODE_CLEAN_SHARED_PERSIST: return "CleanSharedPersist";
91 case REQ_OPCODE_ATOMIC_STORE_ADD: return "AtomicStoreAdd";
92 case REQ_OPCODE_ATOMIC_STORE_CLR: return "AtomicStoreClr";
93 case REQ_OPCODE_ATOMIC_STORE_EOR: return "AtomicStoreEor";
94 case REQ_OPCODE_ATOMIC_STORE_SET: return "AtomicStoreSet";
95 case REQ_OPCODE_ATOMIC_STORE_SMAX: return "AtomicStoreSmax";
96 case REQ_OPCODE_ATOMIC_STORE_SMIN: return "AtomicStoreSmin";
97 case REQ_OPCODE_ATOMIC_STORE_UMAX: return "AtomicStoreUmax";
98 case REQ_OPCODE_ATOMIC_STORE_UMIN: return "AtomicStoreUmin";
99 case REQ_OPCODE_ATOMIC_LOAD_ADD: return "AtomicLoadAdd";
100 case REQ_OPCODE_ATOMIC_LOAD_CLR: return "AtomicLoadClr";
101 case REQ_OPCODE_ATOMIC_LOAD_EOR: return "AtomicLoadEor";
102 case REQ_OPCODE_ATOMIC_LOAD_SET: return "AtomicLoadSet";
103 case REQ_OPCODE_ATOMIC_LOAD_SMAX: return "AtomicLoadSmax";
104 case REQ_OPCODE_ATOMIC_LOAD_SMIN: return "AtomicLoadSmin";
105 case REQ_OPCODE_ATOMIC_LOAD_UMAX: return "AtomicLoadUmax";
106 case REQ_OPCODE_ATOMIC_LOAD_UMIN: return "AtomicLoadUmin";
107 case REQ_OPCODE_ATOMIC_SWAP: return "AtomicSwap";
108 case REQ_OPCODE_ATOMIC_COMPARE: return "AtomicCompare";
109 case REQ_OPCODE_PREFETCH_TGT: return "PrefetchTgt";
110 case REQ_OPCODE_MAKE_READ_UNIQUE: return "MakeReadUnique";
111 case REQ_OPCODE_WRITE_EVICT_OR_EVICT: return "WriteEvictOrEvict";
112 case REQ_OPCODE_WRITE_UNIQUE_ZERO: return "WriteUniqueZero";
113 case REQ_OPCODE_WRITE_NO_SNP_ZERO: return "WriteNoSnpZero";
114 case REQ_OPCODE_STASH_ONCE_SEP_SHARED: return "StashOnceSepShared";
115 case REQ_OPCODE_STASH_ONCE_SEP_UNIQUE: return "StashOnceSepUnique";
116 case REQ_OPCODE_READ_PREFER_UNIQUE: return "ReadPreferUnique";
117 case REQ_OPCODE_WRITE_NO_SNP_FULL_CLEAN_SH: return "WriteNoSnpFullCleanSh";
118 default: return std::string{};
119 }
120}
121
122std::string
123snpOpcodeToName(SnpOpcode snp_opcode)
124{
125 switch (snp_opcode) {
126 case SNP_OPCODE_SNP_LCRD_RETURN: return "SnpLcrdReturn";
127 case SNP_OPCODE_SNP_SHARED: return "SnpShared";
128 case SNP_OPCODE_SNP_CLEAN: return "SnpClean";
129 case SNP_OPCODE_SNP_ONCE: return "SnpOnce";
130 case SNP_OPCODE_SNP_NOT_SHARED_DIRTY: return "SnpNotSharedDirty";
131 case SNP_OPCODE_SNP_UNIQUE_STASH: return "SnpUniqueStash";
132 case SNP_OPCODE_SNP_MAKE_INVALID_STASH: return "SnpMakeInvalidStash";
133 case SNP_OPCODE_SNP_UNIQUE: return "SnpUnique";
134 case SNP_OPCODE_SNP_CLEAN_SHARED: return "SnpCleanShared";
135 case SNP_OPCODE_SNP_CLEAN_INVALID: return "SnpCleanInvalid";
136 case SNP_OPCODE_SNP_MAKE_INVALID: return "SnpMakeInvalid";
137 case SNP_OPCODE_SNP_STASH_UNIQUE: return "SnpStashUnique";
138 case SNP_OPCODE_SNP_STASH_SHARED: return "SnpStashShared";
139 case SNP_OPCODE_SNP_DVM_OP: return "SnpDvmOp";
140 case SNP_OPCODE_SNP_QUERY: return "SnpQuery";
141 case SNP_OPCODE_SNP_SHARED_FWD: return "SnpSharedFwd";
142 case SNP_OPCODE_SNP_CLEAN_FWD: return "SnpCleanFwd";
143 case SNP_OPCODE_SNP_ONCE_FWD: return "SnpOnceFwd";
144 case SNP_OPCODE_SNP_NOT_SHARED_DIRTY_FWD: return "SnpNotSharedDirtyFwd";
145 case SNP_OPCODE_SNP_PREFER_UNIQUE: return "SnpPreferUnique";
146 case SNP_OPCODE_SNP_PREFER_UNIQUE_FWD: return "SnpPreferUniqueFwd";
147 case SNP_OPCODE_SNP_UNIQUE_FWD: return "SnpUniqueFwd";
148 default: return std::string{};
149 }
150}
151
152std::string
153datOpcodeToName(DatOpcode dat_opcode)
154{
155 switch (dat_opcode) {
156 case DAT_OPCODE_DAT_LCRD_RETURN: return "DatLcrdReturn";
157 case DAT_OPCODE_SNP_RESP_DATA: return "SnpRespData";
158 case DAT_OPCODE_COPY_BACK_WR_DATA: return "CopyBackWrData";
159 case DAT_OPCODE_NON_COPY_BACK_WR_DATA: return "NonCopyBackWrData";
160 case DAT_OPCODE_COMP_DATA: return "CompData";
161 case DAT_OPCODE_SNP_RESP_DATA_PTL: return "SnpRespDataPtl";
162 case DAT_OPCODE_SNP_RESP_DATA_FWDED: return "SnpRespDataFwded";
163 case DAT_OPCODE_WRITE_DATA_CANCEL: return "WriteDataCancel";
164 case DAT_OPCODE_DATA_SEP_RESP: return "DataSepResp";
165 case DAT_OPCODE_NCB_WR_DATA_COMP_ACK: return "NcbWrDataCompAck";
166 default: return std::string{};
167 }
168}
169
170std::string
171rspOpcodeToName(RspOpcode rsp_opcode)
172{
173 switch (rsp_opcode) {
174 case RSP_OPCODE_RSP_LCRD_RETURN: return "RspLcrdReturn";
175 case RSP_OPCODE_SNP_RESP: return "SnpResp";
176 case RSP_OPCODE_COMP_ACK: return "CompAck";
177 case RSP_OPCODE_RETRY_ACK: return "RetryAck";
178 case RSP_OPCODE_COMP: return "OpcodeComp";
179 case RSP_OPCODE_COMP_DBID_RESP: return "CompDbidResp";
180 case RSP_OPCODE_DBID_RESP: return "DbidResp";
181 case RSP_OPCODE_PCRD_GRANT: return "PcrdGrant";
182 case RSP_OPCODE_READ_RECEIPT: return "ReadReceipt";
183 case RSP_OPCODE_SNP_RESP_FWDED: return "SnpRespFwded";
184 case RSP_OPCODE_TAG_MATCH: return "TagMatch";
185 case RSP_OPCODE_RESP_SEP_DATA: return "RespSepData";
186 case RSP_OPCODE_PERSIST: return "Persist";
187 case RSP_OPCODE_COMP_PERSIST: return "CompPersist";
188 case RSP_OPCODE_DBID_RESP_ORD: return "DbidRespOrd";
189 case RSP_OPCODE_STASH_DONE: return "StashDone";
190 case RSP_OPCODE_COMP_STASH_DONE: return "CompStashDone";
191 case RSP_OPCODE_COMP_CMO: return "CompCMO";
192 default: return std::string{};
193 }
194}
195
196std::string
197phaseToOpcodeName(const Phase &phase)
198{
199 switch (phase.channel) {
200 case CHANNEL_REQ:
201 return reqOpcodeToName(phase.req_opcode);
202 case CHANNEL_SNP:
203 return snpOpcodeToName(phase.snp_opcode);
204 case CHANNEL_DAT:
205 return datOpcodeToName(phase.dat_opcode);
206 case CHANNEL_RSP:
207 return rspOpcodeToName(phase.rsp_opcode);
208 default:
209 break;
210 }
211 return std::string{};
212}
213
214std::string
215phaseToChannelName(const Phase &phase)
216{
217 switch (phase.channel) {
218 case CHANNEL_REQ:
219 return "REQ";
220 case CHANNEL_SNP:
221 return "SNP";
222 case CHANNEL_DAT:
223 return "DAT";
224 case CHANNEL_RSP:
225 return "RSP";
226 default:
227 return std::string{};
228 }
229}
230
231} // namespace
232
233std::string
234transactionToString(const Payload &payload,
235 const Phase &phase)
236{
237 return csprintf("%s %s addr=0x%08lx ns=%d size=%d attrs=0x%x",
238 phaseToChannelName(phase),
239 phaseToOpcodeName(phase).c_str(),
240 payload.address, payload.ns,
241 (int)payload.size, (int)payload.mem_attr);
242}
243
244namespace tlm_to_ruby {
245
246CHIRequestType
247reqOpcode(ReqOpcode req)
248{
249 static std::unordered_map<uint8_t, CHIRequestType> translation_map = {
250 { REQ_OPCODE_READ_SHARED, CHIRequestType_ReadShared },
251 { REQ_OPCODE_READ_CLEAN, CHIRequestType_ReadOnce }, // TODO
252 { REQ_OPCODE_READ_ONCE, CHIRequestType_ReadOnce },
253 { REQ_OPCODE_READ_NO_SNP, CHIRequestType_ReadNoSnp }, // TODO
254 { REQ_OPCODE_READ_UNIQUE, CHIRequestType_ReadUnique },
255 { REQ_OPCODE_READ_NOT_SHARED_DIRTY, CHIRequestType_ReadNotSharedDirty },
256 { REQ_OPCODE_READ_PREFER_UNIQUE, CHIRequestType_ReadUnique }, // TODO
257 { REQ_OPCODE_MAKE_READ_UNIQUE, CHIRequestType_MakeReadUnique }, // TODO
258
259 { REQ_OPCODE_CLEAN_UNIQUE, CHIRequestType_CleanUnique },
260 { REQ_OPCODE_MAKE_UNIQUE, CHIRequestType_CleanUnique }, // TODO
261 { REQ_OPCODE_EVICT, CHIRequestType_Evict },
262 { REQ_OPCODE_STASH_ONCE_SEP_SHARED, CHIRequestType_StashOnceShared }, // TODO
263 { REQ_OPCODE_STASH_ONCE_SEP_UNIQUE, CHIRequestType_StashOnceUnique },
264 { REQ_OPCODE_WRITE_NO_SNP_PTL, CHIRequestType_WriteUniquePtl },
265 { REQ_OPCODE_WRITE_NO_SNP_FULL, CHIRequestType_WriteUniqueFull },
266 { REQ_OPCODE_WRITE_UNIQUE_FULL, CHIRequestType_WriteUniqueFull },
267 { REQ_OPCODE_WRITE_UNIQUE_ZERO, CHIRequestType_WriteUniqueZero },
268 { REQ_OPCODE_WRITE_BACK_FULL, CHIRequestType_WriteBackFull },
269 { REQ_OPCODE_WRITE_EVICT_OR_EVICT, CHIRequestType_WriteEvictFull }, // TODO
270 };
271
272 auto it = translation_map.find(req);
273 if (it != translation_map.end()) {
274 return it->second;
275 } else {
276 panic("Unsupported Translation: %s\n", reqOpcodeToName(req));
277 }
278}
279
280#define RESP_CASE(opc) \
281 switch (resp) { \
282 case RESP_I: return opc ## _ ## I; \
283 case RESP_SC: return opc ## _ ## SC; \
284 case RESP_UC: return opc ## _ ## UC; \
285 case RESP_SD: return opc ## _ ## SD; \
286 case RESP_I_PD: return opc ## _ ## I_PD; \
287 case RESP_SC_PD: return opc ## _ ## SC_PD; \
288 case RESP_UC_PD: return opc ## _ ## UC; \
289 case RESP_SD_PD: return opc ## _ ## SD; \
290 default: panic(""); \
291 }
292
293CHIDataType
294datOpcode(DatOpcode dat, Resp resp)
295{
296 switch (dat) {
297 case DAT_OPCODE_NON_COPY_BACK_WR_DATA:
298 return CHIDataType_NCBWrData;
299 case DAT_OPCODE_COPY_BACK_WR_DATA:
300 switch (resp) {
301 case RESP_I: return CHIDataType_CBWrData_I;
302 case RESP_UC: return CHIDataType_CBWrData_UC;
303 case RESP_SC: return CHIDataType_CBWrData_SC;
304 case RESP_UD_PD: return CHIDataType_CBWrData_UD_PD;
305 default: panic("");
306 }
307 case DAT_OPCODE_SNP_RESP_DATA:
308 RESP_CASE(CHIDataType_SnpRespData)
309 default:
310 panic("Unsupported Translation: %s\n", datOpcodeToName(dat));
311 }
312}
313
314CHIResponseType
315rspOpcode(RspOpcode opc, Resp resp)
316{
317 switch(opc) {
318 case RSP_OPCODE_COMP_ACK: return CHIResponseType_CompAck;
319 case RSP_OPCODE_SNP_RESP:
320 switch (resp) {
321 case RESP_I: return CHIResponseType_SnpResp_I;
322 default: panic("Invalid resp %d for %d\n", resp, opc);
323 }
324 default:
325 panic("Unsupported Translation: %s\n", rspOpcodeToName(opc));
326 };
327}
328
329}
330
331namespace ruby_to_tlm {
332
333uint8_t
334datOpcode(CHIDataType dat)
335{
336 switch (dat) {
337 case CHIDataType_CompData_I:
338 case CHIDataType_CompData_UC:
339 case CHIDataType_CompData_SC:
340 case CHIDataType_CompData_UD_PD:
341 case CHIDataType_CompData_SD_PD:
342 return 0x4;
343 case CHIDataType_DataSepResp_UC:
344 return 0xb;
345 case CHIDataType_CBWrData_UC:
346 case CHIDataType_CBWrData_SC:
347 case CHIDataType_CBWrData_UD_PD:
348 case CHIDataType_CBWrData_SD_PD:
349 case CHIDataType_CBWrData_I:
350 return 0x2;
351 case CHIDataType_NCBWrData:
352 return 0x3;
353 case CHIDataType_SnpRespData_I:
354 case CHIDataType_SnpRespData_I_PD:
355 case CHIDataType_SnpRespData_SC:
356 case CHIDataType_SnpRespData_SC_PD:
357 case CHIDataType_SnpRespData_SD:
358 case CHIDataType_SnpRespData_UC:
359 case CHIDataType_SnpRespData_UD:
360 return 0x1;
361 case CHIDataType_SnpRespData_SC_Fwded_SC:
362 case CHIDataType_SnpRespData_SC_Fwded_SD_PD:
363 case CHIDataType_SnpRespData_SC_PD_Fwded_SC:
364 case CHIDataType_SnpRespData_SD_Fwded_SC:
365 case CHIDataType_SnpRespData_I_Fwded_SD_PD:
366 case CHIDataType_SnpRespData_I_PD_Fwded_SC:
367 case CHIDataType_SnpRespData_I_Fwded_SC:
368 return 0x6;
369 default:
370 panic("Unrecognised data opcode: %d\n", dat);
371 }
372}
373
374uint8_t
375rspOpcode(CHIResponseType rsp)
376{
377 switch (rsp) {
378 case CHIResponseType_Comp_UD_PD:
379 case CHIResponseType_Comp_UC:
380 case CHIResponseType_Comp_I:
381 return RSP_OPCODE_COMP;
382 case CHIResponseType_CompDBIDResp:
383 return RSP_OPCODE_COMP_DBID_RESP;
384 case CHIResponseType_RetryAck:
385 return RSP_OPCODE_RETRY_ACK;
386 default:
387 panic("Unrecognised rsp opcode: %d\n", rsp);
388 }
389}
390
391uint8_t
392snpOpcode(CHIRequestType snp)
393{
394 switch (snp) {
395 case CHIRequestType_SnpOnceFwd:
396 return SNP_OPCODE_SNP_ONCE_FWD;
397 case CHIRequestType_SnpOnce:
398 return SNP_OPCODE_SNP_ONCE;
399 case CHIRequestType_SnpShared:
400 return SNP_OPCODE_SNP_SHARED;
401 case CHIRequestType_SnpCleanInvalid:
402 return SNP_OPCODE_SNP_CLEAN_INVALID;
403 case CHIRequestType_SnpUnique:
404 return SNP_OPCODE_SNP_UNIQUE;
405 default:
406 panic("Unrecognised snp opcode: %d\n", snp);
407 }
408}
409
410Resp
411datResp(CHIDataType dat)
412{
413 switch (dat) {
414 case CHIDataType_SnpRespData_I:
415 case CHIDataType_CompData_I:
416 case CHIDataType_CBWrData_I:
417 return RESP_I;
418 case CHIDataType_SnpRespData_SC:
419 case CHIDataType_CompData_SC:
420 case CHIDataType_CBWrData_SC:
421 return RESP_SC;
422 case CHIDataType_SnpRespData_UC:
423 case CHIDataType_CompData_UC:
424 case CHIDataType_CBWrData_UC:
425 case CHIDataType_DataSepResp_UC:
426 return RESP_UC;
427 case CHIDataType_SnpRespData_UD:
428 return RESP_UD;
429 case CHIDataType_SnpRespData_SD:
430 return RESP_SD;
431 case CHIDataType_SnpRespData_I_PD:
432 return RESP_I_PD;
433 case CHIDataType_SnpRespData_SC_PD:
434 return RESP_SC_PD;
435 case CHIDataType_CompData_UD_PD:
436 case CHIDataType_CBWrData_UD_PD:
437 return RESP_UD_PD;
438 case CHIDataType_CompData_SD_PD:
439 case CHIDataType_CBWrData_SD_PD:
440 return RESP_SD_PD;
441 // TODO
442 case CHIDataType_SnpRespData_SC_Fwded_SC:
443 case CHIDataType_SnpRespData_SC_Fwded_SD_PD:
444 case CHIDataType_SnpRespData_SC_PD_Fwded_SC:
445 case CHIDataType_SnpRespData_SD_Fwded_SC:
446 case CHIDataType_SnpRespData_I_Fwded_SD_PD:
447 case CHIDataType_SnpRespData_I_PD_Fwded_SC:
448 case CHIDataType_SnpRespData_I_Fwded_SC:
449 default:
450 panic("Unrecognised data opcode: %d\n", dat);
451 }
452}
453
454Resp
455rspResp(CHIResponseType rsp)
456{
457 switch (rsp) {
458 case CHIResponseType_Comp_I:
459 return RESP_I;
460 case CHIResponseType_Comp_UC:
461 return RESP_UC;
462 case CHIResponseType_Comp_UD_PD:
463 return RESP_UD_PD;
464 case CHIResponseType_CompDBIDResp:
465 return RESP_I;
466 case CHIResponseType_RetryAck:
467 // Just setup to zero
468 return RESP_I;
469 default:
470 panic("Unrecognised rsp opcode: %d\n", rsp);
471 }
472}
473
474}
475
476Addr
478{
479 return 1 << sz;
480}
481
482uint8_t
483dataId(Addr address)
484{
485 uint64_t bus_width = 256;
486 switch (bus_width) {
487 case 128:
488 return bits(address, 5, 4);
489 case 256:
490 return bits(address, 5, 4) & 0b10;
491 case 512:
492 default:
493 return 0b00;
494 }
495}
496
497} // namespace tlm::chi
498
499} // namespace gem5
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Definition bitfield.hh:79
#define panic(...)
This implements a cprintf based panic() function.
Definition logging.hh:188
uint8_t snpOpcode(CHIRequestType snp)
Definition utils.cc:392
uint8_t rspOpcode(CHIResponseType rsp)
Definition utils.cc:375
Resp rspResp(CHIResponseType rsp)
Definition utils.cc:455
Resp datResp(CHIDataType dat)
Definition utils.cc:411
uint8_t datOpcode(CHIDataType dat)
Definition utils.cc:334
CHIDataType datOpcode(DatOpcode dat, Resp resp)
Definition utils.cc:294
CHIResponseType rspOpcode(RspOpcode opc, Resp resp)
Definition utils.cc:315
CHIRequestType reqOpcode(ReqOpcode req)
Definition utils.cc:247
Addr transactionSize(Size sz)
Definition utils.cc:477
std::string transactionToString(const Payload &payload, const Phase &phase)
Definition utils.cc:234
uint8_t dataId(Addr address)
Definition utils.cc:483
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
std::string csprintf(const char *format, const Args &...args)
Definition cprintf.hh:161
#define RESP_CASE(opc)
Definition utils.cc:280

Generated on Mon Jan 13 2025 04:28:40 for gem5 by doxygen 1.9.8