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/sim/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/sim/port.hh')
-rw-r--r-- | src/sim/port.hh | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/sim/port.hh b/src/sim/port.hh index 368f46783..e1811643f 100644 --- a/src/sim/port.hh +++ b/src/sim/port.hh @@ -63,7 +63,7 @@ class Port private: /** Descriptive name (for DPRINTF output) */ - std::string portName; + const std::string portName; protected: @@ -72,6 +72,10 @@ class Port * to InvalidPortID in case this port is not part of a vector. */ const PortID id; + /** + * Whether this port is currently connected to a peer port. + */ + bool _connected; /** * Abstract base class for ports @@ -94,6 +98,14 @@ class Port /** Get the port id. */ PortID getId() const { return id; } + /** Attach to a peer port. */ + virtual void bind(Port &peer) = 0; + + /** Dettach from a peer port. */ + virtual void unbind() = 0; + + /** Is this port currently connected to a peer? */ + bool isConnected() const { return _connected; } }; #endif //__SIM_PORT_HH__ |