remove duplicate compiler annotation

This commit is contained in:
joey0320
2023-02-20 23:58:46 -08:00
parent 9760528f1d
commit a9f9068baf
2 changed files with 1 additions and 28 deletions

View File

@@ -36,14 +36,7 @@ private class GenerateModelStageMain(annotations: AnnotationSeq) extends LazyLog
} }
def executeStageMain(): Unit = { def executeStageMain(): Unit = {
val appendedAnnotations = annotations.filter(_ match { val annos = new FirrtlStage().execute(Array.empty, annotations)
case CompilerNameAnnotation(_) => true
case _ => false
}).map(_ match {
case CompilerNameAnnotation("low") => Some(RunFirrtlTransformAnnotation(Dependency[ExtraLowTransforms]))
case _ => None
}).flatten
val annos = new FirrtlStage().execute(Array.empty, annotations ++ appendedAnnotations)
annos.collectFirst { case FirrtlCircuitAnnotation(circuit) => circuit } match { annos.collectFirst { case FirrtlCircuitAnnotation(circuit) => circuit } match {
case Some(circuit) => case Some(circuit) =>

View File

@@ -28,32 +28,12 @@ object OutAnnoAnnotation extends HasShellOptions {
) )
} }
case class CompilerNameAnnotation(name: String) extends NoTargetAnnotation with TapeoutOption
// duplicate of firrtl.stage.CompilerAnnotation but needed so that you can have a
// CompilerAnnotation to match on when adding new transforms
object DuplicateCompilerAnnotation extends HasShellOptions {
val options: Seq[ShellOption[_]] = Seq(
new ShellOption[String](
longOption = "duplicate-compiler",
shortOption = Some("DX"),
toAnnotationSeq = (s: String) => {
Seq(
CompilerNameAnnotation(s))
},
helpText = "duplicate-compiler",
helpValueName = Some("same as --compiler FIRRTL flag")
)
)
}
trait TapeoutCli { trait TapeoutCli {
this: Shell => this: Shell =>
parser.note("Tapeout specific options") parser.note("Tapeout specific options")
Seq( Seq(
OutAnnoAnnotation, OutAnnoAnnotation,
DuplicateCompilerAnnotation
).foreach(_.addOptions(parser)) ).foreach(_.addOptions(parser))
} }