summaryrefslogtreecommitdiff
path: root/src/mem
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2012-10-15 08:12:35 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2012-10-15 08:12:35 -0400
commit2a740aa09682c32eb8f1f8880f279c943d8c6ee1 (patch)
tree61ca1dcb9336bc1f4dbc791c876875c1c260ca8d /src/mem
parent9baa35ba802f2cfb9fb9ecdebf111f4cd793a428 (diff)
downloadgem5-2a740aa09682c32eb8f1f8880f279c943d8c6ee1.tar.xz
Port: Add protocol-agnostic ports in the port hierarchy
This patch adds an additional level of ports in the inheritance hierarchy, separating out the protocol-specific and protocl-agnostic parts. All the functionality related to the binding of ports is now confined to use BaseMaster/BaseSlavePorts, and all the protocol-specific parts stay in the Master/SlavePort. In the future it will be possible to add other protocol-specific implementations. The functions used in the binding of ports, i.e. getMaster/SlavePort now use the base classes, and the index parameter is updated to use the PortID typedef with the symbolic InvalidPortID as the default.
Diffstat (limited to 'src/mem')
-rw-r--r--src/mem/addr_mapper.cc12
-rw-r--r--src/mem/addr_mapper.hh8
-rw-r--r--src/mem/bridge.cc8
-rw-r--r--src/mem/bridge.hh7
-rw-r--r--src/mem/bus.cc8
-rw-r--r--src/mem/bus.hh6
-rw-r--r--src/mem/cache/base.cc8
-rw-r--r--src/mem/cache/base.hh6
-rw-r--r--src/mem/comm_monitor.cc8
-rw-r--r--src/mem/comm_monitor.hh8
-rw-r--r--src/mem/mem_object.cc8
-rw-r--r--src/mem/mem_object.hh16
-rw-r--r--src/mem/port.cc120
-rw-r--r--src/mem/port.hh72
-rw-r--r--src/mem/ruby/system/RubyPort.cc12
-rw-r--r--src/mem/ruby/system/RubyPort.hh6
-rw-r--r--src/mem/simple_dram.cc4
-rw-r--r--src/mem/simple_dram.hh4
-rw-r--r--src/mem/simple_mem.cc4
-rw-r--r--src/mem/simple_mem.hh3
20 files changed, 208 insertions, 120 deletions
diff --git a/src/mem/addr_mapper.cc b/src/mem/addr_mapper.cc
index 28fc85245..b754cb7e6 100644
--- a/src/mem/addr_mapper.cc
+++ b/src/mem/addr_mapper.cc
@@ -59,8 +59,8 @@ AddrMapper::init()
slavePort.peerBlockSize(), masterPort.peerBlockSize());
}
-MasterPort&
-AddrMapper::getMasterPort(const std::string& if_name, int idx)
+BaseMasterPort&
+AddrMapper::getMasterPort(const std::string& if_name, PortID idx)
{
if (if_name == "master") {
return masterPort;
@@ -69,8 +69,8 @@ AddrMapper::getMasterPort(const std::string& if_name, int idx)
}
}
-SlavePort&
-AddrMapper::getSlavePort(const std::string& if_name, int idx)
+BaseSlavePort&
+AddrMapper::getSlavePort(const std::string& if_name, PortID idx)
{
if (if_name == "slave") {
return slavePort;
@@ -192,7 +192,7 @@ AddrMapper::recvTimingSnoopResp(PacketPtr pkt)
bool
AddrMapper::isSnooping() const
{
- if (slavePort.getMasterPort().isSnooping())
+ if (slavePort.isSnooping())
fatal("AddrMapper doesn't support remapping of snooping requests\n");
return false;
}
@@ -266,7 +266,7 @@ AddrRangeList
RangeAddrMapper::getAddrRanges() const
{
AddrRangeList ranges;
- AddrRangeList actualRanges = masterPort.getSlavePort().getAddrRanges();
+ AddrRangeList actualRanges = masterPort.getAddrRanges();
for (AddrRangeIter r = actualRanges.begin(); r != actualRanges.end(); ++r) {
AddrRange range = *r;
diff --git a/src/mem/addr_mapper.hh b/src/mem/addr_mapper.hh
index f469b26ba..887635999 100644
--- a/src/mem/addr_mapper.hh
+++ b/src/mem/addr_mapper.hh
@@ -62,11 +62,11 @@ class AddrMapper : public MemObject
virtual ~AddrMapper() { }
- virtual MasterPort& getMasterPort(const std::string& if_name,
- int idx = -1);
+ virtual BaseMasterPort& getMasterPort(const std::string& if_name,
+ PortID idx = InvalidPortID);
- virtual SlavePort& getSlavePort(const std::string& if_name,
- int idx = -1);
+ virtual BaseSlavePort& getSlavePort(const std::string& if_name,
+ PortID idx = InvalidPortID);
virtual void init();
diff --git a/src/mem/bridge.cc b/src/mem/bridge.cc
index 8bc34e12e..bece5e6a1 100644
--- a/src/mem/bridge.cc
+++ b/src/mem/bridge.cc
@@ -83,8 +83,8 @@ Bridge::Bridge(Params *p)
{
}
-MasterPort&
-Bridge::getMasterPort(const std::string &if_name, int idx)
+BaseMasterPort&
+Bridge::getMasterPort(const std::string &if_name, PortID idx)
{
if (if_name == "master")
return masterPort;
@@ -93,8 +93,8 @@ Bridge::getMasterPort(const std::string &if_name, int idx)
return MemObject::getMasterPort(if_name, idx);
}
-SlavePort&
-Bridge::getSlavePort(const std::string &if_name, int idx)
+BaseSlavePort&
+Bridge::getSlavePort(const std::string &if_name, PortID idx)
{
if (if_name == "slave")
return slavePort;
diff --git a/src/mem/bridge.hh b/src/mem/bridge.hh
index eb0b2434f..6855d2722 100644
--- a/src/mem/bridge.hh
+++ b/src/mem/bridge.hh
@@ -338,9 +338,10 @@ class Bridge : public MemObject
public:
- virtual MasterPort& getMasterPort(const std::string& if_name,
- int idx = -1);
- virtual SlavePort& getSlavePort(const std::string& if_name, int idx = -1);
+ virtual BaseMasterPort& getMasterPort(const std::string& if_name,
+ PortID idx = InvalidPortID);
+ virtual BaseSlavePort& getSlavePort(const std::string& if_name,
+ PortID idx = InvalidPortID);
virtual void init();
diff --git a/src/mem/bus.cc b/src/mem/bus.cc
index badf145ac..274b8c258 100644
--- a/src/mem/bus.cc
+++ b/src/mem/bus.cc
@@ -105,8 +105,8 @@ BaseBus::init()
warn_once("Block size is neither 16, 32, 64 or 128 bytes.\n");
}
-MasterPort &
-BaseBus::getMasterPort(const std::string &if_name, int idx)
+BaseMasterPort &
+BaseBus::getMasterPort(const std::string &if_name, PortID idx)
{
if (if_name == "master" && idx < masterPorts.size()) {
// the master port index translates directly to the vector position
@@ -118,8 +118,8 @@ BaseBus::getMasterPort(const std::string &if_name, int idx)
}
}
-SlavePort &
-BaseBus::getSlavePort(const std::string &if_name, int idx)
+BaseSlavePort &
+BaseBus::getSlavePort(const std::string &if_name, PortID idx)
{
if (if_name == "slave" && idx < slavePorts.size()) {
// the slave port index translates directly to the vector position
diff --git a/src/mem/bus.hh b/src/mem/bus.hh
index 26729f7cc..f3cbc9d24 100644
--- a/src/mem/bus.hh
+++ b/src/mem/bus.hh
@@ -361,8 +361,10 @@ class BaseBus : public MemObject
virtual void init();
/** A function used to return the port associated with this bus object. */
- virtual MasterPort& getMasterPort(const std::string& if_name, int idx = -1);
- virtual SlavePort& getSlavePort(const std::string& if_name, int idx = -1);
+ BaseMasterPort& getMasterPort(const std::string& if_name,
+ PortID idx = InvalidPortID);
+ BaseSlavePort& getSlavePort(const std::string& if_name,
+ PortID idx = InvalidPortID);
virtual unsigned int drain(Event *de) = 0;
diff --git a/src/mem/cache/base.cc b/src/mem/cache/base.cc
index c95999f3e..a88749627 100644
--- a/src/mem/cache/base.cc
+++ b/src/mem/cache/base.cc
@@ -118,8 +118,8 @@ BaseCache::init()
cpuSidePort->sendRangeChange();
}
-MasterPort &
-BaseCache::getMasterPort(const std::string &if_name, int idx)
+BaseMasterPort &
+BaseCache::getMasterPort(const std::string &if_name, PortID idx)
{
if (if_name == "mem_side") {
return *memSidePort;
@@ -128,8 +128,8 @@ BaseCache::getMasterPort(const std::string &if_name, int idx)
}
}
-SlavePort &
-BaseCache::getSlavePort(const std::string &if_name, int idx)
+BaseSlavePort &
+BaseCache::getSlavePort(const std::string &if_name, PortID idx)
{
if (if_name == "cpu_side") {
return *cpuSidePort;
diff --git a/src/mem/cache/base.hh b/src/mem/cache/base.hh
index 2e31836c0..42ade9b0b 100644
--- a/src/mem/cache/base.hh
+++ b/src/mem/cache/base.hh
@@ -430,8 +430,10 @@ class BaseCache : public MemObject
virtual void init();
- virtual MasterPort &getMasterPort(const std::string &if_name, int idx = -1);
- virtual SlavePort &getSlavePort(const std::string &if_name, int idx = -1);
+ virtual BaseMasterPort &getMasterPort(const std::string &if_name,
+ PortID idx = InvalidPortID);
+ virtual BaseSlavePort &getSlavePort(const std::string &if_name,
+ PortID idx = InvalidPortID);
/**
* Query block size of a cache.
diff --git a/src/mem/comm_monitor.cc b/src/mem/comm_monitor.cc
index 1b030de5e..aea028692 100644
--- a/src/mem/comm_monitor.cc
+++ b/src/mem/comm_monitor.cc
@@ -74,8 +74,8 @@ CommMonitor::init()
fatal("Communication monitor is not connected on both sides.\n");
}
-MasterPort&
-CommMonitor::getMasterPort(const std::string& if_name, int idx)
+BaseMasterPort&
+CommMonitor::getMasterPort(const std::string& if_name, PortID idx)
{
if (if_name == "master") {
return masterPort;
@@ -84,8 +84,8 @@ CommMonitor::getMasterPort(const std::string& if_name, int idx)
}
}
-SlavePort&
-CommMonitor::getSlavePort(const std::string& if_name, int idx)
+BaseSlavePort&
+CommMonitor::getSlavePort(const std::string& if_name, PortID idx)
{
if (if_name == "slave") {
return slavePort;
diff --git a/src/mem/comm_monitor.hh b/src/mem/comm_monitor.hh
index 4b90306e1..e59b8c467 100644
--- a/src/mem/comm_monitor.hh
+++ b/src/mem/comm_monitor.hh
@@ -77,11 +77,11 @@ class CommMonitor : public MemObject
/** Destructor */
~CommMonitor() { }
- virtual MasterPort& getMasterPort(const std::string& if_name,
- int idx = -1);
+ virtual BaseMasterPort& getMasterPort(const std::string& if_name,
+ PortID idx = InvalidPortID);
- virtual SlavePort& getSlavePort(const std::string& if_name,
- int idx = -1);
+ virtual BaseSlavePort& getSlavePort(const std::string& if_name,
+ PortID idx = InvalidPortID);
virtual void init();
diff --git a/src/mem/mem_object.cc b/src/mem/mem_object.cc
index cc05b7fc2..766eceeb7 100644
--- a/src/mem/mem_object.cc
+++ b/src/mem/mem_object.cc
@@ -48,14 +48,14 @@ MemObject::MemObject(const Params *params)
{
}
-MasterPort&
-MemObject::getMasterPort(const std::string& if_name, int idx)
+BaseMasterPort&
+MemObject::getMasterPort(const std::string& if_name, PortID idx)
{
fatal("%s does not have any master port named %s\n", name(), if_name);
}
-SlavePort&
-MemObject::getSlavePort(const std::string& if_name, int idx)
+BaseSlavePort&
+MemObject::getSlavePort(const std::string& if_name, PortID idx)
{
fatal("%s does not have any slave port named %s\n", name(), if_name);
}
diff --git a/src/mem/mem_object.hh b/src/mem/mem_object.hh
index 6cc0c4fd3..e12b30661 100644
--- a/src/mem/mem_object.hh
+++ b/src/mem/mem_object.hh
@@ -67,26 +67,30 @@ class MemObject : public ClockedObject
MemObject(const Params *params);
/**
- * Get a master port with a given name and index.
+ * Get a master port with a given name and index. This is used at
+ * binding time and returns a reference to a protocol-agnostic
+ * base master port.
*
* @param if_name Port name
* @param idx Index in the case of a VectorPort
*
* @return A reference to the given port
*/
- virtual MasterPort& getMasterPort(const std::string& if_name,
- int idx = -1);
+ virtual BaseMasterPort& getMasterPort(const std::string& if_name,
+ PortID idx = InvalidPortID);
/**
- * Get a slave port with a given name and index.
+ * Get a slave port with a given name and index. This is used at
+ * binding time and returns a reference to a protocol-agnostic
+ * base master port.
*
* @param if_name Port name
* @param idx Index in the case of a VectorPort
*
* @return A reference to the given port
*/
- virtual SlavePort& getSlavePort(const std::string& if_name,
- int idx = -1);
+ virtual BaseSlavePort& getSlavePort(const std::string& if_name,
+ PortID idx = InvalidPortID);
};
#endif //__MEM_MEM_OBJECT_HH__
diff --git a/src/mem/port.cc b/src/mem/port.cc
index 9b65da756..45045f40e 100644
--- a/src/mem/port.cc
+++ b/src/mem/port.cc
@@ -59,56 +59,100 @@ Port::~Port()
{
}
-/**
- * Master port
- */
-MasterPort::MasterPort(const std::string& name, MemObject* owner, PortID _id)
- : Port(name, *owner, _id), _slavePort(NULL)
+BaseMasterPort::BaseMasterPort(const std::string& name, MemObject* owner,
+ PortID _id)
+ : Port(name, *owner, _id), _baseSlavePort(NULL)
{
}
-MasterPort::~MasterPort()
+BaseMasterPort::~BaseMasterPort()
{
}
-SlavePort&
-MasterPort::getSlavePort() const
+BaseSlavePort&
+BaseMasterPort::getSlavePort() const
{
- if(_slavePort == NULL)
+ if(_baseSlavePort == NULL)
panic("Cannot getSlavePort on master port %s that is not connected\n",
name());
- return *_slavePort;
+ return *_baseSlavePort;
}
-void
-MasterPort::unbind()
+bool
+BaseMasterPort::isConnected() const
{
- if (_slavePort == NULL)
- panic("Attempting to unbind master port %s that is not connected\n",
- name());
- _slavePort->unbind();
- _slavePort = NULL;
+ return _baseSlavePort != NULL;
}
-void
-MasterPort::bind(SlavePort& slave_port)
+BaseSlavePort::BaseSlavePort(const std::string& name, MemObject* owner,
+ PortID _id)
+ : Port(name, *owner, _id), _baseMasterPort(NULL)
{
- if (_slavePort != NULL)
- panic("Attempting to bind master port %s that is already connected\n",
- name());
+}
+
+BaseSlavePort::~BaseSlavePort()
+{
+}
- // master port keeps track of the slave port
- _slavePort = &slave_port;
+BaseMasterPort&
+BaseSlavePort::getMasterPort() const
+{
+ if(_baseMasterPort == NULL)
+ panic("Cannot getMasterPort on slave port %s that is not connected\n",
+ name());
- // slave port also keeps track of master port
- _slavePort->bind(*this);
+ return *_baseMasterPort;
}
bool
-MasterPort::isConnected() const
+BaseSlavePort::isConnected() const
+{
+ return _baseMasterPort != NULL;
+}
+
+/**
+ * Master port
+ */
+MasterPort::MasterPort(const std::string& name, MemObject* owner, PortID _id)
+ : BaseMasterPort(name, owner, _id), _slavePort(NULL)
{
- return _slavePort != NULL;
+}
+
+MasterPort::~MasterPort()
+{
+}
+
+void
+MasterPort::bind(BaseSlavePort& slave_port)
+{
+ // bind on the level of the base ports
+ _baseSlavePort = &slave_port;
+
+ // also attempt to base the slave to the appropriate type
+ SlavePort* cast_slave_port = dynamic_cast<SlavePort*>(&slave_port);
+
+ // if this port is compatible, then proceed with the binding
+ if (cast_slave_port != NULL) {
+ // master port keeps track of the slave port
+ _slavePort = cast_slave_port;
+ // slave port also keeps track of master port
+ _slavePort->bind(*this);
+ } else {
+ fatal("Master port %s cannot bind to %s\n", name(),
+ slave_port.name());
+ }
+}
+
+void
+MasterPort::unbind()
+{
+ if (_slavePort == NULL)
+ panic("Attempting to unbind master port %s that is not connected\n",
+ name());
+ _slavePort->unbind();
+ _slavePort = NULL;
+ _baseSlavePort = NULL;
}
unsigned
@@ -172,7 +216,7 @@ MasterPort::printAddr(Addr a)
* Slave port
*/
SlavePort::SlavePort(const std::string& name, MemObject* owner, PortID id)
- : Port(name, *owner, id), _masterPort(NULL)
+ : BaseSlavePort(name, owner, id), _masterPort(NULL)
{
}
@@ -183,37 +227,23 @@ SlavePort::~SlavePort()
void
SlavePort::unbind()
{
+ _baseMasterPort = NULL;
_masterPort = NULL;
}
void
SlavePort::bind(MasterPort& master_port)
{
+ _baseMasterPort = &master_port;
_masterPort = &master_port;
}
-MasterPort&
-SlavePort::getMasterPort() const
-{
- if (_masterPort == NULL)
- panic("Cannot getMasterPort on slave port %s that is not connected\n",
- name());
-
- return *_masterPort;
-}
-
unsigned
SlavePort::peerBlockSize() const
{
return _masterPort->deviceBlockSize();
}
-bool
-SlavePort::isConnected() const
-{
- return _masterPort != NULL;
-}
-
Tick
SlavePort::sendAtomicSnoop(PacketPtr pkt)
{
diff --git a/src/mem/port.hh b/src/mem/port.hh
index eaad9668a..53b82f66d 100644
--- a/src/mem/port.hh
+++ b/src/mem/port.hh
@@ -117,15 +117,67 @@ class Port
};
/** 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, MemObject* owner,
+ PortID id = InvalidPortID);
+ virtual ~BaseMasterPort();
+
+ public:
+
+ virtual void bind(BaseSlavePort& slave_port) = 0;
+ virtual void unbind() = 0;
+ BaseSlavePort& getSlavePort() const;
+ bool isConnected() const;
+
+};
+
+/**
+ * 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, MemObject* owner,
+ PortID id = InvalidPortID);
+ virtual ~BaseSlavePort();
+
+ public:
+
+ BaseMasterPort& getMasterPort() const;
+ bool isConnected() const;
+
+};
+
+/** Forward declaration */
class SlavePort;
/**
- * A MasterPort is a specialisation of a port. In addition to the
- * basic functionality of sending packets to its slave peer, it also
- * has functions specific to a master, e.g. to receive range changes
- * or determine if the port is snooping or not.
+ * A MasterPort is a specialisation of a BaseMasterPort, which
+ * implements the default protocol for the three different level of
+ * transport functions. In addition to the basic functionality of
+ * sending packets, it also has functions to receive range changes or
+ * determine if the port is snooping or not.
*/
-class MasterPort : public Port
+class MasterPort : public BaseMasterPort
{
friend class SlavePort;
@@ -144,16 +196,13 @@ class MasterPort : public Port
* 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);
+ void bind(BaseSlavePort& slave_port);
/**
* Unbind this master port and the associated slave port.
*/
void unbind();
- SlavePort& getSlavePort() const;
- bool isConnected() const;
-
/**
* Send an atomic request packet, where the data is moved and the
* state is updated in zero time, without interleaving with other
@@ -292,7 +341,7 @@ class MasterPort : public Port
* has functions specific to a slave, e.g. to send range changes
* and get the address ranges that the port responds to.
*/
-class SlavePort : public Port
+class SlavePort : public BaseSlavePort
{
friend class MasterPort;
@@ -307,9 +356,6 @@ class SlavePort : public Port
PortID id = InvalidPortID);
virtual ~SlavePort();
- MasterPort& getMasterPort() const;
- bool isConnected() const;
-
/**
* Send an atomic snoop request packet, where the data is moved
* and the state is updated in zero time, without interleaving
diff --git a/src/mem/ruby/system/RubyPort.cc b/src/mem/ruby/system/RubyPort.cc
index dcedc7841..1259f0f15 100644
--- a/src/mem/ruby/system/RubyPort.cc
+++ b/src/mem/ruby/system/RubyPort.cc
@@ -78,8 +78,8 @@ RubyPort::init()
m_mandatory_q_ptr = m_controller->getMandatoryQueue();
}
-MasterPort &
-RubyPort::getMasterPort(const std::string &if_name, int idx)
+BaseMasterPort &
+RubyPort::getMasterPort(const std::string &if_name, PortID idx)
{
if (if_name == "pio_port") {
return pio_port;
@@ -91,7 +91,7 @@ RubyPort::getMasterPort(const std::string &if_name, int idx)
// pass it along to our super class
return MemObject::getMasterPort(if_name, idx);
} else {
- if (idx >= static_cast<int>(master_ports.size())) {
+ if (idx >= static_cast<PortID>(master_ports.size())) {
panic("RubyPort::getMasterPort: unknown index %d\n", idx);
}
@@ -99,8 +99,8 @@ RubyPort::getMasterPort(const std::string &if_name, int idx)
}
}
-SlavePort &
-RubyPort::getSlavePort(const std::string &if_name, int idx)
+BaseSlavePort &
+RubyPort::getSlavePort(const std::string &if_name, PortID idx)
{
// used by the CPUs to connect the caches to the interconnect, and
// for the x86 case also the interrupt master
@@ -108,7 +108,7 @@ RubyPort::getSlavePort(const std::string &if_name, int idx)
// pass it along to our super class
return MemObject::getSlavePort(if_name, idx);
} else {
- if (idx >= static_cast<int>(slave_ports.size())) {
+ if (idx >= static_cast<PortID>(slave_ports.size())) {
panic("RubyPort::getSlavePort: unknown index %d\n", idx);
}
diff --git a/src/mem/ruby/system/RubyPort.hh b/src/mem/ruby/system/RubyPort.hh
index 7cce6bac3..ab09bd90a 100644
--- a/src/mem/ruby/system/RubyPort.hh
+++ b/src/mem/ruby/system/RubyPort.hh
@@ -126,8 +126,10 @@ class RubyPort : public MemObject
void init();
- MasterPort &getMasterPort(const std::string &if_name, int idx);
- SlavePort &getSlavePort(const std::string &if_name, int idx);
+ BaseMasterPort &getMasterPort(const std::string &if_name,
+ PortID idx = InvalidPortID);
+ BaseSlavePort &getSlavePort(const std::string &if_name,
+ PortID idx = InvalidPortID);
virtual RequestStatus makeRequest(PacketPtr pkt) = 0;
virtual int outstandingCount() const = 0;
diff --git a/src/mem/simple_dram.cc b/src/mem/simple_dram.cc
index 5ee8643e1..0f6e9511c 100644
--- a/src/mem/simple_dram.cc
+++ b/src/mem/simple_dram.cc
@@ -1186,8 +1186,8 @@ SimpleDRAM::recvFunctional(PacketPtr pkt)
functionalAccess(pkt);
}
-SlavePort&
-SimpleDRAM::getSlavePort(const string &if_name, int idx)
+BaseSlavePort&
+SimpleDRAM::getSlavePort(const string &if_name, PortID idx)
{
if (if_name != "port") {
return MemObject::getSlavePort(if_name, idx);
diff --git a/src/mem/simple_dram.hh b/src/mem/simple_dram.hh
index c8e37ee18..74058afaa 100644
--- a/src/mem/simple_dram.hh
+++ b/src/mem/simple_dram.hh
@@ -461,8 +461,8 @@ class SimpleDRAM : public AbstractMemory
unsigned int drain(Event* de);
- virtual SlavePort& getSlavePort(const std::string& if_name,
- int idx = InvalidPortID);
+ virtual BaseSlavePort& getSlavePort(const std::string& if_name,
+ PortID idx = InvalidPortID);
virtual void init();
virtual void startup();
diff --git a/src/mem/simple_mem.cc b/src/mem/simple_mem.cc
index a67b4825f..c54e8e5ea 100644
--- a/src/mem/simple_mem.cc
+++ b/src/mem/simple_mem.cc
@@ -165,8 +165,8 @@ SimpleMemory::release()
}
}
-SlavePort &
-SimpleMemory::getSlavePort(const std::string &if_name, int idx)
+BaseSlavePort &
+SimpleMemory::getSlavePort(const std::string &if_name, PortID idx)
{
if (if_name != "port") {
return MemObject::getSlavePort(if_name, idx);
diff --git a/src/mem/simple_mem.hh b/src/mem/simple_mem.hh
index f201709c2..7fd64db47 100644
--- a/src/mem/simple_mem.hh
+++ b/src/mem/simple_mem.hh
@@ -125,7 +125,8 @@ class SimpleMemory : public AbstractMemory
unsigned int drain(Event* de);
- virtual SlavePort& getSlavePort(const std::string& if_name, int idx = -1);
+ virtual BaseSlavePort& getSlavePort(const std::string& if_name,
+ PortID idx = InvalidPortID);
virtual void init();
protected: