diff options
| author | Jack Koenig | 2018-04-10 21:24:49 -0700 |
|---|---|---|
| committer | GitHub | 2018-04-10 21:24:49 -0700 |
| commit | 0c93a121c109c3e167d80173dbfe8c2e355b30ef (patch) | |
| tree | 1da105cf6ff46a8badb0ec23b27bbd5fedc6b8b4 /src/test | |
| parent | 1d4914c396881c66aceb47d5cdd8740ad9a5be26 (diff) | |
Fix bug in Constant Propagation for registers propped to zero (#787)
It wasn't properly padding the width of the constant zero.
Also add a test that shows the buggy behavior.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/firrtlTests/ConstantPropagationTests.scala | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/ConstantPropagationTests.scala b/src/test/scala/firrtlTests/ConstantPropagationTests.scala index ca7daa17..c798ba37 100644 --- a/src/test/scala/firrtlTests/ConstantPropagationTests.scala +++ b/src/test/scala/firrtlTests/ConstantPropagationTests.scala @@ -836,6 +836,25 @@ class ConstantPropagationIntegrationSpec extends LowTransformSpec { execute(input, check, Seq.empty) } + it should "pad zero when constant propping a register replaced with zero" in { + val input = + """circuit Top : + | module Top : + | input clock : Clock + | output z : UInt<16> + | reg r : UInt<8>, clock + | r <= or(r, UInt(0)) + | node n = UInt("hab") + | z <= cat(n, r)""".stripMargin + val check = + """circuit Top : + | module Top : + | input clock : Clock + | output z : UInt<16> + | z <= UInt<16>("hab00")""".stripMargin + execute(input, check, Seq.empty) + } + it should "pad constant connections to outputs when propagating" in { val input = """circuit Top : |
