86a87,93
> // Error responses
> // @TODO these should be classified as responses rather than
> // requests; coding them as requests initially for backwards
> // compatibility
> NetworkNackError, // nacked at network layer (not by protocol)
> InvalidDestError, // packet dest field invalid
> BadAddressError, // memory address invalid
105a113
> IsError, //!< Error response
138c146
< bool needsExclusive() const { return testCmdAttrib(NeedsExclusive); }
---
> bool needsExclusive() const { return testCmdAttrib(NeedsExclusive); }
143a152
> bool isError() const { return testCmdAttrib(IsError); }
186a196,201
> /** The command field of the packet. */
> MemCmd cmd;
>
> /** A pointer to the original request. */
> RequestPtr req;
>
225a241,247
> /** The original value of the command field. Only valid when the
> * current command field is an error condition; in that case, the
> * previous contents of the command field are copied here. This
> * field is *not* set on non-error responses.
> */
> MemCmd origCmd;
>
229a252
> bool destValid;
231c254,255
< enum SnoopFlag {
---
> enum Flag {
> // Snoop flags
234c258
< NUM_SNOOP_FLAGS
---
> NUM_PACKET_FLAGS
237,238c261,262
< /** Coherence snoopFlags for snooping */
< std::bitset<NUM_SNOOP_FLAGS> snoopFlags;
---
> /** Status flags */
> std::bitset<NUM_PACKET_FLAGS> flags;
255,270d278
< /** A pointer to the original request. */
< RequestPtr req;
<
< /** A virtual base opaque structure used to hold coherence-related
< * state. A specific subclass would be derived from this to
< * carry state specific to a particular coherence protocol. */
< class CoherenceState : public FastAlloc {
< public:
< virtual ~CoherenceState() {}
< };
<
< /** This packet's coherence state. Caches should use
< * dynamic_cast<> to cast to the state appropriate for the
< * system's coherence protocol. */
< CoherenceState *coherence;
<
287,291d294
< public:
<
< /** The command field of the packet. */
< MemCmd cmd;
<
299,300d301
< public:
<
305c306
< bool needsExclusive() const { return cmd.needsExclusive(); }
---
> bool needsExclusive() const { return cmd.needsExclusive(); }
310a312
> bool isError() const { return cmd.isError(); }
312,315c314,318
< void assertMemInhibit() { snoopFlags[MemInhibit] = true; }
< void assertShared() { snoopFlags[Shared] = true; }
< bool memInhibitAsserted() { return snoopFlags[MemInhibit]; }
< bool sharedAsserted() { return snoopFlags[Shared]; }
---
> // Snoop flags
> void assertMemInhibit() { flags[MemInhibit] = true; }
> void assertShared() { flags[Shared] = true; }
> bool memInhibitAsserted() { return flags[MemInhibit]; }
> bool sharedAsserted() { return flags[Shared]; }
316a320,327
> // Network error conditions... encapsulate them as methods since
> // their encoding keeps changing (from result field to command
> // field, etc.)
> void setNacked() { origCmd = cmd; cmd = MemCmd::NetworkNackError; }
> void setBadAddress() { origCmd = cmd; cmd = MemCmd::BadAddressError; }
> bool wasNacked() { return cmd == MemCmd::NetworkNackError; }
> bool hadBadAddress() { return cmd == MemCmd::BadAddressError; }
>
319,330d329
< /** Possible results of a packet's request. */
< enum Result
< {
< Success,
< BadAddress,
< Nacked,
< Unknown
< };
<
< /** The result of this packet's request. */
< Result result;
<
332c331
< short getSrc() const { assert(srcValid); return src; }
---
> short getSrc() const { assert(srcValid); return src; }
339,340c338,339
< short getDest() const { return dest; }
< void setDest(short _dest) { dest = _dest; }
---
> short getDest() const { assert(destValid); return dest; }
> void setDest(short _dest) { dest = _dest; destValid = true; }
343c342
< int getSize() const { assert(addrSizeValid); return size; }
---
> int getSize() const { assert(addrSizeValid); return size; }
346,348d344
< void addrOverride(Addr newAddr) { assert(addrSizeValid); addr = newAddr; }
< void cmdOverride(MemCmd newCmd) { cmd = newCmd; }
<
354c350,351
< : data(NULL), staticData(false), dynamicData(false), arrayData(false),
---
> : cmd(_cmd), req(_req),
> data(NULL), staticData(false), dynamicData(false), arrayData(false),
356,360c353,354
< addrSizeValid(_req->validPaddr), srcValid(false),
< snoopFlags(0),
< time(curTick),
< req(_req), coherence(NULL), senderState(NULL), cmd(_cmd),
< result(Unknown)
---
> addrSizeValid(_req->validPaddr), srcValid(false), destValid(true),
> flags(0), time(curTick), senderState(NULL)
368c362,363
< : data(NULL), staticData(false), dynamicData(false), arrayData(false),
---
> : cmd(_cmd), req(_req),
> data(NULL), staticData(false), dynamicData(false), arrayData(false),
370,374c365,366
< addrSizeValid(_req->validPaddr), srcValid(false),
< snoopFlags(0),
< time(curTick),
< req(_req), coherence(NULL), senderState(NULL), cmd(_cmd),
< result(Unknown)
---
> addrSizeValid(_req->validPaddr), srcValid(false), destValid(true),
> flags(0), time(curTick), senderState(NULL)
385c377,378
< : data(NULL), staticData(false), dynamicData(false), arrayData(false),
---
> : cmd(origPkt->cmd), req(origPkt->req),
> data(NULL), staticData(false), dynamicData(false), arrayData(false),
388,393c381,384
< addrSizeValid(origPkt->addrSizeValid), srcValid(origPkt->srcValid),
< snoopFlags(origPkt->snoopFlags),
< time(curTick),
< req(origPkt->req), coherence(origPkt->coherence),
< senderState(origPkt->senderState), cmd(origPkt->cmd),
< result(origPkt->result)
---
> addrSizeValid(origPkt->addrSizeValid),
> srcValid(origPkt->srcValid), destValid(origPkt->destValid),
> flags(origPkt->flags),
> time(curTick), senderState(origPkt->senderState)
408c399
< snoopFlags = 0;
---
> flags = 0;
413d403
< result = Unknown;
427c417
< void makeAtomicResponse()
---
> void makeResponse()
431d420
< assert(result == Unknown);
433c422,424
< result = Success;
---
> dest = src;
> destValid = srcValid;
> srcValid = false;
436,441c427
< /**
< * Perform the additional work required for timing responses above
< * and beyond atomic responses; i.e., change the destination to
< * point back to the requester and clear the source field.
< */
< void convertAtomicToTimingResponse()
---
> void makeAtomicResponse()
443,444c429
< dest = getSrc();
< srcValid = false;
---
> makeResponse();
447,450d431
< /**
< * Take a request packet and modify it in place to be suitable for
< * returning as a response to a timing request.
< */
453,454c434
< makeAtomicResponse();
< convertAtomicToTimingResponse();
---
> makeResponse();
465,467c445,448
< assert(needsResponse() && result == Nacked);
< dest = Broadcast;
< result = Unknown;
---
> assert(wasNacked());
> cmd = origCmd;
> assert(needsResponse());
> setDest(Broadcast);