summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/sim_object.cc6
-rw-r--r--src/sim/sim_object.hh13
2 files changed, 19 insertions, 0 deletions
diff --git a/src/sim/sim_object.cc b/src/sim/sim_object.cc
index ab92ae55a..7b794a0b7 100644
--- a/src/sim/sim_object.cc
+++ b/src/sim/sim_object.cc
@@ -133,6 +133,12 @@ SimObject::getProbeManager()
return probeManager;
}
+Port &
+SimObject::getPort(const std::string &if_name, PortID idx)
+{
+ fatal("%s does not have any port named %s\n", name(), if_name);
+}
+
//
// static function: serialize all SimObjects.
//
diff --git a/src/sim/sim_object.hh b/src/sim/sim_object.hh
index 42a19bbe7..5c9bf0019 100644
--- a/src/sim/sim_object.hh
+++ b/src/sim/sim_object.hh
@@ -56,6 +56,7 @@
#include "sim/drain.hh"
#include "sim/eventq.hh"
#include "sim/eventq_impl.hh"
+#include "sim/port.hh"
#include "sim/serialize.hh"
class EventManager;
@@ -170,6 +171,18 @@ class SimObject : public EventManager, public Serializable, public Drainable
ProbeManager *getProbeManager();
/**
+ * Get a port with a given name and index. This is used at binding time
+ * and returns a reference to a protocol-agnostic port.
+ *
+ * @param if_name Port name
+ * @param idx Index in the case of a VectorPort
+ *
+ * @return A reference to the given port
+ */
+ virtual Port &getPort(const std::string &if_name,
+ PortID idx=InvalidPortID);
+
+ /**
* startup() is the final initialization call before simulation.
* All state is initialized (including unserialized state, if any,
* such as the curTick() value), so this is the appropriate place to