circt/lib/CAPI/Firtool
Schuyler Eldridge 5cffc8537b
[firrtl] Move LowerLayers after LowerXMR (#8405)
Move the `LowerLayers` pass after the `LowerXMR` pass.  To do this, all
passes at the end of the CHIRRTL to Low FIRRTL pipeline are moved after
`LowerXMR`.  This is necessary because the `LowerLayers` pass cannot, at
present, be moved after the passes at the end of the pipeline.

This is done to enable forcing out of layers.  By lowering probes to XMRs,
the layers can be lowered trivially to modules/instances and their XMRs
will now (seemingly) magically just work.  By doing the loweirng in this
way, it avoids ever having to represent an input probe in the FIRRTL
dialect.

A consequence of this is that there are now simplifying
assumptions (preconditions) that can be made about the `LowerLayers` pass:

1. It will never see a number of probe ops because the `LowerXMR` pass has
   a postcondition that all of these are removed.

2. Input and output ports can never be created on modules created from
   layer blocks.

While I am generally always in favor of passes being relocatable anywhere
in the pipeline, this is one pass that really does _not_ make sense to be
relocatable.  In effect, this pass is part of the lowering from FIRRTL to
HW.  There is no point in being able to use it earlier in the pipeline.
That said, it still is tested to work with things which we may one-day
preserve, like `WhenOp`s.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2025-04-24 11:02:55 -04:00
..
CMakeLists.txt [CAPI] Add circt-capi target and build it in CI (#7017) 2024-05-09 11:21:33 -07:00
Firtool.cpp [firrtl] Move LowerLayers after LowerXMR (#8405) 2025-04-24 11:02:55 -04:00