Gabe Black has submitted this change and it was merged. (
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
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17039
Reviewed-by: Andreas Sandberg <[email protected]>
Maintainer: Andreas Sandberg <[email protected]>
---
M src/python/m5/params.py
1 file changed, 3 insertions(+), 21 deletions(-)
Approvals:
Andreas Sandberg: Looks good to me, approved; Looks good to me, approved
diff --git a/src/python/m5/params.py b/src/python/m5/params.py
index ff625e0..5236022 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,11 @@
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))
+ port = self.simobj.getPort(self.name, self.index)
+ peer_port = peer.simobj.getPort(peer.name, peer.index)
+ port.bind(peer_port)
- if self.role == 'SLAVE':
- # do nothing and let the master take care of it
- 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
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: 6
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Nikos Nikoleris <[email protected]>
Gerrit-Reviewer: Weiping Liao <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev