- 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; }
-
- bool nic_pkt() { panic("Unimplemented"); M5_DUMMY_RETURN }
-
- /** Accessor function that returns the source index of the packet. */
- short getSrc() const { assert(srcValid); return src; }
- void setSrc(short _src) { src = _src; srcValid = true; }
- /** Reset source field, e.g. to retransmit packet on different bus. */
- void clearSrc() { srcValid = false; }
-
- /** Accessor function that returns the destination index of
- the packet. */
- short getDest() const { assert(destValid); return dest; }
- void setDest(short _dest) { dest = _dest; destValid = true; }
-
- Addr getAddr() const { assert(addrSizeValid); return addr; }
- int getSize() const { assert(addrSizeValid); return size; }
- Addr getOffset(int blkSize) const { return addr & (Addr)(blkSize - 1); }
-
- /** Constructor. Note that a Request object must be constructed
- * first, but the Requests's physical address and size fields
- * need not be valid. The command and destination addresses
- * must be supplied. */
- Packet(Request *_req, MemCmd _cmd, short _dest)
- : cmd(_cmd), req(_req),
- data(NULL), staticData(false), dynamicData(false), arrayData(false),
- addr(_req->paddr), size(_req->size), dest(_dest),
- addrSizeValid(_req->validPaddr), srcValid(false), destValid(true),
- flags(0), time(curTick), senderState(NULL)
+ void
+ setNacked()
+ {
+ assert(isResponse());
+ cmd = MemCmd::NetworkNackError;
+ }
+
+ void
+ setBadAddress()
+ {
+ assert(isResponse());
+ cmd = MemCmd::BadAddressError;
+ }
+
+ bool wasNacked() const { return cmd == MemCmd::NetworkNackError; }
+ bool hadBadAddress() const { return cmd == MemCmd::BadAddressError; }
+ void copyError(Packet *pkt) { assert(pkt->isError()); cmd = pkt->cmd; }
+
+ /// Accessor function to get the source index of the packet.
+ NodeID getSrc() const { assert(flags.isSet(VALID_SRC)); return src; }
+ /// Accessor function to set the source index of the packet.
+ void setSrc(NodeID _src) { src = _src; flags.set(VALID_SRC); }
+ /// Reset source field, e.g. to retransmit packet on different bus.
+ void clearSrc() { flags.clear(VALID_SRC); }
+
+ /// Accessor function for the destination index of the packet.
+ NodeID getDest() const { assert(flags.isSet(VALID_DST)); return dest; }
+ /// Accessor function to set the destination index of the packet.
+ void setDest(NodeID _dest) { dest = _dest; flags.set(VALID_DST); }
+
+ Addr getAddr() const { assert(flags.isSet(VALID_ADDR)); return addr; }
+ int getSize() const { assert(flags.isSet(VALID_SIZE)); return size; }
+ Addr getOffset(int blkSize) const { return getAddr() & (Addr)(blkSize - 1); }
+
+ /**
+ * Constructor. Note that a Request object must be constructed
+ * first, but the Requests's physical address and size fields need
+ * not be valid. The command and destination addresses must be
+ * supplied.
+ */
+ Packet(Request *_req, MemCmd _cmd, NodeID _dest)
+ : flags(VALID_DST), cmd(_cmd), req(_req), data(NULL),
+ dest(_dest), time(curTick), senderState(NULL)