Artefact output (#545)
* build: stop using empty .prm file * generator: general-purpose mechanism for creating elaboration artefacts
This commit is contained in:
committed by
GitHub
parent
094b3bc2b1
commit
93b2fa197e
@ -31,9 +31,7 @@ trait CoreplexRISCVPlatform extends CoreplexNetwork {
|
||||
|
||||
lazy val configString = {
|
||||
val managers = l1tol2.node.edgesIn(0).manager.managers
|
||||
// Use the existing config string if the user overrode it
|
||||
ConfigStringOutput.contents.getOrElse(
|
||||
rocketchip.GenerateConfigString(p, clint, plic, managers))
|
||||
rocketchip.GenerateConfigString(p, clint, plic, managers)
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,5 +56,5 @@ trait CoreplexRISCVPlatformModule extends CoreplexNetworkModule {
|
||||
outer.clint.module.io.rtcTick := Reg(init = Bool(false), next=(rtcSync & (~rtcLast)))
|
||||
|
||||
println(s"\nGenerated Configuration String\n${outer.configString}")
|
||||
ConfigStringOutput.contents = Some(outer.configString)
|
||||
ElaborationArtefacts.add("cfg", outer.configString)
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ package groundtest
|
||||
object Generator extends util.GeneratorApp {
|
||||
val longName = names.topModuleProject + "." + names.configs
|
||||
generateFirrtl
|
||||
generateGraphML
|
||||
generateTestSuiteMakefrags // TODO: Needed only for legacy make targets
|
||||
generateParameterDump // TODO: Needed only for legacy make targets
|
||||
generateArtefacts
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import util._
|
||||
import rocket._
|
||||
|
||||
abstract class BareTop(implicit p: Parameters) extends LazyModule {
|
||||
TopModule.contents = Some(this)
|
||||
ElaborationArtefacts.add("graphml", graphML)
|
||||
}
|
||||
|
||||
abstract class BareTopBundle[+L <: BareTop](_outer: L) extends GenericParameterizedBundle(_outer) {
|
||||
|
@ -77,7 +77,5 @@ object Generator extends util.GeneratorApp {
|
||||
val longName = names.topModuleProject + "." + names.configs
|
||||
generateFirrtl
|
||||
generateTestSuiteMakefrags
|
||||
generateConfigString
|
||||
generateGraphML
|
||||
generateParameterDump
|
||||
generateArtefacts
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ package unittest
|
||||
object Generator extends util.GeneratorApp {
|
||||
val longName = names.topModuleProject + "." + names.configs
|
||||
generateFirrtl
|
||||
generateGraphML
|
||||
generateTestSuiteMakefrags // TODO: Needed only for legacy make targets
|
||||
generateParameterDump // TODO: Needed only for legacy make targets
|
||||
generateArtefacts
|
||||
}
|
||||
|
@ -103,26 +103,17 @@ trait GeneratorApp extends App with HasGeneratorUtilities {
|
||||
TestGeneration.addSuite(DefaultTestSuites.singleRegression)
|
||||
}
|
||||
|
||||
/** Output a global Parameter dump, which an external script can turn into Verilog headers. */
|
||||
def generateParameterDump {
|
||||
writeOutputFile(td, s"$longName.prm", "")
|
||||
}
|
||||
|
||||
/** Output a global ConfigString, for use by the RISC-V software ecosystem. */
|
||||
def generateConfigString {
|
||||
ConfigStringOutput.contents.foreach(c => writeOutputFile(td, s"${names.configs}.cfg", c))
|
||||
}
|
||||
|
||||
/** Output a global LazyModule topology for documentation purposes. */
|
||||
def generateGraphML {
|
||||
TopModule.contents.foreach(lm => writeOutputFile(td, s"${names.configs}.graphml", lm.graphML))
|
||||
/** Output files created as a side-effect of elaboration */
|
||||
def generateArtefacts {
|
||||
ElaborationArtefacts.files.foreach { case (extension, contents) =>
|
||||
writeOutputFile(td, s"${names.configs}.${extension}", contents ())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object ConfigStringOutput {
|
||||
var contents: Option[String] = None
|
||||
}
|
||||
|
||||
object TopModule {
|
||||
var contents: Option[LazyModule] = None
|
||||
object ElaborationArtefacts {
|
||||
var files: Seq[(String, () => String)] = Nil
|
||||
def add(extension: String, contents: => String) {
|
||||
files = (extension, () => contents) +: files
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user