chipsalliance / chisel

Chisel: A Modern Hardware Design Language
https://www.chisel-lang.org/
Apache License 2.0
3.98k stars 597 forks source link

D/I Question -- contextual information for Instances #2423

Open mwachs5 opened 2 years ago

mwachs5 commented 2 years ago

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:

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: