chipsalliance / chipsalliance/chisel

Selecting instances when using D/I and Class Property types crashes

Open
#4,476 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
4.8k
Forks
658
Avg merge
18h 59m
Merged PRs (30d)
14

Description

**Type of issue**: Bug Report

**Please provide the steps to reproduce the problem:**

```scala
import chisel3.experimental.hierarchy._

implicit val mg = new chisel3.internal.MacroGenerated {}

class MyClass extends Class {
val id = IO(Output(Property[Int]()))
id := Property(3)
}

class Child extends Module {
val cls = Definition(new MyClass)
// This models SRAMDescription
val io = IO(new Bundle {
val metadata = cls.getPropertyType
})
}

class Top extends Module {
val c = Instantiate(new Child)

val allInstances = Select.unsafe.allCurrentInstancesIn(this).map(_._lookup { m => m.name })
println(allInstances)
}

println(ChiselStage.emitCHIRRTL(new Top))
```

**What is the current behavior?**

This crashes in `_.lookup`

**What is the expected behavior?**

It should not crash. and the only instance in `allInstances` should be `c: Child`.

**Please tell us about your environment:**

**Other Information**

**What is the use case for changing the behavior?**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.