Remove executeTop & make everything to execute

This commit is contained in:
joey0320
2022-12-28 11:12:18 -08:00
parent 13e2bb92ab
commit 5af7f21648
2 changed files with 7 additions and 32 deletions

View File

@@ -7,7 +7,6 @@ import firrtl.ir._
import firrtl.options.{Dependency, InputAnnotationFileAnnotation, StageMain}
import firrtl.passes.memlib.ReplSeqMemAnnotation
import firrtl.stage.{FirrtlCircuitAnnotation, FirrtlStage, OutputFileAnnotation, RunFirrtlTransformAnnotation}
import firrtl.passes.{ConvertFixedToSInt}
import firrtl.transforms.BlackBoxResourceFileNameAnno
import logger.LazyLogging
@@ -23,8 +22,8 @@ private class GenerateTopAndHarness(annotations: AnnotationSeq) extends LazyLogg
}.toList
// Dump firrtl and annotation files
protected def dump(
circuit: Circuit,
// Reads global params "outAnno"
protected def dumpAnnos(
annotations: AnnotationSeq
): Unit = {
outAnno.foreach { annoPath =>
@@ -43,26 +42,8 @@ private class GenerateTopAndHarness(annotations: AnnotationSeq) extends LazyLogg
// TODO: Filter out blackbox dumping from this FIRRTL step, let CIRCT do it
// Top Generation
def executeTop(): Unit = {
val annos = new FirrtlStage().execute(Array.empty, annotations)
annos.collectFirst { case FirrtlCircuitAnnotation(circuit) => circuit } match {
case Some(circuit) =>
dump(circuit, annos)
case _ =>
throw new Exception(s"executeTop failed while executing FIRRTL!\n")
}
}
// Top and harness generation
def executeTopAndHarness(): Unit = {
executeTop()
// For harness run, change some firrtlOptions (below) for harness phase
// customTransforms: setup harness transforms, add AvoidExtModuleCollisions
// outputFileNameOverride: change to harnessOutput
// conf file must change to harnessConf by mapping annotations
def execute(): Unit = {
val generatorAnnotations = annotations
.filterNot(_.isInstanceOf[OutputFileAnnotation])
.map {
@@ -73,12 +54,11 @@ private class GenerateTopAndHarness(annotations: AnnotationSeq) extends LazyLogg
val annos = new FirrtlStage().execute(Array.empty, generatorAnnotations)
annos.collectFirst { case FirrtlCircuitAnnotation(circuit) => circuit } match {
case Some(circuit) =>
dump(circuit, annos)
dumpAnnos(annos)
case _ =>
throw new Exception(s"executeTop failed while executing FIRRTL!\n")
}
}
}
object GenerateTop extends StageMain(new TapeoutStage(doHarness = false))
object GenerateTopAndHarness extends StageMain(new TapeoutStage(doHarness = true))
object GenerateTopAndHarness extends StageMain(new TapeoutStage())

View File

@@ -50,18 +50,13 @@ trait TapeoutCli {
).foreach(_.addOptions(parser))
}
class TapeoutStage(doHarness: Boolean) extends Stage {
class TapeoutStage() extends Stage {
override val shell: Shell = new Shell(applicationName = "tapeout") with TapeoutCli with ChiselCli with FirrtlCli
override def run(annotations: AnnotationSeq): AnnotationSeq = {
Logger.makeScope(annotations) {
val generator = new GenerateTopAndHarness(annotations)
if (doHarness) {
generator.executeTopAndHarness()
} else {
generator.executeTop()
}
generator.execute()
}
annotations
}