void
InOrderCPU::CPUEvent::scheduleEvent(int delay)
{
+ Tick when = cpu->nextCycle(curTick + cpu->ticks(delay));
+
if (squashed())
- mainEventQueue.reschedule(this, cpu->nextCycle(curTick +
- cpu->ticks(delay)));
+ cpu->reschedule(this, when);
else if (!scheduled())
- mainEventQueue.schedule(this, cpu->nextCycle(curTick +
- cpu->ticks(delay)));
+ cpu->schedule(this, when);
}
void
} else {
//Tick next_tick = curTick + cycles(1);
//tickEvent.schedule(next_tick);
- mainEventQueue.schedule(&tickEvent, nextCycle(curTick + 1));
+ schedule(&tickEvent, nextCycle(curTick + 1));
DPRINTF(InOrderCPU, "Scheduled CPU for next tick @ %i.\n",
nextCycle(curTick + 1));
}
if (delay >= 0) {
DPRINTF(InOrderCPU, "Scheduling CPU Event (%s) for cycle %i, [tid:%i].\n",
eventNames[c_event], curTick + delay, tid);
- mainEventQueue.schedule(cpu_event, sked_tick);
+ schedule(cpu_event, sked_tick);
} else {
cpu_event->process();
cpuEventRemoveList.push(cpu_event);
numCycles += extra_cycles;
- mainEventQueue.schedule(&tickEvent, nextCycle(curTick));
+ schedule(&tickEvent, nextCycle(curTick));
}
#if FULL_SYSTEM
/** Schedule tick event, regardless of its current state. */
void scheduleTickEvent(int delay)
{
+ Tick when = nextCycle(curTick + ticks(delay));
+
if (tickEvent.squashed())
- mainEventQueue.reschedule(&tickEvent,
- nextCycle(curTick + ticks(delay)));
+ reschedule(&tickEvent, when);
else if (!tickEvent.scheduled())
- mainEventQueue.schedule(&tickEvent,
- nextCycle(curTick + ticks(delay)));
+ schedule(&tickEvent, when);
}
/** Unschedule tick event, regardless of its current state. */
{
assert(delay >= 0);
+ Tick when = cpu->nextCycle(curTick + cpu->ticks(delay));
+
switch (e_type)
{
case InOrderCPU::ActivateThread:
inst->squashingStage,
inst->bdelaySeqNum,
inst->readTid());
- mainEventQueue.schedule(res_pool_event,
- cpu->nextCycle(curTick +
- cpu->ticks(delay)));
+ cpu->schedule(res_pool_event, when);
}
break;
inst->bdelaySeqNum,
tid);
- mainEventQueue.schedule(res_pool_event,
- cpu->nextCycle(curTick +
- cpu->ticks(delay)));
-
+ cpu->schedule(res_pool_event, when);
}
break;
case InOrderCPU::SuspendThread:
{
+ // not sure why we add another nextCycle() call here...
+ Tick sked_tick = cpu->nextCycle(when);
DPRINTF(Resource, "Scheduling Suspend Thread Resource Pool "
- "Event for tick %i.\n",
- cpu->nextCycle(cpu->nextCycle(curTick + cpu->ticks(delay))));
+ "Event for tick %i.\n", sked_tick);
ResPoolEvent *res_pool_event = new ResPoolEvent(this,
e_type,
inst->bdelaySeqNum,
tid);
- Tick sked_tick = curTick + cpu->ticks(delay);
- mainEventQueue.schedule(res_pool_event,
- cpu->nextCycle(cpu->nextCycle(sked_tick)));
-
+ cpu->schedule(res_pool_event, sked_tick);
}
break;
inst->squashingStage,
inst->seqNum,
inst->readTid());
- mainEventQueue.schedule(res_pool_event,
- cpu->nextCycle(curTick +
- cpu->ticks(delay)));
-
+ cpu->schedule(res_pool_event, when);
}
break;
inst->squashingStage,
inst->bdelaySeqNum,
inst->readTid());
- mainEventQueue.schedule(res_pool_event,
- cpu->nextCycle(curTick +
- cpu->ticks(delay)));
+ cpu->schedule(res_pool_event, when);
}
break;
inst->squashingStage,
inst->seqNum - 1,
inst->readTid());
- mainEventQueue.schedule(res_pool_event,
- cpu->nextCycle(curTick + cpu->ticks(delay)));
+ cpu->schedule(res_pool_event, when);
}
break;
case ResourcePool::UpdateAfterContextSwitch:
{
- DPRINTF(Resource, "Scheduling UpdatePC Resource Pool Event for tick %i.\n",
+ DPRINTF(Resource, "Scheduling UpdatePC Resource Pool Event "
+ "for tick %i.\n",
curTick + delay);
ResPoolEvent *res_pool_event = new ResPoolEvent(this,e_type,
inst,
inst->squashingStage,
inst->seqNum,
inst->readTid());
- mainEventQueue.schedule(res_pool_event,
- cpu->nextCycle(curTick + cpu->ticks(delay)));
-
+ cpu->schedule(res_pool_event, when);
}
break;
void
ResourcePool::ResPoolEvent::scheduleEvent(int delay)
{
+ InOrderCPU *cpu = resPool->cpu;
+ Tick when = cpu->nextCycle(curTick + cpu->ticks(delay));
+
if (squashed()) {
- mainEventQueue.reschedule(this,
- resPool->cpu->nextCycle(curTick +
- resPool->
- cpu->ticks(delay)));
+ cpu->reschedule(this, when);
} else if (!scheduled()) {
- mainEventQueue.schedule(this,
- resPool->cpu->nextCycle(curTick +
- resPool->
- cpu->ticks(delay)));
+ cpu->schedule(this, when);
}
}