diff options
| author | Albert Magyar | 2020-02-07 12:42:19 -0700 |
|---|---|---|
| committer | GitHub | 2020-02-07 12:42:19 -0700 |
| commit | dc9709c55bfa9f2dc7ee9a400e141ce5deb7269c (patch) | |
| tree | f2881fcfc3c0cd102c68f9f6a827ea6ae8c99cce /src/test/scala | |
| parent | b36e36d956ced8f8ccfe8c540e11855b85e038c0 (diff) | |
| parent | ec365cece903de078c8c673348574a7b3b2ab7d4 (diff) | |
Merge pull request #1366 from freechipsproject/dueling-const-prop
Better register const prop through speculative de-optimization
Diffstat (limited to 'src/test/scala')
| -rw-r--r-- | src/test/scala/firrtlTests/ConstantPropagationTests.scala | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/ConstantPropagationTests.scala b/src/test/scala/firrtlTests/ConstantPropagationTests.scala index af186cda..ef52507f 100644 --- a/src/test/scala/firrtlTests/ConstantPropagationTests.scala +++ b/src/test/scala/firrtlTests/ConstantPropagationTests.scala @@ -1148,6 +1148,31 @@ 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 en : UInt<1> + | output out : UInt<1> + | reg r1 : UInt<1>, clock + | reg r2 : UInt<1>, clock + | when en : + | r1 <= UInt<1>(1) + | r2 <= UInt<1>(0) + | when en : + | r2 <= r2 + | out <= xor(r1, r2)""".stripMargin + val check = + """circuit Top : + | module Top : + | input clock : Clock + | 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 : |
