From abc76f20cb98c90e8dab416dd16dfd4a954013ba Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Mon, 23 Jul 2007 21:51:38 -0700 Subject: Major changes to how SimObjects are created and initialized. Almost all creation and initialization now happens in python. Parameter objects are generated and initialized by python. The .ini file is now solely for debugging purposes and is not used in construction of the objects in any way. --HG-- extra : convert_revision : 7e722873e417cb3d696f2e34c35ff488b7bff4ed --- src/arch/alpha/AlphaTLB.py | 6 ++++ src/arch/alpha/freebsd/system.cc | 69 ++++--------------------------------- src/arch/alpha/freebsd/system.hh | 11 ++++-- src/arch/alpha/linux/system.cc | 63 ++-------------------------------- src/arch/alpha/linux/system.hh | 2 ++ src/arch/alpha/system.cc | 73 +++++----------------------------------- src/arch/alpha/system.hh | 13 ++----- src/arch/alpha/tlb.cc | 45 +++++-------------------- src/arch/alpha/tru64/system.cc | 62 ++-------------------------------- src/arch/alpha/tru64/system.hh | 2 ++ 10 files changed, 49 insertions(+), 297 deletions(-) (limited to 'src/arch/alpha') diff --git a/src/arch/alpha/AlphaTLB.py b/src/arch/alpha/AlphaTLB.py index 559516725..fec245b75 100644 --- a/src/arch/alpha/AlphaTLB.py +++ b/src/arch/alpha/AlphaTLB.py @@ -35,8 +35,14 @@ class AlphaTLB(SimObject): class AlphaDTB(AlphaTLB): type = 'AlphaDTB' + cxx_namespace = 'AlphaISA' + cxx_class = 'DTB' + size = 64 class AlphaITB(AlphaTLB): type = 'AlphaITB' + cxx_namespace = 'AlphaISA' + cxx_class = 'ITB' + size = 48 diff --git a/src/arch/alpha/freebsd/system.cc b/src/arch/alpha/freebsd/system.cc index 99be25057..db0be29ab 100644 --- a/src/arch/alpha/freebsd/system.cc +++ b/src/arch/alpha/freebsd/system.cc @@ -35,16 +35,15 @@ * */ -#include "arch/alpha/system.hh" #include "arch/alpha/freebsd/system.hh" +#include "arch/alpha/system.hh" +#include "arch/isa_traits.hh" +#include "arch/vtophys.hh" #include "base/loader/symtab.hh" #include "cpu/thread_context.hh" #include "mem/physical.hh" #include "mem/port.hh" -#include "arch/isa_traits.hh" -#include "sim/builder.hh" #include "sim/byteswap.hh" -#include "arch/vtophys.hh" #define TIMER_FREQUENCY 1193180 @@ -92,64 +91,8 @@ FreebsdAlphaSystem::SkipCalibrateClocksEvent::process(ThreadContext *tc) ((FreebsdAlphaSystem *)tc->getSystemPtr())->doCalibrateClocks(tc); } - -BEGIN_DECLARE_SIM_OBJECT_PARAMS(FreebsdAlphaSystem) - - Param boot_cpu_frequency; - SimObjectParam physmem; - SimpleEnumParam mem_mode; - - Param kernel; - Param console; - Param pal; - - Param boot_osflags; - Param readfile; - Param symbolfile; - Param init_param; - - Param system_type; - Param system_rev; - -END_DECLARE_SIM_OBJECT_PARAMS(FreebsdAlphaSystem) - -BEGIN_INIT_SIM_OBJECT_PARAMS(FreebsdAlphaSystem) - - INIT_PARAM(boot_cpu_frequency, "Frequency of the boot CPU"), - INIT_PARAM(physmem, "phsyical memory"), - INIT_ENUM_PARAM(mem_mode, "Memory Mode, (1=atomic, 2=timing)", - System::MemoryModeStrings), - INIT_PARAM(kernel, "file that contains the kernel code"), - INIT_PARAM(console, "file that contains the console code"), - INIT_PARAM(pal, "file that contains palcode"), - INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot", - "a"), - INIT_PARAM_DFLT(readfile, "file to read startup script from", ""), - INIT_PARAM_DFLT(symbolfile, "file to read symbols from", ""), - INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0), - INIT_PARAM_DFLT(system_type, "Type of system we are emulating", 34), - INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10) - -END_INIT_SIM_OBJECT_PARAMS(FreebsdAlphaSystem) - -CREATE_SIM_OBJECT(FreebsdAlphaSystem) +FreebsdAlphaSystem * +FreebsdAlphaSystemParams::create() { - AlphaSystem::Params *p = new AlphaSystem::Params; - p->name = getInstanceName(); - p->boot_cpu_frequency = boot_cpu_frequency; - p->physmem = physmem; - p->mem_mode = mem_mode; - p->kernel_path = kernel; - p->console_path = console; - p->palcode = pal; - p->boot_osflags = boot_osflags; - p->init_param = init_param; - p->readfile = readfile; - p->symbolfile = symbolfile; - p->system_type = system_type; - p->system_rev = system_rev; - return new FreebsdAlphaSystem(p); + return new FreebsdAlphaSystem(this); } - -REGISTER_SIM_OBJECT("FreebsdAlphaSystem", FreebsdAlphaSystem) - diff --git a/src/arch/alpha/freebsd/system.hh b/src/arch/alpha/freebsd/system.hh index e0d874e8f..8e8493f97 100644 --- a/src/arch/alpha/freebsd/system.hh +++ b/src/arch/alpha/freebsd/system.hh @@ -28,10 +28,13 @@ * Authors: Ben Nash */ -#ifndef __KERN_FREEBSD_FREEBSD_SYSTEM_HH__ -#define __KERN_FREEBSD_FREEBSD_SYSTEM_HH__ +#ifndef __ARCH_ALPHA_FREEBSD_SYSTEM_HH__ +#define __ARCH_ALPHA_FREEBSD_SYSTEM_HH__ +#include "arch/alpha/system.hh" #include "kern/system_events.hh" +#include "params/FreebsdAlphaSystem.hh" +#include "sim/system.hh" class FreebsdAlphaSystem : public AlphaSystem { @@ -49,10 +52,12 @@ class FreebsdAlphaSystem : public AlphaSystem SkipCalibrateClocksEvent *skipCalibrateClocks; public: + typedef FreebsdAlphaSystemParams Params; FreebsdAlphaSystem(Params *p); ~FreebsdAlphaSystem(); + void doCalibrateClocks(ThreadContext *tc); }; -#endif // __KERN_FREEBSD_FREEBSD_SYSTEM_HH__ +#endif // __ARCH_ALPHA_FREEBSD_SYSTEM_HH__ diff --git a/src/arch/alpha/linux/system.cc b/src/arch/alpha/linux/system.cc index e8bdc1d66..f93cdfbad 100644 --- a/src/arch/alpha/linux/system.cc +++ b/src/arch/alpha/linux/system.cc @@ -54,7 +54,6 @@ #include "kern/linux/events.hh" #include "mem/physical.hh" #include "mem/port.hh" -#include "sim/builder.hh" #include "sim/byteswap.hh" using namespace std; @@ -192,64 +191,8 @@ LinuxAlphaSystem::PrintThreadInfo::process(ThreadContext *tc) ti.curTaskName(), ti.curTaskPID(), ti.curTaskStart()); } - -BEGIN_DECLARE_SIM_OBJECT_PARAMS(LinuxAlphaSystem) - - Param boot_cpu_frequency; - SimObjectParam physmem; - SimpleEnumParam mem_mode; - - Param kernel; - Param console; - Param pal; - - Param boot_osflags; - Param readfile; - Param symbolfile; - Param init_param; - - Param system_type; - Param system_rev; - -END_DECLARE_SIM_OBJECT_PARAMS(LinuxAlphaSystem) - -BEGIN_INIT_SIM_OBJECT_PARAMS(LinuxAlphaSystem) - - INIT_PARAM(boot_cpu_frequency, "Frequency of the boot CPU"), - INIT_PARAM(physmem, "phsyical memory"), - INIT_ENUM_PARAM(mem_mode, "Memory Mode, (1=atomic, 2=timing)", - System::MemoryModeStrings), - INIT_PARAM(kernel, "file that contains the kernel code"), - INIT_PARAM(console, "file that contains the console code"), - INIT_PARAM(pal, "file that contains palcode"), - INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot", - "a"), - INIT_PARAM_DFLT(readfile, "file to read startup script from", ""), - INIT_PARAM_DFLT(symbolfile, "file to read symbols from", ""), - INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0), - INIT_PARAM_DFLT(system_type, "Type of system we are emulating", 34), - INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10) - -END_INIT_SIM_OBJECT_PARAMS(LinuxAlphaSystem) - -CREATE_SIM_OBJECT(LinuxAlphaSystem) +LinuxAlphaSystem * +LinuxAlphaSystemParams::create() { - AlphaSystem::Params *p = new AlphaSystem::Params; - p->name = getInstanceName(); - p->boot_cpu_frequency = boot_cpu_frequency; - p->physmem = physmem; - p->mem_mode = mem_mode; - p->kernel_path = kernel; - p->console_path = console; - p->palcode = pal; - p->boot_osflags = boot_osflags; - p->init_param = init_param; - p->readfile = readfile; - p->symbolfile = symbolfile; - p->system_type = system_type; - p->system_rev = system_rev; - return new LinuxAlphaSystem(p); + return new LinuxAlphaSystem(this); } - -REGISTER_SIM_OBJECT("LinuxAlphaSystem", LinuxAlphaSystem) - diff --git a/src/arch/alpha/linux/system.hh b/src/arch/alpha/linux/system.hh index 14396f8ab..00cde826a 100644 --- a/src/arch/alpha/linux/system.hh +++ b/src/arch/alpha/linux/system.hh @@ -41,6 +41,7 @@ class IdleStartEvent; #include "arch/alpha/idle_event.hh" #include "arch/alpha/system.hh" #include "kern/linux/events.hh" +#include "params/LinuxAlphaSystem.hh" using namespace AlphaISA; using namespace Linux; @@ -129,6 +130,7 @@ class LinuxAlphaSystem : public AlphaSystem IdleStartEvent *idleStartEvent; public: + typedef LinuxAlphaSystemParams Params; LinuxAlphaSystem(Params *p); ~LinuxAlphaSystem(); diff --git a/src/arch/alpha/system.cc b/src/arch/alpha/system.cc index ed0938aeb..2af62ceea 100644 --- a/src/arch/alpha/system.cc +++ b/src/arch/alpha/system.cc @@ -39,8 +39,8 @@ #include "base/loader/symtab.hh" #include "base/trace.hh" #include "mem/physical.hh" +#include "params/AlphaSystem.hh" #include "sim/byteswap.hh" -#include "sim/builder.hh" using namespace LittleEndianGuest; @@ -56,14 +56,14 @@ AlphaSystem::AlphaSystem(Params *p) * Load the pal, and console code into memory */ // Load Console Code - console = createObjectFile(params()->console_path); + console = createObjectFile(params()->console); if (console == NULL) - fatal("Could not load console file %s", params()->console_path); + fatal("Could not load console file %s", params()->console); // Load pal file - pal = createObjectFile(params()->palcode); + pal = createObjectFile(params()->pal); if (pal == NULL) - fatal("Could not load PALcode file %s", params()->palcode); + fatal("Could not load PALcode file %s", params()->pal); // Load program sections into memory @@ -212,65 +212,8 @@ AlphaSystem::unserialize(Checkpoint *cp, const std::string §ion) palSymtab->unserialize("pal_symtab", cp, section); } - -BEGIN_DECLARE_SIM_OBJECT_PARAMS(AlphaSystem) - - Param boot_cpu_frequency; - SimObjectParam physmem; - SimpleEnumParam mem_mode; - - Param kernel; - Param console; - Param pal; - - Param boot_osflags; - Param readfile; - Param symbolfile; - Param init_param; - - Param system_type; - Param system_rev; - -END_DECLARE_SIM_OBJECT_PARAMS(AlphaSystem) - -BEGIN_INIT_SIM_OBJECT_PARAMS(AlphaSystem) - - INIT_PARAM(boot_cpu_frequency, "Frequency of the boot CPU"), - INIT_PARAM(physmem, "phsyical memory"), - INIT_ENUM_PARAM(mem_mode, "Memory Mode, (1=atomic, 2=timing)", - System::MemoryModeStrings), - INIT_PARAM(kernel, "file that contains the kernel code"), - INIT_PARAM(console, "file that contains the console code"), - INIT_PARAM(pal, "file that contains palcode"), - INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot", - "a"), - INIT_PARAM_DFLT(readfile, "file to read startup script from", ""), - INIT_PARAM_DFLT(symbolfile, "file to read symbols from", ""), - INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0), - INIT_PARAM_DFLT(system_type, "Type of system we are emulating", 34), - INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10) - -END_INIT_SIM_OBJECT_PARAMS(AlphaSystem) - -CREATE_SIM_OBJECT(AlphaSystem) +AlphaSystem * +AlphaSystemParams::create() { - AlphaSystem::Params *p = new AlphaSystem::Params; - p->name = getInstanceName(); - p->boot_cpu_frequency = boot_cpu_frequency; - p->physmem = physmem; - p->mem_mode = mem_mode; - p->kernel_path = kernel; - p->console_path = console; - p->palcode = pal; - p->boot_osflags = boot_osflags; - p->init_param = init_param; - p->readfile = readfile; - p->symbolfile = symbolfile; - p->system_type = system_type; - p->system_rev = system_rev; - return new AlphaSystem(p); + return new AlphaSystem(this); } - -REGISTER_SIM_OBJECT("AlphaSystem", AlphaSystem) - - diff --git a/src/arch/alpha/system.hh b/src/arch/alpha/system.hh index f92b71c9a..a934550b7 100644 --- a/src/arch/alpha/system.hh +++ b/src/arch/alpha/system.hh @@ -35,25 +35,18 @@ #include #include -#include "sim/system.hh" #include "base/loader/symtab.hh" #include "cpu/pc_event.hh" #include "kern/system_events.hh" +#include "params/AlphaSystem.hh" #include "sim/sim_object.hh" +#include "sim/system.hh" class AlphaSystem : public System { public: - struct Params : public System::Params - { - std::string console_path; - std::string palcode; - uint64_t system_type; - uint64_t system_rev; - }; - + typedef AlphaSystemParams Params; AlphaSystem(Params *p); - ~AlphaSystem(); /** diff --git a/src/arch/alpha/tlb.cc b/src/arch/alpha/tlb.cc index 714bca22a..214b2579f 100644 --- a/src/arch/alpha/tlb.cc +++ b/src/arch/alpha/tlb.cc @@ -41,7 +41,8 @@ #include "base/trace.hh" #include "config/alpha_tlaser.hh" #include "cpu/thread_context.hh" -#include "sim/builder.hh" +#include "params/AlphaDTB.hh" +#include "params/AlphaITB.hh" using namespace std; using namespace EV5; @@ -600,44 +601,14 @@ TLB::index(bool advance) /* end namespace AlphaISA */ } -DEFINE_SIM_OBJECT_CLASS_NAME("AlphaTLB", TLB) - -BEGIN_DECLARE_SIM_OBJECT_PARAMS(ITB) - - Param size; - -END_DECLARE_SIM_OBJECT_PARAMS(ITB) - -BEGIN_INIT_SIM_OBJECT_PARAMS(ITB) - - INIT_PARAM_DFLT(size, "TLB size", 48) - -END_INIT_SIM_OBJECT_PARAMS(ITB) - - -CREATE_SIM_OBJECT(ITB) +AlphaISA::ITB * +AlphaITBParams::create() { - return new ITB(getInstanceName(), size); + return new AlphaISA::ITB(name, size); } -REGISTER_SIM_OBJECT("AlphaITB", ITB) - -BEGIN_DECLARE_SIM_OBJECT_PARAMS(DTB) - - Param size; - -END_DECLARE_SIM_OBJECT_PARAMS(DTB) - -BEGIN_INIT_SIM_OBJECT_PARAMS(DTB) - - INIT_PARAM_DFLT(size, "TLB size", 64) - -END_INIT_SIM_OBJECT_PARAMS(DTB) - - -CREATE_SIM_OBJECT(DTB) +AlphaISA::DTB * +AlphaDTBParams::create() { - return new DTB(getInstanceName(), size); + return new AlphaISA::DTB(name, size); } - -REGISTER_SIM_OBJECT("AlphaDTB", DTB) diff --git a/src/arch/alpha/tru64/system.cc b/src/arch/alpha/tru64/system.cc index 00918bda4..db3402d2a 100644 --- a/src/arch/alpha/tru64/system.cc +++ b/src/arch/alpha/tru64/system.cc @@ -40,7 +40,6 @@ #include "kern/system_events.hh" #include "mem/physical.hh" #include "mem/port.hh" -#include "sim/builder.hh" using namespace std; @@ -91,63 +90,8 @@ Tru64AlphaSystem::~Tru64AlphaSystem() #endif } -BEGIN_DECLARE_SIM_OBJECT_PARAMS(Tru64AlphaSystem) - - Param boot_cpu_frequency; - SimObjectParam physmem; - SimpleEnumParam mem_mode; - - Param kernel; - Param console; - Param pal; - - Param boot_osflags; - Param readfile; - Param symbolfile; - Param init_param; - - Param system_type; - Param system_rev; - -END_DECLARE_SIM_OBJECT_PARAMS(Tru64AlphaSystem) - -BEGIN_INIT_SIM_OBJECT_PARAMS(Tru64AlphaSystem) - - INIT_PARAM(boot_cpu_frequency, "frequency of the boot cpu"), - INIT_PARAM(physmem, "phsyical memory"), - INIT_ENUM_PARAM(mem_mode, "Memory Mode, (1=atomic, 2=timing)", - System::MemoryModeStrings), - INIT_PARAM(kernel, "file that contains the kernel code"), - INIT_PARAM(console, "file that contains the console code"), - INIT_PARAM(pal, "file that contains palcode"), - INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot", - "a"), - INIT_PARAM_DFLT(readfile, "file to read startup script from", ""), - INIT_PARAM_DFLT(symbolfile, "file to read symbols from", ""), - INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0), - INIT_PARAM_DFLT(system_type, "Type of system we are emulating", 12), - INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 2<<1) - -END_INIT_SIM_OBJECT_PARAMS(Tru64AlphaSystem) - -CREATE_SIM_OBJECT(Tru64AlphaSystem) +Tru64AlphaSystem * +Tru64AlphaSystemParams::create() { - AlphaSystem::Params *p = new AlphaSystem::Params; - p->name = getInstanceName(); - p->boot_cpu_frequency = boot_cpu_frequency; - p->physmem = physmem; - p->mem_mode = mem_mode; - p->kernel_path = kernel; - p->console_path = console; - p->palcode = pal; - p->boot_osflags = boot_osflags; - p->init_param = init_param; - p->readfile = readfile; - p->symbolfile = symbolfile; - p->system_type = system_type; - p->system_rev = system_rev; - - return new Tru64AlphaSystem(p); + return new Tru64AlphaSystem(this); } - -REGISTER_SIM_OBJECT("Tru64AlphaSystem", Tru64AlphaSystem) diff --git a/src/arch/alpha/tru64/system.hh b/src/arch/alpha/tru64/system.hh index 947e92f50..815a34213 100644 --- a/src/arch/alpha/tru64/system.hh +++ b/src/arch/alpha/tru64/system.hh @@ -34,6 +34,7 @@ #include "arch/alpha/system.hh" #include "arch/isa_traits.hh" +#include "params/Tru64AlphaSystem.hh" #include "sim/system.hh" class ThreadContext; @@ -64,6 +65,7 @@ class Tru64AlphaSystem : public AlphaSystem DumpMbufEvent *dumpMbufEvent; public: + typedef Tru64AlphaSystemParams Params; Tru64AlphaSystem(Params *p); ~Tru64AlphaSystem(); -- cgit v1.2.3