diff options
| author | Jack Koenig | 2019-01-04 16:49:59 -0800 |
|---|---|---|
| committer | GitHub | 2019-01-04 16:49:59 -0800 |
| commit | 37567cc65d531b5d47d13c12e9c7ac80fc4d7b1f (patch) | |
| tree | f130774f6b1b4fec295ddc9a6d987bc41d9a36ad /src/main | |
| parent | 4253791132c5c550e1bc4a8070cb54e558f17809 (diff) | |
| parent | 1931649a050619a711c066f669d93d436bd03296 (diff) | |
Merge pull request #987 from freechipsproject/fix-grouping
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/scala/firrtl/transforms/GroupComponents.scala | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/scala/firrtl/transforms/GroupComponents.scala b/src/main/scala/firrtl/transforms/GroupComponents.scala index 55828e0a..8c36bb6d 100644 --- a/src/main/scala/firrtl/transforms/GroupComponents.scala +++ b/src/main/scala/firrtl/transforms/GroupComponents.scala @@ -4,7 +4,7 @@ import firrtl._ import firrtl.Mappers._ import firrtl.ir._ import firrtl.annotations.{Annotation, ComponentName} -import firrtl.passes.{InferTypes, LowerTypes, MemPortUtils} +import firrtl.passes.{InferTypes, LowerTypes, MemPortUtils, ResolveKinds} import firrtl.Utils.kind import firrtl.graph.{DiGraph, MutableDiGraph} @@ -62,7 +62,7 @@ class GroupComponents extends firrtl.Transform { case other => Seq(other) } val cs = state.copy(circuit = state.circuit.copy(modules = newModules)) - val csx = InferTypes.execute(cs) + val csx = ResolveKinds.execute(InferTypes.execute(cs)) csx } @@ -119,6 +119,11 @@ class GroupComponents extends firrtl.Transform { } } + // Unused nodes are not reachable from any group nor the root--add them to root group + for ((v, _) <- deps.getEdgeMap) { + reachableNodes.getOrElseUpdate(v, mutable.Set("")) + } + // Add nodes who are reached by a single group, to that group reachableNodes.foreach { case (node, membership) => if(membership.size == 1) { @@ -307,7 +312,9 @@ class GroupComponents extends firrtl.Transform { } def onStmt(stmt: Statement): Unit = stmt match { case w: WDefInstance => - case h: IsDeclaration => h map onExpr(WRef(h.name)) + case h: IsDeclaration => + bidirGraph.addVertex(h.name) + h map onExpr(WRef(h.name)) case Attach(_, exprs) => // Add edge between each expression exprs.tail map onExpr(getWRef(exprs.head)) case Connect(_, loc, expr) => |
