aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/transforms
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/firrtl/transforms')
-rw-r--r--src/main/scala/firrtl/transforms/ConstantPropagation.scala3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main/scala/firrtl/transforms/ConstantPropagation.scala b/src/main/scala/firrtl/transforms/ConstantPropagation.scala
index 5e9a7850..4a4f41d1 100644
--- a/src/main/scala/firrtl/transforms/ConstantPropagation.scala
+++ b/src/main/scala/firrtl/transforms/ConstantPropagation.scala
@@ -396,6 +396,9 @@ class ConstantPropagation extends Transform {
// Propagate connections to references
case Connect(info, lhs, rref @ WRef(rname, _, NodeKind, _)) if !dontTouches.contains(rname) =>
Connect(info, lhs, nodeMap(rname))
+ // If an Attach has at least 1 port, any wires are redundant and can be removed
+ case Attach(info, exprs) if exprs.exists(kind(_) == PortKind) =>
+ Attach(info, exprs.filterNot(kind(_) == WireKind))
case other => other
}
}