aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/test/scala/firrtlTests/InlineBooleanExpressionsSpec.scala36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/test/scala/firrtlTests/InlineBooleanExpressionsSpec.scala b/src/test/scala/firrtlTests/InlineBooleanExpressionsSpec.scala
index 72fcff1c..fb7ecfdb 100644
--- a/src/test/scala/firrtlTests/InlineBooleanExpressionsSpec.scala
+++ b/src/test/scala/firrtlTests/InlineBooleanExpressionsSpec.scala
@@ -3,7 +3,7 @@
package firrtlTests
import firrtl._
-import firrtl.annotations.Annotation
+import firrtl.annotations.{Annotation, ReferenceTarget}
import firrtl.options.Dependency
import firrtl.passes._
import firrtl.transforms._
@@ -53,6 +53,40 @@ class InlineBooleanExpressionsSpec extends FirrtlFlatSpec {
firrtlEquivalenceTest(input, Seq(new InlineBooleanExpressions))
}
+ it should "not inline dontTouched signals" in {
+ val input =
+ """circuit Top :
+ | module Top :
+ | output out : UInt<1>
+ | node x1 = UInt<1>(0)
+ | node x2 = UInt<1>(1)
+ | node _t = head(x1, 1)
+ | node _f = head(x2, 1)
+ | node _c = lt(x1, x2)
+ | node _y = mux(_c, _t, _f)
+ | out <= _y""".stripMargin
+ val check =
+ """circuit Top :
+ | module Top :
+ | output out : UInt<1>
+ | node x1 = UInt<1>(0)
+ | node x2 = UInt<1>(1)
+ | node _t = head(x1, 1)
+ | node _f = head(x2, 1)
+ | node _c = lt(x1, x2)
+ | node _y = mux(lt(x1, x2), _t, _f)
+ | out <= mux(lt(x1, x2), _t, _f)""".stripMargin
+ val result = exec(
+ input,
+ Seq(
+ DontTouchAnnotation(ReferenceTarget("Top", "Top", Seq.empty, "_t", Seq.empty)),
+ DontTouchAnnotation(ReferenceTarget("Top", "Top", Seq.empty, "_f", Seq.empty))
+ )
+ )
+ (result) should be(parse(check).serialize)
+ firrtlEquivalenceTest(input, Seq(new InlineBooleanExpressions))
+ }
+
it should "only inline expressions with the same file and line number" in {
val input =
"""circuit Top :