Merge pull request #126 from ucb-bar/rm-duplicate-compiler-anno

Remove duplicate compiler annotation
This commit is contained in:
Abraham Gonzalez
2023-03-01 23:44:23 -08:00
committed by GitHub
2 changed files with 1 additions and 30 deletions

View File

@@ -36,17 +36,7 @@ private class GenerateModelStageMain(annotations: AnnotationSeq) extends LazyLog
} }
def executeStageMain(): Unit = { def executeStageMain(): Unit = {
val appendedAnnotations = annotations val annos = new FirrtlStage().execute(Array.empty, annotations)
.filter(_ match {
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,31 +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))
} }