Files
lucisv/docs/coverage_gaps.md
T
lucioandClaude Fable 5.1 f476c31483 Cross-file instance-member tail: a module's hierarchical surface, read only behind an instance head; rename edits the tail
TODO §49 (docs/features/hierarchical-tail). Closes topo §2.9-23 and
comment-slots finding 2. The first dev was cut off by an outage with the
library half complete; a second finished the tests, README and gates.

`Surface { Connection, Hierarchical }` on `Resolution::ExternalCandidate`
and `MemberSite::Unit`, set by `resolve.rs::head_surface` for an instance
head. `workspace/hierarchy.rs`: `surface_of` (the export rule, re-ruled)
and the two surface-taking reads; the index keeps two disjoint tables —
`members` (connection: ports, parameters; byte-identical to before for
every existing reader) and `hier_members` (nets, variables, instances) —
and a hierarchical read consults the connection table first, so a port
has one record. `FACTS_FORMAT` 18 → 19. `assign w = u_x.sig;` in another
file now resolves to `sub`'s `wire sig`; rename edits both files (nested
`u_a.u_b.sig` included); the §2.9-20 warning is retired for a resolved
tail; a generate-scoped net is still refused honestly. Completion after
`u_x.` in an expression lists the hierarchical surface; a connection
list's does not.

Census: single-file numbers unmoved; 12 939 connection + 5 239
hierarchical-only members; 335 corpus references newly resolve, 514 over
opentitan `hw/` (20 sampled by QA, all genuine). 0 of 860 corpus files
differ. Also: §50/§51 planned, §55 (state.rs size) filed.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-05 13:35:57 -05:00

27 KiB
Raw Blame History

Verilog/SystemVerilog coverage gaps — ranked (2026-09-01)

Reading this report today (2026-09-05). The survey below is a historical v0.21.0 measurement with later amendments, not a fresh list of current failures. Use repository-analysis.md and topo.md for current implementation status. Original probe counts remain historical.

Through v0.44.0, external waivers, rival conditional headers, net-delay positions and comment slots, inline aggregate overrides, statement/class fences, header recovery, and the three lint-expansion waves have shipped. The prior audit's atomic-write, project lint-selection and directory-cycle findings are also fixed. Bare item-level begin blocks are recovered for lint/editor consumers; strict formatting still refuses them.

At committed 9ef1058, type-name spans replace vlog_semantic/src/scan.rs, and package re-exports resolve through shared member edges (facts codec 18). Both are accepted for the next release. The active hierarchical-tail work proposes codec 19; QA is pending, and handshake 23 remains open. DPI-export name binding is a separate remaining gap (handshake 31), and generate-block hierarchy and cross-file macro expansion remain outside these fixes.

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,, `included 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). — closed at 0.34.0+ by TODO §31. Class bodies and every statement list (begin…end, fork…join*, function/task bodies, initial/always/final bodies, a case item's block body, a statement fragment) are fenceable scopes; --lines still loses to a fence. Two of the three named places stay out, with reasons: port/parameter lists and case label lists print mid-line inside a Group, where Doc::Verbatim (column-0, break-forcing) cannot stand — that wants a new printer primitive, not a scan arm. Measured on OpenTitan, which has 9 fenced files: four now keep their fenced bytes, including a 110-line class-body region. statement-fences README; format-fences / classes / shared-fence-filter READMEs amended. 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. — closed by TODO §32. A list element that does not parse is now a ListElem::Error element of its own list and a statement header's broken condition an ExprKind::Error, so the module, function or instantiation keeps its name, the elements that were typed and its body: the QA shape that cost 3 items and 2 diagnostics costs 1 and 1, and the wire w; under a half-typed sub u (.a( is a sibling item again. Measured over the corpus truncated at each file's midpoint: 622 → 555 error nodes (−11 %), while diagnostics rise 1 702 → 1 826 because the constructs that now survive report their own missing closers (expected \endmodule`` +91) instead of vanishing into one node. header-recovery README; error-recovery README amended. Editing experience: diagnostics no longer cascade while typing a header, and the outline keeps the module.
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. — closed at 0.33.0 by TODO §30. Modport method prototypes parse, format, bind and span; unnamed DPI formals parse behind the DPI flag only (§35.5.5), print as their type alone and declare nothing. The const half was misfiled: const ref (§13.5.2's only const argument form) has parsed and formatted since the corpus shape landed — the probe found only one real gap, a comment written between const and ref, now its own slot. interface-dpi-arms README; interfaces / dpi-export READMEs. Real interface-class idioms; each was 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.

  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.

The three stale README claims found by the inventory are now closed: docs/features/interfaces/README.md records that program and clocking = expression landed in testbench-mopup; docs/features/dv-statements/README.md records the delivered foreach (a[, j]) form; and docs/features/assertions/README.md records that assertions work in an interface body through the shared item path.


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: L3, L6, L9 and L10. M12's second half (--rules-doc, §2.9-5) was delivered by macro-word-census. M10's error recovery inside headers and lists is closed (TODO §32), with the narrowing recorded in its row: a truncated file reports more diagnostics than before, because the constructs that now survive say what closer they are missing. M13's small interface/DPI grammar arms are closed (TODO §30) — with one narrowing recorded there: a single import may carry one prototype, not a comma-separated list of them. M9's format fences are closed too (TODO §31, §2.9-3), with the same kind of narrowing recorded in its row: the two mid-line list positions (port/parameter lists, case label lists) stay inert, because a column-0 verbatim slice has no place inside a Group. The three stale READMEs named under the order were reconciled in the 0.33.0 documentation pass.

Linter addendum (2026-09-04, TODO §35)

Three waves of linter expansion (§33, §34, §35) took the registry from 17 rules to 73, and with §35 lucisv implements every rule in Verible's published list except one: forbid-implicit-declarations, which needs the elaboration-order model lucisv does not have. Each rule cites its Verible name, description and default in its own doc; lucisv check --rules-doc is the generated truth.

Three coverage notes the wave produced, none of them a language gap:

  • Historical parser gap, closed in tolerant mode by v0.40.0: begin where an item belongs. At the time of this addendum, the parser refuses a module-scope begin … end and a bare begin inside a generate region rather than recovering either as a block, so recovery unwinds and the rest of that unit is lost — module-begin-block and v2001-generate-begin read the error leaf instead of a tree. Both constructs are illegal (the first) or legacy (the second), so the finding itself is exact; what is lost is every other rule's view of that file. Filed here as the linter's one remaining "the rule reads a gap between tokens" case, for a future parser round to recover as a labelled generate block.
  • An .svh fragment included into a class body is judged as file scope. explicit-function-lifetime / explicit-task-lifetime report methods in a fragment that only becomes a class body after `include. Verible, which also lints one file at a time, reports the same; 39 of the two rules' 101 opentitan findings are that shape. Not fixable without following includes, which is the same boundary docs/features/fragment-mode/README.md records.
  • Verible's forbidden-symbol is not a rule. It is the name of the source file Verible implements invalid-system-task-function in. lucisv ships one rule with the list as its symbols option rather than two rules that would both fire on $psprintf.