# HG changeset patch
# User Korey Sewell <[email protected]>
# Date 1254427253 14400
# Node ID 4d6c328347dba262318a88bb64198cd1fa3aee13
# Parent  73271f740215297fd95d0022137ed70bace5f906
inorder: fetch thread bug
dont check total # of threads but instead all
active threads

diff --git a/src/cpu/inorder/cpu.hh b/src/cpu/inorder/cpu.hh
--- a/src/cpu/inorder/cpu.hh
+++ b/src/cpu/inorder/cpu.hh
@@ -602,7 +602,7 @@
         if (numActiveThreads() > 0)
             return activeThreads.front();
         else
-            return -1;
+            return InvalidThreadID;
     }
     
      
diff --git a/src/cpu/inorder/first_stage.cc b/src/cpu/inorder/first_stage.cc
--- a/src/cpu/inorder/first_stage.cc
+++ b/src/cpu/inorder/first_stage.cc
@@ -210,11 +210,12 @@
 ThreadID
 FirstStage::getFetchingThread(FetchPriority &fetch_priority)
 {
-    if (numThreads > 1) {
+    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();
@@ -222,7 +223,7 @@
           default:
             return InvalidThreadID;
         }
-    } else {
+    } else if (num_active_threads == 1) {
         ThreadID tid = *activeThreads->begin();
 
         if (stageStatus[tid] == Running ||
@@ -231,8 +232,9 @@
         } else {
             return InvalidThreadID;
         }
-    }
-
+    } else {
+        return InvalidThreadID;
+    }    
 }
 
 ThreadID
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to