diff options
| author | Albert Magyar | 2020-02-06 16:29:58 -0800 |
|---|---|---|
| committer | Albert Magyar | 2020-02-06 16:35:13 -0800 |
| commit | 98a23c0c1fe018c0899d26da5bfd18fb1e0bcab5 (patch) | |
| tree | 916d9a493843eae50909a0ca682b5714dfb42614 /src/test | |
| parent | b36e36d956ced8f8ccfe8c540e11855b85e038c0 (diff) | |
Better register const prop through speculative de-optimization
* Fixes #1240
* Add failing reg const prop test case from #1240
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/firrtlTests/ConstantPropagationTests.scala | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/ConstantPropagationTests.scala b/src/test/scala/firrtlTests/ConstantPropagationTests.scala index af186cda..99b8c2f0 100644 --- a/src/test/scala/firrtlTests/ConstantPropagationTests.scala +++ b/src/test/scala/firrtlTests/ConstantPropagationTests.scala @@ -1148,6 +1148,29 @@ class ConstantPropagationIntegrationSpec extends LowTransformSpec { execute(input, check, Seq.empty) } + "Const prop of registers" should "do limited speculative expansion of optimized muxes to absorb bigger cones" in { + val input = + """circuit Top : + | module Top : + | input clock : Clock + | input reset : UInt<1> + | input en : UInt<1> + | output out : UInt<1> + | reg r : UInt<1>, clock + | when en : + | r <= UInt<1>(1) + | out <= r""".stripMargin + val check = + """circuit Top : + | module Top : + | input clock : Clock + | input reset : UInt<1> + | input en : UInt<1> + | output out : UInt<1> + | out <= UInt<1>("h1")""".stripMargin + execute(input, check, Seq.empty) + } + "A register with constant reset and all connection to either itself or the same constant" should "be replaced with that constant" in { val input = """circuit Top : |
