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).
gitonPATH, 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 checklists 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
- Lint and TestRIG describe each flow’s config and what its result means.
- Running flows explains jobs, steps and outcomes.
- Command line lists every command and option.