diff options
| author | Jack Koenig | 2020-11-11 16:07:54 -0800 |
|---|---|---|
| committer | GitHub | 2020-11-12 00:07:54 +0000 |
| commit | c7bbb75b8b293d639848abaa9f68121f80947f42 (patch) | |
| tree | a80fbf90a249d8372751fa728b7f709e850778ea /src/main/scala/firrtl/transforms | |
| parent | 7d637e256d09e46c5b45c9ac3b6258e43c279f2a (diff) | |
Fix RemoveWires handling of invalidated non-UInt wires (#1949)
It would replace them with a validif node with a UIntLiteral which can
lead to type errors.
Diffstat (limited to 'src/main/scala/firrtl/transforms')
| -rw-r--r-- | src/main/scala/firrtl/transforms/RemoveWires.scala | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/scala/firrtl/transforms/RemoveWires.scala b/src/main/scala/firrtl/transforms/RemoveWires.scala index 440989f4..ee03ad30 100644 --- a/src/main/scala/firrtl/transforms/RemoveWires.scala +++ b/src/main/scala/firrtl/transforms/RemoveWires.scala @@ -10,6 +10,7 @@ import firrtl.traversals.Foreachers._ import firrtl.WrappedExpression._ import firrtl.graph.{CyclicException, MutableDiGraph} import firrtl.options.Dependency +import firrtl.Utils.getGroundZero import scala.collection.mutable import scala.util.{Failure, Success, Try} @@ -128,8 +129,8 @@ class RemoveWires extends Transform with DependencyAPIMigration { case invalid @ IsInvalid(info, expr) => kind(expr) match { case WireKind => - val width = expr.tpe match { case GroundType(width) => width } // LowFirrtl - netlist(we(expr)) = (Seq(ValidIf(Utils.zero, UIntLiteral(BigInt(0), width), expr.tpe)), info) + val (tpe, width) = expr.tpe match { case g: GroundType => (g, g.width) } // LowFirrtl + netlist(we(expr)) = (Seq(ValidIf(Utils.zero, getGroundZero(tpe), tpe)), info) case _ => otherStmts += invalid } case other @ (_: Print | _: Stop | _: Attach | _: Verification) => |
