summaryrefslogtreecommitdiff
path: root/src/mem/port.cc
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.cc
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.cc')
-rw-r--r--src/mem/port.cc12
1 files changed, 10 insertions, 2 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;
}