{
_status = Idle;
ifetch_pkt = dcache_pkt = NULL;
- quiesceEvent = NULL;
+ drainEvent = NULL;
state = SimObject::Timing;
}
}
bool
-TimingSimpleCPU::quiesce(Event *quiesce_event)
+TimingSimpleCPU::drain(Event *drain_event)
{
- // TimingSimpleCPU is ready to quiesce if it's not waiting for
+ // TimingSimpleCPU is ready to drain if it's not waiting for
// an access to complete.
if (status() == Idle || status() == Running || status() == SwitchedOut) {
- DPRINTF(Config, "Ready to quiesce\n");
- changeState(SimObject::QuiescedTiming);
+ changeState(SimObject::DrainedTiming);
return false;
} else {
- DPRINTF(Config, "Waiting to quiesce\n");
- changeState(SimObject::Quiescing);
- quiesceEvent = quiesce_event;
+ changeState(SimObject::Draining);
+ drainEvent = drain_event;
return true;
}
}
delete pkt->req;
delete pkt;
- if (getState() == SimObject::Quiescing) {
- completeQuiesce();
+ if (getState() == SimObject::Draining) {
+ completeDrain();
return;
}
assert(_status == DcacheWaitResponse);
_status = Running;
- if (getState() == SimObject::Quiescing) {
- completeQuiesce();
+ if (getState() == SimObject::Draining) {
+ completeDrain();
delete pkt->req;
delete pkt;
void
-TimingSimpleCPU::completeQuiesce()
+TimingSimpleCPU::completeDrain()
{
- DPRINTF(Config, "Done quiescing\n");
- changeState(SimObject::QuiescedTiming);
- quiesceEvent->process();
+ DPRINTF(Config, "Done draining\n");
+ changeState(SimObject::DrainedTiming);
+ drainEvent->process();
}
bool
Status status() const { return _status; }
- Event *quiesceEvent;
+ Event *drainEvent;
private:
virtual void serialize(std::ostream &os);
virtual void unserialize(Checkpoint *cp, const std::string §ion);
- virtual bool quiesce(Event *quiesce_event);
+ virtual bool drain(Event *drain_event);
virtual void resume();
virtual void setMemoryMode(State new_mode);
void completeDataAccess(Packet *);
void advanceInst(Fault fault);
private:
- void completeQuiesce();
+ void completeDrain();
};
#endif // __CPU_SIMPLE_TIMING_HH__
# matter since most scripts will probably 'from m5.objects import *'.
import objects
-def doQuiesce(root):
- quiesce = cc_main.createCountedQuiesce()
- unready_objects = root.startQuiesce(quiesce, True)
- # If we've got some objects that can't quiesce immediately, then simulate
+def doDrain(root):
+ drain_event = cc_main.createCountedDrain()
+ unready_objects = root.startDrain(drain_event, True)
+ # If we've got some objects that can't drain immediately, then simulate
if unready_objects > 0:
- quiesce.setCount(unready_objects)
+ drain_event.setCount(unready_objects)
simulate()
- cc_main.cleanupCountedQuiesce(quiesce)
+ cc_main.cleanupCountedDrain(drain_event)
def resume(root):
root.resume()
def checkpoint(root):
if not isinstance(root, objects.Root):
raise TypeError, "Object is not a root object. Checkpoint must be called on a root object."
- doQuiesce(root)
+ doDrain(root)
print "Writing checkpoint"
cc_main.serializeAll()
resume(root)
if not isinstance(system, objects.Root) and not isinstance(system, System):
raise TypeError, "Object is not a root or system object. Checkpoint must be "
"called on a root object."
- doQuiesce(system)
+ doDrain(system)
print "Changing memory mode to atomic"
system.changeTiming(cc_main.SimObject.Atomic)
resume(system)
if not isinstance(system, objects.Root) and not isinstance(system, System):
raise TypeError, "Object is not a root or system object. Checkpoint must be "
"called on a root object."
- doQuiesce(system)
+ doDrain(system)
print "Changing memory mode to timing"
system.changeTiming(cc_main.SimObject.Timing)
resume(system)
if not isinstance(cpu, objects.BaseCPU):
raise TypeError, "%s is not of type BaseCPU", cpu
- # Quiesce all of the individual CPUs
- quiesce = cc_main.createCountedQuiesce()
+ # Drain all of the individual CPUs
+ drain_event = cc_main.createCountedDrain()
unready_cpus = 0
for old_cpu in old_cpus:
- unready_cpus += old_cpu.startQuiesce(quiesce, False)
- # If we've got some objects that can't quiesce immediately, then simulate
+ unready_cpus += old_cpu.startDrain(drain_event, False)
+ # If we've got some objects that can't drain immediately, then simulate
if unready_cpus > 0:
- quiesce.setCount(unready_cpus)
+ drain_event.setCount(unready_cpus)
simulate()
- cc_main.cleanupCountedQuiesce(quiesce)
+ cc_main.cleanupCountedDrain(drain_event)
# Now all of the CPUs are ready to be switched out
for old_cpu in old_cpus:
old_cpu._ccObject.switchOut()
for child in self._children.itervalues():
child.connectPorts()
- def startQuiesce(self, quiesce_event, recursive):
+ def startDrain(self, drain_event, recursive):
count = 0
# ParamContexts don't serialize
if isinstance(self, SimObject) and not isinstance(self, ParamContext):
- if self._ccObject.quiesce(quiesce_event):
+ if self._ccObject.drain(drain_event):
count = 1
if recursive:
for child in self._children.itervalues():
- count += child.startQuiesce(quiesce_event, True)
+ count += child.startDrain(drain_event, True)
return count
def resume(self):
}
Event *
-createCountedQuiesce()
+createCountedDrain()
{
- return new CountedQuiesceEvent();
+ return new CountedDrainEvent();
}
void
-cleanupCountedQuiesce(Event *counted_quiesce)
+cleanupCountedDrain(Event *counted_drain)
{
- CountedQuiesceEvent *event =
- dynamic_cast<CountedQuiesceEvent *>(counted_quiesce);
+ CountedDrainEvent *event =
+ dynamic_cast<CountedDrainEvent *>(counted_drain);
if (event == NULL) {
- fatal("Called cleanupCountedQuiesce() on an event that was not "
- "a CountedQuiesceEvent.");
+ fatal("Called cleanupCountedDrain() on an event that was not "
+ "a CountedDrainEvent.");
}
assert(event->getCount() == 0);
delete event;
}
void
-CountedQuiesceEvent::process()
+CountedDrainEvent::process()
{
if (--count == 0) {
- exitSimLoop("Finished quiesce");
+ exitSimLoop("Finished drain");
}
}
virtual const char *description();
};
-class CountedQuiesceEvent : public SimLoopExitEvent
+class CountedDrainEvent : public SimLoopExitEvent
{
private:
- // Count down to quiescing
+ // Count of how many objects have not yet drained
int count;
public:
- CountedQuiesceEvent()
+ CountedDrainEvent()
: count(0)
{ }
void process();
}
bool
-SimObject::quiesce(Event *quiesce_event)
+SimObject::drain(Event *drain_event)
{
- if (state != QuiescedAtomic && state != Atomic) {
- panic("Must implement your own quiesce function if it is to be used "
+ if (state != DrainedAtomic && state != Atomic) {
+ panic("Must implement your own drain function if it is to be used "
"in timing mode!");
}
- state = QuiescedAtomic;
+ state = DrainedAtomic;
return false;
}
void
SimObject::resume()
{
- if (state == QuiescedAtomic) {
+ if (state == DrainedAtomic) {
state = Atomic;
- } else if (state == QuiescedTiming) {
+ } else if (state == DrainedTiming) {
state = Timing;
}
}
SimObject::setMemoryMode(State new_mode)
{
assert(new_mode == Timing || new_mode == Atomic);
- if (state == QuiescedAtomic && new_mode == Timing) {
- state = QuiescedTiming;
- } else if (state == QuiescedTiming && new_mode == Atomic) {
- state = QuiescedAtomic;
+ if (state == DrainedAtomic && new_mode == Timing) {
+ state = DrainedTiming;
+ } else if (state == DrainedTiming && new_mode == Atomic) {
+ state = DrainedAtomic;
} else {
state = new_mode;
}
enum State {
Atomic,
Timing,
- Quiescing,
- QuiescedAtomic,
- QuiescedTiming
+ Draining,
+ DrainedAtomic,
+ DrainedTiming
};
protected:
// Methods to drain objects in order to take checkpoints
// Or switch from timing -> atomic memory model
// Quiesce returns true if the SimObject cannot quiesce immediately.
- virtual bool quiesce(Event *quiesce_event);
+ virtual bool drain(Event *drain_event);
virtual void resume();
virtual void setMemoryMode(State new_mode);
virtual void switchOut();