chipsalliance / chipsalliance/chisel
[Panama] Request to bind InstanceGraph API from CIRCT.
- Dominant language
- Scala
- Stars
- 4.8k
- Forks
- 658
- Avg merge
- 18h 59m
- Merged PRs (30d)
- 14
Description
**Type of issue**: Feature Request
After reviewing the current OM C-API. I suggest introducing the `InstanceGraph` Binding from CIRCT. It should expose the `InstanceGraph` result to Scala.
Basically the current OM C-API is designed for Diplomatic-based design flow, which only need to query OM at top module, but waive all OM at inner layer. This does work under the magic of diplomacy AutoBundle and instantiate API, but... for most of chisel end users, it's less friendly...
IMO, for most of use cases, users just wanna add some annotations on the IR(e.g. retiming, clock domain, power domain). We can always use something like boring utils to bore them to Top for working around, but we can make it simpler...
An example Scala API can be represent below, for more efficiency operations, it should be done in CIRCT, Scala should only store the results as these APIs.
```
package panamalib {
package instancegraph {
case class Module(name: String, children: Seq[InstanceNode], instances: Seq[Instance])
case class Instance(module: Module, father: Option[Module])
case class BFS(instance: Seq[Instance])
case class DFS(instance: Seq[Instance])
}
}
```
After exposing this API, we can traverse the Modules in any MLIR circuit, and query OM inside any modules.
Contributor guide
Assessment
This issue has not been assessed yet.