memory mode information now contained in system object
States are now running, draining, or drained. memory state information moved into system object
system parameter is not fs only for cpus
Implement drain() support in devices
Update for drain() call that returns number of times drain_event->process() will be called
Break O3 CPU! No sense in putting in a hack change that kevin is going to remove in a few minutes i imagine
src/cpu/simple/atomic.cc:
src/cpu/simple/atomic.hh:
Since se mode has a system, allow access to it
Verify that the atomic cpu is connected to an atomic system on resume
src/cpu/simple/base.cc:
Since se mode has a system, allow access to it
src/cpu/simple/timing.cc:
src/cpu/simple/timing.hh:
Update for new drain() call that returns number of times drain_event->process() will be called and memory state being moved into the system
Since se mode has a system, allow access to it
Verify that the timing cpu is connected to an timing system on resume
src/dev/ide_disk.cc:
src/dev/io_device.cc:
src/dev/io_device.hh:
src/dev/ns_gige.cc:
src/dev/ns_gige.hh:
src/dev/pcidev.cc:
src/dev/pcidev.hh:
src/dev/sinic.cc:
src/dev/sinic.hh:
Implement drain() support in devices
src/python/m5/config.py:
Allow drain to return number of times drain_event->process() will be called. Normally 0 or 1 but things like O3 cpu or devices with multiple ports may want to call it many times
src/python/m5/objects/BaseCPU.py:
move system parameter out of fs to everyone
src/sim/sim_object.cc:
src/sim/sim_object.hh:
States are now running, draining, or drained. memory state information moved into system object
src/sim/system.cc:
src/sim/system.hh:
memory mode information now contained in system object
--HG--
extra : convert_revision : 1389c77e66ee6d9710bf77b4306fb47e107b21cf
This commit is contained in:
@@ -72,7 +72,7 @@ SimObject::SimObject(Params *p)
|
||||
|
||||
doRecordEvent = !Stats::event_ignore.match(name());
|
||||
simObjectList.push_back(this);
|
||||
state = Atomic;
|
||||
state = Running;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -88,7 +88,7 @@ SimObject::SimObject(const string &_name)
|
||||
|
||||
doRecordEvent = !Stats::event_ignore.match(name());
|
||||
simObjectList.push_back(this);
|
||||
state = Atomic;
|
||||
state = Running;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -269,38 +269,23 @@ SimObject::recordEvent(const std::string &stat)
|
||||
Stats::recordEvent(stat);
|
||||
}
|
||||
|
||||
bool
|
||||
unsigned int
|
||||
SimObject::drain(Event *drain_event)
|
||||
{
|
||||
if (state != DrainedAtomic && state != Atomic) {
|
||||
panic("Must implement your own drain function if it is to be used "
|
||||
"in timing mode!");
|
||||
}
|
||||
state = DrainedAtomic;
|
||||
return true;
|
||||
state = Drained;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
SimObject::resume()
|
||||
{
|
||||
if (state == DrainedAtomic) {
|
||||
state = Atomic;
|
||||
} else if (state == DrainedTiming) {
|
||||
state = Timing;
|
||||
}
|
||||
state = Running;
|
||||
}
|
||||
|
||||
void
|
||||
SimObject::setMemoryMode(State new_mode)
|
||||
{
|
||||
assert(new_mode == Timing || new_mode == Atomic);
|
||||
if (state == DrainedAtomic && new_mode == Timing) {
|
||||
state = DrainedTiming;
|
||||
} else if (state == DrainedTiming && new_mode == Atomic) {
|
||||
state = DrainedAtomic;
|
||||
} else {
|
||||
state = new_mode;
|
||||
}
|
||||
panic("setMemoryMode() should only be called on systems");
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -60,16 +60,15 @@ class SimObject : public Serializable, protected StartupCallback
|
||||
};
|
||||
|
||||
enum State {
|
||||
Atomic,
|
||||
Timing,
|
||||
Running,
|
||||
Draining,
|
||||
DrainedAtomic,
|
||||
DrainedTiming
|
||||
Drained
|
||||
};
|
||||
private:
|
||||
State state;
|
||||
|
||||
protected:
|
||||
Params *_params;
|
||||
State state;
|
||||
|
||||
void changeState(State new_state) { state = new_state; }
|
||||
|
||||
@@ -116,8 +115,10 @@ class SimObject : public Serializable, protected StartupCallback
|
||||
|
||||
// Methods to drain objects in order to take checkpoints
|
||||
// Or switch from timing -> atomic memory model
|
||||
// Drain returns false if the SimObject cannot drain immediately.
|
||||
virtual bool drain(Event *drain_event);
|
||||
// Drain returns 0 if the simobject can drain immediately or
|
||||
// the number of times the drain_event's process function will be called
|
||||
// before the object will be done draining. Normally this should be 1
|
||||
virtual unsigned int drain(Event *drain_event);
|
||||
virtual void resume();
|
||||
virtual void setMemoryMode(State new_mode);
|
||||
virtual void switchOut();
|
||||
|
||||
@@ -143,6 +143,14 @@ int rgdb_wait = -1;
|
||||
|
||||
#endif // FULL_SYSTEM
|
||||
|
||||
|
||||
void
|
||||
System::setMemoryMode(MemoryMode mode)
|
||||
{
|
||||
assert(getState() == Drained);
|
||||
memoryMode = mode;
|
||||
}
|
||||
|
||||
int
|
||||
System::registerThreadContext(ThreadContext *tc, int id)
|
||||
{
|
||||
|
||||
@@ -61,6 +61,21 @@ class RemoteGDB;
|
||||
class System : public SimObject
|
||||
{
|
||||
public:
|
||||
enum MemoryMode {
|
||||
Invalid=0,
|
||||
Atomic,
|
||||
Timing
|
||||
};
|
||||
|
||||
|
||||
MemoryMode getMemoryMode() { assert(memoryMode); return memoryMode; }
|
||||
|
||||
/** Change the memory mode of the system. This should only be called by the
|
||||
* python!!
|
||||
* @param mode Mode to change to (atomic/timing)
|
||||
*/
|
||||
void setMemoryMode(MemoryMode mode);
|
||||
|
||||
PhysicalMemory *physmem;
|
||||
PCEventQueue pcEventQueue;
|
||||
|
||||
@@ -108,6 +123,8 @@ class System : public SimObject
|
||||
|
||||
protected:
|
||||
|
||||
MemoryMode memoryMode;
|
||||
|
||||
#if FULL_SYSTEM
|
||||
/**
|
||||
* Fix up an address used to match PCs for hooking simulator
|
||||
|
||||
Reference in New Issue
Block a user