65const MemCmd::CommandInfo
69 { {}, InvalidCmd,
"InvalidCmd" },
72 { {IsRead, IsRequest, NeedsResponse}, ReadResp,
"ReadReq" },
74 { {IsRead, IsResponse, HasData}, InvalidCmd,
"ReadResp" },
76 { {IsRead, IsResponse, HasData, IsInvalidate},
77 InvalidCmd,
"ReadRespWithInvalidate" },
79 { {IsWrite, NeedsWritable, IsRequest, NeedsResponse, HasData},
80 WriteResp,
"WriteReq" },
82 { {IsWrite, IsResponse}, InvalidCmd,
"WriteResp" },
90 { {IsWrite, IsResponse}, InvalidCmd,
"WriteCompleteResp" },
92 { {IsWrite, IsRequest, IsEviction, HasData, FromCache},
93 InvalidCmd,
"WritebackDirty" },
97 { {IsWrite, IsRequest, IsEviction, HasData, FromCache},
98 InvalidCmd,
"WritebackClean" },
101 { {IsWrite, IsRequest, HasData, FromCache}, InvalidCmd,
"WriteClean" },
103 { {IsRequest, IsEviction, FromCache}, InvalidCmd,
"CleanEvict" },
105 { {IsRead, IsRequest, IsSWPrefetch, NeedsResponse},
106 SoftPFResp,
"SoftPFReq" },
108 { {IsRead, NeedsWritable, IsInvalidate, IsRequest,
109 IsSWPrefetch, NeedsResponse}, SoftPFResp,
"SoftPFExReq" },
111 { {IsRead, IsRequest, IsHWPrefetch, NeedsResponse, FromCache},
112 HardPFResp,
"HardPFReq" },
114 { {IsRead, IsResponse, IsSWPrefetch, HasData}, InvalidCmd,
"SoftPFResp" },
116 { {IsRead, IsResponse, IsHWPrefetch, HasData}, InvalidCmd,
"HardPFResp" },
118 { {IsWrite, NeedsWritable, IsRequest, NeedsResponse, HasData},
119 WriteResp,
"WriteLineReq" },
121 { {IsInvalidate, NeedsWritable, IsUpgrade, IsRequest, NeedsResponse,
122 FromCache}, UpgradeResp,
"UpgradeReq" },
124 { {IsInvalidate, NeedsWritable, IsUpgrade, IsLlsc,
125 IsRequest, NeedsResponse, FromCache},
126 UpgradeResp,
"SCUpgradeReq" },
128 { {IsUpgrade, IsResponse}, InvalidCmd,
"UpgradeResp" },
130 { {IsRead, NeedsWritable, IsInvalidate,
131 IsLlsc, IsRequest, NeedsResponse, FromCache},
132 UpgradeFailResp,
"SCUpgradeFailReq" },
135 { {IsRead, IsResponse, HasData}, InvalidCmd,
"UpgradeFailResp" },
139 { {IsRead, NeedsWritable, IsInvalidate, IsRequest, NeedsResponse,
140 FromCache}, ReadExResp,
"ReadExReq" },
143 { {IsRead, IsResponse, HasData}, InvalidCmd,
"ReadExResp" },
147 { {IsRead, IsRequest, NeedsResponse, FromCache},
148 ReadResp,
"ReadCleanReq" },
152 { {IsRead, IsRequest, NeedsResponse, FromCache},
153 ReadResp,
"ReadSharedReq" },
156 { {IsRead, IsLlsc, IsRequest, NeedsResponse},
157 ReadResp,
"LoadLockedReq" },
159 { {IsWrite, NeedsWritable, IsLlsc,
160 IsRequest, NeedsResponse, HasData},
161 StoreCondResp,
"StoreCondReq" },
163 { {IsWrite, NeedsWritable, IsLlsc, IsRequest, NeedsResponse, HasData},
164 StoreCondResp,
"StoreCondFailReq" },
166 { {IsWrite, IsLlsc, IsResponse},
167 InvalidCmd,
"StoreCondResp" },
169 { {IsRead, IsLockedRMW, NeedsWritable, IsRequest, NeedsResponse},
170 LockedRMWReadResp,
"LockedRMWReadReq" },
172 { {IsRead, IsLockedRMW, NeedsWritable, IsResponse, HasData},
173 InvalidCmd,
"LockedRMWReadResp" },
175 { {IsWrite, IsLockedRMW, NeedsWritable, IsRequest, NeedsResponse,
176 HasData}, LockedRMWWriteResp,
"LockedRMWWriteReq" },
178 { {IsWrite, IsLockedRMW, NeedsWritable, IsResponse},
179 InvalidCmd,
"LockedRMWWriteResp" },
181 { {IsRead, IsWrite, NeedsWritable, IsRequest, HasData, NeedsResponse},
182 SwapResp,
"SwapReq" },
184 { {IsRead, IsWrite, IsResponse, HasData}, InvalidCmd,
"SwapResp" },
185 { {}, InvalidCmd,
"Deprecated_MessageReq" },
186 { {}, InvalidCmd,
"Deprecated_MessageResp" },
188 {{IsRequest, NeedsResponse}, MemFenceResp,
"MemFenceReq"},
190 {{IsRequest, NeedsResponse}, MemSyncResp,
"MemSyncReq"},
192 {{IsResponse}, InvalidCmd,
"MemSyncResp"},
194 {{IsResponse}, InvalidCmd,
"MemFenceResp"},
198 { {IsRequest, IsClean, NeedsResponse, FromCache},
199 CleanSharedResp,
"CleanSharedReq" },
203 { {IsResponse, IsClean}, InvalidCmd,
"CleanSharedResp" },
206 { {IsRequest, IsInvalidate, IsClean, NeedsResponse, FromCache},
207 CleanInvalidResp,
"CleanInvalidReq" },
211 { {IsResponse, IsInvalidate, IsClean},
212 InvalidCmd,
"CleanInvalidResp" },
214 { {IsResponse, IsError}, InvalidCmd,
"InvalidDestError" },
216 { {IsResponse, IsError}, InvalidCmd,
"BadAddressError" },
218 { {IsRead, IsResponse, IsError}, InvalidCmd,
"ReadError" },
220 { {IsWrite, IsResponse, IsError}, InvalidCmd,
"WriteError" },
222 { {IsRead, IsResponse, IsError}, InvalidCmd,
"FunctionalReadError" },
224 { {IsWrite, IsResponse, IsError}, InvalidCmd,
"FunctionalWriteError" },
226 { {IsRequest, IsPrint}, InvalidCmd,
"PrintReq" },
228 { {IsRequest, IsFlush, NeedsWritable}, InvalidCmd,
"FlushReq" },
230 { {IsInvalidate, IsRequest, NeedsWritable, NeedsResponse, FromCache},
231 InvalidateResp,
"InvalidateReq" },
233 { {IsInvalidate, IsResponse},
234 InvalidCmd,
"InvalidateResp" },
236 { {IsRead, IsRequest, NeedsResponse}, HTMReqResp,
"HTMReq" },
237 { {IsRead, IsResponse}, InvalidCmd,
"HTMReqResp" },
238 { {IsRead, IsRequest}, InvalidCmd,
"HTMAbort" },
239 { {IsRequest}, InvalidCmd,
"TlbiExtSync" },
255 const Addr val_end = val_start +
size - 1;
257 if (is_secure !=
_isSecure || func_start > val_end ||
258 val_start > func_end) {
276 const Addr val_offset = func_start > val_start ?
277 func_start - val_start : 0;
278 const Addr func_offset = func_start < val_start ?
279 val_start - func_start : 0;
280 const Addr overlap_size = std::min(val_end, func_end)+1 -
281 std::max(val_start, func_start);
294 bool all_bytes_valid =
true;
299 for (; all_bytes_valid &&
i < func_offset; ++
i)
303 for (
i = func_offset;
i < func_offset + overlap_size; ++
i)
307 for (; all_bytes_valid &&
i <
getSize(); ++
i)
310 return all_bytes_valid;
312 std::memcpy(_data + val_offset,
336 assert(sender_state != NULL);
354 auto [
val, success] =
369 const std::string &prefix)
const
373 req->isSecure() ?
" (s)" :
"",
374 req->isInstFetch() ?
" IF" :
"",
375 req->isUncacheable() ?
" UC" :
"",
377 req->isToPOC() ?
" PoC" :
"",
378 req->isToPOU() ?
" PoU" :
"");
383 std::ostringstream str;
390 const int blk_size)
const
415 : curPrefixPtr(new
std::string(
"")),
os(_os), verbosity(_verbosity)
422 labelStack.pop_back();
423 assert(labelStack.empty());
429 std::string *_prefix)
430 : label(_label), prefix(_prefix), labelPrinted(false)
436 const std::string &prefix)
459 if (!
i->labelPrinted) {
461 i->labelPrinted =
true;
static const CommandInfo commandInfo[]
Array to map Command enum to associated info.
Command responseCommand() const
void popLabel()
Pop a label off the label stack.
void printObj(Printable *obj)
Print a Printable object to os, because it matched the address on a PrintReq.
PrintReqState(std::ostream &os, int verbosity=0)
void pushLabel(const std::string &lbl, const std::string &prefix=" ")
Push a label onto the label stack, and prepend the given prefix string onto the current prefix.
std::string * curPrefixPtr
const std::string & curPrefix()
Returns the current line prefix.
void printLabels()
Print all of the pending unprinted labels on the stack.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Addr addr
The address of the request.
@ EXPRESS_SNOOP
Special timing-mode atomic snoop for multi-level coherence.
void setUintX(uint64_t w, ByteOrder endian)
Set the value in the word w after truncating it to the length of the packet and then byteswapping it ...
std::vector< bool > bytesValid
Track the bytes found that satisfy a functional read.
const std::string & cmdString() const
Return the string name of the cmd field (for debugging and tracing).
void setHtmTransactionFailedInCache(const HtmCacheFailure ret_code)
Stipulates that this packet/request has returned from the cache hierarchy in a failed transaction.
AddrRange getAddrRange() const
Get address range to which this packet belongs.
bool needsResponse() const
SenderState * senderState
This packet's sender state.
bool matchAddr(const Addr addr, const bool is_secure) const
Check if packet corresponds to a given address and address space.
void pushSenderState(SenderState *sender_state)
Push a new sender state to the packet and make the current sender state the predecessor of the new on...
void copyResponderFlags(const PacketPtr pkt)
Copy the reponse flags from an input packet to this packet.
SenderState * popSenderState()
Pop the top of the state stack and return a pointer to it.
HtmCacheFailure getHtmTransactionFailedInCacheRC() const
If a packet/request has returned from the cache hierarchy in a failed transaction,...
bool isHtmTransactional() const
Returns whether or not this packet/request originates in the CPU executing in transactional mode,...
std::string print() const
A no-args wrapper of print(std::ostream...) meant to be invoked from DPRINTFs avoiding string overhea...
T * getPtr()
get a pointer to the data ptr.
bool trySatisfyFunctional(PacketPtr other)
Check a functional request against a memory value stored in another packet (i.e.
uint64_t getHtmTransactionUid() const
If a packet/request originates in a CPU executing in transactional mode, i.e.
Addr getBlockAddr(unsigned int blk_size) const
RequestPtr req
A pointer to the original request.
unsigned size
The size of the request or transfer.
uint64_t getUintX(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness and zero-extended to 64 bits.
bool isExpressSnoop() const
bool _isSecure
True if the request targets the secure memory space.
const T * getConstPtr() const
bool matchBlockAddr(const Addr addr, const bool is_secure, const int blk_size) const
Check if packet corresponds to a given block-aligned address and address space.
HtmCacheFailure htmReturnReason
Holds the return status of the transaction.
void setHtmTransactional(uint64_t val)
Stipulates that this packet/request originates in the CPU executing in transactional mode,...
void makeHtmTransactionalReqResponse(const HtmCacheFailure ret_code)
Communicates to the core that a packet was processed by the memory subsystem while running in transac...
bool cacheResponding() const
MemCmd cmd
The command field of the packet.
bool htmTransactionFailedInCache() const
Returns whether or not this packet/request has returned from the cache hierarchy in a failed transact...
uint64_t htmTransactionUid
A global unique identifier of the transaction.
Abstract base class for objects which support being printed to a stream for debugging.
virtual void print(std::ostream &os, int verbosity=0, const std::string &prefix="") const =0
AddrRange RangeSize(Addr start, Addr size)
void set(Type mask)
Set all flag's bits matching the given mask.
bool isSet(Type mask) const
Verifies whether any bit matching the given mask is set.
void clear()
Clear all flag's bits.
#define panic(...)
This implements a cprintf based panic() function.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
T safe_cast(U &&ref_or_ptr)
std::pair< std::uint64_t, bool > getUintX(const void *buf, std::size_t bytes, ByteOrder endian)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
bool setUintX(std::uint64_t val, void *buf, std::size_t bytes, ByteOrder endian)
void ccprintf(cp::Print &print)
Overload hash function for BasicBlockRange type.
Declaration of the Packet class.
An entry in the label stack.
LabelStackEntry(const std::string &_label, std::string *_prefix)
A virtual base opaque structure used to hold state associated with the packet (e.g....
SenderState * predecessor