flow/hooks/DFGHook: add iterator on hooks
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Fri, 3 Aug 2012 16:48:35 +0000 (18:48 +0200)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Fri, 3 Aug 2012 16:48:35 +0000 (18:48 +0200)
migen/flow/hooks.py

index 9165e641877444ceac6e2804e3828aeb284f1ffb..9272d9be77e9605f3d9dc139c65137cac87cb05b 100644 (file)
@@ -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())