#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)
{
}
}
// 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);
}
name());
_slavePort->slaveUnbind();
_slavePort = nullptr;
- BaseMasterPort::unbind();
+ Port::unbind();
}
AddrRangeList
* 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)
{
}
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
class SimObject;
-/** Forward declaration */
-class BaseSlavePort;
-
-/**
- * A BaseMasterPort is a protocol-agnostic master port, responsible
- * only for the structural connection to a slave port. The final
- * master port that inherits from the base class must override the
- * bind member function for the specific slave port class.
- */
-class BaseMasterPort : public Port
-{
- protected:
- BaseSlavePort *_baseSlavePort;
-
- BaseMasterPort(const std::string &name, PortID id=InvalidPortID);
- virtual ~BaseMasterPort();
-
- public:
- BaseSlavePort& getSlavePort() const;
- void bind(Port &peer) override;
- void unbind() override;
-};
-
-/**
- * A BaseSlavePort is a protocol-agnostic slave port, responsible
- * only for the structural connection to a master port.
- */
-class BaseSlavePort : public Port
-{
- protected:
- BaseMasterPort *_baseMasterPort;
-
- BaseSlavePort(const std::string &name, PortID id=InvalidPortID);
- virtual ~BaseSlavePort();
-
- public:
- BaseMasterPort& getMasterPort() const;
- void bind(Port &peer) override;
- void unbind() override;
-};
-
/** Forward declaration */
class SlavePort;
* The three protocols are atomic, timing, and functional, each with its own
* header file.
*/
-class MasterPort : public BaseMasterPort, public AtomicRequestProtocol,
+class MasterPort : public Port, public AtomicRequestProtocol,
public TimingRequestProtocol, public FunctionalRequestProtocol
{
friend class SlavePort;
* The three protocols are atomic, timing, and functional, each with its own
* header file.
*/
-class SlavePort : public BaseSlavePort, public AtomicResponseProtocol,
+class SlavePort : public Port, public AtomicResponseProtocol,
public TimingResponseProtocol, public FunctionalResponseProtocol
{
friend class MasterPort;