RegFieldDesc: Prevent different RegField JSONS from overwriting eachother.
This commit is contained in:
parent
64d3731e45
commit
b95f68447f
@ -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)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user