From 1a6d25dc478554cf1e7fe44e607c39989c58f114 Mon Sep 17 00:00:00 2001 From: Korey Sewell Date: Sun, 19 Jun 2011 21:43:35 -0400 Subject: [PATCH] inorder: addtl functionaly for inst. skeds add find and end functions for inst. schedules that can search by stage number --- src/cpu/inorder/resource_sked.cc | 21 +++++++++++++++++++++ src/cpu/inorder/resource_sked.hh | 6 ++++++ 2 files changed, 27 insertions(+) diff --git a/src/cpu/inorder/resource_sked.cc b/src/cpu/inorder/resource_sked.cc index 96b4f84b6..e52ed8ff0 100644 --- a/src/cpu/inorder/resource_sked.cc +++ b/src/cpu/inorder/resource_sked.cc @@ -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() { diff --git a/src/cpu/inorder/resource_sked.hh b/src/cpu/inorder/resource_sked.hh index 6338e8e9b..c44c2d3fa 100644 --- a/src/cpu/inorder/resource_sked.hh +++ b/src/cpu/inorder/resource_sked.hh @@ -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(); -- 2.30.2