Bind semantics, the spaced macro call and the directive inside a connection, and lucisv.instantiate
TODO section 26; closes docs/topo.md 2.9-15 and 2.9-19; coverage_gaps
M4/M5/M6 corrected against a fresh opentitan census.
A bind directive's target is a path of segments with optional indices
(bind top.gen[0].u_core chk u_chk (...)); a lone target binds as a
module reference, an instance path records nothing rather than a guess.
Each connection's port half resolves against the module being bound in
and its expression half in the target module's scope first, the
workspace's member path when the target lives elsewhere, the writing
scope last (Target::BindScope, resolve::in_bind_target - the
inline-constraint shape). FACTS_FORMAT 14 -> 15: binds now post
references and an instantiation edge.
Expression-position spaced macro calls (assign x = `WIDTH (a + b);)
keep the author's gap, read from the source as glued_null_item reads
its gap; verify.rs untouched, both pins stand. A conditional directive
inside a connection value becomes ExprKind::Verbatim, byte-exact
through raw_inline as Doc::Inline, with the closing paren's line and
the list's break read from the source - so the instantiation keeps its
edge, lens and port references instead of collapsing to opaque bytes
(opentitan: the two padring sites in chip_earlgrey_{asic,cw340}.sv,
+2 edges, everything else byte-identical to 0.31.0).
lucisv.instantiate [uri, position, module] renders the inline ghost's
plan as plain text through workspace/applyEdit for clients without
inline completion; the Neovim README documents it.
QA: 3186 tests / 47 binaries, corpus 814/820, independent binary diff
over corpus and 2 645 opentitan files: only the two named files differ.
docs/features/bind-semantics/README.md.
Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
a0c290ccc2
commit
81df63d942
27 files changed
+2038
-134
No files matched your search
@@ -55,9 +55,9 @@ request.
|
||||
| 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. | macro-items/lexer-cleanup READMEs; measured 11 opentitan files. | A UVM spelling people actually type. Deliberately deferred because the lexer fix could break expression position; needs a careful round. |
|
||||
| M5 | Directives inside a list *element* or between an instance name and its `(`. | directives-in-instances README; measured 13 files. | The `.a(` ⏎ `` `ifdef `` ⏎ … ⏎ `)` shape in real port maps. |
|
||||
| M6 | Indexed hierarchical `bind` target (`bind top.gen[0].u_core …`). | bind README non-goals. | Binding SVA into generate arrays is common in formal setups. |
|
||||
| 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; clocking blocks routed to `opaque_spans`. | assertions / clocking-wave READMEs. | Same root as C1; resolves 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. |
|
||||
@@ -77,7 +77,7 @@ request.
|
||||
| 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). | inline-instantiation README. |
|
||||
| ~~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. |
|
||||
|
||||
@@ -130,6 +130,7 @@ Delivered since this analysis was written at 0.21.0, in the recommended order:
|
||||
| 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 | pending release |
|
||||
| M7 semantic lints on by default (§2.9-6) | queued | — |
|
||||
| **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 | pending release |
|
||||
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user