diff options
| author | ducky | 2015-12-09 17:21:38 -0800 |
|---|---|---|
| committer | ducky | 2015-12-09 17:27:08 -0800 |
| commit | 2785c3337a323e343141fd6a7fe4d2468e7feb34 (patch) | |
| tree | 06815b9314650e40816d41eaff3989fdd2000a21 /src/main/scala/Chisel/testers | |
| parent | 996ea685649136229b62579bdc1aecdb7e14d4dc (diff) | |
Refactor testharness generation to create directories and have minimal API
Diffstat (limited to 'src/main/scala/Chisel/testers')
| -rw-r--r-- | src/main/scala/Chisel/testers/TesterDriver.scala | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/main/scala/Chisel/testers/TesterDriver.scala b/src/main/scala/Chisel/testers/TesterDriver.scala index 90dc9355..364480a7 100644 --- a/src/main/scala/Chisel/testers/TesterDriver.scala +++ b/src/main/scala/Chisel/testers/TesterDriver.scala @@ -5,7 +5,7 @@ import Chisel._ import scala.sys.process._ import java.io.File -object TesterDriver extends BackendCompilationUtilities with FileSystemUtilities { +object TesterDriver extends BackendCompilationUtilities { /** For use with modules that should successfully be elaborated by the * frontend, and which can be turned into executeables with assertions. */ def execute(t: () => BasicTester, additionalVSources: Seq[File] = Seq()): Boolean = { @@ -15,23 +15,20 @@ object TesterDriver extends BackendCompilationUtilities with FileSystemUtilities // Set up a bunch of file handlers based on a random temp filename, // plus the quirks of Verilator's naming conventions val target = circuit.name - val fname = File.createTempFile(target, "") - val path = fname.getParentFile.toString + + val path = createTempDirectory(target) + val fname = File.createTempFile(target, "", path) val prefix = fname.toString.split("/").last - val dir = new File(System.getProperty("java.io.tmpdir")) - val vDut = new File(fname.toString + ".v") - val vH = new File(path + "/V" + prefix + ".h") - val cppHarness = new File(fname.toString + ".cpp") + val cppHarness = new File(System.getProperty("user.dir") + "/src/main/resources/top.cpp") // For now, dump the IR out to a file Driver.dumpFirrtl(circuit, Some(new File(fname.toString + ".fir"))) // Use sys.Process to invoke a bunch of backend stuff, then run the resulting exe - if (((new File(System.getProperty("user.dir") + "/src/main/resources/top.cpp") #> cppHarness) #&& - firrtlToVerilog(prefix, dir) #&& - verilogToCpp(prefix, dir, vDut, additionalVSources, cppHarness, vH) #&& - cppToExe(prefix, dir)).! == 0) { - executeExpectingSuccess(prefix, dir) + if ((firrtlToVerilog(prefix, path) #&& + verilogToCpp(prefix, path, additionalVSources, cppHarness) #&& + cppToExe(prefix, path)).! == 0) { + executeExpectingSuccess(prefix, path) } else { false } |
