Pass discovered modules to fusesoc generators
Fusesoc builds a dynamic list of source files, parameters, and other settings by (1) scanning a search path (called CORES_ROOT) for individual *.core files, and (2) resolving a dependency tree from a given top-level module, while taking external constraints (such as the synthesis tool) into consideration. This behavior enables us today to have the right set of source files for a given synthesis or simulation target. Since the search path is dynamic it can be locally extended (on the user's machine) to search code in directories which might or might not be available, such as a private repository or network share containing technology primitives.
Fusesoc also has a feature called "generators", by which it calls an external script to create additional source files on the fly. (https://fusesoc.readthedocs.io/en/master/generators.html)
What's missing is a way to pass (a) all core files fusesoc found, and (b) the resolved dependency tree to a generator. (See the discussion in https://github.com/olofk/fusesoc/issues/250).
We have two use cases for such a feature:
- The automatic toplevel generation (#230) needs to know the resolved dependency tree, and a list of configuration
*.jsonfiles which are included in the build. - The implementation-dependent primitives code in lowRISC/stwg-base#237 needs to know all core files which match a given name.
Note: we can work-around this missing feature in fusesoc by essentially replicating the search and dependency resolution logic that fusesoc uses. However I'd love to avoid that, and adding this missing feature to fusesoc shouldn't be too hard.
Hey Phil, what is the plan around this issue? I recall you mentioning that the goal was to influence fusesoc directly. Is that still the plan? If so, or if not, can you keep this issue fresh with the methods that solve this need?
We're evaluating whether it makes sense to contract Olof (the FuseSoC author) to work on this and other wishlist issues. I'm working through the related issues and docs today in order to move this forwards.
Scrubbing stale issues... @imphil , has this wishlist item been addressed by FuseSoC? Thanks.
No, still open and workaround is still in place.
One step closer here. The cores in the dependency tree now have a property that list their resolved direct dependencies. The complete resolved dependency tree is also available in the EDAM structure. It should be possible to leverage this to also send that info to the generators. Is the VLNVs enough or do you also need core location?
I'm looking into this now. Thanks for the first step @olofk!
Fixed in https://github.com/lowRISC/fusesoc/commits/generators, used in #1679. Will need upstreaming to fusesoc once we're happy with it in OT for a bit.
Upstream bug is at https://github.com/olofk/fusesoc/pull/391 and waiting for a review from @olofk. We have been running with this patch in our ot branch for over half a year now and it works well.