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

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.