Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 1 file changed
  • 0 comments
  • 1 contributor

Showing 1 changed file with 9 additions and 4 deletions. Show diff stats Hide diff stats

  1. 13  migen/fhdl/tools.py
13  migen/fhdl/tools.py
@@ -48,24 +48,29 @@ def list_targets(node):
48 48
 	lister.visit(node)
49 49
 	return lister.output_list
50 50
 
  51
+def _resort_statements(ol):
  52
+	return [statement for i, statement in
  53
+			sorted(ol, key=lambda x: x[0])]
  54
+
51 55
 def group_by_targets(sl):
52 56
 	groups = []
53  
-	for statement in flat_iteration(sl):
  57
+	for statement_order, statement in enumerate(flat_iteration(sl)):
54 58
 		targets = list_targets(statement)
55 59
 
56 60
 		chk_groups = [(targets.isdisjoint(g[0]), g) for g in groups]
57 61
 		merge_groups = [g for dj, g in chk_groups if not dj]
58 62
 		groups = [g for dj, g in chk_groups if dj]
59 63
 
60  
-		new_group = (set(targets), [])
  64
+		new_group = (set(targets), [(statement_order, statement)])
  65
+
61 66
 		for g in merge_groups:
62 67
 			new_group[0].update(g[0])
63 68
 			new_group[1].extend(g[1])
64  
-		new_group[1].append(statement)
65 69
 
66 70
 		groups.append(new_group)
67 71
 
68  
-	return groups
  72
+	return [(target, _resort_statements(stmts))
  73
+		for target, stmts in groups]
69 74
 
70 75
 def list_special_ios(f, ins, outs, inouts):
71 76
 	r = set()

No commit comments for this range

Something went wrong with that request. Please try again.