diff options
Diffstat (limited to 'core/src')
| -rw-r--r-- | core/src/main/scala/chisel3/Module.scala | 4 | ||||
| -rw-r--r-- | core/src/main/scala/chisel3/internal/Builder.scala | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/core/src/main/scala/chisel3/Module.scala b/core/src/main/scala/chisel3/Module.scala index 82a1708e..236f528e 100644 --- a/core/src/main/scala/chisel3/Module.scala +++ b/core/src/main/scala/chisel3/Module.scala @@ -251,7 +251,9 @@ package experimental { /** Legalized name of this module. */ final lazy val name = try { - Builder.globalNamespace.name(desiredName) + // If this is a module aspect, it should share the same name as the original module + // Thus, the desired name should be returned without uniquification + if(this.isInstanceOf[ModuleAspect]) desiredName else Builder.globalNamespace.name(desiredName) } catch { case e: NullPointerException => throwException( s"Error: desiredName of ${this.getClass.getName} is null. Did you evaluate 'name' before all values needed by desiredName were available?", e) diff --git a/core/src/main/scala/chisel3/internal/Builder.scala b/core/src/main/scala/chisel3/internal/Builder.scala index 3988ac68..30fa2db2 100644 --- a/core/src/main/scala/chisel3/internal/Builder.scala +++ b/core/src/main/scala/chisel3/internal/Builder.scala @@ -627,7 +627,11 @@ private[chisel3] object Builder { def build[T <: RawModule](f: => T): (Circuit, T) = { - dynamicContextVar.withValue(Some(new DynamicContext())) { + build(f, new DynamicContext()) + } + + private [chisel3] def build[T <: RawModule](f: => T, dynamicContext: DynamicContext): (Circuit, T) = { + dynamicContextVar.withValue(Some(dynamicContext)) { checkScalaVersion() errors.info("Elaborating design...") val mod = f |
