void
InOrderCPU::CPUEvent::scheduleEvent(int delay)
{
- Tick when = cpu->nextCycle(curTick + cpu->ticks(delay));
-
- if (squashed())
- cpu->reschedule(this, when);
- else if (!scheduled())
- cpu->schedule(this, when);
+ assert(!scheduled() || squashed());
+ cpu->reschedule(this, cpu->nextCycle(curTick + cpu->ticks(delay)), true);
}
void
/** Schedule tick event, regardless of its current state. */
void scheduleTickEvent(int delay)
{
- Tick when = nextCycle(curTick + ticks(delay));
-
- if (tickEvent.squashed())
- reschedule(&tickEvent, when);
- else if (!tickEvent.scheduled())
- schedule(&tickEvent, when);
+ assert(!tickEvent.scheduled() || tickEvent.squashed());
+ reschedule(&tickEvent, nextCycle(curTick + ticks(delay)), true);
}
/** Unschedule tick event, regardless of its current state. */
void
ResourceEvent::scheduleEvent(int delay)
{
- InOrderCPU *cpu = resource->cpu;
- Tick when = curTick + resource->ticks(delay);
-
- if (squashed())
- cpu->reschedule(this, when);
- else if (!scheduled())
- cpu->schedule(this, when);
+ assert(!scheduled() || squashed());
+ resource->cpu->reschedule(this,
+ curTick + resource->ticks(delay), true);
}
ResourcePool::ResPoolEvent::scheduleEvent(int delay)
{
InOrderCPU *cpu = resPool->cpu;
- Tick when = cpu->nextCycle(curTick + cpu->ticks(delay));
-
- if (squashed()) {
- cpu->reschedule(this, when);
- } else if (!scheduled()) {
- cpu->schedule(this, when);
- }
+ assert(!scheduled() || squashed());
+ cpu->reschedule(this, cpu->nextCycle(curTick + cpu->ticks(delay)), true);
}
/** Unschedule resource event, regardless of its current state. */