fusesoc icon indicating copy to clipboard operation
fusesoc copied to clipboard

Added script to generate .f file listings from core files

Open TParry-SystematIC opened this issue 4 years ago • 3 comments

This script adds the ability to auto-generate .f style file listings from the a core file with the same syntax used for fusesoc.

Details on implementation specifics could be answered by the scripts original developer, @sjalloq.

TParry-SystematIC avatar Jul 15 '21 07:07 TParry-SystematIC

Does this run any generators that are part of the core file? Can you specify targets etc? I'm wondering if this functionality might make more sense to be a kind of null backend for edalize?

Jbalkind avatar Aug 02 '21 17:08 Jbalkind

@Jbalkind, I need to look at how I wrote this again but I think your idea of an edalize backend might be more suitable. I'll try and take a look next week.

sjalloq avatar Aug 04 '21 18:08 sjalloq

There has been some discussion about the question how to generate a .f file from FuseSoC runs in the past, and I think the outcome was the only working approach is using the EDAM file that FuseSoC generates (which is part of the FuseSoC API) and converting that into a .f file that suits the tool you're using. That should be easy to achieve in a simple Python script.

In the most trivial case, the script can look like this:

import yaml
import sys


def main():
    eda_yaml_file = sys.argv[1]
    with open(eda_yaml_file) as eda_yaml_f:
        eda_yaml = yaml.safe_load(eda_yaml_f)

    for f in eda_yaml["files"]:
        if f["file_type"] in ["systemVerilogSource", "verilogSource"]:
            print(f["name"])


if __name__ == "__main__":
    main()

Two reasons:

  • .f files are not really standardized on "edge cases"; some tools (e.g. VCS) allow SystemVerilog parameters and defines in it, while others expect a plain list of source files.
  • The tool is a global flag in FuseSoC and its taken into account when doing dependency resolution (c.f. https://fusesoc.readthedocs.io/en/latest/user/build_system/flags.html) and other things. Currently, a tool is equal to a backend. So if you'd create a new ".f file backend", you effectively create a new tool. It's unlikely that you want that.

imphil avatar Aug 05 '21 08:08 imphil

This wasn't intended to be closed. It happened when I renamed the default branch. Please reopen if it's still relevant

olofk avatar Oct 31 '22 22:10 olofk