diff options
| author | azidar | 2016-07-21 13:57:13 -0700 |
|---|---|---|
| committer | azidar | 2016-07-21 13:57:13 -0700 |
| commit | 0441a6df1eafd5db99c5cbcc0a07c5a6cb37f975 (patch) | |
| tree | 116ec7cbf7f94d70f5659abace4267f529b195f2 /src/test | |
| parent | ab340febdc7a5418da945f9b79624d36e66e26db (diff) | |
Added a Chirrtl check for undeclared wires, etc.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/firrtlTests/ChirrtlSpec.scala | 59 |
1 files changed, 40 insertions, 19 deletions
diff --git a/src/test/scala/firrtlTests/ChirrtlSpec.scala b/src/test/scala/firrtlTests/ChirrtlSpec.scala index d3e02ff1..a24cd9fa 100644 --- a/src/test/scala/firrtlTests/ChirrtlSpec.scala +++ b/src/test/scala/firrtlTests/ChirrtlSpec.scala @@ -35,27 +35,28 @@ import firrtl.ir.Circuit import firrtl.passes._ class ChirrtlSpec extends FirrtlFlatSpec { + def passes = Seq( + CheckChirrtl, + CInferTypes, + CInferMDir, + RemoveCHIRRTL, + ToWorkingIR, + CheckHighForm, + ResolveKinds, + InferTypes, + CheckTypes, + ResolveGenders, + CheckGenders, + InferWidths, + CheckWidths, + PullMuxes, + ExpandConnects, + RemoveAccesses, + ExpandWhens, + CheckInitialization + ) "Chirrtl memories" should "allow ports with clocks defined after the memory" in { - val passes = Seq( - CInferTypes, - CInferMDir, - RemoveCHIRRTL, - ToWorkingIR, - CheckHighForm, - ResolveKinds, - InferTypes, - CheckTypes, - ResolveGenders, - CheckGenders, - InferWidths, - CheckWidths, - PullMuxes, - ExpandConnects, - RemoveAccesses, - ExpandWhens, - CheckInitialization - ) val input = """circuit Unit : | module Unit : @@ -73,6 +74,26 @@ class ChirrtlSpec extends FirrtlFlatSpec { } } + "Chirrtl" should "catch undeclared wires" in { + val input = + """circuit Unit : + | module Unit : + | input clk : Clock + | smem ram : UInt<32>[128] + | node newClock = clk + | infer mport x = ram[UInt(2)], newClock + | x <= UInt(3) + | when UInt(1) : + | infer mport y = ram[UInt(4)], newClock + | y <= z + """.stripMargin + intercept[PassException] { + passes.foldLeft(Parser.parse(input.split("\n").toIterator)) { + (c: Circuit, p: Pass) => p.run(c) + } + } + } + it should "compile and run" in { runFirrtlTest("ChirrtlMems", "/features") } |
