summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSchuyler Eldridge2019-04-23 02:03:03 -0400
committerSchuyler Eldridge2019-08-13 13:18:49 -0400
commit00c26d5eeee9968946871e46b00bafdf273ea0cc (patch)
tree2326ef2b92f90f59bfad83dc99d559b796b117ff /src
parent761010e26b8197019719abede3a983c603b34533 (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>
Diffstat (limited to 'src')
-rw-r--r--src/main/scala/chisel3/stage/ChiselStage.scala29
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) )
}