aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorJack Koenig2017-06-28 18:49:32 -0700
committerJack Koenig2017-06-28 18:49:32 -0700
commita0aeafa3d591f9bcc14eca6d8a41eb2155f1b5b0 (patch)
tree7d0bcf384f63e0176acdd70f9524369bb5bb4ce0 /src/test
parent39665e1f74cfe8243067442cccf4e7eab66ade68 (diff)
Make Constant Propagation respect dontTouch
Constant Propagation will not optimize across components marked dontTouch
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")))
+ }
+}