FIRRTL Dialect back to FIRRTL

I have a question about getting FIRRTL out of CIRCT. For example if following along with @mikeurbach’s workflow for getting python all the way into CIRCT would it be possible to generate a .fir file that I could then use in a tool chain that doesn’t include CIRCT?

An example might be that I write something in numpy, lower to CIRCT, and then I have a simulator I want to use that depends on GitHub - ucsc-vama/essent: high-performance RTL simulator, it would be pretty nice to be able to use LLVM/MLIR/CIRCT to generate my inputs to this program.

I haven’t tried any of the above steps yet, but it seemed reasonable to ask if CIRCT to .fir is possible or if not currently supported how hard would it be?

I don’t think this functionality exists, but if it did, I would use diagrammer to visualize the outputs of passes that lower to FIRRTL.

The functionality to serialize from the FIRRTL dialect to a .fir file doesn’t exist, yet. However, this is something that we’d like to have and would be a great feature request. I’ve thought that this would be extremely useful if users wanted to interoperate with the existing Scala Chisel/FIRRTL ecosystem where a lot of the backend tooling expects lowered FIRRTL IR or users might want to not migrate their existing Scala FIRRTL Compiler transforms (or the essent work!).

Note: the center of mass has moved towards lowering things from the FIRRTL dialect to a mixture of RTL dialect and SystemVerilog dialect. For a workflow like what you’re suggesting to really be useful, we’d probably also need to go back to FIRRTL dialect from RTL.

Agreed, it would be great to implement a FIRPrinter that renders the FIRRTL dialect as a .fir file.

Is there a way to formally make this feature request? I would be willing to help out, but will probably have to ask a lot of questions.

Just open an issue here. :slight_smile: