summaryrefslogtreecommitdiff
path: root/src/mem
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem')
-rw-r--r--src/mem/port.cc12
-rw-r--r--src/mem/port.hh25
2 files changed, 32 insertions, 5 deletions
diff --git a/src/mem/port.cc b/src/mem/port.cc
index 3827994fb..9b65da756 100644
--- a/src/mem/port.cc
+++ b/src/mem/port.cc
@@ -82,14 +82,22 @@ MasterPort::getSlavePort() const
}
void
-MasterPort::unBind()
+MasterPort::unbind()
{
+ if (_slavePort == NULL)
+ panic("Attempting to unbind master port %s that is not connected\n",
+ name());
+ _slavePort->unbind();
_slavePort = NULL;
}
void
MasterPort::bind(SlavePort& slave_port)
{
+ if (_slavePort != NULL)
+ panic("Attempting to bind master port %s that is already connected\n",
+ name());
+
// master port keeps track of the slave port
_slavePort = &slave_port;
@@ -173,7 +181,7 @@ SlavePort::~SlavePort()
}
void
-SlavePort::unBind()
+SlavePort::unbind()
{
_masterPort = NULL;
}
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;