diff options
| author | Schuyler Eldridge | 2019-04-23 02:03:03 -0400 |
|---|---|---|
| committer | Schuyler Eldridge | 2019-08-13 13:18:49 -0400 |
| commit | 00c26d5eeee9968946871e46b00bafdf273ea0cc (patch) | |
| tree | 2326ef2b92f90f59bfad83dc99d559b796b117ff | |
| parent | 761010e26b8197019719abede3a983c603b34533 (diff) | |
Migrate ChiselStage to use the DependencyAPI
Modifies ChiselStage to use a PhaseManager for Phase ordering.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@gmail.com>
| -rw-r--r-- | src/main/scala/chisel3/stage/ChiselStage.scala | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/main/scala/chisel3/stage/ChiselStage.scala b/src/main/scala/chisel3/stage/ChiselStage.scala index 0c6512af..923867d7 100644 --- a/src/main/scala/chisel3/stage/ChiselStage.scala +++ b/src/main/scala/chisel3/stage/ChiselStage.scala @@ -3,25 +3,28 @@ package chisel3.stage import firrtl.AnnotationSeq -import firrtl.options.{Phase, Shell, Stage} +import firrtl.options.{Phase, PhaseManager, PreservesAll, Shell, Stage} +import firrtl.options.phases.DeletedWrapper import firrtl.stage.FirrtlCli -class ChiselStage extends Stage { +class ChiselStage extends Stage with PreservesAll[Phase] { val shell: Shell = new Shell("chisel") with ChiselCli with FirrtlCli - private val phases: Seq[Phase] = - Seq( new chisel3.stage.phases.Checks, - new chisel3.stage.phases.Elaborate, - new chisel3.stage.phases.AddImplicitOutputFile, - new chisel3.stage.phases.AddImplicitOutputAnnotationFile, - new chisel3.stage.phases.MaybeAspectPhase, - new chisel3.stage.phases.Emitter, - new chisel3.stage.phases.Convert, - new chisel3.stage.phases.MaybeFirrtlStage ) - .map(firrtl.options.phases.DeletedWrapper(_)) + private val targets = + Seq( classOf[chisel3.stage.phases.Checks], + classOf[chisel3.stage.phases.Elaborate], + classOf[chisel3.stage.phases.AddImplicitOutputFile], + classOf[chisel3.stage.phases.AddImplicitOutputAnnotationFile], + classOf[chisel3.stage.phases.MaybeAspectPhase], + classOf[chisel3.stage.phases.Emitter], + classOf[chisel3.stage.phases.Convert], + classOf[chisel3.stage.phases.MaybeFirrtlStage] ) def run(annotations: AnnotationSeq): AnnotationSeq = /* @todo: Should this be wrapped in a try/catch? */ - phases.foldLeft(annotations)( (a, f) => f.transform(a) ) + new PhaseManager(targets) { override val wrappers = Seq( (a: Phase) => DeletedWrapper(a) ) } + .transformOrder + .map(firrtl.options.phases.DeletedWrapper(_)) + .foldLeft(annotations)( (a, f) => f.transform(a) ) } |
