inorder: fetch thread bug
authorKorey Sewell <ksewell@umich.edu>
Sun, 31 Jan 2010 23:26:54 +0000 (18:26 -0500)
committerKorey Sewell <ksewell@umich.edu>
Sun, 31 Jan 2010 23:26:54 +0000 (18:26 -0500)
dont check total # of threads but instead all
active threads

src/cpu/inorder/cpu.hh
src/cpu/inorder/first_stage.cc

index f4f7cb39061485f15341986684423f7fd82428ec..7ac433723405a1051d7359baa737aca5573d50c8 100644 (file)
@@ -611,7 +611,7 @@ class InOrderCPU : public BaseCPU
         if (numActiveThreads() > 0)
             return activeThreads.front();
         else
-            return -1;
+            return InvalidThreadID;
     }
     
      
index 1427ca46acf061016ed9a6015c3167de849f796d..75e13e559e77291c7bbb74c0955e20e32331e850 100644 (file)
@@ -205,11 +205,12 @@ FirstStage::processInsts(ThreadID tid)
 ThreadID
 FirstStage::getFetchingThread(FetchPriority &fetch_priority)
 {
-    if (numThreads > 1) {
-        switch (fetch_priority) {
+    ThreadID num_active_threads = cpu->numActiveThreads();
 
+    if (num_active_threads > 1) {
+        switch (fetch_priority) {
           case SingleThread:
-            return 0;
+            return cpu->activeThreadId();
 
           case RoundRobin:
             return roundRobin();
@@ -217,7 +218,7 @@ FirstStage::getFetchingThread(FetchPriority &fetch_priority)
           default:
             return InvalidThreadID;
         }
-    } else {
+    } else if (num_active_threads == 1) {
         ThreadID tid = *activeThreads->begin();
 
         if (stageStatus[tid] == Running ||
@@ -226,8 +227,9 @@ FirstStage::getFetchingThread(FetchPriority &fetch_priority)
         } else {
             return InvalidThreadID;
         }
-    }
-
+    } else {
+        return InvalidThreadID;
+    }    
 }
 
 ThreadID