diff options
author | Andreas Hansson <andreas.hansson@arm.com> | 2012-01-17 12:55:09 -0600 |
---|---|---|
committer | Andreas Hansson <andreas.hansson@arm.com> | 2012-01-17 12:55:09 -0600 |
commit | 6315e5bbb5efd6972cf1c7cd8007563646d88d33 (patch) | |
tree | 9ad4a54f924207c88c8699ff31e8f9c924838bab /src | |
parent | de34e49d15b95cc8be51dbed2e98c469e7486959 (diff) | |
download | gem5-6315e5bbb5efd6972cf1c7cd8007563646d88d33.tar.xz |
MEM: Remove the notion of the default port
This patch removes the default port and instead relies on the peer
being set to NULL initially. The binding check (i.e. is a port
connected or not) will eventually be moved to the init function of the
modules.
Diffstat (limited to 'src')
-rw-r--r-- | src/mem/bridge.cc | 2 | ||||
-rw-r--r-- | src/mem/port.cc | 56 | ||||
-rw-r--r-- | src/mem/port.hh | 4 |
3 files changed, 4 insertions, 58 deletions
diff --git a/src/mem/bridge.cc b/src/mem/bridge.cc index 65ce3012e..6001870ff 100644 --- a/src/mem/bridge.cc +++ b/src/mem/bridge.cc @@ -79,7 +79,7 @@ Bridge::getPort(const std::string &if_name, int idx) else return NULL; - if (port->getPeer() != NULL && !port->getPeer()->isDefaultPort()) + if (port->getPeer() != NULL) panic("bridge side %s already connected to %s.", if_name, port->getPeer()->name()); return port; diff --git a/src/mem/port.cc b/src/mem/port.cc index 946f087eb..eae18c6ea 100644 --- a/src/mem/port.cc +++ b/src/mem/port.cc @@ -40,60 +40,8 @@ #include "mem/mem_object.hh" #include "mem/port.hh" -class DefaultPeerPort : public Port -{ - protected: - void blowUp() const - { - fatal("%s: Unconnected port!", peer->name()); - } - - public: - DefaultPeerPort() - : Port("default_port", NULL) - { } - - bool recvTiming(PacketPtr) - { - blowUp(); - return false; - } - - Tick recvAtomic(PacketPtr) - { - blowUp(); - return 0; - } - - void recvFunctional(PacketPtr) - { - blowUp(); - } - - void recvStatusChange(Status) - { - blowUp(); - } - - unsigned - deviceBlockSize() const - { - blowUp(); - return 0; - } - - void getDeviceAddressRanges(AddrRangeList &, bool &) - { - blowUp(); - } - - bool isDefaultPort() const { return true; } -}; - -DefaultPeerPort defaultPeerPort; - Port::Port(const std::string &_name, MemObject *_owner) - : portName(_name), peer(&defaultPeerPort), owner(_owner) + : portName(_name), peer(NULL), owner(_owner) { } @@ -118,7 +66,7 @@ Port::setOwner(MemObject *_owner) void Port::removeConn() { - if (peer->getOwner()) + if (peer != NULL) peer->getOwner()->deletePortRefs(peer); peer = NULL; } diff --git a/src/mem/port.hh b/src/mem/port.hh index 32f331433..4adf8f4cd 100644 --- a/src/mem/port.hh +++ b/src/mem/port.hh @@ -127,9 +127,7 @@ class Port * demise. */ void removeConn(); - virtual bool isDefaultPort() const { return false; } - - bool isConnected() { return peer && !peer->isDefaultPort(); } + bool isConnected() { return peer != NULL; } protected: |