From adacdadd58b1cad4fb6df8994f925343c1114794 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 3 Aug 2012 18:48:35 +0200 Subject: [PATCH] flow/hooks/DFGHook: add iterator on hooks --- migen/flow/hooks.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/migen/flow/hooks.py b/migen/flow/hooks.py index 9165e6418..9272d9be7 100644 --- a/migen/flow/hooks.py +++ b/migen/flow/hooks.py @@ -37,9 +37,10 @@ class DFGHook: ep = data["source"] ep_to_hook[ep] = create(u, ep, v) - def get_fragment(self): - frag = Fragment() + def hooks_iter(self): for v1 in self.nodepair_to_ep.values(): for v2 in v1.values(): - frag += v2.get_fragment() - return frag + yield v2 + + def get_fragment(self): + return sum([h.get_fragment() for h in self.hooks_iter()], Fragment())