diff options
| author | jackkoenig | 2015-10-30 16:36:04 -0700 |
|---|---|---|
| committer | jackkoenig | 2015-10-30 16:36:04 -0700 |
| commit | d715e65b8de4823621b072065b746730d712d2a4 (patch) | |
| tree | 5da801428a69148c3db26d9b9a7a6927743a3c35 /src/main/stanza/compilers.stanza | |
| parent | 852b241e274edd888499b520d320945794a26e24 (diff) | |
Added support for -b <backend> so that specific passes can be run then a backend can be applied. Added firrtl compiler for emitting firrtl
Diffstat (limited to 'src/main/stanza/compilers.stanza')
| -rw-r--r-- | src/main/stanza/compilers.stanza | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/main/stanza/compilers.stanza b/src/main/stanza/compilers.stanza index 0ea9a367..edbf5c66 100644 --- a/src/main/stanza/compilers.stanza +++ b/src/main/stanza/compilers.stanza @@ -5,6 +5,7 @@ defpackage firrtl/compiler : import firrtl/errors import firrtl/flo import firrtl/verilog + import firrtl/firrtl import firrtl/ir2 import firrtl/ir-utils @@ -41,6 +42,8 @@ public defmethod passes (c:StandardFlo) -> List<Pass> : public defstruct StandardVerilog <: Compiler : with-output : (() -> False) -> False with: (as-method => true) +public defmethod backend (c:StandardVerilog) -> List<Pass> : + to-list $ [ Verilog(with-output(c)) ] public defmethod passes (c:StandardVerilog) -> List<Pass> : to-list $ [ RemoveSpecialChars() ;R @@ -74,11 +77,23 @@ public defmethod passes (c:StandardVerilog) -> List<Pass> : Verilog(with-output(c)) ;R ] +public defstruct StandardFIRRTL <: Compiler : + with-output : (() -> False) -> False with: (as-method => true) +public defmethod backend (c:StandardFIRRTL) -> List<Pass> : + to-list $ [ FIRRTL(with-output(c)) ] +public defmethod passes (c:StandardFIRRTL) -> List<Pass> : + to-list $ [ + CheckHighForm() + FIRRTL(with-output(c)) + ] + ;============= DRIVER ====================================== -public defn run-passes (c:Circuit,comp:Compiler) : +public defn run-backend (c:Circuit,comp:Compiler) : + run-passes(c,backend(comp)) +public defn run-passes (c:Circuit,comp:Compiler) -> Circuit: run-passes(c,passes(comp)) -public defn run-passes (c:Circuit,ls:List<Pass>) : +public defn run-passes (c:Circuit,ls:List<Pass>) -> Circuit: var c*:Circuit = c println("Compiling!") if PRINT-CIRCUITS : println("Original Circuit") @@ -105,3 +120,4 @@ public defn run-passes (c:Circuit,ls:List<Pass>) : println-all([x[0] " --- " to-float(x[1] as Int * 100) / to-float(t - start-time) "%"]) println("==========================") println("Done!") + c* |
