diff options
author | Gabe Black <gabeblack@google.com> | 2019-03-07 01:32:54 -0800 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2019-03-19 10:21:46 +0000 |
commit | 7f1458bec4ae3ea3fb5f0948f0323355e1f20512 (patch) | |
tree | 4bdf685549971f6bd5b56e8049092f88a526f09d /src/mem/port.hh | |
parent | 8e89366ada0213d45af088945406c82187b5014a (diff) | |
download | gem5-7f1458bec4ae3ea3fb5f0948f0323355e1f20512.tar.xz |
mem: Move bind() and unbind() into the Port class.
These are now pure virtual methods which more specialized port
subclasses will need to implement. The SlavePort class implements them
by ignoring them and then providing parallel functions for the
MasterPort to call. The MasterPort's methods do basically what they
did before, except now bind() uses dynamic cast to check if its peer
is of the appropriate type and also to convert it into that type before
connecting to it.
Change-Id: I0948799bc954acaebf371e6b6612cee1d3023bc4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17038
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/mem/port.hh')
-rw-r--r-- | src/mem/port.hh | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/mem/port.hh b/src/mem/port.hh index 77081db4d..2154da007 100644 --- a/src/mem/port.hh +++ b/src/mem/port.hh @@ -77,10 +77,7 @@ class BaseMasterPort : public Port public: - virtual void bind(BaseSlavePort& slave_port) = 0; - virtual void unbind() = 0; BaseSlavePort& getSlavePort() const; - bool isConnected() const; }; @@ -101,7 +98,6 @@ class BaseSlavePort : public Port public: BaseMasterPort& getMasterPort() const; - bool isConnected() const; }; @@ -138,12 +134,12 @@ class MasterPort : public BaseMasterPort * 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(BaseSlavePort& slave_port); + void bind(Port &peer) override; /** * Unbind this master port and the associated slave port. */ - void unbind(); + void unbind() override; /** * Send an atomic request packet, where the data is moved and the @@ -394,19 +390,25 @@ class SlavePort : public BaseSlavePort */ virtual AddrRangeList getAddrRanges() const = 0; + /** + * We let the master port do the work, so these don't do anything. + */ + void unbind() override {} + void bind(Port &peer) override {} + protected: /** * Called by the master port to unbind. Should never be called * directly. */ - void unbind(); + void slaveUnbind(); /** * Called by the master port to bind. Should never be called * directly. */ - void bind(MasterPort& master_port); + void slaveBind(MasterPort& master_port); /** * Receive an atomic request packet from the master port. |