+Port::Port(const std::string &_name, MemObject& _owner, PortID _id)
+ : portName(_name), id(_id), owner(_owner)
+{
+}
+
+Port::~Port()
+{
+}
+
+/**
+ * Master port
+ */
+MasterPort::MasterPort(const std::string& name, MemObject* owner, PortID _id)
+ : Port(name, *owner, _id), _slavePort(NULL)
+{
+}
+
+MasterPort::~MasterPort()
+{
+}
+
+SlavePort&
+MasterPort::getSlavePort() const
+{
+ if(_slavePort == NULL)
+ panic("Cannot getSlavePort on master port %s that is not connected\n",
+ name());
+
+ return *_slavePort;
+}
+
+void
+MasterPort::unBind()
+{
+ _slavePort = NULL;
+}
+
+void
+MasterPort::bind(SlavePort& slave_port)
+{
+ // master port keeps track of the slave port
+ _slavePort = &slave_port;
+
+ // slave port also keeps track of master port
+ _slavePort->bind(*this);
+}
+
+bool
+MasterPort::isConnected() const
+{
+ return _slavePort != NULL;
+}
+
+unsigned
+MasterPort::peerBlockSize() const
+{
+ return _slavePort->deviceBlockSize();
+}
+
+AddrRangeList
+MasterPort::getAddrRanges() const
+{
+ return _slavePort->getAddrRanges();
+}
+
+Tick
+MasterPort::sendAtomic(PacketPtr pkt)
+{
+ assert(pkt->isRequest());
+ return _slavePort->recvAtomic(pkt);
+}
+