aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala')
-rw-r--r--src/main/scala/firrtl/transforms/GroupComponents.scala9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/scala/firrtl/transforms/GroupComponents.scala b/src/main/scala/firrtl/transforms/GroupComponents.scala
index 805b534e..8c36bb6d 100644
--- a/src/main/scala/firrtl/transforms/GroupComponents.scala
+++ b/src/main/scala/firrtl/transforms/GroupComponents.scala
@@ -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) =>