From fc473e31eb9154c6b7fb2dcc447a4d23fe2efc14 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 19 Jan 2012 19:24:43 +0100 Subject: [PATCH] Fix disjoint namespace test --- migen/fhdl/namer.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/migen/fhdl/namer.py b/migen/fhdl/namer.py index 3771e423..5f658bba 100644 --- a/migen/fhdl/namer.py +++ b/migen/fhdl/namer.py @@ -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 -- 2.30.2