diff options
| author | Adam Izraelevitz | 2020-02-06 09:42:03 -0800 |
|---|---|---|
| committer | GitHub | 2020-02-06 17:42:03 +0000 |
| commit | b36e36d956ced8f8ccfe8c540e11855b85e038c0 (patch) | |
| tree | 5e79ce67231e79619e5b42b8b397f7b5fa560bc0 /src/test | |
| parent | 39f8563c5e3e737610f46a82f6ceaa52120ef654 (diff) | |
Add constant prop to async regs (#1355)
* Add constant prop to async regs
* Added another test of no reset value but constant assignment
* Clarify name of updateNodeMap
* Update constant assignment of async reset to not be inferred as a latch, works with donttouch
* Revert "Update constant assignment of async reset to not be inferred as a latch, works with donttouch"
This reverts commit 952bf38127cb32f814496a2b4b3bfb173d532728.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/firrtlTests/AsyncResetSpec.scala | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/src/test/scala/firrtlTests/AsyncResetSpec.scala b/src/test/scala/firrtlTests/AsyncResetSpec.scala index 98d51ac8..ebc94cc8 100644 --- a/src/test/scala/firrtlTests/AsyncResetSpec.scala +++ b/src/test/scala/firrtlTests/AsyncResetSpec.scala @@ -319,6 +319,52 @@ class AsyncResetSpec extends FirrtlFlatSpec { ) } + "Unassigned asyncronously reset registers" should "properly constantprop" in { + val result = compileBody( + s""" + |input clock : Clock + |input reset : AsyncReset + |output z : UInt<1>[4] + |wire literal : UInt<1>[2] + |literal[0] <= UInt<1>("h01") + |literal[1] <= UInt<1>("h01") + |wire complex_literal : UInt<1>[4] + |complex_literal[0] <= literal[0] + |complex_literal[1] <= literal[1] + |complex_literal[2] <= UInt<1>("h00") + |complex_literal[3] <= UInt<1>("h00") + |reg r : UInt<1>[4], clock with : (reset => (reset, complex_literal)) + |z <= r""".stripMargin + ) + result shouldNot containLine("always @(posedge clock or posedge reset) begin") + } + + "Constantly assigned asynchronously reset registers" should "properly constantprop" in { + val result = compileBody( + s""" + |input clock : Clock + |input reset : AsyncReset + |output z : UInt<1> + |reg r : UInt<1>, clock with : (reset => (reset, r)) + |r <= UInt(0) + |z <= r""".stripMargin + ) + result shouldNot containLine("always @(posedge clock or posedge reset) begin") + } + + "Constantly assigned and initialized asynchronously reset registers" should "properly constantprop" in { + val result = compileBody( + s""" + |input clock : Clock + |input reset : AsyncReset + |output z : UInt<1> + |reg r : UInt<1>, clock with : (reset => (reset, UInt(0))) + |r <= UInt(0) + |z <= r""".stripMargin + ) + result shouldNot containLine("always @(posedge clock or posedge reset) begin") + } + "AsyncReset registers" should "emit 'else' case for reset even for trivial valued registers" in { val withDontTouch = s""" |circuit m : @@ -341,7 +387,6 @@ class AsyncResetSpec extends FirrtlFlatSpec { ) } - } class AsyncResetExecutionTest extends ExecutionTest("AsyncResetTester", "/features") |
