aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbert Magyar2020-04-15 16:41:52 -0700
committerAlbert Magyar2020-04-20 15:23:35 -0700
commit8653fd628f83c1bcb329dd37844ddfdb8f4cf206 (patch)
treee614936e50ba05d2262150a07d201ebd33ac517b /src
parent04f4bc177f8d38993a191bdba4398840a2a63155 (diff)
Add test cases for illegal casts to AsyncReset / Clock
Diffstat (limited to 'src')
-rw-r--r--src/test/scala/firrtlTests/WidthSpec.scala22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/WidthSpec.scala b/src/test/scala/firrtlTests/WidthSpec.scala
index 4d04ed66..4b0bc5e5 100644
--- a/src/test/scala/firrtlTests/WidthSpec.scala
+++ b/src/test/scala/firrtlTests/WidthSpec.scala
@@ -68,6 +68,28 @@ class WidthSpec extends FirrtlFlatSpec {
}
}
+ "Casting a multi-bit signal to Clock" should "result in error" in {
+ val input =
+ s"""circuit Unit :
+ | module Unit :
+ | input i: UInt<2>
+ | node x = asClock(i)""".stripMargin
+ intercept[CheckWidths.MultiBitAsClock] {
+ executeTest(input, Nil, inferAndCheckPasses)
+ }
+ }
+
+ "Casting a multi-bit signal to AsyncReset" should "result in error" in {
+ val input =
+ s"""circuit Unit :
+ | module Unit :
+ | input i: UInt<2>
+ | node x = asAsyncReset(i)""".stripMargin
+ intercept[CheckWidths.MultiBitAsAsyncReset] {
+ executeTest(input, Nil, inferAndCheckPasses)
+ }
+ }
+
"Width >= MaxWidth" should "result in an error" in {
val input =
s"""circuit Unit :