Fix disjoint namespace test
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Thu, 19 Jan 2012 18:24:43 +0000 (19:24 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Thu, 19 Jan 2012 18:24:43 +0000 (19:24 +0100)
migen/fhdl/namer.py

index 3771e42361f8f49312d365bc93a4855c994b225f..5f658bbaabcf53e0393a2e9adf629b9bdc39302f 100644 (file)
@@ -73,16 +73,18 @@ def _bin(sn, sig_iters):
                        bins[step_name].append((signal, it))
        return terminals, bins
 
+def _sets_disjoint(l):
+       for s1, s2 in combinations(l, 2):
+               if not s1.isdisjoint(s2):
+                       return False
+       return True
+       
 def _r_build_pnd(sn, sig_iters):
        terminals, bins = _bin(sn, sig_iters)
        bins_named = [(k, _r_build_pnd(sn, v)) for k, v in bins.items()]
        name_sets = [set(sub_pnd.values()) for prefix, sub_pnd in bins_named]
-       if name_sets:
-               intersection = set.intersection(*name_sets)
-       else:
-               intersection = set()
        r = {}
-       if intersection:
+       if not _sets_disjoint(name_sets):
                for prefix, sub_pnd in bins_named:
                        for s, n in sub_pnd.items():
                                r[s] = prefix + "_" + n