defpackage firrtl/compiler : import core import verse import firrtl/passes import firrtl/errors ; import firrtl/flo import firrtl/verilog import firrtl/ir2 import firrtl/ir-utils ;public defstruct StandardFlo <: Compiler : ; file: String with: (as-method => true) ;public defmethod passes (c:StandardFlo) -> List : ; to-list $ [ ; CheckHighForm(expand-delin) ; ;; TempElimination() ; ToWorkingIR() ; MakeExplicitReset() ; ResolveKinds() ; CheckKinds() ; InferTypes() ; CheckTypes() ; ResolveGenders() ; CheckGenders() ; ExpandAccessors() ; LowerToGround() ; ExpandIndexedConnects() ; ExpandWhens() ; InferWidths() ; Pad() ; Inline() ; SplitExp() ; ToRealIR() ; SpecialRename(`#,`_) ; SpecialRename(`$,`::) ; CheckHighForm(`::) ; CheckLowForm() ; Flo(file(c)) ; ] public defstruct StandardVerilog <: Compiler : file: String with: (as-method => true) public defmethod passes (c:StandardVerilog) -> List : to-list $ [ CheckHighForm(expand-delin) TempElimination() ToWorkingIR() MakeExplicitReset() ResolveKinds() CheckKinds() InferTypes() CheckTypes() ResolveGenders() CheckGenders() ExpandAccessors() LowerToGround() ExpandIndexedConnects() ExpandWhens() InferWidths() Pad() SplitExp() ToRealIR() SpecialRename(`#,`_) SpecialRename(`$,`__) CheckHighForm(`__) CheckLowForm() Verilog(file(c)) ] ;============= DRIVER ====================================== public defn run-passes (c:Circuit,comp:Compiler) : run-passes(c,passes(comp)) public defn run-passes (c:Circuit,ls:List) : var c*:Circuit = c println("Compiling!") if PRINT-CIRCUITS : println("Original Circuit") if PRINT-CIRCUITS : print(c) val start-time = current-time-us() var t = start-time for p in ls do : if PRINT-CIRCUITS : println(name(p)) c* = pass(p)(c*) if PRINT-CIRCUITS : print(c*) if PRINT-CIRCUITS : println-all(["Finished " name(p) "\n"]) val current-time = current-time-us() println-all(["Time since start: " current-time - start-time]) println-all(["Time for this pass: " current-time - t]) t = current-time println("Done!")