Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/17039

Change subject: python: Switch to the new getPort mechanism to connect ports.
......................................................................

python: Switch to the new getPort mechanism to connect ports.

This retrieves ports using the getPort method, and connects them using
the bind method on the ports themselves. Any smarts as far as what type
of peers are allowed to connect or how they connect is left up to the
individual bind methods.

Change-Id: Ic640d1fce8af1bed411116e5830edc4a8a0f9d66
---
M src/python/m5/params.py
1 file changed, 5 insertions(+), 20 deletions(-)



diff --git a/src/python/m5/params.py b/src/python/m5/params.py
index ff625e0..90fff67 100644
--- a/src/python/m5/params.py
+++ b/src/python/m5/params.py
@@ -1943,8 +1943,6 @@

     # Call C++ to create corresponding port connection between C++ objects
     def ccConnect(self):
-        from _m5.pyobject import connectPorts
-
         if self.ccConnected: # already done this
             return

@@ -1952,27 +1950,14 @@
         if not self.peer: # nothing to connect to
             return

-        # check that we connect a master to a slave
-        if self.role == peer.role:
-            raise TypeError(
- "cannot connect '%s' and '%s' due to identical role '%s'" % \
-                (peer, self, self.role))
-
-        if self.role == 'SLAVE':
-            # do nothing and let the master take care of it
+        port = self.simobj.getPort(self.name, self.index)
+        peer_port = peer.simobj.getPort(peer.name, peer.index)
+        if not port or not peer_port:
             return

-        try:
-            # self is always the master and peer the slave
-            connectPorts(self.simobj.getCCObject(), self.name, self.index,
-                         peer.simobj.getCCObject(), peer.name, peer.index)
-        except:
-            print("Error connecting port %s.%s to %s.%s" %
-                  (self.simobj.path(), self.name,
-                   peer.simobj.path(), peer.name))
-            raise
+        port.bind(peer_port)
+
         self.ccConnected = True
-        peer.ccConnected = True

 # A reference to an individual element of a VectorPort... much like a
 # PortRef, but has an index.

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/17039
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Ic640d1fce8af1bed411116e5830edc4a8a0f9d66
Gerrit-Change-Number: 17039
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to