diff options
| author | jackkoenig | 2016-10-20 00:19:01 -0700 |
|---|---|---|
| committer | Jack Koenig | 2016-11-04 13:29:09 -0700 |
| commit | 8fa9429a6e916ab2a789f5d81fa803b022805b52 (patch) | |
| tree | fac2efcbd0a68bfb1916f09afc7f003c7a3d6528 /src/main/scala/firrtl/Driver.scala | |
| parent | 62133264a788f46b319ebab9c31424b7e0536101 (diff) | |
Refactor Compilers and Transforms
* Transform Ids now handled by Class[_ <: Transform] instead of magic numbers
* Transforms define inputForm and outputForm
* Custom transforms can be inserted at runtime into compiler or the Driver
* Current "built-in" custom transforms handled via above mechanism
* Verilog-specific passes moved to the Verilog emitter
Diffstat (limited to 'src/main/scala/firrtl/Driver.scala')
| -rw-r--r-- | src/main/scala/firrtl/Driver.scala | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/main/scala/firrtl/Driver.scala b/src/main/scala/firrtl/Driver.scala index ba5527b4..293ac4fd 100644 --- a/src/main/scala/firrtl/Driver.scala +++ b/src/main/scala/firrtl/Driver.scala @@ -30,7 +30,8 @@ import scala.collection._ * firrtl.Driver.execute(Array("--top-name Dummy --compiler verilog".split(" +")) * }}} * each approach has its own endearing aspects - * @see firrtlTests.DriverSpec.scala in the test directory for a lot more examples + * @see firrtlTests/DriverSpec.scala in the test directory for a lot more examples + * @see [[CompilerUtils.mergeTransforms]] to see how customTransformations are inserted */ object Driver { @@ -42,11 +43,15 @@ object Driver { output: String, compiler: Compiler, infoMode: InfoMode = IgnoreInfo, + customTransforms: Seq[Transform] = Seq.empty, annotations: AnnotationMap = new AnnotationMap(Seq.empty) ): String = { val parsedInput = Parser.parse(Source.fromFile(input).getLines(), infoMode) val outputBuffer = new java.io.CharArrayWriter - compiler.compile(parsedInput, annotations, outputBuffer) + compiler.compile( + CircuitState(parsedInput, ChirrtlForm, Some(annotations)), + outputBuffer, + customTransforms) val outputFile = new java.io.PrintWriter(output) val outputString = outputBuffer.toString @@ -108,7 +113,11 @@ object Driver { val parsedInput = Parser.parse(firrtlSource, firrtlConfig.infoMode) val outputBuffer = new java.io.CharArrayWriter - firrtlConfig.compiler.compile(parsedInput, new AnnotationMap(firrtlConfig.annotations), outputBuffer) + firrtlConfig.compiler.compile( + CircuitState(parsedInput, ChirrtlForm, Some(new AnnotationMap(firrtlConfig.annotations))), + outputBuffer, + firrtlConfig.customTransforms + ) val outputFileName = firrtlConfig.getOutputFileName(optionsManager) val outputFile = new java.io.PrintWriter(outputFileName) @@ -193,4 +202,4 @@ object FileUtils { } } } -}
\ No newline at end of file +} |
