diff options
| author | mergify[bot] | 2022-06-02 18:06:03 +0000 |
|---|---|---|
| committer | GitHub | 2022-06-02 18:06:03 +0000 |
| commit | 5bec54e535dca53c9347caddb0b395c4651a0919 (patch) | |
| tree | ea9b4e534b19be7385a14d00ab434f23b54f648f /plugin/src/main/scala/chisel3 | |
| parent | 97fde23f666a560d4eba9333e4230f901d7f5361 (diff) | |
Support VerificationStatement in the naming plugin (#2555) (#2557)
Previously, verification statements (assert, assume, cover, and printf)
were only named via reflection.
(cherry picked from commit 7fa2691f670813eef4ec59fc27c4e4f625d598de)
Co-authored-by: Jack Koenig <koenig@sifive.com>
Diffstat (limited to 'plugin/src/main/scala/chisel3')
| -rw-r--r-- | plugin/src/main/scala/chisel3/internal/plugin/ChiselComponent.scala | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/plugin/src/main/scala/chisel3/internal/plugin/ChiselComponent.scala b/plugin/src/main/scala/chisel3/internal/plugin/ChiselComponent.scala index eced652b..f98049e2 100644 --- a/plugin/src/main/scala/chisel3/internal/plugin/ChiselComponent.scala +++ b/plugin/src/main/scala/chisel3/internal/plugin/ChiselComponent.scala @@ -78,10 +78,13 @@ class ChiselComponent(val global: Global, arguments: ChiselPluginArguments) } } - private val shouldMatchData: Type => Boolean = shouldMatchGen(tq"chisel3.Data") - private val shouldMatchDataOrMem: Type => Boolean = shouldMatchGen(tq"chisel3.Data", tq"chisel3.MemBase[_]") - private val shouldMatchModule: Type => Boolean = shouldMatchGen(tq"chisel3.experimental.BaseModule") - private val shouldMatchInstance: Type => Boolean = shouldMatchGen(tq"chisel3.experimental.hierarchy.Instance[_]") + private val shouldMatchData: Type => Boolean = shouldMatchGen(tq"chisel3.Data") + // Checking for all chisel3.internal.NamedComponents, but since it is internal, we instead have + // to match the public subtypes + private val shouldMatchNamedComp: Type => Boolean = + shouldMatchGen(tq"chisel3.Data", tq"chisel3.MemBase[_]", tq"chisel3.VerificationStatement") + private val shouldMatchModule: Type => Boolean = shouldMatchGen(tq"chisel3.experimental.BaseModule") + private val shouldMatchInstance: Type => Boolean = shouldMatchGen(tq"chisel3.experimental.hierarchy.Instance[_]") // Given a type tree, infer the type and return it private def inferType(t: Tree): Type = localTyper.typed(t, nsc.Mode.TYPEmode).tpe @@ -176,7 +179,7 @@ class ChiselComponent(val global: Global, arguments: ChiselPluginArguments) treeCopy.ValDef(dd, mods, name, tpt, localTyper.typed(named)) } // If a Data or a Memory, get the name and a prefix - else if (shouldMatchDataOrMem(tpe)) { + else if (shouldMatchNamedComp(tpe)) { val str = stringFromTermName(name) val newRHS = transform(rhs) val prefixed = q"chisel3.experimental.prefix.apply[$tpt](name=$str)(f=$newRHS)" |
