From e75b8d1fbf4c61041e1670fb1499b178dfa5ef10 Mon Sep 17 00:00:00 2001 From: jackkoenig Date: Tue, 13 Dec 2016 22:01:18 -0800 Subject: Clean names of private vals in Modules --- chiselFrontend/src/main/scala/chisel3/core/Module.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3