Skip to content

Commit

Permalink
Fix Select.attachedTo (#4458)
Browse files Browse the repository at this point in the history
Previously it would always fail to find anything.
  • Loading branch information
jackkoenig authored and debs-sifive committed Oct 15, 2024
1 parent 6fa43ae commit dbb06a1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/scala/chisel3/aop/Select.scala
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ object Select {
.block
.getCommands()
) {
case Attach(_, seq) if seq.contains(signal) => seq
case Attach(_, seq) if seq.contains(Node(signal)) => seq
}.flatMap { seq => seq.map(_.id.asInstanceOf[Data]) }.toSet
}

Expand Down
14 changes: 14 additions & 0 deletions src/test/scala/chiselTests/aop/SelectSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,20 @@ class SelectSpec extends ChiselFlatSpec {

}

"Test" should "pass if selecting attach" in {
import chisel3.experimental.{attach, Analog}
class AttachTest extends RawModule {
val a, b, c = IO(Analog(8.W))
attach(a, b, c)
}
val dut = ChiselGeneratorAnnotation(() => new AttachTest)
.elaborate(1)
.asInstanceOf[DesignAnnotation[AttachTest]]
.design
Select.attachedTo(dut)(dut.a) should be(Set(dut.a, dut.b, dut.c))

}

"Test" should "pass if selecting ops by kind" in {
val dut = ChiselGeneratorAnnotation(() => {
new SelectTester(Seq(0, 1, 2))
Expand Down

0 comments on commit dbb06a1

Please sign in to comment.