summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/aop
diff options
context:
space:
mode:
authorJack Koenig2021-06-29 15:34:18 -0700
committerJack Koenig2021-06-29 15:34:18 -0700
commit0531cb53d3cedaff33c2a280e34418f6af5bc6a1 (patch)
tree90ef041e872393b2cc8e23aad408d3fc0bc202a0 /src/test/scala/chiselTests/aop
parent8724cd542df2e907069d9ee3fd7d1675a9ca9287 (diff)
Restore aop.Select behavior for CloneModuleAsRecord
Diffstat (limited to 'src/test/scala/chiselTests/aop')
-rw-r--r--src/test/scala/chiselTests/aop/SelectSpec.scala25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/aop/SelectSpec.scala b/src/test/scala/chiselTests/aop/SelectSpec.scala
index 91353f5a..d34f4391 100644
--- a/src/test/scala/chiselTests/aop/SelectSpec.scala
+++ b/src/test/scala/chiselTests/aop/SelectSpec.scala
@@ -153,5 +153,30 @@ class SelectSpec extends ChiselFlatSpec {
assert(bbs.size == 1)
}
+ "CloneModuleAsRecord" should "show up in Select aspects as duplicates" in {
+ import chisel3.experimental.CloneModuleAsRecord
+ class Child extends RawModule {
+ val in = IO(Input(UInt(8.W)))
+ val out = IO(Output(UInt(8.W)))
+ out := in
+ }
+ class Top extends MultiIOModule {
+ val in = IO(Input(UInt(8.W)))
+ val out = IO(Output(UInt(8.W)))
+ val inst0 = Module(new Child)
+ val inst1 = CloneModuleAsRecord(inst0)
+ inst0.in := in
+ inst1("in") := inst0.out
+ out := inst1("out")
+ }
+ val top = ChiselGeneratorAnnotation(() => {
+ new Top()
+ }).elaborate
+ .collectFirst { case DesignAnnotation(design: Top) => design }
+ .get
+ val mods = Select.collectDeep(top) { case mod => mod }
+ mods should equal (Seq(top, top.inst0, top.inst0))
+ }
+
}