since memoryMode was put into the System (from SimObject), things got broken - this fixes it so that changeToTiming/changeToAtomic works.
src/python/m5/SimObject.py: now that setMemoryMode is a method in System, need to convert the SimObject * _ccObject into a system ptr to call setMemoryMode. src/sim/main.cc: need this conversion now. src/sim/sim_object.hh: put the enum back into SimObject. src/sim/system.hh: memoryMode is now a part of SimObject, need the ::'s --HG-- extra : convert_revision : 0ade06957fa57b497798e1f50c237ca1badc821d
This commit is contained in:
parent
024b33a1ef
commit
8acecfef9b
4 changed files with 29 additions and 11 deletions
|
@ -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)
|
||||||
|
|
|
@ -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