chipsalliance / chipsalliance/chisel
Aspect Subindex Builder Weirdness
- Dominant language
- Scala
- Stars
- 4.8k
- Forks
- 658
- Avg merge
- 18h 59m
- Merged PRs (30d)
- 14
Description
Calling `toTarget` on a subindex inside an aspect is causing an odd builder failure.
```scala
import chisel3._
import chisel3.aop.injecting.InjectingAspect
import chisel3.stage.{
ChiselGeneratorAnnotation,
ChiselStage
}
class Foo extends MultiIOModule {
val in = IO(Input(UInt(2.W)))
}
class FooAspect extends InjectingAspect(
{dut: Foo => Seq(dut)},
{dut: Foo =>
dut.in(0).toTarget
}
)
(new ChiselStage)
.execute(Array("--no-run-firrtl"), Seq(new FooAspect, ChiselGeneratorAnnotation(() => new Foo)))
```
This fails with:
```
chisel3.internal.ChiselException: signalName/pathName should be called after circuit elaboration
```
https://scastie.scala-lang.org/w0bbflYoTXepYy97Vex7xA
**Type of issue**: bug report
**Impact**: unknown
**Development Phase**: request
**Please tell us about your environment:**
- Chisel 3.4.0
**What is the use case for changing the behavior?**
I think this should be possible.
Contributor guide
Research direction
Reproduce the failure from the issue's Scala example, focusing on InjectingAspect, ChiselStage, and the dut.in(0).toTarget call. Trace the builder path that reaches signalName/pathName during aspect injection; done means the example completes without the elaboration exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100