63 #define SET1(a1) (1 << (a1))
64 #define SET2(a1, a2) (SET1(a1) | SET1(a2))
65 #define SET3(a1, a2, a3) (SET2(a1, a2) | SET1(a3))
66 #define SET4(a1, a2, a3, a4) (SET3(a1, a2, a3) | SET1(a4))
67 #define SET5(a1, a2, a3, a4, a5) (SET4(a1, a2, a3, a4) | SET1(a5))
68 #define SET6(a1, a2, a3, a4, a5, a6) (SET5(a1, a2, a3, a4, a5) | SET1(a6))
69 #define SET7(a1, a2, a3, a4, a5, a6, a7) (SET6(a1, a2, a3, a4, a5, a6) | \
76 { 0, InvalidCmd,
"InvalidCmd" },
79 {
SET3(IsRead, IsRequest, NeedsResponse), ReadResp,
"ReadReq" },
81 {
SET3(IsRead, IsResponse, HasData), InvalidCmd,
"ReadResp" },
83 {
SET4(IsRead, IsResponse, HasData, IsInvalidate),
84 InvalidCmd,
"ReadRespWithInvalidate" },
86 {
SET5(IsWrite, NeedsWritable, IsRequest, NeedsResponse, HasData),
87 WriteResp,
"WriteReq" },
89 {
SET2(IsWrite, IsResponse), InvalidCmd,
"WriteResp" },
91 {
SET5(IsWrite, IsRequest, IsEviction, HasData, FromCache),
92 InvalidCmd,
"WritebackDirty" },
96 {
SET5(IsWrite, IsRequest, IsEviction, HasData, FromCache),
97 InvalidCmd,
"WritebackClean" },
99 {
SET3(IsRequest, IsEviction, FromCache), InvalidCmd,
"CleanEvict" },
101 {
SET4(IsRead, IsRequest, IsSWPrefetch, NeedsResponse),
102 SoftPFResp,
"SoftPFReq" },
104 {
SET5(IsRead, IsRequest, IsHWPrefetch, NeedsResponse, FromCache),
105 HardPFResp,
"HardPFReq" },
107 {
SET4(IsRead, IsResponse, IsSWPrefetch, HasData),
108 InvalidCmd,
"SoftPFResp" },
110 {
SET4(IsRead, IsResponse, IsHWPrefetch, HasData),
111 InvalidCmd,
"HardPFResp" },
113 {
SET5(IsWrite, NeedsWritable, IsRequest, NeedsResponse, HasData),
114 WriteResp,
"WriteLineReq" },
116 {
SET6(IsInvalidate, NeedsWritable, IsUpgrade, IsRequest, NeedsResponse,
118 UpgradeResp,
"UpgradeReq" },
120 {
SET7(IsInvalidate, NeedsWritable, IsUpgrade, IsLlsc,
121 IsRequest, NeedsResponse, FromCache),
122 UpgradeResp,
"SCUpgradeReq" },
124 {
SET2(IsUpgrade, IsResponse),
125 InvalidCmd,
"UpgradeResp" },
127 {
SET7(IsRead, NeedsWritable, IsInvalidate,
128 IsLlsc, IsRequest, NeedsResponse, FromCache),
129 UpgradeFailResp,
"SCUpgradeFailReq" },
132 {
SET3(IsRead, IsResponse, HasData),
133 InvalidCmd,
"UpgradeFailResp" },
137 {
SET6(IsRead, NeedsWritable, IsInvalidate, IsRequest, NeedsResponse,
139 ReadExResp,
"ReadExReq" },
142 {
SET3(IsRead, IsResponse, HasData),
143 InvalidCmd,
"ReadExResp" },
147 {
SET4(IsRead, IsRequest, NeedsResponse, FromCache),
148 ReadResp,
"ReadCleanReq" },
152 {
SET4(IsRead, IsRequest, NeedsResponse, FromCache),
153 ReadResp,
"ReadSharedReq" },
156 {
SET4(IsRead, IsLlsc, IsRequest, NeedsResponse),
157 ReadResp,
"LoadLockedReq" },
159 {
SET6(IsWrite, NeedsWritable, IsLlsc,
160 IsRequest, NeedsResponse, HasData),
161 StoreCondResp,
"StoreCondReq" },
163 {
SET6(IsWrite, NeedsWritable, IsLlsc,
164 IsRequest, NeedsResponse, HasData),
165 StoreCondResp,
"StoreCondFailReq" },
167 {
SET3(IsWrite, IsLlsc, IsResponse),
168 InvalidCmd,
"StoreCondResp" },
170 {
SET6(IsRead, IsWrite, NeedsWritable, IsRequest, HasData, NeedsResponse),
171 SwapResp,
"SwapReq" },
173 {
SET4(IsRead, IsWrite, IsResponse, HasData),
174 InvalidCmd,
"SwapResp" },
176 {
SET4(IsWrite, IsRequest, NeedsResponse, HasData),
177 MessageResp,
"MessageReq" },
179 {
SET2(IsWrite, IsResponse), InvalidCmd,
"MessageResp" },
181 {
SET2(IsRequest, NeedsResponse), MemFenceResp,
"MemFenceReq"},
183 {
SET1(IsResponse), InvalidCmd,
"MemFenceResp"},
185 {
SET2(IsResponse, IsError), InvalidCmd,
"InvalidDestError" },
187 {
SET2(IsResponse, IsError), InvalidCmd,
"BadAddressError" },
189 {
SET3(IsRead, IsResponse, IsError), InvalidCmd,
"FunctionalReadError" },
191 {
SET3(IsWrite, IsResponse, IsError), InvalidCmd,
"FunctionalWriteError" },
193 {
SET2(IsRequest, IsPrint), InvalidCmd,
"PrintReq" },
195 {
SET3(IsRequest, IsFlush, NeedsWritable), InvalidCmd,
"FlushReq" },
197 {
SET5(IsInvalidate, IsRequest, NeedsWritable, NeedsResponse, FromCache),
198 InvalidateResp,
"InvalidateReq" },
200 {
SET2(IsInvalidate, IsResponse),
201 InvalidCmd,
"InvalidateResp" }
208 Addr func_start = getAddr();
209 Addr func_end = getAddr() + getSize() - 1;
211 Addr val_end = val_start + size - 1;
213 if (is_secure != _isSecure || func_start > val_end ||
214 val_start > func_end) {
234 int offset = func_start - val_start;
237 if (func_start >= val_start && func_end <= val_end) {
238 memcpy(getPtr<uint8_t>(), _data + offset, getSize());
239 if (bytesValid.empty())
240 bytesValid.resize(getSize(),
true);
251 if (val_start < func_start && val_end <= func_end) {
254 val_offset = func_start - val_start;
256 overlap_size = val_end - func_start;
257 }
else if (val_start >= func_start && val_end > func_end) {
261 func_offset = val_start - func_start;
262 overlap_size = func_end - val_start;
263 }
else if (val_start >= func_start && val_end <= func_end) {
268 func_offset = val_start - func_start;
270 }
else if (val_start < func_start && val_end > func_end) {
273 val_offset = func_start - val_start;
275 overlap_size = func_end - func_start;
277 panic(
"Missed a case for checkFunctional with "
278 " %s 0x%x size %d, against 0x%x size %d\n",
279 cmdString(), getAddr(), getSize(), addr, size);
283 uint8_t *dest = getPtr<uint8_t>() + func_offset;
284 uint8_t *src = _data + val_offset;
285 memcpy(dest, src, overlap_size);
289 if (bytesValid.empty())
290 bytesValid.resize(getSize(),
false);
293 bool all_bytes_valid =
true;
298 for (; all_bytes_valid && i < func_offset; ++
i)
299 all_bytes_valid &= bytesValid[i];
302 for (i = func_offset; i < func_offset + overlap_size; ++
i)
303 bytesValid[i] =
true;
306 for (; all_bytes_valid && i < getSize(); ++
i)
307 all_bytes_valid &= bytesValid[i];
309 return all_bytes_valid;
311 }
else if (isWrite()) {
313 memcpy(_data + offset, getConstPtr<uint8_t>(),
314 (min(func_end, val_end) - func_start) + 1);
317 memcpy(_data, getConstPtr<uint8_t>() - offset,
318 (min(func_end, val_end) - val_start) + 1);
321 panic(
"Don't know how to handle command %s\n", cmdString());
331 assert(sender_state != NULL);
333 senderState = sender_state;
339 assert(senderState != NULL);
347 Packet::print(ostream &o,
const int verbosity,
const string &prefix)
const
349 ccprintf(o,
"%s%s [%x:%x]%s%s%s%s", prefix, cmdString(),
350 getAddr(), getAddr() + getSize() - 1,
351 req->isSecure() ?
" (s)" :
"",
352 req->isInstFetch() ?
" IF" :
"",
353 req->isUncacheable() ?
" UC" :
"",
354 isExpressSnoop() ?
" ES" :
"");
365 : curPrefixPtr(new string(
"")),
os(_os), verbosity(_verbosity)
372 labelStack.pop_back();
373 assert(labelStack.empty());
379 : label(_label), prefix(_prefix), labelPrinted(false)
407 if (!i->labelPrinted) {
408 ccprintf(
os,
"%s%s\n", *(i->prefix), i->label);
409 i->labelPrinted =
true;
void ccprintf(cp::Print &print)
Object used to maintain state of a PrintReq.
LabelStackEntry(const std::string &_label, std::string *_prefix)
std::string print() const
A no-args wrapper of print(std::ostream...) meant to be invoked from DPRINTFs avoiding string overhea...
#define SET4(a1, a2, a3, a4)
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)
#define SET7(a1, a2, a3, a4, a5, a6, a7)
Structure that defines attributes and other data associated with a Command.
An entry in the label stack.
SenderState * predecessor
void printLabels()
Print all of the pending unprinted labels on the stack.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
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 MemObject that sees the packet.
bool checkFunctional(PacketPtr other)
Check a functional request against a memory value stored in another packet (i.e.
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.
#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.
void printObj(Printable *obj)
Print a Printable object to os, because it matched the address on a PrintReq.