1
0

RegFieldDesc: Prevent different RegField JSONS from overwriting eachother.

This commit is contained in:
Megan Wachs 2018-02-15 14:01:47 -08:00
parent 64d3731e45
commit b95f68447f
2 changed files with 12 additions and 2 deletions

View File

@ -111,7 +111,12 @@ case class TLRegisterNode(
("baseAddress" -> base) ~ ("baseAddress" -> base) ~
("regfields" -> regDescs) ("regfields" -> regDescs)
)) ))
ElaborationArtefacts.add(s"${base}.regmap.json", pretty(render(json)))
var suffix = 0
while( ElaborationArtefacts.contains(s"${base}.${suffix}.regmap.json")){
suffix = suffix + 1
}
ElaborationArtefacts.add(s"${base}.${suffix}regmap.json", pretty(render(json)))
} }
} }

View File

@ -139,7 +139,12 @@ trait GeneratorApp extends App with HasGeneratorUtilities {
object ElaborationArtefacts { object ElaborationArtefacts {
var files: Seq[(String, () => String)] = Nil var files: Seq[(String, () => String)] = Nil
def add(extension: String, contents: => String) {
def add(extension: String, contents: => String) = {
files = (extension, () => contents) +: files files = (extension, () => contents) +: files
} }
def contains(extension: String): Boolean = {
files.foldLeft(false)((t, s) => {s._1 == extension | t})
}
} }