summaryrefslogtreecommitdiff
path: root/dev
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2005-06-29 01:20:41 -0400
committerNathan Binkert <binkertn@umich.edu>2005-06-29 01:20:41 -0400
commit8a0bc840221cf7af4845f4ee44de11bc7271ff10 (patch)
tree96800ff9b98a6bc32bdb5a443974bb8c2994ebc4 /dev
parent036a8ceb8da8aff10b819b4aab32584d41282a64 (diff)
downloadgem5-8a0bc840221cf7af4845f4ee44de11bc7271ff10.tar.xz
Allow CPUs to specify their own CPU ids.
Make the AlphaConsole calculate the number of CPUs instead of passing that in as a parameter. cpu/base.cc: pass the desired cpu_id into registerExecContext, offsetting it by the thread number. a cpu_id of -1 means that it should be generated for you. cpu/base.hh: Take the cpu_id as a parameter cpu/o3/alpha_cpu_builder.cc: cpu/simple/cpu.cc: Accept the cpu_id as a parameter while we're here, let's remove the multiplier since it is not used. dev/alpha_console.cc: don't take the number of CPUs as a parameter. Calculate it from the system based on the number of CPUs that have been registered. move init() code to startup() to ensure that all CPUs are registerd. dev/alpha_console.hh: python/m5/objects/AlphaConsole.py: don't take the number of CPUs as a parameter. move init() code to startup() to ensure that all CPUs are registerd. python/m5/objects/BaseCPU.py: take the cpu_id as a parameter. Default it to -1 which means that it will be generated. sim/system.cc: allow the registerExecContext functioin to take a desired cpu_id as a parameter. Check to ensure that the id isn't already used. Accept -1 as a request to have an id assigned. sim/system.hh: keep track of the number of registered exec contexts. provide a function for accessing the number of exec contexts that checks to ensure that they are all registered correctly. --HG-- extra : convert_revision : 8e12f96ff8a49fa16cdbbdb4c05c651376c35788
Diffstat (limited to 'dev')
-rw-r--r--dev/alpha_console.cc11
-rw-r--r--dev/alpha_console.hh4
2 files changed, 6 insertions, 9 deletions
diff --git a/dev/alpha_console.cc b/dev/alpha_console.cc
index 34c2978aa..c4799bf6b 100644
--- a/dev/alpha_console.cc
+++ b/dev/alpha_console.cc
@@ -56,7 +56,7 @@ using namespace std;
AlphaConsole::AlphaConsole(const string &name, SimConsole *cons, SimpleDisk *d,
System *s, BaseCPU *c, Platform *p,
- int num_cpus, MemoryController *mmu, Addr a,
+ MemoryController *mmu, Addr a,
HierParams *hier, Bus *bus)
: PioDevice(name, p), disk(d), console(cons), system(s), cpu(c), addr(a)
{
@@ -72,7 +72,6 @@ AlphaConsole::AlphaConsole(const string &name, SimConsole *cons, SimpleDisk *d,
alphaAccess->last_offset = size - 1;
alphaAccess->version = ALPHA_ACCESS_VERSION;
- alphaAccess->numCPUs = num_cpus;
alphaAccess->diskUnit = 1;
alphaAccess->diskCount = 0;
@@ -89,8 +88,9 @@ AlphaConsole::AlphaConsole(const string &name, SimConsole *cons, SimpleDisk *d,
}
void
-AlphaConsole::init()
+AlphaConsole::startup()
{
+ alphaAccess->numCPUs = system->getNumCPUs();
alphaAccess->kernStart = system->getKernelStart();
alphaAccess->kernEnd = system->getKernelEnd();
alphaAccess->entryPoint = system->getKernelEntry();
@@ -330,7 +330,6 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(AlphaConsole)
SimObjectParam<SimConsole *> sim_console;
SimObjectParam<SimpleDisk *> disk;
- Param<int> num_cpus;
SimObjectParam<MemoryController *> mmu;
Param<Addr> addr;
SimObjectParam<System *> system;
@@ -346,7 +345,6 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(AlphaConsole)
INIT_PARAM(sim_console, "The Simulator Console"),
INIT_PARAM(disk, "Simple Disk"),
- INIT_PARAM_DFLT(num_cpus, "Number of CPU's", 1),
INIT_PARAM(mmu, "Memory Controller"),
INIT_PARAM(addr, "Device Address"),
INIT_PARAM(system, "system object"),
@@ -361,8 +359,7 @@ END_INIT_SIM_OBJECT_PARAMS(AlphaConsole)
CREATE_SIM_OBJECT(AlphaConsole)
{
return new AlphaConsole(getInstanceName(), sim_console, disk,
- system, cpu, platform, num_cpus, mmu,
- addr, hier, io_bus);
+ system, cpu, platform, mmu, addr, hier, io_bus);
}
REGISTER_SIM_OBJECT("AlphaConsole", AlphaConsole)
diff --git a/dev/alpha_console.hh b/dev/alpha_console.hh
index eb59626f5..6236c5713 100644
--- a/dev/alpha_console.hh
+++ b/dev/alpha_console.hh
@@ -102,10 +102,10 @@ class AlphaConsole : public PioDevice
/** Standard Constructor */
AlphaConsole(const std::string &name, SimConsole *cons, SimpleDisk *d,
System *s, BaseCPU *c, Platform *platform,
- int num_cpus, MemoryController *mmu, Addr addr,
+ MemoryController *mmu, Addr addr,
HierParams *hier, Bus *bus);
- virtual void init();
+ virtual void startup();
/**
* memory mapped reads and writes