inorder: update graduation unit
authorKorey Sewell <ksewell@umich.edu>
Fri, 18 Feb 2011 19:30:05 +0000 (14:30 -0500)
committerKorey Sewell <ksewell@umich.edu>
Fri, 18 Feb 2011 19:30:05 +0000 (14:30 -0500)
make sure instructions are able to commit before writing back to the RF
do not commit more than 1 non-speculative instruction per cycle

src/cpu/inorder/cpu.cc
src/cpu/inorder/resources/graduation_unit.cc
src/cpu/inorder/resources/graduation_unit.hh

index 4130b9e142667a040f7635d695705e747d4066a8..0ec4c9861927226677498e257b4f485f938ab65a 100644 (file)
@@ -465,12 +465,12 @@ InOrderCPU::createBackEndSked(DynInstPtr inst)
         W.needs(ExecUnit, ExecutionUnit::ExecuteInst);
     }
 
+    W.needs(Grad, GraduationUnit::GraduateInst);
+
     for (int idx=0; idx < inst->numDestRegs(); idx++) {
         W.needs(RegManager, UseDefUnit::WriteDestReg, idx);
     }
 
-    W.needs(Grad, GraduationUnit::GraduateInst);
-
     // Insert Back Schedule into our cache of
     // resource schedules
     addToSkedCache(inst, res_sked);
index 68adcbd1d583d75b58b0f7848c09603045abd4af..edc2fb3ff7523ff039c5186ca71dd2f0dbfb230c 100644 (file)
@@ -37,8 +37,7 @@ GraduationUnit::GraduationUnit(std::string res_name, int res_id, int res_width,
                                int res_latency, InOrderCPU *_cpu,
                                ThePipeline::Params *params)
     : Resource(res_name, res_id, res_width, res_latency, _cpu),
-      lastCycleGrad(0), numCycleGrad(0)
-      
+      lastNonSpecTick(0)
 {
     for (ThreadID tid = 0; tid < ThePipeline::MaxThreads; tid++) {
         nonSpecInstActive[tid] = &cpu->nonSpecInstActive[tid];
@@ -58,15 +57,18 @@ GraduationUnit::execute(int slot_num)
     {
       case GraduateInst:
         {
-            // Make sure this is the last thing on the resource schedule
-            // @todo: replace this check
-            // assert(inst->resSched.size() == 1);
+            if (lastNonSpecTick == curTick()) {
+                DPRINTF(InOrderGraduation, "Unable to graduate [sn:%i]. "
+                        "Only 1 nonspec inst. per cycle can graduate.\n");
+                grad_req->done(false);
+                return;
+            }
 
-             // Handle Any Faults Before Graduating Instruction
+            // Handle Any Faults Before Graduating Instruction
             if (inst->fault != NoFault) {
                 cpu->trap(inst->fault, tid, inst);
                 grad_req->setCompleted(false);
-                 return;
+                return;
             }
 
             DPRINTF(InOrderGraduation,
@@ -81,6 +83,7 @@ GraduationUnit::execute(int slot_num)
                 DPRINTF(InOrderGraduation,
                         "[tid:%i] Non-speculative inst [sn:%i] graduated\n",
                         tid, inst->seqNum);
+                lastNonSpecTick = curTick();
             }
 
             if (inst->traceData) {
index aae41993fc4e86c699ac04c5fa48a4cd3e8fc1a9..59631bfcbb8b4f96b682d134190f02f7dcd016ee 100644 (file)
@@ -57,9 +57,7 @@ class GraduationUnit : public Resource {
     void execute(int slot_num);
 
   protected:
-    Tick lastCycleGrad;
-    int numCycleGrad;
-
+    Tick lastNonSpecTick;
     bool *nonSpecInstActive[ThePipeline::MaxThreads];
 
     InstSeqNum *nonSpecSeqNum[ThePipeline::MaxThreads];