summaryrefslogtreecommitdiff
path: root/src/main/scala/chisel3/Driver.scala
diff options
context:
space:
mode:
authorJim Lawson2016-12-12 09:14:33 -0800
committerGitHub2016-12-12 09:14:33 -0800
commitb581a24728bfba0c39ed2c032fd86f628a1e1a50 (patch)
treef625219f936d39e760192aa69df17e776b95dd56 /src/main/scala/chisel3/Driver.scala
parent0bd9ae059368570dc72f25f7939afa5cfe5fd06e (diff)
parentad53161bbb9f67e16b88ca7a508a537f88d77e05 (diff)
Merge branch 'master' into buildinfousepackageaspath
Diffstat (limited to 'src/main/scala/chisel3/Driver.scala')
-rw-r--r--src/main/scala/chisel3/Driver.scala18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/main/scala/chisel3/Driver.scala b/src/main/scala/chisel3/Driver.scala
index a0713379..646702c3 100644
--- a/src/main/scala/chisel3/Driver.scala
+++ b/src/main/scala/chisel3/Driver.scala
@@ -6,10 +6,13 @@ import chisel3.internal.firrtl.Emitter
import scala.sys.process._
import java.io._
+import net.jcazevedo.moultingyaml._
import internal.firrtl._
import firrtl._
+import _root_.firrtl.annotations.AnnotationYamlProtocol._
+
/**
* The Driver provides methods to invoke the chisel3 compiler and the firrtl compiler.
* By default firrtl is automatically run after chisel. an [[ExecutionOptionsManager]]
@@ -95,7 +98,7 @@ trait BackendCompilationUtilities {
/** Generates a Verilator invocation to convert Verilog sources to C++
* simulation sources.
*
- * The Verilator prefix will be V$dutFile, and running this will generate
+ * The Verilator prefix will be V\$dutFile, and running this will generate
* C++ sources and headers as well as a makefile to compile them.
*
* @param dutFile name of the DUT .v without the .v extension
@@ -119,13 +122,13 @@ trait BackendCompilationUtilities {
"-Wno-WIDTH",
"-Wno-STMTDLY",
"--trace",
- "-O0",
+ "-O1",
"--top-module", topModule,
"+define+TOP_TYPE=V" + dutFile,
s"+define+PRINTF_COND=!$topModule.reset",
s"+define+STOP_COND=!$topModule.reset",
"-CFLAGS",
- s"""-Wno-undefined-bool-conversion -O0 -DTOP_TYPE=V$dutFile -include V$dutFile.h""",
+ s"""-Wno-undefined-bool-conversion -O1 -DTOP_TYPE=V$dutFile -include V$dutFile.h""",
"-Mdir", dir.toString,
"--exe", cppHarness.toString)
System.out.println(s"${command.mkString(" ")}") // scalastyle:ignore regex
@@ -239,6 +242,15 @@ object Driver extends BackendCompilationUtilities {
w.write(firrtlString)
w.close()
+ val annotationFile = new File(optionsManager.getBuildFileName("anno"))
+ val af = new FileWriter(annotationFile)
+ af.write(circuit.annotations.toArray.toYaml.prettyPrint)
+ af.close()
+
+ /* This passes the firrtl source and annotations directly to firrtl */
+ optionsManager.firrtlOptions = optionsManager.firrtlOptions.copy(
+ firrtlSource = Some(firrtlString), annotations = circuit.annotations.toList)
+
val firrtlExecutionResult = if(chiselOptions.runFirrtlCompiler) {
Some(firrtl.Driver.execute(optionsManager))
}