summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests
diff options
context:
space:
mode:
authorSchuyler Eldridge2020-03-24 19:00:16 -0400
committerGitHub2020-03-24 19:00:16 -0400
commit3f6b1ce708063097042ecee5d004c66182c25470 (patch)
tree3f727a5128f5847b341f2152ce00a641449db4db /src/test/scala/chiselTests
parent6ed81bc6c6d0f0e8cb57eb3cedb73feab204ef6e (diff)
parent3fb11ea0331cfc70128524b98b4915300362762f (diff)
Merge pull request #1213 from freechipsproject/driver-deprecations
Deprecate Driver methods in favor of ChiselStage
Diffstat (limited to 'src/test/scala/chiselTests')
-rw-r--r--src/test/scala/chiselTests/stage/ChiselStageSpec.scala59
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)
+ }
+
+}