diff options
| author | Jack Koenig | 2018-06-06 21:13:24 -0700 |
|---|---|---|
| committer | GitHub | 2018-06-06 21:13:24 -0700 |
| commit | 7c49fa1726ab1860fbb3616156467807de2d7e3c (patch) | |
| tree | f3fd0f149f22811acd6048ad4bb58722351873e3 /src/main/scala/firrtl/transforms/ConstantPropagation.scala | |
| parent | c9d40a022efc2d4380186912e61c2c91d07e8958 (diff) | |
ConstProp attached wires if there is also a port (#818)
This enables the pattern of attaching "through" a wire to give better
Verilog that also works in Verilator
Use WrappedExpression when combining attaches in ExpandWhens
to ensure no duplication of references in resulting, combined attaches
Diffstat (limited to 'src/main/scala/firrtl/transforms/ConstantPropagation.scala')
| -rw-r--r-- | src/main/scala/firrtl/transforms/ConstantPropagation.scala | 3 |
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 } } |
