summaryrefslogtreecommitdiff
path: root/chiselFrontend/src/main/scala/chisel3/core/Module.scala
diff options
context:
space:
mode:
authorChick Markley2016-08-26 08:19:51 -0700
committerGitHub2016-08-26 08:19:51 -0700
commit0c34480c5049c000e03b7b1a174e4bd6cca682cb (patch)
treea3ea3175792b9a1424179b02359966c6d8531b1d /chiselFrontend/src/main/scala/chisel3/core/Module.scala
parentddb7278760029be9d960ba8bf2b06ac8a8aac767 (diff)
parent5ca2820216a4c4b8c28438967d6e4680412f6580 (diff)
Merge pull request #259 from ucb-bar/addpublicnode
Public APIs for chisel object names
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/core/Module.scala')
-rw-r--r--chiselFrontend/src/main/scala/chisel3/core/Module.scala23
1 files changed, 22 insertions, 1 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Module.scala b/chiselFrontend/src/main/scala/chisel3/core/Module.scala
index 5af744c4..2426ae78 100644
--- a/chiselFrontend/src/main/scala/chisel3/core/Module.scala
+++ b/chiselFrontend/src/main/scala/chisel3/core/Module.scala
@@ -31,7 +31,9 @@ object Module {
m._commands.prepend(DefInvalid(childSourceInfo, m.io.ref)) // init module outputs
dynamicContext.currentModule = parent
val ports = m.computePorts
- Builder.components += Component(m, m.name, ports, m._commands)
+ val component = Component(m, m.name, ports, m._commands)
+ m._component = Some(component)
+ Builder.components += component
pushCommand(DefInstance(sourceInfo, m, ports))
m.setupInParent(childSourceInfo)
}
@@ -63,6 +65,25 @@ extends HasId {
/** Legalized name of this module. */
final val name = Builder.globalNamespace.name(desiredName)
+ /** FIRRTL Module name */
+ private var _modName: Option[String] = None
+ private[chisel3] def setModName(name: String) = _modName = Some(name)
+ def modName = _modName match {
+ case Some(name) => name
+ case None => throwException("modName should be called after circuit elaboration")
+ }
+
+ /** Keep component for signal names */
+ private[chisel3] var _component: Option[Component] = None
+
+
+ /** Signal name (for simulation). */
+ override def instanceName =
+ if (_parent == None) name else _component match {
+ case None => getRef.name
+ case Some(c) => getRef fullName c
+ }
+
/** IO for this Module. At the Scala level (pre-FIRRTL transformations),
* connections in and out of a Module may only go through `io` elements.
*/