summaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2006-03-26 21:44:22 -0500
committerAli Saidi <saidi@eecs.umich.edu>2006-03-26 21:44:22 -0500
commitc27c122afc6b778e67a9c77915fac71730a5a4ef (patch)
tree3056d2ebc1c9eb74fc8d850a942666ce46ad2026 /sim
parent4973a16b34471dcb5f65a1d6c31d5a7d8c2dfd83 (diff)
downloadgem5-c27c122afc6b778e67a9c77915fac71730a5a4ef.tar.xz
Add the bus and connector objects to scons
change getPort parameter from char* to string Add an extra phase between construction and init called connect SConscript: Add the bus and connector objects to scons cpu/simple/cpu.cc: cpu/simple/cpu.hh: the connection to memory shouldn't be made until we know the memory object exists (e.g. after construction) dev/io_device.hh: change to const string mem/bus.hh: change getPort parameter from char* to string initialize num_interfaces mem/mem_object.hh: change getPort parameter from char* to string mem/physical.cc: mem/physical.hh: change getPort parameter from char* to string get rid of the bus object I created last time python/m5/objects/PhysicalMemory.py: get rid of the bus object I created last time sim/main.cc: sim/sim_object.cc: sim/sim_object.hh: Add an extra phase between construction and init called connect --HG-- extra : convert_revision : 0e994f93374fa72a06d291655c440ff1b8e155a9
Diffstat (limited to 'sim')
-rw-r--r--sim/main.cc4
-rw-r--r--sim/sim_object.cc20
-rw-r--r--sim/sim_object.hh2
3 files changed, 26 insertions, 0 deletions
diff --git a/sim/main.cc b/sim/main.cc
index 6f6143506..aecc171ed 100644
--- a/sim/main.cc
+++ b/sim/main.cc
@@ -355,6 +355,10 @@ main(int argc, char **argv)
echoCommandLine(argc, argv, *outputStream);
ParamContext::showAllContexts(*configStream);
+ // Any objects that can't connect themselves until after construction should
+ // do so now
+ SimObject::connectAll();
+
// Do a second pass to finish initializing the sim objects
SimObject::initAll();
diff --git a/sim/sim_object.cc b/sim/sim_object.cc
index f34e17fe6..151ba68a7 100644
--- a/sim/sim_object.cc
+++ b/sim/sim_object.cc
@@ -88,6 +88,11 @@ SimObject::SimObject(const string &_name)
}
void
+SimObject::connect()
+{
+}
+
+void
SimObject::init()
{
}
@@ -151,6 +156,21 @@ SimObject::regAllStats()
}
//
+// static function: call connect() on all SimObjects.
+//
+void
+SimObject::connectAll()
+{
+ SimObjectList::iterator i = simObjectList.begin();
+ SimObjectList::iterator end = simObjectList.end();
+
+ for (; i != end; ++i) {
+ SimObject *obj = *i;
+ obj->connect();
+ }
+}
+
+//
// static function: call init() on all SimObjects.
//
void
diff --git a/sim/sim_object.hh b/sim/sim_object.hh
index 59d9daf45..5db62dd51 100644
--- a/sim/sim_object.hh
+++ b/sim/sim_object.hh
@@ -78,7 +78,9 @@ class SimObject : public Serializable, protected StartupCallback
// initialization pass of all objects.
// Gets invoked after construction, before unserialize.
virtual void init();
+ virtual void connect();
static void initAll();
+ static void connectAll();
// register statistics for this object
virtual void regStats();