circt
circt copied to clipboard
[FIRRTL] Output directory control for layers and modules
Add output directory control for layers and firrtl.
For specifying the output directories:
- Add a new annotation called "circt.OutputDirAnnotation", for specifying the output directory of modules
- For layers, add syntax for optionally specifying the output directory
In the Lower-Layers Pass:
- Place layer collateral (the bindfile, any layerblocks->modules) under the output directory of the layer, if there is any.
- Stop outputting layer collateral under the testbench/views
Add a new pass, AssignOutputDirs, which will sink modules into the output directories they are instantiated from. This pass runs after lower-layers. In conjunction with the changes to the lower-layers pass, this means that modules which are only used under a particular layer will be sunk into that layer's output directory.
What is an expected behavior when modules with different output dir annotations are deduplicated?
What is an expected behavior when modules with different output dir annotations are deduplicated?
Hey, thanks for taking a look! Two modules will dedup iff they have the same output directory annotation (modulo dirname canonicalization when constructing the the hw::OutputFileAttr). I've added a test for this here.
☝️ After discussing with @darthscsi more about this. This comment is saying that we can remove the OutputDirPrecedenceAnnotation and any logic associated with it and instead compute the LCA based on the LCA of the directories themselves. E.g., SimpleLCA("verilog/design/", "verilog/testbench/") == "verilog/". This cannot express certain things like we do internally where AnnoyingLCA("verilog/design/", "verilog/testbench/") == "verilog/design/"). However, we can change this internally so that we can use the SimpleLCA computation.
Edit: We may be able to get the same behavior as we have today for SimpleLCA by always choosing the provided output directory ("verilog/design/") if the LCA is above the provided output directory.
Thanks everyone!