aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorJack Koenig2020-11-11 16:07:54 -0800
committerGitHub2020-11-12 00:07:54 +0000
commitc7bbb75b8b293d639848abaa9f68121f80947f42 (patch)
treea80fbf90a249d8372751fa728b7f709e850778ea /src/test
parent7d637e256d09e46c5b45c9ac3b6258e43c279f2a (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/test')
-rw-r--r--src/test/scala/firrtlTests/RemoveWiresSpec.scala14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/RemoveWiresSpec.scala b/src/test/scala/firrtlTests/RemoveWiresSpec.scala
index 48eaaa65..58d42710 100644
--- a/src/test/scala/firrtlTests/RemoveWiresSpec.scala
+++ b/src/test/scala/firrtlTests/RemoveWiresSpec.scala
@@ -6,6 +6,7 @@ import firrtl._
import firrtl.ir._
import firrtl.Mappers._
import firrtl.testutils._
+import FirrtlCheckers._
import collection.mutable
@@ -187,4 +188,17 @@ class RemoveWiresSpec extends FirrtlFlatSpec {
firrtl.passes.CheckHighForm.execute(result)
}
+ it should "give nodes made from invalid wires the correct type" in {
+ val result = compileBody(
+ s"""|input a : SInt<4>
+ |input sel : UInt<1>
+ |output z : SInt<4>
+ |wire w : SInt<4>
+ |w is invalid
+ |z <= mux(sel, a, w)
+ |""".stripMargin
+ )
+ result should containLine("""node w = validif(UInt<1>("h0"), SInt<4>("h0"))""")
+ }
+
}