chipsalliance / chipsalliance/chisel
D/I Question -- contextual information for Instances
- Dominant language
- Scala
- Stars
- 4.8k
- Forks
- 658
- Avg merge
- 18h 59m
- Merged PRs (30d)
- 14
Description
Definition/Instance API allows us to specify a Module once then stamp down copies of it. This works well from Chisel -> FIRRTL, but it's unclear what the mental model is as it goes through FIRRTL.
Currently FIRRTL (specifically SFC) can modify Modules/Instances in the following ways:
- [A] Reset Inference -- change the types of flops inside based on what the reset of an instance is connected to
- [B] Constant Propagation -- eliminate certain inputs, outputs, or internal logic based on what is connected to the instance
- [C] Width inference -- decide the width of internal signals, registers, I/Os based on what is connected to the instance
- [D] Arbitrary annotations -- change pretty much anything based on what annotations are applied to the Instance
For D/I API to be useful, we need to clearly define what is allowed/expected behavior for each of these cases.
My observations are:
# [A] Reset Inference
SFC seems to check that all of the Instances of the Definition will have the same inferred reset type:
https://scastie.scala-lang.org/O1QxHS4nQ8aITDFCB7suhA
The Definition's reset type is ignored.
https://scastie.scala-lang.org/ORaed9rCRRORAapWYiq3wg
and
https://scastie.scala-lang.org/kvx1kLUBS5aHtPHIrmVyQA
# [B] Constant Prop
I *think* that constant prop will happen if it can be constant-propped for all instances, and will not happen otherwise. TODO Scastie example
# [C] Width Inference
Seems to take the maximum width?
https://scastie.scala-lang.org/5Bzl0WCDQ2ewUJ65Z8Hv0Q
# [D] Arbitrary Instance Annotations
Not sure yet
**Type of issue**: feature request
**Impact**: unknown
**Development Phase**: request
**Other information**
**If the current behavior is a bug, please provide the steps to reproduce the problem:**
See Scasties Above
**What is the current behavior?**
See above
**What is the expected behavior?**
Not sure. My request is that we make sure we are clear on what the expected behavior is.
**Please tell us about your environment:**
- version: 3.5.1
**What is the use case for changing the behavior?**
More useful Definition/Instance API
Contributor guide
Assessment
This issue has not been assessed yet.