inorder: addtl functionaly for inst. skeds
authorKorey Sewell <ksewell@umich.edu>
Mon, 20 Jun 2011 01:43:35 +0000 (21:43 -0400)
committerKorey Sewell <ksewell@umich.edu>
Mon, 20 Jun 2011 01:43:35 +0000 (21:43 -0400)
add find and end functions for inst. schedules
that can search by stage number

src/cpu/inorder/resource_sked.cc
src/cpu/inorder/resource_sked.hh

index 96b4f84b6e3c97a761ef961742849553dd08350f..e52ed8ff0294fdad989eabb5fed18662a3544c68 100644 (file)
@@ -90,6 +90,27 @@ ResourceSked::end()
     return stages[num_stages - 1].end();
 }
 
+ResourceSked::SkedIt
+ResourceSked::end(int stage_num)
+{
+    return stages[stage_num].end();
+}
+
+ResourceSked::SkedIt
+ResourceSked::find(int stage_num, int cmd)
+{
+    SkedIt stage_it = stages[stage_num].begin();
+    SkedIt stage_end = stages[stage_num].end();
+
+    while (stage_it != stage_end) {
+        if ((*stage_it)->cmd == cmd)
+            return stage_it;
+        stage_it++;
+    }
+
+    return stages[stage_num].end();
+}
+
 ScheduleEntry*
 ResourceSked::top()
 {
index 6338e8e9bbfeb1e88f90b15e2326bc87e06e8258..c44c2d3fabb106e75d5afbc48fc11b13816bd893 100644 (file)
@@ -111,6 +111,12 @@ class ResourceSked {
     /** Ending Entry of this schedule */
     SkedIt end();
 
+    /** Ending Entry of a specified stage */
+    SkedIt end(int stage_num);
+
+    /** Find a schedule entry based on stage and command */
+    SkedIt find(int stage_num, int cmd);
+
     /** What is the next task for this instruction schedule? */
     ScheduleEntry* top();