flow: match record fields by position

This commit is contained in:
Sebastien Bourdeauducq 2013-04-10 21:33:56 +02:00
parent df1ed32765
commit 6ce856290a
2 changed files with 5 additions and 5 deletions

View File

@ -22,12 +22,12 @@ class _Endpoint(Record):
Record.__init__(self, full_layout) Record.__init__(self, full_layout)
class Source(_Endpoint): class Source(_Endpoint):
def connect(self, sink): def connect(self, sink, **kwargs):
return Record.connect(self, sink) return Record.connect(self, sink, **kwargs)
class Sink(_Endpoint): class Sink(_Endpoint):
def connect(self, source): def connect(self, source, **kwargs):
return source.connect(self) return source.connect(self, **kwargs)
def get_endpoints(obj, filt=_Endpoint): def get_endpoints(obj, filt=_Endpoint):
if hasattr(obj, "get_endpoints") and callable(obj.get_endpoints): if hasattr(obj, "get_endpoints") and callable(obj.get_endpoints):

View File

@ -210,4 +210,4 @@ class CompositeActor(Module):
for u, v, d in dfg.edges_iter(data=True): for u, v, d in dfg.edges_iter(data=True):
ep_src = getattr(u, d["source"]) ep_src = getattr(u, d["source"])
ep_dst = getattr(v, d["sink"]) ep_dst = getattr(v, d["sink"])
self.comb += ep_src.connect(ep_dst) self.comb += ep_src.connect(ep_dst, match_by_position=True)