summaryrefslogtreecommitdiff
path: root/src/mem/port.hh
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2012-08-28 14:30:27 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2012-08-28 14:30:27 -0400
commitd14e5857c7e1ee053fb4eb448c4776d7c985c5b2 (patch)
treee57462955190d314ee97fbe7c3a3a53178aa5148 /src/mem/port.hh
parentfb5dd28420d6cebdf4f12a095c3aa32cd5611ed9 (diff)
downloadgem5-d14e5857c7e1ee053fb4eb448c4776d7c985c5b2.tar.xz
Port: Stricter port bind/unbind semantics
This patch tightens up the semantics around port binding and checks that the ports that are being bound are currently not connected, and similarly connected before unbind is called. The patch consequently also changes the order of the unbind and bind for the switching of CPUs to ensure that the rules are adhered to. Previously the ports would be "over-written" without any check. There are no changes in behaviour due to this patch, and the only place where the unbind functionality is used is in the CPU.
Diffstat (limited to 'src/mem/port.hh')
-rw-r--r--src/mem/port.hh25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/mem/port.hh b/src/mem/port.hh
index eac92791e..631725ce1 100644
--- a/src/mem/port.hh
+++ b/src/mem/port.hh
@@ -140,8 +140,17 @@ class MasterPort : public Port
PortID id = InvalidPortID);
virtual ~MasterPort();
- void unBind();
+ /**
+ * Bind this master port to a slave port. This also does the
+ * mirror action and binds the slave port to the master port.
+ */
void bind(SlavePort& slave_port);
+
+ /**
+ * Unbind this master port and the associated slave port.
+ */
+ void unbind();
+
SlavePort& getSlavePort() const;
bool isConnected() const;
@@ -298,8 +307,6 @@ class SlavePort : public Port
PortID id = InvalidPortID);
virtual ~SlavePort();
- void unBind();
- void bind(MasterPort& master_port);
MasterPort& getMasterPort() const;
bool isConnected() const;
@@ -387,6 +394,18 @@ class SlavePort : public Port
protected:
/**
+ * Called by the master port to unbind. Should never be called
+ * directly.
+ */
+ void unbind();
+
+ /**
+ * Called by the master port to bind. Should never be called
+ * directly.
+ */
+ void bind(MasterPort& master_port);
+
+ /**
* Receive an atomic request packet from the master port.
*/
virtual Tick recvAtomic(PacketPtr pkt) = 0;