cpu: Use request flags in trace playback
authorAndreas Hansson <andreas.hansson@arm.com>
Mon, 22 Apr 2013 17:20:33 +0000 (13:20 -0400)
committerAndreas Hansson <andreas.hansson@arm.com>
Mon, 22 Apr 2013 17:20:33 +0000 (13:20 -0400)
This patch changes the TraceGen such that it uses the optional request
flags from the protobuf trace if they are present.

src/cpu/testers/traffic_gen/generators.cc
src/cpu/testers/traffic_gen/generators.hh

index 5cf40b2e67d2a06ae2626d2b229b9eb3b3e59b53..7fec2a34a425d77bf09a39a17757dde7974dd62f 100644 (file)
@@ -50,10 +50,10 @@ BaseGen::BaseGen(QueuedMasterPort& _port, MasterID master_id, Tick _duration)
 }
 
 void
-BaseGen::send(Addr addr, unsigned size, const MemCmd& cmd)
+BaseGen::send(Addr addr, unsigned size, const MemCmd& cmd,
+              Request::FlagsType flags)
 {
     // Create new request
-    Request::Flags flags;
     Request *req = new Request(addr, size, flags, masterID);
 
     // Embed it in a packet
@@ -215,6 +215,8 @@ TraceGen::InputStream::read(TraceElement& element)
         element.addr = pkt_msg.addr();
         element.blocksize = pkt_msg.size();
         element.tick = pkt_msg.tick();
+        if (pkt_msg.has_flags())
+            element.flags = pkt_msg.flags();
         return true;
     }
 
@@ -280,14 +282,15 @@ TraceGen::execute()
     // state graph from executing the state if it should not
     assert(currElement.isValid());
 
-    DPRINTF(TrafficGen, "TraceGen::execute: %c %d %d %d\n",
+    DPRINTF(TrafficGen, "TraceGen::execute: %c %d %d %d 0x%x\n",
             currElement.cmd.isRead() ? 'r' : 'w',
             currElement.addr,
             currElement.blocksize,
-            currElement.tick);
+            currElement.tick,
+            currElement.flags);
 
     send(currElement.addr + addrOffset, currElement.blocksize,
-         currElement.cmd);
+         currElement.cmd, currElement.flags);
 }
 
 void
index 899a3c07815f18643b442fbbbaf3f6cfbc30c8da..b6c70037ac13c27cdc701185d274ee2dbbb328f5 100644 (file)
@@ -75,8 +75,10 @@ class BaseGen
      * @param addr Physical address to use
      * @param size Size of the request
      * @param cmd Memory command to send
+     * @param flags Optional request flags
      */
-    void send(Addr addr, unsigned size, const MemCmd& cmd);
+    void send(Addr addr, unsigned size, const MemCmd& cmd,
+              Request::FlagsType flags = 0);
 
   public:
 
@@ -328,6 +330,9 @@ class TraceGen : public BaseGen
         /** The time at which the request should be sent */
         Tick tick;
 
+        /** Potential request flags to use */
+        Request::FlagsType flags;
+
         /**
          * Check validity of this element.
          *