mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
fhdl/tools/group_by_target: remove resort_statements
This commit is contained in:
parent
16ebe41028
commit
939f01cee2
1 changed files with 4 additions and 9 deletions
|
@ -48,29 +48,24 @@ def list_targets(node):
|
||||||
lister.visit(node)
|
lister.visit(node)
|
||||||
return lister.output_list
|
return lister.output_list
|
||||||
|
|
||||||
def resort_statements(ol):
|
|
||||||
return [statement for i, statement in
|
|
||||||
sorted(ol, key=lambda x: x[0])]
|
|
||||||
|
|
||||||
def group_by_targets(sl):
|
def group_by_targets(sl):
|
||||||
groups = []
|
groups = []
|
||||||
for statement_order, statement in enumerate(flat_iteration(sl)):
|
for statement in flat_iteration(sl):
|
||||||
targets = list_targets(statement)
|
targets = list_targets(statement)
|
||||||
|
|
||||||
chk_groups = [(targets.isdisjoint(g[0]), g) for g in groups]
|
chk_groups = [(targets.isdisjoint(g[0]), g) for g in groups]
|
||||||
merge_groups = [g for dj, g in chk_groups if not dj]
|
merge_groups = [g for dj, g in chk_groups if not dj]
|
||||||
groups = [g for dj, g in chk_groups if dj]
|
groups = [g for dj, g in chk_groups if dj]
|
||||||
|
|
||||||
new_group = (set(targets), [(statement_order, statement)])
|
new_group = (set(targets), [])
|
||||||
|
|
||||||
for g in merge_groups:
|
for g in merge_groups:
|
||||||
new_group[0].update(g[0])
|
new_group[0].update(g[0])
|
||||||
new_group[1].extend(g[1])
|
new_group[1].extend(g[1])
|
||||||
|
new_group[1].append(statement)
|
||||||
|
|
||||||
groups.append(new_group)
|
groups.append(new_group)
|
||||||
|
|
||||||
return [(target, resort_statements(stmts))
|
return groups
|
||||||
for target, stmts in groups]
|
|
||||||
|
|
||||||
def list_special_ios(f, ins, outs, inouts):
|
def list_special_ios(f, ins, outs, inouts):
|
||||||
r = set()
|
r = set()
|
||||||
|
|
Loading…
Reference in a new issue