Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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 onfilelist
ReadsThe tool’s files in filelist/work/
Outputflatten/filelist.f, flatten/verible.flags for Verible, and flatten/ascentlint.tcl and flatten/ascentlint.flags for AscentLint
Passes whenThe 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 forReadsfilelist.f is
TestRIGThe one .scr fileThe simulator’s filelist
Lint with VerilatorThe one .vc file, and config.mkA Verilator argument file
Lint with VeribleThe EDAM fileThe files to lint, one per line
Lint with slangThe EDAM fileA slang command file
Lint with AscentLintsources.f, and the EDAM fileAscentLint’s filelist
  • TestRIG: the .scr with its source paths, +incdir+ directories and -I directories 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 .vc file holds the include directories, waiver files, sources, --top-module and the target’s defines and parameters. --Mdir and --exe are left out. The target’s verilator_options are then added as the last line. FuseSoC keeps them in config.mk, as VERILATOR_OPTIONS, for its Makefile, and they are copied as written.
  • Verible: filelist.f is every Verilog and SystemVerilog source that is not an include file. verible.flags is Verible’s flags, one per line: --lint_fatal, --parse_fatal, --rules and --ruleset from the target, its verible_lint_args, --rules_config for the rules file (file type veribleLintRules) and --waiver_files for 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: -D for each define, -G for each parameter, -I for the directory of each include file, the sources, the target’s slang_options, and --top. The top is the design file’s top if it has one, otherwise the target’s toplevel. --error-limit 0 is added unless the options set a limit, because slang otherwise stops reporting after 20 errors.
  • AscentLint: filelist.f is the sources.f Edalize’s backend writes, rebased: +define+ for each define, +incdir+ for each include directory, and the sources. ascentlint.tcl is the run script the backend writes as run-ascentlint.tcl, made again from the EDAM: it sources each waiver file (file type waiver) and then each Tcl file (tclSource), runs analyze -f ../flatten/filelist.f, elaborate with the target’s parameters and the top, and report_policy -skip_empty_summary_status -compat -output ascentlint.rpt NEW. The top is the design file’s top if it has one, otherwise the target’s toplevel. ascentlint.flags is -i, the script, and the target’s ascentlint_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, and flatten/verible.flags for Verible, or flatten/ascentlint.tcl and flatten/ascentlint.flags for AscentLint, should hold the options of the core’s target and name every waiver file you expect to apply.