inorder: update event priorities
authorKorey Sewell <ksewell@umich.edu>
Mon, 20 Jun 2011 01:43:36 +0000 (21:43 -0400)
committerKorey Sewell <ksewell@umich.edu>
Mon, 20 Jun 2011 01:43:36 +0000 (21:43 -0400)
dont use offset to calculate this but rather an enum
that can be updated

src/cpu/inorder/cpu.cc
src/cpu/inorder/cpu.hh
src/cpu/inorder/resource_pool.cc
src/cpu/inorder/resource_pool.hh
src/cpu/inorder/resources/fetch_seq_unit.cc

index e0e4d9a158c486b9463371e6adf22b8f61b08493..dbee7f46c9688caa2676d6692f6a8361dae8d060 100644 (file)
@@ -90,9 +90,8 @@ InOrderCPU::TickEvent::description()
 
 InOrderCPU::CPUEvent::CPUEvent(InOrderCPU *_cpu, CPUEventType e_type,
                                Fault fault, ThreadID _tid, DynInstPtr inst,
-                               unsigned event_pri_offset)
-    : Event(Event::Priority((unsigned int)CPU_Tick_Pri + event_pri_offset)),
-      cpu(_cpu)
+                               CPUEventPri event_pri)
+    : Event(event_pri), cpu(_cpu)
 {
     setEvent(e_type, fault, _tid, inst);
 }
@@ -836,10 +835,10 @@ InOrderCPU::squashDueToMemStall(int stage_num, InstSeqNum seq_num,
 void
 InOrderCPU::scheduleCpuEvent(CPUEventType c_event, Fault fault,
                              ThreadID tid, DynInstPtr inst, 
-                             unsigned delay, unsigned event_pri_offset)
+                             unsigned delay, CPUEventPri event_pri)
 {
     CPUEvent *cpu_event = new CPUEvent(this, c_event, fault, tid, inst,
-                                       event_pri_offset);
+                                       event_pri);
 
     Tick sked_tick = nextCycle(curTick() + ticks(delay));
     if (delay >= 0) {
@@ -1064,7 +1063,7 @@ InOrderCPU::activateNextReadyContext(int delay)
     // threads after we've finished deactivating, squashing,etc.
     // other threads
     scheduleCpuEvent(ActivateNextReadyThread, NoFault, 0/*tid*/, dummyInst[0], 
-                     delay, 5);
+                     delay, ActivateNextReadyThread_Pri);
 
     // Be sure to signal that there's some activity so the CPU doesn't
     // deschedule itself.
index f60258c963c216950634a98830cd153fc6fc9820..051a790dbedfdabf8e710ad35691ed25bf8b0b41 100644 (file)
@@ -190,6 +190,11 @@ class InOrderCPU : public BaseCPU
 
     static std::string eventNames[NumCPUEvents];
 
+    enum CPUEventPri {
+        InOrderCPU_Pri                 = Event::CPU_Tick_Pri,
+        ActivateNextReadyThread_Pri    = Event::CPU_Tick_Pri + 10
+    };
+
     /** Define CPU Event */
     class CPUEvent : public Event
     {
@@ -206,7 +211,7 @@ class InOrderCPU : public BaseCPU
       public:
         /** Constructs a CPU event. */
         CPUEvent(InOrderCPU *_cpu, CPUEventType e_type, Fault fault,
-                 ThreadID _tid, DynInstPtr inst, unsigned event_pri_offset);
+                 ThreadID _tid, DynInstPtr inst, CPUEventPri event_pri);
 
         /** Set Type of Event To Be Scheduled */
         void setEvent(CPUEventType e_type, Fault _fault, ThreadID _tid,
@@ -235,7 +240,7 @@ class InOrderCPU : public BaseCPU
     /** Schedule a CPU Event */
     void scheduleCpuEvent(CPUEventType cpu_event, Fault fault, ThreadID tid,
                           DynInstPtr inst, unsigned delay = 0,
-                          unsigned event_pri_offset = 0);
+                          CPUEventPri event_pri = InOrderCPU_Pri);
 
   public:
     /** Interface between the CPU and CPU resources. */
index d5b3a5115021d99fca2da638a1d09d5b7e0475d5..0713783b3242d7a85538b09da6f2dffcf2fa682b 100644 (file)
@@ -508,7 +508,7 @@ ResourcePool::ResPoolEvent::ResPoolEvent(ResourcePool *_resPool,
                                          int stage_num,
                                          InstSeqNum seq_num,
                                          ThreadID _tid)
-    : Event(CPU_Tick_Pri), resPool(_resPool),
+    : Event(ResPool_Pri), resPool(_resPool),
       eventType(e_type), inst(_inst), seqNum(seq_num),
       stageNum(stage_num), tid(_tid)
 { }
index 85c0f70f6dd6e4ad439889f7a54d66f18cd2e53c..51eb413384d7d2d374b183d1f21f73aa05360d99 100644 (file)
@@ -67,6 +67,10 @@ class ResourcePool {
         Default
     };
 
+    enum ResPoolEventPri {
+        ResPool_Pri =  InOrderCPU::InOrderCPU_Pri - 5
+    };
+
     class ResPoolEvent : public Event
     {
       protected:
index 024f38fdda91041ca387a6fd99b2594dbab80f86..b79b17cdc1f34af32ba179748084006a29bbdfd7 100644 (file)
@@ -165,7 +165,8 @@ FetchSeqUnit::squash(DynInstPtr inst, int squash_stage,
             // A Trap Caused This Fault and will update the pc state
             // when done trapping
             DPRINTF(InOrderFetchSeq, "[tid:%i] Blocking due to fault @ "
-                    "[sn:%i].\n", inst->seqNum);
+                    "[sn:%i].%s %s \n", inst->seqNum,
+                    inst->instName(), inst->pcState());
             pcValid[tid] = false;
         } else {
             TheISA::PCState nextPC;