Make overriding port assignments in Python work,
authorSteve Reinhardt <Steve.Reinhardt@amd.com>
Tue, 30 Sep 2008 06:30:14 +0000 (23:30 -0700)
committerSteve Reinhardt <Steve.Reinhardt@amd.com>
Tue, 30 Sep 2008 06:30:14 +0000 (23:30 -0700)
and print better error messages when it doesn't.

src/dev/io_device.hh
src/python/m5/params.py

index 1e2e623f17c3432107112eea53033b963d36701a..e18489378f32bd0352ee32b49241821ea02b597c 100644 (file)
@@ -212,7 +212,8 @@ class PioDevice : public MemObject
     {
         if (if_name == "pio") {
             if (pioPort != NULL)
-                panic("pio port already connected to.");
+                fatal("%s: pio port already connected to %s",
+                      name(), pioPort->getPeer()->name());
             pioPort = new PioPort(this, sys);
             return pioPort;
         } else
@@ -289,12 +290,14 @@ class DmaDevice : public PioDevice
     {
         if (if_name == "pio") {
             if (pioPort != NULL)
-                panic("pio port already connected to.");
+                fatal("%s: pio port already connected to %s",
+                      name(), pioPort->getPeer()->name());
             pioPort = new PioPort(this, sys);
             return pioPort;
         } else if (if_name == "dma") {
             if (dmaPort != NULL)
-                panic("dma port already connected to.");
+                fatal("%s: dma port already connected to %s",
+                      name(), pioPort->getPeer()->name());
             dmaPort = new DmaPort(this, sys);
             return dmaPort;
         } else
index 9394b11e2ba92402bfb48d055bb18812637323e8..081bd342e4b494f8f98483ea539a7e82f1327a94 100644 (file)
@@ -1004,6 +1004,7 @@ class PortRef(object):
         if self.peer and not proxy.isproxy(self.peer):
             print "warning: overwriting port", self, \
                   "value", self.peer, "with", other
+            self.peer.peer = None
         self.peer = other
         if proxy.isproxy(other):
             other.set_param_desc(PortParamDesc())
@@ -1046,6 +1047,8 @@ class PortRef(object):
         if self.ccConnected: # already done this
             return
         peer = self.peer
+        if not self.peer: # nothing to connect to
+            return
         connectPorts(self.simobj.getCCObject(), self.name, self.index,
                      peer.simobj.getCCObject(), peer.name, peer.index)
         self.ccConnected = True