Another thread number removed
[gem5.git] / src / mem / packet.hh
index 9511d43b5a6a3193510a50abc843aa6490289597..be9bf5f57e8c7b641dfbfdd2e8d927d116e69598 100644 (file)
@@ -42,6 +42,7 @@
 #include "sim/host.hh"
 #include "sim/root.hh"
 #include <list>
+#include <cassert>
 
 struct Packet;
 typedef Packet* PacketPtr;
@@ -55,6 +56,7 @@ typedef std::list<PacketPtr> PacketList;
 #define CACHE_LINE_FILL 1 << 3
 #define COMPRESSED 1 << 4
 #define NO_ALLOCATE 1 << 5
+#define SNOOP_COMMIT 1 << 6
 
 //For statistics we need max number of commands, hard code it at
 //20 for now.  @todo fix later
@@ -222,7 +224,7 @@ class Packet
     bool isNoAllocate() { return (flags & NO_ALLOCATE) != 0; }
     bool isCompressed() { return (flags & COMPRESSED) != 0; }
 
-    bool nic_pkt() { assert("Unimplemented\n" && 0); }
+    bool nic_pkt() { assert("Unimplemented\n" && 0); return false; }
 
     /** Possible results of a packet's request. */
     enum Result
@@ -265,6 +267,7 @@ class Packet
            result(Unknown)
     {
         flags = 0;
+        time = curTick;
     }
 
     /** Alternate constructor if you are trying to create a packet with
@@ -279,6 +282,7 @@ class Packet
            result(Unknown)
     {
         flags = 0;
+        time = curTick;
     }
 
     /** Destructor. */
@@ -294,6 +298,7 @@ class Packet
         assert(req->validPaddr);
         addr = req->paddr;
         size = req->size;
+        time = req->time;
         addrSizeValid = true;
         result = Unknown;
         if (dynamicData) {
@@ -307,7 +312,7 @@ class Packet
      *   for returning as a response to that request.  Used for timing
      *   accesses only.  For atomic and functional accesses, the
      *   request packet is always implicitly passed back *without*
-     *   modifying the command or destination fields, so this function
+     *   modifying the destination fields, so this function
      *   should not be called. */
     void makeTimingResponse() {
         assert(needsResponse());
@@ -320,6 +325,18 @@ class Packet
         srcValid = false;
     }
 
+    /** Take a request packet and modify it in place to be suitable
+     *   for returning as a response to that request.
+     */
+    void makeAtomicResponse() {
+        assert(needsResponse());
+        assert(isRequest());
+        int icmd = (int)cmd;
+        icmd &= ~(IsRequest);
+        icmd |= IsResponse;
+        cmd = (Command)icmd;
+    }
+
     /** Take a request packet that has been returned as NACKED and modify it so
      * that it can be sent out again. Only packets that need a response can be
      * NACKED, so verify that that is true. */