aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorDavid Biancolin2021-09-29 16:58:10 -0700
committerGitHub2021-09-29 23:58:10 +0000
commit519e8c8dea592d2faf949a1a1aa49ea303bd1c72 (patch)
treed8bbbad77200db241e9345c0d3c2a6bc27735528 /src/main
parentb81de69928b765949be0c79dea1d0cc714a31aa1 (diff)
TopWiring: filter out unnamed declarations when building source lists (#2376)
* Demonstrate a couple failing cases * Have TopWiring ignore unnamed declarations as potential sources
Diffstat (limited to 'src/main')
-rw-r--r--src/main/scala/firrtl/transforms/TopWiring.scala7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/scala/firrtl/transforms/TopWiring.scala b/src/main/scala/firrtl/transforms/TopWiring.scala
index c231d347..9fc40c59 100644
--- a/src/main/scala/firrtl/transforms/TopWiring.scala
+++ b/src/main/scala/firrtl/transforms/TopWiring.scala
@@ -68,8 +68,11 @@ class TopWiringTransform extends Transform with DependencyAPIMigration {
state: CircuitState
)(s: Statement
): Statement = s match {
- // If target wire, add name and size to to sourceMap
- case w: IsDeclaration =>
+ // Declarations with non-empty names can be sources. However, some
+ // side-affecting statements may given the empty string as name. Filter
+ // these out before they are rejected by ComponentName's constructor, since
+ // they cannot be named as a source in a TopWiring annotation anyways.
+ case w: IsDeclaration if w.name != "" =>
if (sourceList.keys.toSeq.contains(ComponentName(w.name, currentmodule))) {
val (isport, tpe, prefix) = w match {
case d: DefWire => (false, d.tpe, sourceList(ComponentName(w.name, currentmodule)))