scripts: Fix to ensure that port connection count is always set
authorAndreas Hansson <andreas.hansson@arm.com>
Mon, 19 Mar 2012 10:34:02 +0000 (06:34 -0400)
committerAndreas Hansson <andreas.hansson@arm.com>
Mon, 19 Mar 2012 10:34:02 +0000 (06:34 -0400)
This patch ensures that the port connection count is set to zero in those
cases when the port is not connected.

src/python/m5/SimObject.py

index 9c6a32f41ec96ec2265cccc8247ff4769d66d3c5..a447d96db7c1f1c492909f70049283c83783ccf1 100644 (file)
@@ -993,9 +993,8 @@ class SimObject(object):
         port_names.sort()
         for port_name in port_names:
             port = self._port_refs.get(port_name, None)
-            if port != None:
-                setattr(cc_params, 'port_' + port_name + '_connection_count',
-                        len(port))
+            setattr(cc_params, 'port_' + port_name + '_connection_count',
+                    len(port) if port != None else 0)
         self._ccParams = cc_params
         return self._ccParams