lowRISC / lowRISC/dvsim

Let a lint, CDC or RDC config pass several FuseSoC arguments

Open
#259 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
13
Forks
21
Avg merge
1d 11h
Merged PRs (30d)
8

Description

`additional_fusesoc_argument` holds one argument. `LintCfg` declares it as a scalar (`flow/lint.py:41`), and `CdcCfg` and `RdcCfg` inherit it. `SimCfg`, `FormalCfg` and `SynCfg` do not have the key; they reach FuseSoC through `sv_flist_gen_flags`, which dvsim does not declare, so its type comes from the first config that sets it and a list just works. The declaration as `""` is what locks these three flows to a single string, and it appears to be the only declared scalar carrying an open-ended list of tool arguments.

Two things follow. A list is rejected outright by `set_target_attribute()` (`flow/hjson.py:113-151`), with `of unknown type list`. And because scalars merge first-non-default-wins and raise on a genuine conflict, a config and one that imports it cannot each contribute an argument:

```
RuntimeError: '.../common_lint_cfg.hjson': Value for key 'additional_fusesoc_argument' is
'--mapping=lowrisc:prim_generic:all:0.1', but we already had a conflicting value of
'--mapping=lowrisc:systems:top_darjeeling:0.1'.
```

So every entry needing a mapping has to spell out the mappings of its whole import chain. Lists merge by concatenation, which is the behaviour this key wants.

Independent of #258, which is why the concatenated string cannot even be wrapped today: fixing that makes the string readable, not the imports composable.

## Scope

- Add `additional_fusesoc_arguments` to `LintCfg`, declared as `[]`; `CdcCfg` and `RdcCfg` inherit it. Little else is needed, as list keys already merge by concatenation and `_stringify_wildcard_value()` (`utils/wildcards.py:35-53`) already joins them with spaces on expansion.
- Keep the singular key working and expand both wildcards in `build_opts`, since every OpenTitan lint config uses the singular form. Deprecating it is a separate decision.
- Reject a config setting both: the names differ by one letter and the order would not be predictable from reading the file.

## Done when

- A list of two mappings loads and both reach the FuseSoC command line, including when they come from two configs in an import chain.
- The singular key behaves exactly as before, and a config setting both is rejected. Tests cover all three.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with LintCfg in flow/lint.py, validation in flow/hjson.py:113-151, and wildcard expansion in utils/wildcards.py:35-53; trace how build_opts reaches the FuseSoC command line. Add plural-list handling while preserving the singular key, reject configs setting both, and run or add tests covering list merging across imports, singular behavior, and the conflict case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.