llvm / circt

Circuit IR Compilers and Tools
https://circt.org
Other
1.64k stars 285 forks source link

[FIRRTL] Allow layers under when and match. #7234

Closed dtzSiFive closed 3 months ago

dtzSiFive commented 3 months ago

Behavior is same as-if the contained operations were not under a layer.

Some layer-related passes such as LayerMerge (for completeness) and LowerLayers (for correctness) now explicitly require ExpandWhen's to execute first.

The FIRRTL specification does not yet permit this.

dtzSiFive commented 3 months ago

Can you include tests of a layer block under a when under a layer block?

This is already included in the modified firtool/layers.fir test -- is there something more specific you'd like to test? Very happy to add tests for whichever just LMK 👍 .

Also, can you include a test of an assert under a when under a layer block?

Those appeared to work in local testing -- I'll add tests for these as well. The expand-when's test for printf shows that working for ( when-influenced-statement )-under-layer-under-when. I'll add an e2e test for assert too since that's of particular importance. Thanks!