diff options
| author | Schuyler Eldridge | 2020-03-24 13:25:24 -0400 |
|---|---|---|
| committer | Schuyler Eldridge | 2020-03-24 15:48:58 -0400 |
| commit | 693e6ad61f5ad8e84ade2a51ebd7e23ad69587bb (patch) | |
| tree | 48ca3ff5ca7822b7c3a7fcd9e871b280ba1f583b /src | |
| parent | 1c18667136d39b2005c83cb58d8c8f017fc11808 (diff) | |
Add ChiselStageSpec for string/circuit emission
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/scala/chiselTests/stage/ChiselStageSpec.scala | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/stage/ChiselStageSpec.scala b/src/test/scala/chiselTests/stage/ChiselStageSpec.scala new file mode 100644 index 00000000..b14d79a1 --- /dev/null +++ b/src/test/scala/chiselTests/stage/ChiselStageSpec.scala @@ -0,0 +1,59 @@ +// See LICENSE for license details. + +package chiselTests.stage + +import chisel3._ +import chisel3.stage.ChiselStage + +import org.scalatest.{FlatSpec, Matchers} + +object ChiselStageSpec { + + class Foo extends MultiIOModule { + val addr = IO(Input(UInt(4.W))) + val out = IO(Output(Bool())) + val bar = SyncReadMem(8, Bool()) + out := bar(addr) + } + +} + +class ChiselStageSpec extends FlatSpec with Matchers { + + import ChiselStageSpec._ + + private trait ChiselStageFixture { + val stage = new ChiselStage + } + + behavior of "ChiselStage.emitChirrtl" + + it should "return a CHIRRTL string" in new ChiselStageFixture { + stage.emitChirrtl(new Foo) should include ("infer mport") + } + + behavior of "ChiselStage.emitFirrtl" + + it should "return a High FIRRTL string" in new ChiselStageFixture { + stage.emitFirrtl(new Foo) should include ("mem bar") + } + + behavior of "ChiselStage.emitVerilog" + + it should "return a Verilog string" in new ChiselStageFixture { + stage.emitVerilog(new Foo) should include ("endmodule") + } + + behavior of "ChiselStage$.elaborate" + + it should "generate a Chisel circuit from a Chisel module" in { + ChiselStage.elaborate(new Foo) + } + + behavior of "ChiselStage$.convert" + + it should "generate a CHIRRTL circuit from a Chisel module" in { + ChiselStage.convert(new Foo) + } + +} |
