inorder: addtl functionaly for inst. skeds

add find and end functions for inst. schedules
that can search by stage number
This commit is contained in:
Korey Sewell 2011-06-19 21:43:35 -04:00
parent 8b54858831
commit 1a6d25dc47
2 changed files with 27 additions and 0 deletions

View 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()
{

View 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();