TODO section 27; the SVA half of coverage_gaps C1/M8; docs/topo.md
2.9-18's engine half.
property/sequence declarations, concurrent assert/assume/cover/restrict
property, expect, cover sequence and default disable iff were verbatim
text. They are nodes now: sequence_expr/property_expr as one
precedence-climbing extension of parse_expr (IEEE 1800-2017 Table 16-3
row by row - QA caught two rows transcribed from Table 11-2 and the
rework fixed them: nexttime on not's row, the whole loosest row read
position-independently), typed formals, assertion variables, action
blocks as the statements they are - behind a Rewind snapshot with a
byte-exact per-construct fallback that fires on 0 of 4 792 corpus and
opentitan files. No keyword reserved: operator words are text-matched
in SVA position only. One layout rule: top-level |->, |=>, ##, and, or
break one per line at the parent's indent when the spec does not fit.
SVA gap fuzzer 705 gaps / 0 failing; 46 attack pairs; verify.rs
untouched.
Semantics: SymbolKind::{Property, Sequence}, ScopeKind::PropSeq, formals
and locals scoped, instances resolve in-file and cross-file
(FACTS_FORMAT 15 -> 16); rename, references, document symbols and the
lints see inside; Scope::sva_fallback_warnings names what would still
fall back. macro_use_warnings pinned for a file whose only relationship
to the name is a macro argument (the server half stays filed).
Output moved in 13 corpus and 36 opentitan files, every changed line
inside an SVA construct (proved by tests/census.rs::sva_lines and by
QA's independent re-implementation); the 4 854 ASSERT macro uses are
byte-identical. Corpus 814/820.
docs/features/sva-bodies/README.md. Also carries TODO section 28
(decomposition, planned) and the topo rows for this round.
Co-Authored-By: Claude Fable 5 <[email protected]>
157 lines
21 KiB
Markdown
157 lines
21 KiB
Markdown
# Verilog/SystemVerilog coverage gaps — ranked (2026-09-01)
|
||
|
||
What lucisv 0.21.0 does not yet handle, ranked by severity, from two
|
||
independent sweeps crossed against each other:
|
||
|
||
- **Empirical probe** — 71 minimal-but-realistic files (44 RTL, 27 DV)
|
||
covering the Verilog-2005 / SV-2017 features an RTL or DV engineer
|
||
writes, each run through `--check`, `--stdout`, a second `--stdout`
|
||
(idempotency) and a comment/layout eyeball; plus 13 headless LSP
|
||
hover/definition spot checks. Probe files, harness and logs:
|
||
the session scratchpad `survey/` (re-runnable). Snapshot binaries were
|
||
used so concurrent dev rebuilds could not skew results.
|
||
- **Documentation inventory** — every non-goal, deferral, verbatim
|
||
capture, non-resolution rule, parse-error string and open handshake
|
||
across `TODO.md`, `docs/topo.md` §2.9, `syntax_coverage.md` and all
|
||
108 feature READMEs.
|
||
|
||
**Headline:** across every file that parsed, `format(format(x)) ==
|
||
format(x)` held with zero exceptions and no comment was moved or lost.
|
||
The gaps are (1) grammar holes, (2) regions the parser captures as opaque
|
||
verbatim text — they *format* but nothing inside is navigable, renamable
|
||
or lintable — and (3) semantic blind spots where the LSP answers nothing
|
||
or, worse, the wrong thing.
|
||
|
||
Severity scale: **Critical** = wrong answer or a correctness risk on
|
||
common code · **High** = common construct with no formatting or no
|
||
navigation · **Medium** = less common construct, or partial behavior ·
|
||
**Low** = rare construct or deliberate non-goal worth revisiting only on
|
||
request.
|
||
|
||
---
|
||
|
||
## Critical
|
||
|
||
| # | Gap | Evidence | Why it ranks here |
|
||
|---|---|---|---|
|
||
| C1 | ~~**Rename/references do not see inside verbatim regions**~~ — **closed at 0.33.0.** Constraint blocks (0.27.0), covergroups (0.28.0) and now `property`/`sequence` bodies and concurrent-assertion expressions (`sva-bodies`) are all real nodes; `randomize() with {…}` came with round 1. What is left is the *measured* fallback in each: a body the grammar does not recognise still rewinds to a byte-exact verbatim capture, and rename now **says so** rather than being silent (`sva-bodies` P5). | Documented: classes, assertions, dv-statements READMEs; vlog-semantic non-goals; sva-bodies. | A DV rename of `user_id` rewrites every declaration and use the binder knows and **silently leaves `constraint c { user_id < 5; }` untouched** — output that does not compile. Same for a coverpoint on the renamed field. This is the one gap that turns a refactor into a correctness problem, and constraints/covergroups are in every UVM sequence item and coverage class. Fix path: parse constraint bodies (an expression grammar plus `inside`/`dist`/`->`/`soft`/`solve … before`/`foreach`/`if-else`) and covergroup bodies as real nodes; SVA property expressions can stay opaque longer but must at least yield *identifier occurrences* so rename can warn or refuse. |
|
||
| C2 | **Modport port resolves to the wrong symbol.** Hover on `.m(b_if.mp)` answers with the instantiated *module*, definition jumps to the module, not the modport. | Probe: LSP check "modport port, used". Documented root: interfaces indexed as `Module`, modport names unbound (topo §2.9-7). | A wrong answer is worse than none. Needs `SymbolKind::Interface` + modport symbols; unlocks C3/H2 too. |
|
||
|
||
## High
|
||
|
||
| # | Gap | Evidence | Why |
|
||
|---|---|---|---|
|
||
| H1 | **Struct field access `s.field` — hover null, definition empty.** | Probe: struct field LSP check. Documented: vlog-semantic rule 4 ("nothing ever looks up into it"), topo §2.9-13. | `typedef struct packed {…} bus_t;` is the standard way RTL carries buses; every `.field` use is dark to hover/definition/references. Needs struct members as symbols (named typedefs and the anonymous form) plus the `type_name` link the §15 round-1 work introduces — the natural §15 round 2. |
|
||
| H2 | **Virtual-interface signal access `vif.sig` — hover null.** | Probe: `vif.sig_a` LSP check. | The DV daily driver. Same mechanism as H1 once interfaces export their signals (C2's `SymbolKind::Interface`) and `virtual my_if vif` carries `type_name`. |
|
||
| H3 | **Escaped identifiers are unformattable.** `wire \my-signal ;` → `verification failed: … output has identifier "\my-signal;"`. | Probe: two RTL files, both refused. | The formatter drops the mandatory terminating space, verify.rs catches it (invariant 1 holds), and the whole file is refused. Netlists and synthesis/tool-generated RTL are full of escaped names, so those files cannot be formatted at all. Small formatter fix (emit the space), attack tests owed. |
|
||
| H4 | ~~**Include-fragment files (`*.svh` class-body pieces) do not parse at all.**~~ **Corrected 2026-09-02 (TODO §22):** class-body and module-item fragments *always* parsed — the file-scope item loop **is** the class-item and module-item loop, and the two `cip_base_vseq.svh` pieces formatted at 0.28.0. Three shapes did not: a **statement list**, an **enum-member list** and a **covergroup-item list**, all failing at one site (`parse_ident_item`). And `cip_base_vseq__tl_errors.svh` was never a fragment problem at all: its `` `define`` formal-argument list spans lines 8–10 with no backslash, which every tool accepts and lucisv's line-oriented directive lexing did not. | `riscv_custom_instr_enum.sv` (one comment and `CUSTOM_1,`, `` `include``d between two enum members of `riscv_instr_pkg`); `cip_base_vseq__tl_errors.svh` lines 8–10. | Delivered by TODO §22 / `docs/features/fragment-mode/README.md`: the three shapes are read when the file's first structural item fails and a shape consumes the whole file, and the `` `define`` formal list continues across a line break. opentitan sweep 12 → 10 failures (exactly these two files), corpus 813 → 814. |
|
||
| H5 | **`` `define`` go-to-definition returns nothing** while hover shows the body. | Probe: macro LSP check. | Inconsistent and cheap: the define table already knows the site. |
|
||
| H6 | **Class member chains `a.b.c` and instance heads `u.port`** through the index. | TODO §15 round 2 (filed); vlog-semantic rule 8. | Follows directly from §15 round 1 (needs `Def::type_name`, FACTS_FORMAT bump). `cfg.vif.clk` and `item.hdr.addr` are the common DV shapes; `u_sub.port` is the common RTL one. |
|
||
|
||
## Medium
|
||
|
||
| # | Gap | Evidence | Why |
|
||
|---|---|---|---|
|
||
| M1 | `specify … endspecify` / `specparam` and UDP `primitive … endprimitive` — hard parse errors. | Probe (3 files); README "still open". Corpus count 0, opentitan 0. | Absent from hand-written RTL, present in every std-cell / IO / memory simulation model a project vendors. Exclude patterns cover most; parsing (opaque-verbatim capture is enough) would stop the errors. |
|
||
| M2 | `checker … endchecker` — parse error on the checker's port list; `checker` not even a keyword. | **Evidence corrected 2026-09-02:** the "13 corpus files" were UVM protocol-*checker* filenames and identifiers, not declarations. A token-level census over 4 839 corpus + opentitan files finds **0** `checker` declarations — and 0 code-shaped uses of the word at all. | Formal-verification collateral. The 13-hit number was wrong, so this is a completeness item, not a measured pain: the value is that a formal harness opens without an error node. Delivered by TODO §23. |
|
||
| M3 | `interface class` + `implements` — parse error. | Probe; interfaces/type-hierarchy READMEs. | UVM-style DV uses it occasionally; also blocks type-hierarchy's `implements` edges. |
|
||
| M4 | ~~Macro call with a space before `(` — `` `uvm_field_int (x, y) `` — clean parse error at item position.~~ **Evidence corrected 2026-09-02:** item and statement position were closed by item-misc on 2026-08-20 (`Parser::at_spaced_macro_call`); all 33 opentitan files that write a spaced macro call format, and every one of them writes it at item position. The residue was *expression* position, where the file parsed and the **formatter** tightened the gap, so the safety net refused it. | macro-items/lexer-cleanup READMEs; the "11 opentitan files" were item-position hits, already fixed. | Delivered by TODO §26 (`Fmt::spaced_macro_callee`): the author's gap is read from `src` and printed back; `verify.rs` untouched. Zero opentitan movement — the one expression-position hit in the tree sits inside a concurrent assertion, which is verbatim before an expression parser sees it. |
|
||
| M5 | ~~Directives inside a list *element* or between an instance name and its `(`.~~ **Evidence corrected 2026-09-02:** the headline shape has *formatted* since directive-in-statements (2026-08-29) — as opaque bytes for the whole item, so the instantiation lost its edge, its lens, its hierarchy site and every port reference. A census of the 3 975-file opentitan tree finds **3** such files, not 13, and **zero** matching the literal `.name(` ⏎ `` `ifdef `` shape: the real one is a directive between the elements of a concatenation *inside* a connection value. | directives-in-instances README; census 2026-09-02. | Delivered by TODO §26 (`ExprKind::Verbatim`): only the one connection's **value** is opaque now, so the instantiation is a node again — 2 opentitan files gained an edge, and they are the only two whose output moved. Still open, and still a clean parse error: a directive inside an **ANSI port-list element**, the **one-line spelling**, and the *directive-split* shape (two instantiation heads behind one `` `ifdef ``, `hw/top_earlgrey/dv/tb/tb.sv`) — that last one no expression-level capture can reach. |
|
||
| M6 | ~~Indexed hierarchical `bind` target (`bind top.gen[0].u_core …`).~~ | bind README non-goals. | Delivered by TODO §26: `BindDirective::target` is a `Vec<PathSegment { name, span, index }>` and `at_bind_directive` steps over one `[…]` per segment. Shipped with the §2.9-15 semantics in the same round — a lone target resolves as a module or interface, a connection's port half against the bound-in module and its expression half in the target's scope. Real but unmeasured: still zero corpus and opentitan hits. |
|
||
| M7 | Semantic lints (`unused-signal`, `undriven-net`, `multiply-driven`) ship **off by default**. | linter-core / semantic-lints READMEs; blocked on topo §2.9-6 (workspace-wide "does any file mention this name"). | These are the lints RTL engineers want most; the index now has reference postings and `files_spelling`, so §2.9-6 is closer than when filed. |
|
||
| M8 | ~~Lint rules do not descend into verbatim regions~~ — **closed at 0.33.0 for what parses**, by construction: the rules read the reference table, and a structured assertion contributes ordinary references to it. A `signals.rs` `opaque_span` remains only for a region that fell back. | assertions / clocking-wave / sva-bodies READMEs. | Same root as C1; resolved with it. |
|
||
| M9 | Statement-level format fences (inside `always`, case items, port lists) and fences inside class bodies (topo §2.9-3). | format-fences / classes READMEs. | Users protect hand-aligned tables inside procedural blocks; DV users protect them in classes. |
|
||
| M10 | Error recovery does not reach headers and lists (port lists, parameter lists, for-headers) — a half-typed port list yields a garbage tree. | error-recovery README (QA-confirmed). | Editing experience: diagnostics cascade while typing a header. |
|
||
| M11 | Anonymous aggregate members (`enum {A,B} x;`) not symbols (topo §2.9-13); cast type `state_t'(0)` records no reference. | overlay-promotion README; probe: enum *typedef'd* members do work. | Partial: named enums navigate, anonymous ones do not. |
|
||
| M12 | No `lint` key in `lucisv.toml` (topo §2.9-4); no `--rules-doc`. | four READMEs. | Config surface, not language — but it gates per-project rule selection. |
|
||
| M13 | Modport method prototypes (`import task drive(int x);`), `const` task/function arguments, unnamed DPI formals. | interfaces / dpi-export READMEs. | Real interface-class idioms; each a small grammar arm. |
|
||
|
||
## Low
|
||
|
||
| # | Gap | Evidence |
|
||
|---|---|---|
|
||
| L1 | `expect (@(posedge clk) prop);` — parsed as a call, not a keyword. | Probe. |
|
||
| L2 | Tagged unions (`union tagged`, `tagged Valid`, `case … matches`). | Probe. |
|
||
| L3 | `randsequence` production bodies. | Probe; classes README ("building for a user that does not exist" — corpus 0). |
|
||
| L4 | `alias` statement. | Probe. |
|
||
| L5 | `config … endconfig`, `library`. | Probe. |
|
||
| L6 | `->>` non-blocking event trigger; stream `with [range]`; cast bases other than a name/system call; drive strength on a net declaration; net delay written after the type; `let` at statement position; `#(min:typ:max)` clocking skew. | expressions-2 / interfaces / dv-statements READMEs, TODO §11 skips. |
|
||
| L7 | `` `ifdef `` conditions never evaluated (both arms listed); no macro expansion; stringification passes through. | TODO §7 non-goal — by design, like Verible. |
|
||
| ~~L8~~ | ~~Execute-command spelling of the instantiation skeleton for clients without `inlineCompletion` (topo §2.9-19).~~ — **delivered 2026-09-02 by TODO §26**: `lucisv.instantiate [uri, position, module]`, planned through the ghost's own `nearest_definition`/`plan_for`, rendered plainly and pushed as a `workspace/applyEdit`. Documented with a keymap in `editors/nvim/README.md`. | inline-instantiation README. |
|
||
| L9 | `codeAction/resolve` laziness; `inlayHint` zero at default scope; index widen not interleaved. | TODO §10 deferred. |
|
||
| L10 | Cosmetic: an enum body one-lined when short; `` `uvm_field_* `` lines dedented to the `` `uvm_object_utils_begin `` column (they are plain macro statements — no block for the formatter to see). | Probe observations. |
|
||
|
||
---
|
||
|
||
## What passed (so nobody re-probes it)
|
||
|
||
RTL: `always_ff`/`always_comb`/`always_latch`; `unique`/`unique0`/`priority`; `casez`/`casex`/`inside`; packed/unpacked struct/union/enum + typedefs; multi-dim packed arrays; `'{…}` patterns with default/index keys; streaming and replication; `+:`/`-:`; interfaces with modports, parameterized interface instantiation, interface ports; generate if/case/for with named blocks; `defparam`; `parameter type`; `$clog2`; gate primitives with strengths and delays; `wand`/`wor`/`tri1`/`supply0`; `@*`/`@(*)`; net/procedural/assign delays; `timeunit`/`` `timescale``; `` `define`` with args, `` `ifdef``/`` `elsif``/`` `else``, `` `include``, `` `default_nettype``; attributes; `import`/`export`; `let` (item); `bind`; `$unit`; every literal form; `++`/`+=`/`do while`/`foreach`/`repeat`/`forever`; `fork`/`join_any`/`join_none`, named events, `wait`, `wait fork`, `disable fork`; `void'()`; `static`/`automatic`; DPI import/export; `q[$]`.
|
||
|
||
DV: parameterized classes and `extends #()`; `virtual`/`pure virtual`/`extern` + out-of-class bodies; `static`/`local`/`protected`/`const`; `typedef class`; `this`/`super`/`new`; `rand`/`randc`; constraints with `inside`/`dist`/`->`/`if-else`/`soft`/`solve … before`/`foreach`/`unique`; `randomize() with`; `std::randomize`; queues/dynamic/associative arrays and their methods; `.sum`/`.find with`; virtual interfaces + clocking blocks; `program`, `mailbox`, `semaphore`, `process`; covergroups with `bins`/`cross`/`iff`/`sample()`; `property`/`sequence` with arguments; `assert`/`cover`/`assume property` with `|->`/`|=>`/`##[1:$]`/`throughout`/`$rose`/`$past`/`disable iff`; immediate assertions; `$cast`/`$sformatf`/`int'()`; string and enum methods; `$bits`/`$size`/`$typename`; UVM macro blocks incl. multi-line `` `uvm_info``; macro-as-statement; `case … inside` with `?`.
|
||
|
||
LSP: hover + definition for package-imported parameters, enum members, class parameters, function arguments, genvars, hierarchical instance ports (`u_sub.port_q`), `let` names.
|
||
|
||
## Recommended order
|
||
|
||
1. **§15 round 1** (in flight) → **H6 chains** as its round 2 — the same machinery, and it unlocks H1/H2 once the member tables exist.
|
||
2. **C2 + H2**: `SymbolKind::Interface`, modport symbols, interface member export — fixes a wrong answer and the DV daily driver together.
|
||
3. **H1**: struct members as symbols (with §2.9-13's anonymous forms).
|
||
4. **H3**: the escaped-identifier space — a one-line formatter fix with attack tests; ship it in any adjacent round.
|
||
5. **C1**: constraint and covergroup bodies as real nodes — the biggest single DV win and the one correctness risk; SVA expressions can follow. *(All three done: 0.27.0, 0.28.0, 0.33.0.)*
|
||
6. **H4**: fragment mode for `.svh` pieces. *(Done by TODO §22 — and the row itself was wrong; see the correction in the High table.)*
|
||
7. **M1–M3** grammar arms (specify/UDP/checker/interface class) as one "vendor and formal collateral" round, verbatim capture acceptable. *(Done by TODO §23 — and the M2 row's evidence was wrong; see the correction in the Medium table.)*
|
||
8. **M7** semantic lints on by default via §2.9-6.
|
||
|
||
Two stale READMEs found by the inventory, to fix on the next docs pass:
|
||
`docs/features/interfaces/README.md` still lists `program` and the
|
||
clocking `= expression` as unsupported (delivered in §11 round 2);
|
||
`docs/features/dv-statements/README.md` lists `foreach (a[, j])` as not
|
||
done (delivered by testbench-mopup); `docs/features/assertions/README.md`
|
||
says `interface` is still a parse error.
|
||
|
||
|
||
---
|
||
|
||
## Status addendum — 2026-09-02, at 0.28.0
|
||
|
||
Delivered since this analysis was written at 0.21.0, in the recommended order:
|
||
|
||
| item | status | release |
|
||
|---|---|---|
|
||
| §15 r1 class member access (`in_item.user_id`, inherited, out-of-body methods) | done | 0.22.0 |
|
||
| H6 chains `a.b.c`, instance heads `u.port`, typedef aliases | done (ports/params exported; nets/vars in-file only, ruled) | 0.23.0 |
|
||
| C2 + H2 interface/modport/clocking symbols, `vif.sig`, `vif.cb.sig` | done | 0.24.0 |
|
||
| H1 struct/union/enum members incl. anonymous forms and nested register-package structs (§2.9-13) | done | 0.25.0 |
|
||
| member completion after `.`/`::` + port-map completion (new item, found during H1) | done; `localparam` kind fixed at the root | 0.26.0 |
|
||
| H3 escaped identifiers | done (one scoped-name shape refused, §2.9-21) | 0.26.0 |
|
||
| **C1** constraint bodies (`soft`/`dist`/`->`/`foreach`/`solve before`) as real nodes, rename reaches inside | done; 1 993/2 009 opentitan bodies structured | 0.27.0 |
|
||
| **C1** covergroup bodies | done; 544/544 opentitan covergroups structured | 0.28.0 |
|
||
| H5 `` `define`` go-to-definition | done (`nav::definition` shares hover's lookup) | 0.31.0 |
|
||
| H4 fragment mode — statement / enum-member / covergroup-item files, plus the `` `define`` formal-argument continuation (the H4 row above is corrected: class-body and module-item fragments already parsed) | done; opentitan 12 → 10, corpus 813 → 814 | 0.29.0 |
|
||
| M1–M3 specify/UDP/checker/interface class, plus L1/L2/L4/L5 (`alias`, statement `expect`, `config`/`library`, `union tagged`) | done; corpus 814/820 and the opentitan 3 975-file sweep byte-identical | 0.30.0 |
|
||
| M7 semantic lints on by default (§2.9-6), with `[lint] select/ignore` (§2.9-4, the first half of M12) | done; `FileFacts::words` census, `MentionOracle`; corpus `unused-signal` 52 → 44, `undriven-net` 3 → 0, opentitan 14 findings all true | 0.30.0 |
|
||
| §2.9-22 comment slots in shared machinery (a parser-wide round), with H5, M11's cast half, §2.9-20 and §2.9-21 | done; ~70 slots, four gap fuzzers at zero (329/153/395/352), 860 corpus + 3 975 opentitan files byte-identical | 0.31.0 |
|
||
| **C1/M8** the SVA half: `property`/`sequence` bodies, concurrent assertions, `expect`, `cover sequence` and `default disable iff` as real nodes, with a canonical layout and the rename warning for what still falls back | done; opentitan 79/79 declarations and 97/97 assertions structured with zero fallbacks (corpus 8/8 and 63/63), 13 corpus and 36 opentitan files' output moved — assertion text only — and both sweeps otherwise byte-identical | 0.33.0 |
|
||
| **M4/M5/M6** corrected and closed: the macro gap in expression position, the conditional region inside a connection's value, the indexed `bind` target + `bind` semantics (§2.9-15), and `lucisv.instantiate` (§2.9-19, L8) | done; corpus 814/820, opentitan 3 965/3 975 with 2 files' output changed and +2 instantiation edges | 0.32.0 |
|
||
|
||
New gaps filed along the way — §2.9-20 (rename loses its warning for an
|
||
unresolvable hierarchical tail), §2.9-21 (escaped segment in a scoped
|
||
name is refused), §2.9-22 (comment slots inside shared expression
|
||
machinery) — were all delivered by 0.31.0. Open after 0.32.0: §2.9-23 (a
|
||
cross-file instance-member tail is not edited by rename; since 0.31.0 the
|
||
rename says so).
|
||
|
||
**The recommended order is complete at 0.32.0, and its last correctness
|
||
residue is closed at 0.33.0.** The SVA half of C1/M8 —
|
||
`property`/`sequence` bodies and concurrent-assertion expressions —
|
||
is a real tree since `docs/features/sva-bodies/README.md`: a rename of a
|
||
signal named only inside a property edits it, references list it, and the
|
||
"at least identifier occurrences" fallback the C1 row asked for was
|
||
overtaken rather than built (what the grammar cannot read still rewinds to
|
||
the byte-exact capture, and rename *names* those regions instead of going
|
||
quiet). What the tables above still leave open, by weight: M9 statement-level
|
||
and class-body format fences
|
||
(§2.9-3); M10 error recovery inside headers and lists; the second half of
|
||
M12 (`--rules-doc`, §2.9-5); M13's small interface/DPI grammar arms; L3,
|
||
L6, L9, L10; and the three stale READMEs named under the order.
|