inorder: get rid of references to mainEventQueue.
Events need to be scheduled on the queue assigned to the SimObject, not on the global queue (which should be going away). Also cleaned up a number of redundant expressions that made the code unnecessarily verbose.
This commit is contained in:
@@ -157,12 +157,12 @@ InOrderCPU::CPUEvent::description()
|
||||
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
|
||||
@@ -540,7 +540,7 @@ InOrderCPU::tick()
|
||||
} 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));
|
||||
}
|
||||
@@ -701,7 +701,7 @@ InOrderCPU::scheduleCpuEvent(CPUEventType c_event, Fault fault,
|
||||
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);
|
||||
@@ -1403,7 +1403,7 @@ InOrderCPU::wakeCPU()
|
||||
|
||||
numCycles += extra_cycles;
|
||||
|
||||
mainEventQueue.schedule(&tickEvent, nextCycle(curTick));
|
||||
schedule(&tickEvent, nextCycle(curTick));
|
||||
}
|
||||
|
||||
#if FULL_SYSTEM
|
||||
|
||||
@@ -156,12 +156,12 @@ class InOrderCPU : public BaseCPU
|
||||
/** 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. */
|
||||
|
||||
@@ -498,3 +498,15 @@ ResourceEvent::description()
|
||||
|
||||
return desc.c_str();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -277,13 +277,7 @@ class ResourceEvent : public Event
|
||||
void setSlot(int slot) { slotIdx = slot; }
|
||||
|
||||
/** Schedule resource event, regardless of its current state. */
|
||||
void scheduleEvent(int delay)
|
||||
{
|
||||
if (squashed())
|
||||
mainEventQueue.reschedule(this, curTick + resource->ticks(delay));
|
||||
else if (!scheduled())
|
||||
mainEventQueue.schedule(this, curTick + resource->ticks(delay));
|
||||
}
|
||||
void scheduleEvent(int delay);
|
||||
|
||||
/** Unschedule resource event, regardless of its current state. */
|
||||
void unscheduleEvent()
|
||||
|
||||
@@ -244,6 +244,8 @@ ResourcePool::scheduleEvent(InOrderCPU::CPUEventType e_type, DynInstPtr inst,
|
||||
{
|
||||
assert(delay >= 0);
|
||||
|
||||
Tick when = cpu->nextCycle(curTick + cpu->ticks(delay));
|
||||
|
||||
switch (e_type)
|
||||
{
|
||||
case InOrderCPU::ActivateThread:
|
||||
@@ -258,9 +260,7 @@ ResourcePool::scheduleEvent(InOrderCPU::CPUEventType e_type, DynInstPtr inst,
|
||||
inst->squashingStage,
|
||||
inst->bdelaySeqNum,
|
||||
inst->readTid());
|
||||
mainEventQueue.schedule(res_pool_event,
|
||||
cpu->nextCycle(curTick +
|
||||
cpu->ticks(delay)));
|
||||
cpu->schedule(res_pool_event, when);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -278,19 +278,17 @@ ResourcePool::scheduleEvent(InOrderCPU::CPUEventType e_type, DynInstPtr inst,
|
||||
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,
|
||||
@@ -299,10 +297,7 @@ ResourcePool::scheduleEvent(InOrderCPU::CPUEventType e_type, DynInstPtr inst,
|
||||
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;
|
||||
|
||||
@@ -316,10 +311,7 @@ ResourcePool::scheduleEvent(InOrderCPU::CPUEventType e_type, DynInstPtr 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;
|
||||
|
||||
@@ -333,9 +325,7 @@ ResourcePool::scheduleEvent(InOrderCPU::CPUEventType e_type, DynInstPtr inst,
|
||||
inst->squashingStage,
|
||||
inst->bdelaySeqNum,
|
||||
inst->readTid());
|
||||
mainEventQueue.schedule(res_pool_event,
|
||||
cpu->nextCycle(curTick +
|
||||
cpu->ticks(delay)));
|
||||
cpu->schedule(res_pool_event, when);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -350,23 +340,21 @@ ResourcePool::scheduleEvent(InOrderCPU::CPUEventType e_type, DynInstPtr inst,
|
||||
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;
|
||||
|
||||
@@ -552,16 +540,13 @@ ResourcePool::ResPoolEvent::description()
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user