aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorAdam Izraelevitz2016-08-05 13:18:14 -0700
committerGitHub2016-08-05 13:18:14 -0700
commitfa0573f657f722b1a163ce721f06172a1a9782c2 (patch)
tree7f56fce5cbecf29dd56d189bed6746c9e6173f19 /src/test
parent732d0c6ccbcb971abfde4679a27384647d18b44d (diff)
parent6aea3924fb48cbb4c1be217630c60be39b243ff1 (diff)
Merge pull request #220 from ucb-bar/fix-width-error-msg
Bugfix: recursing stmts to remove unknown widths
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/firrtlTests/UnitTests.scala57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/UnitTests.scala b/src/test/scala/firrtlTests/UnitTests.scala
index bc8db897..2d1bbdc1 100644
--- a/src/test/scala/firrtlTests/UnitTests.scala
+++ b/src/test/scala/firrtlTests/UnitTests.scala
@@ -232,4 +232,61 @@ class UnitTests extends FirrtlFlatSpec {
)
executeTest(input, check, passes)
}
+
+ "Oversized bit select" should "throw an exception" in {
+ val passes = Seq(
+ ToWorkingIR,
+ ResolveKinds,
+ InferTypes,
+ ResolveGenders,
+ InferWidths,
+ CheckWidths)
+ val input =
+ """circuit Unit :
+ | module Unit :
+ | node x = bits(UInt(1), 100, 0)""".stripMargin
+ intercept[CheckWidths.BitsWidthException] {
+ passes.foldLeft(Parser.parse(input.split("\n").toIterator)) {
+ (c: Circuit, p: Pass) => p.run(c)
+ }
+ }
+ }
+
+ "Oversized head select" should "throw an exception" in {
+ val passes = Seq(
+ ToWorkingIR,
+ ResolveKinds,
+ InferTypes,
+ ResolveGenders,
+ InferWidths,
+ CheckWidths)
+ val input =
+ """circuit Unit :
+ | module Unit :
+ | node x = head(UInt(1), 100)""".stripMargin
+ intercept[CheckWidths.HeadWidthException] {
+ passes.foldLeft(Parser.parse(input.split("\n").toIterator)) {
+ (c: Circuit, p: Pass) => p.run(c)
+ }
+ }
+ }
+
+ "Oversized tail select" should "throw an exception" in {
+ val passes = Seq(
+ ToWorkingIR,
+ ResolveKinds,
+ InferTypes,
+ ResolveGenders,
+ InferWidths,
+ CheckWidths)
+ val input =
+ """circuit Unit :
+ | module Unit :
+ | node x = tail(UInt(1), 100)""".stripMargin
+ intercept[CheckWidths.TailWidthException] {
+ passes.foldLeft(Parser.parse(input.split("\n").toIterator)) {
+ (c: Circuit, p: Pass) => p.run(c)
+ }
+ }
+ }
}