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

Introduction

Doris the cat, the project mascot

doris runs hardware verification flows, from linting RTL to checking a RISC-V core against its reference model, instruction by instruction. Describe a design once, in a few small config files, and doris plans the work, runs only what has changed, and records every job as a versioned JSON result with an HTML report.

doris run lint                  # lint every design that has a lint config
doris run testrig my_core       # check a RISC-V core against its reference model
doris report view               # open the reports in a browser

Flows

  • TestRIG checks a RISC-V core against the Sail reference model, instruction by instruction, with Xcelium or Verilator.
  • Lint runs Verilator, Verible, slang and AscentLint over a design’s RTL.
  • CDC and RDC check a design’s clock and reset domain crossings with Meridian CDC and Meridian RDC.

Synthesis and formal flows are planned. The Roadmap lists them, with everything else that is designed but not built.

Key features

  • Everything is cached. A step’s cache key is a hash of its command, its inputs, the versions of its tools and the plugins they come from. A second run with nothing changed runs no tool at all, and an edit reruns only the steps it reaches. The cache is shared by every checkout, so a new worktree starts warm.
  • Tools are plugins. Each tool is a sandboxed WebAssembly plugin that knows how to invoke it and how to read what it writes. doris ships one for every tool it supports, and a site adds its own through plugins.path, including for a commercial tool whose details can’t be published.
  • Mistakes surface at load time. Every config file is checked against a schema, and each tool’s options by its plugin, so a misspelt key is an error naming the file and line before any step runs.
  • You can see a run before it happens. doris plan shows every job and step, the exact command each runs, and which come from the cache. doris check runs each step’s prechecks against the machine, without running a step.
  • The machine is shared fairly. Steps hold threads, memory, disk and licences from resource pools, so the steps running at once never hold more than there is. doris resources suggests what each step should hold, from what earlier runs measured.
  • Results are data. Each job writes a result file in a versioned format. Reports are made from it, and doris report view serves them, so an old run’s report can be made again by a newer doris.

Guiding principles

  • Config is data, not a program. Loading config never runs a command or reads the environment, so a config means the same thing on every machine and in every checkout.
  • Tool knowledge lives in one place. How to drive a simulator or linter, and how to read its output, is written once, in its plugin. A project’s config describes its designs and which tool fills each role.
  • Plans are repeatable. A plugin never starts a process or sees the machine, and the sandbox, not review, is what keeps it that way. The same request always gives the same plan.
  • The result is the record. A result file holds everything a report shows about a job. Reports, indexes and metrics pages are views of it.
  • A verdict says what it covers. Each flow and step page says what passed means and what to check by hand, so a reviewer knows how far to rely on a result.

How it fits together

flowchart LR
    config["<b>Config files</b><br/>project, design, flow"] --> loader["<b>Loader</b><br/>schema check, paths"]
    loader --> plan["<b>Flow</b><br/>plans the step graph"]
    tools["<b>Tool plugins</b><br/>simulator, linter, …"] -- commands --> plan
    plan --> exec["<b>Run</b><br/>cache check, then steps"]
    exec --> parse["<b>Tool plugins</b><br/>read the tool's output"]
    parse --> results["<b>Result files</b><br/>versioned JSON"]
    results --> reports["<b>Reports</b><br/>HTML, from the results"]
    classDef tool stroke-width:3px
    class tools,parse tool

Config is loaded and checked once. Only the two boxes with heavy borders know anything about a specific tool. The rest of doris works the same whichever simulator or linter a design uses.

Where to start

ToRead
Build doris and make a first runGetting started
Describe a project and its designsConfiguration
Understand a run, its outcomes and outputsRunning flows
Set up or review one flowTestRIG, Lint
Know exactly what a step ran and checkedSteps
Understand how doris is put togetherArchitecture
Look up a command or optionCommand line
See what is comingRoadmap

Getting started

This page builds doris, sets up a project with one design, and takes it through a lint run. The output shown is from such a project: yours will have other names, paths, times and versions, and some lines are left out where marked.

What you need

  • Linux. doris does not run on other systems (see Where doris runs).
  • git on PATH, and a project that is a git checkout.
  • The tools the flows run, on PATH. doris never installs or downloads a tool. Run it inside the project’s own dev shell, where FuseSoC, the linters and the simulator already are. doris check lists what is missing.

Build doris

doris is a Rust program. Install a release from crates.io with:

cargo install --locked doris    # ~/.cargo/bin/doris

Or, from a checkout of its repo:

nix build        # a release binary, at result/bin/doris

Or, in the dev shell (nix develop, or direnv):

cargo build --release    # target/release/doris

Put the binary on your PATH. doris --version prints the version, and doris help COMMAND a command’s options.

Describe the project

doris reads three kinds of config file. This example sets up lint for one design, aes, whose FuseSoC core has a lint target. Configuration covers the files in full.

The project file marks the repo root and says where the other files are. project.hjson:

{
  schema: dv/project/1

  configs: [
    "hw/ip/*/design.hjson"
    "hw/ip/*/lint/lint.hjson"
  ]
  cores_root: [
    hw
  ]
}

A design file names a design and gives the facts every flow shares. hw/ip/aes/design.hjson:

{
  schema: dv/design/1
  name: aes

  core: lowrisc:ip:aes:1.0
  top: aes
}

A flow config file sets up one flow for the design above it. hw/ip/aes/lint/lint.hjson:

{
  schema: dv/lint/1

  tool: {
    linter: [
      verilator
      verible
    ]
  }
}

tool binds tools to the flow’s roles. Lint has one role, linter, and each linter bound to it lints the design in a job of its own. The project file can give the linters once for every design: see Tools and roles.

Check the config

doris validate    # load every config file and report every error and warning
doris flows       # each design and the flows it configures; -v adds the config files, -t nests designs by dependency

For the project above:

$ doris validate
checked 3 config files: 0 errors, 0 warnings
$ doris flows
DESIGN  TESTRIG  LINT  CDC  RDC
aes     -        yes   -    -

doris validate exits non-zero if a file has an error, so it suits CI and pre-commit hooks. With --strict it fails on a warning too, such as a config pattern that matches no file (see Strict). A misspelt key is an error that names the file, the line and the valid keys.

doris finds the project by walking up from the current directory, so these commands work anywhere in the repo. Use -C DIR to point at another one.

Check the environment

doris check              # what every configured flow needs of the machine, and whether it is there
doris check lint aes     # only what this run needs
$ doris check lint aes
lint
  ok      program `fusesoc` on PATH               /usr/bin/fusesoc
  ok      program `verilator` on PATH             /usr/bin/verilator
  ok      program `xargs` on PATH                 /usr/bin/xargs
  ok      program `verible-verilog-lint` on PATH  /usr/bin/verible-verilog-lint

doris check lists each program the steps run and whether it is on PATH, and the other prechecks steps declare, such as an environment variable being set. It exits 1, FAILED, if any fails. doris run makes the same checks before its first step.

Plan and run

doris plan prints what a run would do, and runs nothing:

doris plan lint aes
$ doris plan lint aes
lint
└── aes
    ├── verilator
    │   └── filelist      will run
    │       └── flatten   will run
    │           └── lint  will run
    └── verible
        └── filelist      will run
            └── flatten   will run
                └── lint  will run
2 jobs, 6 steps: 6 will run, 0 cached
`doris plan -v` shows each step's command, inputs and outputs

There is one job for each linter, lint/aes@verilator and lint/aes@verible. The plan prints the jobs as a tree by flow, design and tool, with each job’s steps under it in the order they run after each other, each marked cached or will run. For lint, a design linted in a top’s context sits under that top. With -v it lists every step in full: its directory, inputs, exact command and outputs.

doris run lint aes       # one design
doris run lint           # every design with a lint config

A run prints a line when each step starts and ends, with the time of day. The jobs run side by side, so their lines interleave:

$ doris run lint aes
12:13:12 [ start ] lint/aes@verilator: filelist
12:13:12 [ start ] lint/aes@verible: filelist
12:13:12 [       ] lint/aes@verilator: filelist: running fusesoc; output scratch/doris/lint/aes@verilator/filelist/stdout.log
12:13:12 [ pass  ] lint/aes@verilator: filelist (0.6s)
12:13:12 [ start ] lint/aes@verilator: flatten
12:13:12 [ pass  ] lint/aes@verilator: flatten (0.0s)
12:13:12 [ start ] lint/aes@verilator: lint
...
12:13:13 [ pass  ] lint/aes@verilator: lint (0.2s)
lint/aes@verilator: passed (result: scratch/doris/lint/aes@verilator/result.json)
lint/aes@verible: passed (result: scratch/doris/lint/aes@verible/result.json)
12:13:13 [status ] lint: 2 steps: 2 passed
metrics: 6 steps in 2 jobs: 6 ran, 0 cached, 0 skipped; 1.1 s wall, 1.7 s of steps, 0.55 s CPU; at most 2 steps at once (-j 14)
...
report: scratch/doris/lint/report.html (all jobs)

[ start ], [ pass ] and [ FAIL ] mark a step starting and ending, and a blank [ ] is a detail of one, such as the command it is running. [status ] sums up a step name once every job has run it. After the run come the metrics, with a table of each step’s time and memory (left out here), and the reports written. A step’s own output goes to log files in its directory, and the progress line names them. A step that passes keeps only the logs that are among its outputs. The exit code is 0, OK, if every job passed and 1, FAILED, if a design failed (see Exit codes).

Look at the results

Everything a run writes is under scratch/doris/ in the repo root:

scratch/doris/lint/
├── report.html              the flow's index: one row per job
├── metrics.html             the latest run's step times and resources
├── metrics.json
├── assets/                  the scripts the reports use
├── aes@verilator/           one directory per job
│   ├── result.json          the job's result
│   ├── report.html          the job's report
│   ├── filelist/            step: FuseSoC's setup
│   │   └── work/
│   │       ├── lowrisc_ip_aes_1.0.eda.yml
│   │       ├── lowrisc_ip_aes_1.0.vc
│   │       └── src/lowrisc_ip_aes_1.0/rtl/aes.sv    the copy the linter reads
│   ├── flatten/             step: one argument file for the linter
│   │   └── filelist.f
│   └── lint/                step: the linter
│       ├── messages.json    its messages, as parsed
│       └── stderr.log       its log
└── aes@verible/
    ├── ...
    └── flatten/
        ├── filelist.f       the files to lint
        └── verible.flags    Verible's options, which it reads apart

Some files are left out, such as FuseSoC’s other files in filelist/work/.

A step that passed leaves only its outputs in its directory: for lint, the linter’s logs. A step that failed keeps everything it wrote, and doris run --debug keeps every step’s. See Working directories.

doris report view        # serve the reports and open them in a browser

Results and reports describes both files.

When lint finds something

A linter’s warnings fail the design, but which checks run is up to the core’s lint target. Verilator reports only its default warnings unless the target passes -Wall:

targets:
  lint:
    filesets: [rtl]
    toplevel: aes
    tools:
      verilator:
        verilator_options:
          - "-Wall"

With that, a signal that nothing drives or reads fails the Verilator job, while Verible, which has no such rule, still passes:

$ doris run lint aes
...
12:13:35 [ pass  ] lint/aes@verible: lint (0.2s)
lint/aes@verible: passed (result: scratch/doris/lint/aes@verible/result.json)
12:13:35 [ FAIL  ] lint/aes@verilator: lint (0.2s): 0 lint errors, 1 lint warning; see scratch/doris/lint/aes@verilator/lint/stderr.log
lint/aes@verilator: failed (result: scratch/doris/lint/aes@verilator/result.json)
12:13:35 [status ] lint: 2 steps: 1 passed, 1 failed
...
$ echo $?
1

The result file has each message, with the file named from the job’s directory:

$ jq .messages scratch/doris/lint/aes@verilator/result.json
[
  {
    "severity": "warning",
    "rule": "UNUSEDSIGNAL",
    "file": "filelist/work/src/lowrisc_ip_aes_1.0/rtl/aes.sv",
    "line": 2,
    "column": 9,
    "text": "Signal is not driven, nor used: 'spare'"
  }
]

Lint describes the result, and how a core waives a message.

Run it again

doris run lint aes

Nothing has changed, so every step comes from the cache and the run takes a moment:

$ doris run lint aes
12:13:21 [ start ] lint/aes@verilator: filelist
12:13:21 [ pass  ] lint/aes@verilator: filelist (cached)
...
metrics: 6 steps in 2 jobs: 0 ran, 6 cached, 0 skipped; 0.38 s wall, 0.00 s of steps, 0.00 s CPU; at most 2 steps at once (-j 14)

Edit an RTL file and only the steps that depend on it run again. doris run --rerun runs every step whatever the cache holds. See The cache.

Next

Configuration

A project tells doris about its designs in config files that are committed to the repo. Config is plain data, checked against a schema. Loading it never runs a command, reads an environment variable or substitutes a string, so a config means the same thing on every machine.

The three kinds of file

FileNameOne perHolds
Project fileproject.hjson, at the repo rootRepoWhere the other config files and the FuseSoC cores are, and the default tools
Design filedesign.hjsonDesignFacts about the design that every flow shares
Flow config filetestrig.hjson, lint.hjsonDesign and flowWhat that flow needs beyond the design file
project.hjson
hw/ip/aes/
  design.hjson             name, core, top, scope, mappings, tags
  lint/lint.hjson
hw/ip/my_core/
  design.hjson
  lint/lint.hjson
  dv/testrig/testrig.hjson

Each key belongs to exactly one kind of file, with one exception: the tool table, which binds tools to a flow’s roles. The project file gives defaults for it and a flow config file can replace them. There is no other overrides mechanism, so reading any other value never means working out which file wins.

A flow config file belongs to the nearest design.hjson above it, in its own directory or any parent within the repo. It does not name its design, so the name is written once. Three things follow:

  • A flow config file with no design file above it is an error.
  • There is one design file per directory. Two designs never share one.
  • Two files configuring the same flow for one design is an error, and so are two designs with the same name in the same scope.

A design’s flows are the flow config files that belong to it: a design with a lint.hjson can be linted.

Flow config files don’t override design keys. When a flow needs something like a design key but different, it has its own key. TestRIG’s dut.core is a testbench wrapper around the design, not the design’s RTL core, so it lives in testrig.hjson.

Schemas

Every config file starts with a schema key, which says what the file is and which version of the format it uses:

SchemaFile
dv/project/1Project file
dv/design/1Design file
dv/testrig/1TestRIG config
dv/lint/1Lint config

The schema decides what a file is. A flow config file’s flow comes from its schema, not its name, so naming it after the flow is a convention. The project and design file names are fixed, project.* and design.*, because doris looks for them by name while walking up directories. A project.hjson or design.hjson with some other schema belongs to something else and is skipped.

The schemas don’t name doris. They start dv/, not doris/, so another tool can read the same config files without taking on doris’s name.

The project file

{
  schema: dv/project/1

  configs: [
    "hw/ip/*/design.hjson"
    "hw/ip/*/dv/testrig/testrig.hjson"
    "hw/**/lint/lint.hjson"
  ]
  cores_root: [
    hw
  ]

  tool: {
    lint: {
      linter: [
        verilator
        verible
      ]
    }
    testrig: {
      reference: sail
    }
  }
}
KeyRequiredMeaning
configsYesGlob patterns for design and flow config files, relative to the repo root
rootNoThe repo root, relative to the project file’s directory. By default it is that directory. For a project file kept below the root, given with --project
cores_rootNoDirectories FuseSoC searches for core files, relative to the repo root. Each is passed to FuseSoC as --cores-root
toolNoThe default tools for each flow’s roles: a flow’s name, then a role’s. See Tools and roles
filtersNoNamed filter sets, used on the command line as @NAME: each an include and an exclude list of KEY=GLOB filters. A name is made of letters, digits, _ and -. See Named filter sets

Config files are found, not listed. doris loads every file a configs pattern matches.

  • A matched file with no schema, or one doris does not know, is an error. It is not silently skipped.
  • A pattern that matches no file is a warning, or an error with --strict.
  • A design file doesn’t have to match a pattern: one above a matched flow config file is found by walking up.
  • A file that no pattern matches is not seen, so it is neither validated nor run.

Every directory in cores_root is an input of each filelist step, so a change to any file under one, as git sees it, reruns the FuseSoC steps of every design. Keep the list to the directories that hold core files and the sources they name.

The design file

{
  schema: dv/design/1
  name: aes

  core: lowrisc:ip:aes:1.0
  top: aes
}
KeyRequiredMeaning
nameYesThe design’s name, which commands take. No /, @ or #. See below for what it must be unique among
coreNoThe design’s RTL FuseSoC core. Lint needs it, and so does a top
topNoThe design’s RTL top module
scopeNotop makes the design a top. shared keeps a design below a top’s directory from being the top’s own
mappingsNoFuseSoC --mapping for every flow that resolves core. A top’s also apply to each design in its context
tagsNoLabels for the design’s jobs in every flow, which filters select on: letters, digits, _, - and .. A flow config can add its own

A design file must be named design.hjson, or design.toml or design.json, even when a pattern matches it under another name. Two in one directory is an error.

Tops and contexts

A shared IP block often can’t be resolved by FuseSoC on its own. Its core depends on virtual cores, such as a top_pkg of bus widths, that each top provides with different values. So the block is not one build: it is one build per top that uses it.

doris models this with three scopes:

ScopeWhich designsNamedRun
TopA design whose file sets scope: topearlgreyOn its own, with its own mappings
A top’s ownA design whose file is below a top’s directoryearlgrey/pwrmgrIn that top’s context
SharedEvery other design, and one below a top that sets scope: shareduartOnce in the context of each top that uses it
hw/top_earlgrey/
  design.hjson               name: earlgrey, scope: top, mappings
  ip_autogen/pwrmgr/
    design.hjson             name: pwrmgr       -> earlgrey/pwrmgr
hw/top_darjeeling/
  design.hjson               name: darjeeling, scope: top, mappings
  ip_autogen/pwrmgr/
    design.hjson             name: pwrmgr       -> darjeeling/pwrmgr
hw/ip/uart/
  design.hjson               name: uart         -> shared
{
  schema: dv/design/1
  name: earlgrey
  core: lowrisc:systems:top_earlgrey
  top: top_earlgrey

  scope: top
  mappings: [
    lowrisc:prim_generic:all:0.1
    lowrisc:systems:top_earlgrey:0.1
  ]
}

A context is a top’s mappings. A design run in a top’s context is resolved with the top’s mappings, then its own, then the flow config’s, each given once. The mappings are written once, in the top, not in every block’s config.

A top uses a shared design if the top’s core depends on the design’s core, directly or through other cores. doris reads this from the core files under cores_root; nothing lists a top’s blocks. A shared design that no top uses, and every design in a project with no tops, is run on its own, with only its own mappings.

Names. A top’s own design is named TOP/NAME, so two tops can each have a pwrmgr. Three rules keep every name unambiguous:

  • Tops and shared designs have different names from each other.
  • A top’s own designs have different names from each other.
  • A top’s own design can’t have a shared design’s name, because earlgrey/uart also names the shared uart in Earl Grey’s context.

A top can’t be below another top’s directory.

Only lint uses contexts so far. TestRIG simulates its own testbench core, with the mappings of its own config, and names a top’s own design TOP/NAME but is otherwise unchanged.

Two limits of reading the core files instead of running FuseSoC:

  • A dependency through a virtual core is followed only when one core provides it. A design that a top reaches only through a virtual core with several providers is not found to be used by that top, and is run on its own.
  • Only each core’s default target is read, with every flag ? (...) condition taken.

doris plan lint prints the jobs, so it shows which contexts each design got.

Flow config files

Each flow’s keys are on its own page:

Tools and roles

A flow needs a tool for each of its roles. Lint has one role, linter. TestRIG has three: dut, the simulator; reference, the reference model; and coverage, the coverage reporter, which can be left out. A tool table binds tools to roles: the role’s name, then a tool’s name or a list of names.

{
  schema: dv/lint/1

  tool: {
    linter: [
      verilator
      slang
    ]
  }
}
  • A flow config’s tool table binds the roles of its flow. Each flow’s page lists its roles and the tools each can have: TestRIG and Lint.
  • The project file’s tool table gives the defaults, by flow name and then role. tool.lint.linter in the project file above is the linters of every lint config that names none. The table need not name every flow or every role.
  • A flow config’s binding for a role replaces the default for that role. The two lists are not joined. A role the flow config leaves out keeps its default.
  • A role with no tool from either file is an error, unless the flow can do without one. TestRIG’s coverage is the only such role.
  • Several tools for a role give a job for each. With several for more than one role, there is a job for each combination. See Jobs, steps and directories.

Options for a tool go in the flow config’s tools table, under the tool’s name and then the step it is used in, such as tools.verilator.build.args. Each flow’s page lists them. The project file has no tools table.

Rules every file follows

  • Unknown keys are errors, in every file and every nested table. The message names the file, the line and column, and every valid key of that table.
  • Paths are relative to the file that declares them, and are resolved once when the file is loaded. A file copied or vendored with its directory works unchanged.
  • Lists stay lists. Command lines are built by doris from typed values, never by joining config strings.
  • Nothing is read from the environment, and nothing is run.
  • The top level is a map, keys are snake_case, and there is no null. An absent key means the default.

Some things a schema can’t express are checked as each file is loaded. These messages name the file but not a line.

  • Tools and roles. A flow the project file’s tool names must exist. A role must be one of its flow’s. A tool must be one the role can have, and be named once for it. Every role that needs a tool must have one, from the flow config or the project file. A tools.<name> table must be for a tool that can fill a role of the flow.
  • The ISA string of a TestRIG config.
  • That a lint config’s design has a core.
  • The design a flow config belongs to, and duplicate names.

Writing HJSON

Config files are HJSON, which allows comments and leaves out most quotes and commas.

Values run to the end of the line. An unquoted value takes the rest of its line, so { name: aes } sets name to aes }, and [a, b] is one string. Write one value per line, as the examples here do, or quote values that share a line.

Quote glob patterns, so that hw/ip/*/dv isn’t read as the start of a /* comment.

The parser is chosen by file extension, and the loader also reads .toml and .json into the same types, with the same checks. Projects use HJSON, and the examples in this book do too.

doris files and other HJSON files. A repo can hold .hjson files that belong to other tools. doris only loads the files the project file’s patterns match, and tells its own by the schema key.

Validating

doris validate

doris validate loads every config file a run would: the project file, each file its patterns match, and each design file found above a flow config file. Loading carries on past a bad file, so every error and warning is reported at once. It exits 1, FAILED, if any file has an error, so it can run in CI or a pre-commit hook. Warnings don’t change the exit code, unless --strict makes them errors: doris --strict validate is the check for CI.

It checks config only. It doesn’t lint RTL, which is the lint flow, or check that the tools a run needs are installed, which is doris check.

Every other command that reads the project validates the same way before it does anything, and stops if there is an error. doris gc, doris settings and doris report view don’t load config, so a bad file doesn’t stop them.

Vendored designs

Vendored IP is found the same way as local IP: by its design and flow config files. Because paths are relative to the file, a config vendored from another repo works unchanged.

An upstream that has no doris config gets a local directory of its own for each design, outside the vendored tree. For example:

hw/vendor/my_core/                   vendored code, untouched
hw/vendor/my_core.core               a local core file, example::my_core
hw/ip/my_core/design.hjson           name, core: example::my_core, top: my_core
hw/ip/my_core/dv/testrig/testrig.hjson

The design file can’t sit beside the vendored tree as a core file does, because a flow config file finds its design as the nearest design.hjson above it. Where it lives barely matters otherwise: it mostly holds FuseSoC core names, which FuseSoC resolves wherever the core file is.

What a project file can’t do

doris has no variants or filter sets. The project file gives default tools, but no options for them: a tools table is written in each flow config that needs one. Variants and filter sets are planned: see Configuration in the roadmap. How a run happens on a machine, such as pool sizes and where a tool is installed, is not project config but settings.

Repos without doris config

A repo that has no doris config but has another tool’s can still be run with doris. --compat FORMAT makes a doris project from the other tool’s config files, and every command then works on it as on any other project. The one format is dvsim, for OpenTitan’s dvsim lint, CDC and RDC configs.

cd opentitan
doris --compat dvsim flows                                  # the designs it found
doris --compat dvsim run lint top_earlgrey/uart              # one block, with every linter
doris --compat dvsim run lint --top top_earlgrey --tool verilator
doris --compat dvsim run lint -i tag=dv --tool verible       # the testbenches
doris --compat dvsim run cdc                                 # each top's CDC check

This is a bridge until a repo has its own doris config, and is meant to be removed then. The repo’s files are not changed.

How it works

On every command, doris reads the other tool’s files and writes a project from them to scratch/doris-compat/<format>/: a project file, and design files and flow config files as a repo of its own would have. It then loads that project file as --project would. The project file’s root is the repo, so the cores, the jobs’ working directories in scratch/doris/ and the cache are the repo’s, as they would be with its own config.

The project is made again on every command, so it follows the other tool’s files. A file is only rewritten when its text changes, and files of designs that are gone are removed. Don’t edit them: edit the files they are made from.

The generated files are a starting point for a repo’s own config. Copy them out of scratch/doris-compat/ and edit them.

dvsim

Each top’s lint batch, hw/<top>/lint/<top>_lint_cfgs.hjson, lists its lint jobs in use_cfgs. Each job names a FuseSoC core, and imports the configs that build its fusesoc run command. A top’s other lint batches, <top>_<kind>_lint_cfgs.hjson, such as dv for its testbenches and fpv for its formal harnesses, add jobs to the top. They are only read for a top with a batch of its own. The project root is the git checkout’s root, which is dvsim’s proj_root.

dvsimdoris
A top’s batchA design with scope: top, named after the top’s directory
The job named after the top, if anyThe top’s own lint config. The top’s core is its core, or otherwise the core of a job’s --mapping that has the top’s name, such as lowrisc:systems:top_earlgrey
Each other jobA design of the top’s own, named after the job, with a lint config. Its job is lint/<top>/<job>@<linter>
Each job of a <kind> batchThe same, with _<kind> added to its name unless it ends in it: aes in the dv batch is top_earlgrey/aes_dv, and prim_arbiter_ppc_fpv keeps its name. Its design has the kind as a tag, so -i tag=dv selects the testbenches
The job’s fusesoc_core, as runThe design’s core
--targetThe lint config’s target
Each --mappingThe lint config’s mappings, in order
--cores-rootThe project’s cores_root
A tool with a config, {tool}.hjsonA linter in the project’s tool.lint.linter: verilator, veriblelint as verible, slang, ascentlint
  • The FuseSoC command is built as dvsim builds it. The job’s own keys and those of every config it imports, through import_cfgs, make its build_opts, with each {name} replaced by its value. A list in an importing config and an imported one is joined.
  • Only what decides what is linted is translated. --tool and --work-root are doris’s to set. Any other FuseSoC option is an error, as is a command that is not the same for every tool, or that names a variable with no value. Keys dvsim reads only for its reports, such as rel_path and report_severities, are not read.
  • A job is linted in its top’s context, as dvsim lints it. A block that two tops list, such as uart, is two designs: top_earlgrey/uart and top_darjeeling/uart. Each has its top’s mappings. Where they resolve to the same sources, the second job is taken from the cache.
  • Waivers and options are the core’s, from its lint target and the cores it depends on, as they are for dvsim. See What the core file controls.

CDC and RDC

A top’s CDC config, hw/<top>/cdc/<name>_cdc_cfg.hjson, and its RDC config, hw/<top>/rdc/<name>_rdc_cfg.hjson, each check one design, name, elaborated as dut. Each becomes a cdc.hjson or rdc.hjson of the top’s design of that name: the lint job’s, such as top_earlgrey/chip_earlgrey_asic, which is given the dut as its top, or a design of its own if no lint job has the name. A lint job’s design must have the core the check names.

dvsimdoris
sv_flist_gen_opts: --target, --mappingThe config’s target and mappings, as a lint job’s are read
sdc_fileconstraints
cdc_env_file, env_fileenv_files
cdc_config_fileconfig_scripts
cdc_waiver_file, rdc_waiver_filewaivers, and the <kind>_waivers.*.tcl files beside them as reads, since the main one sources them
reset_scenario_filereset_scenarios
tool: meridiancdc, meridianrdcThe project’s tool.cdc.checker and tool.rdc.checker
An empty pathNone
  • doris runs its checker’s script, not OpenTitan’s. What run-cdc.tcl and run-rdc.tcl hard-code is written into the configs: the synchronizer cells, the black boxes, OpenTitan’s prim_fifo_async intent, RDC’s AST_BYPASS_CLK define and ri_ settings, and IS_CDC_RUN, which the constraints read. RDC’s modules, which its waivers loop over, is read from run-rdc.tcl. A change to those scripts is only followed for modules.
  • params and foundry_root are errors if set: doris takes parameters by name, and has no foundry setup to translate to.
  • What the configs say is what runs, including what looks wrong in them. OpenTitan’s CDC config gives no waiver file, so its waivers are not applied, and its RDC config gives only chip_earlgrey_asic.sdc, without the setup file its CDC config reads first.

Limits

  • Lint, CDC and RDC only. dvsim’s simulation, formal and synthesis configs are not read.
  • Every batch is linted with every linter. dvsim leaves the choice to whoever runs it: OpenTitan’s CI lints the dv and fpv batches with Verible only, and Verilator can’t lint a UVM testbench. Pick linters with --tool, as in doris --compat dvsim run lint -i tag=dv -i tag=fpv --tool verible, which lints what that CI does.
  • Each command reads every batch. A batch that can’t be translated stops every command, naming the job and why.
  • Messages and counts are doris’s, not dvsim’s report parsers’. See the lint step for how each linter’s are read.

Running flows

This page explains what happens when doris runs a flow: how a run is split into jobs and steps, how one step runs, and what its outcome means. A job’s outcome is only as strong as the checks behind it, so this page also says what doris does not check.

doris plan FLOW [DESIGN...]     # what would run; runs no step, only the tools' version commands
doris run FLOW [DESIGN...]      # run it

FLOW is testrig or lint. A DESIGN is a design’s name, as its design.hjson gives it. With no design, the run covers every design that configures the flow. Command line lists every command and option.

Jobs, steps and directories

A run is made of jobs. A job is one design in one flow with one tool bound to each of the flow’s roles, named FLOW/DESIGN@TOOL after the tool in the flow’s main role: testrig/my_core@xcelium, or lint/top_chip_system@verilator. TestRIG has one job per simulator bound for the design. Lint has one per linter bound for the design, in each context the design has: lint/top_chip_system/uart@verilator is uart linted with that top’s mappings.

Several tools for any role give a job for each combination. A role other than the main one adds its tool to the name, after a +, when it has several, as in testrig/my_core@xcelium+imc. A role with one tool is not in the name. No role but a main one has two tools that work in the same job today, so these longer names don’t come up yet.

A job is a graph of steps. Each step runs one command and has its own directory:

scratch/doris/<flow>/<job>/
  result.json           the job's result
  report.html           the job's report, made from the result
  <step>/
    stdout.log          the step command's stdout
    stderr.log          the step command's stderr
    <service>.log       stdout and stderr of a service the step started
    ...                 whatever the command wrote

<job> is the job’s name without the flow: <design>@<simulator> for TestRIG and <design>@<linter> for lint. A TOP/NAME is written TOP.NAME there, so job directories are never nested. Everything a run writes goes under scratch/doris/ in the repo root, and nowhere else in the repo.

A step that passed keeps only its declared outputs. Its logs and everything else it wrote are deleted when it ends, unless they are outputs. A step that failed or did not complete keeps its whole directory, and doris run --debug keeps every step’s. See Working directories.

The flow pages say which steps each flow has. The step pages say what each one runs and checks.

Planning a run

doris plan FLOW DESIGN prints the jobs as a tree of their IDs, with each job’s steps under it: a step sits under the step it runs after, and is marked cached or will run. A step that runs after several is put under the last and its note names the others. doris plan -v FLOW DESIGN prints the whole graph without running it: each step’s directory, the steps it runs after, its inputs, exact command, services and outputs, and whether it would run or come from the cache. The plan is what doris will do. Compare it with the flow and step pages when reviewing a run.

doris plan runs no step, but it does run each tool’s version command, such as verilator --version, once per tool. A tool’s version is part of each step’s cache key, and the plan needs the keys to say what is cached.

--until STEP keeps only STEP and the steps it depends on, for plan and run alike. It is the way to work on one part of a flow, such as doris run testrig my_core --until build.

Checking the environment

doris runs tools from PATH and never installs one. Each step says what it needs of the machine, as prechecks, and doris check runs them all without running a step:

doris check                       # every configured flow
doris check testrig my_core    # one run
testrig
  ok      program `make` on PATH               /usr/bin/make
  failed  program `sail` on PATH               not on PATH; needed by testrig/my_core@xcelium: model; testrig/my_core@verilator: model
  ok      program `xrun` on PATH               /tools/cadence/bin/xrun
  failed  environment variable `UVM_HOME` set  not set; needed by testrig/my_core@verilator: build
error: 2 of 5 prechecks failed; is the project's dev shell active?

Each flow has a line for each precheck its jobs make, in the order the steps first need them. A check that holds is ok, with how it is met, such as where the program was found. One that does not is failed, with why, and the steps of each job that need it. doris check exits 1 if any failed.

PrecheckMade for
A program on PATHEvery program a step runs by name, and those a command runs itself, such as the compiler a Makefile calls
An environment variable setUVM_HOME, for a Verilator build with dut.uvm
A file or directory that existsThe replay trace directory, for a TestRIG run with --replay
A cgroup doris may write toEvery step that starts a process, with resources.enforce = cgroup

doris run makes the same checks for its own jobs before any step starts. If any fails it prints each as a setup error: line and exits 2, CANNOT_RUN. So a missing tool or variable fails in seconds, not after an hour of upstream steps.

  • doris check reads the same settings as doris run, files, --settings and --set alike, so it checks with the pool sizes and tool directories the run would have.
  • Resource pools are not prechecks. They are the scheduler’s: a step starts only when every pool it holds has enough left. Before any step starts, doris check and doris run both check that no step needs more of a pool than the pool’s size, since such a step could never start.
  • With enforcement on, every step that starts a process needs what the setting needs: with systemd, systemd-run, systemctl, busctl and a user systemd manager that answers; with cgroup, a cgroup doris may write to with the memory and cpu controllers.
  • A program a step is given by path is not checked. It is usually built by an earlier step, such as the QCVEngine binary.
  • A check says that a tool is there, not that it works. A licence server that can’t be reached is found when the step runs.

Tools not on PATH

The setting tools.NAME.path says where a tool that is not on PATH is. NAME is a tool config can bind, such as xcelium or verilator, and the value must be a directory. A site sets it once in its settings file, or a command gives it with --set:

doris run testrig my_core --set tools.xcelium.path=/tools/cadence/XCELIUM2409/bin

The directory is in front of PATH only for that tool: for the commands and services whose invocations use it, the programs they start, their prechecks and the tool’s version probe. Every other step’s command sees PATH as it is, so a program of the same name in that directory is not found by another tool. It is not part of any cache key.

How a step runs

flowchart TD
    key[Compute the cache key] --> hit{Key stored?}
    hit -- yes --> restore[Restore outputs and verdict] --> done([Done, cached])
    hit -- no --> empty[Empty the step directory]
    empty --> ports[Allocate a free port per service]
    ports --> services[Start services, wait until each port is listening]
    services --> cmd[Run the command]
    cmd --> stop[Stop the services]
    stop --> checks[Completion checks]
    checks --> verdict[Verdict: passed or failed]
    verdict --> store[Store verdict and outputs in the cache]
    store --> clean[Clean the step directory] --> done2([Done])

Before the first step of a run starts, the prechecks of every step are run. Then, for each step:

  1. Cache key. A hash of everything that can change the result (see The cache). If the key is stored, the step’s outputs and verdict are restored and nothing runs.
  2. Empty the directory. The step’s directory is deleted and recreated, so nothing from an earlier run is left in it. This only happens when the step runs. A step taken from the cache keeps or restores its outputs.
  3. Staging. Just before a process starts, doris prepares what it needs: a directory, a symlink, or a copy of a source tree in the step’s directory. A copied tree holds the files git would track, plus untracked files that aren’t ignored. Build products lying in the repo are not copied.
  4. Services. Some steps need programs running beside the command, such as the simulator in TestRIG’s run step. Each service gets a free TCP port. doris starts every service, then waits for each to be ready. Both of TestRIG’s are ready when their port is listening, read from /proc/net/tcp. doris does not connect, because an RVFI-DII server accepts only one connection. A service that is not ready within its start-up timeout is a setup error.
  5. Command. One program and its arguments, run without a shell, in its own process group, with stdin closed. It inherits the whole environment doris was started in. A few steps are functions inside doris and run no command.
  6. Stop services. Each service has a rule: terminate it with SIGTERM, or wait a given time for it to exit by itself. A service that then has to be killed is a step error.
  7. Completion checks, in this order. Failing any of them is a step error, not a failure:
    • no service died or had to be killed against its stop rule;
    • the command was not killed by a signal;
    • the exit code is one the step accepts (0 unless the step says otherwise);
    • every declared output exists;
    • every pass pattern matches in the output it names, such as stdout.log.
  8. Verdict. A step with a parse function has its results parsed first, in-process, into one of its outputs. A step that completed fails if its judge says so, from the exit code, the step’s directory and the parsed results, if one of its fail patterns matches in the output it names, or if it exited with a code other than 0 and is failed by that, as TestRIG’s run step is. Otherwise it has passed. A pattern is a regular expression, matched line by line. Only TestRIG’s run step has a pass pattern, and no step has a fail pattern yet.
  9. Store. A passed or failed step’s verdict and outputs go to the cache.
  10. Clean up. A step that passed has its directory deleted, except its outputs. A step that failed or did not complete keeps it whole. See Working directories.

Order and parallelism. A step runs after the steps whose outputs it reads. doris plan shows them as a tree, and doris plan -v as after .... Steps with no dependency between them run in parallel, up to -j N at once (default: the number of CPUs). The jobs of a run are scheduled together, so -j limits the steps of all of them, and steps of different jobs run at the same time. Each job’s result is written as soon as its last step ends.

A step two jobs share runs once. When two jobs have a step with the same cache key, such as the reference model in a design’s Xcelium and Verilator TestRIG jobs, one job runs it. The other waits, and takes it from the cache.

Progress. doris run prints a line when each step starts and ends, with the local time of day, and a line for each thing a running step does: a service starting and listening, the command starting and ending, a service being stopped, the result being cached. A [ wait ] line says that a step is ready but held back, by a resource pool or by another job running the same step. A step’s own output is not printed. It goes to the log files in its directory, which the progress line names. Those files are there while the step runs, and afterwards only if the step keeps them.

Status. On a terminal, doris run keeps a table below the progress lines and redraws it as steps move on. It has a row for each step name, counting the steps of that name over every job by where they are, and a row for all of them when there is more than one name:

STEP      PROGRESS                  QUEUE  WAIT   RUN  PASS  FAIL   ERR  SKIP TOTAL  RUNNING, 00:00:11 in
filelist  █████████▒▒▒▒▒░░░░░░  48%     0    15    13    26     0     0     0    54  lint/top_chip_system/spi_host@slang, …
flatten   █████████░░░░░░░░░░░  48%    28     0     0    26     0     0     0    54
lint      █████████░░░░░░░░░░░  46%    28     0     1    23     2     0     0    54  lint/top_chip_system/spi_device@verilator
all       █████████▒▒░░░░░░░░░  47%    56    15    14    75     2     0     0   162
ColumnSteps that
QUEUEDepend on steps that have not ended
WAITAre ready, and held back by -j, a resource pool or another job running the same step
RUNAre being looked up in the cache or run. Their jobs are listed at the end of the row
PASSPassed, run or taken from the cache
FAILFailed
ERREnded in a step error or a setup error
SKIPWere skipped

The bar is the share of steps that have ended, and the percentage beside it the same. When the output is not a terminal there is no table: a [status ] line gives a step name’s counts when the last step of that name ends, such as lint: 54 steps: 47 passed, 7 failed.

Resource pools

A step holds resources for as long as it runs: CPU threads, memory, disk space, licences. Each kind is a resource pool with a name and a size, and the steps running at once never hold more of a pool than its size. A step that needs more than is left waits.

PoolCountsSize unless setHeld by
threadsCPU threadsThe machine’s CPU threadsEvery step: one for each of its processes, or every thread for a parallel build
memoryBytes of memoryThe machine’s memorySteps the flow’s config gives a memory
diskBytes of disk in the scratch directoryThe space free there when a step asksSteps the flow’s config gives a disk
xceliumXcelium licencesThe CPU threads, at most 16One by each xrun: TestRIG’s build and run steps with Xcelium
imcIMC licencesThe CPU threads, at most 16One by each imc: TestRIG’s coverage step for an Xcelium job
ascentlintAscentLint licencesThe CPU threads, at most 16One by each ascentlint: the Lint flow’s lint step with AscentLint

doris plan -v shows what each step holds.

What a step holds comes from two places. The tool’s plugin says what its commands hold that is the same for every design: a licence, and how many threads. A parallel build, such as Verilator’s or cabal’s, takes every thread of the pool and is told how many that is, so it runs with no other step beside it. How much memory or disk a step needs depends on the design, so the flow’s config says, under resources and the step’s name:

// testrig.hjson
resources: {
  build: { threads: 8, memory: "24G", disk: "10G" }
  run: { memory: "8G" }
}

threads here replaces what the tool asks for, for the step’s command: the build above takes 8 threads and is told to use 8, where it would have taken them all. A name that is not a step of the flow is an error.

A tool can have values of its own, under STEP@TOOL, where the tool is the one the step’s command runs: doris plan -v shows it after runs. Different linters and simulators need different amounts, so the same step can too:

// lint.hjson
resources: {
  lint: { memory: "128M" }               // every linter
  "lint@slang": { threads: 3 }           // slang alone
  "lint@verilator": { memory: "256M" }   // Verilator alone, in place of 128M
}

Each of threads, memory and disk is taken from STEP@TOOL if it sets it, and from STEP if not. A tool no plugin has is an error, as a step no job has is.

A service has values of its own, under STEP.SERVICE, and STEP.SERVICE@TOOL for one tool. TestRIG’s run step runs QuickCheckVEngine as its command, and the reference model and the simulator as its services, reference and dut, each with its own needs:

// testrig.hjson
resources: {
  run: { memory: "1G", disk: "2G" }        // QuickCheckVEngine, and the step's disk
  "run.dut": { memory: "4G" }              // the simulator
  "run.dut@xcelium": { threads: 2 }        // Xcelium alone
  "run.reference@sail": { memory: "512M" }
}

STEP is then the command’s share. What the step holds is the sum of its parts: the command’s threads and memory, and each service’s. The step is scheduled as a whole, with that sum, as a service only ever runs for its step’s command. Disk is the step’s alone, since its parts share its directory, so a service’s key can’t set it. doris plan -v shows what each part holds under the step, and the step’s total beside its name.

A pool’s size is the setting pools.NAME: in a settings file, or for one command with --set pools.NAME=SIZE. memory and disk take sizes such as 64G, the others a count, and unlimited takes the limit away. The system and user settings files can also put a limit on a pool that no later layer can raise.

doris run testrig --set pools.xcelium=2     # at most two xruns at once
doris run lint --set pools.threads=8 --set pools.memory=32G
  • A step that needs more of a pool than is left waits. Steps that need nothing from that pool go ahead of it. Steps after it in the plan that do need the pool wait behind it, so a step that needs a lot is not kept waiting by a stream of small ones.
  • A step holds its resources only while it runs: from when its services and command start until they have ended. A step taken from the cache holds nothing.
  • A step that needs more than a pool’s size could never start, so doris run exits 2, CANNOT_RUN, before any step starts, naming the step.
  • Resources are reserved, and enforced only if the settings say so. By default a step that uses more memory or threads than it holds is not stopped. The run’s metrics show what each step used, which is what to set its memory from. See Enforcing what a step holds.
  • disk counts free space, less what running steps hold. A step starts only if the scratch directory’s filesystem has that much free beyond what the steps already running have reserved. Without enforcement it is a check that there is room, not a quota. With it, a step that writes more to its working directory than it holds is stopped. Either way, what a step has written stays written after it ends.
  • Neither sizes nor what a step holds change a result, so they are not part of any cache key. The thread count a tool is told isn’t either.

-j still limits the steps running at once, whatever they hold. With the defaults it and threads are both the number of CPU threads, so threads is the one that holds a run back.

A commercial tool’s pool defaults to one licence per CPU thread, and to 16 on a machine with more, so a large machine does not take every licence a site has. Set it to what the site allows. With unlimited a pool limits nothing. Xcelium and IMC are run with -licqueue, and then wait in the licence server’s queue. AscentLint waits for a licence if its options give -wait_license, as those of lowrisc:lint:common do.

Enforcing what a step holds

With the setting resources.enforce, what a step holds is a limit, not only a reservation. Each step that starts a process gets a cgroup of its own for as long as it runs:

  • Its memory limit is the memory it holds, with no swap. A step that holds no memory has no memory limit.
  • Its CPU quota is its threads: one CPU’s worth of time for each thread it holds. A step that uses more threads is slowed down, not stopped.
  • Every process of the step is in the cgroup: its command and its services, and what they start. A step with services has a cgroup below its own for each part, its command and each service, so each is measured on its own, but the limits are the step’s: one part may use what another leaves. A cache unit’s children share the unit’s cgroup.
  • A step the kernel stops for going over its memory is a step error: used more than the 8.0G of memory it holds, and was killed. For a step with services it says which part was killed, such as (its service dut). That is the part whose process the kernel chose, its largest, which is not always in the part that grew. Give it more with the flow config’s resources.
  • A step that writes more to its working directory than the disk it holds is stopped, and is a step error: wrote 3.1G to scratch/doris/..., more than the 2.0G of disk it holds. doris measures the directory while the step runs, every 2 seconds or less often if measuring it is slow, and again when it ends, so a step that writes a lot quickly can go over before it is stopped. Sources copied into the directory count. What it writes elsewhere does not.
  • The cgroup is removed when the step ends, after anything left in it is killed.

There are two ways to get the cgroups:

resources.enforceEach step’s cgroup isNeeds
systemdA transient slice of the user’s systemd manager, with MemoryMax and CPUQuota. Each process is started with systemd-run --user --scopesystemd-run, systemctl, busctl and a user systemd manager that answers: a desktop session has one, and a CI container may not
cgroupA directory doris makes itself in a cgroup v2 hierarchy, with memory.max and cpu.max. Each process moves itself into it before it starts the programA cgroup with the memory and cpu controllers that this user may write to: resources.cgroup, or the cgroup doris was started in
# ~/.config/doris/settings.toml
[resources]
enforce = "systemd"

cgroup is for a machine with no systemd user manager, such as a container. A container with a cgroup namespace of its own, which Docker and Podman give by default on a cgroup v2 host, has its own cgroup at /sys/fs/cgroup. If it may write there, as a rootless Podman container or one run with --privileged may, resources.enforce = cgroup needs nothing else. Otherwise, give doris a cgroup delegated to its user with resources.cgroup, or start it in one, such as with systemd-run --user --scope -p Delegate=yes doris run ....

A cgroup that hands its controllers to cgroups below it can’t have processes of its own. So on the first step, doris moves every process in that cgroup, itself among them, to a new cgroup below it, doris_leaf, and makes each step’s cgroup beside it. Give doris a cgroup of its own, not one that other programs are in.

doris check and doris run check what the setting needs: for systemd, that systemd-run, systemctl and busctl are on PATH and that systemctl --user answers; for cgroup, that the cgroup has the controllers and is writable.

Pinning steps to CPUs

The CPU quota limits a step to its threads’ worth of CPU time, spread over every CPU. With resources.pin = true, each step is instead run on as many CPUs as it holds threads, and no other step runs on those CPUs while it does. A step’s processes are started with their CPU affinity set to its CPUs, so a tool that sizes itself by the CPUs it may use, such as make -j$(nproc), sees only those. It needs no enforcement, and works with either.

  • The threads pool must be no larger than the CPUs doris may run on, or doris run exits 2, CANNOT_RUN, before any step starts. It is that size by default.
  • A cache unit’s children share the unit’s CPUs.
  • A process can set its own affinity, so a tool that does is not held to its CPUs.
  • A progress line says which CPUs each step runs on: pinned to CPUs 4-7.

Metrics

doris measures every step, and doris run ends with a summary of what it measured:

metrics: 18 steps in 6 jobs: 18 ran, 0 cached, 0 skipped; 4.1 s wall, 12.9 s of steps, 12.1 s CPU; at most 4 steps at once (-j 4)
  STEP                                           TIME    KEY     WAITED  CPU     BUSY  MEMORY  HELD
  lint/top_chip_system/uart@slang: filelist      1.5 s   0.32 s  -       1.3 s   0.9   40.4M   threads=1
  lint/top_chip_system/i2c@verible: filelist     1.4 s   -       2.2 s   1.2 s   0.9   40.9M   threads=1
  lint/top_chip_system/i2c@verilator: lint       1.0 s   -       -       0.92 s  0.9   67.7M   threads=1
  lint/top_chip_system/i2c@slang: lint           0.37 s  -       -       1.1 s   2.9   55.3M   threads=1
  ...
  and 8 steps that took less
  POOL     SIZE  PEAK  STEPS  WAITED
  threads  14    4     18     0.00 s
  steps waited 4.5 s in all for the step limit (-j 4)
metrics: scratch/doris/lint/metrics.json

The first line has the totals: the time the run took, the time of the steps that ran added together, key included, and their CPU time. The table lists the ten steps that took longest to run, of those that ran.

ColumnMeaning
TIMEHow long the step took to run and store its outputs
KEYHow long it took before that to work out its cache key and look for it in the cache: asking its tools for their versions and hashing its inputs. Each tool is asked once a run, so the first steps to need one take longest
WAITEDHow long it was ready but held back: by -j, by a resource pool, or by another job running the same step
CPUUser and system CPU time of its command and services, and of the processes they started
BUSYHow many CPUs it kept busy: its CPU time over its time. A second number is its busiest seconds, the 95th percentile, when that is higher by half a CPU or more
MEMORYThe most memory the step had at once, every process together, page cache included. What was used, not what the step held. Marked * if the step was not measured: then it is the largest process alone
HELDWhat it held from the resource pools

A second table has a row for each pool a step held some of: its size, the most held at once, how many steps held some of it, and how long steps waited for it in all. The last line is the same total for -j. Long waits for a pool, with a peak at its size, mean the pool is what limits the run.

Measuring steps

The kernel’s account of a process, when it is waited for, gives its CPU time and its own peak memory, not the peak of all the processes a step runs at once. A build that runs eight compilers at once uses about eight times its largest. So each step that starts a process is measured in a cgroup of its own, as enforcement uses, but with no limits: every process it starts, together. A step with services is measured for each part too, its command and each service, in a cgroup of its own below the step’s. While it runs, doris reads the cgroups each second and measures the step’s working directory as often as is cheap.

MeasuredFrom
Peak memorymemory.peak, or the most memory.current was
CPU timecpu.stat, which counts processes no one waited for too
CPUs kept busy, on averageCPU time over the step’s time
CPUs kept busy, at its mostThe 95th percentile of each second’s
Peak diskThe working directory’s size, at its largest

The setting resources.measure says how steps get the cgroup when nothing is enforced:

ValueSteps are measured
autoWith systemd if systemd-run is there and the user manager answers, and not otherwise
systemdWith a systemd slice, as resources.enforce = systemd makes
cgroupWith a cgroup doris makes, as resources.enforce = cgroup does, in resources.cgroup
offNot: only each process’s own account

With enforcement on, its cgroups are measured, whatever resources.measure says. A step that can’t be given a cgroup to be measured in runs without, and the run warns once. Starting a step in a systemd slice and stopping the slice takes a few hundredths of a second, on the step’s own thread.

The same numbers, for every step, are in the run’s metrics file. Each job’s result file and report page have its own steps’ numbers.

The metrics page shows them as interactive charts and tables. doris run and doris report FLOW write it to scratch/doris/<flow>/metrics.html from the metrics file, the flow’s index links to it, and doris report view serves it for the latest run and for every past run whose metrics the cache keeps. It has five tabs, and opens on the first:

TabShows
SummaryThe run on one screen: the headline numbers, the steps running over time, the five longest steps, the time by step name, and the resource pools
TimelineEvery step that ran as a bar from its start to its end, in a band of rows for its step name, and below it how many steps were running, by step name, against -j
Longest stepsEvery step with its time, start, time waited, CPU time, threads used and held, memory used and held
Time breakdownStep time, CPU time, the longest step and the most memory, added up by step name, by tool and by job
ResourcesEach pool’s size, peak and wait, how much of it was held over the run, and the steps by the memory they used. A step that used more threads or memory than it held is marked
  • Charts zoom. Drag over a chart to zoom into that part, scroll to zoom at the pointer, and double-click to see the whole run again. Hovering over a step gives its numbers, and clicking it opens its job’s page. Clicking a name in a chart’s legend hides it.
  • The filter above the tabs applies to every chart and table: text that the job or step name must contain, and a box for each step name and tool. The headline numbers and the pools table are always of the whole run.
  • Tables sort by the column whose heading is clicked. They show the first 100 rows, with a button for the rest.
  • The address keeps the tab and the filter, so a link opens the page as it was, such as metrics.html#tab=timeline&q=uart.

Threads used is CPU time over run time: the threads the step kept busy on average. Steps taken from the cache or skipped ran nothing, and are counted on the summary only.

The page is drawn by a script, with Plotly for the charts. Plotly is carried in doris and written to scratch/doris/<flow>/assets/plotly.min.js, beside the page, so the page needs no network. To move the page elsewhere, take the assets directory with it.

  • CPU and memory come from the kernel, when doris waits for each process it started. They cover a process a tool started and waited for itself, which is the usual case. A process that outlives its parent is not counted.
  • A step that started no process has neither: one taken from the cache, or one a plugin runs itself, such as flatten.
  • A step measured in a cgroup has more: every process together, whether or not it was waited for, sampled each second while it runs (see Measuring steps).

Suggested resources

A repo can start with no resources in its flow configs, and get them as runs show what each step needs. Each run keeps what its steps used in the measurement store, and doris resources says from the store what each step should hold.

$ doris resources lint i2c
CONFIG                     STEP            POOL     NOW  SUGGESTED  RECORDS  FROM
hw/ip/i2c/lint/lint.hjson  filelist        memory   -    56M        15       p95 41.9M + 25%
                                           disk     -    2.5M       15       p95 1.8M + 25%
                                           threads  -    1          15       p95 0.9 CPUs busy, from runs: no sweep
                           lint            disk     -    1M         15       3 tools agree; the largest: p95 8.0K + 25%
                           lint@slang      memory   -    80M        5        p95 58.2M + 25%
                                           threads  -    5          5        p95 4.8 CPUs busy, from runs: no sweep
                           lint@verible    memory   -    12M        5        p95 8.8M + 25%
                                           threads  -    1          5        p95 0.8 CPUs busy, from runs: no sweep
                           lint@verilator  memory   -    112M       5        p95 77.5M + 25%
                                           threads  -    1          5        p95 1.0 CPUs busy, from runs: no sweep
10 values to change, from 30 records of 5 runs in ~/.cache/doris/measurements

A value is suggested for each part of a step and each tool it runs: slang, verible and Verilator lint at different speeds and sizes, as simulators run at different speeds. Where every tool’s value for a pool agrees, within resources.min_change, and exactly for threads, it is one value for the step, under STEP, the largest of them. Where they don’t, each tool has its own, under STEP@TOOL. A part that only ever runs one tool, such as filelist, which is FuseSoC in every job, has only STEP. Every job of the flow config counts, in every context. NOW is what the config gives the step, or the tool, and - if nothing.

A step with services has a row for each part: TestRIG’s run step has run, for QuickCheckVEngine, run.dut for the simulator and run.reference for the reference model, each from what that part used, and run.dut@xcelium where the simulators differ. Disk is suggested for the step, under run, as it is the step’s alone. Then run in all says what the step holds, the sum of its parts, now and with every suggestion taken. That is what the scheduler has to find room for. Jobs whose totals differ, as an Xcelium job’s and a Verilator job’s do, each have their own:

                                           run                memory   -    384M       5        p95 286.1M + 25%
                                                              disk     -    1.25G      5        p95 858.3M + 25%
                                                              threads  -    1          5        p95 0.5 CPUs busy, from runs: no sweep
                                           run.dut@verilator  memory   -    1.25G      5        p95 953.7M + 25%
                                                              threads  -    4          5        p95 3.6 CPUs busy, from runs: no sweep
                                           run.dut@xcelium    memory   -    3.5G       5        p95 2.8G + 25%
                                                              threads  -    2          5        p95 1.8 CPUs busy, from runs: no sweep
                                           run.reference      memory   -    256M       5        p95 190.7M + 25%
                                                              threads  -    1          5        p95 0.9 CPUs busy, from runs: no sweep
                                           run in all         memory   -    4.12G               the sum of its parts, for xcelium
                                                              threads  3    4                   the sum of its parts
                                                              memory   -    1.88G               the sum of its parts, for verilator
                                                              threads  3    6                   the sum of its parts

A part with no value either way, set or suggested, is named after nothing for, and the total leaves it out.

  • Memory and disk are the 95th percentile of the step’s peaks, plus 25%, rounded up to a round size. A step the kernel killed for its memory is given at least half as much again as it held then, whatever the other records say.
  • Threads are the 95th percentile of how many CPUs the step kept busy in its busiest seconds, rounded up. They show what a step used while it ran beside others, not what more threads would be worth: a step that uses 4 CPUs may be as fast on 1. from runs: no sweep says so.
  • A value needs enough records, resources.min_samples, 5 by default. With fewer, nothing is suggested, and the step stays as it is.
  • A part killed for its memory may not be the one that grew. The limit is the step’s, and the kernel kills its largest process, wherever that is. The part that held it has a record that says it was killed, and the next suggestion for that part is at least half as much again as it held.
  • A value only changes by enough to matter: by more than resources.min_change, 20% by default, unless it was too low. Small drifts are not worth a change to the config.
  • Only the newest 50 records of a step count. Older ones are of the design as it was.
  • Only records of this repo count: those with the same origin remote URL, or, outside git, the same root.

doris resources suggests and changes nothing. The values go into the flow config by hand, for review like any other change.

The measurement store

The store is a directory of files, one per run, each a list of records in JSON: ~/.cache/doris/measurements, or the setting measurements.dir, or off to keep none. A run that ran a step adds a file and says where:

measurements: ~/.cache/doris/measurements/1796068732-buildhost-2103851.json

A record is one step that started a process in one run, or for a step with services, one part of it: its command, with the step’s disk, or one service. A step taken from the cache, skipped, or run by doris itself has none. It holds:

  • the flow config file, relative to the repo root, the flow, design, job, step and service names, the tool the part runs, and the step’s cache key;
  • the outcome, whether the kernel killed it for its memory, and what it held;
  • how long it ran, and what it was measured to use: CPU time, peak memory, CPUs kept busy and peak disk. A step not measured in a cgroup has only its CPU time and largest process, and counts for nothing but its outcome;
  • once per file: the repo’s origin URL, root, commit and whether it was dirty, the host’s name, CPU model, CPUs and memory, the time and the doris version.

A file per run means many machines can write to one directory on a shared filesystem with no locking. A CI job can instead keep its run’s file as an artefact, and it can be imported:

doris measurements import ci-artefacts/          # every file in the directory
doris measurements import run-1234.json          # one file

Every file is checked before any is copied, and a file the store already has is not copied twice. doris gc removes the files of runs older than measurements.max_age, 365 days by default, or never.

Outcomes

Every step ends with exactly one outcome, so a problem with the environment is never reported as a failure of the design.

OutcomeMeaningCached
passedThe step completed and its verdict is passYes
failedThe step completed and its verdict is fail. This says something about the designYes
step errorThe step did not complete: a crash, a timeout, a dead service, a missing output. This says nothing about the designNo
setup errorThe step could not start: a tool or input is missing, a service was never ready, a port could not be allocatedNo
skippedA step it depends on did not pass, or the run was interruptedNo

A job’s outcome is the worst of its steps. From worst to best: setup error, step error, failed, skipped, passed. So a job with a failed step and the steps skipped after it is failed.

A step can be made to run after a failure. TestRIG’s coverage step is: it runs when the run step failed, because a run with a failing test still collected coverage. Such a step is still skipped when a step it depends on ended in a step error or a setup error, or was skipped itself. No other step runs after a failure.

doris run exits 0, OK, if every job passed; 1, FAILED, if the worst outcome is failed; 3, ERROR, for an error or a skip; and 2, CANNOT_RUN, if the run could not start. See Exit codes, and Interrupting a run for what Ctrl-C does.

Working directories

What is left in a step’s directory after a run depends on how the step ended:

The stepIts directory after the run
PassedOnly its declared outputs
FailedEverything, unless dirs.keep_failed is false
Did not complete: a step error, a setup error or an interruptEverything
Ran in a run with --debugEverything
Was taken from the cacheIts declared outputs, and whatever an earlier run kept there
Was skippedWhatever an earlier run left

After a normal run, a step that passed has no stdout.log or stderr.log, no service log and no scratch files, unless the step declares them as outputs. The step pages say what each step’s outputs are. Lint’s logs are outputs, and so are the engine’s and the simulator’s logs of TestRIG’s run step. The logs of the build steps are not. To read the log of a step that passed, run it with --debug:

doris run testrig my_core --until build --debug
  • --debug keeps every step’s directory whole, and keeps each step’s debug outputs in the cache with its other outputs. A debug output is a file that is only of use for looking into a step, such as Xcelium’s build.log.
  • A debug run runs a step again if its cache entry was stored by a plain run, because that entry has no debug outputs. So the first --debug run after a plain one runs every selected step. Its entries then serve debug runs and plain runs alike: the cache keys are the same.
  • A step a debug run takes from the cache has its outputs and debug outputs, not its logs, unless its directory is still there from the run that stored it. --debug --rerun runs every step and so always leaves the logs.
  • A failed step’s directory is kept so the failure can be looked into without running the step again. The setting dirs.keep_failed = false cleans a failure like a pass, which CI may prefer.
  • The job’s result.json and reports are not affected. They are made from step outcomes and declared outputs.

A directory that was kept whole has a file .doris-kept in it, holding failed, interrupted or debug. debug is a step that passed in a debug run: one that failed in it is failed. Kept directories are removed in two ways:

  • By age. At its start, every doris run removes the kept directories in the scratch directory that are older than dirs.work_max_age, of every flow. The default is 14 days. The setting changes it, such as dirs.work_max_age = "7d" in a settings file, and never turns it off.
  • By doris clean.
doris clean --dry-run            # list every kept directory, with its kind and size
doris clean                      # remove them all
doris clean lint                 # only one flow's
doris clean testrig my_core      # only one design's jobs
doris clean lint --tool verible   # only the jobs that use one tool
doris clean --failed --debug     # only those of failed steps, and of steps that passed in a debug run
failed           1.2M  scratch/doris/lint/top_chip_system.uart@verilator/lint
interrupted    340.0M  scratch/doris/testrig/my_core@xcelium/build
would remove 2 working directories, 341.2M

--failed, --interrupted and --debug pick the kinds. With none of them, every kind goes. doris clean removes a kept directory whole, outputs included. A step whose directory is gone is put back from the cache by the next run, if it has an entry. It never touches the directory of a step that passed in a plain run, a result file or a report, and it does not touch the cache. Neither it nor removal by age touches a job that a run is running: doris clean lists such a directory as in use and leaves it.

Runs at the same time

You can start several doris run commands at once in one checkout, in different terminals, from a script, or from CI jobs that share a workspace. Each run holds the jobs it runs, so two runs never work in the same job’s directory at once. Runs of different jobs go side by side, and a run that wants a job another run holds waits for it. Runs at the same time in the architecture explains how.

What that means in practice:

You run, while another run is goingWhat happens
Other jobs: doris run lint uart beside lint aesBoth run now. Each takes from the cache what the other has stored
Another flow: doris run testrig beside doris run lintBoth run now. Every job of one flow is a different job from every job of the other
The same job: doris run lint aes twiceThe second waits until the first ends, then takes from the cache what the first ran, so it is quick
Some of the same jobs: doris run lint beside lint aesThe second waits until the first ends, then runs. It runs none of its jobs until it holds all of them
doris clean, or a run’s removal of old kept directoriesDirectories of jobs a run holds are left. doris clean lists them as in use
doris report FLOW, or doris report viewWorks as usual. A job still running shows its last result
doris gcWaits for the runs to end, as it always has (see Collecting while runs are going)

A run that waits says so before it starts any step, naming the job:

waiting for another doris run of scratch/doris/lint/aes@verilator to finish
  • A waiting run has done nothing yet. It has planned and checked, but run no step and written nothing. Ctrl-C stops it at once.
  • To run one job twice at once, use two checkouts. Each checkout has its own scratch directory, so it has its own jobs. Two runs of one job in one checkout would undo each other’s working files, which is what the wait prevents.
  • Each run uses its own -j and resource pools, as if it were alone. Two runs at once can together start twice the threads, memory and licences either is allowed. When that matters, give each a share, such as -j 8 --set pools.xcelium=2 for each of two runs on a 16-thread machine with four Xcelium licences.
  • The flow’s report index and metrics.json are those of the run that ended last. The index lists every job with a result file, whichever run wrote it. metrics.json and the metrics page are the last run’s alone. Each run’s own metrics stay with its GC root, and doris report view shows each past run.
  • Two runs can run a step that both need, once each. Within one run, a step that two jobs share runs once. Between two runs, each runs it if neither has stored it yet. Both results are correct, and the cache keeps one.
  • Nothing to clean up after a crash. The wait is a flock lock on the file .doris-lock in each job’s directory, which the system lets go when the run’s process ends, however it ends. The file itself stays and is harmless.
  • The scratch directory must be on a filesystem with flock, as the cache must. On one without it, a run stops with an error before its first step.

What passed covers

A passed step means only what its checks cover. Most steps have no judge and no pass pattern, so passed means “exited 0 and wrote its outputs”. A build step that exits 0 without doing any work passes. Each step’s page says what passed means for it and what to check by hand.

These hold for every step, and matter when judging a run:

  • Logs are not scanned for error lines. A tool warning or error that doesn’t change the exit code is not seen, unless the step’s page says its output is parsed.
  • Commands get the whole host environment, not a filtered one. Only what a plugin declares is part of the cache key.
  • Resources are what steps declare, not what they use. A step with no memory in the config holds none, however much it uses, and a tool that starts more threads than it holds is not stopped. See Resource pools.
  • A passed step’s logs are gone after the run, unless they are outputs of the step. Checking one by hand needs a run with --debug (see Working directories).
  • Steps don’t use the network. doris never fetches sources or packages. Sources already in the repo are built as ordinary steps.

The roadmap covers what is planned here.

The cache

Every step is cached. A step’s cache key is a hash of everything doris knows can change its result, and a step whose key is already stored is not run again: its outputs and verdict are restored. A second run with nothing changed runs no tool at all.

doris plan FLOW DESIGN     # shows which steps would come from the cache
doris run FLOW --rerun     # run every selected step anyway, and replace its entry
doris run FLOW --rerun=build,run  # run only the steps of these names anyway
doris run FLOW --no-store  # take steps from the cache, but store nothing
doris run FLOW --no-cache  # run every step, and neither read nor write the cache

--rerun=STEP,... reruns the steps of those names in every selected job, as doris plan names them, and replaces their entries. The steps downstream of them run again only if the new outputs differ, as after any change. A name that no selected job has a step of is an error. The = is needed, so the names are not read as designs.

--no-store reads the cache as usual. A step that runs is not stored: its outputs are hashed, so the steps downstream of it still get keys and can still come from the cache, but nothing is written. --no-cache is --rerun --no-store, and the run has no GC root, as it uses no entry.

The cache is per user, in $XDG_CACHE_HOME/doris, or ~/.cache/doris. It is shared by every checkout and every project, so a second worktree of the same commit starts warm. Cleaning the cache covers how it is kept from growing without limit.

What is in a key

A step’s key is a SHA-256 over:

  • the key protocol, doris-step/2, and the step’s name;
  • the command: program, arguments, environment variables it sets, working directory, staging, the host variables it asks for, and the programs it declares it runs itself;
  • the same for each service, with its name, port name, readiness check and stop rule;
  • each tool the step declares: its name, its version as the tool’s probe reports it, such as what xrun -version prints, and the hash of the plugin it comes from;
  • each host variable such a tool names as changing its results: the variable’s name and its value, or that it is not set;
  • the content of each declared input;
  • the content hash of every output of each step it depends on;
  • for a step a plugin runs itself, such as flatten or instrument, the plugin’s hash and what the plugin was asked to do;
  • the names and paths of its own outputs, its accepted exit codes, its pass and fail patterns, the message a failing exit code gives, whether it has a judge, and the output its parse function writes to.

Inputs are hashed as git sees them. A directory input counts its tracked files, plus untracked files that aren’t ignored. Outside a git checkout, or in a directory git ignores entirely, every file counts.

Keys are the same in every checkout. Paths are written relative to the step, the job or the repo root. Port numbers are not part of a key, and neither is anything worked out on the host when a step starts, such as the path of the system libstdc++.

Downstream steps are keyed on output content, not on the upstream key. An edit that reruns a step but leaves its outputs the same reruns nothing after it.

A tool’s version is asked for when a key is worked out, by doris plan and doris run. Each tool is asked once, however many steps use it. The step pages name each step’s key tools and the command that gives the version.

Only one host variable is keyed today: UVM_HOME, for every Verilator build step, because it names the UVM library Verilator compiles. Two machines with the library in different places therefore don’t share that step’s entries.

What is not in a key

A change to any of these does not cause a rerun:

  • The inherited environment, other than the variables a tool names as part of its key. PATH, HOME and LM_LICENSE_FILE reach every tool and are in no key.
  • Files a command reads that are not a declared input or an upstream output, such as a simulator’s install, a standard-cell library, or an include file outside the directories doris hashes.
  • Programs a command calls that are not among the step’s key tools, such as z3 or make. The step pages name them.
  • Timeouts: the step’s own, and its services’ start-up and stop timeouts.
  • How a run is carried out: --debug and every setting, from a file or --set, -j included. A step’s prechecks and what it holds from the resource pools are not keyed either.

Three more things can give a result from the cache that a fresh run would not:

  • doris’s own part in a result is keyed by the key protocol, not by doris’s version. The protocol is bumped by hand when doris changes how it makes a key, how it reaches a verdict from a step’s rules, or what it does around a plugin’s results, such as writing a linter’s messages to messages.json. A newer doris that changes none of these keeps the cache. One that changes them without a bump is a bug in doris that would reuse results it should not; --rerun works around it. A changed plugin is a new hash, so the steps that use its tool rerun.
  • A tool whose probe fails, because its version command can’t run or exits non-zero, has the version unknown. It is keyed like any other version, so two versions of a tool whose probe fails share a key. A missing tool is caught by the check before the run, not here.
  • A judge is keyed by its presence only, and a parse function by its output. What they do is a plugin’s, whose hash is in the key of the step that uses its tool, with doris’s handling around it, which the key protocol covers.

EDA tools are not hermetic, so the cache is only as good as the declared inputs. When in doubt, --rerun.

What is stored

Only passed and failed outcomes are stored. A step error or setup error is never cached, so the step runs again next time.

An entry holds the verdict, its message, and a copy of each declared output. A hit puts the outputs back in the step’s directory, unless they are already there with the same content. Outputs often contain timestamps and paths, so two runs of one step do not give identical bytes. doris caches outputs and never compares them.

Only declared outputs are stored. A step’s stdout.log and stderr.log are in its entry only if the step declares them as outputs, as lint does. A passed step’s other files are deleted when it ends (see Working directories).

Debug outputs are stored by a debug run only. A step can mark an output as a debug output: a file only of use for looking into the step, such as Xcelium’s build.log. A plain run does not store it. doris run --debug does, and its entries say so. A debug run does not take a step from an entry stored without debug outputs: it runs the step and replaces the entry. A plain run takes a step from either kind. Debug outputs are not part of any key, so the two kinds of run share every key and everything downstream.

A step that runs after a failure is cached like any other. TestRIG’s coverage step is keyed on the run step’s outputs whether that passed or failed, since a failed step’s outputs are stored too.

A stored failure keeps its message with the paths made neutral, and a hit shows them as they are in this checkout.

An entry that can’t be read is treated as a miss, without a warning: the step runs and replaces it. An entry that can’t be restored is not an error either. doris warns, runs the step and replaces the entry.

Seeing what was cached

In a job’s result.json, each step has cached and its key. cached: true means the step did not run in this job: its outputs and verdict are those of an earlier run with the same key, and seconds is the time taken to restore them. Any log in its directory is from that earlier run too.

jq -r '.steps[] | "\(.name)\t\(.outcome)\t\(.seconds)s\tcached=\(.cached)"' result.json

Randomised steps

A step that generates its own stimulus from a seed is cached like any other, because the seed is an argument and so part of the key. TestRIG’s generate mode works this way: a run with a seed it has had before comes from the cache, and a run with a newly picked seed always runs. See Generate and replay.

Two steps with the same key

A result is reused whenever two steps have the same key: the same command, inputs and tool versions. That is true across checkouts and across jobs. Steps of different flows that happen to share a name, such as filelist, usually ask for different things and so have different keys.

Cleaning the cache

The cache is cleaned by garbage collection, on the model of Nix generations: every run writes a GC root, roots keep cache entries alive, and a collection deletes every entry no root reaches.

doris gc roots                      # the roots: one per run, with its age, size, revision and job count
doris gc --dry-run                  # what a collection would drop and free
doris gc                            # drop roots older than 30 days, then delete what no root reaches
doris gc --older-than 7d --max-size 100G   # a shorter age limit, then oldest roots go until the cache fits
doris gc --older-than 3d -f         # by age alone: the newest root of a job or branch goes too
doris gc pin latest --name signoff  # keep a run's entries whatever its age
doris gc unpin signoff              # let it age out again

The doris gc commands need no repo. The cache is per user, so they work from any directory.

Roots

Every doris run writes a root, even a run of one job. A root records:

  • an ID, made from the run’s start time in UTC and its process ID;
  • the repo path, git branch and commit, and whether the tree was dirty;
  • the command line and the job IDs it ran;
  • every cache entry its jobs used or stored;
  • each job’s result file;
  • the run’s metrics file.

Each cache entry also records the entries it was built from. A collection keeps everything reachable from a root, upstream entries included, so a small change to the sources still reruns only what changed.

A root keeps the result files, so doris report view can show a past run after the scratch directory has moved on. A job that fails or is cut short with --until still has a root, which keeps what it got through.

Naming a root. Commands that take a root accept its ID, a prefix of the ID only one root has, its pin name, or latest.

What a collection does

A collection has two phases. First it drops roots, by the rules below. Then it sweeps: it marks everything the remaining roots reach, and deletes every entry left unmarked.

doris gc applies the age rules and then, if gc.max_size is set, collects by size.

SettingDefaultMeaning
gc.keep_age30dDrop unpinned roots older than this. never turns the rule off
gc.keep_latestjob-branchKeep the newest root whatever its age: for each job on each branch (job-branch), for each branch (branch), or none
gc.keep_branches0With keep_latest, protect only the N most recently run branches. 0 means all
gc.drop_missing_repotrueDrop roots whose repo path no longer exists, which cleans up after deleted worktrees
gc.max_sizenoneThe cache size to collect down to. none means no limit
gc.autooffWhen to collect after a run: off, size (by size, if over max_size), or age+size (the age rules, then by size)

Because of keep_latest, a branch left for a month still has a warm cache. doris gc lists each root it kept only because of keep_latest, with the jobs it is the newest run of. A job that has been renamed or removed keeps its last root this way forever, so -f (--force, short for --set gc.keep_latest=none) drops roots by age alone. Pinned roots are still kept.

Set them in a settings file, or change one for one command with --set:

doris gc --set gc.keep_latest=branch
doris run lint --set gc.auto=age+size --set gc.max_size=100G    # collect after the run

--older-than AGE and --max-size SIZE are short for --set gc.keep_age=AGE and --set gc.max_size=SIZE. They and -f are applied after every --set, so they win over one.

Collecting by size drops the oldest root, sweeps, and measures again, one root at a time, until the cache is within max_size. It never drops a pinned root, a root keep_latest protects, or the root of the run that triggered it. If the cache is still too big when only those are left, doris stops and warns. Sizes are the sum of file sizes, not disk blocks.

A root whose repo is missing protects nothing under keep_latest while drop_missing_repo is on, which drops it even if it is the newest of its branch. With drop_missing_repo off, it is treated like any other root.

Pinning

doris gc pin ROOT [--name NAME] protects a root from every rule, for example a sign-off run you may need to reproduce or whose report must stay available. doris gc unpin ROOT removes the protection, and the root then ages out like any other.

Collecting while runs are going

A run holds a shared lock on the cache from its start to its end. A sweep takes the lock exclusively, so it never deletes an entry a live run has just used or written:

  • doris gc waits for running runs before it sweeps.
  • A run’s own collection (gc.auto) is skipped if other runs are using the cache.
  • --dry-run and doris gc roots take no lock.

The locks are flock locks, so the cache directory must be on a filesystem that supports them.

A root left by a run that crashed stays, and ages out like any other.

What is in the cache directory

entries/<kk>/<key>/  an entry; <kk> is the first two characters of the key
  entry.json         the step's name, its verdict and message, the hash of each output,
                     whether a debug run stored it, and the keys of its upstream entries
  out/<n>            a copy of the step's nth declared output, a file or a directory
roots/<id>.json      a run's root
roots/<id>.pin       present if the root is pinned; holds the pin's name, if it has one
tmp/                 entries being written; each is moved into entries/ when complete
lock                 held shared by runs, exclusive by a sweep

An entry file’s schema is doris/cache-entry/1 and a root’s is doris/gc-root/1. An entry with another schema is not used, so its step runs again. A sweep removes a root with another schema along with root files it can’t read, and whatever interrupted runs left in tmp/. Until the first release, a cache written by another version of doris is not kept (see Upgrading the cache’s files).

Working directories are separate. Nothing under scratch/doris/ is in the cache or needs a root, and doris gc does not touch it. A step that passed leaves only its outputs there. The directories kept whole, for a failure or a debug run, are removed by doris clean or after dirs.work_max_age.

Measurements are removed by age. doris gc also removes the measurement store’s files of runs older than measurements.max_age, 365 days by default. --dry-run says which it would remove. The store is not part of the cache, and no root keeps a measurement.

Settings

Settings say how and where a run happens on this machine: how many steps run at once, how large the resource pools are, where a tool is installed, what is kept. They never change what a job makes, so no setting is part of a cache key, and changing one invalidates nothing.

Project config is different. It says what can run, is committed to the repo, and is the same for everyone (see Configuration). Settings vary by site and user.

Layers

Settings are read in layers. Each later layer overrides the earlier ones, key by key:

OrderLayerWhereTypical use
1Built-in defaultsdorisValues for a laptop
2System/etc/doris/settings.*Site policy: licence pool sizes, tool installs, limits
3User$XDG_CONFIG_HOME/doris/settings.*, else ~/.config/doris/Personal preferences: how long to keep things, limits
4Checkout.doris/settings.* in the repo root, untrackedOne checkout’s tweaks
5Command line--settings FILE, then -j N, then each --set KEY=VALUEThis command only. CI passes its settings as a file
  • A settings file can be HJSON, TOML or JSON: settings.hjson, settings.toml or settings.json. Two at the same layer is an error, rather than one silently winning.
  • A file is a table of keys, nested or not: pools: { xcelium: 2 } and "pools.xcelium": 2 are the same key. No key takes a list: plugins.path takes its directories as one value, separated by :.
  • Every key is checked. An unknown key, or a value of the wrong kind, is an error naming the file or --set it came from. A pool’s name is the exception: pools.NAME is not checked against the pools there are, so a misspelt pool is set and never used.
  • A relative path in a file is relative to the file’s directory. One given with --set is relative to the current directory.
  • Every command reads them, doris check and doris clean included, and --settings and --set are accepted by every command. The checkout’s layer is read when doris is started inside a repo, which doris gc and doris settings need not be.
# ~/.config/doris/settings.toml
[pools]
memory = "48G"

[dirs]
work_max_age = "7d"

[tools.xcelium]
path = "/tools/cadence/XCELIUM2409/bin"

[plugins]
path = "/tools/doris/plugins"
doris run testrig --settings ci-settings.hjson --set pools.xcelium=2

Keys

KeyValueDefaultMeaning
jobs.maxA countThe CPU threadsThe most steps running at once, over every job. -j N sets it
pools.NAMEA count, a size such as 32G for memory and disk, or unlimitedThe machine’s threads and memory, the free disk space. A licence pool: the CPU threads, at most 16The size of a resource pool
resources.enforceoff, systemd or cgroupoffWhether what a step holds from the pools is enforced, or only reserved
resources.cgroupA cgroup v2 directoryThe cgroup doris was started inWhere resources.enforce = cgroup makes a cgroup per step
resources.pintrue or falsefalsePin each step to as many CPUs as it holds threads
resources.measureauto, systemd, cgroup or offautoHow each step is measured in a cgroup of its own when nothing is enforced
resources.min_samplesA count5The records of a step doris resources needs before it suggests a value
resources.min_changeA percentage such as 20%20%How much a value must change by for doris resources to suggest it, unless it was too low
measurements.dirA directory, or off~/.cache/doris/measurementsThe measurement store, which each run adds what its steps used to. off keeps nothing
measurements.max_ageA duration such as 90d, or never365 daysdoris gc removes the measurements of runs older than this
dirs.keep_failedtrue or falsetrueKeep the whole working directory of a step that failed. With false it is cleaned like that of a step that passed
dirs.work_max_ageA duration such as 7d, or never14 daysAt the start of a run, working directories that were kept whole longer ago than this are removed
tools.NAME.pathA directoryNot set: tools are found on PATHWhere the tool NAME is, for its own commands only (see Tools not on PATH). NAME is a tool config can bind
plugins.pathDirectories, separated by :None: only the plugins built into dorisWhere more tool plugins are: each .wasm file in them is loaded, after the built-in ones. One for a tool doris has replaces doris’s. A later layer’s list replaces an earlier one’s
gc.*See Cleaning the cacheSee thereWhat a collection keeps, and whether a run collects

Limits

Some settings are policy, not defaults. The system file and the user’s file can put a key under limits, and no later layer can raise it above that:

// /etc/doris/settings.hjson
{
  pools: { xcelium: 4 }
  limits: {
    jobs: { max: 16 }
    pools: { xcelium: 4 }
  }
}

A user can still ask for fewer. One who asks for more, such as -j 32 here, runs with the limit and a warning naming the file that set it. A key no layer sets is held to the limit too, quietly: on a 64-thread machine jobs.max is 16.

  • Only jobs.max and pools.NAME can be limited. Any other key under limits is an error.
  • Only the system and user files can set limits. A limits table in the checkout’s file or a --settings FILE is an error.
  • Where both files limit a key, the lower limit holds. A user can tighten a site’s limit, for example to keep a shared machine’s licences for others, but not raise it.
  • A limit can’t be unlimited.

Seeing what applies

doris settings lists every setting, its value, and the file or flag it came from:

KEY                    VALUE                        FROM
dirs.keep_failed       true                         default
dirs.work_max_age      7d                           /home/me/.config/doris/settings.toml
gc.auto                off                          default
jobs.max               16                           /etc/doris/settings.hjson (limit)
measurements.dir       ~/.cache/doris/measurements  default
measurements.max_age   365d                         default
pools.memory           30.9G                        machine
pools.xcelium          2                            --set
resources.cgroup       doris's own                  default
resources.enforce      off                          default
resources.measure      auto                         default
resources.min_change   20%                          default
resources.min_samples  5                            default
resources.pin          false                        default
tools.xcelium.path     /tools/cadence/...           /home/me/.config/doris/settings.toml

A pool no layer sizes is listed with the machine’s size, and disk as the space free in the scratch directory. doris settings takes --settings and --set like any command, so it shows what a command with them would use.

Results and reports

Every job writes a result file, result.json, when it ends. The result is the record of the job. Reports are HTML pages made from result files, and from nothing else.

The result file

scratch/doris/<flow>/<job>/result.json is versioned JSON. Its schema names the flow and the format version: dv/testrig-result/1 or dv/lint-result/1. Fields with no value are left out, not written as null. A path in it is relative to the job’s directory, such as a lint message’s file. The exception is a TestRIG counterexample’s file, which is absolute.

Every flow’s result has these fields:

FieldMeaning
schemaThe result format and its version
job, dutThe job ID and the design
toolThe tool in each of the flow’s roles, by name
versionsThe version of each tool the job’s steps use, by the tool’s name
produced_byThe doris release version, such as doris 0.1.0
revisionThe repo’s commit, with (dirty) if tracked files have changes. Untracked files don’t count
timestampWhen the result was written, at the end of the job
untilPresent if the job was cut short with --until. The result then covers only the steps up to that one
tagsThe job’s tags: its design file’s, then its flow config’s. Left out if it has none (see Filters)
outcomeThe worst step outcome, with message if it is not a pass
stepsPer step: outcome, message, seconds, the cache key if it has one, cached, metrics, and a cache unit’s children

The metadata follows the lowrisc-dv-evidence format, so other tools that read that format see the same fields. revision is left out if git can’t give it.

versions is a map from a tool’s name to its version. It has an entry for every tool a step of the job declares: the tools bound to the flow’s roles, such as xcelium or slang, and helper programs, such as fusesoc and gcc.

  • A version is what the tool’s probe reports, the same text that is part of the step’s cache key. It is whatever the tool’s version command prints, so it can be more than a number.
  • A tool whose probe fails is left out. versions is left out when it would be empty.
  • The versions are read when the result is written, from the machine the job ran on. For a step that came from the cache, the version is the one that would have run, which is the one in the step’s key.
  • Steps a plugin runs itself have no entry, such as flatten, and the coverage step of a Verilator job.
  • The reports don’t show versions yet. Read them from result.json.

cached: true means the step did not run in this job (see Seeing what was cached).

steps has one entry for each step of the job, in the order planned. A cache unit is one entry, with a children list of how each of its children ended, in the order they ended: name, outcome, message, seconds, and resumed: true for one that was done in an earlier, interrupted run and not run again. A unit taken from the cache has no children, since none ran. The child of a unit in a unit is named INNER/NAME. A composite step’s children are steps of the job, each an entry of its own, named PARENT/CHILD. No flow has either yet.

metrics is what the scheduler measured of the step (see Metrics). A skipped step has none. Times are in seconds.

FieldMeaning
startedWhen the step started, from the start of the run. For a step that waited for a pool, when it got it
endedWhen it ended, from the start of the run
waitedHow long it was ready but held back
key_secondsHow long it took to work out its cache key and look for it in the cache, before started. Part of seconds: for a cached step, nearly all of it
cpu_secondsCPU time of its processes: its cgroup’s, if it was measured in one. Left out for a cached step and for one a plugin runs itself
max_rss_bytesThe most memory any one of its processes had resident. Left out with cpu_seconds
memory_peak_bytesThe most memory the step had at once, all its processes together. Only for a step measured in a cgroup, as are the next three
parallelismHow many CPUs it kept busy on average
parallelism_p95How many CPUs it kept busy in its busiest seconds
disk_peak_bytesThe most its working directory took on disk
resourcesWhat it held from each resource pool: memory and disk in bytes. Left out if it held nothing, as a cached step did
toolThe tool its command runs, if it runs one
partsFor a step with services, each part: its command, then each service, measured each in a cgroup of its own. See below

seconds is the time the step itself took, key_seconds included and waited not.

Each of parts has service, left out for the command, tool, resources, what the part held, and cpu_seconds, memory_peak_bytes, parallelism and parallelism_p95 of the part alone. killed_for_memory: true marks a part the kernel killed a process of. The step’s own fields are of all its parts together.

The metrics file

doris run also writes scratch/doris/<flow>/metrics.json, with what the scheduler measured of the whole run. Its schema is doris/run-metrics/1. Each run of a flow replaces it. A copy is kept with the run’s GC root, as each job’s result is, so a past run’s metrics can still be reported on.

FieldMeaning
produced_by, timestampAs in a result file
commandThe command line of the run
wall_secondsHow long the steps of the run took, from the first starting to the last ending
max_steps, peak_steps-j, and the most steps that ran at once
waited_secondsHow long steps were held back by -j, added over the steps
step_seconds, cpu_secondsThe time and the CPU time of the steps that ran, added together
poolsA list, one per pool a step held some of: name, size if it is limited, peak, steps and waited_seconds. memory and disk are in bytes
jobsPer job: id, outcome, and steps as in its result file
# The steps that waited longest, and for how long.
jq -r '.jobs[] | .id as $j | .steps[] | select(.metrics) | "\(.metrics.waited)\t\($j): \(.name)"' metrics.json | sort -rn | head

TestRIG

FieldMeaning
modegenerate or replay
tests_requestedGenerate mode: --tests if given, otherwise tests.count. A request, not a count of tests that ran
seedGenerate mode: the seed the tests were generated from. --seed with it repeats the run
testsPer test group, or per trace in replay mode: outcome, tests passed and tests run
counterexamplesEach saved counterexample: where it was kept and its trace
coveragePer module with covergroups: covergroup average in percent, and bins covered out of total
instructionsPer instruction QCVEngine saw: times executed without a trap (notrap) and with one (trap)

The test counts are read from QCVEngine’s output. instructions is read from the statistics file QCVEngine writes, run/stats.txt, and is there only when the run step completed. See TestRIG for what they cover. coverage is there only when the coverage step passed, and tool.coverage names the reporter whenever the job has that step. That step runs after a run step that failed too, so a job with a failing test still has its coverage.

Lint

FieldMeaning
contextThe top whose context a shared design was linted in. Left out for a design run on its own
lintedWhether the lint step completed. If not, the counts and messages say nothing
errors, warningsHow many messages of each severity the linter reported
messagesEach message: severity, rule, file, line, column and text. Waived ones are not in it

See Lint for the details of a message.

Reports

A report has a header with the outcome, revision, tools and seed, a table of tests with passing, total and pass rate, the failures, and the steps. A lint page has the message counts by rule and the messages in place of the tests. Each page is one self-contained file, with no scripts. The metrics page is the exception: it is drawn by a script, and loads its charting library from the assets directory beside it, never from a network.

CommandDoes
doris run FLOW [DESIGN...]Writes the pages of the jobs it ran and the flow’s index, when the jobs end
doris report FLOW [DESIGN...]Writes the same pages again, from the result.json files in the scratch directory
doris report view [RUN]Serves the reports from a web server in doris, and opens the browser at one of them

The pages doris run and doris report FLOW write are files, next to the results they are made from:

scratch/doris/<flow>/
  report.html             the flow's index: one row per job, its latest result
  metrics.html            the metrics page of the flow's latest run
  assets/                 what the metrics page loads: the charting library
  <job>/report.html       the job's page

A report shows only what its result file holds. It is not made from logs or from the steps’ directories. For what a result does not cover, see each flow’s page. A result file whose schema this doris does not know is left out.

Pages are never the record of a run. The result is the record, and a page is made from it when it is written or asked for, by the doris that is asked, with that doris’s layout. So the report of an old run can be made again after doris has changed, and it then has the new layout. The footer names the doris that made the page and the one that wrote the result.

Viewing reports

doris report view              # open the index of flows and runs
doris report view latest       # open the latest run, of any repo
doris report view signoff      # open a pinned run
doris report view --no-open --port 8000    # only serve, on a fixed port

doris report view writes nothing. It listens on 127.0.0.1, on any free port or the one given with --port, prints the address, opens the browser there, and runs until it is interrupted. --no-open only prints the address, for a machine with no browser: forward the port to one that has.

It needs no project. The runs are in the cache, which is per user, so it serves them from anywhere. In a checkout, the home page has the checkout’s latest results and lists its runs. It does not load the checkout’s configs, so one that does not load does not stop it. Outside a checkout, the home page lists the runs of every repo in the cache, with a column for each run’s repo, and there are no /flows/ pages.

The home page has a row per run, newest first. A run is shown by its number, counted from the oldest run listed, with its ID on hover; the numbers move down when doris gc drops older runs. A pinned run has a pin before its number. Each row counts the run’s jobs, the pass rate, and the jobs that failed, had an error, or were skipped, with each outcome’s count on hover.

It serves:

AddressPage
/The flows with results in the scratch directory, and this repo’s runs
/?flow=<flow>The same, for one flow: its latest results, and the runs with a job of that flow, counting only those jobs
/flows/<flow>/report.htmlThe flow’s index of latest results
/flows/<flow>/metrics.htmlThe metrics page of the flow’s latest run
/flows/<flow>/<job>/report.htmlA job’s latest result
/flows/...Any other file or directory in the scratch directory, such as a log
/runs/<run>/report.htmlOne past run: a row per job of that run
/runs/<run>/metrics.htmlThe metrics page of that run
/runs/<run>/<job>/report.htmlA job as it was in that run
/runs/<run>/<job>/files/<step>/<output>/...A step output of that run, as the cache keeps it

Under /runs/, <job> is the whole job ID, flow included, with each character other than a letter, digit, -, _, . or @ written _: lint_top_chip_system_uart@verilator. Under /flows/, it is the job’s directory, as in Jobs, steps and directories.

Past runs. A run is a GC root. doris run keeps each job’s result in the run’s root, so the report of a past run can be made for as long as the root lives, whatever later runs do to the scratch directory. RUN names a root as doris gc roots lists it: its ID, a unique prefix of it, a pin name, or latest. latest is the newest run in the cache, of any repo, even in a checkout. Pin a run whose report must stay available.

Text files. A log or any other text file is shown in a viewer, not sent as it is. Each line has a number, and the number links to the line: .../stdout.log#L120 opens the file at line 120 and marks it. The viewer makes visible what a browser would not show. A control character is shown as its control picture, such as ␁, and a byte that is not UTF-8 as \xNN. A tool’s terminal colours are drawn as a terminal would draw them, and other terminal escape sequences are left out. The viewer shows the first 8 MiB of a file. Add ?raw to the address, or follow the viewer’s link, for the file itself.

Coverage data. A Verilator coverage data file, as the run step of a Verilator job keeps, is shown as a table with a row for each coverage point: its hits, its place in the source, and the other fields of the point, with Verilator’s __0XX encoding of names undone. A point with no hits has its count in red. A row has the number of its line in the file, so #L120 links to it as in any other file. This is the data as Verilator wrote it; the job’s coverage report is the place to read functional coverage.

Logs. The job page in the scratch directory links each step to the *.log files that are in its directory when the page is made. A step that passed has only the logs it declares as outputs, so most passed steps have no link; a step that failed or did not complete has them all, and so has every step after a run with --debug (see Working directories). The logs are those of the run that last ran the step. The page of a past run links instead to the step outputs the cache keeps, for the steps that have a cache entry.

Flows

A flow is one kind of verification work. It owns the shape of that work: which steps exist, how they connect, and what the result means. A design takes part in a flow by having a config file for it.

FlowChecksConfig fileSteps
TestRIGA RISC-V core against a reference model, instruction by instructiontestrig.hjsonmodel, engine, filelist, flatten, instrument (Verilator), build, run, coverage (with functional coverage)
LintA design’s RTL with Verilator, Verible, slang and AscentLint, as its core’s lint target describes itlint.hjsonfilelist, flatten, lint
CDCA design’s clock domain crossings with Meridian CDC, given its constraintscdc.hjsonfilelist, flatten, script, cdc
RDCA design’s reset domain crossings with Meridian RDC, in each reset scenariordc.hjsonfilelist, flatten, script, rdc

The flows are a fixed list in doris. Synthesis and formal are planned.

Flows and tools

A flow has a role for each kind of tool it needs, and config binds a tool to each role: the design’s flow config, or the project file for a role that config leaves out (see Tools and roles). How to invoke the tool and read its output is part of doris, so a config carries no command lines.

FlowRoleKind of toolTools
TestRIGdutSimulatorxcelium, verilator
TestRIGreferenceReference modelsail, the CHERI RISC-V model
TestRIGcoverageCoverage reporterimc, and doris for doris’s own
LintlinterLinterverilator, verible, slang, ascentlint
CDCcheckerCDC checkermeridiancdc
RDCcheckerRDC checkermeridianrdc

FuseSoC resolves every design’s sources and is used by every flow.

Flow, role and tool names are checked when config is loaded, so doris validate reports an unknown one.

Reading these pages

Each flow’s page says which steps it runs, what its config gives them, what its result holds, and how to check a run by hand. Each step’s page gives the command it runs, what it reads and writes, and what passed means for it.

Read Running flows first for how any step runs and what outcomes mean.

TestRIG

TestRIG checks a RISC-V core against a reference model. QuickCheckVEngine (QCVEngine) generates instruction sequences and sends each one to two implementations over RVFI-DII sockets. Each implementation executes the instructions and sends back one trace packet per instruction. QCVEngine compares the two streams. If they differ it shrinks the sequence to a small counterexample and saves it.

In doris, implementation A is the reference model and implementation B is the design in a simulator. For example, that is the Sail CHERI RISC-V model against the core’s testbench in Xcelium or in Verilator.

This page covers the steps the flow runs, its config, and how to check a run. Each step has its own page under Steps. Read Running flows first for how any step runs and what outcomes mean.

doris plan -v testrig my_core          # the steps and exact commands
doris run testrig my_core              # generate mode: new random tests
doris run testrig my_core --seed 42    # generate mode: the tests seed 42 makes
doris run testrig my_core --replay     # replay mode: rerun saved traces
doris run testrig my_core --until build
doris run testrig my_core --tool verilator   # only the Verilator job

The steps

flowchart LR
    model --> run
    engine --> run
    filelist --> flatten --> build --> run
    filelist --> build
    flatten -.-> instrument -.-> build
    run --> coverage

The dotted step is in a Verilator job only.

StepIn this flowProduces
modelBuilds the Sail model in reference.source for archThe reference model’s RVFI-DII binary
engineBuilds QCVEngine from engine.sourceThe QCVEngine binary
filelistAsks FuseSoC for the default target of dut.core, the testbenchA copy of every source, and a .scr
flattenRewrites the .scr for the build stepfilelist.f
instrumentVerilator only. Makes the build’s filelist, with covergroups as cover propertiesfilelist.f and rewritten sources
buildCompiles and elaborates dut.top in the simulatorThe simulation snapshot
runRuns QCVEngine against the model and the simulator. The test resultStats, logs, counterexamples, coverage
coverageReports on the coverage of the run. Only with dut.coverage.functionalCoverage reports

There is one job per simulator bound for the design, testrig/<design>@<simulator>, in scratch/doris/testrig/<design>@<simulator>/. The jobs of a design get the same seed, so each simulator is given the same tests, and they share the model and engine builds through the cache. --tool keeps the jobs that use one tool. Every step is cached. model, engine and filelist depend on nothing, so they start together.

The coverage step runs after a run step that failed. A job with a failing test is failed, and still has its coverage report. Every other step is skipped when a step it depends on did not pass, and coverage is too when run did not complete.

Tools

The flow has three roles. The config’s tool table binds a tool to each, by a name or a list of names:

RoleToolsUsed byIf the config leaves it out
dutxcelium, verilatorbuild, runThe project file’s tool.testrig.dut. An error if that is unset too
referencesailmodel, runThe project file’s tool.testrig.reference. An error if that is unset too
coverageimc, doriscoverageThe project file’s tool.testrig.coverage. Otherwise the simulator’s own reporter
tool: {
  dut: [
    xcelium
    verilator
  ]
  reference: sail
}
  • dut is the main role. Its tool names the job, after the @.
  • Several tools for a role give a job for each. The config above gives testrig/<design>@xcelium and testrig/<design>@verilator. With several tools for more than one role there is a job for each combination, and a role other than dut that has several adds its tool to the name after a +, such as testrig/<design>@xcelium+imc.
  • The coverage reporter goes with the simulator. imc reads the databases Xcelium writes, and doris, doris’s own reporter, reads the file a Verilator run writes. With coverage left out, each job gets the one that reads its simulator’s. Binding one that can’t is an error when the job is planned: job `testrig/my_core@verilator` pairs simulator `verilator` with coverage reporter `imc`: `verilator` writes Verilator coverage databases, and `imc` only reads Cadence ones. A list for coverage gives every simulator a job with every reporter, and a pair that can’t work stops the plan. So leave coverage out, above all in a config with both simulators. The role is only used, and the pair only checked, in a job with dut.coverage.functional.
  • The coverage role is only used with dut.coverage.functional. Without it a job has no coverage step, and reporters bound to the role, however many, give no extra jobs.
  • A binding replaces the project file’s default for that role. See Tools and roles.

Simulators

SimulatorNeedsCoverage report
xceliumxrun and a licence. imc for coverageIMC’s, of the covergroups
verilatorVerilator with make and a C++ compiler: 5.048 is known to work, and 5.040 cannot compile UVM. A UVM library for a UVM testbenchdoris’s own, as text and HTML, of the cover properties instrument makes of the covergroups

Verilator has no UVM library. For a testbench with dut.uvm, the environment variable UVM_HOME names one Verilator can compile, such as the uvm-2017-1.0-vlt branch of chipsalliance/uvm-verilator: the directory holding src/uvm_pkg.sv. It is compiled with UVM_NO_DPI, so UVM’s command line options that need its DPI code, such as +UVM_PHASE_TRACE, do nothing. The variable’s value is part of the Verilator build step’s cache key, so pointing it at another library builds again. That it is set is a precheck of the build: doris check lists it, and a run without it stops before any step starts.

doris check testrig DESIGN lists everything a design’s jobs need of the machine: the programs, UVM_HOME, and with --replay the trace directory (see Checking the environment).

A testbench written for one simulator may need changes for the other. Verilator is a two-state simulator with no tristate ports, it does not wake a wait on some conditions read through a virtual interface, and processes that start at time 0 may run in another order, which shows up races another simulator hid.

What a config asks of a simulator is checked when the job is planned. Functional coverage, waves, DPI sources and UVM are each a feature a simulator has or lacks, and a job that needs one its simulator lacks fails in doris plan. Xcelium and Verilator have all four.

The job passes when every step passes. What that covers is on each step’s page. For the test result, see what passed means for the run step.

What the config file controls

The flow reads testrig.hjson (schema dv/testrig/1) next to or below the design’s design.hjson.

KeyUsed byEffect
archmodel, runISA string. Picks the model binary, and is passed to QCVEngine as -r
support_misalignedrunPasses -m to the reference model
tests.countrunGenerate mode: QCVEngine -n. Tests per test group, default 100
tests.includerunGenerate mode: QCVEngine -I, a regex of test groups to run
tests.excluderunGenerate mode: QCVEngine -x, a regex of test groups to leave out
tests.lengthrunQCVEngine -L, the maximum test length in instructions
tests.seedrunGenerate mode: QCVEngine --seed. A new seed every run if unset
replayrunReplay mode: the directory of saved traces, QCVEngine -d
timeoutrunWall-clock limit for the run step, such as 2h. No limit if unset
tagsSelectionLabels for the design’s TestRIG jobs, added to the design file’s tags. -i tag=GLOB and -x tag=GLOB select on them (see Filters). They are not part of any cache key
resources.<step>, resources.<step>@<tool>That stepWhat the step holds while it runs: threads, memory and disk, for every tool or for one. For run, its command’s share: QCVEngine’s. See Resource pools
resources.run.dut, resources.run.reference, each with @<tool>runWhat the simulator and the reference model hold, on top of run’s: threads and memory
tool.dutbuild, runThe simulators: xcelium, verilator. See Tools
tool.referencemodel, runThe reference model. Only sail exists
tool.coveragecoverageThe coverage reporter: imc or doris. Usually left out
reference.sourcemodelThe model’s source tree
engine.sourceengineThe QCVEngine source tree
dut.corefilelistThe FuseSoC core of the testbench
dut.topbuildThe top module
dut.definesbuild+define+ for each
dut.parametersbuildValues for parameters of the top module, by name
dut.dpibuildC and C++ sources of DPI code that the core does not name, relative to the config file
dut.uvmbuildCompile with UVM
dut.testrun+UVM_TESTNAME, and the coverage test name. Unset, no +UVM_TESTNAME is passed and the coverage test is test
dut.coverage.functionalbuild, runCollect functional coverage, and add the coverage step to report it
dut.coverage.scopesbuild, instrumentModules to collect coverage in (Xcelium’s -covdut in build, Verilator’s coverage in instrument)
dut.wavesbuild, runRecord the waves of the run. See Waves
tools.xcelium.build.argsbuildExtra xrun arguments for the build
tools.xcelium.run.argsrunExtra xrun arguments for the run
tools.verilator.commandbuildThe Verilator to simulate with, if it is not verilator
tools.verilator.build.argsbuildExtra Verilator arguments for the build
tools.verilator.run.argsrunExtra arguments for the simulation binary
tools.sail.model.argsmodelExtra arguments for make
tools.sail.run.argsrunExtra arguments for the emulator
tools.imc.coverage.argscoverageExtra imc arguments

A tool’s options are under its name and then the step it is used in, because a tool can be used in two steps with different arguments in each: xrun builds and runs. A tools.<name> table is read only by the jobs that tool is bound in, so a config has one for each simulator it names. doris, the Verilator coverage reporter, has no options. A table for a tool that can fill none of the flow’s roles, such as tools.slang, is an error.

tools.verilator is also where a lint config keeps Verilator’s options as a linter, so it accepts a lint table here too. TestRIG has no such step, and ignores it.

dut.parameters and dut.dpi. Each parameter becomes -defparam <dut.top>.<name>=<value> for Xcelium and -G<name>=<value> for Verilator. doris passes the value as text and adds no quoting, so a string parameter must carry the quotes its simulator wants. Each DPI source is given to the simulator with the filelist, and is an input of the build step, so an edit to one rebuilds. DPI code the testbench core already lists needs no entry. dut.parameters and dut.dpi have unit tests of the command lines only: neither has yet been run in a real Xcelium or Verilator.

An example

An example config, hw/ip/my_core/dv/testrig/testrig.hjson. It belongs to hw/ip/my_core/design.hjson, which names the design and gives its RTL core. TestRIG doesn’t use that core: dut.core is the testbench wrapper around it.

{
  schema: dv/testrig/1

  arch: rv64icxcheri
  support_misaligned: false
  tests: {
    count: 100
    exclude: unstructured
  }
  replay: regressions

  tool: {
    dut: xcelium
    reference: sail
  }

  reference: {
    source: ../../../../vendor/dv/sail-cheri-riscv
  }

  engine: {
    source: ../../../../vendor/dv/qcvengine
  }

  dut: {
    core: example::my_core_testrig
    top: my_core_testrig_tb_top
    uvm: true
    test: my_core_testrig_test
    defines: [
      XSIM
      DISABLE_OVERLAP_DETECTION
    ]
    coverage: {
      functional: true
      scopes: [
        isa_coverage
        alu_coverage
      ]
    }
  }

  tools: {
    xcelium: {
      build: {
        args: [
          -uvmhome
          CDNS-1.2
        ]
      }
    }
  }
}

Waves

dut.waves: true records the waves of the run. The build is made so that a run can record them, and the run does. The waves are an output of the run step, so they are kept in the cache with its other outputs.

SimulatorBuildRunWaves
xcelium-access +r, read access to every objectThe -input script opens an SHM database and probes every object, to any depthrun/dut/waves.shm/
verilator--trace-fst, and a waves source bound into the top module+doris_waves, which makes the waves source start the dumprun/dut/waves.fst

Every signal is recorded for the whole run, so the build and the run are slower and the waves can be large. Turn it on to look at a failure, with a seed or a replay that shows it, and off again after. Turning it on or off changes the build step’s command, so the testbench is built again.

Waves have been run for real in Verilator, and not in Xcelium. A Verilator job with dut.waves has run and written run/dut/waves.fst, complete though the simulation is stopped with SIGTERM. The Xcelium path has unit tests of the command lines only, so check the first such job by hand.

What the flow needs from the project

  • A QCVEngine with a --seed option. Upstream QCVEngine has none, so mocha adds it as a vendor patch.
  • QCVEngine’s Haskell dependencies in the dev shell. The engine is built offline. doris steps never use the network.
  • An arch with CHERI. Sail is built as the CHERI model only, and any other arch is an error when the job is planned.
  • A testbench core whose default target writes one flat filelist (see filelist). The list is compiled in one go, so that macros such as ASSERT are visible in every file.

Coming from the Makefile and testrig.py

The flow replaces the manual steps of mocha’s TestRIG README. Each becomes a step:

By handStep
make -C sail-cheri-riscv ARCH=RV64 rvfimodel
cabal install --offline in qcvengine/engine
fusesoc run --setup example::my_core_testrigfilelist, flatten
xrun -elaborate -snapshot workbuild
testrig.py -a sail -b my_core_coveragerun
imc -exec coverage/coverage_report.tclcoverage

Some things work differently:

  • testrig.py is not used. doris starts the model, the simulator and QCVEngine itself. It waits for each port to be listening where testrig.py sleeps for five seconds, and the xrun command line comes from doris, not from a patch to the vendored script.
  • Nothing is built in the source trees. The Sail Makefile and cabal build next to their sources, so each is given a copy of the tree in its step’s directory.
  • The run does not write into the build. xrun -R runs in a directory of its own that links to the snapshot.
  • The library path fixes are in doris. The build’s LD_LIBRARY_PATH and the run’s LD_PRELOAD of the system libstdc++ are set by doris when each step starts.
  • The IMC commands are in doris. The project’s coverage_report.tcl is not read. The coverage report is of one run, in that run’s job directory.
  • dvplan annotation is not run. The coverage step writes the report data dvplan reads. See the roadmap.

Generate and replay

The flow has two modes. They differ only in the arguments the run step gives QCVEngine.

  • Generate is the default. QCVEngine makes its tests from a seed, passed as --seed, and the same seed with the same arguments makes the same tests. The seed is --seed N on the command line if given, otherwise tests.seed from the config, otherwise one doris picks when it plans the job. --seed random asks for a picked seed even when the config sets one. The seed is an argument, so it is part of the cache key: a run with a seed it has had before is taken from the cache, and a run with a picked seed always runs. The seed is printed when the job ends and is seed in result.json, so a failure can be rerun with --seed. --seed can’t be combined with --replay.
  • Replay (--replay) reruns the traces in the replay directory. It is deterministic, so it is cached, with the trace directory as an input. tests.count, tests.include and tests.exclude are not used.

--tests N on the command line replaces tests.count for one run, for a shorter run while working on the flow without editing the config file. It can’t be combined with --replay.

Counterexamples

When a test fails, QCVEngine saves its shrunk trace in run/counterexamples/. That directory is emptied the next time the step runs, so when the job ends doris copies it to counterexamples/<id>/ in the job’s directory and records each file and its content in result.json. The ID is the first 16 characters of the run step’s cache key. Nothing is kept unless the run step completed in this job.

To rerun a saved failure, copy the traces into the config’s replay directory and use --replay. To rerun the whole generated run that found it, pass the seed from result.json as --seed.

Checking a run by hand

Work through these in the job’s directory after a run. They cover what doris does not check.

A step that passed leaves only its outputs, so some of the files named here are gone after a normal run: the logs of model, engine, filelist and build, and run/reference.log. Run the job with --debug to keep every step’s directory whole (see Working directories). The first --debug run after a plain one runs every step again:

doris run testrig my_core --debug

The run step’s own files that these checks read are outputs, and are there after any run: run/stdout.log, run/stats.txt, run/counterexamples/, the coverage data, and the simulator’s log. That log is run/dut/run.log for Xcelium and run/dut.log for Verilator, written $log below.

log=run/dut/run.log    # Xcelium; run/dut.log for Verilator
  1. Did every step run, with the code you expect? In result.json, check revision has no (dirty) and is the commit you meant, and look at each step’s cached and seconds. A cached step’s logs are from an earlier run. A build step that took a fraction of a second did no work.

    jq -r '.revision, (.steps[] | "\(.name)\t\(.outcome)\t\(.seconds)s\tcached=\(.cached)")' result.json
    
  2. Were the binaries built from the vendored sources? After a run with --debug, model/stdout.log and engine/stdout.log should show compilation, not Nothing to be done.

  3. Did QCVEngine talk to both sides? run/stdout.log starts with connected to implementation-A and connected to implementation-B. Read any WARNING after them: a trace version one side doesn’t support narrows what is compared.

  4. Which test groups ran, and how many tests? Each group that ran prints its name and +++ OK, passed N tests. Each one left out prints Warning: skipping .... Check the skipped list is what you expect for the ISA string.

    grep -c '^+++ OK, passed' run/stdout.log      # groups that ran
    grep 'skipping' run/stdout.log                # groups that did not
    grep -v '^+++ OK\|^Warning: skipping\| -- ' run/stdout.log   # anything else
    
  5. Did the simulator do the work? Each test starts with a reset, so the testbench should log at least one reset per test. After a run with --debug, or a failure, run/reference.log has one line per instruction the model executed, numbered from 0 within each test.

    grep -c 'Received reset command' "$log"
    
  6. Were the instructions the ones you care about? run/stats.txt counts each instruction QCVEngine saw, split by whether it trapped. The job’s report has the same counts under “Instructions”, and names the instructions that only ever trapped. Look for instructions that are missing, or that only ever trapped.

  7. Is the simulator log clean? doris does not look.

    grep -c 'UVM_ERROR\|UVM_FATAL' "$log"
    grep '\*E,\|\*F,' "$log" | cut -c1-200 | sort | uniq -c | sort -rn | head
    grep -o 'Assertion [^ ]* has failed' "$log" | sort | uniq -c | sort -rn
    
  8. How did the simulation end? For Xcelium, the end of the log should show Simulation received SIGTERM from doris, then the coverage files being written and xrun exiting. The UVM report summary and final phases do not run, because the testbench never ends the test itself.

  9. Is there coverage? run/dut/cov_work/scope/<dut.test>/ should hold a .ucd file written at the end of the run. coverage/detail.txt lists every bin with its hit count: check the bins not hit are ones this run could not have hit. The report is there when the run step failed too.

  10. No counterexamples? run/counterexamples/ is empty on a pass, and counterexamples in result.json is [].

A check that the flow can fail at all is worth doing once: break the design on purpose, for example by changing an ALU result, and confirm the job reports failed with a counterexample.

Lint

Lint runs linters over a design’s RTL, as described in the design’s FuseSoC core file: its lint target of the design’s core names the sources, the waiver files, the top module and each linter’s options, and the linter checks them. Any message it reports fails the design.

There are four linters. A design’s lint config names the ones to run, or leaves it to the project file, and each runs in a job of its own:

LinterProgramChecks
verilatorverilatorThe elaborated design: widths, unused and undriven signals, latches
veribleverible-verilog-lintStyle, one file at a time, without preprocessing or elaborating
slangslangThe elaborated design against the SystemVerilog standard, and warnings
ascentlintascentlintThe elaborated design against the rules of a policy, such as lowRISC’s. Commercial, from Real Intent

This page covers the steps the flow runs, its config, and how to check a run. Each step has its own page under Steps. Read Running flows first for how any step runs and what outcomes mean.

doris plan lint top_chip_system        # each job's steps as a tree, cached or will run
doris plan -v lint top_chip_system     # the steps and exact commands of each job
doris run lint                         # every design with a lint config, with each of its linters
doris run lint top_chip_system         # one design
doris run lint top_chip_system --until flatten
doris report lint                      # write the report pages again

The steps

Every job has the same three steps:

flowchart LR
    filelist --> flatten --> lint
    filelist --> lint
StepIn this flowProduces
filelistAsks FuseSoC for the lint target of the design’s core, for the job’s linterA copy of every source, and a description of the files
flattenMakes the linter’s arguments from the target’s files and optionsfilelist.f, and verible.flags for Verible
lintRuns the linter. The lint resultThe linter’s logs, and the messages parsed from them

There is one job per design, context and linter. A design on its own is lint/<design>@<linter>, in scratch/doris/lint/<design>@<linter>/. A design in a top’s context is lint/<top>/<design>@<linter>, in scratch/doris/lint/<top>.<design>@<linter>/: see Contexts. Every step is cached. The jobs of one design share nothing: FuseSoC is asked once per linter, because a core can keep filesets for one tool.

The job passes when every step passes. For the lint result, see what passed means for the lint step: in short, the linter read every source and reported no error and no warning.

What the config files control

The flow lints the core of the design’s design.hjson. A design with no core can’t have a lint config. The flow reads lint.hjson (schema dv/lint/1) next to or below the design file.

KeyFileUsed byEffect
coredesign.hjsonfilelistThe FuseSoC core to lint
topdesign.hjsonlintThe top module. If unset, the top is the toplevel of the core’s target
tool.linterlint.hjsonallThe linters: verilator, verible, slang, ascentlint. A name, or a list of names with a job each. If unset, the project file’s tool.lint.linter
targetlint.hjsonfilelistThe core’s target that describes a lint build. Default lint
mappingsdesign.hjsonfilelistFuseSoC --mapping for each: the core to use where a virtual core has several providers
scopedesign.hjsonalltop makes the design a top, which other designs are linted in the context of
mappingslint.hjsonfilelistMore mappings, for lint only, after the top’s and the design’s
timeoutlint.hjsonlintWall-clock limit for each lint step, such as 30m. No limit if unset
tagsdesign.hjson, lint.hjsonSelectionLabels that -i tag=GLOB and -x tag=GLOB select on (see Filters). The design file’s are every job’s, and the lint config’s are added for its lint jobs. They are not part of any cache key
resources.<step>, resources.<step>@<tool>lint.hjsonThat stepWhat the step holds while it runs: threads, memory and disk, for every tool or for one. See Resource pools
tools.verilator.commandlint.hjsonlintThe Verilator to lint with, if it is not verilator
tools.verilator.lint.argslint.hjsonlintExtra Verilator arguments, after the target’s options
tools.verible.lint.argslint.hjsonlintExtra verible-verilog-lint arguments, after the flag file
tools.slang.lint.argslint.hjsonlintExtra slang arguments, after the target’s options
tools.ascentlint.lint.argslint.hjsonlintExtra AscentLint arguments, before the target’s options

A config for a design whose core has a lint target:

{
  schema: dv/lint/1

  tool: {
    linter: [
      verilator
      verible
      slang
    ]
  }
}

Lint has one role, linter, and tool.linter binds the linters to it. A name by itself binds one:

tool: {
  linter: verilator
}

A project whose designs all use the same linters can name them once, as tool.lint.linter in the project file. A lint config then needs only its schema, and one that sets tool.linter has its own list in place of the project’s. A design with no linter from either file is an error when config loads.

A tools.<name> table gives a linter options the core’s target does not, under the linter’s name and then the step’s. It is read only by that linter’s job:

tools: {
  slang: {
    lint: {
      args: [
        -Wextra
      ]
    }
  }
}

A table for a tool that is not a linter, such as tools.xcelium, is an error. tools.verilator is also where a TestRIG config keeps the simulator’s options, so it accepts build and run tables here too. Lint has no such steps, and ignores them.

Contexts

A design is linted once for each context it has (see Tops and contexts):

DesignJobsFuseSoC mappings
A toplint/earlgrey@verilatorThe top’s, then its lint.hjson’s
A top’s ownlint/earlgrey/pwrmgr@verilatorThe top’s, the design’s, its lint.hjson’s
Shared, used by two topslint/earlgrey/uart@verilator and lint/darjeeling/uart@verilatorEach top’s, the design’s, its lint.hjson’s
Shared, used by no toplint/spare@verilatorThe design’s, then its lint.hjson’s

A block is linted in a top’s context as well as by the top’s own lint job because the two see different things. The top’s job elaborates the block with the parameters the top gives it. The block’s job elaborates it by itself, with its default parameters and the top’s packages.

doris run lint uart                 # uart in every top that uses it
doris run lint earlgrey/uart        # uart in Earl Grey's context only
doris run lint --top earlgrey       # Earl Grey, its own designs, and the shared designs it uses
doris run lint pwrmgr               # an error if two tops have one: give earlgrey/pwrmgr

The same work is not done twice. Each context is a job of its own, with its own FuseSoC step, because the mappings are part of that step’s command. If two tops resolve a design to the same sources and options, the flatten and lint steps have the same cache key, and the second job takes them from the cache. If they differ, the design really is a different build in each top, and both are linted.

What the core file controls

Everything else comes from the core file, so the same description serves doris and FuseSoC run directly. Arguments a config adds with tools.<linter>.lint.args come after the core file’s on the command line. FuseSoC is asked for the target once per linter, with --tool set, so a fileset can be kept for one linter with a tool_<name> ? condition:

filesets:
  files_verilator_waiver:
    files:
      - lint/top_chip_system.vlt
    file_type: vlt

  files_veriblelint_waiver:
    files:
      - lint/top_chip_system.vbl
    file_type: veribleLintWaiver

  files_ascentlint_waiver:
    files:
      - lint/top_chip_system.waiver
    file_type: waiver

targets:
  lint:
    filesets:
      - tool_verilator ? (files_verilator_waiver)
      - tool_veriblelint ? (files_veriblelint_waiver)
      - tool_ascentlint ? (files_ascentlint_waiver)
      - files_rtl
    toplevel: top_chip_system
    default_tool: verilator
    parameters:
      - SYNTHESIS=true
    tools:
      verilator:
        mode: lint-only
        verilator_options:
          - "-Wall"
      veriblelint:
        ruleset: default
        rules:
          - "-line-length"
      slang:
        slang_options:
          - "--single-unit"
          - "-Wextra"
LinterFuseSoC --toolWaiversOptions of the target
verilatorverilatorFiles of type vltverilator_options
veribleveriblelintFiles of type veribleLintWaiverruleset, rules, verible_lint_args, and one file of type veribleLintRules
slangslangNone. Use slang_options or pragmasslang_options
ascentlintascentlintFiles of type waiver, Tcl the run script sourcesascentlint_options, and files of type tclSource, such as one that loads the policy
  • Waivers and rules files are files of the target’s filesets, the design’s own and those of every core it depends on. doris has no waiver list of its own. A shared core, such as lowrisc:lint:common, can bring a style rules file and common Verible waivers to every core that depends on it.
  • Options come from every core. FuseSoC adds to the options of the design’s own target those of each core it depends on, from that core’s default target. lowrisc:lint:common gives AscentLint -wait_license and -stop_on_error this way, so a design that depends on it needs no AscentLint options of its own.
  • Which checks run is decided by those options. Without -Wall, Verilator reports only its default warnings. Without -Wextra or other -W options, slang reports its default ones.
  • slang needs --single-unit for most FuseSoC cores. By default slang compiles each file by itself, so a macro defined in one file is unknown in the next. FuseSoC orders the files for one compilation unit, which is what Verilator and the simulators assume.
  • AscentLint checks only what its policy names. The run script loads none: a file of type tclSource, such as ascentlint-config.tcl in OpenTitan’s lowrisc:lint:common, sources the policy and sets its limits. Without one, AscentLint checks its default rules.
  • A mapping names a whole core, version included, such as lowrisc:prim_generic:all:0.1. Without one, a virtual core such as lowrisc:prim:flop gets whichever provider FuseSoC finds, which may be an FPGA library.

How these become the linter’s command line is on the flatten page.

The result

result.json has messages: each one’s severity (error or warning), rule (such as WIDTHEXPAND, line-length or width-trunc, absent for a message that belongs to no rule), file, line, column and text. errors and warnings count them. tool.linter names the linter, and versions has its version and FuseSoC’s. context names the top a shared design was linted in the context of, and is absent for a design linted on its own. linted is false if the lint step did not complete, and the counts then say nothing.

A message’s file is relative to the job’s directory, such as filelist/work/src/<core>/rtl/<file>.sv. That is the copy FuseSoC made, which is the file the linter read. The path after src/<core>/ is the file’s path below the directory of its core file. AscentLint’s report names a file by its name only, so doris names the copied source with that name. If two sources have the name, or none does, file is the name as the report gave it.

Checking a run by hand

Work through these in a job’s directory after a run. The linter’s logs are outputs of the lint step, so they are there after any run. Every other log is deleted when its step passes (see Working directories).

  1. Did the lint step run, with the code you expect? In result.json, check revision, and each step’s cached. A cached lint step’s log is from an earlier run with the same sources and options.

    jq -r '.revision, (.steps[] | "\(.name)\t\(.outcome)\t\(.seconds)s\tcached=\(.cached)")' result.json
    
  2. Were the right cores linted? See filelist: filelist/stderr.log lists them. That log is not an output of the step, so it is only there after a run with --debug: doris run lint DESIGN --debug. The copied sources in filelist/work/src/ are always there.

  3. Were the right options and waivers used? See flatten: read flatten/filelist.f, and flatten/verible.flags for Verible, and flatten/ascentlint.tcl and flatten/ascentlint.flags for AscentLint.

  4. Do the counts match the log? See lint.

  5. Does FuseSoC’s own flow agree? It should report the same messages:

    fusesoc --cores-root hw run --target=lint --tool=verilator --work-root /tmp/lint <core>
    fusesoc --cores-root hw run --target=lint --tool=veriblelint --work-root /tmp/lint <core>
    fusesoc --cores-root hw run --target=lint --tool=slang --work-root /tmp/lint <core>
    fusesoc --cores-root hw run --target=lint --tool=ascentlint --work-root /tmp/lint <core>
    

A check that the flow can fail at all is worth doing once: add an unused signal to the design and confirm the Verilator job reports failed with an UNUSEDSIGNAL warning. Don’t name it unused: Verilator leaves out signals whose name contains that.

Limits

  • doris run lint DESIGN runs every linter bound for the design. --tool keeps the jobs of one.
  • Options are not checked against the steps a linter has. tools.verilator.build is accepted in a lint config and ignored. See Tool capabilities in the roadmap.
  • Which tops use a design is read from the core files, not asked of FuseSoC, so a design reached only through a virtual core with several providers is linted on its own. See Tops and contexts.
  • Each context is its own job and result. Two tops that resolve a design to the same sources share the cached lint step, but the design still has a job and a report row for each.
  • Waived messages are not in the result. The linter applies the waivers, so doris never sees a waived message.
  • Each design needs its own config files: a design.hjson and a lint.hjson.

The roadmap covers what is planned for each.

CDC and RDC

CDC and RDC check a design’s domain crossings: CDC each signal that crosses from one clock domain to another, and RDC each path from a flop of one reset to a flop of another. A checker reads the design’s RTL, as the syn target of its FuseSoC core describes it, and its timing constraints, which say what the clocks are. It then checks every crossing against its rules, and reports each violation that no waiver matches. By default, a violation that needs looking at fails the design.

The two are separate flows, cdc and rdc, with a config file and a job each. They share everything but the checker and RDC’s reset scenarios, so this page covers both.

FlowCheckerProgramChecks
cdcmeridiancdcmcdcClock domain crossings: synchronizers, reconvergence, glitches. Commercial, Real Intent
rdcmeridianrdcmrdcReset domain crossings, in each reset scenario. Commercial, Real Intent
doris plan cdc chip_earlgrey_asic       # the job's steps as a tree
doris plan -v rdc chip_earlgrey_asic    # the steps and exact commands
doris run cdc                           # every design with a CDC config
doris run rdc chip_earlgrey_asic --until script   # only write the run script, to read it
doris report cdc                        # write the report pages again

The steps

flowchart LR
    filelist --> flatten --> check["cdc or rdc"]
    filelist --> check
    script --> check
StepIn this flowProduces
filelistAsks FuseSoC for the syn target of the design’s coreA copy of every source
flattenRebases the target’s .scr filelistfilelist.f
scriptWrites the checker’s run script from the config. Not there with script setscript/run.tcl
cdc or rdcRuns the checker on the script. The resultThe checker’s reports, and the findings parsed from them

There is one job per design, context and checker: cdc/<design>@meridiancdc, in scratch/doris/cdc/<design>@meridiancdc/, and cdc/<top>/<design>@meridiancdc for a design in a top’s context, as lint’s contexts are. Every step is cached. The run script is an output of its own step, so changing a waiver runs the check again without writing the script again, and changing an option of the script writes it again.

What the config files control

The flow checks the core of the design’s design.hjson, elaborated as its top: a design needs both. The flow reads cdc.hjson (schema dv/cdc/1) or rdc.hjson (schema dv/rdc/1) next to or below the design file. Paths are relative to the config file.

KeyUsed byEffect
tool.checkerallThe checker: meridiancdc for CDC, meridianrdc for RDC. If unset, the project file’s tool.cdc.checker or tool.rdc.checker
targetfilelistThe core’s target that describes the design as it is built. Default syn. Its tool must write one flat filelist, as icarus does
mappingsfilelistMore FuseSoC mappings, after the top’s and the design’s
definesscriptMacros defined when the design is read, such as AST_BYPASS_CLK
parametersscriptValues for parameters of the top module, by name
variablesscriptTcl variables set before anything is read, by name: switches the constraints read, such as OpenTitan’s IS_CDC_RUN, and the checker’s ri_ settings
constraintsscriptSDC files: the clocks and what is asynchronous. A check without them knows no clocks
env_linesscriptLines of an environment file of the run’s own, read after the constraints
env_filesscriptEnvironment files: intent beyond the constraints, such as constants and extra resets
config_scriptsscriptTcl sourced once the intent is analysed
black_boxesscriptModules elaborated as black boxes, such as a clock gate whose technology cell is not in the RTL
synchronizersscriptModules that synchronise a signal into a clock domain, such as a two-flop synchronizer
reset_synchronizersscriptModules that synchronise a reset
reset_scenariosscriptRDC only. Tcl that sets the reset scenarios to check. Without it, the scenarios the checker works out
wavesscriptRDC only. Write a waveform of each violation
waiversscriptTcl that waives findings, sourced after the check
readscheckOther files the scripts read, such as the files a waiver script sources. Part of the check’s key, so a change to one runs it again
scriptcheckThe project’s own run script, in place of the checker’s. See A project’s own script
fail_oncheckThe levels that fail the design, of error, warning, review and info. Default error, warning, review. Empty, a check reports and fails nothing
timeoutcheckWall-clock limit for the check, such as "12h". No limit if unset
resources.<step>That stepWhat the step holds while it runs. A chip-level check needs a lot of memory
tagsSelectionLabels for the design’s jobs of the flow
tools.meridiancdc.check.args, tools.meridianrdc.check.argscheckExtra arguments for the program
tools.<checker>.reportcheckThe report to parse, relative to the check step’s directory, for a project script that writes it elsewhere
tools.<checker>.ignored_warningscheckNumbers of log warnings that are not findings. Default OpenTitan’s: unused signals and ports, constants, and a few others

A config for a chip:

{
  schema: dv/cdc/1
  tool: {
    checker: meridiancdc
  }
  constraints: [
    ../syn/chip.sdc
  ]
  synchronizers: [
    prim_flop_2sync
  ]
  reset_synchronizers: [
    prim_rst_sync
  ]
  black_boxes: [
    prim_clock_gating
  ]
  waivers: [
    cdc_waivers.tcl
  ]
  timeout: "12h"
  resources: {
    cdc: {
      memory: "64G"
    }
  }
}

Every file the check reads is part of its key: the constraints, environment files, scripts, waivers, reset scenarios and reads. A file one of them sources is not seen unless reads names it.

The run script

The script step writes script/run.tcl, which tells the checker what to do. Its stages are those of OpenTitan’s run-cdc.tcl and run-rdc.tcl, with what those scripts hard-code taken from the config:

  1. Set <KIND>_WAIVER_DIR to the first waiver’s directory, as OpenTitan’s scripts do, then the config’s variables.
  2. analyze -sverilog the filelist, with the defines, and elaborate the top, with the parameters and black_boxes.
  3. Name the synchronizers: set_user_cntl_synchronizer and set_user_reset_synchronizer for CDC, and set_rdc_user_defined_sync_cell for RDC.
  4. read_sdc the constraints into an environment file, then read_env it, the env_lines and the env_files, and analyze_intent. Source the config_scripts.
  5. CDC: report the setup checks and verify_cdc. RDC: write the scenarios the checker works out to reports/reset_scenarios.tcl, source the config’s reset_scenarios or those, and verify_rdc.
  6. Source the waivers, and report_policy -compat the ALL, NEW and WAIVED policies to reports/<kind>.<policy>.rpt. CDC also reports its clock domains.

Paths in the script are relative to the check step’s directory, where the checker runs, so the script, and its key, are the same in every checkout. doris run cdc DESIGN --until script writes it without running the checker.

A project’s own script

With script set, there is no script step: the checker runs the project’s script. It is given what OpenTitan’s scripts read from the environment: SV_FLIST, BUILD_DIR, DUT, PARAMS (NAME=VALUE words), CONSTRAINT (the files, as words), ENV_FILE, CDC_WAIVER_FILE or RDC_WAIVER_FILE, USER_CONFIG_FILE (CDC), RESET_SCENARIO_FILE and WAVES (RDC), and FOUNDRY_ROOT and FOUNDRY_CONSTRAINT, empty. Each of the environment, waiver and configuration files can be only one. The script runs in the check step’s directory, and its NEW report must be at reports/<kind>.new.rpt, or where tools.<checker>.report says.

The result

result.json has rules, from the summary of the ALL report, which is the only one with the rules every violation of which was waived: each rule’s name, category (such as cdc, rdc, setup or sdc), level, and total, new and waived counts. messages are the findings: what the log says, with the category flow, then each violation no waiver matched, from the NEW report, with its rule and text. A violation is one RuleDataId of its rule: the report gives one row for each thing it involves, such as each flop a reset reaches, and the first row’s columns are its text. counts counts the messages by level, and fail_on says which levels fail. checked is false if the check step did not complete, and reported is false if the checker wrote no report: the counts then say nothing.

What passed means

CheckIf it fails
The checker was not killed by a signal, and finished within the timeoutstep error
Its log has no licensing errorstep error
It wrote its report, and the report has the summary of the NEW policystep error
It did not exit non-zero without a finding that fails itstep error
No finding of a level in fail_onfailed

The checker’s exit code is not taken to say what it found: its report decides. A finding is a violation in the report, or an error or warning in the log: a line that starts Error: , ERROR, ERR, Warning: or WARN, with the indented : ... lines under it that say what it is. A log warning whose number is in ignored_warnings is not one, and the log’s infos, one for each file read, are not findings.

Checking a run by hand

  1. Read the run script. script/run.tcl is what the checker was told: the files it read, the synchronizers, the black boxes and the waivers.

  2. Does the parse agree with the report? Each rule’s new count in result.json should be the number of its violations in messages. If it is not, the report’s details have a violation on more than one line, or none, and the counts are wrong. This is the first thing to check on a new release of the checker.

    jq -r '.rules[] as $r | "\($r.name)\t\($r.new)\t\([.messages[] | select(.rule == $r.name)] | length)"' result.json
    
  3. Read the reports. cdc/reports/ or rdc/reports/ has each policy’s report, which has every violation in full.

Limits

  • A synchronizer must be in the design. Meridian stops on a synchronizers or reset_synchronizers module the design does not have, and the step is a step error naming it.
  • Only Meridian. The capabilities, a CDC checker and an RDC checker, are tool-neutral, but Meridian is the only checker.
  • Raw output is licensed. Real Intent’s licence restricts sharing a checker’s raw output, and the result file holds its findings.

The roadmap covers what is planned.

Steps

A flow is a graph of steps. This part has one page per step: the command, what it reads and writes, what its cache key covers, what passed means for it, and what to check by hand. The flow pages say which steps a flow runs, in what order, and with what from its config.

Read Running flows first for how any step runs and what outcomes mean.

StepDoesUsed by
filelistAsks FuseSoC for a core’s sourcesTestRIG, Lint
flattenMakes one argument file from what FuseSoC wroteTestRIG, Lint
modelBuilds the reference modelTestRIG
engineBuilds QCVEngineTestRIG
instrumentPrepares the sources a Verilator build usesTestRIG
buildCompiles and elaborates a testbench in a simulatorTestRIG
runRuns QCVEngine against the reference model and the designTestRIG
coverageReports on the coverage a run collectedTestRIG
lintRuns a linter on the sourcesLint
scriptWrites a checker’s run script from the configCDC and RDC
cdc, rdcRuns a crossing checker on the run scriptCDC and RDC

A step used by two flows is not shared between them

filelist and flatten are each one piece of doris that both flows use. A flow gives the step its own arguments, and every job runs the step in its own directory:

scratch/doris/testrig/my_core@xcelium/filelist/
scratch/doris/lint/top_chip_system@verilator/filelist/
scratch/doris/lint/top_chip_system@verible/filelist/

Those three ask FuseSoC for different things, so they have different cache keys and none of them reuses another’s result. A result is reused only when two steps have the same key: the same command, the same inputs and the same tool versions.

On these pages, paths are relative to the job’s directory, scratch/doris/<flow>/<job>/. doris plan -v FLOW DESIGN prints the real commands.

What is left in a step’s directory

Each page names the step’s outputs. After a normal run, a step that passed has those in its directory and nothing else: its stdout.log, stderr.log and scratch files are deleted when it ends, unless they are outputs. A step that failed or did not complete keeps everything.

So a page’s “To check by hand” says where a file it names is not an output. To read such a file for a step that passed, run the job with --debug, which keeps every step’s whole directory and runs again any step whose cache entry a plain run stored:

doris run testrig my_core --debug

Working directories has the rules, and doris clean to remove what a debug run kept.

StepOutputs, kept after a passNot outputs: there after a failure, or with --debug
filelistwork/stdout.log, stderr.log
flattenfilelist.f, verible.flagsNothing: it writes nothing else
modelThe emulator binarystdout.log, stderr.log, the rest of the copied source tree
enginebin/QCVEnginestdout.log, stderr.log, the copied source tree
instrumentfilelist.f, src/, doris_support.cc, unsupported.txtNothing: it writes nothing else
buildXcelium: xcelium.d/. Verilator: obj_dir/simstdout.log, stderr.log. Xcelium: build.log, a debug output, and build.history, xmsc.log. Verilator: the rest of obj_dir/
runstats.txt, stdout.log, the simulator’s log, counterexamples/, the coverage data, the wavesstderr.log, reference.log, and for Xcelium dut.log
coverageThe reportsFor IMC: stdout.log, stderr.log
lintThe logs the messages are read fromFor Verilator: stdout.log

filelist

Asks FuseSoC for a core’s sources, as one EDA tool sees them. Used by TestRIG for the testbench and by Lint for the design, once per linter.

Depends onNothing
InputEvery directory in the project’s cores_root, such as hw
Commandfusesoc --cores-root hw run --setup --target=<target> [--tool=<tool>] [--mapping=<core>] --work-root filelist/work <core>
Outputfilelist/work/: a copy of every source file under src/, and the tool’s files
Key toolsfusesoc, by the version fusesoc --version prints, and the hash of the FuseSoC plugin that plans the command
Passes whenfusesoc exits 0 and filelist/work/ exists

--setup resolves the core and its dependencies, copies their files into the work root and writes the EDA tool’s files. Nothing is compiled and no tool is run.

What each flow asks for

FlowCoreTarget--tool--mapping
TestRIGdut.core, the testbenchdefaultNot passed: the target’s own default_toolNone
Lintcore of the design’s own filetarget of the config, lintThe linter’s: see belowEach of mappings

What FuseSoC writes

Besides the sources, what is in filelist/work/ depends on the tool. The flatten step reads it.

ToolFilesWritten by
The target’s own (TestRIG)One flat .scr filelistEdalize’s backend for that tool, such as vcs
verilator (lint with Verilator)A .vc argument file, and config.mkEdalize’s Verilator backend
veriblelint, slang (lint with either)Only <core>.eda.yml, the EDAM fileFuseSoC, for every tool
ascentlint (lint with AscentLint)sources.f, run-ascentlint.tcl and a Makefile, and the EDAM fileEdalize’s AscentLint backend
  • TestRIG’s target must use a tool whose backend writes one flat .scr filelist, such as vcs. The simulator that compiles it need not be that tool.
  • The EDAM file lists each file with its type, the target’s parameters, its top module and its options for each tool. Edalize’s Verible and slang backends write nothing at setup. They make the command line from the EDAM when they run the tool, and the flatten step does the same. AscentLint’s backend writes its filelist and run script at setup. The flatten step rebases the filelist, and makes the script again from the EDAM.
  • Filesets can depend on the tool. A core keeps a fileset for one tool with a tool_<name> ? condition, such as a linter’s waiver files. So the sources of two jobs with different tools can differ.

The cache key

The key covers everything under the cores roots, because any file there could be a core file or a source. That is coarse, but the step is quick. Later steps are keyed on filelist/work/ itself, so an edit to a file the core doesn’t use reruns this step and nothing after it.

To check by hand

filelist/stderr.log lists each core FuseSoC prepared, ending with the core that was asked for. The log is not an output of the step, so it is only there after a run with --debug, or if the step did not pass (see What is left in a step’s directory).

  • Check the versions it picked are the ones you expect.
  • Where the design leaves cores virtual, check the providers are the ones you mean, such as lowrisc:prim_generic:flop and not lowrisc:prim_xilinx:flop.

The files later steps read are the copies in filelist/work/src/, not the files in the repo, so paths in tool messages point there.

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.

instrument

Makes the filelist a Verilator build uses: the flattened one, with a support source added, for coverage each covergroup bin written again as a cover property, and for waves a source that starts the dump. Used by TestRIG in a Verilator job. An Xcelium job has no such step. This is a function inside doris, not a command, so there are no logs.

Depends onfilelist (the sources) and flatten (the list naming them)
Outputsinstrument/filelist.f, instrument/src/, instrument/doris_support.cc, instrument/unsupported.txt
Passes whenThe filelist was read and the outputs were written

The cache key covers the sources and the flattened filelist, as outputs of the steps it reads, and what the step was asked for: the coverage scopes, or that there is no functional coverage, and the top module the waves source is bound into, or that there are no waves. So changing dut.coverage.scopes or dut.waves runs the step again. The step is the Verilator plugin’s, so its hash is in the key too, and a new plugin runs the step again.

The support source

doris_support.cc is added to every Verilator build. A TestRIG testbench runs until it is stopped, and Verilator only writes coverage when its main() is told to. So the source installs a handler for SIGTERM and SIGINT that writes the coverage collected so far to coverage.dat in the working directory and exits with code 0. It also makes standard output line buffered, so the log keeps up with the run.

The handler does the work itself rather than asking the simulation loop to stop, because the testbench can be blocked in DPI code waiting for its peer and never return to the loop. final blocks and UVM’s report summary do not run.

The waves source

With dut.waves set, the step writes instrument/src/doris_waves.sv and adds it to the filelist, after the testbench’s sources:

module doris_waves;
  initial begin
    if ($test$plusargs("doris_waves")) begin
      $dumpfile("waves.fst");
      $dumpvars;
    end
  end
endmodule

bind <dut.top> doris_waves doris_waves_i ();

The module is bound into the top module, so the testbench needs no change. A simulation built with it records waves only when it is given the +doris_waves plusarg, which the run step passes. The file is written in the run’s working directory, run/dut/waves.fst. The build needs --trace-fst, which the build step adds.

This has been built and run in a real Verilator, 5.040: the run wrote run/dut/waves.fst.

Covergroups as cover properties

Verilator parses covergroups and ignores them. It does count concurrent cover properties, with --coverage-user. So with dut.coverage.functional set, each source in the filelist that has covergroups is copied to instrument/src/ with a cover property added for each bin, and the filelist names the copy. The covergroups are left in the copy. The original’s directory is added as an include directory, for files the source includes from beside itself.

covergroup cg_itype @(posedge clk_i iff (rvfi_valid_i && rst_ni));
  cp_r_type: coverpoint {funct7, funct3} iff (opcode == 7'b0110011) {
    bins ADD = {10'b0000000_000};
  }
endgroup

becomes, before the module’s endmodule:

doris_cov__isa_coverage__cg_itype__cp_r_type__ADD: cover property (@(posedge clk_i)
    ((rvfi_valid_i && rst_ni)) && (opcode == 7'b0110011) && ((({funct7, funct3}) inside {10'b0000000_000})));

The name holds the module, covergroup, coverpoint and bin. The coverage step reads them back from it.

With dut.coverage.scopes set, only the covergroups of those modules are rewritten, as -covdut limits Xcelium.

What is not rewritten

Only what a cover property of that form can say is rewritten. Each thing left out is a line of instrument/unsupported.txt, and has no bins in the coverage report, so the totals are lower than Xcelium’s for the same testbench.

ConstructWhat happens
bins X = defaultLeft out, silently: it is not part of coverage
A crossListed
illegal_bins and ignore_binsListed. An illegal value is not an error
Bins with [], a transition (=>), with, or their own iffListed
A coverpoint with no label, or with automatic binsListed
A covergroup not sampled as @(posedge clk) or @(negedge clk), such as one sampled with sample()Listed
A covergroup in a class or a packageListed
A name with __ in itListed: __ separates the parts of the name

A cover property counts whether or not the covergroup has an instance, so a covergroup that is declared and never constructed still reports coverage here. Options such as option.weight and option.at_least are not used: a bin is covered when it is hit once.

To check by hand

instrument/unsupported.txt is empty. grep -c 'cover property' instrument/src/* gives the number of bins per source, which is the total the coverage report shows.

model

Builds the reference model with its RVFI-DII interface. Used by TestRIG. The only reference model is Sail.

Depends onNothing
Inputreference.source, such as hw/vendor/dv/sail-cheri-riscv
StagingCopies the source tree to model/src/
Commandmake -C model/src ARCH=RV64 rvfi [<args>], run in model/
Needsmake, and sail, z3 and gcc, which the Makefile calls
Outputmodel/src/c_emulator/cheri_riscv_rvfi_RV64
Key toolssail, by the version sail --version prints, and gcc, by gcc -dumpfullversion
Passes whenmake exits 0 and the emulator binary exists

The Sail Makefile builds next to its sources, so it is given a copy. The repo’s tree is not written to, and a binary already built in the vendored tree is not picked up, because only files git would track are copied. ARCH is RV32 or RV64 from arch. The binary name gets the cheri_ prefix when arch has the xcheri extension, and only the CHERI model is supported so far. <args> is tools.sail.model.args, as given: arguments for make, such as a variable the Makefile reads.

sail is keyed by the Sail compiler’s version. The model itself is a source tree, keyed by its content as the step’s input.

To check by hand

The step’s only output is the emulator binary. Its logs and the rest of model/src/ are deleted when it passes, so check it after a run with --debug (see What is left in a step’s directory).

model/stdout.log should show the Sail compiler and gcc running. make: Nothing to be done for 'rvfi' means nothing was built and the binary came from somewhere else. z3 is not a key tool, so a new z3 does not cause a rebuild.

engine

Builds QuickCheckVEngine (QCVEngine) from its vendored source. Used by TestRIG.

Depends onNothing
Inputengine.source, such as hw/vendor/dv/qcvengine
StagingCopies the source tree to engine/src/
Commandcabal install --offline --install-method=copy --overwrite-policy=always --installdir=engine/bin --jobs=<threads>, run in engine/src/
Needscabal, ghc
Outputengine/bin/QCVEngine
Key toolscabal and ghc, each by the version its --numeric-version prints
Passes whencabal exits 0 and the binary exists

--offline means cabal never fetches. QCVEngine’s Haskell dependencies must come from the dev shell’s GHC package set. They are not a declared input and not a key tool, so a changed dependency with the same GHC version does not cause a rebuild.

To check by hand

The step’s only output is the binary. Its logs and engine/src/ are deleted when it passes, so check it after a run with --debug (see What is left in a step’s directory).

engine/stdout.log should show modules compiling and end with Copying 'QCVEngine' to .... cabal keeps its own store in ~/.cabal or ~/.local/state/cabal, outside the step’s directory, so parts of the build can come from there.

build

Compiles and elaborates a testbench into a simulation snapshot. Used by TestRIG. The simulators are Xcelium and Verilator, and the step differs for each.

Xcelium

Depends onfilelist (the sources) and flatten (the list naming them)
InputEach source in dut.dpi
Commandxrun -64bit -sv -licqueue -elaborate -snapshot snapshot -l build.log ... -f flatten/filelist.f -top <dut.top>, run in build/
Outputbuild/xcelium.d/, the library holding the snapshot
Debug outputbuild/build.log, Xcelium’s log of the build. Kept, and cached, only in a run with --debug
Prechecksxrun on PATH
Key toolsxcelium, by the version xrun -version prints
Passes whenxrun exits 0, and build/xcelium.d/ and build/build.log exist

The arguments between -l build.log and -f, in order:

ArgumentFrom
-uvmdut.uvm
-coverage functionaldut.coverage.functional
-covdut <scope> for eachdut.coverage.scopes
-covworkdir cov_work -covoverwriteAny dut.coverage section
-access +rdut.waves
+define+XCELIUMAlways
+define+<name> for eachdut.defines
-defparam <dut.top>.<name>=<value> for eachdut.parameters
The arguments as giventools.xcelium.build.args

Each source in dut.dpi comes after the filelist, before -top: xrun compiles the C and C++ sources it is given with the design.

-elaborate stops after elaboration, so nothing is simulated. -licqueue waits for a licence rather than failing. DPI C++, in the filelist or from dut.dpi, is compiled here, by Xcelium’s bundled g++. doris puts /usr/lib64 and /lib64 in front of LD_LIBRARY_PATH, where they exist, so the DPI code links against the host’s system libraries.

-access +r gives read access to every object, which the run needs to record waves. The -access and -defparam arguments, and dut.dpi sources, have unit tests only: they have not yet been run in a real Xcelium.

To check by hand

A build that passed leaves only build/xcelium.d/. Run with --debug to keep the files named here (see What is left in a step’s directory). build.log is a debug output, so a debug run also keeps it in the cache.

build/build.log ends with the design hierarchy summary and no *E or *F lines. Read its *W warnings once: doris does not. build/build.history records the exact xrun command line Xcelium saw. build/xmsc.log shows the DPI compile.

Verilator

Depends onfilelist (the sources), flatten and instrument (the list naming them)
InputEach source in dut.dpi
Commandverilator --binary --timing -j <threads> --Mdir obj_dir -o sim ... -f instrument/filelist.f --top-module <dut.top>, run in build/
Outputbuild/obj_dir/sim, the simulation binary
Prechecksverilator and make on PATH. With dut.uvm: UVM_HOME is set
Key toolsverilator, by the version verilator --version prints and the value of UVM_HOME
Passes whenVerilator exits 0 and build/obj_dir/sim exists

verilator is tools.verilator.command if the config sets it, for the command and for the version. The arguments between -o sim and -f, in order:

ArgumentFrom
+define+UVM_NO_DPI +incdir+$UVM_HOME/src $UVM_HOME/src/uvm_pkg.svdut.uvm
--coverage-user -Wno-COVERIGNdut.coverage.functional
--trace-fstdut.waves
+define+<name> for eachdut.defines
-G<name>=<value> for eachdut.parameters
The arguments as giventools.verilator.build.args

Each source in dut.dpi comes after the filelist, before --top-module: Verilator compiles the C and C++ sources it is given into the binary.

--binary makes Verilator write a main() and compile everything, with make and the C++ compiler on the path. -j <threads> gives both the threads the step holds, which resources.build.threads can set. --timing is needed for delays and event controls. DPI C++, in the filelist or from dut.dpi, is compiled into the binary, as is the support source doris adds.

$UVM_HOME is passed as written: Verilator puts the variable’s value in itself. So the plan is the same on every machine. Which library it names does change the build, so Verilator as a simulator names UVM_HOME as a host variable that is part of the cache key: its value, or that it is not set. That holds for every Verilator build, with dut.uvm or without, so changing the variable rebuilds a testbench that does not use UVM too. A build with dut.uvm has a precheck that the variable is set, so a run without it stops before any step starts, and doris check lists it.

Verilator defines VERILATOR itself. Nothing like +define+XCELIUM is added.

--trace-fst builds the simulation so that it can write waves in FST format. The waves source the instrument step adds starts the dump when the run asks for it. A build with --trace-fst has been run in a real Verilator, 5.040. -G and dut.dpi sources have unit tests only: they have not yet been run in a real Verilator.

Warnings stop a Verilator build unless they are turned off. A testbench is not written to be lint clean, so its config usually passes -Wno-fatal in tools.verilator.build.args. A few checks are errors that need their own option, such as -Wno-IMPURE for an interface task that is called through a virtual interface and uses the interface’s variables.

To check by hand

A build that passed leaves only build/obj_dir/sim. Run with --debug to keep its logs and the rest of obj_dir/ (see What is left in a step’s directory).

build/stderr.log has no %Error. build/stdout.log ends with Verilator’s report of the build: its wall time and the memory it took.

run

Starts the reference model and the design in its simulator, runs QCVEngine against them, and collects what they wrote. Used by TestRIG, where its outcome is the test result.

Depends onmodel, engine, build
InputReplay mode only: the replay trace directory
Servicesreference (the model) and dut (the simulator)
Commandengine/bin/QCVEngine, run in run/
Outputsrun/stats.txt, run/stdout.log, the simulator’s log, run/counterexamples/, the coverage data, the waves
PrechecksFor an Xcelium job: xrun and gcc on PATH. In replay mode: the replay trace directory exists
Key toolsxcelium for an Xcelium job, by the version xrun -version prints. The model and a Verilator binary are keyed as outputs of the steps that built them
Timeouttimeout from the config. None by default
CachedYes. In generate mode the seed is part of the key

Sequence

sequenceDiagram
    participant D as doris
    participant R as reference (Sail)
    participant S as dut (xrun)
    participant Q as QCVEngine
    D->>D: allocate two free ports
    D->>R: start, -r PORT
    D->>S: start, RVFI_DII_PORT=PORT
    D->>D: wait until both ports are listening
    D->>Q: start, -a REFERENCE_PORT -b DUT_PORT
    Q->>R: connect (implementation A)
    Q->>S: connect (implementation B)
    loop each test
        Q->>R: reset, then instructions
        Q->>S: reset, then instructions
        R-->>Q: trace packets
        S-->>Q: trace packets
        Q->>Q: compare, then shrink and save on a mismatch
    end
    Q->>D: exit with the number of failing tests
    D->>R: SIGTERM
    D->>S: SIGTERM
    D->>D: completion checks, then the verdict

The reference service

model/src/c_emulator/cheri_riscv_rvfi_RV64 [-C] [-m] <run args> -r <port> -i     # in run/reference/
ArgumentWhenMeaning
-Carch has no c extensionDisable compressed instructions
-msupport_misaligned: trueAllow misaligned accesses
<run args>tools.sail.run.args is setThe arguments as given
-r <port>AlwaysServe RVFI-DII on this port
-iAlwaysStore illegal instruction bits in mtval

Its stdout and stderr go to run/reference.log: one line per executed instruction, with register and memory writes. That log is not an output of the step, so it is deleted when the step passes: it is there after a failure, or a run with --debug. It must be listening within 60 seconds. It is stopped with SIGTERM as soon as QCVEngine exits, and it is a step error if it has to be killed.

The dut service

The service declares what the simulator writes as its own outputs, which are outputs of the step named dut.log, dut.coverage and dut.waves. They are checked once the service has stopped, since the simulator writes its coverage as it stops. The simulator’s log, dut.log, is run/dut/run.log for Xcelium and run/dut.log for Verilator. The coverage data, dut.coverage, is run/dut/cov_work/ for Xcelium and run/dut/coverage.dat for Verilator, and the coverage step reads it. The waves, dut.waves, are run/dut/waves.shm/ for Xcelium and run/dut/waves.fst for Verilator.

Xcelium

RVFI_DII_PORT=<port> xrun -64bit -R -licqueue -snapshot snapshot -l run.log \
    -coverage functional -covworkdir cov_work -covoverwrite -covtest <dut.test> \
    +UVM_TESTNAME=<dut.test> -input '@run; finish' <run args>      # in run/dut/

xrun -R runs a snapshot from the library in its working directory, so doris links run/dut/xcelium.d to build/xcelium.d. Logs and coverage are then written in run/dut/, not in the build. The coverage arguments are present when dut.coverage.functional is set. With no dut.test, +UVM_TESTNAME is left out and the coverage test is test. <run args> is tools.xcelium.run.args, as given. The testbench reads its port from RVFI_DII_PORT. doris also puts the host’s libstdc++.so.6, found with gcc -print-file-name, in front of LD_PRELOAD, so DPI code doesn’t load the older copy bundled with Xcelium.

Its stdout and stderr go to run/dut.log. run/dut/run.log is Xcelium’s own log of the same run, and is the one the step keeps: run/dut.log is deleted when the step passes. The testbench writes its traces next to it. It must be listening within 30 minutes, which allows for a licence queue.

The testbench does not finish by itself: after QCVEngine disconnects it keeps listening for another connection. So doris stops it with SIGTERM as soon as QCVEngine exits, as testrig.py does. Xcelium ends the simulation on SIGTERM and writes the coverage database before it exits, but the UVM report summary and final phases do not run. If it is still running 10 seconds after the signal it is killed and the step is a step error, because the coverage may be incomplete.

Verilator

RVFI_DII_PORT=<port> build/obj_dir/sim +UVM_TESTNAME=<dut.test> [+doris_waves] <run args>      # in run/dut/

The binary the build step made is run from run/dut/, where the testbench writes its traces. <run args> is tools.verilator.run.args, as given. Its stdout and stderr go to run/dut.log, and it has no other log. It needs no licence, so it is listening at once. With no dut.test, +UVM_TESTNAME is left out.

It is stopped with SIGTERM in the same way. The support source doris builds into the binary then writes run/dut/coverage.dat and exits. final blocks and the UVM report summary do not run.

Waves

With dut.waves the simulator records the waves of the run, and they are an output of the dut service, and so of the step, named dut.waves.

SimulatorWhat changes in the commandWaves
XceliumThe -input script is @database -open waves -shm -default; probe -create -all -depth all; run; finishrun/dut/waves.shm/
Verilator+doris_waves is passed, and the waves source built into the binary starts the dumprun/dut/waves.fst

Xcelium’s script opens an SHM database, which SimVision reads, and probes every object below the top to any depth. The build gave read access to them with -access +r. Verilator’s file is in FST format, which GTKWave reads.

The waves must exist for the step to pass. The Verilator path has been run for real, in Verilator 5.040: the file is written though the simulation is stopped with SIGTERM. The Xcelium path has unit tests of the command line only, and whether Xcelium has written all of its waves when doris stops it has not been checked.

The QCVEngine command

engine/bin/QCVEngine -a <reference port> -b <dut port> -r <arch> -v 1 \
    -s run/counterexamples --statsFile run/stats.txt <mode arguments> [-L <length>]
ArgumentMeaning
-a, -bPorts of implementation A (reference) and B (dut)
-r <arch>ISA string. QCVEngine skips test groups the architecture doesn’t support
-v 1Verbosity
-s <dir>Save counterexamples here. Without it QCVEngine asks on stdin for a file name
--statsFile <file>Write the per-instruction counts here at the end
-n <count>Generate mode: tests per test group
-I <regex>, -x <regex>Generate mode: test groups to include and exclude
--seed <seed>Generate mode: the seed the tests are generated from
-d <dir>Replay mode: run the traces in this directory instead of generating
-L <length>Maximum test length

tests.count is per test group. With 19 groups enabled, count: 100 runs 1900 tests. Where the count and the seed come from, and how the two modes differ, is on the flow’s page.

What passed means

The step’s outcome is decided in this order:

CheckIf it fails
Both services started and were listening in timesetup error
No service exited while QCVEngine ranstep error
QCVEngine finished within the timeoutstep error
No service was killed by something else, or ignored SIGTERM for 10 sstep error
QCVEngine was not killed by a signalstep error
stats.txt, stdout.log, counterexamples/, and the simulator’s log, coverage data and waves (see The dut service) existstep error
run/stdout.log contains Written coverage stats tostep error
QCVEngine’s exit code is 0failed

QCVEngine exits with the number of failing tests, so any exit code completes the step. The pass pattern is what tells a run that reached the end from a crash that happened to exit non-zero: QCVEngine prints that line last.

So passed means: QCVEngine ran to the end, reported no failing test, and both implementations stayed up. It does not mean:

  • A minimum number of tests ran. Groups skipped for the architecture, or a regex that matches nothing, lower the count without failing. tests_requested in the result is the number asked for, not a measurement. tests in the result, and the test table in the report, list what each group did, read from the verdict lines QCVEngine prints in run/stdout.log: check there that the groups you expect ran.
  • The simulator log is clean. The simulator’s log is not scanned: the step has no fail pattern. Assertion failures, UVM errors and *E messages that leave the simulation running do not change the outcome. A service’s exit code is not checked either.
  • The UVM test passed. The outcome comes from QCVEngine’s comparison alone.
  • Coverage was collected. The coverage data must exist, but its content is not checked here. The coverage step loads it, whether this step passed or failed.
  • The two sides compared everything. What is compared is whatever both sides put in their trace packets, in the trace version both support.

To check by hand

The flow’s page has the full list. For this step: run/stdout.log starts with connected to implementation-A and connected to implementation-B, each group that ran prints +++ OK, passed N tests., and for Xcelium run/dut/run.log ends with Simulation received SIGTERM and the coverage files being written. For Verilator, run/dut/coverage.dat is not empty.

Those files are outputs of the step, so they are there after any run. run/reference.log, run/stderr.log and, for Xcelium, run/dut.log are not: a step that passed has them only after a run with --debug (see What is left in a step’s directory).

coverage

Reports on the coverage the run step collected. Used by TestRIG, when dut.coverage.functional is set. The reporter goes with the simulator: IMC reads the databases Xcelium writes, and doris itself reads the file a Verilator run writes. A job gets the one that reads its simulator’s unless the config binds one as tool.coverage, by the name imc or doris, and binding one that can’t read them is an error when the job is planned (see Tools). Both give the same summary in the result.

The step reports on this run alone. Coverage is not merged across runs (see Open questions).

It runs after a run step that failed, too. A run with a failing test still collected coverage, and the report of it shows what the tests reached. So a job whose run step is failed has a coverage report, and coverage in its result. The step is skipped when the run step did not complete, with a step error or a setup error, or was skipped itself: its outputs are then not known to be complete.

Xcelium: IMC

Depends onrun (the coverage database), passed or failed
Commandimc -licqueue [<args>] -execcmd '<commands>', run in coverage/
Outputscoverage/summary.txt, coverage/detail.txt, coverage/html/
Key toolsimc, by the version imc -version prints
Passes whenIMC prints no *E or *F line and the three outputs exist
CachedYes. The key covers the run step’s outputs, so a new run is a new report

<args> is tools.imc.coverage.args, as given.

The commands

IMC is given its commands on the command line, separated by ;, so they are part of the cache key:

load -run {<abs>/run/dut/cov_work/scope/<test>}
config reports.detachable_report_data -set true
report -summary -type -all -metrics covergroup -source off -out summary.txt
report -detail -type -all -metrics covergroup -source off -out detail.txt
report_metrics -out html -overwrite -detail -metrics all -kind aggregate \
    -source on -exclComments -assertionStatus -allAssertionCounters -all

The database is given by its absolute path, <abs> here, in braces so that Tcl reads it as one word. <test> is dut.test, or test when it is unset.

OutputHolds
summary.txtOne row per module with covergroups: its covergroup average and its bins covered
detail.txtEvery covergroup, coverpoint and bin, with hit counts. Look here for the bins not hit
html/IMC’s HTML report of every metric. Open html/index.html

detachable_report_data makes IMC write the HTML report’s data to html/report_data/, which is the file dvplan annotates a verification plan from. -licqueue waits for a licence rather than failing. The two report commands are IMC’s legacy text reports, so each prints a *W,REPDEP warning: report_metrics only writes HTML.

What passed means

IMC exits with code 0 whatever happened, so the exit code decides nothing. The step is a step error if coverage/stderr.log, where IMC writes its messages, or coverage/stdout.log has a line starting *E, or *F,, such as a database that can’t be loaded, or if an output is missing.

passed means the reports were written. It does not mean:

  • Any level of coverage was reached. There is no coverage goal. A run that covered nothing passes.
  • The summary has the modules you expect. A module with no covergroups, or left out of dut.coverage.scopes, has no row.

To check by hand

coverage/stderr.log shows *I,RUNLD: Successfully loaded run, and coverage/stdout.log ends with Metrics report written to. Neither log is an output of the step, so for a step that passed they are only there after a run with --debug (see What is left in a step’s directory). The reports are always there. summary.txt has a row for each module in dut.coverage.scopes. In detail.txt, a bin shows (hits/1): check that the bins you expect to be hit have counts in line with the number of tests.

Verilator: doris

This is the doris plugin reading the file itself, not a command, so there are no logs. Config binds it by the name doris, and it has no options.

Depends onrun (the coverage file), passed or failed
Readsrun/dut/coverage.dat
Outputscoverage/summary.json, coverage/detail.txt, coverage/html/
Passes whenThe file was read and the outputs were written
CachedYes. The key covers the run step’s outputs, so a new run is a new report
KeyThe plugin’s hash, and the coverage file’s path

The file has a count for each cover property. doris takes those the instrument step made, whose names hold the module, covergroup, coverpoint and bin, and reports them as the covergroups they came from. A module with several instances has a count for each: they are added.

OutputHolds
summary.jsonOne entry per module with covergroups: its covergroup average and its bins covered
detail.txtEvery covergroup, coverpoint and bin, with hit counts. Look here for the bins not hit
html/The same as a page, html/index.html: the modules, each covergroup’s coverpoints with the bins not hit, and every bin’s hits

For a testbench whose covergroups can all be rewritten, the figures are the ones IMC gives for the same tests in Xcelium, down to the hit count of each bin. What can’t be rewritten is left out. The HTML report has the covergroups only: IMC’s also has assertions and the source.

What passed means

passed means the reports were written. As for IMC, it does not mean any level of coverage was reached. A run that wrote no cover properties of doris’s gives an empty summary and passes.

To check by hand

detail.txt lists the modules in dut.coverage.scopes, and the bins you expect to be hit have counts in line with the number of tests. instrument/unsupported.txt is empty: if not, those bins are missing from the totals.

The summary in the result

doris reads the summary when it writes the result file. Each row becomes an entry of coverage: the module’s name, its covergroup average in percent, and the bins covered out of the total. The job’s page shows them as a table, and the flow’s index shows the bins covered over all modules.

average is IMC’s figure, and doris works it out the same way for Verilator: the mean of the module’s covergroups, each the mean of its coverpoints. It is not covered / total, which weights every bin the same.

lint

Runs a linter on the sources. Used by the Lint flow, where its outcome is the lint result. A job has one linter.

Depends onfilelist (the sources) and flatten (the list naming them)
Runs inlint/
OutputsThe linter’s logs, and lint/messages.json: the messages parsed from them
Timeouttimeout from the config. None by default
LinterCommandKeyed by the version printed byMessages are read from
verilatorverilator --lint-only -f flatten/filelist.f --Mdir lint/obj_dir [--top-module <top>] [<args>]verilator --versionlint/stderr.log
veriblexargs -a flatten/filelist.f -d '\n' verible-verilog-lint --flagfile=../flatten/verible.flags [<args>]verible-verilog-lint --versionlint/stdout.log, lint/stderr.log
slangslang -f flatten/filelist.f [<args>]slang --versionlint/stderr.log, lint/stdout.log
ascentlintxargs -a ../flatten/ascentlint.flags -d '\n' ascentlint -log ascentlint.log [<args>]ascentlint -version, the line AscentLint ...lint/ascentlint.rpt, lint/ascentlint.log

<args> is the linter’s tools.<linter>.lint.args from the lint config, as given. They come after the options the core’s target gives, except where xargs adds what the flatten step wrote: for Verible they are in front of the files, and for AscentLint in front of -i, the run script and the target’s options.

  • Verilator generates nothing when linting, so lint/obj_dir is not made. --top-module comes after the filelist, so the design file’s top wins over the target’s toplevel. verilator is tools.verilator.command if the config sets it, for the command and for the version.
  • Verible takes the files as arguments and reads no argument file, and the files are only known once the filelist step has run. So xargs reads them from the list. If they don’t fit one command line it runs Verible more than once, each time with the same flags.
  • slang has its top module in the command file, where the flatten step put it.
  • AscentLint runs flatten/ascentlint.tcl, the script Edalize’s backend would write, which sources the waivers, analyzes the files of flatten/filelist.f, elaborates the top and writes lint/ascentlint.rpt. Its options are only known once the filelist step has run, so xargs reads them from flatten/ascentlint.flags, with -i and the script. Each run holds one licence from the ascentlint resource pool. Its version is only the line of ascentlint -version that names the release and build: the rest of what it prints, such as the date and the working directory, changes every run.

Every other option comes from the core’s target, through the flatten step, or from tools.<linter>.lint.args.

The parsed messages

When the linter has run to the end, doris parses its logs once, in-process, into lint/messages.json: the messages, each with its severity, rule, file, line, column and text, and the log to point at. A file is named from the job’s directory, such as filelist/work/src/aes_0/rtl/aes.sv, not as the linter named it from lint/, so the file is the same in every checkout. The step’s verdict is decided from those messages, and the job’s result file is written from them, so the logs are never parsed twice. messages.json is an output of the step, so a step taken from the cache has the messages of the run that was stored.

What passed means

The step’s outcome is decided in this order:

CheckIf it fails
The linter was not killed by a signal, and finished within the timeoutstep error
Its exit code is one a linter that ran to the end givesstep error
Its logs exist, and its messages were parsed into messages.jsonstep error
Verilator only: no message contains Internal Errorstep error
It did not exit non-zero without reporting an error or warningstep error
It reported no error and no warningfailed

What counts as a message, and which exit codes are accepted:

LinterExit codesA message is a lineRule
verilator0, 1Starting %Error or %Warning. The closing %Error: Exiting due to ... line is a count, not a messageWIDTHEXPAND
verible0, 123FILE:LINE:COLUMN: TEXT. With a [rule] at the end it is a warning. Without one it is an error, such as a syntax errorline-length
slangAny[FILE:LINE:COLUMN: ]error: TEXT or warning: TEXT [-Wname]. Notes are not messageswidth-trunc
ascentlint0, 123, 124In ascentlint.rpt: a row of E or W, then RULE:, FILE:LINE and the text, in columns padded with spaces; the columns after the text are left out. FILE is the name only. A violation at several places has a row for each, and each row is a message, so the counts can be more than the report’s summary gives. Infos, I, are not messages, and a text that goes on in the next line is cut there. In ascentlint.log: starting Error: , ERROR, ERR, Warning: or WARN, which belong to no ruleNOT_READ

xargs exits 123 when Verible exited non-zero, which it does for any violation or syntax error. slang’s exit code names the kind of failure and is not the same in every version, so its messages decide: a non-zero exit with no message, such as an option it does not know, is a step error. AscentLint exits 0 when it finds violations, so its messages decide; xargs exits 123 or 124 when AscentLint exited non-zero. A FlexNet licensing error in its log is a step error, not a lint error: it says nothing about the design. If AscentLint stops before it writes ascentlint.rpt, as it may on an error in analysis with -stop_on_error, the missing report is a step error, and ascentlint.log has the errors.

Warnings fail the design. That includes Verilator warnings made non-fatal with -Wno-fatal, slang warnings, for which slang itself exits 0, and AscentLint’s warnings in its log, other than that a licence will expire. Errors that belong to no rule fail it too: a syntax error, or a module that can’t be found, says the design can’t be linted as it is described.

So passed means: the linter read every source the core’s target names and reported nothing. It does not mean:

  • The checks you expect ran. The options come from the core’s target and the lint config’s tools table. A target without -Wall passes Verilator with far fewer checks, and Verible with no rules file checks only its default rules.
  • Nothing was waived. No linter reports what a waiver turns off, so waived messages are neither listed nor counted. A waiver that is too broad hides real findings, and one that no longer matches anything is not reported either. Review the waiver files named in flatten/.
  • The whole design was read. Verilator, slang and AscentLint check only what is instantiated below the top module. A module in the filelist that nothing instantiates is parsed, but not elaborated. Verible reads every source file but no include file.
  • The linters agree. Each has its own checks. A design that passes one can fail another, and vendored code written to another style guide will fail Verible’s style rules until it is waived.

To check by hand

Compare the counts in result.json with the linter’s own:

jq '.errors, .warnings' result.json
tail -n 1 lint/stderr.log                    # Verilator's own count; absent on a clean run
grep -c '\[Style: ' lint/stdout.log lint/stderr.log   # Verible's violations
tail -n 1 lint/stdout.log                    # slang's "Build succeeded: 0 errors, 0 warnings"
grep -cE '^[EW] +[A-Z0-9_]+:' lint/ascentlint.rpt     # AscentLint's errors and warnings in the report
grep -E '^(Error: |ERROR|  ERR |Warning: |  WARN )' lint/ascentlint.log   # and in the log

Only the first line of each message is kept in the result. The log also has what the linter prints under it: the instance, the source line and hints.

The logs the messages are read from are outputs of the step, as is messages.json, so they are there after any run, pass or fail, and for a step taken from the cache. Verilator’s lint/stdout.log is not one. It is only left by a step that did not pass or a run with --debug (see What is left in a step’s directory).

script

Writes the run script a checker runs, from the flow’s config. Used by CDC and RDC. The checker’s plugin does this itself, as a callback, not as a command, so there are no logs. A config that names its own script has no script step.

Depends onNothing
Outputscript/run.tcl
Passes whenThe script was written

The cache key covers the plugin’s hash and what it was asked: everything of the config the script is made from, such as the synchronizers, black boxes, variables, and the paths of the constraints and waivers. It does not cover the content of those files: the check step’s key does. So a changed waiver runs the check again with the same script, and a changed synchronizer writes the script again.

The script’s stages are on the flow’s page.

To check by hand

Read script/run.tcl. doris run cdc DESIGN --until script writes it without running the checker, which needs no licence.

cdc and rdc

Runs a crossing checker on the run script. Used by CDC and RDC, where its outcome is the result. The step is named after the flow: cdc in a CDC job and rdc in an RDC job.

Depends onfilelist (the sources), flatten (the list naming them) and script
Runs incdc/ or rdc/
Outputsreports/, stdout.log, and findings.json: what the checker found, parsed from its report and log
Timeouttimeout from the config. None by default
CheckerCommandKeyed by the version printed byReportLog
meridiancdcmcdc -i ../script/run.tcl [<args>]mcdc -version, the line Meridian CDC ...cdc/reports/cdc.new.rptcdc/mcdc.log, else stdout.log
meridianrdcmrdc -i ../script/run.tcl [<args>]mrdc -version, the line Meridian RDC ...rdc/reports/rdc.new.rptrdc/mrdc.log, else stdout.log

<args> is tools.<checker>.check.args. With the config’s own script, -i names it, and the environment has what OpenTitan’s scripts read (see A project’s own script). Each run holds one licence from the checker’s resource pool. reports/ is made before the checker starts, so it is there even if the checker stops early.

The cache key covers the sources and the filelist, the run script, every file the config names (constraints, environment files, configuration scripts, waivers, reset scenarios, and reads), the checker’s version and its plugin.

The parsed findings

When the checker has run, doris parses its reports and log once, in-process, into findings.json. A report’s summary, between Summary of Policy: <POLICY> and Rule Details of Policy: <POLICY>, gives each rule’s category, from its section (SDC_ENV_LINT, M?DC_SETUP_CHECKS, M?DC_ANALYSIS_CHECKS), and level, from the group within it (ERROR, WARNING, REVIEW, INFO), with its counts. A group within a level, such as RDC’s E_RST_METASTABILITY, holds rules of its own, one per reset scenario. The rules and their waived counts are read from reports/<kind>.all.rpt, and the findings from the details of reports/<kind>.new.rpt: rows that start with a rule and its RuleDataId, all the rows of one id being one violation. A rule listed under two levels has the first, the higher, and the counts of both. The log’s errors and warnings come first, with the category flow.

What passed means

See the flow’s page.

To check by hand

Compare each rule’s new count with the number of its violations in result.json, as on the flow’s page, and read the reports in reports/.

Troubleshooting

doris can’t find the project

doris walks up from the current directory to the first project.hjson whose schema is dv/project/1. If there is none it exits 2, CANNOT_RUN. Run it inside the repo, or pass -C DIR. A project.hjson with another schema is skipped, so check the schema line.

A config file is rejected

Run doris validate. It reports every error in every file at once.

Message is aboutLikely cause
An unknown keyA misspelt key. The message lists the valid keys of that table
A value that ends in } or ]Two values on one line. An unquoted HJSON value runs to the end of its line (see Writing HJSON)
A missing or unknown schemaA configs pattern matches a file that is not a doris config, such as another tool’s HJSON. Narrow the pattern
No design fileA flow config file has no design.hjson in its directory or above it
No tool for a roleNeither the flow config’s tool table nor the project file’s binds a tool to a role the flow needs (see Tools and roles)
A role the flow does not haveA misspelt role in a tool table. The message lists the flow’s roles
A tool that is not a table, a tools that is a list, or an unknown key in dut, reference or tools.<name>A config written before tools were bound to roles. See below
A pattern that matches nothingA warning. An unquoted glob such as hw/ip/*/dv starts a /* comment: quote it

A config from before tools were bound to roles

The schema names did not change when the tool table came in, so an older config is rejected key by key. Rewrite it:

Older configNow
Lint’s tool: NAME, or its tools list of linterstool.linter: a name, or a list of names
A simulator, or a list of them, named inside TestRIG’s duttool.dut: a name, or a list of names
A reference model named inside TestRIG’s referencetool.reference
A simulator’s build arguments, as one list under tools.<name>tools.<name>.build.args
A simulator’s run arguments, as one list under tools.<name>tools.<name>.run.args

A design is missing from doris flows

Only files that a configs pattern in the project file matches are loaded. A flow config file that no pattern matches is not seen at all, and is neither validated nor run.

doris run exits 2 (CANNOT_RUN) before any step starts

A precheck failed: something a step needs of the machine is not there. doris run prints a setup error: line for each, with the steps that need it, and doris check FLOW DESIGN lists every precheck of the run, passed and failed.

The line saysDo
program `NAME` on PATH: not on PATHRun doris inside the project’s dev shell: doris never installs tools. Or give the tool’s directory with the setting tools.NAME.path
program `NAME` on PATH: not on PATH, nor in the tool's directory from settingstools.NAME.path is set, but the program is not in that directory. doris settings shows the value and the file it came from
environment variable `UVM_HOME` set: not setSet it to a UVM library Verilator can compile (see Simulators)
`DIR` exists: no such file or directoryWith --replay: the config’s replay directory is missing
`systemctl --user show --property=Version` exits with code 0resources.enforce is systemd, and there is no user systemd manager, as in many containers. Set it to cgroup, or off, for that machine
doris's own cgroup delegated: ... is not writableresources.enforce is cgroup, and doris may not write to its cgroup. Set resources.cgroup to one delegated to its user, or start doris in one (see Enforcing what a step holds)
... does not have the memory controllerThe cgroup’s parent does not hand it the memory controller, or cpu. Enable them in the parent’s cgroup.subtree_control, or use another cgroup

A run also exits 2, CANNOT_RUN, before any step starts if a step holds more of a resource pool than the pool’s size. The message names the step and the pool.

A job ended in step error or setup error

Neither says anything about the design. The job’s result.json and report give the message for the step. The step’s directory is kept whole, with every log, until the step runs again, doris clean removes it, or it is 14 days old.

Message or symptomLook at
A command exited with an unexpected codestdout.log and stderr.log in the step’s directory
A service never listened<service>.log in the step’s directory. For Xcelium, a licence queue can outlast the 30 minute limit
A service died or had to be killed<service>.log. The command’s own result is not trusted once a service is lost
A timeoutThe timeout key of the flow’s config
A missing outputThe tool exited 0 without doing its work. Read its log
without ... in its stdout, so it did not finish normallyA pass pattern did not match: the tool ended with an accepted exit code before it printed the line that shows it finished. Read the file the message names
interruptedThe run was stopped with Ctrl-C (see Interrupting a run)

doris plan -v FLOW DESIGN prints each step’s exact command and working directory, so a failing command can be run by hand.

A step did not rerun after a change

The cache key covers only what doris knows about (see What is not in a key). A step is not rerun for:

  • a change to how doris makes a key or reaches a verdict that did not bump its key protocol, which is a bug in doris (a changed plugin is a miss: its hash is keyed);
  • a file a tool reads that is not a declared input, such as a tool install or library;
  • a changed environment variable;
  • an untracked file that git ignores.

Run with --rerun to run every selected step and replace its cache entry.

A step reran when nothing changed

  • The filelist step is keyed on every file under the project’s cores_root directories. Any change there reruns it, though the steps after it only rerun if the resolved sources changed. Keep cores_root narrow.
  • A TestRIG run in generate mode picks a new seed each time unless one is given, so its run step always runs. Pass --seed N or set tests.seed to repeat a run.
  • An untracked, unignored file in an input directory is part of the key. Build products left in a source tree change it: add them to .gitignore.
  • A run with --debug runs each step whose cache entry a run without it stored, because that entry has no debug outputs. Later debug runs take the step from the cache.

A step’s logs are not there

A step that passed keeps only its declared outputs. Its stdout.log, stderr.log and other files are deleted when it ends, unless the step declares them as outputs (see Working directories). The step pages say which files each step keeps.

To read them, run with --debug, which keeps every step’s directory whole:

doris run FLOW DESIGN --debug           # runs again each step whose cache entry a plain run stored
doris run FLOW DESIGN --debug --rerun   # runs every step

A step that failed or did not complete keeps its directory without --debug, unless the settings have dirs.keep_failed = false.

The logs don’t match this run

A step taken from the cache did not run. Its logs are those of the earlier run that made the entry. Check cached for each step in result.json, or use --rerun.

A job failed but has a coverage report

That is meant. TestRIG’s coverage step runs after a run step that failed, because a run with a failing test still collected coverage. The job is still failed. The step is skipped when run ended in a step error or a setup error.

The cache is too big

doris gc roots lists what is holding it, and doris gc --dry-run shows what a collection would free. See Cleaning the cache.

The scratch directory is too big

The step directories under scratch/doris/ are not part of the cache. A step that passed leaves only its outputs there. What takes the space is the directories kept whole: those of steps that failed or did not complete, and of every step of a run with --debug.

doris clean --dry-run     # list them, with the kind and size of each
doris clean               # remove them
doris clean --debug       # only those a debug run kept

doris run also removes those kept more than 14 days ago, or dirs.work_max_age. The outputs of steps that passed stay until they are deleted by hand: the cache puts them back when they are needed.

A run says it is waiting for another doris run

Another doris run in this checkout is running a job this run wants. This run waits until that one ends, then goes on, taking from the cache what the other ran. Nothing has run or been written yet, so Ctrl-C is safe. To see what holds the job, look for the other doris run process, such as with pgrep -af 'doris run'. To run both at once, run one in another checkout, or give the two runs different designs. See Runs at the same time.

doris gc hangs

It waits for running doris run processes, which hold a lock on the cache from start to end. doris gc --dry-run and doris gc roots don’t wait.

The report of an old run is gone

A past run’s report is made from its GC root, so it goes when the root is collected. Pin runs that must stay: doris gc pin RUN --name NAME.

Reporting a bug

Include the command, the output of doris --version, the job’s result.json, and the output of doris plan -v for the same arguments.

Command line

This page lists every command and option, what each command exits with, and what an interrupt does.

Commands

CommandDoes
doris flows [-t [-a]] [-v]Lists each design and the flows it configures. -t nests designs by their FuseSoC dependencies
doris validateLoads every config file and reports every error and warning
doris check [FLOW [DESIGN...]]Runs the prechecks of a run’s steps and lists each as ok or failed. Every configured flow if none
doris plan [FLOW] [DESIGN|JOB...]Prints a tree of jobs and their steps, each cached, will run or no cache key. Runs nothing. -v for full detail, --ids for the IDs, --explain for what was left out
doris run [FLOW] [DESIGN|JOB...]Runs the jobs, writes each result file and the reports (see Choosing jobs)
doris report FLOW [DESIGN...]Writes the report pages again from the result files
doris report view [RUN]Serves the reports and opens the browser (see Viewing reports)
doris gcDrops the GC roots of old runs and deletes the cache entries no root reaches, and removes old measurements
doris gc rootsLists the GC roots
doris gc pin ROOT [--name NAME]Protects a root from collection
doris gc unpin ROOTRemoves the protection
doris clean [FLOW] [DESIGN|JOB...]Removes the working directories that were kept whole (see doris clean)
doris settingsLists every setting, its value and where it came from (see Settings)
doris resources FLOW [DESIGN...]Says what each step should hold from the resource pools, from the measurement store (see Suggested resources)
doris measurements import FILE...Copies measurement files, or each in a directory, into the store
doris --version, doris help COMMANDThe version, and a command’s options

FLOW is testrig or lint. The flows are a fixed list in doris. plan, run and clean take designs, job IDs and filters, and can leave the flow out (see Choosing jobs).

Finding the repo

doris walks up from the current directory to the first project.hjson whose schema is dv/project/1. That directory is the repo root. -C DIR, before or after the command, starts the walk at DIR instead. --project FILE loads FILE instead, relative to that directory. A project file’s root can put the repo root elsewhere.

A repo with no doris config, but another tool’s, can be run from a project made from those: --compat dvsim does this for OpenTitan’s dvsim lint configs. See Repos without doris config.

The doris gc commands, doris settings and doris report view need no repo. The cache is per user, so they work from any directory. Inside a repo they also read its checkout settings. Outside one, doris report view serves the runs of every repo in the cache.

Everything a run writes goes under scratch/doris/ in the repo root, and nowhere else in the repo. The directory can’t be changed.

Choosing jobs

Config describes the largest run, and the command line narrows it. doris plan, doris run and doris clean take the same arguments:

doris run [FLOW] [DESIGN | JOB | @SET]... [-i KEY=GLOB]... [-x KEY=GLOB]... [--top TOP] [--tool TOOL] [--shared] [--failed | --jobs-from FILE]

Every job of the chosen flows is planned, and then chosen from: by the designs and jobs named, then by the filters. A job is one design in one flow, with a tool bound to each of the flow’s roles, and for lint in one context (see Config and the repo model).

doris run lint                                  # every lint job
doris run lint 'earlgrey/*'                     # earlgrey's designs, and the shared ones in its context
doris run lint/earlgrey/uart@verilator          # one job, by its ID
doris run lint --top earlgrey -x tag=slow       # earlgrey's lint jobs, without the slow ones
doris run -i tag=nightly                        # the nightly jobs of every flow
doris run @pr                                   # the project file's `pr` filter set
doris run --failed                              # what did not pass last time

The flow

FLOW is testrig or lint, as the first argument. It can be left out:

  • A job ID names its flow, as its first part. With only job IDs, the run is of their flows.
  • Otherwise every flow a design configures is chosen from, narrowed by -i flow=GLOB. A run of several flows writes each flow’s results and reports in its own directory.

A flow name in another place is the flow too, unless a design has that name. Naming a flow no design configures is an error.

Designs and job IDs

ArgumentChooses
uartThe design with that name. An error listing them if several tops each have their own
TOP/NAMEA top’s own design, such as earlgrey/pwrmgr
TOP/NAMEFor a shared design, that design in one top’s context only
'earlgrey/*'A glob on design names: the qualified name, or TOP/NAME as a job ID names a shared design in a context
lint/uart@xA job, by its ID as doris plan --ids prints it
'lint/*@x*'A glob on job IDs. One that starts with a glob, such as '*/uart@*', is matched in every chosen flow
@SETThe project file’s filter set of that name
  • The arguments are ORed. A job any of them matches is kept, for the filters to narrow. With none, every job of the chosen flows.
  • An argument that matches no job is an error, and so is a name no design has, which lists the designs.
  • A design named exactly with no config for the flow is an error.
  • TOP/NAME for a top that does not use the design is an error.
  • Globs are *, ? and [...], with * matching / too. Quote them, so the shell leaves them alone.

A design gets all of its jobs. For lint that is one job per linter bound for it, in each of its contexts. For TestRIG it is one job per simulator bound for it. Where another role is bound to several tools too, there is one job for each combination. The tools are bound in the design’s flow config or, for a role it leaves out, in the project file (see Tools and roles).

Filters

-i KEY=GLOB (--include) keeps only the jobs with an attribute that matches. -x KEY=GLOB (--exclude) leaves out the jobs with one that matches. Every job has these attributes:

KeyValuesExample
flowtestrig, lintflow=lint
designThe design’s qualified namedesign='earlgrey/*'
topThe top the job belongs to: a top’s own, the top a design is its own design of, or the top whose context a shared design is run intop=darjeeling
scopetop, top-ip for a top’s own design, or sharedscope=shared
toolThe tool in any of the flow’s rolestool=verilator
tool.ROLEThe tool in one role: linter for lint, and dut, reference and coverage for TestRIGtool.reference=sail
tagThe design file’s tags, and the flow config’stag=slow
  • Filters of one key are ORed, and of different keys ANDed. -i tag=dv -i tag=fpv -i top=earlgrey keeps earlgrey’s jobs tagged dv or fpv.
  • Excludes are applied last and always win.
  • The glob is matched against each of a job’s values. A job with no value for a key, such as no tags, or the top of a shared design that no top uses, matches no include and no exclude of it.
  • An include that matches no job is an error that lists the values the key has, so a typo doesn’t run nothing. So is a design or job named exactly that the filters leave out, and filters that leave out every job. A glob the filters narrow to nothing of its own is not an error.
  • A tool.ROLE with a role none of the flows has is an error, and so is a key that is none of these. package and variant are planned, and are errors until doris has vendored packages and variants.
  • Filters only choose. No attribute is part of any cache key, so adding a tag reruns nothing.

doris flows shows each design’s tags in a TAGS column, with a flow config’s as FLOW:TAG. Each job’s result file records its tags.

Shorthands

ShorthandIs
--top TOP-i top=TOP
--tool TOOL-i tool=TOOL
--shared-i scope=shared

They combine with the filters of the same key as filters do: --tool verilator --tool verible keeps the jobs of either.

Named filter sets

The project file can name filter sets that are used often, such as a quick set for pull requests (see The project file):

filters: {
  pr: {
    exclude: [
      tag=slow
    ]
  }
}

@pr on the command line adds its includes and excludes to the command line’s own, as in doris run lint @pr. A set only filters: it never changes what a job does. A name the project file doesn’t have is an error that lists the sets.

Reruns

  • --failed chooses the jobs of the last run in this checkout that did not pass: failed, a step error, or no result because the run stopped. With a flow, the last run that had jobs of it. The runs are read from the GC roots in the cache, so a run with --no-cache isn’t one, and doris gc forgets old ones. If every job passed, the command says so and does nothing.
  • --jobs-from FILE chooses the jobs whose IDs the file lists, one per line, as doris plan --ids prints them. Blank lines and lines that start with # are skipped.

Both are lists of jobs to narrow with filters, so a listed job the filters leave out is not an error. They take no designs or job IDs of their own, and a listed job that is no longer planned is an error.

Checking a choice

doris plan takes the same arguments and prints the chosen jobs. --ids prints only their IDs, one per line, for --jobs-from. --explain also lists every job the filters left out and the filter that did it, and counts the jobs no argument named.

$ doris plan lint 'earlgrey/u*' -x tool=slang --explain
...
left out by the filters:
  lint/earlgrey/uart@slang    -x tool=slang
  lint/earlgrey/usbdev@slang  -x tool=slang
and 640 other jobs of the flows, which no design or job named matches

Options

OptionCommandsMeaning
-C DIRAllRun as if started in DIR
--project FILEAllLoad the project file FILE instead of the one found by walking up
--compat FORMATAllLoad a project made from another tool’s config files: dvsim. See Repos without doris config
--until STEPplan, run, checkKeep only STEP and the steps it depends on. The result file records it as until
--top TOPplan, run, cleanOnly the jobs in this top’s context: -i top=TOP. Can be repeated (see Shorthands)
--sharedplan, run, cleanOnly the jobs of shared designs: -i scope=shared
--tool TOOLplan, run, cleanOnly the jobs that use this tool in one of the flow’s roles: -i tool=TOOL. Can be repeated
-i KEY=GLOB, --includeplan, run, cleanOnly the jobs with an attribute that matches. Can be repeated (see Filters)
-x KEY=GLOB, --excludeplan, run, cleanLeave out the jobs with an attribute that matches. Can be repeated, and wins over -i
--failedplan, runOnly the jobs of the last run that did not pass (see Reruns)
--jobs-from FILEplan, runOnly the jobs whose IDs FILE lists, one per line
--idsplanPrint only the chosen jobs’ IDs, one per line
--explainplanAlso list the jobs the filters left out, and why
--replayplan, run, checkTestRIG: rerun saved traces instead of generating tests
--tests Nplan, runTestRIG: generate N tests per test group, instead of the config’s tests.count
--seed Nplan, runTestRIG: generate from this seed. --seed random picks a new one
-j N, --jobsrunAt most N steps at once, over every job: the setting jobs.max. Default: the number of CPUs
--rerunrunRun every selected step even if it is cached, and replace its cache entry
--rerun=STEP,...runRun only the steps of these names even if they are cached (see The cache)
--no-storerunTake steps from the cache, but store nothing in it
--no-cacherunRun every step, and neither read nor write the cache
--debugrunKeep every step’s working directory whole, and its debug outputs in the cache. A step whose cache entry has no debug outputs runs again (see Working directories)
--set KEY=VALUEAllChange a setting for this command, and no other, after every settings file (see Settings)
--strictAllMake a warning about the project’s files an error: see Strict
--settings FILEAllRead settings from FILE too, after the system, user and checkout files (see Settings)
--older-thangcShort for --set gc.keep_age=AGE
--max-sizegcShort for --set gc.max_size=SIZE
-f, --forcegcDrop roots by age alone, even the newest root of a job or branch. Pinned roots are still kept. Short for --set gc.keep_latest=none
--dry-rungc, cleanList what would go and the space freed, and change nothing
--failedcleanRemove the directories of steps that failed
--interruptedcleanRemove the directories of steps that did not complete: a step error, a setup error or an interrupt
--debugcleanRemove the directories of steps that passed in a run with --debug. One that failed in it counts as failed
--port PORTreport viewListen on this port of 127.0.0.1. Default: any free port
--no-openreport viewPrint the address without opening a browser
-t, --treeflowsShow designs as a tree: each under the designs whose cores depend on it, with its flows
-a, --all-coresflowsWith -t, show every FuseSoC core, not only designs. A core shown before is marked (*)
-v, --verboseflows, planflows: show the design file and config files. plan: show each step’s directory, key, inputs, command and outputs

Flow options sit on the shared commands. --replay, --tests and --seed belong to TestRIG but are options of plan and run. Giving one when no TestRIG job is chosen is an error that says so. --until applies to every chosen job, so a step only one flow has is an error in a run of several. --replay can’t be combined with --tests or --seed. With doris check, --until and --replay need a flow.

-j counts steps, over every job. doris run schedules the steps of all its jobs together, so steps of different jobs run at the same time. A step also waits for the resource pools to have the threads, memory, disk space and licences it holds. doris run ends with the run’s metrics.

Settings

Settings come from layered settings files, then --settings FILE, -j and --set KEY=VALUE, which change a setting for one command. Every command reads them. Settings has the layers, the keys, limits and doris settings. A key that is not one of them is an error.

KeyMeaning
jobs.maxThe most steps running at once. -j sets it
pools.NAMEThe size of a resource pool
resources.enforcesystemd or cgroup to enforce what a step holds, off to only reserve it
resources.cgroupThe cgroup cgroup enforcement makes a cgroup per step in
resources.pintrue to pin each step to CPUs of its own
resources.measureHow steps are measured: auto, systemd, cgroup or off
resources.min_samples, resources.min_changeWhat doris resources needs to suggest a value
measurements.dir, measurements.max_ageWhere the measurement store is, and how long it keeps a run
dirs.keep_failedKeep the whole working directory of a step that failed
dirs.work_max_ageHow long a working directory that was kept whole is kept
tools.NAME.pathWhere a tool that is not on PATH is, for its own commands
plugins.pathDirectories of tool plugins beside the built-in ones, as DIR[:DIR...]
gc.*What a collection keeps, and whether a run collects

doris check

doris check plans the jobs as doris run would, and runs every precheck their steps declare. No step is run.

lint
  ok      program `fusesoc` on PATH  /usr/bin/fusesoc
  failed  program `slang` on PATH    not on PATH; needed by lint/uart@slang: lint
error: 1 of 2 prechecks failed; is the project's dev shell active?

Under each flow there is a line for each precheck, once, in the order the steps first need it. ok is followed by how the check is met: the path a program was found at, set for a variable, there for a file, the first line of a tool’s version, or exits with code 0 for a command. failed is followed by why, and by the steps that need it, as JOB: STEP, STEP; JOB: STEP. With --until, only the steps kept are checked, and with --replay the run step’s replay directory is.

After the prechecks, every step is checked against the sizes of the resource pools the settings give, as doris run checks them: a step that needs more of a pool than the pool has could never start, and is an error that names it. Either kind of failure makes doris check exit 1, FAILED.

doris clean

doris clean [FLOW] [DESIGN|JOB|@SET]... [-i KEY=GLOB] [-x KEY=GLOB] [--top TOP] [--tool TOOL] [--shared] [--failed] [--interrupted] [--debug] [--dry-run]

Removes the working directories that were kept whole: those with a .doris-kept marker, which a step that failed, did not complete or ran in a debug run leaves. See Working directories.

  • With nothing but a flow, that flow’s. With nothing at all, every flow’s.
  • Designs, job IDs, filter sets and filters choose jobs as they do for doris run (see Choosing jobs): the jobs are planned, and only their directories are looked in. An argument or include that chooses nothing is an error, as it is for a run. --failed here is a kind of directory, not the jobs of the last run.
  • --failed, --interrupted and --debug pick the kinds, and can be combined. With none of them, every kind is removed.
  • --dry-run lists what would go and removes nothing.
  • Each directory is listed with its kind, its size and its path, and the last line has the count and the total size.

It never removes the directory of a step that left only its outputs, a result file or anything in the cache.

Strict

--strict makes a warning about the project’s files an error:

  • a config pattern that matches no file;
  • a core file under the cores roots that does not parse;
  • a design whose core is not under the cores roots, as doris flows -t finds it.

Each is printed as error:. doris validate counts them as errors and exits 1, FAILED. Any other command that reads the project’s config does nothing and exits 2, CANNOT_RUN, as for an error in a config file; doris run therefore runs no step. Use it in CI, so a stale pattern or a broken core file fails the build rather than going unread in the log.

Other warnings are not affected: a setting lowered to a site’s limit, and what a command could not write after it ran, such as a report or the measurements.

Exit codes

doris exits with one of four codes. Each has a name, which these docs use beside the number; a script sees only the number.

CodeNameIn short
0OKIt did what was asked, and everything passed
1FAILEDIt ran, and the design or the environment failed
2CANNOT_RUNIt could not do what was asked at all
3ERRORA run went wrong in a way that is not the design’s

What each means for each command:

Command0 OK1 FAILED2 CANNOT_RUN3 ERROR
runEvery job passedThe worst job outcome is failedSee belowA job ended in an error or a skip, or was interrupted
validateNo errors. Warnings don’t count, unless --strictA config file has an error, or a warning with --strictNo project file was found—
checkEvery precheck holdsA precheck failedSee below—
Any other commandIt did what was asked—See below—

Exit code 2, CANNOT_RUN, means doris could not do what was asked at all: a config file did not load, a design or step name is wrong, an option is invalid, or a file could not be written. doris run also exits 2, before any step starts, if a precheck of its steps fails, such as a program that is not on PATH, or if a step needs more of a resource pool than the pool has. Those are the checks doris check makes, and it exits 1, FAILED, for either.

A job’s outcome is the worst of its steps, and the run’s exit code comes from the worst job. From worst to best: setup error, step error, failed, skipped, passed. A job cut short by a failed step therefore reports failed, not skipped, and a run exits 3, ERROR, only when something other than the design went wrong.

doris flows -t

The tree shows each design under the designs whose FuseSoC cores depend on it, directly or through cores that aren’t designs. Flows are in brackets, such as [lint], and come before the designs under a design. On a terminal, designs are bold, flows cyan, and other cores and paths dimmed; set NO_COLOR to turn colour off. A design nothing depends on is a root. A shared IP appears under every design that uses it. With -a, every core is shown, and a core that has been shown already is marked (*) and not expanded again.

doris reads the .core files under cores_root itself, without running FuseSoC, so the tree is quick but approximate:

  • Only the default target’s filesets are followed, or every fileset if a core has no default target.
  • Every flag ? (...) condition is taken as true.
  • Version constraints are ignored, and the highest version of a core is used.
  • A virtual core resolves only if exactly one core provides it. Mappings are not applied, so -a shows a virtual core with several providers as (virtual).
  • A directory holding a FUSESOC_IGNORE file is skipped, as FuseSoC skips it.

A design whose core isn’t found under the cores roots is a warning, and shows with no dependencies. With --strict it is an error.

Output

  • Paths are relative to the repo root, wherever doris was started. A path outside the root is shown in full. In a printed command the root is written <root>, because commands run in their own directories.
  • Result files hold paths relative to the job’s directory, except a TestRIG counterexample’s file, which is absolute.
  • Progress lines start with the local time of day. doris run prints one when a step starts, one for each thing it does, such as starting a service, and one with the step’s outcome and time.
  • A status table stays below them on a terminal, counting the steps of each name by where they are. See How a step runs.
  • A step’s own output is not printed. It goes to stdout.log and stderr.log in the step’s directory, and the progress line names the file. A step that passes keeps those files only if they are outputs of the step, or the run has --debug.
  • Warnings and errors go to stderr, prefixed warning: and error:.

Interrupting a run

Ctrl-C during doris run stops the run without losing its record:

  1. Each running command is sent SIGTERM, and SIGKILL if it has not exited after 10 seconds. Its services are stopped the same way.
  2. Each step that was running ends as a step error with the message interrupted. Nothing is cached for it, and its working directory is kept whole.
  3. Every step that had not started is skipped, in this job and in every job after it.
  4. Each job’s result.json and the reports are still written, and the run’s GC root keeps the entries used so far.
  5. doris exits 3, ERROR.

A step that finished before the interrupt keeps its cache entry, so the next run starts from where this one stopped. A second Ctrl-C does nothing more: wait for the commands to stop.

Where doris runs

doris runs on Linux only. It reads /proc/net/tcp to see when a service is listening, puts each command in its own process group, and locks the cache with flock.

It needs git on PATH and expects the repo to be a git checkout. Git decides which files of an input directory are hashed and copied: tracked files, plus untracked files that aren’t ignored. Outside a git checkout, or in a directory git ignores entirely, every file counts. The revision in a result file, and the branch and commit in a GC root, are left out if git can’t give them.

Glossary

Artefact. A declared output of a step, as another step refers to it. Reading one is what makes a step run after the step that wrote it.

Cache entry. The stored verdict and outputs of one step, under its cache key. See The cache.

Cache key. A hash of everything doris knows can change a step’s result: its command, inputs, tool versions and upstream outputs.

Cache unit. A step with child steps and no command of its own, cached as a whole. Only the outputs it exports are stored. Its children run side by side, and can be units themselves. No flow has one yet. See Cache units.

Composite step. A step with child steps and no command of its own, whose children are each cached by itself. A job’s composite steps are flattened when it is planned, into steps named PARENT/CHILD. No flow has one yet. See Composite steps.

Capability. A kind of tool a flow can ask for, such as a simulator or a linter. Each tool that provides it is a plugin: built into doris, or added with the setting plugins.path.

Core. A FuseSoC core: a .core file that names a set of sources, their dependencies and targets. doris gets every design’s sources from FuseSoC.

Counterexample. A shrunk instruction sequence on which the design and the reference model disagree, saved by a TestRIG run.

Debug output. An output of a step that is only of use for looking into it, such as a raw build log. It is kept and cached only in a run with --debug.

Design. One thing that flows are run on, declared by a design.hjson. It can be an IP block, a core or a whole top.

Design file. design.hjson: a design’s name, RTL core and top module.

DUT. Design under test. In result files, dut is the design’s name, as TOP/NAME for a top’s own design.

Flow. One kind of verification work, such as lint or TestRIG. A flow owns its steps and its result format.

Flow config file. A design’s config for one flow, such as lint.hjson. It belongs to the nearest design file above it.

GC root. The record a run leaves in the cache, listing the entries it used. Roots keep entries alive. See Cleaning the cache.

Invocation. One program and everything doris must do to start it: arguments, environment, working directory and staging. A plugin builds it.

Context. The top a design is run in the context of: the design is resolved with that top’s FuseSoC mappings. See Tops and contexts.

Job. One design in one flow with one tool bound to each of the flow’s roles, and for lint in one context, named FLOW/[TOP/]DESIGN@TOOL after the tool in the main role. Another role bound to several tools adds its tool, as @TOOL+TOOL. A job is what a result file describes.

Judge. A function in doris that decides whether a completed step passed or failed, from its exit code, the files in its directory and its parsed results.

Outcome. How a step or job ended: passed, failed, step error, setup error or skipped. See Outcomes.

Parse function. A function in doris that reads what a completed step wrote into results, such as a linter’s messages from its logs. They are written to one of the step’s outputs as JSON, and given to its judge.

Pattern. A regular expression looked for in one output of a step, or in its stdout or stderr. A pass pattern must match for the step to complete, and a fail pattern that matches fails it.

Pin. A mark on a GC root that protects it from collection.

Precheck. A condition a step needs of the machine, checked before any step of a run starts: a program on PATH, an environment variable, a file, a tool’s version, a command that exits with code 0. doris check runs them alone. See Checking the environment.

Probe. How doris asks a tool for its version, such as by running xrun -version. The version is part of the cache key of each step that uses the tool, and is written to the result file.

Project file. project.hjson at the repo root. It marks the root and says where the config files and cores are.

QCVEngine. QuickCheckVEngine, the TestRIG verification engine. It generates instruction sequences and compares the traces two implementations return.

Reference model. The implementation a design is compared against in TestRIG. Sail is the only one.

Resource pool. A named amount of something steps hold while they run: CPU threads, memory, disk space or licences. The steps running at once never hold more of a pool than its size. See Resource pools.

Role. One thing a flow needs a tool for, such as lint’s linter or TestRIG’s dut. Config binds a tool to each role, and a flow’s first role is its main one. See Tools and roles.

Result file. result.json: the versioned JSON record of a job.

Run. One doris run command. It has one or more jobs and one GC root.

RVFI-DII. The socket protocol TestRIG uses: instructions are injected into an implementation, which returns a trace packet for each.

Scope. Where a design sits among the tops: a top, a top’s own design, or shared.

Scratch directory. scratch/doris/ in the repo root, where every job and step has its directory. A step’s directory is its working directory: a step that passed leaves only its outputs there, and one that failed is kept whole. See Working directories.

Service. A program a step starts before its command and stops after it, such as the simulator in TestRIG’s run step. The command starts once every service is ready.

Settings. How and where a run happens on this machine, such as pool sizes and where a tool is installed, from layered settings files and the command line. No setting changes a result. See Settings.

Step. One unit of a job: usually one command, with declared inputs and outputs, cached by itself. A step runs after the steps whose artefacts it reads.

Step error. An outcome meaning the step did not complete. It says nothing about the design.

Top. A design that others are run in the context of, marked scope: top in its design file. Designs below its directory are its own.

Verdict. A completed step’s pass or fail, from its judge and its fail patterns.

Architecture

This part describes how doris is put together: the pieces, what each one owns, and the rules that hold between them. Everything in it is built. What is designed but not built is in the Roadmap, and each page here ends with a link to the matching roadmap page.

The user guide says how to use each piece. This part says why it has the shape it has. Code layout maps the same pieces onto the source tree.

The pieces

flowchart LR
    config["<b>Config files</b><br/>project, design, flow"] --> repo["<b>Repo model</b><br/>designs, tops, contexts"]
    repo --> plan["<b>Flow</b><br/>plans jobs of steps"]
    tools["<b>Tool plugins</b><br/>behind capabilities"] -- invocations --> plan
    plan --> exec["<b>Executor</b><br/>runs the step graph"]
    cache["<b>Cache</b><br/>entries and GC roots"] <--> exec
    exec --> results["<b>Result files</b><br/>versioned JSON"]
    results --> reports["<b>Reports</b><br/>HTML"]
PieceOwnsPage
ConfigTyped files, checked against a schema as they loadConfig and the repo model
Repo modelWhich designs exist, which are tops, and the contexts a design is run inConfig and the repo model
FlowThe shape of one kind of work: its steps, how they connect, and its result formatFlows and tools
Tool pluginOne tool: how to invoke it and how to read its outputTool plugins
StepOne command with declared inputs and outputs. The unit that is run and cachedSteps and execution
ExecutorRunning a job’s step graph: cache check, services, command, completion and verdictSteps and execution
CacheStep results by key, and the GC roots that keep themCache and results
Result filesThe record of each job. Reports are made from them and nothing elseCache and results

What is built

AreaBuilt
FlowsTestRIG and lint
ToolsSimulators: Xcelium, Verilator. Reference model: Sail. Coverage: IMC, and doris’s own for Verilator. Linters: Verilator, Verible, slang, AscentLint
ConfigProject, design and flow config files in HJSON, TOML or JSON, tools bound to each flow’s roles with defaults in the project file, and doris validate
Repo modelTops, a top’s own designs, shared designs, and contexts for lint
Selecting a runDesigns and job IDs, exactly or as globs, filters on every attribute but package and variant, tags, named filter sets, --failed, --jobs-from and --until
StepsSteps that depend on each other through the artefacts they read, with prechecks, services, completion checks, pass and fail patterns, parse functions, judges on their results and debug outputs. Cache units and composite steps, which no flow uses yet
ExecutionLocal only. The steps of every job scheduled together, up to -j at once and within the resource pools: threads, memory, disk and licences, enforced with cgroups if the settings say so, and threads pinned to CPUs if they say that. Every step measured, in a cgroup of its own where it can be
CachePer user, keyed on content, with GC roots, collection by age and size, and pinning
ResultsA result format for each flow, HTML reports, and doris report view for the latest and past runs
Working directoriesCleaned when each step ends, by how it ended. doris run --debug keeps them, and doris clean removes those that were kept
SettingsLayered settings files, --settings, -j and --set, read by every command, with limits from the system and user files and doris settings

Principles

These hold across every piece. The later pages give the rules that follow from each.

  • Config is plain, typed data. A config file is checked against a schema when it loads. Loading never runs a command or reads the environment, so a config means the same thing on every machine. There is no variable substitution.
  • Tool knowledge lives in plugins. How to invoke a tool and read its output is one plugin, which doris embeds or a site installs. A project’s config describes the design and its options, and carries no command lines.
  • A flow never names a tool. It asks for a capability, such as a simulator or a linter, and config says which tool provides it: the project file binds a default for every design, and a design’s flow config file can replace it.
  • Planning is separate from running. A plan is made from config alone: no command is run and nothing is read from the machine. doris plan therefore shows exactly what doris run will do.
  • A step describes everything needed to run it. Its command, environment, working directory, inputs and outputs are declared, which is what lets it be cached, and would let it run elsewhere.
  • Completion and verdict are kept apart. A tool that crashed says nothing about the design, so it is a step error and never a failure.
  • The result file is the record. Reports are made from result files only, so a report can be made again by a later doris.
  • How a run is carried out never changes its result. -j and the gc.* settings are not part of any cache key.

In summary

PieceIn doris
ConfigTyped files with a schema. No substitution, nothing run while loading
Tool definitionsOne plugin per tool, built in or installed. A project vendors none
Unit of workA step: argv, environment, working directory, declared inputs and outputs
What runsConfig files found by pattern. A top’s blocks come from the FuseSoC cores
ReuseEvery step is cached by the content of its inputs
Pass and failCompletion checks, then a judge that works on parsed output

doris drives simulators for TestRIG only; it is not a UVM simulation regression runner.

Config and the repo model

doris knows a repo from its config files: which designs exist, which flows each configures, which designs are tops, and which tops use which shared designs. A run is planned from that model. Configuration gives every key and rule; this page gives the reasons.

Three kinds of file

FileOne perHolds
Project fileRepo, at its rootGlob patterns that find the other files, cores roots, and default tools
Design fileDesignThe design’s name, core, top module, scope and mappings
Flow config fileDesign and flowWhat that flow needs for that design
  • Nothing lists the designs. The project file’s patterns find the config files, each file’s schema says what it is, and a flow config file belongs to the nearest design file above it. There is no hand-kept list to maintain.
  • Facts every flow shares are written once, in the design file. A flow config holds only what is particular to that flow.
  • Paths are relative to the file that declares them. A config copied or vendored with its directory works unchanged, so vendored IP is found exactly as local IP is.
  • Project config says what can run, not how. It is committed and is the same for everyone. Parallelism and cache retention are given on the command line and never change a job’s result.

One model, several formats

The parser is chosen by file extension. HJSON, TOML and JSON each parse into the same Rust types, so validation, defaults, relative paths and unknown-key errors are the same whatever the format. Projects use HJSON, a format widely used for hardware project config.

The model keeps to what every format can express: the top level of a file is a map, keys are snake_case, and there is no null. An absent key means the default.

Every table rejects unknown keys. Checks a type can’t express, such as an unknown tool name, are made as each file loads. doris validate runs the whole load and reports every error at once, and every other command does the same before it starts.

Tops, their own designs, and shared designs

Designs in a project with several tops come down to three cases, and each needs something different:

CaseExampleWhat it needs
Shared IP that resolves on its ownA block with no virtual dependenciesNothing. Run in two tops, its steps have one cache key and run once
Shared IP that depends on a top’s virtual coresuart, through top_pkgA context: the top’s mappings. One job per top that uses it
Generated, top-specific IPalert_handler, one per topA namespace: earlgrey/alert_handler. It has one context, its own top

The first two are not told apart in config. Both are shared designs, planned once per top that uses them, and the cache decides whether the tops’ builds are the same. A bus-attached block whose bus package imports top_pkg is the second case.

The model that covers all three:

  • A top is a design marked scope: top. Its mappings are its context, written once, in its design file.
  • A design below a top’s directory is the top’s own. It is named <top>/<design> and run in that top’s context. scope: shared in its design file keeps it shared.
  • Every other design is shared, and named plainly (aes).
  • The shared designs a top uses come from the cores. A top uses a design if the top’s core depends on the design’s core, so the list is never typed. This also works for repos without topgen, such as mocha.

A top lints its blocks in two ways, and both are kept. The top’s own job elaborates each block as the top instantiates it. Each block’s job elaborates the block by itself, with its default parameters, which finds what the top’s parameters hide.

Only lint uses contexts. TestRIG names a top’s own design <top>/<design> and is otherwise unchanged.

How the tops that use a design are found

doris reads the .core files under the cores roots itself, without running FuseSoC. That is quick, and approximate: it follows a virtual core only when exactly one core provides it, takes every flag ? (...) condition as true, and reads only the default target. A design reached only through a virtual core with several providers is not found to be used by that top. doris flows -t shows the same walk as a tree.

Jobs

A job is one design, in one flow, with one tool bound to each of the flow’s roles, and for lint in one context. Its ID is FLOW/[TOP/]DESIGN@TOOL, with the tool of the flow’s main role: lint/earlgrey/uart@verilator, or testrig/my_core@xcelium. The tools are part of the job, not an option of the run, so a config that names three linters gives three jobs.

Several tools for any role give a job for each combination. A role other than the main one is in the ID only when it has several tools, as +TOOL at the end: testrig/my_core@xcelium+imc. So an ID is as short as it can be and still tell a design’s jobs apart.

The tools for a role come from the flow config’s tool table and, for a role it leaves out, from the project file’s. That is the one key two kinds of file share. A project with one set of linters writes it once, and a design that differs says so in its own config.

Config describes the largest run, and the command line narrows it. doris run FLOW with nothing else covers every design that configures the flow. Design names, job IDs and filters on the jobs’ attributes each keep a subset of those jobs, and --until cuts each job short. Config is never edited to make a run smaller. Choosing jobs has the rules.

Shared designs are de-duplicated by the cache

A shared design is planned once for every top that uses it, with that top’s mappings. Nothing compares the jobs by name. If two tops resolve the design to the same sources and options, the steps after FuseSoC have the same cache key and run once. If they differ, the design really does build differently in each top, and each version runs.

This is correct either way: identical work is never repeated, and real differences are never hidden.

Each context still runs its own FuseSoC step, because the top’s mappings are part of that step’s command, and each context is a job with its own result and report row.

Vendored IP

CaseWhat the vendoring repo does
Upstream has design and flow config filesNothing. Each vendored directory brings its own design.hjson, found by the project’s patterns
Upstream has no config filesGives each design a local directory outside the vendored tree, holding its design.hjson and flow config files
An upstream config needs a local changePatches it like any other vendored file
Tool definitionsNothing. Tools are plugins, so no tool definitions need vendoring

See Vendored designs.

Not built

The roadmap has what is designed here and not built: filters, variants and job selection by ID, more config keys, JSON Schema and other formats, origins and packages for vendored IP and settings files.

Flows and tools

A flow owns the shape of one kind of work: which steps exist, how they connect, and what the result means. A tool, through its plugin, knows one tool: how to invoke it and how to read what it wrote. They meet at a capability, a trait with tool-neutral requests, so a flow never names a tool. A flow names roles, each needing a capability, and config binds a tool to each role.

Switching Xcelium for Verilator in TestRIG, or adding a linter, changes a value in a design’s config and nothing in the flow.

Every tool comes from a plugin: a WebAssembly component doris embeds, or loads from a site’s plugin directory. What this page says of a tool, its plugin does.

Tools

Every tool implements one trait:

#![allow(unused)]
fn main() {
pub trait Tool: Send + Sync {
    /// The name config binds it by, and results record.
    fn name(&self) -> &str;
    /// Find the tool and report its version, for cache keys and results.
    fn probe(&self, env: &ToolEnv) -> Result<ToolVersion>;
    /// Host variables that change the tool's results, and so are part of
    /// the cache key.
    fn key_env(&self) -> &[String] {
        &[]
    }
    /// The hash of the plugin the tool comes from, part of the cache key.
    fn plugin(&self) -> Option<&str> {
        None
    }
}
}
  • probe is how a tool is identified. It reports the tool’s version, which is part of the cache key of every step that uses the tool, and is written to the job’s result file. It is given a ToolEnv, which can run a command and read a variable on the host. A ToolEnv runs each command once and remembers what it printed, because a tool does not change while doris runs.
  • key_env names the host variables that change the tool’s results. A tool is given the whole host environment, but only these are keyed: each one’s name and its value, or that it is not set. Verilator as a simulator names UVM_HOME, the UVM library it compiles. No other tool names one.
  • plugin names the plugin that knows how to run the tool, by its hash, which is keyed too: a new plugin is a miss. A helper program has none.
  • A helper program is a tool too. A step also runs programs that are no capability’s tool, such as cabal, ghc and gcc. Each is a tools::program: a name and the arguments that make it print its version.

Capabilities

CapabilityToolsUsed by
SimulatorXcelium, VerilatorTestRIG
Reference modelSail, as the CHERI RISC-V modelTestRIG
Coverage reporterIMC for Xcelium, and doris’s own for VerilatorTestRIG
LinterVerilator, Verible, slang, AscentLintLint
Source managerFuseSoCEvery flow
CDC checkerMeridian CDCCDC
RDC checkerMeridian RDCRDC

These are the plugins built into doris. A plugin in a site’s plugin directory adds its tool to the capabilities it exports.

Each capability is a trait of its own, and a subtrait of Tool. The linter’s is the simplest:

#![allow(unused)]
fn main() {
pub trait Linter: Tool {
    /// The file list the linter reads.
    fn backend(&self) -> sources::FilelistFormat;
    fn lint(&self, req: &LintRequest) -> Result<LintPlan>;
    /// The log files in the lint step's directory that `parse` reads.
    fn logs(&self) -> Vec<String>;
    /// What the linter reported, from the content of its logs.
    fn parse(&self, log: &str) -> Result<Vec<LintMessage>>;
}
}
  • Requests are tool-neutral. A LintRequest or SimBuild carries the filelist, the top module and typed options. Nothing in it is a tool flag. A SimBuild also carries the defines, the values of the top module’s parameters, DPI sources, and whether UVM, coverage and waves are wanted. Each simulator turns them into its own arguments.
  • A capability returns a small plan, not a step. It holds an invocation and what the flow needs to know about it, such as where the snapshot is, or which exit codes mean the linter finished. The flow decides where the invocation goes. In most steps it is the command. In TestRIG’s run step the simulator’s is a service.
  • Results are tool-neutral too. Every linter’s parse returns LintMessages, so the result file and the report are the same whichever linter ran. A LintPlan carries a judge of those messages, which the lint step is given as a judge on parsed results.
  • A tool that provides two capabilities is one plugin that exports both. Verilator is a linter and a simulator in one plugin. Both have the name verilator and share one tools.verilator table of options.

The source manager is a capability, but not a role. Every flow resolves a design’s sources the same way, with the filelist and flatten steps that tools::sources::steps builds from the plan of the fusesoc plugin. Config binds no tool to it: the flows always use FuseSoC. Its knowledge of FuseSoC’s files is in its plugin, like any other tool’s, so its hash is in the key of both steps.

Features

A simulator says what it supports, as Simulator::features: functional coverage, waves, DPI and UVM. A flow checks the build request against it when it plans a job. A job that needs a feature its simulator lacks fails in doris plan, before anything runs:

job `testrig/core@bare` needs functional coverage from its simulator, and `bare` has none

Xcelium and Verilator both have every feature, so no config can fail this check today.

Simulators and coverage reporters

A coverage reporter reads the databases of its own vendor’s simulators and no others. So a simulator says which format its runs write, as Simulator::coverage_format, and a reporter says which it reads, as CoverageReporter::reads. There are two formats: Cadence’s, which Xcelium writes and IMC reads, and Verilator’s, which doris’s own reporter reads.

The flow checks the pair when it plans a job that collects coverage. A binding that pairs IMC with Verilator is an error:

job `testrig/core@verilator` pairs simulator `verilator` with coverage reporter `imc`: `verilator` writes Verilator coverage databases, and `imc` only reads Cadence ones

The reporter’s role is optional. With none bound, a job gets the reporter that reads its simulator’s databases, so a config rarely names one. A flow can say a design’s jobs don’t use a role at all, with Flow::uses(role, cfg): TestRIG uses coverage only when dut.coverage.functional is set, so the reporters bound to it give no jobs of their own otherwise.

Flows, roles and bindings

#![allow(unused)]
fn main() {
pub trait Flow {
    type Config: DeserializeOwned;
    type Job: Job;
    /// The name the command line and the project file's `tool` table use.
    fn name(&self) -> &'static str;
    /// What the flow needs tools for, the main role first.
    fn roles(&self) -> &'static [Role];
    /// Whether a design's jobs use `role` at all.
    fn uses(&self, role: &Role, cfg: &Self::Config) -> bool {
        true
    }
    /// The job of `design` with `tools` bound to the flow's roles.
    fn plan(&self, repo: &Repo, design: &Design, cfg: &Self::Config, tools: &Bindings)
        -> Result<Self::Job>;
}
}

A role is one thing a flow needs a tool for: a name, the capability the tool must have, and whether the role is optional. A flow’s first role is its main role.

FlowRoleCapabilityOptional
LintlinterLinterNo
CDCcheckerCDC checkerNo
RDCcheckerRDC checkerNo
TestRIGdutSimulatorNo. The main role
TestRIGreferenceReference modelNo
TestRIGcoverageCoverage reporterYes. Left out, a job gets the reporter that reads its simulator’s data

Bindings is one tool bound to each role: the tools of one job. plan takes them and returns that job. A value of the flow holds what one run asks of it, such as TestRIG’s seed.

flows::plan_jobs is the driver every flow shares. It works out the tools bound to each role, makes every combination, keeps those --tool asks for, and calls plan for each.

The command line is still a fixed list of flows that main.rs matches on. Each flow has a plan function of its own shape that the match calls, and that function calls plan_jobs. What the flows share beyond that is the Job trait: an ID, a design, the steps, a way to cut them short for --until, and a way to write the result file.

Choosing tools

A flow config binds tools to roles in its tool table: a role’s name, and a tool’s name or a list of names.

tool: {
  dut: [
    xcelium
    verilator
  ]
  reference: sail
}
  • The project file gives the defaults. Its tool table has a role table for each flow, such as tool.lint.linter. A flow config’s binding for a role replaces the default for that role, whole. A role that neither binds is an error, unless it is optional.
  • Several tools for any role give a job for each combination. The job’s ID ends @TOOL with the main role’s tool. Another role adds +TOOL when it has several: testrig/core@xcelium+imc. A role with one tool says nothing about which job it is, so it is not in the ID.
  • Names are checked when config loads. An unknown flow in the project file, a role the flow does not have, a tool without the role’s capability, and a tool named twice for one role are each an error that doris validate reports.

Options a neutral request can’t express go in a typed table under tools.<name> in the flow config, read only by the jobs that tool is bound in. Every tool has one, except doris’s own coverage reporter, which has no options. A table is keyed by tool and then by step:

tools: {
  verilator: {
    build: {
      args: [
        -Wno-fatal
      ]
    }
    run: {
      args: [
        +UVM_VERBOSITY=UVM_LOW
      ]
    }
  }
}

Options are keyed by step because one tool can be used in two steps, with different arguments in each: xrun builds and runs, and Sail’s model step runs make where its run step runs the emulator. A tools.<name> table for a tool that can fill no role of the flow is an error. Most of a linter’s options still come from the FuseSoC core’s lint target (see Lint).

Invocations

An invocation is one program and everything doris must do to start it. It is all a plugin hands back, so a plugin never starts a process and never sees the machine.

FieldMeaning
program, argsThe command. An argument is text, a named port or the thread count, the last two filled in when the step starts
envVariables set for the program, on top of the whole host environment
cwdThe working directory. Default: the step’s directory
stageWork done just before the program starts: make a directory, make a symlink, or copy a source tree
needsPrograms the command runs itself, such as the compiler a Makefile calls. Checked on PATH like program
host_envVariables worked out on the host when the program starts, such as a library path. The request is keyed, not the answer
toolsThe tools the invocation uses. The version each one’s probe reports is keyed, and so is each variable of its key_env
resourcesWhat the program holds from a resource pool while it runs, such as one xcelium licence. Not keyed
threadsThe CPU threads the program uses: a count, one by default, or every thread of the pool. An argument can stand for the count it is given. Not keyed
prechecksConditions the program needs of the machine, checked before any step of the run starts, such as a variable being set. Not keyed

Planning never runs a command or reads the environment. Anything that depends on the machine is declared: a host_env variable, a port, or a tool whose version is wanted. The executor answers when the step starts, and the cache asks each tool’s probe when it works out a step’s key. This is what makes a plan repeatable and a cache key the same on every machine.

A probe that fails still gives a key. The version is then unknown, keyed like any other. A missing program is caught by the check before the run, not by the probe.

A command is a program and an argument list. It is built from typed values and run without a shell. A step that needs a pipeline asks for a shell in so many words: Invocation::shell(script) is bash -c SCRIPT. No flow has one.

Where tool knowledge lives

Everything about running a tool is in doris, not in the project’s repo:

Tool knowledgeIn doris
The order of a flow’s stagesSteps returned by the flow’s plan
Command and optionsBuilt by the tool’s capability methods from typed requests
Environment passed to the toolSet by the plugin in its invocation
Report parsingThe capability’s parse function, in Rust
Pass and failThe flow’s judge, working on parsed results
Tool special casesEach tool is its own plugin behind a capability

A project provides designs and options, and doris provides tools. A project depends on no other repo for tool definitions.

Not built

Tool capabilities in the roadmap has what is designed here and not built: a command line that works on any Flow, a published schema for each flow’s config, options checked against the steps a tool is used in, tool scripts, and the capabilities of the planned flows. Adding tools and flows says how to add to what is here.

Tool plugins

Every tool comes from a plugin: a WebAssembly component that knows one tool, how to invoke it and how to read what it wrote. doris embeds a plugin for each tool it ships with, and loads more from the directories the plugins.path setting names. Both kinds load the same way, so a tool written outside this repo, such as one for a commercial tool whose details can’t be published, is no different from one built in.

A plugin does what a tool module did before plugins: it builds plans from tool-neutral requests and reads the tool’s logs. The flows don’t change: tools::wasm implements the capability traits on a plugin, so a flow gets a dyn Linter or a dyn Simulator as before.

The interface

The interface is wit/plugin.wit, in the WIT language of the component model, package doris:plugin@0.1.0.

InterfaceWhat it is
typesWhat a plugin hands back: an invocation and its parts, exit-codes, an outcome, a lint-message
hostWhat doris lets a plugin do: read, list and write files while a step runs, and make a report page in doris’s style
toolWhat every plugin exports: its name and licence pools, a check of its options, how to find its version, its key-env, and its callbacks
linterThe Linter capability
simulatorThe Simulator capability
coverage-reporterThe CoverageReporter capability
reference-modelThe ReferenceModel capability
sourcesThe Sources capability: a source manager, such as FuseSoC
crossing-checkerA crossing checker: the CdcChecker or RdcChecker capability, by the kind its kind function says it checks
  • A plugin has the capabilities whose interfaces it exports. doris looks at what the component exports when it loads it. A plugin is built for one of the worlds linter-plugin, simulator-plugin, coverage-reporter-plugin, reference-model-plugin, sources-plugin and crossing-checker-plugin, or a world that includes two, as Verilator’s includes linter-plugin and simulator-plugin.
  • Every function is given the tool’s options: its tools.<name> table of the flow config, as JSON, or {} if there is none. The plugin reads them into its own type, which denies unknown fields, so check-options finds a mistake when the config loads and doris has no type for any tool’s options.
  • Paths cross the interface as text. In a path that is not UTF-8, the bytes that are not are replaced with U+FFFD.

Plans, and callbacks

A plugin never starts a process and never sees the machine. Planning is a function from a request to a plan: an invocation doris runs, and what the flow needs to know about it. The rule that planning never runs a command or reads the environment is kept by the sandbox, not by review: a plugin has no way to do either.

What a plugin does itself when a step runs is a callback. Verilator’s instrument step rewrites sources, FuseSoC’s flatten step rewrites a file list, and the doris coverage reporter reads a coverage database. A plan names such work with a callback: data the plugin made when it planned the step, such as JSON. When the step runs, doris hands it back to the plugin’s tool.run, or to tool.judge to decide a step’s outcome.

  • A callback is keyed by what it is. The step is keyed by the callback’s data and the plugin’s hash, as Step::params. Everything that changes what the callback does is in its data, because that is all the plugin is given.
  • A callback can read files in its job’s directory, and write them in its step’s. A relative path is relative to the step’s directory. Paths are made absolute and lose their .. before they are checked, so ../filelist/work/src/a.sv from the instrument step is read, and /etc/hostname is not. While planning, a plugin has no files at all.
  • The check is of the path’s text, not of where it leads. Symlinks are not resolved, so a symlink in the job’s directory that points out of it, such as one a step stages, is followed. A callback can read, and write, what such a link reaches.

The sandbox, and what it does not do

A plugin is built for wasm32-unknown-unknown, with no WASI. Beyond computing, it can do only what host allows. That makes a plan repeatable, and keeps a plugin’s own file access to paths in its job, as above: not to the files those paths reach through a symlink.

It does not make a plugin safe to run. A plugin’s plans are commands doris runs, so a plugin can run anything a command can. Install a plugin as you would any tool: from someone you trust.

Loading

  1. The embedded plugins come first, then each .wasm file in the plugins.path directories, in the order of the directories and then of the file names. The order is the order tools are listed in, such as the known linters in an error message, and the order default_reporter looks for a coverage reporter in.
  2. A file whose tool has the name of an embedded one replaces it, so a site can ship a newer plugin for a tool doris has. Two files for one tool are an error.
  3. Plugins are loaded the first time a tool is asked for, compiled in parallel, and asked for their name and licence pools. A command that uses no tool, such as doris gc, loads none, unless the settings give a tools.NAME.path: every command checks that its tool exists, which loads them all.
  4. Compiled code is cached in plugins/ in the per-user cache directory, named by the hash of the component and of the engine’s settings. Compiling all the embedded plugins takes under a second the first time, and loading them from the cache takes milliseconds after that. A cache that can’t be written only costs the compile.

A call instantiates the plugin afresh. Calls share nothing, so they can be made from any of the executor’s threads, and one can’t leave state for the next.

Cache keys and versions

A tool’s plugin is part of the key of every step that uses it. Tool::plugin gives the SHA-256 of the component, and the cache keys it with the tool’s version and key_env. A new plugin is a miss, as a new version of the tool is, so a plugin’s own behaviour needs no version bump.

The interface has a version, 0.1.0, in its package name. A plugin built for another version doesn’t link, and loading it is an error that names the file. The interface stays at 0.x, free to change, while every plugin is in this repo.

Building

build.rs builds the plugin crates in plugins/ for wasm32-unknown-unknown, with the plugin profile, makes each a component with wit-component, and embeds them. It needs the wasm32-unknown-unknown standard library and lld, which the dev shell has. A plugin crate is a library: build.rs asks for a cdylib with cargo rustc --crate-type cdylib, because a native cdylib can’t be linked with the component’s export names. So a plugin’s unit tests run natively, with cargo test --workspace.

Adding tools and flows says how to write a plugin.

Steps and execution

A job is a list of steps, and a step is the unit that is run and cached. This page gives what a step declares, the rules steps keep, and how the executor runs them. How a step runs walks through one step from the user’s side.

What a step declares

A flow builds each step from an invocation and what the flow itself knows:

FieldMeaning
name, dirIts name, unique in the job, and its own directory, emptied each time the step runs
actionOne invocation, an in-process function given the step’s directory, or child steps, which make the step a cache unit or a composite step
readsThe artefacts of other steps that it reads. Each makes the step run after the step that wrote it
depsThe steps that must pass first: every step it reads an artefact of, and any it is told to run after without reading
inputsNamed files or directories in the repo. Their content is keyed
paramsFor an in-process step: the values its function captured that change its result, keyed as text
prechecksConditions checked before any step of the run starts
servicesEach has a name, an invocation, named ports, a readiness check, a start-up timeout, a stop rule, a stop timeout, and inputs and outputs of its own
outputsNamed files or directories. Each must exist when the step completes, and is what the cache stores. One marked debug is kept and cached only in a run with --debug
timeoutWall-clock limit for the command
complete_onThe accepted exit codes, or any
pass_patternsRegular expressions that must each match in a named output, or the step did not complete
fail_patternsRegular expressions of which any match in a named output fails the step
fail_on_exitA message that fails the step if its command exits with a code other than 0, with {code} in it replaced by the code
judgeA function given the exit code, the step’s directory and its parsed results, returning passed or failed
parseA function run in-process once the step completed, which reads what it wrote into results, written to one of its outputs as JSON
run_after_failRun even when a step it depends on failed
volatileNever cached. No flow sets it
resourcesWhat it holds from each resource pool while it runs: threads, memory, disk, licences. The sum of what its command and services declare and what the flow’s config gives the step

Everything except a name and an action is optional.

Rules steps keep

  • One command per step, so each is cached by itself. A step that needs a pipeline says so: Invocation::shell runs a script with bash -c. Every other command is an argument list, and no flow uses a shell.
  • A step writes only inside its own directory. A tool that builds next to its sources is given a copy of them, staged into the step’s directory.
  • Files a step writes for other steps use relative paths. Step directories are siblings, so the same relative path reads the same from any of them, and in any checkout.
  • A dependency is named once, by reading an artefact. A step that names a path in another step’s directory without running after that step is an error when the job is planned.
  • Only declared outputs are kept. A step that passed has its outputs in its directory and nothing else, and so has a step taken from the cache. A later step, and the result file, may rely only on those.
  • Steps don’t use the network. Sources already in the repo are built as ordinary steps.

Artefacts and dependencies

An artefact is a declared output of a step, as another step refers to it: the step’s name, the output’s name and its path. Step::artefact(name) gives one, and Step::reads(&artefact) makes the reading step depend on the step that wrote it. So a flow names a dependency once, and takes the path it puts in a command from the artefact it reads:

#![allow(unused)]
fn main() {
let filelist = source_steps.flatten.artefact("filelist");
let lint = linter.lint(&LintRequest {
    dir: lint_dir.clone(),
    filelist: filelist.path.clone(),
    flag_file,
    top,
})?;
let lint_step = Step::exec("lint", lint_dir, lint.invocation).reads(&filelist);
}

Step::after orders a step after another without reading anything of it. No flow needs it.

Two checks are made when a job is planned, by exec::validate:

  • What a step reads is a declared output. Reading an artefact that no step declares is an error: step `b` reads `a.out`, which is no output of a step.
  • A path into another step’s directory needs the dependency. A step whose command, arguments, environment or working directory names a path in the directory of a step it does not run after, directly or through other steps, is an error: step `b` names `...`, in the directory of step `a`, which it does not run after: read the artefact, so that it does. Without the dependency the step could start before what it reads is written, and its cache key would not hold what it read. The check covers a step’s services and the children of a cache unit too.

An in-process function is not checked this way, because the paths it uses are inside the function. It still declares what it reads.

Completion and verdict

A step is judged in two stages, and they are never mixed:

  1. Completion decides whether the tool ran to the end: no service died, the command was not killed, the exit code is one the step accepts, every declared output exists, and every pass pattern matches. Failing any of these is a step error.
  2. Verdict decides pass or fail, and only for a step that completed. A step fails if its judge says so, if a fail pattern matches, or if it exited with a code other than 0 and has a fail_on_exit message. Otherwise it has passed.

So a crashed tool, a timeout or a missing licence is never reported as a failure of the design, and never cached. A linter that exits non-zero because it found something still completes: its step accepts that exit code, and the judge decides from the parsed messages.

A pattern is a regular expression looked for in one output. It names the output by its name, or the command’s stdout or stderr. The syntax is that of Rust’s regex crate, matched in multi-line mode, so ^ and $ are the ends of a line. Pattern::text takes literal text and escapes it, and Pattern::regex takes an expression.

RuleDecidesMessage
pass_patternsCompletion. Each must match, or the tool did not finish normally: a step errorThe exit code, the pattern and the file it was looked for in
fail_patternsThe verdict. A match of any one fails the stepThe pattern, the first line that matches and its file
fail_on_exitThe verdict. An exit code other than 0 fails the stepIts own, with {code} replaced by the exit code
judgeThe verdict. It is given the exit code, the step’s directory and its parsed results, and can also return a step errorThe function’s own
  • Of several rules, a step error wins, then a failure. A missing output or pass pattern is a step error before the judge is asked. A judge’s step error or failure comes before a fail pattern’s.
  • Patterns are checked when the job is planned. One that does not compile, or names something that is not an output of the step, stdout or stderr, is an error before anything runs.
  • Patterns and the fail_on_exit message are part of the cache key. A judge and a parse function can’t be hashed: a plugin’s are covered by its hash, and doris’s handling around them by the key protocol. A judge is keyed by its presence, and a parse function by the output it writes to; what either captured that changes the verdict goes in the step’s params.

A step with a parse function has its results parsed once. When the step completes, before the outputs are checked, the function is run in-process in the step’s directory, and what it returns is written as JSON to the output it names (Step::parsed(name, path, function)). The judge is given the same value. The results are an output like any other, so they are in the cache, and a step taken from the cache has them: a flow reads them for its result file instead of parsing logs again. A parse function that fails is a step error.

A judge is preferred to patterns, because it works on parsed results and not on log text, so it can weigh what a tool reported, such as waived messages or expected failures. Lint’s step has a parse function that reads the linter’s logs into messages.json, with each file named from the job’s directory, and its judge decides from those messages; the result file is written from them too. TestRIG’s run step has no judge: QCVEngine exits with the number of failing tests, so a fail_on_exit message fails it on a non-zero exit code, and a pass pattern tells a finished run from a crash. No flow has a fail pattern yet. Outcomes lists the five outcomes a step can have.

A step after one that did not pass is skipped, unless it sets run_after_fail. Such a step also runs when a step it depends on failed, as a report on a failing run does. A failed step completed, so its outputs are there and are in the cache. The step is still skipped after a step error, a setup error or a skip. TestRIG’s coverage step sets it.

Prechecks

A precheck is a condition a step needs of the machine. The prechecks of every selected step of every job are run before any step starts, so a run that can’t succeed fails in seconds, not after its upstream steps.

PrecheckHolds whenDeclared by
Program(name)The program is on PATH, or in the directory settings give the invocation’s toolNothing: every program a step runs by name is checked
Version { tool, at_least }The tool’s probe reports that version or a later oneNo flow yet
Env(name)The environment variable is set, and not emptyA Verilator build with dut.uvm: UVM_HOME
File(path)The file or directory existsTestRIG’s run in replay mode: the trace directory
Command(argv)The command exits with code 0Enforcement: systemctl --user
  • A program is checked without being declared. Every program an invocation runs by name, and every program it lists in needs, is a Program precheck. A program given as a path is usually built by an earlier step, so it is only checked when it is started.
  • A precheck is declared where the need is known: on a step, on its command’s invocation, or on a service’s invocation. A plugin declares what its tool’s commands need, and a flow what its step needs. The children of a cache unit are checked like any step.
  • Version compares the first dotted number in the probe’s output with the one asked for, number by number: 5.030 is 5, then 30. The tool must be one the step’s invocations declare.
  • Prechecks are not keyed. They decide whether a step can run, not what it makes.

doris check runs only the prechecks, and lists each with how it is met or why it is not (see Checking the environment). Both read the settings, so they check with the same pool sizes and tool directories. doris run exits 2 if any fails, and doris check exits 1.

Services

Some steps need programs running beside the command, such as the simulator and the reference model in TestRIG’s run step. A service is an invocation with one or more named ports. The executor allocates a free port for each port of each service, all different, starts them, waits until each is ready, runs the command, and stops them by each one’s stop rule. Port numbers are filled in when the step starts and are not part of the cache key.

FieldMeaningDefault
portsThe names of its ports, which its invocation and the step’s command refer to with Arg::port. The first is its ownThe one it was made with
readyWhat shows it is ready: its first port is listening, a file it writes exists, or a line of its log matches a regular expressionIts port is listening
inputsFiles from the repo it reads. Keyed like the step’s inputs, as SERVICE.NAMENone
outputsWhat it writes that is kept, such as a log, a coverage database or waves. Each is an output of the step, SERVICE.NAMENone
ready_timeoutHow long it has to become ready. Not being ready in time is a setup error60 seconds
stopSend SIGTERM as soon as the command ends, or wait a given time for it to exit by itselfSIGTERM
stop_timeoutHow long it has to exit after SIGTERM before it is killed. Having to kill it is a step error10 seconds

Service::new(name, port, invocation) gives the defaults, and .port, .input and .output add to them. A service’s invocation carries prechecks and resources like a command’s: TestRIG’s dut service holds an Xcelium licence. Both TestRIG services are ready by their ports. The file and log checks, and waiting for a service to exit by itself, have no flow that uses them.

A service’s stdout and stderr go to one file, <service>.log in the step’s directory, which a pattern names as SERVICE.log.

A service’s outputs are checked once it has stopped. Step::service makes each an output of the step named SERVICE.NAME, so it is checked, cached and read by other steps like any output, and is checked with the step’s own outputs, after every service has been stopped: a simulator that writes its coverage when it is stopped has written it by then. TestRIG’s dut service declares the simulator’s log, coverage database and waves, as dut.log, dut.coverage and dut.waves, and the coverage step reads dut.coverage. No flow gives a service more than one port or an input yet.

Working directories and clean-up

When a step ends, what is left of its working directory depends on how it ended:

The stepIts directory
PassedIs deleted, except its outputs that are not debug outputs
FailedIs kept whole if dirs.keep_failed is true, which is the default. Otherwise it is cleaned like a pass
Did not complete: a step error, a setup error or an interruptIs kept whole
Passed or failed in a run with --debugIs kept whole
  • A passed step leaves only what other steps and the result may read. The command’s stdout.log and stderr.log, a service’s log and every scratch file go, unless the step declares them as outputs. Lint declares the linter’s logs, and TestRIG’s run the engine’s and the simulator’s.
  • A debug output is for looking into the step, such as a simulator’s raw build log. Step::debug_output declares one. It must exist like any output, but it is deleted with the rest when the step passes, and is not stored in the cache. TestRIG’s Xcelium build declares build.log as one.
  • A run with --debug keeps everything, and stores each step’s debug outputs in its cache entry. An entry records whether a debug run stored it, and a debug run does not take a step from an entry that one did not: the step runs again. Debug outputs are not part of any downstream key, so a debug run and a plain run agree on every key.
  • A directory kept whole has a marker file, .doris-kept, holding failed, interrupted or debug. doris clean finds kept directories by it. So does doris run, which at its start removes those older than dirs.work_max_age, 14 days by default.
  • A step taken from the cache is not cleaned. If its outputs are already there with the stored content, its directory is left as it is, kept files and marker included. If none is, the directory is emptied and the outputs are put back.

The clean module does this. Working directories has the user’s side.

Cache units

A cache unit is a step with child steps and no command of its own (Step::unit). It is for a large step: one that is worth resuming part-way when it is interrupted, such as a synthesis run with several long stages, or a tool whose raw output is unfit for caching, such as a log with timestamps and paths in it, or gigabytes of which only a summary matters. The tool runs in one child, another child reduces what it wrote, and the unit stores only what it exports.

A unit is never needed: a step that is quick to run again, and whose outputs are fit to cache, stays a leaf, without the unit’s journal and extra bookkeeping. Lint is one: the linter runs in seconds, and its messages are parsed by a parse function on the step.

No flow has a cache unit yet. They are for the planned synthesis flow, and are exercised by unit tests only.

  • A unit is one step to everything outside it. The scheduler sees one node, and --until names the unit, not a child. A result file records the unit as one step, with an entry under it, children, for each child that ran or was resumed: its name, outcome, message and time.
  • It is cached as a whole. Its key is made from its own inputs, its upstream steps’ outputs, and the definition of each child with the children that child runs after. A change to any child is a new key. What children hand each other is not hashed, because it is made from what is.
  • Only exports are stored. Step::export(&artefact) makes a child’s artefact an output of the unit, named CHILD.OUTPUT, which other steps read. Everything else a child writes is scratch, deleted when the unit’s directory is cleaned as any step’s is.
  • A child works in a directory of its own, or in the unit’s. One in a directory of its own, inside the unit’s, has it emptied before it runs, as any step has. One whose directory is the unit’s own shares it with the siblings that do the same: it is not emptied, so a child reads what an earlier one left there by the same relative path, and a tool that expects its working files beside it finds them. The unit’s directory is emptied once, when a run of the unit starts from nothing. A child that shares it has its command’s logs named after it, CHILD.stdout.log and CHILD.stderr.log, so siblings’ logs are not mixed. A child that runs again on a resume starts with what its interrupted attempt left there.
  • Children run side by side. A child starts once the children it depends on are done, beside any others that fit in what the unit holds. The unit holds, for its whole run, enough of each pool for the children at one depth to run at once: those that depend on no sibling, then those that depend only on them, and so on, the most over the depths. It holds no more of a pool than the pool has, threads no more than one step can have, and no less than the hungriest child needs. With less room the children take turns; the first that is ready always starts.
  • A child only completes or not. It may have accepted exit codes, pass patterns and outputs that must exist, but no judge and no fail patterns. A child that does not complete ends the unit as a step error, child `NAME`: ..., and one that could not start as a setup error with the same prefix. No other child starts after it, and the unit ends when those running beside it have ended. So a tool that finds errors still completes, and the child after it still writes the summary.
  • The unit has the verdict, from what it exports: its pass and fail patterns name exports, and its judge is given the exit code of the last child, in the order they were declared, that ran a command.
  • A unit can be a child of a unit. It is cached only as part of the outer unit, keeps no journal of its own, and only completes or not, like any child. Its children are reported as INNER/NAME.

These are checked when a job is planned: a unit has at least one child and no services of its own, each child’s directory is the unit’s or inside it, a child that is a unit has a directory of its own, and a child is not volatile, has no run_after_fail and has no verdict of its own.

A unit that did not complete is resumed. While a unit with a cache key runs, a journal in its directory, .doris-journal.json, records each child that completed, under the unit’s key. If the unit ends in a step error or is interrupted, its directory is kept whole, journal included. The next run of a unit with the same key does not run a child the journal records, as long as that child’s outputs are still there and no child it depends on has just run again. A unit with another key starts from nothing. The journal is deleted when the unit completes, and never enters the cache.

Composite steps

A composite step is a step with child steps and no command of its own (Step::group), whose children are cached each by itself. It groups steps under one name, as a cache unit does, without making them one piece of work: a change to one child runs that child and what reads it, and not its siblings.

A job’s composite steps are flattened when it is planned (group::flatten), so the scheduler, the cache and the result file only see leaves:

  • Each child is a step named PARENT/CHILD, and the child of a composite in a composite PARENT/CHILD/GRANDCHILD. A / in any other step’s name is an error.
  • A child runs after what its parent runs after, reads what it reads and has its prechecks, as well as its own. Children name each other by their own names, as siblings.
  • A parent exports what its children write. Step::export on a composite step adds an output CHILD.OUTPUT, as on a unit. A step that reads it reads the output of the child that writes it, and runs after that child only. A step that runs after the composite step runs after all of its children.
  • --until takes either name. PARENT/CHILD keeps that child and what it needs, and PARENT keeps all of its children.
  • A composite step has no verdict, command, services, inputs, resources or timeout of its own, and no outputs but its exports. Each child’s directory is inside its own. These are checked when the job is planned. A composite step can be a child of a cache unit, and is then flattened inside the unit.

A job is a list of steps, the same thing as a composite step at the top: the flattening is what makes a job’s steps the scheduler’s nodes. A step with several commands, each cached by itself, is written as a composite step with a child per command. No flow has a composite step yet.

How steps are run

One module, exec, both schedules and runs. There is no separate scheduler or executor interface.

  • Before anything starts, every precheck of the selected steps is run, and every step is checked against the sizes of the resource pools: one that needs more of a pool than the pool has could never start. doris check makes both checks.
  • The jobs of a run are scheduled as one graph, in the order planned, so steps of different jobs run together. A job’s result file is written when its last step ends, while other jobs are still running.
  • Steps with no dependency between them run in parallel, up to -j at once over every job. Each running step has an operating-system thread, which polls its command and services ten times a second for an exit, a timeout or an interrupt.
  • A step is looked up, then run. Its thread works out the cache key and restores the step from the cache if it is there. A step that has to run goes back to the scheduler, which starts it once nothing holds it back.
  • A step that runs holds what it declares from the resource pools, from when it starts until it ends: at least one CPU thread, and whatever memory, disk space and licences it declares. While a pool has too little left, the step waits. Steps after it that need nothing from that pool go ahead; steps that do need it wait behind it. A pool with no size is not limited. A step taken from the cache holds nothing.
  • Three pools have a size from the machine: threads is its CPU threads, memory its memory, and disk the space free in the scratch directory, read whenever a step asks. A commercial tool’s licence pool is as large as the machine’s CPU threads, and no larger than 16. Any other pool is not limited until it is given a size.
  • A tool is told how many threads it has. An invocation that takes every thread has an argument that stands for the count, filled in when the step starts, like a port. The count is not keyed.
  • A step two jobs share runs once. Two steps with the same cache key, such as the reference model in each of a design’s TestRIG jobs, are not run together. The second waits for the first, and is then taken from the cache.
  • Every step is measured: when it started and ended, how long it was held back and by what, and the CPU time and peak memory of its processes. The kernel reports those when doris waits for each process (wait4), so they cover what the process started and waited for itself. Where it can be, each step is also measured in a cgroup of its own, with no limits unless enforcement sets them: a thread the enforce module starts with the cgroup reads memory.current and cpu.stat each second, and the working directory’s size as often as is cheap, and when the step ends memory.peak and the total CPU time. That gives the peak memory of all the step’s processes together, how many CPUs it kept busy, and its peak disk. A step with services has a cgroup below its own for each part, its command and each service, read the same way, so each part is measured on its own. See Metrics.
  • Each command and service is its own process group, so an interrupt or timeout stops everything it started: SIGTERM, then SIGKILL after 10 seconds.
  • A step after one that did not pass is skipped, unless it runs after a failure.
  • A step’s directory is cleaned when the step ends, by how it ended.
  • Commands get the whole host environment, as they would if run by hand. EDA tools depend on too many variables to list. What is restricted is the cache key, not the environment. The one change is PATH: an invocation whose tool settings give a directory, with tools.NAME.path, has it in front of PATH, and no other invocation does.
  • Resources are reserved, and enforced if the settings say so. By default nothing stops a step that uses more memory or threads than it holds. With resources.enforce the enforce module gives each step that starts a process a cgroup of its own, with its memory limit set to the memory it holds and its CPU quota to its threads. For a step with services those are the sum of its parts’, and the parts’ cgroups below it have no limits of their own. With systemd it is a transient slice, and each process is started in a scope in it with systemd-run --user --scope. With cgroup it is a directory doris makes in a delegated cgroup v2 hierarchy, and each process writes itself into the directory’s cgroup.procs between fork and exec. A step the kernel kills for its memory is a step error that says so. So is one that writes more to its working directory than the disk it holds, which doris measures while the step runs and when it ends. With resources.pin the scheduler also hands out CPUs: a step is given as many of the free ones as it holds threads, and its processes are started with their affinity set to them. See Enforcing what a step holds.

doris is Linux only: a port is listening when it is in the LISTEN state in /proc/net/tcp, process groups are used directly, and the cache and each job’s directory are locked with flock.

Runs at the same time

Two doris run processes in one checkout share three things: the jobs’ working directories in the scratch directory, the files each flow’s reports are made from and into, and the cache. Each is made safe in its own way. Runs at the same time has the user’s side.

Why a job’s directory has one run at a time

A job’s directory is the job’s workspace for the whole run, not only while a step runs. A step that passed leaves its outputs there, and later steps of the job read them by relative paths such as ../filelist/work/src/.... A step taken from the cache has its outputs copied back there. The result file is written from there when the job ends. And a step that is about to run empties its directory first.

So two runs of one job would undo each other. One run’s build empties build/ while the other run’s run step is starting the simulator it built, or one run puts back a cached filelist/ while the other is reading it. Nothing breaks between different jobs: no step writes outside its own directory, and no step reads another job’s directory.

The job lock

The lock module gives each job a lock file, .doris-lock, in the job’s directory, such as scratch/doris/lint/aes@verilator/.doris-lock. The file is empty. The lock is an exclusive flock on it, and the file stays when the lock is let go.

  1. When the lock is taken. doris run plans, checks that every step fits in the pools, and runs the prechecks. Then it takes the lock of every job it is about to run, before it opens the cache or writes its GC root. A run whose prechecks fail never waits for a lock.
  2. Without waiting first. Each lock is first tried with LOCK_NB. If another run holds it, the run prints waiting for another doris run of DIR to finish, then waits with a blocking flock.
  3. In the order of the jobs’ directories. The directories are sorted, and the locks taken one by one. Two runs that want some of the same jobs take them in the same order, so neither can hold one job while waiting for a job the other holds. One of them waits at the first job they share, holding only jobs that come before it.
  4. Before the interrupt handler. doris handles Ctrl-C itself once steps run, so it can stop them cleanly. That handler is installed after the locks are taken, so Ctrl-C ends a waiting run at once, as the default signal action does.
  5. Held to the end of the run. The locks are let go when run returns, after every result, the metrics and the reports are written. Not job by job: a job that has ended may still be read for the reports.
  6. Let go by the kernel however the run ends. A flock belongs to the open file, which the kernel closes when the process exits, cleanly, by a signal or by a crash. No stale lock is left behind, and there is nothing to remove by hand.

A job’s whole run is the unit, not a step. A step lock would let two runs of one job interleave, and a later step of one would read the outputs an earlier step of the other had just replaced.

Cleaning up around a run

doris clean and the removal of old kept directories when a run starts both delete kept step directories, which may belong to a job another run holds. Before deleting one, each looks for a .doris-lock in the directory and each directory above it, up to the one being cleaned, and tries a shared flock on each it finds with LOCK_NB. If any is held, the directory is left. doris clean lists it as in use. Trying the lock takes it for a moment, so a run starting at that moment waits that moment.

Files written for more than one run

FileWritten byHow two runs share it
A job’s result.jsonThe run holding the jobWritten to a temporary file beside it and renamed, so the report of another run never reads half of one
The flow’s report pages and indexEvery run, when it endsMade again from every result file there, and renamed into place. The last run to end writes the index others will see
The flow’s metrics.json and its pageEvery run, when it endsRenamed into place. They are the metrics of the run that ended last. Each run’s own are kept with its GC root
A GC rootEach run, its ownNamed by the time and the process ID, so two runs never write one
The measurement storeEach run, a file of its ownNamed by the time, the host and the process ID

The temporary file is .<name>.<pid>.tmp, so two processes never write one, and a rename within a directory replaces the file in one step.

The cache

The cache is per user and shared by every checkout, so it was already shared between runs before runs of one checkout were. A run holds the cache’s lock shared, and only a collection takes it exclusive.

Two runs can still work out the same key at once, for jobs that share a step, such as a block’s lint in two tops’ runs. Both run the step, each in its own job’s directory, and both store it:

  • An entry is built in tmp/ and renamed into place, so a reader sees an entry whole or not at all.
  • An entry being replaced is renamed away before it is deleted. A run copying outputs out of it then fails to find a file, rather than copying half of them. A restore that fails is a miss, and the step runs.
  • If another run’s entry lands first, it is kept, and this run’s copy is dropped. The key is the same inputs, so either serves. The run that dropped its copy still has its own outputs in its job’s directory, and keys its downstream steps from them.

Within one run, a step two jobs share runs once: the second waits for the first. Between runs nothing makes one wait for the other’s step, so a shared step that misses in both runs runs twice.

What is not shared

  • Resource pools are per run. Each run schedules within its own -j and pool sizes, and knows nothing of what the other holds. Sharing licences between runs and hosts is on the roadmap.
  • Ports are not reserved between runs. A step asks the kernel for a free port for each of its services, then lets the ports go just before the services start. Another run, or any other program, could take one in that moment. The service then fails to listen, and the step ends in a step error.
  • The lock needs flock. On a filesystem without it, flock fails and the run stops with an error. NFS on Linux emulates flock with byte-range locks.

Not built

The roadmap has what is left of the step model: normalised exports and flows that use more of it. Scheduling and remote execution has a separate executor interface and remote executors.

Cache and results

doris keeps two kinds of thing: cache entries, which let a step be skipped, and result files, which are the record of a job. This page gives the reasons behind each. The cache, Cleaning the cache and Results and reports say how to use them.

Cache keys

Every step of a job is cached by itself. Its key is a hash of what doris knows can change its result: the command and its services, the versions of the tools it declares, the content of its inputs, and the content of its upstream steps’ outputs. What is in a key has the full list.

  • A key holds nothing tied to one machine. Paths are written relative to the step’s directory, the job’s directory or the repo root, so a key is the same in every checkout. Port numbers, and anything worked out on the host when a step starts, are left out.
  • The environment is keyed by inclusion. A tool is given the whole host environment, but only what its invocation sets or asks for, and the variables the tool names as its key_env, are part of the key. Keying on everything would let any unrelated variable invalidate the cache, and no two machines or users share an environment. The cost is that a variable that changes results without being declared gives a stale hit.
  • A key_env variable is keyed by its value, or as not set. It is the one thing in a key that is read from the host besides tool versions, so a tool names a variable only when it changes what the tool writes. Verilator as a simulator names UVM_HOME.
  • A tool is identified by its version string, which its probe reports. Its install path would tie keys to one machine, and installs are too large to hash. A probe that fails gives the version unknown.
  • A tool’s plugin is identified by its hash. The plugin decides the command, judges the step and reads its logs, so a new plugin is a new key for every step that uses its tool (see Tool plugins).
  • Downstream steps are keyed on output content, not on the upstream key. A change that reruns a step but leaves its outputs the same reruns nothing after it.
  • An in-process step is keyed on its parameters. Every in-process step is a plugin’s callback, keyed by its data, which is all the plugin is given, and by the plugin’s hash, as Step::params hashed with paths made neutral: flatten’s holds the file-list format and top module, and instrument’s its coverage scopes and waves top. Without them a change to one could be a stale hit.
  • Inputs are hashed as git sees them: tracked files, plus untracked files that aren’t ignored. Build products lying in the repo don’t change a key.
  • How a run is carried out is not keyed. -j, --debug, timeouts, prechecks, the sizes of resource pools and the gc.*, dirs.* and tools.* settings never change a result, so changing them invalidates nothing.

Only passed and failed are stored. A step error or setup error says nothing about the design, so the step runs again next time.

Cache entries

An entry holds the step’s verdict, a copy of each output, and the keys of the entries it was built from.

  • Debug outputs are stored apart from the others. An entry has debug, whether a run with --debug stored it, and debug_outputs, the hashes of the debug outputs it then has. outputs never lists a debug output, and only outputs feed downstream keys. So a debug run and a plain run agree on every key, and an entry either kind stores serves the steps after it in both.
  • A debug run does not use an entry stored without debug outputs. The debug outputs would be missing, so the step runs again and its entry is replaced by one that has them. A plain run uses either kind of entry.
  • The entry format did not change name. Both fields default when absent, so an entry written before they existed is read as one stored by a plain run. The schema is still doris/cache-entry/1.
  • A cache unit has one entry, for the unit. Its key holds the key of each child, worked out with no upstream outputs, and the children each child runs after. Its outputs are the unit’s exports. A child has no entry of its own, and the journal that resumes an interrupted unit is never stored. See Cache units.

Two steps with the same key share an entry, across jobs, checkouts and projects. This is how a shared design used by two tops is built once, and how the simulators of one TestRIG design share the model and engine builds.

EDA tools are not hermetic, so the cache is only as good as the declared inputs. What is not in a key lists the gaps.

GC roots

The cache is per user and shared by every checkout, so no one run knows what can be deleted. Collection follows Nix generations: every run writes a root naming the entries it used, each entry names the entries it was built from, and a collection deletes what no root reaches.

  • A root is the record of a run. It holds the command line, the revision, the jobs, and each job’s result file, so the report of a past run can be made for as long as its root lives.
  • The newest root of each job on each branch is kept, whatever its age, so a branch left for a month still has a warm cache.
  • A pin protects a root that must be kept, such as a sign-off run.

Result files

Each flow has its own result format with a versioned schema, such as dv/lint-result/1, defined by the Rust types that write it. The metadata every flow shares follows the lowrisc-dv-evidence format, so other tools that read that format see the same fields.

  • A result file is read by its schema. A change old readers would misread gets a new version. Result files outlive the doris that wrote them.
  • A result is written from step outcomes and declared outputs, so it is the same whether a step ran or came from the cache, and whatever was cleaned from the step’s directory.
  • A cache unit is one step in a result. Its children are not listed.
  • A report is made from result files only, never from logs or step directories. A page is not a record: it is made again whenever it is asked for, by the doris that is asked.

Names on disk

Config and result schemas use the neutral dv/ prefix, because other tools read them. Cache entries and GC roots are doris’s own and use doris/. The formats are documented where users meet them: config files, result files and the cache directory.

Not built

The roadmap’s Cache page has keys on the build of doris, a file index, include files, content-addressed blobs and a shared cache. Results has tool versions in the reports, published schemas and Markdown reports.

Developer guide

This part is for working on doris itself. This page covers building and testing. Code layout maps the source tree, Adding tools and flows and Writing documentation say how to change each, and the API documentation is generated from the source. Read Architecture first for how the pieces fit.

doris is a Cargo workspace: the doris binary crate at the root, the plugin SDK in sdk/ and a crate for each tool plugin in plugins/, with this book next to it in docs/. The repo is a Nix flake that provides the toolchain, the formatters and the checks CI runs.

The dev shell

With direnv, the tools are on your path as soon as you enter the repo (run direnv allow once). Without it, run nix develop first. The shell has cargo, rustc, clippy, rustfmt, rust-analyzer, lld, mdbook, mdbook-mermaid, lychee and treefmt. lld links the plugins, which build.rs builds for wasm32-unknown-unknown.

Everyday commands

cargo build                 # a debug build, at target/debug/doris
cargo test --workspace      # the unit tests, the plugins' and the SDK's included
cargo clippy                # lints
cargo run -- -C ../mocha plan lint    # run the working tree against another repo
nix fmt                     # format Rust, Nix, TOML and Markdown with treefmt
nix build                   # the release binary, at result/bin/doris
nix flake check             # everything CI runs

-C DIR is the way to try a change against a real project without installing anything.

Tests

Tests are unit tests, in a tests module at the end of the file they cover. They need no EDA tools: they build repos and step graphs in temporary directories, and run small shell commands as steps. cargo test --workspace runs them all, and so does the Nix build of doris. A plain cargo test runs only the doris crate’s.

There are no tests that run a simulator or a linter. A change to a plugin is checked by hand against a project: doris plan -v to read the commands, then a run, then the checks on the step’s page.

After changing doris’s own part in a result, bump KEY_PROTOCOL in src/cache.rs. That is how it makes a key, how it reaches a verdict from a step’s rules, or what a flow does around a plugin’s results, such as lint’s writing of a linter’s messages to messages.json. Every key holds the protocol, not doris’s version, so without a bump a rebuilt doris takes old results from the cache. A changed plugin needs no bump: its hash is in the key of every step that uses its tool (see What is not in a key).

What CI checks

nix flake check runs the same checks as the Checks workflow:

CheckWhat it does
formattingtreefmt: rustfmt, nixfmt, taplo for TOML, prettier for Markdown and YAML
dorisBuilds the release binary and runs the tests
docsBuilds this book and the API documentation
docs-linksChecks every internal link of the built book

The Documentation workflow builds the same book on every pull request and publishes it to GitHub Pages on a push to main.

Conventions

  • Errors are anyhow errors with context that names the file or the job. A message says what is wrong and what would fix it.
  • Paths shown to people go through ui, which makes them relative to the repo root. Files written for tools keep absolute paths.
  • No shell. A command is a program and an argument list, built by a plugin from typed values.
  • Nothing tied to one machine goes in a cache key. See Cache keys.
  • Document the behaviour, not the plan. When a change alters what a user sees, update the page that describes it in the same change. What is designed but not built belongs in the Roadmap.

Licence

doris is licensed under Apache-2.0.

Code layout

This page maps the source tree and follows one doris run through it. Architecture explains the pieces and the rules they keep, and the API documentation has every type and function.

Modules

ModuleDoes
mainThe command line: parses arguments, picks the flow, and drives planning, running and reporting
configThe project and design file types, and the tool and tools tables flow configs share. Parsers for HJSON, TOML and JSON, chosen by extension
repoFinds the project file, then the design and flow config files, and checks them. The project file is the one nearest above the start directory, or the one --project gives
compatMakes a doris project from another tool’s config files, for --compat: OpenTitan’s dvsim lint configs. It writes ordinary config files for repo to load, and nothing else uses it, so it can be removed whole
coresThe FuseSoC core index: which core depends on which, read from the .core files under the cores roots without running FuseSoC
topsTops and their contexts: which top each design is run in the context of
selectChoosing jobs: each planned job’s attributes, the KEY=GLOB filters on them, and the designs and job IDs a command line names. plan plans every job of the chosen flows, then asks it which to keep, and why it left out the rest
settingsThe settings layers: finds and reads the settings files, applies --settings, -j and --set, checks every key and applies the system and user files’ limits
stepThe step model: Step, Invocation, Service, Artefact, Pattern, Precheck, Judge, Parse, Outcome
groupComposite steps: flattens them into their children when a job is planned
flowsThe Flow and Job traits, roles and bindings, plan_jobs, and what else flows share. One submodule per flow
flows::testrigTestRIG: its plan, result file and report
flows::lintLint: its plan, result file and report
flows::crossingCDC and RDC, one module: their config, plan, result file and report
toolsThe Tool trait, the capability traits (Simulator, ReferenceModel, CoverageReporter, Linter, Sources, CrossingChecker), the tool-neutral requests, and the tools with each capability, from the plugins
tools::wasmThe capability traits implemented on a plugin: requests to the plugin, and what it returns to invocations and steps
pluginTool plugins: loads the embedded ones and those in plugins.path, caches their compiled code, and gives a plugin the host interface while a step runs
tools::sourcesThe filelist and flatten steps, shared by every flow, from the source manager’s plan
execChecks a job’s step graph and runs the prechecks. Schedules the step graphs of a run’s jobs, within -j and the resource pools, and runs each step: the cache check, services, the command or a cache unit’s children side by side, completion checks, the parse function and the verdict. Measures each step
enforceEnforcing what a step holds: a cgroup per running step, a systemd slice or one doris makes, how its processes are started in it, the disk quota, and pinning to CPUs
cleanWhat is left of a step’s working directory when it ends, the marker in one that is kept whole, and finding and removing those for doris clean and dirs.work_max_age
metricsThe run’s metrics file, and the summary a run ends with
measurementsThe measurement store: a file of records per run, importing and removing them, and what they suggest a step holds
cacheCache keys and entries
gcGC roots, collection and pinning
treeHashing and copying files and directory trees, as git sees them
reportThe parts of an HTML report every flow shares
serveThe web server behind doris report view
uiOutput for people: progress lines and repo-relative paths
statusThe live status of a run: a table of how many steps of each name are in each phase, redrawn at the bottom of a terminal

Outside src/:

PathHolds
wit/plugin.witThe interface between doris and a tool plugin
sdk/doris-plugin, the crate a plugin is written with: the types it hands back, an Invocation builder, and helpers for options, files and linters
plugins/<tool>/The plugin of each tool built into doris. Verilator’s is a linter and a simulator
plugins/verilator-cov/Functional coverage from Verilator, which the Verilator plugin and the doris coverage reporter share: covergroups as cover properties, and the report on them
build.rsBuilds the plugins for wasm32-unknown-unknown, makes components of them, and embeds them

One run, end to end

flowchart LR
    main --> repo["<b>repo</b><br/>load and check config"]
    repo --> plan["<b>flows::*::plan</b><br/>a Job per design and tool"]
    tools["<b>tools::*</b><br/>plugins' invocations"] --> plan
    plan --> exec["<b>exec</b><br/>run the steps"]
    cache["<b>cache</b>"] <--> exec
    exec --> result["<b>Job::write_result</b><br/>result.json"]
    result --> report["<b>flows::*::report</b><br/>report.html"]
    exec --> gc["<b>gc</b><br/>the run's root"]
  1. repo walks up to the project file, expands its configs patterns, loads each file through config, and builds the list of designs with the flow configs that belong to each. No tool is run.
  2. The flow’s plan function turns a design and its config into jobs. It calls flows::plan_jobs, which works out the tools bound to each of the flow’s roles and calls Flow::plan once for each combination. That asks the tools’ plugins for the tool-specific parts and puts the steps together. Each job carries its attributes, and select chooses from every job of the chosen flows by the command line’s designs, job IDs and filters.
  3. exec runs every precheck the steps declare, such as each program being on PATH, then runs the steps of every job as one graph. For each step it asks cache for the key, restores a hit or runs the step once the resource pools have what it holds, and stores the result. cache asks each tool a step uses for its version, through Tool::probe. When a step ends, clean deletes what is not an output from its directory, or marks the directory as kept.
  4. Job::write_result writes the job’s result.json from the step reports and the step directories, with the version of each tool the job’s steps use.
  5. The flow’s report module writes the HTML pages from result files only.
  6. gc records the entries the run used in its root, with each job’s result.

Where the rules are kept

RuleDescribed inKept by
Planning never runs a command or reads the environmentInvocationshost_env and Arg::Port, answered by exec, and Tool::probe, asked by cache
A flow never names a toolFlows, roles and bindingsFlow::roles, and the Bindings its plan is given
A cache key holds no absolute pathCache keyscache, which writes paths relative to the step, job or root
A step writes only inside its own directoryRules steps keepStage::CopyTree, for a tool that builds next to its sources
A dependency is named once, by reading an artefactArtefacts and dependenciesStep::reads, and exec::validate, which refuses a path into the directory of a step that is not a dependency
Only declared outputs are keptWorking directories and clean-upclean, which leaves a passed step its outputs and nothing else
A job’s directory has one run at a timeRuns at the same timelock::JobLocks, taken by doris run after its prechecks, and lock::in_use, asked by clean
A crashed tool is never a design failureCompletion and verdictexec: completion checks first, then the judge
A report is made from result files onlyResult filesEach flow’s report module, which takes the result type alone

Adding tools and flows

A tool is a plugin: a WebAssembly component built from wit/plugin.wit, which doris embeds or loads from a plugin directory. A flow is compiled into doris. Read Flows and tools, Tool plugins and Code layout first.

Adding a tool

A tool can be added to doris, or kept outside it: the plugin is the same either way. A linter is the simplest case. To add one:

  1. Make the crate, plugins/<name>/, a library that depends on doris-plugin (the SDK, in sdk/), serde and wit-bindgen. Use plugins/slang as the pattern. Bind the world of the capability, mapping the shared interfaces to the SDK’s, so its helpers work on your types:

    #![allow(unused)]
    fn main() {
    wit_bindgen::generate!({
        world: "doris:plugin/linter-plugin",
        path: "../../wit",
        with: {
            "doris:plugin/types@0.1.0": doris_plugin::types,
            "doris:plugin/host@0.1.0": doris_plugin::host,
        },
    });
    }
  2. Implement tool::Guest, which every plugin exports, and export! the type.

    • describe gives the name config binds the tool by, which is also the name of its tools.<name> table, and the resource pools its commands hold, such as the site’s licences for it. Each pool it names gets the default size of a licence pool.
    • probe says how doris finds the tool’s version, so a new version reruns the step: most are a command, such as ["slang", "--version"], which doris runs once when it works out a cache key, never while planning.
    • key-env names any host variable that changes what the tool writes as a capability. Return none unless one does: a variable in it splits the cache between machines that set it differently.
    • check-options reads the options into the tool’s Options type (see step 4), so a mistake in a config is found when it loads.
    • run and judge are the plugin’s callbacks (see below). A tool with none returns an error.
  3. Implement linter::Guest.

    • lint builds the Invocation from the request with the SDK’s builder, and calls .tool() on it. That is what puts the tool’s version, its key-env and the plugin’s hash in the step’s cache key, and the version in the result file. A helper program the command runs, such as a compiler, is added as .program("gcc", &["-dumpfullversion"]).
    • Say what the tool holds while it runs, so the scheduler can count it: .resource(POOL, 1) for a licence, naming a pool describe names, and .threads(...) if it uses more than one. A tool that takes a thread count gets it from Arg::threads (see Resource pools).
    • Declare what the tool needs of the machine on the invocation, with .precheck(...), if it is more than the program being on PATH (see Prechecks).
    • complete-on says which exit codes mean it finished. A linter that exits non-zero for findings must not be reported as a step error.
    • logs names the files parse reads. They become the step’s outputs, so a cached step still has them, and a step that passed keeps them.
    • parse turns the log text into lint-messages. The lint flow calls it once, as the step’s parse function, and writes the messages to messages.json, which the judge and the result file read.
    • judge is given the parsed messages, the exit code and the log to point at: doris_plugin::lint::verdict for most linters, or more for one with more to say, such as Verilator’s, which makes an internal error a step error.
    • backend names the filelist-format it reads. The FuseSoC plugin, in plugins/fusesoc, asks FuseSoC for that tool’s files and flattens them into the linter’s argument file. A tool Edalize writes nothing for at setup is flattened from the EDAM file, as Verible and slang are. A format FuseSoC has no flattening for is a change to that plugin and to the filelist-format enum.
  4. Give it options. Write an Options struct, with deny_unknown_fields and a doris_plugin::StepOptions field for each step the tool is used in, named after the step, and read it with doris_plugin::options. Put each step’s args in that step’s command.

  5. Build it into doris, if it is to ship with doris: add the tool’s name and crate to PLUGINS in build.rs. Where it goes in that list is where it is listed among the tools. A plugin kept outside doris is built with cargo rustc --crate-type cdylib --target wasm32-unknown-unknown and made a component with wasm-tools component new, and a site puts it in a plugins.path directory. wasm-tools is not in the dev shell: get it from nixpkgs’ wasm-tools, or with cargo install wasm-tools.

  6. Test it. Test parse natively, in the crate, with cargo test --workspace, on real log text, including a clean run, a syntax error and a message with no rule. Test the command line lint gives, with and without options, and the judge, through the plugin, in tools::wasm’s tests.

  7. Document it: the Lint page’s tables, and the flatten and lint step pages.

The other capabilities follow the same steps, each with its world and interface:

CapabilityWorldFunctions
Simulatorsimulator-pluginfeatures, coverage-format, build, run
Reference modelreference-model-pluginbuild, serve
Coverage reportercoverage-reporter-pluginreads, report, summary, files, parse
Linterlinter-pluginbackend, lint, logs, parse, judge
CDC or RDC checkercrossing-checker-pluginkind, check, parse, judge
  • A simulator says what it can do. features gives coverage, waves, DPI and UVM. Say only what the plugin’s build and run really handle, because the flow fails a job that asks for more when it plans it. coverage-format names the format of the databases its runs write, such as Cadence.
  • A coverage reporter says what it reads, as reads, a format a simulator names. A job whose config binds no reporter gets the first plugin’s that reads its simulator’s format.
  • A simulator that builds from sources it writes gives a prepare-step for that in its build plan, as Verilator does with instrument.
  • A coverage reporter is either a command or the plugin reading the database itself, as a callback. One that is the plugin reports the plugin’s version from probe, as doris does.
  • A tool with two capabilities is one plugin whose world includes both worlds, as Verilator’s does. Its key-env is asked for each capability, and both share one Options struct.
  • Code two plugins share is a crate of its own, as plugins/verilator-cov is for Verilator and the doris reporter: the names of the cover properties one writes are the names the other reads. Two tools that are one code are one crate that two thin plugin crates export, as plugins/meridian is for plugins/meridiancdc and plugins/meridianrdc: it binds its world with pub_export_macro: true, and each exports its type with plugin_meridian::export!(Cdc with_types_in plugin_meridian).

A callback is all data. What a plugin does itself when a step runs, such as instrument’s rewrite, is named by a callback: data the plugin makes when it plans the step, usually JSON of an enum of the plugin’s own. The step is keyed by it, so put everything that changes the result in it. When the step runs, tool.run is given it back with the step’s directory, and can read files in the job’s directory and write them in the step’s, with doris_plugin::fs. A judge that reads files, such as IMC’s, is a callback given to tool.judge.

Keep tool flags out of the flow. If a flow needs something new from a tool, add it to the request type in neutral terms, in the WIT and the capability trait, and let each tool turn it into its own arguments. If not every tool can do it, make it a feature so that asking for it is checked.

Keep the machine out of the plan. A library path, a port or a version is a host-env request, an Arg::Port or a tool’s probe. A plugin can’t read the environment or run a command while planning, so there is no other way.

Adding a flow

A flow touches more places, because the command line is a fixed list of flows:

  1. The flow module, src/flows/<name>.rs:
    • the config type: a serde struct with deny_unknown_fields, its schema name, such as dv/syn/1, a tool field of type config::RoleTools and a tools field of type config::ToolOptions;
    • NAME, the flow’s name on the command line and in the project file’s tool table;
    • ROLES, the roles the flow needs tools for, each with a name, a capability and whether it is optional. The first is the main role, whose tool is in the job’s ID;
    • a type that implements Flow. Its plan takes a design, the config and a Bindings, gets each tool from its capability’s constructor with tools.tool(ROLE), and returns one job. Use tools.label() for what follows @ in the job’s ID and directory;
    • a validate on the config that calls flows::bound and ToolOptions::check, so a bad binding is found when config loads;
    • a plan function for the command line that calls flows::plan_jobs, which makes a job for each combination of bound tools;
    • a job type that implements Job;
    • the result type, with its own schema name such as dv/syn-result/1, a versions field from flows::tool_versions, and write_result.
  2. Discovery, in src/repo.rs: load files with that schema, attach each to its design, call the config’s validate with the project file’s defaults for the flow, and add the flow’s name and roles where the project file’s tool table is checked.
  3. The report, src/flows/<name>/report.rs, made from the result type alone. Add the result to JobResult in src/flows/mod.rs so doris report and doris report view can read it.
  4. The command line, in src/main.rs: the Flow enum and the places that match on it.
  5. Documentation: a page under Flows, a page for each new step, the schema in Configuration, and the flow’s roles in Tools and roles.

A flow that needs a new kind of tool adds a capability first: an interface for it in wit/plugin.wit, with its tool-neutral request and plan types, a world for its plugins, an export of it in the doris world, and a variant of the tool interface’s capability enum, which key-env is given; a Capability variant with its label, and a trait that is a subtrait of Tool, in src/tools/mod.rs; the interface’s indices on plugin::Plugin, which say whether a plugin exports it, with its entry in Plugin::capabilities and a Call method that loads it; and the trait’s implementation on a plugin, in tools::wasm.

When designing the steps:

  • One command per step, so each is cached by itself.
  • Read artefacts; don’t name dependencies. Take another step’s output with step.artefact("name"), give its path to whatever builds the command, and call .reads(&artefact) on the step that uses it. That is the dependency. A command that names a path in another step’s directory without it is refused by exec::validate. Step::after is only for an order with nothing read.
  • Give an in-process step a param for everything its closure captures that changes its result. The cache can’t see into a function, so a captured option that is not a param, an input or an artefact the step reads is not in the key, and changing it gives a stale hit. Step::param(what, value) keys the value’s Debug text.
  • Declare every output a later step or the result needs. Only declared outputs are cached, and only they are left in the directory of a step that passed. write_result must work for a step that came from the cache, so anything it reads, such as a log it parses, is an output.
  • Declare a file that is only for looking into the step as a debug output, with debug_output: a raw tool log, or an intermediate file. It is kept and cached in a run with --debug and deleted otherwise. Don’t declare scratch at all. Nothing downstream can rely on a debug output, because a plain run deletes it.
  • Parse a tool’s output once, with a parse function, when the judge and the result file both need what it reported: Step::parsed(name, path, function). The judge is given the results, and write_result reads them from the output, which a cached step has. Write paths in them relative to the job’s directory, so they are the same in every checkout.
  • Give the step that decides the result a judge, and say on its page what passed does and does not mean. Use a pass pattern to tell a tool that finished from one that crashed with an accepted exit code, and a fail pattern for an error line no exit code shows. Pattern::text and Pattern::regex name the output to look in, or STDOUT or STDERR.
  • Set run_after_fail on a step that reports on a run, if the report is wanted when the run failed. It then reads a failed step’s outputs, so they must be complete when the step fails.
  • Declare what the step needs of the machine as prechecks, so a run that can’t work stops before its first step. A program run by name needs nothing: it is checked already, and Invocation::needs adds the programs a command runs itself. Put a Precheck on the invocation, in the plugin, for what the tool needs whatever the flow, such as Precheck::Env for a variable. A licence is not a precheck: hold it with .resource(POOL, 1) and the scheduler waits for one. Put one on the step, in the flow, for what the flow knows, such as Precheck::File for a directory the config names.
  • Start services with Service::new, and change only what differs: ready for a service that shows it is ready by a file or a log line, ready_timeout, stop and stop_timeout. Declare what a service writes on the service, with .output, so it is checked once the service has stopped; .port gives it more ports, and .input keys a file it reads.
  • Use a cache unit only for a step that needs one: a long step worth resuming part-way, or one whose raw output should not be cached because it has timestamps or paths in it, or is far larger than what is wanted from it. A unit, a composite step, a parse function and a service’s own outputs are all there for steps that need them; a step that doesn’t stays as simple as it can be. Make the tool one child and the reduction another, with Step::unit, and export only what the rest of the job and the result read. Give a child the unit’s own directory when it needs its siblings’ working files, and one of its own otherwise. Give the unit the verdict: children can’t have a judge or fail patterns. A step whose outputs are already small and stable stays a leaf. See Cache units.
  • Use a composite step to group steps that are each cached by itself, with Step::group, such as a list of commands. Name its children as siblings, and export what the rest of the job reads. See Composite steps.
  • Reuse tools::sources::steps for the sources.
  • Check what the config asks of a tool when the job is planned, as TestRIG does with tools::check_features and tools::check_pairing, so a job that can’t work fails in doris plan.

The roadmap’s Tool capabilities page describes where these interfaces are going: a command line that works on any Flow, and options checked against the steps a tool is used in.

Changing a format

Config files, result files, cache entries and GC roots all carry a schema with a version.

  • A change that old readers would misread needs a new version. Result files outlive the doris that wrote them: doris report view reads results kept in GC roots.
  • A changed cache key is safe. Old entries are simply never hit, and are collected when their roots go.
  • A new field that defaults when absent needs no new version, as the debug and debug_outputs fields of a cache entry did not.
  • Bump KEY_PROTOCOL in src/cache.rs when doris’s own part in a result changes: how a key is made, how a verdict is reached from a step’s rules, or what a flow does around a plugin’s results. Every key holds it, so entries stored before are not used. A plugin needs no bump: its hash is in the key of every step that uses its tool.

Writing documentation

This book is built with mdbook, with mdbook-mermaid for diagrams. Its source is in docs/src/, and docs/src/SUMMARY.md is the table of contents.

nix run .#docs             # live preview at http://localhost:3000, no dev shell needed
mdbook serve docs --open   # the same, from the dev shell
mdbook build docs          # writes docs/book/
nix build .#docs           # the whole site into ./result, as CI builds it

Where things go

PartHolds
User guideHow to use doris, by task
FlowsOne page per flow and per step: what runs, and what a result means
ReferenceMaterial to look up: commands, terms
ArchitectureHow doris is put together, and why. Only what is built
Developer guideHow to work on doris
RoadmapWhat is designed but not built, and nothing else

The main parts describe doris as it is. If a page says doris does something, the code does it. A feature that is planned goes in the Roadmap. The change that builds it moves it to the main parts, with its design in Architecture, and takes it out of the roadmap, so the roadmap only ever lists what is outstanding. A roadmap page starts with one Built line that links to where the built part is described.

State limits as facts. Where doris does not do something a reader might expect, say so on the page they would look at, and link to the roadmap if it is planned.

Each flow and step page says what passed means and what to check by hand. A reviewer relies on these to judge a run.

API documentation

nix build .#docs also runs cargo doc and puts the result under api/ in the site, where the API documentation page links to it. mdbook serve does not, so that link is dead in a local preview. Build the API documentation by itself with:

cargo doc --no-deps --document-private-items --open

doris is a binary crate, so --document-private-items is what makes its modules appear.

Checks

nix flake check builds the book and checks its internal links with lychee. nix fmt formats Markdown with prettier, which also aligns tables.

mermaid.min.js and mermaid-init.js were added by mdbook-mermaid install docs. Rerun that command to update them when mdbook-mermaid is upgraded. Update the bundled dependency notices from the matching Mermaid release source map and upstream package licences at the same time.

Publishing

Pushes to main publish the site to GitHub Pages through .github/workflows/docs.yml. Pull requests build it without publishing.

API documentation

The API documentation is generated from the Rust source with rustdoc, and is published with this book:

doris API documentation

It covers every module, type and function of the crate, private items included, since doris is a binary and has no public library interface. Start from the module list, or from these:

ItemIs
step::StepOne step of a job, as a flow plans it
step::InvocationOne program and how to start it
flows::JobWhat every flow’s job provides
toolsThe capability traits, and tools from plugins
configThe config file types
cacheCache keys and entries
gcGC roots and collection

Code layout explains how the modules fit together.

The link above works on the published site and in a nix build .#docs build. In a local mdbook serve preview, build the API documentation yourself:

cargo doc --no-deps --document-private-items --open

Roadmap

This part lists what is designed but not built. Nothing in it works today. What is built is described in the rest of this book, and Architecture has a summary of it.

The pages describe planned behaviour in the present tense, as a design does. The design can still change before it is built. When something here is built, it moves to the main parts in the same change.

Flows

doris starts with TestRIG and lint, adds CDC and RDC, and then two more flows, one at a time. UVM simulation is not planned.

FlowToolsStatus
TestRIGXcelium, Verilator, SailBuilt. Outstanding: dvplan annotation, and more
LintVerilator, Verible, slang, AscentLintBuilt. Outstanding: other linters, and more
SynthesisDesign Compiler (full and GTECH)Planned
CDCMeridian CDCBuilt. Next: a full chip
RDCMeridian RDCBuilt. Next: a full chip
Formal (FPV, connectivity)JasperGoldPlanned
UVM simulationVCS, XceliumNot planned

Outstanding, by area

AreaNot built
FlowsSynthesis, formal. CDC and RDC on a full chip. dvplan annotation, a second reference model
ConfigurationMore project and design keys, variants, JSON Schema, YAML, doris convert
Selecting jobsThe package and variant attributes, metrics of a run of several flows, doris tops and doris ip
Vendored IPOrigins from lock files, package names and manifests, vendoring in doris
Settingsdirs.work, dirs.cache and output.*, and limits on more keys
Tool capabilitiesFlows as plugins, distributing plugins, flows registered in one place, options checked against steps, more capabilities, tool scripts
Step modelNormalised exports, enforcement on a remote machine, flows that use more of the model
Profiling resourcesThread sweeps, and doris resources --write
CacheKeys on the build, include files, a file index, blobs, a shared cache
ResultsWaived messages, formats for the planned flows, published schemas, Markdown
Scheduling and remote executionA separate executor interface, logs on the terminal, remote executors

Goals still to meet

  • A launcher interface that allows remote backends. Shared resources, such as licences, threads and memory, are already modelled by the scheduler.
  • JSON Schema for every config and result format, so editors can validate and autocomplete.

Milestones

Each milestone ends with something that runs. No dates are set. Four are done: TestRIG with Xcelium, Verilator and Sail; TestRIG coverage; lint with Verilator, Verible and slang from native configs; and AscentLint as a fourth linter, checked against its own report on a real run.

  1. dvplan annotation as a step after TestRIG’s coverage.
  2. Synthesis with Design Compiler. DC as a synthesiser with an embedded run-syn.tcl, parse-syn-report.py ported to Rust, the GTECH variant, and a dc licence pool.
    • Done when: area and timing are validated against DC’s own reports.
  3. CDC and RDC with Meridian: built, with a run script made from typed config and OpenTitan’s configs translated.
    • Next: a full chip.
  4. Formal with JasperGold, including connectivity checks from CSV.

Validating a flow

  • A flow’s results are validated directly. doris’s parsed results are checked against the tools’ own reports, and against small designs with known, seeded findings.

Open questions

  • Coverage across runs. The likely rule: runs whose input artefacts are identical and that differ only in seed can have their coverage merged. Where merged coverage is stored is not designed.
  • Tool scripts. How much of a tool’s script, such as run-syn.tcl, a project may replace, and how partners point at foundry libraries. The answer depends on the tool, so it is decided when each tool’s plugin is written.
  • Flow options on the command line. --replay, --tests and --seed belong to TestRIG but sit on the shared plan and run commands. How a flow’s own options are attached once there are many flows is not designed.
  • De-duplicating shared IP. Planning each shared IP once per top depends on cache keys being quick to compute. If they are not, shared IP may be run once in a neutral context instead (see De-duplicating shared IP).
  • Default settings values. The defaults in Settings are placeholders to be agreed.

Flows

Built: TestRIG, Lint, and CDC and RDC. This page lists what each still lacks, and the flows to come.

TestRIG

  • dvplan annotation. mocha’s Makefile annotates ISA_V_Plan.hjson with the IMC report through dvplan. This becomes a later step after coverage, which already writes the report data dvplan reads. dvplan must be on the path: steps don’t fetch from the network.
  • More of Verilator’s coverage. A Verilator job reports the covergroup bins that can be written as cover properties (see instrument): no crosses or transition bins. Verilator’s own line, branch and toggle coverage is not collected.
  • Sharing the filelist between simulators. The jobs of a design share model and engine through the cache, but each runs filelist in its own directory.
  • Other reference models. Sail is built as the CHERI model only.
  • Other simulators, such as VCS, with URG as its coverage reporter.
  • Parallel runs. testrig.py -j starts several sets of processes. In doris these are several run steps in one job, limited by the Xcelium licence pool.
  • Checking more of the run. The simulator log is not scanned, and a minimum number of tests is not enforced (see what passed means). Fail patterns are built and are the way in: the run step has none yet.
  • Coverage across runs. See Open questions.

Lint

  • Other linters, such as other commercial tools.
  • An exact list of the tops that use a design, and one report row for a design across its contexts (see De-duplicating shared IP).
  • Waived messages in the result, kept and marked, for linters that report them.

Synthesis

Design Compiler, in full and GTECH variants.

  • DC is driven by run-syn.tcl, which doris embeds (see Tool scripts).
  • parse-syn-report.py is ported to Rust as the synthesiser’s parse function.
  • The GTECH run is a variant of the design’s one synthesis config, not a second config with overrides.
  • DC licences are a resource pool.
  • The DC run and the parsing of its reports are children of one cache unit, so the raw logs are not cached. Cache units are built, and this is the first flow to use one.
  • The result holds area by module to the configured depth, timing per path group, and the stage reached.

CDC and RDC

Built with Meridian CDC and Meridian RDC, each its own capability on one plugin interface, crossing-checker.

  • A full chip. Run CDC and RDC on a full chip, such as chip_earlgrey_asic, to learn the resources a chip check needs, and exercise parameters, reset_scenarios, waves and a project’s own script along the way.
  • Constraints shared with synthesis. CDC, RDC and synthesis read the same SDC files. They belong in the design file, once, rather than in each flow’s config. OpenTitan’s RDC config names only chip_earlgrey_asic.sdc, without the ot.sdc_setup.tcl its CDC config reads first, which the SDC needs.
  • Saved databases between stages. If Meridian can save and restore its database, the check could be split so that a change to a waiver runs only the stage that applies waivers and reports, not the whole analysis. As a cache unit, the databases would not be cached.
  • Per-module reports, as OpenTitan’s RDC script writes them for each of its modules.
  • Other checkers, such as a structural CDC check of the synchronizer cells on an open-source netlist, as a second CDC checker.

Formal

JasperGold, for FPV and for connectivity checks from CSV. The result holds each property’s outcome: proven, failed with a trace, unreachable or undetermined. Expected failures are applied by the flow’s judge.

Configuration

Built: the loader, the three kinds of file in HJSON, TOML or JSON, and doris validate. See Configuration and Config and the repo model.

More in the project file

The project file has configs, cores_root, tool, the default tool for each flow role, and filters. It gains:

  • Core mappings, such as lowrisc:prim_generic, shared by every design.
  • The output root. Today output goes to scratch/doris/.
  • Packages of vendored config (see Vendored IP).

More in the design file

  • scope: <top>, to put a design in a top that it is not below.

Variants

A variant of a flow, such as GTECH synthesis, is a named variant inside one flow config file, not a second config with overrides. Each variant is a small typed struct. An illustration for AES’s synthesis config, not a final syntax:

{
  schema: dv/syn/1

  tool: dc
  constraints: constraints.sdc

  variants: {
    gtech: {
      constraints: {
        builtin: gtech
      }
      stop_after: compile
    }
  }
}

A variant is part of the job’s ID: syn/aes#gtech@dc.

JSON Schema

JSON Schema is generated from the same Rust types as the loader, with schemars, so editors can validate and autocomplete. One schema serves every file format: editors use it for HJSON and JSON directly, and for TOML through Taplo.

Better messages

  • An unknown key names the nearest valid key. Today the message lists every valid key of the table.
  • The checks the types can’t express, such as an unknown tool name, name the line as well as the file.

More file formats

  • YAML (.yaml, .yml), if asked for. YAML’s implicit typing (no becoming false, version numbers becoming floats) is a common source of config bugs, and the Rust YAML crates are in flux.
  • doris convert --to toml <file> rewrites a config in another format through the same value tree. HJSON comments are carried across to TOML and YAML where the position is unambiguous, and dropped otherwise with a warning. JSON has no comments, so converting to it drops them all.

More flow config files

Each planned flow has its own file and schema: syn.hjson with dv/syn/1, and the same for CDC, RDC and formal. They hold constraints, waivers and typed options, with tool-specific options under tools.

Selecting and filtering jobs

What is built is described in Choosing jobs. This page is what is still to come.

Packages and variants

Two attributes wait for the features they describe: vendored IP and variants.

AttributeValuesExample
packagelocal, or the vendored package namepackage=lowrisc_ip
variantVariant name, default if nonevariant=gtech
  • A job’s ID gains its variant: FLOW/DESIGN[#VARIANT][@TOOL], for example syn/kmac#gtech@dc. A design argument such as doris run syn kmac gives every variant’s jobs.
  • Two more shorthands: --vendored and --local, for -x package=local and -i package=local.
CommandRuns
doris run lint --top earlgrey -x package=lowrisc_ipEarlgrey and its IP, except blocks from the lowrisc_ip package
doris run syn kmacEvery syn job for kmac: each tool and variant
doris run syn/kmac#gtech@dcOne job

A named filter set can then leave out a package too:

filters: {
  pr: {
    exclude: [
      tag=slow
      package=lowrisc_ip
    ]
  }
}

One run of several flows

A run with jobs of several flows runs them together, but writes the run’s metrics file to each flow’s directory, so each flow’s metrics page shows the other flows’ jobs too. The run gets a metrics file and page of its own, and each flow’s page shows only its jobs.

Commands

doris tops                        list tops and their IP counts
doris ip [--top T] [--shared]     list IP, with scope and configured flows
doris flows [DESIGN]              show which flows each design has configured

doris flows exists. It gains the design argument and a scope column:

DESIGN                    SCOPE       LINT  SYN  CDC  RDC  FORMAL
earlgrey                  top         yes   yes  yes  yes  yes
earlgrey/alert_handler    earlgrey    yes   -    -    -    yes
darjeeling/alert_handler  darjeeling  yes   -    -    -    yes
aes                       shared      yes   yes  -    -    yes

Contexts

  • An exact dependency walk. The walk that finds the tops using a design reads core files instead of asking FuseSoC (see How the tops that use a design are found). Applying the top’s mappings to the walk, or taking the resolved core list from the top’s own filelist step, would make it exact.
  • Contexts for every flow. Only lint uses them. Each new flow that resolves a design’s core takes the same contexts.
  • scope: <top>, to move a design into a top that it isn’t below.

De-duplicating shared IP

Shared designs are de-duplicated by the cache. Three things would make that better:

  • An exact walk, as above.
  • Sharing the FuseSoC step. A top’s mappings are part of the filelist command, so each context runs FuseSoC itself, and only flatten and the steps after it are taken from the cache. A resolve step keyed on the core files would make that cheap.
  • Merged results. Each context is a job with its own result and report row. The design has one row under the shared IP, listing the tops it covers.

This depends on cache keys being quick to compute, since every top’s FuseSoC resolution feeds them. The file index should make that cheap. If measurement shows it isn’t, alternatives will be considered. One is to run shared IP once in a neutral context, such as prim_generic with no top mapping, which only works if no shared IP depends on a top’s virtual cores.

Vendored IP

Built: vendored IP is found like local IP, by the project file’s patterns, and a design from an upstream without config files gets a local directory of its own. See Vendored designs and Vendored IP.

Not built: lock files, package names and the package manifest are not read.

Origins and package names

  • Vendored IP has an origin. doris reads the matching *.lock.hjson to record the upstream URL and revision. doris ip shows it as a column, and results record it.
  • Names are qualified by package when they collide. If a local and a vendored design share a name, they are named <package>/<design>, such as lowrisc_ip/uart. A vendored block renamed on the way, as mocha’s rv_core_pkg is from rv_core_ibex, keeps the name its design.hjson declares.
  • A package attribute for filters (see Packages and variants), so a run can leave out everything vendored from one upstream.

Optional package manifest

A vendored tree can carry a small package.hjson (schema dv/package/1) at its root giving its package name and its own glob patterns for design and flow config files. The vendoring repo then includes it with one entry in its project file, instead of repeating the upstream’s layout:

packages: [
  {
    path: hw/vendor/lowrisc_ip
  }
]

Without a manifest, the package name defaults to the vendor file’s name (lowrisc_ip).

Later: vendoring in doris

doris could take over vendoring from util/vendor.py, about 800 lines of Python copied into each repo. doris needs the vendor and lock files anyway to find packages and record their origin, so owning the step that writes them is a small extension.

What it would add beyond vendor.py:

  • Drift checks. Confirm that a vendored tree still matches its lock file plus patches, so local edits made outside patch_dir are caught.
  • Generated overlay files. Write the design and flow config files for upstreams without them as part of vendoring, instead of keeping them by hand.
  • Package-aware updates. After an update, show which flow config files and filters it changed, and run the affected jobs with doris plan.

It would read the existing *.vendor.hjson and *.lock.hjson formats (upstream, mapping, patch_dir, patch_repo, exclude_from_upstream, only_subdir), so repos can switch without converting. This is not part of the first milestones: vendor.py also serves simulation and software, and works today.

Settings

Built: settings in layers: built-in defaults, /etc/doris/settings.*, the user’s $XDG_CONFIG_HOME/doris/settings.*, the checkout’s untracked .doris/settings.*, then --settings FILE, -j and --set KEY=VALUE, read by every command. The keys are jobs.max, pools.NAME, resources.enforce, resources.cgroup, resources.pin, resources.measure, dirs.keep_failed, dirs.work_max_age, tools.NAME.path, plugins.path and gc.*. The system and user files can limit jobs.max and pools.NAME, and doris settings lists every value and where it came from. The only environment variables doris reads for itself are XDG_CONFIG_HOME, XDG_CACHE_HOME and HOME, to find its files, and PATH, to find tools.

This page is what settings still lack.

Keys that can’t be set

KeyDefaultExample of who sets it
dirs.work<repo>/scratch/dorisUser or checkout: a fast local disk
dirs.cache$XDG_CACHE_HOME/dorisUser: a larger disk
output.*Progress on a terminalUser: colour, how much of each step is printed

Work goes to scratch/doris/ in the repo, and the cache is found from XDG_CACHE_HOME or HOME alone. Moving either would change no result and invalidate nothing, since cache keys hold no absolute path.

Limits on more keys

Only jobs.max and pools.NAME can be limited. A site could cap gc.max_size on shared home directories the same way, or require resources.enforce. Which keys can be limited is part of each key’s definition.

Line numbers

An unknown key or a bad value names the settings file it is in, but not the line: a file is read into one table before its keys are checked.

The defaults

The defaults in Settings are placeholders to be agreed.

Tool capabilities

Built: every tool a plugin, a WebAssembly component doris embeds or loads from plugins.path; a Tool trait every tool implements, with four capabilities as subtraits of it; a Flow trait with roles and bindings; tools bound to roles in config, with defaults in the project file and several tools for any role; tools.<name> options for every tool; and feature and pairing checks when a job is planned. See Flows and tools.

Flows as plugins

Tools are plugins and flows are not. A flow plugin would export a flow interface whose plan returns the job’s steps, and import the capability interfaces of its roles, which doris would link to the plugins config binds. The hard part is the step model in WIT: artefacts, services, readiness, cache units, composite steps, prechecks and resources, and judges and parse functions as callbacks, as plugins’ are already. The step model is still changing, so this waits until it settles, and until the command line works on any Flow (below). A flow’s report would be a callback too, or made from a generic result form, so that doris report view can show results whose flow it doesn’t have.

Distributing plugins

A plugin is a file in a plugins.path directory today. A project file could name the plugins its configs need, pinned by hash, so a checkout that lacks one says so when config loads, and a run never uses another build of it by mistake. Plugins could be published as OCI artefacts or Nix packages, and signed.

Flows on the command line

The command line is a fixed list of flows that main.rs matches on. Each flow has a plan function of its own that the match calls, and the Flow trait and its driver, flows::plan_jobs, are used inside those functions. The design has the command line work on any Flow, so a new flow is registered in one place.

Flow::Config gains a JsonSchema bound, so each flow’s config schema is published from the type the loader reads (see JSON Schema). Today the bound is DeserializeOwned alone, and schemars is not a dependency.

Options checked against steps

A tool’s options are keyed by the step the tool is used in, such as tools.verilator.build. Today a tools.<name> table is accepted if the tool can fill any role of the flow, and every step’s table of that tool is accepted with it. So tools.verilator.build is accepted in a lint config and ignored, because a lint job has no build step.

The design checks each step’s table against the steps the flow uses the tool in. One that no step reads is an error when the config loads.

Waves, parameters and DPI sources in a real simulator

dut.waves, dut.parameters and dut.dpi are built, with unit tests of the command lines they give. Waves have been run in a real Verilator. Waves in Xcelium, and parameters and DPI sources in either simulator, have not been run for real yet.

More capabilities

CapabilityToolsUsed by
SimulatorVCSTestRIG
Coverage reporterURGTestRIG
SynthesiserDesign CompilerSynthesis
Formal proverJasperGoldFormal

Tool scripts

Some tools are driven by scripts that are themselves part of the flow, such as run-syn.tcl for Design Compiler. doris ships default scripts embedded in the binary. A project can point at its own script for flows where it needs to customise, which partners using a foundry library will need. How much of each script a project may replace is decided per tool (see Open questions).

Meridian CDC and RDC are the first tools driven by a script. Their plugin makes it from typed config, in a step of its own, with a callback (see script), and a config can name a project’s own script instead. Design Compiler’s would follow the same pattern.

Step model

Built: a job is a list of steps. A step has one command or in-process function, the artefacts it reads, inputs, prechecks, services with named ports and inputs and outputs of their own, outputs that may be marked debug, a timeout, accepted exit codes, pass and fail patterns, a parse function, a judge given the parsed results, and run_after_fail. A step with child steps is a cache unit, cached as a whole and resumed after an interrupt, whose children run side by side and can be units themselves, or a composite step, whose children are cached each by itself. A step holds threads, memory, disk space and licences from resource pools, and with resources.enforce its memory, threads and disk are enforced, with a systemd slice or a cgroup doris makes itself. With resources.pin each step runs on CPUs of its own. Working directories are cleaned by how a step ended, and doris clean removes those that were kept. See Steps and execution.

This page is what the step model still lacks, and what is built but not yet used by any flow.

What is left

PartBuiltLeft
Child stepsCache units and composite stepsNormalised exports
ResourcesResource pools, enforced with systemd or cgroups, pinned to CPUsEnforcement on a remote machine, and stricter limits
Flows that use theseTestRIG and lint read artefacts. TestRIG declares prechecks, a debug output, a pass pattern, service outputs and run_after_fail. Lint has a parse function and a judge on its resultsA flow with a cache unit, a composite step, a fail pattern, and more

Normalised exports

Downstream keys use the content of a step’s outputs. That only saves reruns if a rerun gives the same bytes, so what a cache unit exports should have no timestamps or absolute paths in it, or be a summary of a log rather than the log. Nothing in doris does this for a unit: it is up to each child, and there is no child that does. Lint’s parse function names each file from the job’s directory, so its messages.json is the same in every checkout, but lint is a step, not a unit: it is quick to run again and has nothing to resume.

A helper that strips the usual timestamps and the repo’s and job’s paths from a text file would let a unit’s last child normalise any log it exports.

Enforcing resources

Enforcement works with a systemd user manager, or with a cgroup v2 hierarchy delegated to doris, as in a container. Each step’s threads can be pinned to CPUs of its own. What is left:

  • Enforcement on a remote machine, by a remote executor (see Scheduling and remote execution).
  • A disk quota the kernel keeps. doris measures a step’s working directory while it runs and stops it once it is over, so a step can go over by what it writes between two measurements, and what it writes outside its directory is not counted. A filesystem’s project quotas, such as XFS’s, would stop the write itself, but need a filesystem set up for them and root to set them.
  • Pinning a step’s processes for good. A step is pinned with its processes’ CPU affinity, which a process can change for itself. The cpuset controller’s cpuset.cpus, or systemd’s AllowedCPUs, would hold it, but a user systemd manager does not usually have that controller delegated.

No flow uses these yet

These parts of the step model are built and have unit tests. What is not built is a flow that uses them:

  • Cache units, for synthesis.
  • Composite steps.
  • Fail patterns, for checking more of a TestRIG run.
  • Version prechecks, and a Command precheck other than enforcement’s.
  • A service ready by a file or a line of its log, one that is waited for and not stopped, one with more than one port, and one with an input.
  • Invocation::shell, Step::after and Step::hold.

Initialisation and teardown

The proposal is to leave these out. Setup that produces something is an upstream step. Something that must run during the step is a service. Clean-up is generic. They can be added if a real case doesn’t fit those three.

Profiling resources

Built: a step holds what its flow config’s resources says, or what its tool asks for, and with enforcement that is a limit. Each step that runs is measured in a cgroup of its own, with no limits unless enforcement sets them: its peak memory, every process together, how many CPUs it kept busy on average and at its most, and its peak disk. --rerun=STEP,..., --no-store and --no-cache say which steps run whether they are cached or not, and whether they are stored (see The cache). Each run adds what its steps used to the measurement store, doris measurements import adds other machines’ runs, doris gc removes old ones, and doris resources suggests memory, disk and threads from them, for each step and the tool it runs. A step with services is measured, given values and suggested them for each part, its command and each service, and holds their sum.

This page is the design for working out what each step needs from measurements, keeping them, and writing what they show into a repo’s flow configs. A repo starts with no resources at all, and gets them as runs show what each step needs: the more runs, the tighter the values.

The loop

  1. Every run measures, as it does now: each step in a cgroup of its own.
  2. Measurements are kept, in a store that outlives the run and collects them from every machine that runs the repo, CI among them.
  3. doris profile fills the gaps: it sweeps a step’s threads to find how many it can use, and what each one is worth.
  4. doris resources says what each step should hold, from the store, and with --write writes it into the flow configs, for review in a pull request like any other change.

The store

Built: see The measurement store. It differs from the first design in three ways, each to keep what was built simple until a real need shows:

  • Recency is a count, not a weight. Only a step’s newest 50 records count. Weighting a record by whether its cache key still matches the step’s would mean working out every key, and a key changes with every edit to a design’s inputs, so few records would ever match.
  • Tool versions are not recorded on their own: the cache key covers them.
  • Whether a step ran alone is not recorded. Only threads would use it, and only once wall time is compared, which the thread sweep does under its own control.

A database, such as SQLite, would answer queries faster, but it can’t be shared safely on a network filesystem and can’t be merged by copying files. If reading every file gets slow, an index can be built from them, and thrown away.

Profiling threads

How many threads a step can use is not something normal runs show: each step is given the threads it holds, and runs beside others. doris profile finds it:

doris profile testrig my_core --step build --step run
  1. It runs the flow once with each profiled step given every CPU and running alone, and the rest as usual. The parallelism measured is how many threads the step can use: its ceiling.
  2. It sweeps down from the ceiling, halving: 16, 8, 4, 2, 1. Each point reruns the profiled step, alone, with that many threads, and repeats it if the times are far apart. It stops once a point is more than twice as slow as the best.
  3. It fits two curves: wall time against threads, and peak memory against threads. Memory is fitted as a + b × threads. A build that runs a compiler per thread has a large b. A simulator that shares one model between its threads has a small one.

A profiled step’s upstream steps are taken from the cache, as in any run, unless they are profiled too. Profiled steps are swept one at a time, in the order they run, so each point of one step’s sweep has the same inputs. Downstream steps are not run: profiling stops after the last profiled step, as with --until.

Thread counts are not part of a cache key, so a sweep runs each point as --rerun=STEP --no-store would: the cache already has its result.

What a thread is worth

The suggested threads is the knee of the time curve: the fewest threads whose time is within 10% of the best, resources.knee. A step that runs as fast on 4 threads as on 16 holds 4, and the other 12 run other steps. A step that runs alone, such as one build every run waits for, can be given more with a lower knee.

Suggesting values

Built, from runs alone: see Suggested resources. What the sweep adds:

CONFIG                                  STEP   POOL     NOW  SUGGESTED  RECORDS  FROM
cores/my_core/dv/testrig/testrig.hjson  build  threads  -    8          4 sweep  knee at 8: 6% slower than 16
                                               memory   -    12G        31       p95 9.4G + 25%; 1.1G + 1.0G/thread
                                        run    threads  -    2          2 sweep  knee at 2
  • Threads are the knee of the sweep, where there is one. Without, they stay the 95th percentile of the CPUs a step kept busy, marked from runs: no sweep.
  • Where memory depends on threads, the value suggested is for the threads suggested, and the fit is shown. A flow config could instead give memory as "1G + 1G/thread", worked out for the threads a step is given. That is only worth adding if the sweeps show it matters for real steps.
  • A design far from the rest is shown as such. Its own flow config gets its own value, as any design’s does.

Writing them

doris resources FLOW --write writes the suggested values into each flow config’s resources, and changes nothing else. The repo’s own process takes it from there: a branch, a pull request, a review. --diff prints what it would change, and writes nothing.

Only the resources table is rewritten, in the file’s own format and indentation, and its comments are kept. A TOML file is edited with toml_edit. An HJSON or JSON file has its resources object found and replaced in the text, with a key added at the end if there is none. A value that was written by hand and has a comment beside it is listed, not changed, unless --force is given.

The values go into the flow config files themselves, not a file beside them. Configuration has one rule for where a value is: each key in one kind of file, and no overrides. A generated file that a hand-written value overrides would break it.

The order to build it in

  1. The store, doris measurements import, and doris resources without --write: built.
  2. doris profile and the thread sweep.
  3. --write, for TOML, then HJSON and JSON.

Cache

Built: every step is cached by itself in a per-user cache, with GC roots, collection by age and size, and pinning. A cache unit is cached as a whole, and a debug run stores debug outputs. A key holds the version each tool’s probe reports, the host variables the tool names as its key_env, the hash of each plugin, and a key protocol for doris’s own part, bumped by hand, in place of doris’s version. See The cache, Cleaning the cache and Cache and results.

Host environment in the key

key_env is built, and Verilator as a simulator uses it for UVM_HOME (see What is in a key). No other tool names a variable yet. A plugin adds one as soon as it is found to matter.

Tool identity

  • A patched install that keeps its version string has the patch level added to the version its plugin reports. A plugin can only name a command whose output is the version, so this needs a way for a plugin to read the output; none does it yet.
  • A probe that fails gives the version unknown today, which is keyed like any other.

Include files

Include files are not in a filelist, only the include directories. By default, doris will hash the header-like files (.svh, .vh, .sv; the list is set per tool) under each +incdir. Where a tool writes a dependency file, such as Verilator --MMD, it uses that instead, which narrows the key to the files actually included.

FuseSoC resolution

Today the filelist step is keyed on every file under the cores roots, because it also copies the sources.

For FuseSoC generators, the generator’s script and declared inputs become part of the key, so generated IP never goes stale. With the file index below, checking the cores roots is a metadata scan, not a re-hash.

External inputs

Tool modules declare large libraries, such as foundry libraries, as external inputs, keyed by name and a version tag from site settings rather than by path or content. A cheap guard (the directory’s modification time, or the hash of a version file) turns a library replaced in place into a cache miss.

Hashing cost

Today inputs are re-hashed on every run.

A local index maps path, size, modification time, change time and inode to a content hash, as Cargo, Ninja and git do. Only files whose metadata changed are re-hashed. A file modified within the timestamp resolution of the last index write is always re-hashed, so a quick edit is never missed.

Forcing a rerun of part of a run

--rerun alone reruns everything selected, and --rerun=STEP,... the steps of those names. It will take the same -i/-x filter syntax as job selection too, such as --rerun='design=aes*', to rerun the steps of some jobs only.

Blobs

Entries store their outputs as content-addressed blobs, so identical outputs are stored once. Marking walks from roots to entries, from entries to their upstream entries, and from entries to blobs. Collecting by size keeps a reference count per entry, so removing one root at a time is cheap rather than re-marking the whole cache.

Today each entry holds its own copy of each output.

Cache units

Cache units are built: a unit has one entry, which stores only what it exports. Exports are not yet normalised, so a rerun of a unit can still change the keys downstream (see Normalised exports).

A shared cache

A shared or remote cache comes with remote launchers. Keys already hold nothing tied to one machine, so the format carries over.

Garbage collection

  • Limits on gc.*. The gc.* values come from the settings layers, but a site can’t cap them in limits (see Limits on more keys).
  • Protected roots under size pressure. Today collecting by size never drops a root keep_latest protects, and stops with a warning. The design has them go last, after all other roots.
  • Shorter locking. Today a run holds the shared lock from start to end, so doris gc waits for running runs. The design has collection lock only for the sweep.
  • Upgrading the cache’s files. Until the first release a schema change is a clean break: a root with another schema is removed by the next sweep, and an entry with another schema is not used, so its step runs again. From the first release, a change to doris/gc-root or doris/cache-entry comes with a transform that reads the older schema and converts it, so a newer doris keeps what an older one stored.

Results

Built: two result formats, dv/testrig-result/1 and dv/lint-result/1, with the version of each tool a job used, HTML reports and doris report view. See Results and reports and Cache and results.

More in today’s results

  • Tool versions in the reports. A result file has them as versions. The HTML pages don’t show them yet.
  • The build of doris. produced_by is the release version, not the build.
  • Waived lint messages, kept and marked. Today the linter applies the waivers, so doris never sees a waived message.
  • The origin of vendored IP: the upstream URL and revision (see Vendored IP).

Formats for the planned flows

Each flow gets its own schema name and typed body, defined by the Rust types:

FlowBody (first version)
SynthesisArea by module to the configured depth, timing per path group, stage reached
FormalProperty results: proven, failed with trace, unreachable, undetermined

Published schemas

Each result format is published as JSON Schema, generated from the Rust types. Today the format is defined by the types alone.

Reports

  • Markdown reports, beside the HTML ones.
  • De-duplicated shared IP is reported once, listing the tops it covers (see De-duplicating shared IP).

Scheduling and remote execution

Built: steps run on the local machine only. One module both schedules and runs. The steps of every job are scheduled as one graph, up to -j at once and within the resource pools, and every step is measured. See How steps are run.

A scheduler and an executor

Two parts with a narrow boundary between them:

  • Scheduler: walks the step graph, checks the cache, and hands ready steps to an executor. It enforces the step limit and the resource pools, as it does today.
  • Executor: runs one step and returns its exit status, logs and output paths. The local executor runs processes, streams logs to files and the terminal, and kills the process group on cancel.

What this adds to the code as it is:

  • The boundary itself. Today the code that walks the graph also starts the processes, and nothing calls through a trait.
  • Enforcing what a step holds on a remote machine, where locally it is enforced with cgroups (see Enforcing resources).
  • Logs on the terminal as well as in files.
  • An async runtime, in place of a thread per running step.

Launchers only see steps. No launcher knows a tool, and one scheduler serves them all.

Sharing licences between runs

Resource pools are counted within one run. Two runs at once, in one checkout or in two, or on two hosts, each start up to their own pool sizes, so together they can ask the licence server for more than the site has. Xcelium and IMC wait in the server’s queue when that happens (-licqueue), so nothing fails, but the waiting is not visible to doris and a step’s measured time includes it.

What is needed is a pool that several processes and hosts count against together: a pool server, a lock directory on a shared filesystem with one file per licence, or the licence server’s own count. Until then, give each run a share with --set pools.NAME=N.

Remote execution

Because steps declare their inputs and outputs, a remote executor can stage files in and out, as Bazel’s remote execution API does. Schedulers such as LSF or Slurm can be added the same way, using a shared filesystem instead of staging. Nothing is built for remote execution beyond keeping steps self-describing.

Other platforms

doris is Linux only, and no other platform is planned.