summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDonggyu2016-11-21 14:52:05 -0800
committerJack Koenig2016-11-21 14:52:05 -0800
commit11302f77c90512f81b882ad1cc623c53d45724f8 (patch)
treeafc1236dd4fb97e857d86cec79c6e640632106e5 /src
parent3b4755716a74d4711efa3ce6799742479e17e80b (diff)
Remove deduplication from Chisel (#347)
Remove modName from Module
Diffstat (limited to 'src')
-rw-r--r--src/main/scala/chisel3/internal/firrtl/Emitter.scala20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/main/scala/chisel3/internal/firrtl/Emitter.scala b/src/main/scala/chisel3/internal/firrtl/Emitter.scala
index b8651828..42bc6c30 100644
--- a/src/main/scala/chisel3/internal/firrtl/Emitter.scala
+++ b/src/main/scala/chisel3/internal/firrtl/Emitter.scala
@@ -32,7 +32,7 @@ private class Emitter(circuit: Circuit) {
"\"" + printf.format(fmt) + "\"") ++ args
printfArgs mkString ("printf(", ", ", ")")
case e: DefInvalid => s"${e.arg.fullName(ctx)} is invalid"
- case e: DefInstance => s"inst ${e.name} of ${e.id.modName}"
+ case e: DefInstance => s"inst ${e.name} of ${e.id.name}"
case w: WhenBegin =>
indent()
s"when ${w.pred.fullName(ctx)} :"
@@ -53,9 +53,6 @@ private class Emitter(circuit: Circuit) {
s"parameter $name = $str"
}
- // Map of Module FIRRTL definition to FIRRTL name, if it has been emitted already.
- private val defnMap = collection.mutable.HashMap[(String, String), Component]()
-
/** Generates the FIRRTL module declaration.
*/
private def moduleDecl(m: Component): String = m.id match {
@@ -92,17 +89,10 @@ private class Emitter(circuit: Circuit) {
*/
private def emit(m: Component): String = {
// Generate the body.
- val defn = moduleDefn(m)
-
- defnMap get (m.id.desiredName, defn) match {
- case Some(duplicate) =>
- m.id setModName duplicate.name
- ""
- case None =>
- defnMap((m.id.desiredName, defn)) = m
- m.id setModName m.name
- moduleDecl(m) + defn
- }
+ val sb = new StringBuilder
+ sb.append(moduleDecl(m))
+ sb.append(moduleDefn(m))
+ sb.result
}
private var indentLevel = 0