diff options
author | Steve Reinhardt <stever@gmail.com> | 2008-06-21 01:04:43 -0400 |
---|---|---|
committer | Steve Reinhardt <stever@gmail.com> | 2008-06-21 01:04:43 -0400 |
commit | 6b45238316052f458ba9ebc9d24a91cfa9e41cf1 (patch) | |
tree | 25f6faa5422b6e44e51fbd2f50d3d969d63a1e10 /src/mem/port.hh | |
parent | c1584e422783a33731c7dfa23517d30bcecf28bc (diff) | |
download | gem5-6b45238316052f458ba9ebc9d24a91cfa9e41cf1.tar.xz |
Generate more useful error messages for unconnected ports.
Force all non-default ports to provide a name and an
owner in the constructor.
Diffstat (limited to 'src/mem/port.hh')
-rw-r--r-- | src/mem/port.hh | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/mem/port.hh b/src/mem/port.hh index 15fda2164..4e0d91e75 100644 --- a/src/mem/port.hh +++ b/src/mem/port.hh @@ -87,17 +87,14 @@ class Port public: - Port(); - /** * Constructor. * * @param _name Port name for DPRINTF output. Should include name * of memory system object to which the port belongs. * @param _owner Pointer to the MemObject that owns this port. - * Will not necessarily be set. */ - Port(const std::string &_name, MemObject *_owner = NULL); + Port(const std::string &_name, MemObject *_owner, Port *_peer = NULL); /** Return port name (for DPRINTF). */ const std::string &name() const { return portName; } @@ -111,24 +108,18 @@ class Port RangeChange }; - void setName(const std::string &name) - { portName = name; } - /** Function to set the pointer for the peer port. */ virtual void setPeer(Port *port); /** Function to get the pointer to the peer port. */ Port *getPeer() { return peer; } - /** Function to set the owner of this port. */ - void setOwner(MemObject *_owner) { owner = _owner; } - /** Function to return the owner of this port. */ MemObject *getOwner() { return owner; } - /** Inform the peer port to delete itself and notify it's owner about it's - * demise. */ - void removeConn(); + /** Notify my peer port that I'm disconnecting (by calling its + * disconnect() method) so it can clean up. */ + void disconnectFromPeer(); virtual bool isDefaultPort() const { return false; } @@ -254,6 +245,11 @@ class Port /** Internal helper function for read/writeBlob(). */ void blobHelper(Addr addr, uint8_t *p, int size, MemCmd cmd); + + /** Receive notification that my peer is disconnecting and clean + * up (potentially deleting myself in the process). Should be + * called only from peer's disconnectFromPeer(). */ + void disconnect(); }; /** A simple functional port that is only meant for one way communication to |