inorder: multi-issue branch resolution
authorKorey Sewell <ksewell@umich.edu>
Fri, 4 Feb 2011 05:08:17 +0000 (00:08 -0500)
committerKorey Sewell <ksewell@umich.edu>
Fri, 4 Feb 2011 05:08:17 +0000 (00:08 -0500)
Only execute (resolve) one branch per cycle because handling more than one is
a little more complicated

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

index 9ba7a64c7bfaf2f7b15f859ceba10b63f24e8260..cae007debe8a1c6e659e3dcfc95b96c9c7ee6015 100644 (file)
@@ -41,7 +41,8 @@ using namespace ThePipeline;
 ExecutionUnit::ExecutionUnit(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)
+    : Resource(res_name, res_id, res_width, res_latency, _cpu),
+      lastExecuteTick(0), lastControlTick(0)
 { }
 
 void
@@ -55,8 +56,6 @@ ExecutionUnit::regStats()
         .name(name() + ".predictedNotTakenIncorrect")
         .desc("Number of Branches Incorrectly Predicted As Not Taken).");
 
-    lastExecuteCycle = curTick();
-
     executions
         .name(name() + ".executions")
         .desc("Number of Instructions Executed.");
@@ -98,14 +97,22 @@ ExecutionUnit::execute(int slot_num)
     {
       case ExecuteInst:
         {
-            if (curTick() != lastExecuteCycle) {
-                lastExecuteCycle = curTick();
+            if (curTick() != lastExecuteTick) {
+                lastExecuteTick = curTick();
             }
 
 
             if (inst->isMemRef()) {
                 panic("%s not configured to handle memory ops.\n", resName);
             } else if (inst->isControl()) {
+                if (lastControlTick == curTick()) {
+                    DPRINTF(InOrderExecute, "Can not Execute More than One Control "
+                            "Inst Per Cycle. Blocking Request.\n");
+                    exec_req->done(false);
+                    return;
+                }
+                lastControlTick = curTick();
+
                 // Evaluate Branch
                 fault = inst->execute();
                 executions++;
index 8be339f4a7240d703997944075221f2777a3fb76..a6694ddb5ebaf33b4529dfbc527db820abc08aaa 100644 (file)
@@ -74,7 +74,8 @@ class ExecutionUnit : public Resource {
     Stats::Scalar predictedCorrect;
     Stats::Formula mispredictPct;
     Stats::Scalar executions;
-    Tick lastExecuteCycle;
+    Tick lastExecuteTick;
+    Tick lastControlTick;
 };