From: Korey Sewell Date: Mon, 20 Jun 2011 01:43:35 +0000 (-0400) Subject: inorder: addtl functionaly for inst. skeds X-Git-Tag: stable_2012_02_02~255 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1a6d25dc478554cf1e7fe44e607c39989c58f114;p=gem5.git inorder: addtl functionaly for inst. skeds add find and end functions for inst. schedules that can search by stage number --- 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();