diff options
-rw-r--r-- | configs/test.py | 8 | ||||
-rwxr-xr-x | configs/test/hello | bin | 0 -> 312176 bytes | |||
-rw-r--r-- | configs/test/test.py | 10 | ||||
-rw-r--r-- | python/m5/objects/System.py | 17 | ||||
-rw-r--r-- | sim/system.cc | 30 | ||||
-rw-r--r-- | sim/system.hh | 2 |
6 files changed, 50 insertions, 17 deletions
diff --git a/configs/test.py b/configs/test.py deleted file mode 100644 index ea0e63a61..000000000 --- a/configs/test.py +++ /dev/null @@ -1,8 +0,0 @@ -from m5 import * -AddToPath('/z/stever/bk/m5-test') -import Benchmarks - -mem = PhysicalMemory() -cpu = SimpleCPU(workload=Benchmarks.HelloWorld(), mem=mem) -system = System(physmem=mem, cpu=cpu) -root = Root(system=system) diff --git a/configs/test/hello b/configs/test/hello Binary files differnew file mode 100755 index 000000000..59c0d195c --- /dev/null +++ b/configs/test/hello diff --git a/configs/test/test.py b/configs/test/test.py new file mode 100644 index 000000000..0982ba4f2 --- /dev/null +++ b/configs/test/test.py @@ -0,0 +1,10 @@ +from m5 import * + +class HelloWorld(LiveProcess): + executable = '../configs/test/hello' + cmd = 'hello' + +mem = PhysicalMemory() +cpu = SimpleCPU(workload=HelloWorld(), mem=mem) +system = System(physmem=mem, cpu=cpu) +root = Root(system=system) diff --git a/python/m5/objects/System.py b/python/m5/objects/System.py index 5925cadf5..2959c1d1a 100644 --- a/python/m5/objects/System.py +++ b/python/m5/objects/System.py @@ -2,15 +2,16 @@ from m5 import * class System(SimObject): type = 'System' - boot_cpu_frequency = Param.Frequency(Self.cpu[0].clock.frequency, - "boot processor frequency") - memctrl = Param.MemoryController(Parent.any, "memory controller") physmem = Param.PhysicalMemory(Parent.any, "phsyical memory") - init_param = Param.UInt64(0, "numerical value to pass into simulator") - bin = Param.Bool(False, "is this system binned") - binned_fns = VectorParam.String([], "functions broken down and binned") - kernel = Param.String("file that contains the kernel code") - readfile = Param.String("", "file to read startup script from") + if build_env['FULL_SYSTEM']: + boot_cpu_frequency = Param.Frequency(Self.cpu[0].clock.frequency, + "boot processor frequency") + memctrl = Param.MemoryController(Parent.any, "memory controller") + init_param = Param.UInt64(0, "numerical value to pass into simulator") + bin = Param.Bool(False, "is this system binned") + binned_fns = VectorParam.String([], "functions broken down and binned") + kernel = Param.String("file that contains the kernel code") + readfile = Param.String("", "file to read startup script from") class AlphaSystem(System): type = 'AlphaSystem' diff --git a/sim/system.cc b/sim/system.cc index f1d0579d7..05b41e32b 100644 --- a/sim/system.cc +++ b/sim/system.cc @@ -217,5 +217,35 @@ printSystems() System::printSystems(); } +#if FULL_SYSTEM + +// In full system mode, only derived classes (e.g. AlphaLinuxSystem) +// can be created directly. + DEFINE_SIM_OBJECT_CLASS_NAME("System", System) +#else + +BEGIN_DECLARE_SIM_OBJECT_PARAMS(System) + + SimObjectParam<Memory *> physmem; + +END_DECLARE_SIM_OBJECT_PARAMS(System) + +BEGIN_INIT_SIM_OBJECT_PARAMS(System) + + INIT_PARAM(physmem, "physical memory") + +END_INIT_SIM_OBJECT_PARAMS(System) + +CREATE_SIM_OBJECT(System) +{ + System::Params *p = new System::Params; + p->name = getInstanceName(); + p->physmem = physmem; + return new System(p); +} + +REGISTER_SIM_OBJECT("System", System) + +#endif diff --git a/sim/system.hh b/sim/system.hh index cbe876c42..0d5b40e3d 100644 --- a/sim/system.hh +++ b/sim/system.hh @@ -101,6 +101,7 @@ class System : public SimObject protected: +#if FULL_SYSTEM /** * Fix up an address used to match PCs for hooking simulator * events on to target function executions. See comment in @@ -125,7 +126,6 @@ class System : public SimObject return NULL; } -#if FULL_SYSTEM /** Add a function-based event to kernel code. */ template <class T> T *System::addKernelFuncEvent(const char *lbl) |