summaryrefslogtreecommitdiff
path: root/src/mem/port.cc
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2019-08-17 00:13:09 -0700
committerGabe Black <gabeblack@google.com>2019-08-28 02:14:21 +0000
commitc387a212d98024e42e4267ff364c2976f976d666 (patch)
treede4f67564682bb2d8633dc99f6cb048481c7e370 /src/mem/port.cc
parent4d503eeffee054de0aab10962c345ca4bcb54140 (diff)
downloadgem5-c387a212d98024e42e4267ff364c2976f976d666.tar.xz
mem: Eliminate the Base(Slave|Master)Port classes.
The Port class has assumed all the duties of the less generic Base*Port classes, making them unnecessary. Since they don't add anything but make the code more complex, this change eliminates them. Change-Id: Ibb9c56def04465f353362595c1f1c5ac5083e5e9 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/20236 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/mem/port.cc')
-rw-r--r--src/mem/port.cc82
1 files changed, 6 insertions, 76 deletions
diff --git a/src/mem/port.cc b/src/mem/port.cc
index 303d1bc41..36e11caec 100644
--- a/src/mem/port.cc
+++ b/src/mem/port.cc
@@ -51,81 +51,11 @@
#include "base/trace.hh"
#include "sim/sim_object.hh"
-BaseMasterPort::BaseMasterPort(const std::string &name, PortID _id)
- : Port(name, _id), _baseSlavePort(NULL)
-{
-}
-
-BaseMasterPort::~BaseMasterPort()
-{
-}
-
-BaseSlavePort&
-BaseMasterPort::getSlavePort() const
-{
- if (_baseSlavePort == NULL)
- panic("Cannot getSlavePort on master port %s that is not connected\n",
- name());
-
- return *_baseSlavePort;
-}
-
-void
-BaseMasterPort::bind(Port &peer)
-{
- _baseSlavePort = dynamic_cast<BaseSlavePort *>(&peer);
- fatal_if(!_baseSlavePort, "Attempt to bind port %s to non-master port %s.",
- name(), peer.name());
- Port::bind(peer);
-}
-
-void
-BaseMasterPort::unbind()
-{
- _baseSlavePort = nullptr;
- Port::unbind();
-}
-
-BaseSlavePort::BaseSlavePort(const std::string &name, PortID _id)
- : Port(name, _id), _baseMasterPort(NULL)
-{
-}
-
-BaseSlavePort::~BaseSlavePort()
-{
-}
-
-BaseMasterPort&
-BaseSlavePort::getMasterPort() const
-{
- if (_baseMasterPort == NULL)
- panic("Cannot getMasterPort on slave port %s that is not connected\n",
- name());
-
- return *_baseMasterPort;
-}
-
-void
-BaseSlavePort::bind(Port &peer)
-{
- _baseMasterPort = dynamic_cast<BaseMasterPort *>(&peer);
- fatal_if(!_baseMasterPort, "Attempt to bind port %s to non-slave port %s.",
- name(), peer.name());
- Port::bind(peer);
-}
-
-void
-BaseSlavePort::unbind()
-{
- _baseMasterPort = nullptr;
- Port::unbind();
-}
-
/**
* Master port
*/
MasterPort::MasterPort(const std::string& name, SimObject* _owner, PortID _id)
- : BaseMasterPort(name, _id), _slavePort(NULL), owner(*_owner)
+ : Port(name, _id), _slavePort(NULL), owner(*_owner)
{
}
@@ -143,7 +73,7 @@ MasterPort::bind(Port &peer)
}
// master port keeps track of the slave port
_slavePort = slave_port;
- BaseMasterPort::bind(peer);
+ Port::bind(peer);
// slave port also keeps track of master port
_slavePort->slaveBind(*this);
}
@@ -156,7 +86,7 @@ MasterPort::unbind()
name());
_slavePort->slaveUnbind();
_slavePort = nullptr;
- BaseMasterPort::unbind();
+ Port::unbind();
}
AddrRangeList
@@ -182,7 +112,7 @@ MasterPort::printAddr(Addr a)
* Slave port
*/
SlavePort::SlavePort(const std::string& name, SimObject* _owner, PortID id)
- : BaseSlavePort(name, id), _masterPort(NULL), defaultBackdoorWarned(false),
+ : Port(name, id), _masterPort(NULL), defaultBackdoorWarned(false),
owner(*_owner)
{
}
@@ -195,14 +125,14 @@ void
SlavePort::slaveUnbind()
{
_masterPort = NULL;
- BaseSlavePort::unbind();
+ Port::unbind();
}
void
SlavePort::slaveBind(MasterPort& master_port)
{
_masterPort = &master_port;
- BaseSlavePort::bind(master_port);
+ Port::bind(master_port);
}
Tick