diff options
| author | Jack Koenig | 2020-11-10 18:40:51 -0800 |
|---|---|---|
| committer | GitHub | 2020-11-11 02:40:51 +0000 |
| commit | 1260f7c89f1b95bdb00e56e49edb73dc2eac3a0e (patch) | |
| tree | 8f349d91946fd43b7bf0d8ed9987404c0a49b7a1 /core/src/main/scala/chisel3/internal/Builder.scala | |
| parent | 8187318e7aef42d541ce307f93d9fc946ed4c38d (diff) | |
Refine autonaming to have more intuitive behavior (#1660)
* Refine autonaming to have more intuitive behavior
Last name in an Expression wins, while the first Statement to name wins.
This is done via checking the _id of HasIds during autonaming and only
applying a name if the HasId was created in the scope of autonaming.
There is no change to .autoSeed or .suggestName behavior.
Behavior of chisel3-plugins from before this change is maintained.
* Update docs with naming plugin changes
Diffstat (limited to 'core/src/main/scala/chisel3/internal/Builder.scala')
| -rw-r--r-- | core/src/main/scala/chisel3/internal/Builder.scala | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/src/main/scala/chisel3/internal/Builder.scala b/core/src/main/scala/chisel3/internal/Builder.scala index 56a85fb6..d665b7bc 100644 --- a/core/src/main/scala/chisel3/internal/Builder.scala +++ b/core/src/main/scala/chisel3/internal/Builder.scala @@ -59,6 +59,7 @@ private[chisel3] class IdGen { counter += 1 counter } + def value: Long = counter } /** Public API to access Node/Signal names. @@ -119,7 +120,9 @@ private[chisel3] trait HasId extends InstanceId { * @param seed Seed for the name of this component * @return this object */ - private [chisel3] def autoSeed(seed: String): this.type = { + private[chisel3] def autoSeed(seed: String): this.type = forceAutoSeed(seed) + // Bypass the overridden behavior of autoSeed in [[Data]], apply autoSeed even to ports + private[chisel3] def forceAutoSeed(seed: String): this.type = { auto_seed = Some(seed) for(hook <- auto_postseed_hooks) { hook(seed) } prefix_seed = Builder.getPrefix() |
