diff options
| author | Andrew Waterman | 2016-08-07 17:11:24 -0700 |
|---|---|---|
| committer | Andrew Waterman | 2016-08-09 13:05:13 -0700 |
| commit | 2a074c828ddd8e6c20fa21d618664d50120f3d7a (patch) | |
| tree | 0b5486b62293d90d4b17ff18dc36044fff3740be /chiselFrontend | |
| parent | c907eabfb65cd6442e35588b095ca031e2bdad7a (diff) | |
Support Module name overrides with "override def desiredName"
The API allowed this before, but not safely, as users could create
name conflicts. This exposes the pre-deduplication/sanitization
naming API, and closes the other one.
Diffstat (limited to 'chiselFrontend')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/Module.scala | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Module.scala b/chiselFrontend/src/main/scala/chisel3/core/Module.scala index ca91c5f8..5af744c4 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Module.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Module.scala @@ -57,8 +57,11 @@ extends HasId { private[core] val _ids = ArrayBuffer[HasId]() dynamicContext.currentModule = Some(this) - /** Name of the instance. */ - val name = Builder.globalNamespace.name(getClass.getName.split('.').last) + /** Desired name of this module. */ + def desiredName = this.getClass.getName.split('.').last + + /** Legalized name of this module. */ + final val name = Builder.globalNamespace.name(desiredName) /** IO for this Module. At the Scala level (pre-FIRRTL transformations), * connections in and out of a Module may only go through `io` elements. |
