diff options
| author | Adam Izraelevitz | 2016-07-27 13:53:30 -0700 |
|---|---|---|
| committer | GitHub | 2016-07-27 13:53:30 -0700 |
| commit | 486cdb5ea4a3450c81231f09488b5b166c363133 (patch) | |
| tree | 0df3abbd5ee94a1d221b5d798e2722dfe9844028 /src/test | |
| parent | 42d38081f19b25ccb78f81f451b58e77b3e96d53 (diff) | |
| parent | a6c8493e907dedcbb289f6d4f6323cc26fb1edc0 (diff) | |
Merge pull request #198 from ucb-bar/add-chirrtl-check
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") } |
