flatten
Makes one argument file for a tool from what FuseSoC wrote, with paths later steps can use from their own directories. Used by TestRIG and Lint. The FuseSoC plugin does this itself, as a callback, not as a command, so there are no logs.
| Depends on | filelist |
| Reads | The tool’s files in filelist/work/ |
| Output | flatten/filelist.f, flatten/verible.flags for Verible, and flatten/ascentlint.tcl and flatten/ascentlint.flags for AscentLint |
| Passes when | The files it reads were found and the outputs were written |
The cache key covers filelist/work/, as the output of the step it reads, the FuseSoC plugin’s hash, and what the plugin was asked: the tool the argument file is made for, and the design file’s top when the flow passes one. So a changed top, or a changed plugin, runs the step again.
Paths
Each path that exists relative to filelist/work/ is rewritten relative to flatten/, for example ../filelist/work/src/.... Step directories are siblings, so the same relative path works from the directory of the step that uses the list, such as build/ or lint/. Options, absolute paths, and paths that don’t exist are left as they are, as are paths outside the job’s directory, which the plugin can’t see. FuseSoC copies every source into filelist/work/, so a source is never one of those. The file has no absolute path, so it is the same in every checkout.
What it makes for each tool
| Used for | Reads | filelist.f is |
|---|---|---|
| TestRIG | The one .scr file | The simulator’s filelist |
| Lint with Verilator | The one .vc file, and config.mk | A Verilator argument file |
| Lint with Verible | The EDAM file | The files to lint, one per line |
| Lint with slang | The EDAM file | A slang command file |
| Lint with AscentLint | sources.f, and the EDAM file | AscentLint’s filelist |
- TestRIG: the
.scrwith its source paths,+incdir+directories and-Idirectories rewritten. It has the same number of lines as the.scr, in the same order. It is an error if there is not exactly one.scr. - Verilator: the
.vcfile holds the include directories, waiver files, sources,--top-moduleand the target’s defines and parameters.--Mdirand--exeare left out. The target’sverilator_optionsare then added as the last line. FuseSoC keeps them inconfig.mk, asVERILATOR_OPTIONS, for its Makefile, and they are copied as written. - Verible:
filelist.fis every Verilog and SystemVerilog source that is not an include file.verible.flagsis Verible’s flags, one per line:--lint_fatal,--parse_fatal,--rulesand--rulesetfrom the target, itsverible_lint_args,--rules_configfor the rules file (file typeveribleLintRules) and--waiver_filesfor the waiver files (veribleLintWaiver). Two rules files are an error. Defines and the top module are not used: Verible does not preprocess or elaborate. - slang:
-Dfor each define,-Gfor each parameter,-Ifor the directory of each include file, the sources, the target’sslang_options, and--top. The top is the design file’stopif it has one, otherwise the target’stoplevel.--error-limit 0is added unless the options set a limit, because slang otherwise stops reporting after 20 errors. - AscentLint:
filelist.fis thesources.fEdalize’s backend writes, rebased:+define+for each define,+incdir+for each include directory, and the sources.ascentlint.tclis the run script the backend writes asrun-ascentlint.tcl, made again from the EDAM: it sources each waiver file (file typewaiver) and then each Tcl file (tclSource), runsanalyze -f ../flatten/filelist.f,elaboratewith the target’s parameters and the top, andreport_policy -skip_empty_summary_status -compat -output ascentlint.rpt NEW. The top is the design file’stopif it has one, otherwise the target’stoplevel.ascentlint.flagsis-i, the script, and the target’sascentlint_options, one word per line. The backend’s Makefile gives the options to the shell, which splits them into words; here they are split on white space, without the shell’s quoting.
For Verible, slang and AscentLint these are the command lines Edalize’s backends make, with one difference each: Verible is given all the files at once where Edalize runs it once per file, slang gets --error-limit 0, and AscentLint’s script names files from the lint step’s directory, not from FuseSoC’s work root.
To check by hand
- Order. The files are in FuseSoC’s order, which is that of one flat compile: packages and macro definitions come before their users.
- Options and waivers. For lint,
flatten/filelist.f, andflatten/verible.flagsfor Verible, orflatten/ascentlint.tclandflatten/ascentlint.flagsfor AscentLint, should hold the options of the core’s target and name every waiver file you expect to apply.