65 #define SET1(a1) (1 << (a1)) 66 #define SET2(a1, a2) (SET1(a1) | SET1(a2)) 67 #define SET3(a1, a2, a3) (SET2(a1, a2) | SET1(a3)) 68 #define SET4(a1, a2, a3, a4) (SET3(a1, a2, a3) | SET1(a4)) 69 #define SET5(a1, a2, a3, a4, a5) (SET4(a1, a2, a3, a4) | SET1(a5)) 70 #define SET6(a1, a2, a3, a4, a5, a6) (SET5(a1, a2, a3, a4, a5) | SET1(a6)) 71 #define SET7(a1, a2, a3, a4, a5, a6, a7) (SET6(a1, a2, a3, a4, a5, a6) | \ 78 { 0, InvalidCmd,
"InvalidCmd" },
81 {
SET3(IsRead, IsRequest, NeedsResponse), ReadResp,
"ReadReq" },
83 {
SET3(IsRead, IsResponse, HasData), InvalidCmd,
"ReadResp" },
85 {
SET4(IsRead, IsResponse, HasData, IsInvalidate),
86 InvalidCmd,
"ReadRespWithInvalidate" },
88 {
SET5(IsWrite, NeedsWritable, IsRequest, NeedsResponse, HasData),
89 WriteResp,
"WriteReq" },
91 {
SET2(IsWrite, IsResponse), InvalidCmd,
"WriteResp" },
93 {
SET5(IsWrite, IsRequest, IsEviction, HasData, FromCache),
94 InvalidCmd,
"WritebackDirty" },
98 {
SET5(IsWrite, IsRequest, IsEviction, HasData, FromCache),
99 InvalidCmd,
"WritebackClean" },
102 {
SET4(IsWrite, IsRequest, HasData, FromCache), InvalidCmd,
"WriteClean" },
104 {
SET3(IsRequest, IsEviction, FromCache), InvalidCmd,
"CleanEvict" },
106 {
SET4(IsRead, IsRequest, IsSWPrefetch, NeedsResponse),
107 SoftPFResp,
"SoftPFReq" },
109 {
SET6(IsRead, NeedsWritable, IsInvalidate, IsRequest,
110 IsSWPrefetch, NeedsResponse), SoftPFResp,
"SoftPFExReq" },
112 {
SET5(IsRead, IsRequest, IsHWPrefetch, NeedsResponse, FromCache),
113 HardPFResp,
"HardPFReq" },
115 {
SET4(IsRead, IsResponse, IsSWPrefetch, HasData),
116 InvalidCmd,
"SoftPFResp" },
118 {
SET4(IsRead, IsResponse, IsHWPrefetch, HasData),
119 InvalidCmd,
"HardPFResp" },
121 {
SET5(IsWrite, NeedsWritable, IsRequest, NeedsResponse, HasData),
122 WriteResp,
"WriteLineReq" },
124 {
SET6(IsInvalidate, NeedsWritable, IsUpgrade, IsRequest, NeedsResponse,
126 UpgradeResp,
"UpgradeReq" },
128 {
SET7(IsInvalidate, NeedsWritable, IsUpgrade, IsLlsc,
129 IsRequest, NeedsResponse, FromCache),
130 UpgradeResp,
"SCUpgradeReq" },
132 {
SET2(IsUpgrade, IsResponse),
133 InvalidCmd,
"UpgradeResp" },
135 {
SET7(IsRead, NeedsWritable, IsInvalidate,
136 IsLlsc, IsRequest, NeedsResponse, FromCache),
137 UpgradeFailResp,
"SCUpgradeFailReq" },
140 {
SET3(IsRead, IsResponse, HasData),
141 InvalidCmd,
"UpgradeFailResp" },
145 {
SET6(IsRead, NeedsWritable, IsInvalidate, IsRequest, NeedsResponse,
147 ReadExResp,
"ReadExReq" },
150 {
SET3(IsRead, IsResponse, HasData),
151 InvalidCmd,
"ReadExResp" },
155 {
SET4(IsRead, IsRequest, NeedsResponse, FromCache),
156 ReadResp,
"ReadCleanReq" },
160 {
SET4(IsRead, IsRequest, NeedsResponse, FromCache),
161 ReadResp,
"ReadSharedReq" },
164 {
SET4(IsRead, IsLlsc, IsRequest, NeedsResponse),
165 ReadResp,
"LoadLockedReq" },
167 {
SET6(IsWrite, NeedsWritable, IsLlsc,
168 IsRequest, NeedsResponse, HasData),
169 StoreCondResp,
"StoreCondReq" },
171 {
SET6(IsWrite, NeedsWritable, IsLlsc,
172 IsRequest, NeedsResponse, HasData),
173 StoreCondResp,
"StoreCondFailReq" },
175 {
SET3(IsWrite, IsLlsc, IsResponse),
176 InvalidCmd,
"StoreCondResp" },
178 {
SET6(IsRead, IsWrite, NeedsWritable, IsRequest, HasData, NeedsResponse),
179 SwapResp,
"SwapReq" },
181 {
SET4(IsRead, IsWrite, IsResponse, HasData),
182 InvalidCmd,
"SwapResp" },
183 { 0, InvalidCmd,
"Deprecated_MessageReq" },
184 { 0, InvalidCmd,
"Deprecated_MessageResp" },
186 {
SET2(IsRequest, NeedsResponse), MemFenceResp,
"MemFenceReq"},
188 {
SET1(IsResponse), InvalidCmd,
"MemFenceResp"},
192 {
SET4(IsRequest, IsClean, NeedsResponse, FromCache),
193 CleanSharedResp,
"CleanSharedReq" },
197 {
SET2(IsResponse, IsClean), InvalidCmd,
"CleanSharedResp" },
200 {
SET5(IsRequest, IsInvalidate, IsClean, NeedsResponse, FromCache),
201 CleanInvalidResp,
"CleanInvalidReq" },
205 {
SET3(IsResponse, IsInvalidate, IsClean),
206 InvalidCmd,
"CleanInvalidResp" },
208 {
SET2(IsResponse, IsError), InvalidCmd,
"InvalidDestError" },
210 {
SET2(IsResponse, IsError), InvalidCmd,
"BadAddressError" },
212 {
SET3(IsRead, IsResponse, IsError), InvalidCmd,
"FunctionalReadError" },
214 {
SET3(IsWrite, IsResponse, IsError), InvalidCmd,
"FunctionalWriteError" },
216 {
SET2(IsRequest, IsPrint), InvalidCmd,
"PrintReq" },
218 {
SET3(IsRequest, IsFlush, NeedsWritable), InvalidCmd,
"FlushReq" },
220 {
SET5(IsInvalidate, IsRequest, NeedsWritable, NeedsResponse, FromCache),
221 InvalidateResp,
"InvalidateReq" },
223 {
SET2(IsInvalidate, IsResponse),
224 InvalidCmd,
"InvalidateResp" }
240 const Addr val_end = val_start + size - 1;
242 if (is_secure !=
_isSecure || func_start > val_end ||
243 val_start > func_end) {
261 const Addr val_offset = func_start > val_start ?
262 func_start - val_start : 0;
263 const Addr func_offset = func_start < val_start ?
264 val_start - func_start : 0;
265 const Addr overlap_size = std::min(val_end, func_end)+1 -
266 std::max(val_start, func_start);
269 std::memcpy(getPtr<uint8_t>() + func_offset,
279 bool all_bytes_valid =
true;
284 for (; all_bytes_valid && i < func_offset; ++
i)
288 for (i = func_offset; i < func_offset + overlap_size; ++
i)
292 for (; all_bytes_valid && i <
getSize(); ++
i)
295 return all_bytes_valid;
297 std::memcpy(_data + val_offset,
298 getConstPtr<uint8_t>() + func_offset,
321 assert(sender_state != NULL);
341 return (uint64_t)get<uint8_t>(endian);
343 return (uint64_t)get<uint16_t>(endian);
345 return (uint64_t)get<uint32_t>(endian);
347 return (uint64_t)get<uint64_t>(endian);
358 set<uint8_t>((uint8_t)w, endian);
361 set<uint16_t>((uint16_t)w, endian);
364 set<uint32_t>((uint32_t)w, endian);
367 set<uint64_t>((uint64_t)w, endian);
377 const std::string &prefix)
const 381 req->isSecure() ?
" (s)" :
"",
382 req->isInstFetch() ?
" IF" :
"",
383 req->isUncacheable() ?
" UC" :
"",
385 req->isToPOC() ?
" PoC" :
"",
386 req->isToPOU() ?
" PoU" :
"");
391 std::ostringstream str;
398 const int blk_size)
const 423 : curPrefixPtr(new
std::string(
"")),
os(_os), verbosity(_verbosity)
437 std::string *_prefix)
438 : label(_label), prefix(_prefix), labelPrinted(false)
444 const std::string &
prefix)
467 if (!i->labelPrinted) {
468 ccprintf(
os,
"%s%s\n", *(i->prefix), i->label);
469 i->labelPrinted =
true;
#define panic(...)
This implements a cprintf based panic() function.
void ccprintf(cp::Print &print)
AddrRange RangeSize(Addr start, Addr size)
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.
bool isExpressSnoop() const
Object used to maintain state of a PrintReq.
LabelStackEntry(const std::string &_label, std::string *_prefix)
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.
#define SET4(a1, a2, a3, a4)
bool cacheResponding() const
Overload hash function for BasicBlockRange type.
static const CommandInfo commandInfo[]
Array to map Command enum to associated info.
const std::string & curPrefix()
Returns the current line prefix.
void popLabel()
Pop a label off the label stack.
PrintReqState(std::ostream &os, int verbosity=0)
uint64_t getUintX(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness and zero-extended to 64 bits...
Addr getBlockAddr(unsigned int blk_size) const
RequestPtr req
A pointer to the original request.
#define SET7(a1, a2, a3, a4, a5, a6, a7)
std::string print() const
A no-args wrapper of print(std::ostream...) meant to be invoked from DPRINTFs avoiding string overhea...
Structure that defines attributes and other data associated with a Command.
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
An entry in the label stack.
unsigned size
The size of the request or transfer.
SenderState * predecessor
bool trySatisfyFunctional(PacketPtr other)
Check a functional request against a memory value stored in another packet (i.e.
void printLabels()
Print all of the pending unprinted labels on the stack.
void copyResponderFlags(const PacketPtr pkt)
Copy the reponse flags from an input packet to this packet.
AddrRange getAddrRange() const
Get address range to which this packet belongs.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
bool _isSecure
True if the request targets the secure memory space.
Addr addr
The address of the request.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
std::string * curPrefixPtr
Abstract base class for objects which support being printed to a stream for debugging.
A virtual base opaque structure used to hold state associated with the packet (e.g., an MSHR), specific to a SimObject that sees the packet.
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...
Declaration of the Packet class.
SenderState * senderState
This packet's sender state.
#define SET6(a1, a2, a3, a4, a5, a6)
#define SET5(a1, a2, a3, a4, a5)
virtual void print(std::ostream &os, int verbosity=0, const std::string &prefix="") const =0
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...
SenderState * popSenderState()
Pop the top of the state stack and return a pointer to it.
const std::string & cmdString() const
Return the string name of the cmd field (for debugging and tracing).
bool matchAddr(const Addr addr, const bool is_secure) const
Check if packet corresponds to a given address and address space.
void printObj(Printable *obj)
Print a Printable object to os, because it matched the address on a PrintReq.