1
0

Explicitly name PlusArg serializers as *_cHeader

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@gmail.com>
This commit is contained in:
Schuyler Eldridge 2018-01-15 17:00:12 -05:00
parent cfd49f87c1
commit 09c1d034fa
2 changed files with 6 additions and 6 deletions

View File

@ -21,7 +21,7 @@ abstract class BareCoreplexModule[+L <: BareCoreplex](_outer: L) extends LazyMod
ElaborationArtefacts.add("graphml", outer.graphML)
ElaborationArtefacts.add("dts", outer.dts)
ElaborationArtefacts.add("json", outer.json)
ElaborationArtefacts.add("plusArgs", PlusArgArtefacts.serialize)
ElaborationArtefacts.add("plusArgs", PlusArgArtefacts.serialize_cHeader)
println(outer.dts)
}

View File

@ -36,7 +36,7 @@ object PlusArgArtefacts {
artefacts = artefacts ++ Map(name -> PlusArgInfo(default, docstring))
/* From plus args, generate help text */
private def serializeHelp(tab: String = ""): String = artefacts
private def serializeHelp_cHeader(tab: String = ""): String = artefacts
.map{ case(arg, PlusArgInfo(default, docstring)) =>
s"""|$tab+$arg=INT\\n\\
|$tab${" "*20}$docstring\\n\\
@ -44,7 +44,7 @@ object PlusArgArtefacts {
.mkString("\\n\\\n") ++ "\""
/* From plus args, generate a char array of their names */
private def serializeArray(tab: String = ""): String = {
private def serializeArray_cHeader(tab: String = ""): String = {
val prettyTab = tab + " " * 44 // Length of 'static const ...'
s"${tab}static const char * verilog_plusargs [] = {\\\n" ++
artefacts
@ -55,9 +55,9 @@ object PlusArgArtefacts {
/* Generate C code to be included in emulator.cc that helps with
* argument parsing based on available Verilog PlusArgs */
def serialize(): String =
def serialize_cHeader(): String =
s"""|#define PLUSARG_USAGE_OPTIONS \"EMULATOR VERILOG PLUSARGS\\n\\
|${serializeHelp(" "*7)}
|${serializeArray()}
|${serializeHelp_cHeader(" "*7)}
|${serializeArray_cHeader()}
|""".stripMargin
}