summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjackkoenig2016-12-13 22:01:18 -0800
committerJack Koenig2017-01-27 15:47:00 -0800
commite75b8d1fbf4c61041e1670fb1499b178dfa5ef10 (patch)
tree6f4495dd5b8d2d787746cc4175b69449e798fb5c
parent82ec96f58df0892ff004af14988581fd990c8083 (diff)
Clean names of private vals in Modules
-rw-r--r--chiselFrontend/src/main/scala/chisel3/core/Module.scala7
1 files changed, 6 insertions, 1 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Module.scala b/chiselFrontend/src/main/scala/chisel3/core/Module.scala
index 609f2ccf..ca7c8abd 100644
--- a/chiselFrontend/src/main/scala/chisel3/core/Module.scala
+++ b/chiselFrontend/src/main/scala/chisel3/core/Module.scala
@@ -199,8 +199,13 @@ extends HasId {
}
case _ => // Do nothing
}
+ /** Scala generates names like chisel3$util$Queue$$ram for private vals
+ * This extracts the part after $$ for names like this and leaves names
+ * without $$ unchanged
+ */
+ def cleanName(name: String): String = name.split("""\$\$""").lastOption.getOrElse(name)
for (m <- getPublicFields(classOf[Module])) {
- nameRecursively(m.getName, m.invoke(this))
+ nameRecursively(cleanName(m.getName), m.invoke(this))
}
// For Module instances we haven't named, suggest the name of the Module