diff options
| author | Jack Koenig | 2019-01-13 21:05:17 -0800 |
|---|---|---|
| committer | Jack Koenig | 2019-01-13 22:10:22 -0800 |
| commit | f5a42ce22193a038008a1c4f80618e38f72b40f1 (patch) | |
| tree | 1570de07988e47d533892ca2d5a3a9ee3facacda /src/test | |
| parent | 5f0e893c9213464507418a532ee61347a5da26c8 (diff) | |
Keep constant propagating expressions until done optimizing
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/firrtlTests/ConstantPropagationTests.scala | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/ConstantPropagationTests.scala b/src/test/scala/firrtlTests/ConstantPropagationTests.scala index 603ddc25..a6df1a3b 100644 --- a/src/test/scala/firrtlTests/ConstantPropagationTests.scala +++ b/src/test/scala/firrtlTests/ConstantPropagationTests.scala @@ -734,6 +734,24 @@ class ConstantPropagationSingleModule extends ConstantPropagationSpec { """.stripMargin (parse(exec(input))) should be(parse(check)) } + + // Optimizing this mux gives: z <= pad(UInt<2>(0), 4) + // Thus this checks that we then optimize that pad + "ConstProp" should "optimize nested Expressions" in { + val input = + """circuit Top : + | module Top : + | output z : UInt<4> + | z <= mux(UInt(1), UInt<2>(0), UInt<4>(0)) + """.stripMargin + val check = + """circuit Top : + | module Top : + | output z : UInt<4> + | z <= UInt<4>("h0") + """.stripMargin + (parse(exec(input))) should be(parse(check)) + } } // More sophisticated tests of the full compiler |
