summaryrefslogtreecommitdiff
path: root/src/main/scala/chisel3/testers
diff options
context:
space:
mode:
authorchick2016-09-29 00:37:32 -0700
committerchick2016-10-14 09:41:25 -0700
commit070a8d724b282d3866da530b5d99ce7646fbf00e (patch)
treec5aa54b045e23320b07e164bc0758315ea139a2e /src/main/scala/chisel3/testers
parented872df330cb7dfabdd0e0866176f8f5be8861da (diff)
Implement a standardized execution scheme for chisel
Provide support for chisel options Provide support for firrtl options when called as part of chisel compile provide command line support the above options via scopt provide and execution result class that can be used when chisel3 is part of some externally controlled toolchain
Diffstat (limited to 'src/main/scala/chisel3/testers')
-rw-r--r--src/main/scala/chisel3/testers/TesterDriver.scala35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/main/scala/chisel3/testers/TesterDriver.scala b/src/main/scala/chisel3/testers/TesterDriver.scala
index 586fa780..76b9a2e9 100644
--- a/src/main/scala/chisel3/testers/TesterDriver.scala
+++ b/src/main/scala/chisel3/testers/TesterDriver.scala
@@ -3,15 +3,13 @@
package chisel3.testers
import chisel3._
-import scala.io.Source
-import scala.sys.process._
import java.io._
object TesterDriver extends BackendCompilationUtilities {
/** Copy the contents of a resource to a destination file.
*/
def copyResourceToFile(name: String, file: File) {
- val in = getClass().getResourceAsStream(name)
+ val in = getClass.getResourceAsStream(name)
if (in == null) {
throw new FileNotFoundException(s"Resource '$name'")
}
@@ -22,7 +20,9 @@ object TesterDriver extends BackendCompilationUtilities {
/** For use with modules that should successfully be elaborated by the
* frontend, and which can be turned into executables with assertions. */
- def execute(t: () => BasicTester, additionalVResources: Seq[String] = Seq()): Boolean = {
+ def execute(t: () => BasicTester,
+ additionalVResources: Seq[String] = Seq(),
+ runFirrtlasProcess: Boolean = false): Boolean = {
// Invoke the chisel compiler to get the circuit's IR
val circuit = Driver.elaborate(finishWrapper(t))
@@ -46,13 +46,28 @@ object TesterDriver extends BackendCompilationUtilities {
out
})
- // Use sys.Process to invoke a bunch of backend stuff, then run the resulting exe
- if ((firrtlToVerilog(target, path) #&&
+ if(runFirrtlasProcess) {
+ // Use sys.Process to invoke a bunch of backend stuff, then run the resulting exe
+ if ((firrtlToVerilog(target, path) #&&
verilogToCpp(target, target, path, additionalVFiles, cppHarness) #&&
- cppToExe(target, path)).! == 0) {
- executeExpectingSuccess(target, path)
- } else {
- false
+ cppToExe(target, path)).! == 0) {
+ executeExpectingSuccess(target, path)
+ } else {
+ false
+ }
+ }
+ else {
+ // Compile firrtl
+ if (!compileFirrtlToVerilog(target, path)) {
+ return false
+ }
+ // Use sys.Process to invoke a bunch of backend stuff, then run the resulting exe
+ if ((verilogToCpp(target, target, path, additionalVFiles, cppHarness) #&&
+ cppToExe(target, path)).! == 0) {
+ executeExpectingSuccess(target, path)
+ } else {
+ false
+ }
}
}
/**