aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/firrtlTests/UnitTests.scala22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/UnitTests.scala b/src/test/scala/firrtlTests/UnitTests.scala
index eda5d5d2..64f71180 100644
--- a/src/test/scala/firrtlTests/UnitTests.scala
+++ b/src/test/scala/firrtlTests/UnitTests.scala
@@ -27,4 +27,26 @@ class UnitTests extends FlatSpec with Matchers {
}
}
}
+
+ "Initializing a register with a different type" should "throw an exception" in {
+ val passes = Seq(
+ ToWorkingIR,
+ CheckHighForm,
+ ResolveKinds,
+ InferTypes,
+ CheckTypes)
+ val input =
+ """circuit Unit :
+ | module Unit :
+ | input clk : Clock
+ | input reset : UInt<1>
+ | wire x : { valid : UInt<1> }
+ | reg y : { valid : UInt<1>, bits : UInt<3> }, clk with :
+ | reset => (reset, x)""".stripMargin
+ intercept[PassExceptions] {
+ passes.foldLeft(Parser.parse("",input.split("\n").toIterator)) {
+ (c: Circuit, p: Pass) => p.run(c)
+ }
+ }
+ }
}