summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authormergify[bot]2022-08-23 21:31:57 +0000
committerGitHub2022-08-23 21:31:57 +0000
commit1c5bd39a192272877cf4b8dc3d26a9284eb0c05d (patch)
tree30017b71c5f7a6a74df354945297d235a07998df /src/test
parent16dfc84d6667f1f6bbca46935cb445bc288c96d4 (diff)
Add AffectsChiselPrefix tests to PrefixSpec (#2693) (#2695)
(cherry picked from commit 1a23b42429bf9de7dfab9f0a8e67334f8c5d4540) Co-authored-by: Jared Barocsi <82000041+jared-barocsi@users.noreply.github.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/chiselTests/naming/PrefixSpec.scala24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/naming/PrefixSpec.scala b/src/test/scala/chiselTests/naming/PrefixSpec.scala
index 6d52407e..b5eac1d4 100644
--- a/src/test/scala/chiselTests/naming/PrefixSpec.scala
+++ b/src/test/scala/chiselTests/naming/PrefixSpec.scala
@@ -7,6 +7,7 @@ import chisel3.stage.ChiselStage
import chisel3.aop.Select
import chisel3.experimental.{dump, noPrefix, prefix, treedump}
import chiselTests.{ChiselPropSpec, Utils}
+import chisel3.experimental.AffectsChiselPrefix
class PrefixSpec extends ChiselPropSpec with Utils {
implicit val minimumMajorVersion: Int = 12
@@ -497,4 +498,27 @@ class PrefixSpec extends ChiselPropSpec with Utils {
Select.wires(top).map(_.instanceName) should be(List("a_b_c_d"))
}
}
+
+ property("Prefixing of AffectsChiselPrefix objects should work") {
+ class NotAData extends AffectsChiselPrefix {
+ val value = Wire(UInt(3.W))
+ }
+ class NotADataUnprefixed {
+ val value = Wire(UInt(3.W))
+ }
+ class Test extends Module {
+ {
+ val nonData = new NotAData
+ // Instance name of nonData.value should be nonData_value
+ nonData.value := RegNext(3.U)
+
+ val nonData2 = new NotADataUnprefixed
+ // Instance name of nonData2.value should be value
+ nonData2.value := RegNext(3.U)
+ }
+ }
+ aspectTest(() => new Test) { top: Test =>
+ Select.wires(top).map(_.instanceName) should be(List("nonData_value", "value"))
+ }
+ }
}