Every tracked file that can carry a comment (880 of them) now opens with "Author: Guoliang Chen, a Senior Digital Design Engineer" and closes with "Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love, luciochen.com", in the file's own comment syntax. No behaviour change: the diff outside the version bump and changelogs is comment lines only. - tools/stamp_author.py: writes the lines; idempotent, `--check` lists what is missing. Headers go under a shebang and under Markdown front matter. - Left alone: test fixtures, cases and snapshots (byte-exact inputs), JSON and JSONL, logs, images, lockfiles, docs/site/dist (regenerated) and the LICENSE files (already carry the copyright line). - tools/linux_check.sh: --help reads its header from line 3, now that the author line sits under the shebang. - tools/gates.sh green on this tree: 5 545 tests, corpus 814/6 as before. Co-Authored-By: Claude Mythos 5.2 <[email protected]>
498 lines
30 KiB
Markdown
498 lines
30 KiB
Markdown
<!-- Author: Guoliang Chen, a Senior Digital Design Engineer -->
|
||
|
||
# bind-semantics
|
||
|
||
## Goal
|
||
|
||
Close the four items TODO §26 groups under "Bind, macro spacing, and the
|
||
instantiate command": the **M4 residue** (a macro name the author separated
|
||
from its `(` in *expression* position — `` assign x = `WIDTH (a + b); `` —
|
||
parses as a call and the formatter used to tighten the gap, which the safety
|
||
net rightly refused); the **M5 residue** (a conditional directive written
|
||
inside a connection's *expression* turned the whole instantiation into opaque
|
||
bytes, costing the instantiation edge, the code lens, the hierarchy site and
|
||
every port reference); **M6 + `docs/topo.md` §2.9-15** (an indexed
|
||
hierarchical `bind` target `top.gen[0].u_core` was a clean parse error, and a
|
||
`bind` recorded nothing but the instantiated module's name — no target, no
|
||
port references, no expression resolution); and **§2.9-19** (a
|
||
`lucisv.instantiate` execute command, the path to the full instantiation
|
||
skeleton for clients without `textDocument/inlineCompletion`).
|
||
|
||
## Assumptions
|
||
|
||
- **The gap between a macro name and its `(` is data.** `` `A (b) `` and
|
||
`` `A(b) `` are one token each, of *different text*, and which one the
|
||
author meant depends on whether the macro was defined with formals (IEEE
|
||
1800 §22.5.1) — a fact that lives in a file lucisv does not read. So the
|
||
formatter prints back the gap the source wrote, read from `src`, and
|
||
`verify.rs` keeps refusing a rewrite in either direction.
|
||
- **A conditional directive is line-oriented** (inherited from
|
||
directives-in-lists / directives-in-instances). The one-line spelling
|
||
``.a(`ifdef X a `else b `endif)`` is still one lexer token from the
|
||
`` `ifdef `` to the end of the line, so it is not this round's shape either.
|
||
- **lucisv never evaluates a `` `ifdef `` condition.** An expression holding
|
||
one is therefore not an expression at all as far as this crate is concerned:
|
||
it is a region whose *value* depends on the preprocessor. It is captured
|
||
byte-for-byte and records nothing — no references, no completion, no rename.
|
||
Everything around it (the instantiation, its module, its instance name, its
|
||
other connections) is structural and keeps working.
|
||
- **A `bind` target's index expression records nothing.** `top.gen[0]`'s `0`
|
||
is a constant elaborated in the *target's* enclosing scope, which is not the
|
||
scope the directive is written in; binding it here would manufacture an
|
||
answer this crate cannot stand behind. Every corpus and opentitan hit is a
|
||
literal, which records nothing anyway.
|
||
- **A comment written inside a `bind` target path is still a clean exit-2
|
||
refusal** — `bind a . /*x*/ b chk u (.*);`, and the same inside a `[…]`
|
||
selector. The pre-existing refusal for a comment inside the `: instance,
|
||
list` (bind README, 2026-08-21) is the precedent: the path's separators own
|
||
no comment slot, nothing in 4 795 corpus + opentitan files writes one, and
|
||
giving five slots per segment to a construct with no user is exactly the
|
||
abstraction-for-a-second-user the project rules forbid. The failure mode is
|
||
an error with the input untouched, pinned by a test.
|
||
- **`lucisv.instantiate` inserts at the position it is given**, without
|
||
looking for a better one. `at_instantiation_site` says whether a module
|
||
instantiation may stand there at all; where it may, the caller's position is
|
||
the insertion point, exactly as the ghost's is.
|
||
|
||
## Handshakes
|
||
|
||
### Consumed
|
||
|
||
- `Parser::at_spaced_macro_call` (item-misc) — the item/statement-position
|
||
reading of the same shape; this round's formatter half is its expression
|
||
twin and does not change it.
|
||
- `Fmt::glued_null_item` (null-items) — the precedent for reading a layout
|
||
fact about the gap between two tokens from `src` in the formatter rather
|
||
than storing a flag on the AST. `Fmt::spaced_macro_callee` is the same shape.
|
||
- `Parser::push_scope_segment` (comment-slots, §2.9-21) — the escaped-segment
|
||
terminator rule for a joined `::` chain. `Parser::push_path_segment` is its
|
||
`.` twin, used for a `bind`'s `: instance, list` entries; the target path is
|
||
no longer joined at all, so its segments carry the rule through
|
||
`Fmt::named` per segment.
|
||
- `Target::InlineConstraint` (constraint-bodies) — the refuse-on-uncertainty
|
||
shape: look in the construct's own scope first, fall back to the writing
|
||
scope only when the first scope *settles* the miss, and record nothing
|
||
rather than guess. `Target::BindScope` is built on it.
|
||
- `completion::{plan_for, nearest_definition, at_instantiation_site}` and
|
||
`InstantiationPlan::render` (inline-instantiation / refactor-instantiate) —
|
||
the one planner. The command adds no second answer to "what is this
|
||
module's instantiation".
|
||
- `ports::execute` + `Server::deliver` (refactor-ports / apply-edit) — the
|
||
executeCommand hub every edit-producing command is delivered through.
|
||
- `completion::layout_at` (completion-core) — made `pub(crate)` again (it was
|
||
private from 2026-08-25) so the command indents a real insertion the way the
|
||
completion list used to. One visibility change and an amended doc comment;
|
||
no behavior of completion's own moved. **Flagged**: `completion.rs` is
|
||
outside the lane's file list except as a "plan module as needed".
|
||
|
||
### Promised / requested
|
||
|
||
- **`ExprKind::Verbatim(RawText)`** in `vlog_parser::ast`. The three
|
||
exhaustive `ExprKind` matches §3.3 predicts each got an arm:
|
||
`vlog_formatter/src/format.rs` (re-emit the bytes exactly, through
|
||
`raw_inline`), `vlog_semantic/src/bind.rs` (record nothing) and
|
||
`vlog_parser/tests/spans.rs` (a leaf whose span is its own text).
|
||
- **`BindDirective::target` is now `Vec<PathSegment>`**, not a joined
|
||
`String` — a non-additive change to an existing field, in the shape
|
||
`dynamic-types` made for `Dim`. Every consumer was found by grep:
|
||
`format.rs::bind`, `tests/spans.rs`, two parser tests. `target_span` is
|
||
unchanged and still covers the whole path.
|
||
`BindDirective::target_path()` is the joined spelling for consumers that
|
||
want one.
|
||
- **`Target::BindScope { target }`** in `vlog_semantic::bind`, resolved in
|
||
`resolve.rs`. `Target` is matched exhaustively in exactly one place
|
||
(`resolve::resolve`), so the variant costs one arm.
|
||
- **`FACTS_FORMAT` 14 → 15.** A `bind` now records its target, its
|
||
connections' port halves and their expression halves, so a record written
|
||
by a 0.31.0 build holds strictly fewer references than this build produces
|
||
for the same file. Bumping is what stops a stale index cache from answering
|
||
with the old, thinner facts (`docs/features/index-persistence/README.md`).
|
||
- **`lucisv.instantiate`** — a new command in
|
||
`crates/lucisv_server/src/instantiate.rs`, registered by `main.rs::commands`
|
||
and dispatched from `ports::execute`'s match (which is where `server.rs`
|
||
routes every non-lens `workspace/executeCommand`; no `server.rs` change was
|
||
needed, and none was made).
|
||
|
||
### Not requested, deliberately
|
||
|
||
- `crates/vlog_formatter/src/verify.rs` is **untouched**. The M4 residue was a
|
||
formatter bug, not a missing forgiveness, and the two standing pins
|
||
(`tightening_a_spaced_macro_call_is_rejected`,
|
||
`loosening_a_glued_macro_call_is_rejected`) still pass unchanged.
|
||
|
||
## Status / TODO
|
||
|
||
- [x] M4 residue: `Fmt::spaced_macro_callee`, 5 cases, verify pins unchanged.
|
||
- [x] M5 residue: `ExprKind::Verbatim` for a balanced region holding a
|
||
conditional directive inside a connection's expression.
|
||
- [x] M6 + §2.9-15: `PathSegment` target with `[…]`, bind semantics.
|
||
- [x] §2.9-19: `lucisv.instantiate`.
|
||
- [x] Gates: fmt / clippy / tests / corpus gate / opentitan sweep.
|
||
|
||
## Work log
|
||
|
||
### 2026-09-02 — dev
|
||
|
||
**M4 residue (formatter only).** `ExprKind::Call`'s arm now asks
|
||
`Fmt::spaced_macro_callee`: the callee is an `ExprKind::Ident` whose text
|
||
starts with a backtick, and the source byte just past the callee's span is
|
||
whitespace. One `text(" ")` before the argument list, in both the
|
||
comment-free and the comment-carrying branch (in the latter only when
|
||
`before_open` is empty, or the comment's own spacing would double it).
|
||
Nothing else changed: `verify.rs` is untouched and its two macro-spacing pins
|
||
still pass, which is the whole point — the net was right and the formatter was
|
||
wrong. `` `W(a) `` stays glued (the lexer hands it over as one token, so it is
|
||
an `Ident`, never a `Call`), and a `(` opening the next line prints as one
|
||
space, which is still two tokens and so is accepted and idempotent.
|
||
|
||
Five cases in `macros.cases` (expression, `localparam` initialiser, parameter
|
||
override, both connection kinds, the comment-in-the-gap slot and the
|
||
next-line `(`), and one new attack pair per direction and per position in
|
||
`verification.rs`. **Zero opentitan movement**, which is the honest headline:
|
||
the 33 files that write a spaced macro call all write it at *item* position
|
||
(`` `uvm_field_int (x, y) ``, closed by item-misc in 2026-08-20), and the one
|
||
expression-position hit in the tree — `` |-> `MAIN_RST_CYCLES ( `` — sits
|
||
inside a concurrent assertion, which is captured verbatim before an
|
||
expression parser ever sees it. So this is a correctness fix with no
|
||
measurable population, exactly as TODO §26's evidence correction predicted.
|
||
|
||
**M5 residue (parser + formatter + one `bind.rs` arm).**
|
||
`Parser::conditional_region_end(close)` scans from the cursor to the `)` that
|
||
matches the bracket just consumed and answers "…and there is a conditional
|
||
directive in it". `parse_connection` asks it right after the value's `(`; a
|
||
`Some` takes `parse_verbatim_expr`, which walks the tokens through `bump` and
|
||
returns `ExprKind::Verbatim(RawText)`. `open_conds` is deliberately untouched
|
||
— `note_item_conditional` counts *item* scope only, so a new verbatim
|
||
construct inherits "does not count" by doing nothing.
|
||
|
||
Three decisions worth recording:
|
||
|
||
* **Where the hook goes.** Only the named connection's `.name( … )` value.
|
||
An ordinary directive *between* elements is already a `ListDirective`
|
||
(directives-in-lists / directives-in-instances) and an ordered element is
|
||
reached through that same harvest, so both were already structural; the
|
||
named value was the one place `parse_expr` was called with no directive
|
||
handling at all. The parameter-override list uses the same
|
||
`parse_connection`, so `#(.P( … ))` came along for free.
|
||
* **`Doc::Inline`, not `Doc::Verbatim`.** `Doc::Verbatim` undoes the
|
||
indentation of the line it lands on, which would drag a region beginning
|
||
mid-line (`.dio_pad_io({ …`) back to column 0. `Doc::Inline` prints the
|
||
bytes exactly and keeps the printer's column honest — the reason
|
||
`Fmt::raw_inline` exists — and is idempotent by construction.
|
||
* **Two `src`-read layout facts.** `Fmt::verbatim_value_breaks` puts the `)`
|
||
on its own line when the source did, which it must whenever the region ends
|
||
on a `` `endif ``: a line-oriented directive swallows a `)` written after it
|
||
on the same line, and the net refuses that (pinned by
|
||
`closing_a_connection_on_a_directives_own_line_is_rejected`).
|
||
`holds_verbatim_value` breaks the enclosing list, because `Doc::Inline`'s
|
||
line breaks are invisible to the group that contains it — the same reason a
|
||
list holding a `ListDirective` is broken.
|
||
|
||
Two pinned parser tests were **inverted**, which is the whole point of the
|
||
change: `a_directive_inside_a_connection_is_captured_or_refused_by_kind` and
|
||
`an_ifdef_inside_an_instantiations_parameter_value_captures_the_instantiation`
|
||
(renamed `…captures_only_that_value`) asserted the whole item became opaque
|
||
bytes; they now assert the instantiation is a node with a verbatim value. The
|
||
`directive_in_statements.cases` case built from
|
||
`chip_earlgrey_asic.sv:621` was re-recorded for the same reason. A
|
||
non-conditional directive inside a connection (`` `include "x.vh" ``) is still
|
||
an ordinary parse error — the check fires on conditionals only.
|
||
|
||
**M6 + §2.9-15 (parser + formatter + semantics).** `BindDirective::target`
|
||
became `Vec<PathSegment { name, span, index }>`; `at_bind_directive` steps
|
||
over one `[…]` per segment with `scan_matching`; `Fmt::bind` prints the
|
||
segments one at a time through `named`, which is what gives an escaped
|
||
segment the space that terminates it. `parse_bind_instance` keeps gluing its
|
||
paths into one `Name` (nothing else wanted them split) but now through
|
||
`Parser::push_path_segment`, `push_scope_segment`'s `.` twin, so the escaped
|
||
case is right there too. Four consumers of the old `String` were found by
|
||
grep and updated; `BindDirective::target_path()` is the joined spelling for
|
||
the ones that only wanted a name.
|
||
|
||
On the semantic side `bind_instantiation_module` became `Binder::bind_bind`:
|
||
the head resolves as `Target::Module` when the target is a lone unindexed
|
||
name and records **nothing** for an instance path (a place in an elaborated
|
||
hierarchy no single file knows); each connection's port half is an ordinary
|
||
`Target::Port(inst.module)`; and the expression half rides
|
||
`Binder::bind_target`, the `with_head` mechanism's twin, which redirects a
|
||
bare `Target::Lexical` through the one `use_member` funnel to
|
||
`Target::BindScope { target }`. `resolve::in_bind_target` looks the name up
|
||
in the target's own scope when this file declares it, hands it to the
|
||
workspace as a one-segment member path (`Target::Port`'s existing spelling)
|
||
when it does not, and falls back to the writing scope only on a miss — the
|
||
`Target::InlineConstraint` shape. A miss on both sides records **nothing**,
|
||
not `NotFound`: a module opens a scope per generate block, so "absent from
|
||
the module's own scope" is not "absent". `FACTS_FORMAT` 14 → 15, for the
|
||
references and the instantiation edges this round adds.
|
||
|
||
12 tests in the new `crates/vlog_semantic/tests/binds.rs`, three cases in
|
||
`bind.cases`, three parser tests, and an attack test per way a segment
|
||
printer could lose a `.`, a `[…]` or an escaped segment's terminator.
|
||
|
||
**§2.9-19, `lucisv.instantiate`.** A new
|
||
`crates/lucisv_server/src/instantiate.rs`: decode `[uri, position, module]`,
|
||
gate the position with `completion::at_instantiation_site` (the same gate
|
||
tier 0 and the ghost ask), plan with `completion::nearest_definition` +
|
||
`completion::plan_for` (the same two calls the ghost makes, through the same
|
||
view cache), render plainly with `completion::layout_at`, and answer one
|
||
`TextEdit` inserting at the position. `main.rs::commands` advertises it, and
|
||
`ports::execute` gets one delegating arm — `server.rs` routes every non-lens
|
||
`workspace/executeCommand` through there, so **`server.rs` needed no change
|
||
and got none**. `completion::layout_at` went `pub(crate)` again with its doc
|
||
comment amended: an `applyEdit` is plain text no editor re-indents, so it
|
||
needs the real indentation of the real line rather than the ghost's relative
|
||
`\t`. An escaped-identifier plan is *accepted* here where the ghost declines
|
||
it: a `TextEdit` has no snippet grammar to escape into.
|
||
|
||
Six unit tests plus one e2e over the wire (advertised in `initialize`,
|
||
arguments survive, the skeleton arrives as a `workspace/applyEdit` push, an
|
||
insertion not a replacement, no tabstops, and a bad position is a request
|
||
error). The one-planner pin is
|
||
`the_command_inserts_the_same_text_the_ghost_would`: rendered through the
|
||
ghost's own layout and hole spelling, the command's plan *is* the ghost's
|
||
text with `sub ` put back in front — read off the ghost's serialized wire
|
||
shape rather than a private field.
|
||
|
||
**Gates.** `cargo fmt -p` per touched crate clean; `cargo clippy
|
||
--all-targets --workspace` 0 warnings; `cargo test --workspace` 3 186 passed,
|
||
0 failed across 47 binaries; `cargo test -p vlog_formatter` green (921
|
||
cases + 199 verification tests); `scripts/corpus_gate.sh corpus` 814/820 with
|
||
the same six failures.
|
||
|
||
**opentitan (read-only, `--stdout`/`check` only; `git status --porcelain`
|
||
after every sweep showed only the owner's three pre-existing modified
|
||
files).** 3 975 files, before and after:
|
||
|
||
| measure | before | after |
|
||
|---|---|---|
|
||
| files that format | 3 965 | 3 965 (same 10 failures, same messages) |
|
||
| files whose output changed | — | **2** |
|
||
| instantiation sites | 17 899 | **17 901** |
|
||
| opaque instantiations holding a directive | 3 | **1** |
|
||
|
||
The two files are `hw/top_earlgrey/rtl/autogen/chip_earlgrey_{asic,cw340}.sv`,
|
||
which are exactly the two whose `padring` instantiation stopped being opaque
|
||
bytes — so their connection lists are laid out canonically now, and each
|
||
gained its instantiation edge. The third opaque one,
|
||
`hw/top_earlgrey/dv/tb/tb.sv`, is the *directive-split* shape (two
|
||
instantiation **heads** behind one `` `ifdef ``, sharing a connection list),
|
||
which no expression-level capture can reach; it stays filed. Lint output
|
||
(`lucisv check`) is byte-identical between the two binaries over
|
||
`hw/ip/*/dv/sva`, `hw/ip/prim/rtl`, `hw/top_earlgrey/rtl/autogen` and
|
||
`hw/top_earlgrey/dv/tb`.
|
||
|
||
The "53 directive-in-connection files" TODO §26 cites could not be
|
||
reproduced: a census of the tree finds **3** files whose instantiation is
|
||
opaque because of a directive, and **zero** matching the literal `.name(` ⏎
|
||
`` `ifdef `` shape. The real shape is a directive between the elements of a
|
||
concatenation *inside* a connection value, and it lives in two autogenerated
|
||
top-level files. Reported as measured rather than as briefed.
|
||
|
||
## QA log
|
||
|
||
### 2026-09-02 — QA
|
||
|
||
**Verdict: PASS.**
|
||
|
||
**Gates (self-run).** `cargo fmt -p lucisv_server -p vlog_formatter -p
|
||
vlog_parser -p vlog_semantic -- --check` clean. `cargo clippy --all-targets
|
||
--workspace` 0 warnings; the two `#[allow]`s in the touched files
|
||
(`bind.rs:1572` too_many_arguments, `main.rs:619` deprecated) are both
|
||
pre-existing, outside this diff, and both carry an explaining comment.
|
||
`cargo test --workspace --no-fail-fast`: 3 186 passed, 0 failed, 47 binaries
|
||
(41 `Running` + 6 `Doc-tests`) — matches the dev report exactly (the 3 185/48
|
||
figure in this README's own work log is a stale snapshot from mid-round, not
|
||
a discrepancy in the delivered state). `cargo test -p vlog_formatter`: 199
|
||
verification tests + the full case table, all green. `git diff --stat --
|
||
crates/vlog_formatter/src/verify.rs` is empty — confirmed untouched.
|
||
|
||
**Output neutrality (independent binary diff, not the corpus-gate script).**
|
||
Built v0.31.0 (tag, = the trunk commit this round is based on) in a worktree
|
||
and the working tree, both `--release`, and diffed `--stdout` byte-for-byte:
|
||
- corpus/ (860 files): 854 identical, 0 differing, 6 both-fail (the same six
|
||
`scripts/corpus_gate.sh` reports: 814/820, unchanged from baseline).
|
||
- opentitan hw/ip + hw/dv + hw/top_earlgrey (2 645 files): 2 638 identical, 2
|
||
differing (exactly the two the dev names), 5 both-fail — all five
|
||
pre-existing unrelated parse errors (`jtag_if.sv`, `edn_env_cfg.sv`,
|
||
`keccak_2share_fpv.sv`, `kmac_reduced_tb.sv`, `spi_device_scoreboard.sv`),
|
||
none touching bind/M4/M5 machinery.
|
||
- `git -C opentitan status --porcelain` after every sweep: only the owner's
|
||
three pre-existing files (`hw/ip/aes/dv/tb/tb.sv`,
|
||
`hw/top_darjeeling/ip/ast/rtl/ast.sv`, `hw/top_earlgrey/ip/ast/rtl/ast.sv`),
|
||
never touched.
|
||
- Read both diffs in full. Confined entirely to the `padring` instantiation
|
||
in each file (source lines 305–~800 in `chip_earlgrey_asic.sv`; nothing
|
||
outside it). One nuance the dev's report didn't spell out: the
|
||
`` `ifdef ``/`` `else ``/`` `endif `` lines' *indentation* changes between
|
||
the two binaries (2-space → 0-space). Checked against the true opentitan
|
||
source: the directive lines are written at column 0 in the actual file —
|
||
the new build's `raw_inline` (a literal `src` slice) reproduces that
|
||
exactly; the old build's whole-item capture went through `raw_text`'s
|
||
dedent-by-`col`-then-reindent, which pushed them to the surrounding list's
|
||
depth. So the new output is the one that's byte-exact to source; the old
|
||
one wasn't. Not a defect — and it's exactly what
|
||
`directive_in_statements.cases`' updated `chip_earlgrey_asic.sv:621` case
|
||
pins (confirmed: that case's expected output has the same 0-indent). Both
|
||
outputs individually idempotent (`--stdout` twice, byte-identical) and
|
||
`lucisv check` byte-identical between the two binaries.
|
||
- Worktree removed after (`git worktree remove --force
|
||
.claude/worktrees/qa-base`).
|
||
|
||
**M4 — attack attempts.** Built and ran: expression assign, `localparam`
|
||
initializer, parameter override, ordered connection, nested `` `A (`B (x)) ``,
|
||
comment-in-the-gap, macro at item position (unaffected, still bare), and
|
||
`` `W(a) `` glued (stays one token, never a `Call`). All format, all
|
||
idempotent (formatted twice, byte-identical), no space dropped or added
|
||
relative to source in any case. Also directly exercised the two standing
|
||
verify.rs pins plus the new
|
||
`tightening_a_spaced_macro_call_in_an_expression_is_rejected` (5 assertions,
|
||
all pass) — a deliberate tighten/loosen in expression position is refused
|
||
with `verification failed`, never silently corrupted.
|
||
|
||
**M5 — attack attempts.** Built: bare signal, concatenation with directive
|
||
between elements, nested paren, region ending on `` `endif `` right before
|
||
`)`, the same in `#(.P(...))`, a directive spanning a whole ORDERED
|
||
connection list (pre-existing `ListDirective` shape, unaffected), a directive
|
||
inside one ORDERED connection's own `{...}` value, and a directive inside an
|
||
ANSI port-list element's own width expression. Findings:
|
||
- Named-connection shapes (bare value, concat, nested paren, param override,
|
||
ends-on-`` `endif ``): format, idempotent, `)`-on-directive's-own-line
|
||
correctly forced to its own line.
|
||
- Ordered connection whose value is `{...}` holding a directive: formats via
|
||
the **pre-existing whole-item opaque capture** (not the new
|
||
`ExprKind::Verbatim` — confirmed by diffing against the v0.31.0 baseline,
|
||
byte-identical), consistent with "the named connection's `.name(...)` value"
|
||
being the only hook point this round added. Filed, not delivered, exactly
|
||
as claimed — it stays opaque as before, not corrupted, not worse.
|
||
- ANSI port-list element's own width holding a directive: clean parse error
|
||
(`expected expression`), exit 2, input untouched. Matches "still hard
|
||
errors."
|
||
- `crates/vlog_semantic/tests/binds.rs`'s
|
||
`a_directive_inside_a_connections_value_leaves_the_instantiation_countable`
|
||
is the semantic pin for the edge/lens claim (`instantiations::sites` len 1,
|
||
the non-verbatim connection resolves, the verbatim one resolves to
|
||
nothing) — read and re-run in isolation, passes.
|
||
|
||
**M6 — attack attempts.** Built: `bind top u_chk chk (.clk(clk))`,
|
||
`bind top.gen[0].u_core ...`, `bind \my-top ... (escaped head)`,
|
||
`bind top chk #(.W(8)) u_chk (...)`, and the pinned comment-inside-target-path
|
||
refusal (`bind top . /*c*/ u_dut chk c (.*);`) — reproduced independently:
|
||
`verification failed: token stream diverges at index 6: input has comment
|
||
"/*c*/" ... output has identifier "u_dut" ...`, exit 2, clean refusal, never
|
||
a corruption. All non-refused cases idempotent. Read `bind.rs`/`resolve.rs`
|
||
in full: `bind_bind` only sets `bind_target` (feeding `Target::BindScope`)
|
||
for a *lone, unindexed* head segment, so `target_path()`'s documented
|
||
dropping of `[…]` from its joined spelling (pinned by
|
||
`an_indexed_bind_target_parses_as_path_segments`:
|
||
`target_path() == "top.gen.u_core"`) never reaches production resolution —
|
||
`target_path()` is test-only in this diff (`grep -rn target_path crates/`
|
||
confirms zero non-test call sites). `resolve::in_bind_target` matches the
|
||
README exactly: target's own scope first (`lookup_local`, no lexical
|
||
fallback), workspace `ExternalCandidate` when the target isn't declared
|
||
here, writing-scope fallback only on an in-file miss — one code path,
|
||
already covered by `the_target_scope_wins_over_the_writing_scope` and
|
||
`an_expression_half_reaches_a_target_declared_in_another_file` in
|
||
`binds.rs`. Nit: the file has **12** `#[test]` functions, not the "11" the
|
||
dev report and this README's work log state (miscount, not a missing test —
|
||
harmless).
|
||
|
||
**§2.9-19 — `lucisv.instantiate`.** Read `instantiate.rs` end to end and
|
||
re-ran its 6 unit tests plus
|
||
`the_instantiate_command_pushes_a_skeleton_over_the_wire` in isolation — all
|
||
pass. `main.rs::commands()` advertises it (`every_advertised_command_is_one_the_server_runs`
|
||
chains `instantiate::commands()`); `ports.rs::execute` has the one delegating
|
||
arm exactly where described. `editors/nvim/README.md`'s keymap argument order
|
||
(`vim.uri_from_bufnr(0), position, module`) matches `execute`'s own
|
||
`arguments[0]/[1]/[2]` reads. `completion::layout_at` is `pub(crate)` with an
|
||
amended doc comment, no other behavior moved (confirmed by diff). Did not
|
||
independently fabricate a new e2e case beyond re-running the shipped one —
|
||
its coverage (advertised in `initialize`, arguments survive, push not
|
||
result, insertion not replacement, no tabstops, bad-position refusal) already
|
||
matches every wire-level item this task asked for.
|
||
|
||
**FACTS_FORMAT 14 → 15.** Constant and doc comment at `facts.rs`. The
|
||
existing `a_store_from_any_previous_facts_format_is_dropped_not_misread` test
|
||
loops `for format in 1..FACTS_FORMAT`, so the bump automatically extends
|
||
coverage to reject a format-14 (v0.31.0) store rather than needing a new
|
||
test — confirmed by reading the loop and its passing result.
|
||
|
||
**Inverted pins.** Read the `git diff` for all three: the two parser tests
|
||
(`a_bind_directive_parses_its_target_and_instances` — now compares
|
||
`b.target_path()` instead of the old glued `String` field, same assertion in
|
||
substance; the new `an_indexed_bind_target_parses_as_path_segments` and
|
||
`an_escaped_bind_path_segment_keeps_its_terminator` are additions, not
|
||
inversions of existing tests, so "two parser tests inverted" in the dev
|
||
report is read as the target-path field-type migration touching two existing
|
||
assertions) and the one `.cases` case
|
||
(`directive_in_statements.cases`, `chip_earlgrey_asic.sv:621`): old expected
|
||
output was the whole instantiation as one opaque block ending at `;`; new
|
||
expected output is the same source with the `padring` connections and
|
||
`u_padring` instantiation laid out structurally, comment updated to say so.
|
||
Both describe the delivered behavior, not just a passing assertion — spot
|
||
checked against the actual current output, matches.
|
||
|
||
**Docs.** `docs/features/bind-semantics/README.md` has every required
|
||
section (Goal/Assumptions/Handshakes/Status-TODO/Work log/QA log/Review).
|
||
Status/TODO matches what's landed. `TODO.md` §26's first four boxes ticked
|
||
correctly; the fifth (opentitan QA) was still open — ticked in this pass
|
||
with the corrected census (see below) since that's exactly what it asked
|
||
for. `docs/coverage_gaps.md` M4/M5/M6 read against my own counts:
|
||
- M4 "33 files, all item position": independent census
|
||
(`` `[A-Za-z_][A-Za-z0-9_]*[ \t]+\( `` over the whole opentitan tree) also
|
||
finds **33**; the one expression-position hit
|
||
(`` |-> `MAIN_RST_CYCLES ( `` inside a concurrent assertion) is present
|
||
identically in all three top variants (earlgrey/darjeeling/englishbreakfast
|
||
each vendor their own copy of `pwrmgr_rstreqs_sva_if.sv`), matching "one
|
||
hit in the tree" read as one source location duplicated three ways.
|
||
- M5 "3 files, 0 literal-shape hits": independent literal-shape regex
|
||
(`` \.\w+\(\s*\n\s*`(ifdef|ifndef) ``) over the whole tree: **0**, matches
|
||
exactly. A broader census (any conditional directive inside a named
|
||
connection's own paren-balanced value) also finds **3** files, but the
|
||
third by that method is `hw/dv/sv/jtag_agent/jtag_dtm_reg_block.sv` —
|
||
inspected directly: that's a directive between named *arguments of a UVM
|
||
`.configure()` method call*, not a module instantiation connection at all,
|
||
and it formats byte-identically old vs. new (confirmed), so it is not part
|
||
of this round's population. The dev's own third file
|
||
(`hw/top_earlgrey/dv/tb/tb.sv`, the directive-split shape) is a different
|
||
pathology my regex cannot see (the directive separates two instantiation
|
||
*heads*, not one connection's value) and was independently confirmed
|
||
byte-identical between builds. Net: both counts corroborated once the
|
||
false positive is understood.
|
||
|
||
**Overall:** no wrong answer found anywhere M4/M5/M6/§2.9-19 was exercised;
|
||
every refusal is clean (exit 2 / request error, input untouched); the two
|
||
opentitan output changes are exactly the two named files, confined to the
|
||
one instantiation each names, and the internal difference (directive-line
|
||
indentation) is a source-fidelity *improvement*, verified against the actual
|
||
opentitan bytes, not a regression. One LOW nit (11 vs. 12 tests in
|
||
`binds.rs`) left as reported rather than "fixed," since it's a report number,
|
||
not a bug.
|
||
|
||
## Review
|
||
|
||
**2026-09-02 — lead.** Accepted. The three residues were each solved
|
||
where they belong: M4 in the formatter, reading the author's gap from
|
||
`src` because the gap is token text a macro's formals decide, so
|
||
`verify.rs` stays exactly as strict; M5 as a verbatim *expression* rather
|
||
than a verbatim item, which is what keeps the instantiation's edge, lens
|
||
and port references alive (opentitan's two `padring` sites are the
|
||
proof, and QA confirmed the new output is the one byte-exact to the
|
||
source); M6 with the one rule that matters — a lone target is a module
|
||
reference, an instance path is nothing, never a guess. The connection
|
||
resolver's order (target scope, then the workspace's one-segment member
|
||
path, then the writing scope) is the inline-constraint precedent and
|
||
carries the same accepted edge: a name declared only inside one of the
|
||
target's generate blocks misses the target's own scope and can land on a
|
||
same-named signal in the writing scope. Documented here, not filed —
|
||
generate-block scopes are a `vlog_semantic` model question, not a bind
|
||
one. `lucisv.instantiate` rendering through `layout_at` rather than the
|
||
ghost's relative layout is right for an `applyEdit`, and the plan-level
|
||
pin is the honest form of "the same text". Handshakes: the
|
||
`completion::layout_at` visibility change accepted; `FACTS_FORMAT` 15
|
||
recorded in `docs/topo.md`; §2.9-15 and §2.9-19 struck; the evidence
|
||
corrections carried into `coverage_gaps.md`. QA's two LOW findings (a
|
||
test count and a stale gate snapshot in the work log) fixed at review.
|
||
Ships in 0.32.0.
|
||
|
||
<!-- Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love, luciochen.com -->
|