Merge zizzer:/bk/newmem
into zed.eecs.umich.edu:/z/hsul/work/m5/newmem src/cpu/simple/timing.cc: hand merge --HG-- extra : convert_revision : 083bf102249ad9bc63c447dbf85d3863f935f647
This commit is contained in:
commit
339b1f8516
7 changed files with 36 additions and 16 deletions
|
@ -182,9 +182,9 @@ AtomicSimpleCPU::unserialize(Checkpoint *cp, const string §ion)
|
||||||
void
|
void
|
||||||
AtomicSimpleCPU::resume()
|
AtomicSimpleCPU::resume()
|
||||||
{
|
{
|
||||||
assert(system->getMemoryMode() == System::Atomic);
|
|
||||||
changeState(SimObject::Running);
|
changeState(SimObject::Running);
|
||||||
if (thread->status() == ThreadContext::Active) {
|
if (thread->status() == ThreadContext::Active) {
|
||||||
|
assert(system->getMemoryMode() == System::Atomic);
|
||||||
if (!tickEvent.scheduled())
|
if (!tickEvent.scheduled())
|
||||||
tickEvent.schedule(curTick);
|
tickEvent.schedule(curTick);
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,6 +147,8 @@ void
|
||||||
TimingSimpleCPU::resume()
|
TimingSimpleCPU::resume()
|
||||||
{
|
{
|
||||||
if (_status != SwitchedOut && _status != Idle) {
|
if (_status != SwitchedOut && _status != Idle) {
|
||||||
|
assert(system->getMemoryMode() == System::Timing);
|
||||||
|
|
||||||
// Delete the old event if it existed.
|
// Delete the old event if it existed.
|
||||||
if (fetchEvent) {
|
if (fetchEvent) {
|
||||||
if (fetchEvent->scheduled())
|
if (fetchEvent->scheduled())
|
||||||
|
@ -160,7 +162,6 @@ TimingSimpleCPU::resume()
|
||||||
fetchEvent->schedule(curTick);
|
fetchEvent->schedule(curTick);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(system->getMemoryMode() == System::Timing);
|
|
||||||
changeState(SimObject::Running);
|
changeState(SimObject::Running);
|
||||||
previousTick = curTick;
|
previousTick = curTick;
|
||||||
}
|
}
|
||||||
|
|
|
@ -726,7 +726,12 @@ class SimObject(object):
|
||||||
child.resume()
|
child.resume()
|
||||||
|
|
||||||
def changeTiming(self, mode):
|
def changeTiming(self, mode):
|
||||||
if isinstance(self, System):
|
if isinstance(self, m5.objects.System):
|
||||||
|
# i don't know if there's a better way to do this - calling
|
||||||
|
# setMemoryMode directly from self._ccObject results in calling
|
||||||
|
# SimObject::setMemoryMode, not the System::setMemoryMode
|
||||||
|
## system_ptr = cc_main.convertToSystemPtr(self._ccObject)
|
||||||
|
## system_ptr.setMemoryMode(mode)
|
||||||
self._ccObject.setMemoryMode(mode)
|
self._ccObject.setMemoryMode(mode)
|
||||||
for child in self._children.itervalues():
|
for child in self._children.itervalues():
|
||||||
child.changeTiming(mode)
|
child.changeTiming(mode)
|
||||||
|
|
|
@ -144,7 +144,7 @@ def restoreCheckpoint(root, dir):
|
||||||
resume(root)
|
resume(root)
|
||||||
|
|
||||||
def changeToAtomic(system):
|
def changeToAtomic(system):
|
||||||
if not isinstance(system, objects.Root) and not isinstance(system, System):
|
if not isinstance(system, objects.Root) and not isinstance(system, objects.System):
|
||||||
raise TypeError, "Object is not a root or system object. Checkpoint must be "
|
raise TypeError, "Object is not a root or system object. Checkpoint must be "
|
||||||
"called on a root object."
|
"called on a root object."
|
||||||
doDrain(system)
|
doDrain(system)
|
||||||
|
@ -153,7 +153,7 @@ def changeToAtomic(system):
|
||||||
resume(system)
|
resume(system)
|
||||||
|
|
||||||
def changeToTiming(system):
|
def changeToTiming(system):
|
||||||
if not isinstance(system, objects.Root) and not isinstance(system, System):
|
if not isinstance(system, objects.Root) and not isinstance(system, objects.System):
|
||||||
raise TypeError, "Object is not a root or system object. Checkpoint must be "
|
raise TypeError, "Object is not a root or system object. Checkpoint must be "
|
||||||
"called on a root object."
|
"called on a root object."
|
||||||
doDrain(system)
|
doDrain(system)
|
||||||
|
@ -162,6 +162,7 @@ def changeToTiming(system):
|
||||||
resume(system)
|
resume(system)
|
||||||
|
|
||||||
def switchCpus(cpuList):
|
def switchCpus(cpuList):
|
||||||
|
print "switching cpus"
|
||||||
if not isinstance(cpuList, list):
|
if not isinstance(cpuList, list):
|
||||||
raise RuntimeError, "Must pass a list to this function"
|
raise RuntimeError, "Must pass a list to this function"
|
||||||
for i in cpuList:
|
for i in cpuList:
|
||||||
|
@ -189,9 +190,9 @@ def switchCpus(cpuList):
|
||||||
cc_main.cleanupCountedDrain(drain_event)
|
cc_main.cleanupCountedDrain(drain_event)
|
||||||
# Now all of the CPUs are ready to be switched out
|
# Now all of the CPUs are ready to be switched out
|
||||||
for old_cpu in old_cpus:
|
for old_cpu in old_cpus:
|
||||||
|
print "switching"
|
||||||
old_cpu._ccObject.switchOut()
|
old_cpu._ccObject.switchOut()
|
||||||
index = 0
|
index = 0
|
||||||
print "Switching CPUs"
|
|
||||||
for new_cpu in new_cpus:
|
for new_cpu in new_cpus:
|
||||||
new_cpu.takeOverFrom(old_cpus[index])
|
new_cpu.takeOverFrom(old_cpus[index])
|
||||||
new_cpu._ccObject.resume()
|
new_cpu._ccObject.resume()
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
#include "sim/sim_events.hh"
|
#include "sim/sim_events.hh"
|
||||||
#include "sim/sim_exit.hh"
|
#include "sim/sim_exit.hh"
|
||||||
#include "sim/sim_object.hh"
|
#include "sim/sim_object.hh"
|
||||||
|
#include "sim/system.hh"
|
||||||
#include "sim/stat_control.hh"
|
#include "sim/stat_control.hh"
|
||||||
#include "sim/stats.hh"
|
#include "sim/stats.hh"
|
||||||
#include "sim/root.hh"
|
#include "sim/root.hh"
|
||||||
|
@ -440,6 +441,17 @@ convertToBaseCPUPtr(SimObject *obj)
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System *
|
||||||
|
convertToSystemPtr(SimObject *obj)
|
||||||
|
{
|
||||||
|
System *ptr = dynamic_cast<System *>(obj);
|
||||||
|
|
||||||
|
if (ptr == NULL)
|
||||||
|
warn("Casting to System pointer failed");
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do C++ simulator exit processing. Exported to SWIG to be invoked
|
* Do C++ simulator exit processing. Exported to SWIG to be invoked
|
||||||
* when simulator terminates via Python's atexit mechanism.
|
* when simulator terminates via Python's atexit mechanism.
|
||||||
|
|
|
@ -64,6 +64,13 @@ class SimObject : public Serializable, protected StartupCallback
|
||||||
Draining,
|
Draining,
|
||||||
Drained
|
Drained
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum MemoryMode {
|
||||||
|
Invalid=0,
|
||||||
|
Atomic,
|
||||||
|
Timing
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
State state;
|
State state;
|
||||||
|
|
||||||
|
|
|
@ -62,22 +62,16 @@ class RemoteGDB;
|
||||||
class System : public SimObject
|
class System : public SimObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum MemoryMode {
|
|
||||||
Invalid=0,
|
|
||||||
Atomic,
|
|
||||||
Timing
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char *MemoryModeStrings[3];
|
static const char *MemoryModeStrings[3];
|
||||||
|
|
||||||
|
SimObject::MemoryMode getMemoryMode() { assert(memoryMode); return memoryMode; }
|
||||||
MemoryMode getMemoryMode() { assert(memoryMode); return memoryMode; }
|
|
||||||
|
|
||||||
/** Change the memory mode of the system. This should only be called by the
|
/** Change the memory mode of the system. This should only be called by the
|
||||||
* python!!
|
* python!!
|
||||||
* @param mode Mode to change to (atomic/timing)
|
* @param mode Mode to change to (atomic/timing)
|
||||||
*/
|
*/
|
||||||
void setMemoryMode(MemoryMode mode);
|
void setMemoryMode(SimObject::MemoryMode mode);
|
||||||
|
|
||||||
PhysicalMemory *physmem;
|
PhysicalMemory *physmem;
|
||||||
PCEventQueue pcEventQueue;
|
PCEventQueue pcEventQueue;
|
||||||
|
@ -126,7 +120,7 @@ class System : public SimObject
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
MemoryMode memoryMode;
|
SimObject::MemoryMode memoryMode;
|
||||||
|
|
||||||
#if FULL_SYSTEM
|
#if FULL_SYSTEM
|
||||||
/**
|
/**
|
||||||
|
@ -173,7 +167,7 @@ class System : public SimObject
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
PhysicalMemory *physmem;
|
PhysicalMemory *physmem;
|
||||||
MemoryMode mem_mode;
|
SimObject::MemoryMode mem_mode;
|
||||||
|
|
||||||
#if FULL_SYSTEM
|
#if FULL_SYSTEM
|
||||||
Tick boot_cpu_frequency;
|
Tick boot_cpu_frequency;
|
||||||
|
|
Loading…
Reference in a new issue