aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/firrtlTests/ConstantPropagationTests.scala43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/ConstantPropagationTests.scala b/src/test/scala/firrtlTests/ConstantPropagationTests.scala
index c94adbf6..f818f9c0 100644
--- a/src/test/scala/firrtlTests/ConstantPropagationTests.scala
+++ b/src/test/scala/firrtlTests/ConstantPropagationTests.scala
@@ -373,3 +373,46 @@ class ConstantPropagationSpec extends FirrtlFlatSpec {
(parse(exec(input))) should be (parse(check))
}
}
+
+// More sophisticated tests of the full compiler
+class ConstantPropagationIntegrationSpec extends LowTransformSpec {
+ def transform = new LowFirrtlOptimization
+
+ "ConstProp" should "should not optimize across dontTouch on nodes" in {
+ val input =
+ """circuit Top :
+ | module Top :
+ | input x : UInt<1>
+ | output y : UInt<1>
+ | node z = x
+ | y <= z""".stripMargin
+ val check =
+ """circuit Top :
+ | module Top :
+ | input x : UInt<1>
+ | output y : UInt<1>
+ | node z = x
+ | y <= z""".stripMargin
+ execute(input, check, Seq(dontTouch("Top.z")))
+ }
+
+ it should "should not optimize across dontTouch on wires" in {
+ val input =
+ """circuit Top :
+ | module Top :
+ | input x : UInt<1>
+ | output y : UInt<1>
+ | wire z : UInt<1>
+ | y <= z
+ | z <= x""".stripMargin
+ val check =
+ """circuit Top :
+ | module Top :
+ | input x : UInt<1>
+ | output y : UInt<1>
+ | wire z : UInt<1>
+ | y <= z
+ | z <= x""".stripMargin
+ execute(input, check, Seq(dontTouch("Top.z")))
+ }
+}