From: Sebastien Bourdeauducq Date: Wed, 1 May 2013 20:13:26 +0000 (+0200) Subject: flow/network: better determination of plumbing layout X-Git-Tag: 24jan2021_ls180~2099^2~589 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8ffa273719af7405e444470d7b124e4168a9deb6;p=litex.git flow/network: better determination of plumbing layout --- diff --git a/migen/flow/network.py b/migen/flow/network.py index b1824d27..fea4b791 100644 --- a/migen/flow/network.py +++ b/migen/flow/network.py @@ -151,24 +151,26 @@ class DataFlowGraph(MultiDiGraph): if not ap: break for a in ap: - if a.actor_class in plumbing.layout_sink: - edges = self.in_edges(a, data=True) - assert(len(edges) == 1) - other, me, data = edges[0] + in_edges = self.in_edges(a, data=True) + out_edges = self.out_edges(a, data=True) + if a.actor_class in plumbing.layout_sink and len(in_edges) == 1: + other, me, data = in_edges[0] if isinstance(other, AbstractActor): continue other_ep = data["source"] if other_ep is None: other_ep = get_single_ep(other, Source)[1] - elif a.actor_class in plumbing.layout_source: - edges = self.out_edges(a, data=True) - assert(len(edges) == 1) - me, other, data = edges[0] + else: + other_ep = getattr(other, other_ep) + elif a.actor_class in plumbing.layout_source and len(out_edges) == 1: + me, other, data = out_edges[0] if isinstance(other, AbstractActor): continue other_ep = data["sink"] if other_ep is None: other_ep = get_single_ep(other, Sink)[1] + else: + other_ep = getattr(other, other_ep) else: raise AssertionError layout = other_ep.payload.layout