diff options
| author | Jack | 2016-01-30 15:22:08 -0800 |
|---|---|---|
| committer | azidar | 2016-02-09 18:55:26 -0800 |
| commit | 1613a7127dd74427786baa093b0dde5a76265b78 (patch) | |
| tree | 9b5b212617439fc05f518f8e788a0872be7f230c /src/main/scala/firrtl/Compiler.scala | |
| parent | 2aea6744256d5be73fef044565c96c39589520f8 (diff) | |
Restructure passes to be new subpackage with more modular design, add new structures Compiler and Emitter, deprecate old Passes object, update Driver to use new constructs
Diffstat (limited to 'src/main/scala/firrtl/Compiler.scala')
| -rw-r--r-- | src/main/scala/firrtl/Compiler.scala | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/main/scala/firrtl/Compiler.scala b/src/main/scala/firrtl/Compiler.scala new file mode 100644 index 00000000..18bec9dc --- /dev/null +++ b/src/main/scala/firrtl/Compiler.scala @@ -0,0 +1,65 @@ + +package firrtl + +import com.typesafe.scalalogging.LazyLogging +import java.io.Writer + +import Utils._ +import firrtl.passes._ + +trait Compiler extends LazyLogging { + def run(c: Circuit, w: Writer) +} + +object FIRRTLCompiler extends Compiler { + def run(c: Circuit, w: Writer) = { + FIRRTLEmitter.run(c, w) + w.close + } +} + +object VerilogCompiler extends Compiler { + // Copied from Stanza implementation + val passes = Seq( + CheckHighForm, + ToWorkingIR, + ResolveKinds, + InferTypes, + CheckTypes, + ResolveGenders, + CheckGenders, + InferWidths, + CheckWidths, + PullMuxes, + ExpandConnects, + RemoveAccesses, + ExpandWhens, + CheckInitialization, + ConstProp, + ResolveKinds, + InferTypes, + CheckTypes, + ResolveGenders, + CheckGenders, + InferWidths, + CheckWidths, + LowerTypes, + ResolveKinds, + InferTypes, + CheckTypes, + ResolveGenders, + CheckGenders, + InferWidths, + CheckWidths, + VerilogWrap, + SplitExp, + VerilogRename + ) + def run(c: Circuit, w: Writer) + { + val loweredIR = PassUtils.executePasses(c, passes) + VerilogEmitter.run(loweredIR, w) + w.close + } + +} |
