Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 2 contributors
Commits on Jul 17, 2013
@davidcarne davidcarne fhdl/tools: BUGFIX: fix group_by_target grouping
group_by_target does not properly combine target groups if statements
are presented in the order:

 ({A}, statement1)
 ({B}, statement2)
 ({A, B}, statement3)

which returns groups:

 ({A, B}, [statement1, statement3])
 ({B}, [statement2])

This patch fixes group_by_target such that the resulting group is:

 ({A, B}, [statement1, statement2, statement3])
@sbourdeauducq sbourdeauducq fhdl/tools/group_by_target: remove resort_statements 939f01c
Showing with 13 additions and 9 deletions.
  1. +13 −9 migen/fhdl/
22 migen/fhdl/
@@ -52,15 +52,19 @@ def group_by_targets(sl):
groups = []
for statement in flat_iteration(sl):
targets = list_targets(statement)
- processed = False
- for g in groups:
- if not targets.isdisjoint(g[0]):
- g[0].update(targets)
- g[1].append(statement)
- processed = True
- break
- if not processed:
- groups.append((targets, [statement]))
+ chk_groups = [(targets.isdisjoint(g[0]), g) for g in groups]
+ merge_groups = [g for dj, g in chk_groups if not dj]
+ groups = [g for dj, g in chk_groups if dj]
+ new_group = (set(targets), [])
+ for g in merge_groups:
+ new_group[0].update(g[0])
+ new_group[1].extend(g[1])
+ new_group[1].append(statement)
+ groups.append(new_group)
return groups
def list_special_ios(f, ins, outs, inouts):

No commit comments for this range

Something went wrong with that request. Please try again.