summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorSchuyler Eldridge2019-01-14 21:01:29 -0500
committerSchuyler Eldridge2019-05-22 16:19:13 -0400
commit23641521174ba828feb32dc1c65c13a3d6b46970 (patch)
tree22fe46c8f675ca3739f893890efc2479f367d9a1 /src/test
parent07ea0bac73d2ee5c9d09e9f3c07275340f0e75bb (diff)
Make Driver a ChiselStage compatibility layer
This converts the original chisel3.Driver to use chisel3.stage.ChiselStage. This is implemented in the following way: 1. ExecutionOptions are converted to an AnnotationSeq 2. The AnnotationSeq is preprocessed using phases contained in the Chisel DriverCompatibility objects. One of these *disables* the execution of FirrtlStage by ChiselStage. 3. ChiselStage runs on the preprocessed AnnotationSeq 4. The input ExecutionOptionsManager is mutated based on the output of ChiselStage. 5. The FIRRTL stage is re-enabled if it's supposed to run and selected FIRRTL DriverCompatibility phases run. 6. FirrtlStage runs 7. The output AnnotationSeq is "viewed" as a ChiselExecutionResult This modifies the original DriverSpec to make it more verbose with the addition of info statements. The functionality of the DriverSpec is unmodified. Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/chiselTests/DriverSpec.scala9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/DriverSpec.scala b/src/test/scala/chiselTests/DriverSpec.scala
index 612bdef2..8fc58e21 100644
--- a/src/test/scala/chiselTests/DriverSpec.scala
+++ b/src/test/scala/chiselTests/DriverSpec.scala
@@ -28,6 +28,7 @@ class DriverSpec extends FreeSpec with Matchers {
val exts = List("anno.json", "fir", "v")
for (ext <- exts) {
val dummyOutput = new File(targetDir, "DummyModule" + "." + ext)
+ info(s"${dummyOutput.toString} exists")
dummyOutput.exists() should be(true)
dummyOutput.delete()
}
@@ -44,6 +45,7 @@ class DriverSpec extends FreeSpec with Matchers {
val exts = List("anno.json", "fir", "v")
for (ext <- exts) {
val dummyOutput = new File(targetDir, "dm" + "." + ext)
+ info(s"${dummyOutput.toString} exists")
dummyOutput.exists() should be(true)
dummyOutput.delete()
}
@@ -53,14 +55,21 @@ class DriverSpec extends FreeSpec with Matchers {
}
}
+
"execute returns a chisel execution result" in {
val targetDir = "test_run_dir"
val args = Array("--compiler", "low", "--target-dir", targetDir)
+
+ info("Driver returned a ChiselExecutionSuccess")
val result = Driver.execute(args, () => new DummyModule)
result shouldBe a[ChiselExecutionSuccess]
+
+ info("emitted circuit included 'circuit DummyModule'")
val successResult = result.asInstanceOf[ChiselExecutionSuccess]
successResult.emitted should include ("circuit DummyModule")
+
val dummyOutput = new File(targetDir, "DummyModule.lo.fir")
+ info(s"${dummyOutput.toString} exists")
dummyOutput.exists() should be(true)
dummyOutput.delete()
}