summaryrefslogtreecommitdiff
path: root/core/src/main/scala/chisel3/internal
diff options
context:
space:
mode:
authorJack Koenig2021-10-05 13:20:28 -0700
committerGitHub2021-10-05 20:20:28 +0000
commitc2985aa6ef95a45d6ce9663a17f835eaba0cb9c5 (patch)
tree034269cbfe96292648e43ac597ea2ff972f82604 /core/src/main/scala/chisel3/internal
parent110705eeace4f9165dc6377e55c86a599f37a465 (diff)
Fix naming of unwrapped val io in Chisel.Modules (#2150)
The removal of virtual method io accidentally made the naming of io in compatibility mode Bundles sensitive to the prefix at the time of the first access of the field. It also made .suggestName able to override the name. This commit fixes that issue by forcing the name of the io Data to be "io" no matter what.
Diffstat (limited to 'core/src/main/scala/chisel3/internal')
-rw-r--r--core/src/main/scala/chisel3/internal/Builder.scala11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/src/main/scala/chisel3/internal/Builder.scala b/core/src/main/scala/chisel3/internal/Builder.scala
index 4e68623d..0a0a3f2d 100644
--- a/core/src/main/scala/chisel3/internal/Builder.scala
+++ b/core/src/main/scala/chisel3/internal/Builder.scala
@@ -154,6 +154,17 @@ private[chisel3] trait HasId extends InstanceId {
this
}
+ // Internal version of .suggestName that can override a user-suggested name
+ // This only exists for maintaining "val io" naming in compatibility-mode Modules without IO
+ // wrapping
+ private[chisel3] def forceFinalName(seed: String): this.type = {
+ // This could be called with user prefixes, ignore them
+ noPrefix {
+ suggested_seed = Some(seed)
+ this.suggestName(seed)
+ }
+ }
+
/** Computes the name of this HasId, if one exists
* @param defaultPrefix Optionally provide a default prefix for computing the name
* @param defaultSeed Optionally provide default seed for computing the name