Skip to content

Commit

Permalink
Clean names of private vals in Modules
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkoenig committed Jan 27, 2017
1 parent e77e345 commit eb38a5d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion chiselFrontend/src/main/scala/chisel3/core/Module.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit eb38a5d

Please sign in to comment.