diff options
| author | jackkoenig | 2016-04-09 18:29:59 -0700 |
|---|---|---|
| committer | jackkoenig | 2016-04-09 18:48:15 -0700 |
| commit | f93dc6831e282338bcda1db04dbf272a36b4a895 (patch) | |
| tree | fe3ea2c6b71d8e126c48fdcb1ccdece8faaa7a07 /src/test | |
| parent | b0723eca35e1ac6bae60e233c3319d3e85a6984b (diff) | |
Adds check for type of DefRegister initialization
Fixes #89
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/firrtlTests/UnitTests.scala | 22 |
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) + } + } + } } |
