summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2007-11-29 00:23:14 -0500
committerAli Saidi <saidi@eecs.umich.edu>2007-11-29 00:23:14 -0500
commita84d9716d63e16e01bdcef34b115c6dcd20e4146 (patch)
treebe81458d0230a4767a1ebc3d6f30d953768b582e
parent376c7285eedf5b235a414accf9f5253a4d55633e (diff)
parent8a020d40d3e7c9ecd3a41cfa5ab720080f5a9bbf (diff)
downloadgem5-a84d9716d63e16e01bdcef34b115c6dcd20e4146.tar.xz
merge, no manual changes
--HG-- extra : convert_revision : 6d6b744bbdfb09e7c3092368870a4f372241f9e8
-rw-r--r--src/mem/bridge.cc5
-rw-r--r--src/mem/port.cc58
-rw-r--r--src/mem/port.hh9
3 files changed, 64 insertions, 8 deletions
diff --git a/src/mem/bridge.cc b/src/mem/bridge.cc
index 3fa9e5bb9..aa059ad13 100644
--- a/src/mem/bridge.cc
+++ b/src/mem/bridge.cc
@@ -78,8 +78,9 @@ Bridge::getPort(const std::string &if_name, int idx)
else
return NULL;
- if (port->getPeer() != NULL)
- panic("bridge side %s already connected to.", if_name);
+ if (port->getPeer() != NULL && !port->getPeer()->isDefaultPort())
+ 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 ba4f23668..2e56d2486 100644
--- a/src/mem/port.cc
+++ b/src/mem/port.cc
@@ -39,6 +39,64 @@
#include "mem/mem_object.hh"
#include "mem/port.hh"
+class defaultPeerPortClass: public Port
+{
+ protected:
+ void blowUp()
+ {
+ fatal("Unconnected port!");
+ }
+
+ public:
+ defaultPeerPortClass() : Port("default_port")
+ {}
+
+ bool recvTiming(PacketPtr)
+ {
+ blowUp();
+ return false;
+ }
+
+ Tick recvAtomic(PacketPtr)
+ {
+ blowUp();
+ return 0;
+ }
+
+ void recvFunctional(PacketPtr)
+ {
+ blowUp();
+ }
+
+ void recvStatusChange(Status)
+ {
+ blowUp();
+ }
+
+ int deviceBlockSize()
+ {
+ blowUp();
+ return 0;
+ }
+
+ void getDeviceAddressRanges(AddrRangeList &, bool &)
+ {
+ blowUp();
+ }
+
+ bool isDefaultPort() { return true; }
+
+} defaultPeerPort;
+
+Port::Port() : peer(&defaultPeerPort), owner(NULL)
+{
+}
+
+Port::Port(const std::string &_name, MemObject *_owner) :
+ portName(_name), peer(&defaultPeerPort), owner(_owner)
+{
+}
+
void
Port::setPeer(Port *port)
{
diff --git a/src/mem/port.hh b/src/mem/port.hh
index b23de6050..cadf67260 100644
--- a/src/mem/port.hh
+++ b/src/mem/port.hh
@@ -88,9 +88,7 @@ class Port
public:
- Port()
- : peer(NULL), owner(NULL)
- { }
+ Port();
/**
* Constructor.
@@ -100,9 +98,7 @@ class Port
* @param _owner Pointer to the MemObject that owns this port.
* Will not necessarily be set.
*/
- Port(const std::string &_name, MemObject *_owner = NULL)
- : portName(_name), peer(NULL), owner(_owner)
- { }
+ Port(const std::string &_name, MemObject *_owner = NULL);
/** Return port name (for DPRINTF). */
const std::string &name() const { return portName; }
@@ -135,6 +131,7 @@ class Port
* demise. */
void removeConn();
+ virtual bool isDefaultPort() { return false; }
protected: