diff options
| author | Albert Chen | 2020-09-01 14:21:05 -0700 |
|---|---|---|
| committer | GitHub | 2020-09-01 21:21:05 +0000 |
| commit | 3b12706287bfbb07cff09a101aab1abedb522858 (patch) | |
| tree | 81a73e4f59465d8b2bc89fa9a81bb6113b1ac2af | |
| parent | 76c7e654d178020e947968b207b15001c839c7f2 (diff) | |
InlineBooleanExpressions: test DontTouch (#1880)
* InlineBooleanExpressions: test DontTouch
* run scalafmt
| -rw-r--r-- | src/test/scala/firrtlTests/InlineBooleanExpressionsSpec.scala | 36 |
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 : |
