summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJack Koenig2020-03-06 11:05:55 -0800
committerGitHub2020-03-06 19:05:55 +0000
commita06c411ce2ce6ddf8c20b38f90f4074af7b33b3f (patch)
tree3e129e07c524baaf4e7f7a85813fcefc69160189 /src
parent1a4e0dd65ba3e64268beca8f592bd58d98c434a4 (diff)
Provide API to set concrete type of implicit reset (#1361)
Introduces mutually-exclusive traits RequireAsyncReset and RequireSyncReset to set the type of the implicit reset in MultiIOModules. The Scala-type remains Reset, but the Chisel elaboration-time checks apply. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/test/scala/chiselTests/ResetSpec.scala24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/ResetSpec.scala b/src/test/scala/chiselTests/ResetSpec.scala
index 2a17d52f..d08be8fa 100644
--- a/src/test/scala/chiselTests/ResetSpec.scala
+++ b/src/test/scala/chiselTests/ResetSpec.scala
@@ -68,4 +68,28 @@ class ResetSpec extends ChiselFlatSpec {
})
async should include ("always @(posedge clk or posedge rst)")
}
+
+ behavior of "Users"
+
+ they should "be able to force implicit reset to be synchronous" in {
+ val fir = generateFirrtl(new MultiIOModule with RequireSyncReset {
+ reset shouldBe a [Bool]
+ })
+ fir should include ("input reset : UInt<1>")
+ }
+
+ they should "be able to force implicit reset to be asynchronous" in {
+ val fir = generateFirrtl(new MultiIOModule with RequireAsyncReset {
+ reset shouldBe an [AsyncReset]
+ })
+ fir should include ("input reset : AsyncReset")
+ }
+
+ "Chisel" should "error if sync and async modules are nested" in {
+ a [ChiselException] shouldBe thrownBy {
+ elaborate(new MultiIOModule with RequireAsyncReset {
+ val mod = Module(new MultiIOModule with RequireSyncReset)
+ })
+ }
+ }
}