CPU: move the PC Events code to a place where the code won't be executed multiple...
authorAli Saidi <saidi@eecs.umich.edu>
Thu, 14 Feb 2008 21:14:35 +0000 (16:14 -0500)
committerAli Saidi <saidi@eecs.umich.edu>
Thu, 14 Feb 2008 21:14:35 +0000 (16:14 -0500)
--HG--
extra : convert_revision : 19c8e46a4eea206517be7ed4131ab9df0fe00e68

src/cpu/simple/atomic.cc
src/cpu/simple/base.cc
src/cpu/simple/base.hh
src/cpu/simple/timing.cc

index 2254d44d5b9d5e361ed251815fbc131bd684c87a..23bd40b9b432685893f3c21a3d0ace79b9d6e7ba 100644 (file)
@@ -713,6 +713,8 @@ AtomicSimpleCPU::tick()
         if (!curStaticInst || !curStaticInst->isDelayedCommit())
             checkForInterrupts();
 
+        checkPcEventQueue();
+
         Fault fault = setupFetchRequest(&ifetch_req);
 
         if (fault == NoFault) {
index 367f38b8930610bf87cd456125a322b24633a214..4a91a9e122862182d595758ef3d7804ba1963419 100644 (file)
@@ -494,12 +494,6 @@ BaseSimpleCPU::advancePC(Fault fault)
             assert(thread->readNextPC() != thread->readNextNPC());
         }
     }
-
-    Addr oldpc;
-    do {
-        oldpc = thread->readPC();
-        system->pcEventQueue.service(tc);
-    } while (oldpc != thread->readPC());
 }
 
 /*Fault
index 82f73e5dd9566ef0e4992fba633ed1ecd51d43fc..8c162a8460b549d0cf3ea26f6e468ec9588a594b 100644 (file)
@@ -44,6 +44,7 @@
 #include "mem/port.hh"
 #include "mem/request.hh"
 #include "sim/eventq.hh"
+#include "sim/system.hh"
 
 // forward declarations
 #if FULL_SYSTEM
@@ -86,6 +87,14 @@ class BaseSimpleCPU : public BaseCPU
   protected:
     Trace::InstRecord *traceData;
 
+    inline void checkPcEventQueue() {
+        Addr oldpc;
+        do {
+            oldpc = thread->readPC();
+            system->pcEventQueue.service(tc);
+        } while (oldpc != thread->readPC());
+    }
+
   public:
     void post_interrupt(int int_num, int index);
 
index 9fe3d2fffec5e0b36b017b5fe1fad4d586cdcc3f..a76824ff31bc9962cb627d3e7b599119b071516c 100644 (file)
@@ -522,6 +522,8 @@ TimingSimpleCPU::fetch()
     if (!curStaticInst || !curStaticInst->isDelayedCommit())
         checkForInterrupts();
 
+    checkPcEventQueue();
+
     Request *ifetch_req = new Request();
     ifetch_req->setThreadContext(cpuId, /* thread ID */ 0);
     Fault fault = setupFetchRequest(ifetch_req);