chipsalliance / chisel

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

API for specifying customized transforms in ChiselStage (and dependencies?) #4280

Open poemonsense opened 4 months ago

poemonsense commented 4 months ago

Type of issue: Feature Request

Is your feature request related to a problem? Please describe.

We have some (lightweight) customized transforms before emitting the FIRRTL. They are still written in Scala. Currently we have to build our own stage with the transform in ChiselStage preserved and customized transform inserted.

Is there any clear API for the users to inject some transforms into the stage? The difficult thing may be specifiying the dependency.

Describe the solution you'd like

Allowing customized transforms only just after Convert? Then the dependency issue does not exist.

Describe alternatives you've considered

We are copying the code of ChiselStage (the transforms) and build our own Stage.

Additional context Include detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. Stack Overflow, gitter, Scastie.

What is the use case for implementing this feature?

Customized transforms to collect information before emitting FIRRTL.

sequencer commented 4 months ago

Maybe I need to upstream this: https://github.com/chipsalliance/t1/blob/real-rocket-v/elaborator/src/Elaborator.scala and its usage https://github.com/chipsalliance/t1/blob/real-rocket-v/elaborator/src/rocketv/ALU.scala for migrate out from Stage API. wdyt @jackkoenig?