summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/port.cc4
-rw-r--r--src/sim/port.hh14
2 files changed, 16 insertions, 2 deletions
diff --git a/src/sim/port.cc b/src/sim/port.cc
index 551785ba4..b3139a630 100644
--- a/src/sim/port.cc
+++ b/src/sim/port.cc
@@ -49,5 +49,7 @@
#include "sim/port.hh"
-Port::Port(const std::string& _name, PortID _id) : portName(_name), id(_id) {}
+Port::Port(const std::string& _name, PortID _id) :
+ portName(_name), id(_id), _connected(false)
+{}
Port::~Port() {}
diff --git a/src/sim/port.hh b/src/sim/port.hh
index 368f46783..e1811643f 100644
--- a/src/sim/port.hh
+++ b/src/sim/port.hh
@@ -63,7 +63,7 @@ class Port
private:
/** Descriptive name (for DPRINTF output) */
- std::string portName;
+ const std::string portName;
protected:
@@ -72,6 +72,10 @@ class Port
* to InvalidPortID in case this port is not part of a vector.
*/
const PortID id;
+ /**
+ * Whether this port is currently connected to a peer port.
+ */
+ bool _connected;
/**
* Abstract base class for ports
@@ -94,6 +98,14 @@ class Port
/** Get the port id. */
PortID getId() const { return id; }
+ /** Attach to a peer port. */
+ virtual void bind(Port &peer) = 0;
+
+ /** Dettach from a peer port. */
+ virtual void unbind() = 0;
+
+ /** Is this port currently connected to a peer? */
+ bool isConnected() const { return _connected; }
};
#endif //__SIM_PORT_HH__