- L-1: an unowned block's closing label is a use of a same-named block only for block constructs and only when it spells the construct's own opening label (use_block_end_label); a mismatched `end : a` or an `endfunction : g` beside block `g` records nothing. - L-2: duplicate-declaration stays silent for two block labels only when both may be arms of one generate if/case; sibling `for` blocks and a procedural block beside a generate one are reported in either order. OpenTitan check: 1 158 findings, identical to 0.60.0. - L-3: a block comment between `.` and the name is still dotted. - L-4: a bind file that does not lex counts as binding (K2); a pasted fragment that does not lex is said, not skipped. - L-12: no unchecked slice in rename/arms.rs. - L-13: expand/ansi/inline/extract messages name files by Scope::name_of. 7 tests (L-3/L-4's fail with the fixes disabled). Per-crate suites under the guard: 80 suites, 5 085 passed, 0 failed, 51 ignored (one combined run was cut at 1 800 s in vlog_refactor/tests/corpus.rs with syspolicyd at 95 % — the §65.3 stall). Co-Authored-By: Claude Opus 5.5 <[email protected]>
generate-label-rename
TODO §65.1 (stabilization round 1), topo §2.9 row 43 (MCP-14).
Goal
rename of a generate block label (for (…) begin : g_lane … end) used to
rewrite the label and nothing else: a hierarchical path through it
(g_lane[0].lane_q beside the loop, u_x.g_lane[1].sig in another file)
kept the old name and no longer resolved, with no warning, and
find_references on the label listed no use. The MCP layer refused such a
rename; the LSP still performed it. The goal is that a path segment naming a
block — bare, indexed, nested, behind an instance path from another file — is
a reference to the label, so find_references lists it, rename rewrites
it with the label and its closing label (all or nothing), and the rename
verifier sees it move. Named procedural blocks (begin : lbl / end : lbl /
disable lbl;) are the same reference set.
Root cause
Three gaps in vlog_semantic, none in the rename engine itself:
- A
forgenerate block's label was declared in the loop header's scope (bind/item.rs::bind_gen_forhanded the header tobind_gen_block), which exists sogenvar idoes not leak — and so the label did not reach the module either.g_lane[0]at module level resolved toNotFound.generate … endgeneratelikewise opened a scope of its own, hiding every label (and net) written inside it from the rest of the module. - A path could not continue through a block:
resolve::member_scopegave a block no member scope (link_typeansweredNonefor "a block label"), andbind/expr.rs::spinestopped at an index, sog[0].xrecorded no tail. - The index held no block:
hierarchy::surface_ofput noBlockon a module's surfaces, sou_x.g_lanefrom another file resolved to nothing.
The closing label was already a use of the block (use_end_label), and
disable lbl already resolved lexically. With the three gaps closed every
segment is an ordinary resolved reference, Scope::collect_occurrences finds
it through references_of / the overlay unchanged, and the verifier's
resolution print watches it unchanged.
What changed
vlog_semantic/src/bind/generate.rs(new;bind_gen_if/for/blockmoved out ofitem.rs, which was at 620): a labelled block's name is declared in the scope the construct is written in and its body opened inside theforheader (bind_gen_body(b, declared_in, parent)).bind/item.rs:GenerateRegionbinds its items in the enclosing scope.bind/mod.rs::use_end_label: a closing label whose opening label was a redeclaration (the second arm of a generateif/casecarrying the same label, and thelbl: begin … end : lblprefix form, whose block is unowned) records a use of the first same-scope block of that name.bind/expr.rs::spine: anIndexlink is transparent (g[0].xwalks asg.x).resolve.rs::member_scope: aBlockopens its child scope as a member scope.workspace/hierarchy.rs::surface_of:Blockon a module's and an interface's hierarchical surface; a block exports its nets, variables, instances, parameters and nested blocks, hierarchical only.workspace/record.rs::block_key: a block's members are recorded under the synthesized keymodule.label(sub.g_a.g_bfor nesting), carried as the block'stype_namesofold_path's hop finds them.FACTS_FORMAT20 → 21.lib.rs::Semantics::member_key(scope): that key, computed from one file's analysis — whatlucisv_server/src/nav.rs(leaves_this_file,indexed_def_in_file) now asks the index with instead of the owner's bare name.lucisv_mcp/src/tools/edit.rs: theblock-kind rename refusal is removed.
That was the first pass. The reworks and the review fixes then changed the engine's warnings and messages, never what a rename rewrites:
vlog_refactor/src/rename/paths.rs(rework 1, F1): a hierarchical path segment spelling the name that resolved to nothing, in any file of the set, is warned about with its lines.rename/arms.rs(rework 1, F2): the same-named member of another arm of the renamed member's generate label is warned about.bind/mod.rs,vlog_linterduplicate-declaration(rework 1, F3): a label beside a net is a duplicate, not a use;lib.rs::member_keyqualifies a subroutine's block (F4).scope.rs::name_of/name_at(rework 2, R1): a file whose base name another file of the set shares is named by its path in every refactoring's messages, the verifier's included; counted once per set (BaseNames, review M-2).rename/home.rs,rename/scoped.rs(reworks 3–5): rename warnings scoped to the declaration's home set;lucisv_mcp/src/tools/mentions.rs(Focus::local) scopes mentions the same way.rename/carry.rs(review H-1/H-2): a macro argument the macro carries to the declaration is warned about wherever it is written.scoped.rs::fragment_use_warnings(review M-1): a use the rename edits is not reported as left unchanged.
The verifier (check/) gained no normalization: its only change is how it
names files in its messages (R1).
Assumptions
- An index is transparent in every spine, not only after a block. A link
the walk can continue from is one whose recorded type is the element's: a
generate block (an element of a generate array is an instance of the same
block), or a packed array of a struct (
pkt_t [1:0] a; a[0].f). An unpacked declarator and an instance array record no type (declare_typed,bind_instantiation), soq[i].mandu[0].sigstill stop at the head. If a future change records a type on an unpacked declarator, this assumption must be revisited. generate … endgenerateis not a scope (IEEE 1800 §27.3). A net declared inside a region and a same-named one outside it are now a redeclaration (the second a reference to the first), which is also what a compiler says.- Two arms of one generate
if/casewith the same label are one label. The second arm's opening label was already a use of the first (declare's redeclaration rule); its closing label now is too. A member written in only the second arm is not resolved throughg.x(it is looked up in the first arm's scope and misses, recording nothing). - An unnamed block (
genblk1) declares nothing:genblk1.wstaysNotFoundat the head and the rename refuses there ("not resolved"). - The member-table key of a block is
container.label, unwritable as a type name (a.), unique per module. The bare label would collide across every module writinggen_generic; nested struct members use the same spelling rule (nested_key). - A block inside a function or task is on no cross-file surface (the
index never filed one:
collect_membersrecurses only through blocks, classes, typedefs and covergroups), andSemantics::member_keyqualifies its key by the enclosing unit and marks the subroutine:m.ff().fb. The()is unwritable in an index key, so it can never be moduleff's blockfb(ff.fb) — QA F4, rework 2026-09-30. - An unresolved path is warned about only in the files the rename was
given (lead ruling on F1). The MCP hands the engine the whole set, so it
sees every one; the LSP hands it the fan-out (
state::fan_out_of) plus every open buffer, so a closed file whose only tie to the name is a path nothing resolves (tb.dut.…) is not in the set and not named. Resolving such roots is TODO §65.4. - A repeated block label is a use of the first declaration only when that
one is a block too (F3). A label colliding with a net, variable,
parameter or instance of its scope is a
duplicate-declaration(the lint'scollides), and neither is a use of the other. - The governing principle of every scoping rule below (rework 5): scoping
may drop a warning only when the engine can show the spelling cannot reach
the renamed declaration; any doubt falls back to the unscoped behaviour —
every spelling warned, as before rework 3. Concretely: K1 — a
declaration with no enclosing module or interface (a fragment's own
logic shared_q;, a$unitdeclaration) is warned unscoped; K3 — if any include-related file of the home set has an`includewhose name is not a plain"…"/<…>form (a macro builds it) or names no file of the set, the home set is unknown and the rename is warned unscoped (andlucisv-mcplists every mention); K2 — a file holding abindinto the declaring unit (by name, or by any instance path) is home, so the macros it invokes are followed; N3 — the upward include chain is followed transitively (includers of includers, and everything they include), cycles terminating; N1 — in a file the rename edits, a bare spelling in a macro argument or unparsed assertion warns only when the scope lookup finds the renamed declaration (which only the declaring file's own analysis can), and the unconditional bare rule is kept for the included/including files alone; N2 — a macro with a formal parameter named like the declaration never warns about its body, and a backtick inside a string literal or a comment is no invocation. - The home set of a declaration (
vlog_refactor/src/rename/home.rs, public asvlog_refactor::home_set) = the declaring file; every file it`includes, transitively; every file that includes the declaring file (when the declaration sits in an included fragment), the files that include those, and so on (rework 5, N3), and everything any of them includes, transitively; the files the rename edits; and, for the macro-invocation rule only, every file holding abindinto the declaring unit (K2). Includes are read off the files' text (`include "…"/<…>; a commented-out include counts, which only grows the set) and resolved against the set by path suffix; an include no path ends in is matched by base name, and when several files match, all are home. - Rename warnings are scoped to the renamed declaration (lead's
inspection, rework 3; corrected after QA's H1–H4, rework 4;
vlog_refactor/src/rename/scoped.rs). When the renamed declaration is a member of a module or interface — the first owned scope outward from where it is declared belongs to a module or interface (a block, function or task in between does not end the walk; a package or class does, and then nothing below applies):- a macro-argument or unstructured-assertion spelling with no
.before it (past blanks) is warned about: in the declaring file when the name, looked up at that offset by the innermost-scope-outward walk (sites::nearest, local scopes only, no imports), is the renamed declaration; in any other home-set file always (pasted text has no scope to look in — H1); inside abindstatement whose target is the declaring unit by name, or is an instance path (which lucisv cannot follow to a unit), in any file (H3); nowhere else. A spelling after a.is warned about wherever it is; - a
`definebody spelling the name is warned about when the define is written in a home-set file, when the macro is invoked from a home-set file — directly or through other define bodies, transitively (H2) — or when the body spells the name after a.. A macro named like the declaration is still warned about everywhere; - a bare use of the name in the plain code of a home-set file the declaring file includes or that includes it (not the declaring file, not a file that is home only because it is edited) — no declaration of that fragment and no reference resolved inside it — is a use the engine cannot rename; it is warned about per file with its lines (H4). Renaming inside fragments is TODO §65.6. Every other declaration (a module, interface, package, class, a package's or class's member) is warned about exactly as before.
- a macro-argument or unstructured-assertion spelling with no
- Mentions (
lucisv-mcpunresolved:) follow the same idea (lucisv_mcp/src/tools/mentions.rs,Focus::local). For a member of a module (rename: the declaration has an enclosing module and is no module/interface/program itself;port: always;find … refs:true: every declaration found is such a member and none is a macro), a comment, string, macro-text or`define-body mention is listed only when it is in the member's home set (forfind: the union of each declaration's home set with the files an engine hit is in), or when the byte right before it is a.(".state_q",`HIER.u.state_q). Otherwise every mention is listed as before. - Procedural named blocks inside an unowned scope (a named
begininside an unnamed one) get no index record —member_keyanswersNonefor them, as the index holds none. Same-file references are unaffected.
Handshakes
- Consumes (unchanged):
vlog_refactor'sScope::collect_occurrences/check::verifyoverSemantics::references_ofand the overlay; the server's §64.1 fan-out (nav::declaring_file_usesre-analyses a closed declaring file for a hierarchical-only declaration — a block is one). - Promises (changed, stated for every consumer of
vlog_semantic):- a
Blocksymbol has a member scope;Semantics::member_sitethrough a block answers its scope (completion afterblk.lists its members). - a
forgenerate block's label symbol'sscopeis the enclosing scope, and itschild_scope's parent is the loop header (not the label's scope). GenerateRegionopens no scope.- index-transparent spines: more member tails are references than before
(a packed struct array's
a[0].f, everyg[0].x). - the index:
Blockmembers on the hierarchical surface under the enclosing unit's key; block members underunit.label. New publicSemantics::member_key.FACTS_FORMAT21.
- a
- Changed for
lucisv_server(edited within this lane's scope):nav.rsasksmember_keyinstead ofowner.name.state::fan_out_ofis unchanged:hierarchical_declarationsnow also yields blocks (container = the module) and block members (container =unit.label, which names no unit or instantiation — those rungs add nothing, andreferences_tocovers the files a rename edits). - Changed for
lucisv-mcp: renaming ablockdeclaration is no longer refused. The MCP feature README (mcp-lean-catalogue) has a dated note. - Changed for
vlog_linter(rework, lead ruling F3):duplicate-declarationalso fires for a block label beside a net, variable, parameter or instance of one scope. Handshake request →Granted by the lead and done in rework 2: the table is built once per set.lucisv_mcp(tools/source.rs):WholeSet::rootedwalks the set's file names quadratically on every call.- Changed for every refactoring's messages (rework 2, R1): a file whose base name another file of the set shares is named by the path the caller gave; front ends make it relative (the MCP root-relative).
Status / TODO
- root cause named (above)
- path segments (bare, indexed, nested, cross-file) resolve to the label
find_references: declaration, closing label, every segment, both filesrename: all of them, all-or-nothing; macro/string spellings warn;genblk1not renameable- named procedural blocks: label, closing label,
disable(incl. thelbl: begin … end : lblprefix form andfork : f … join : f) - verifier: no normalization added; attack tests
(
vlog_refactor/src/check/qa_block_paths.rs, 8) - LSP
references/prepareRename/rename(lucisv_server/src/server/tests/rename_generate_label.rs, 5) - MCP refusal lifted;
qa_m7asserts the rename - tests pinning the old behaviour flipped (listed in the work log)
- opentitan check on the eval clone
- docs: this README, refactor-rename work log, topo row 43, CHANGELOG
- rework F1: unresolved path segments warned in every file of the set
- rework F2: a same-named member in a sibling arm warned
- rework F3: a label beside a net is a duplicate, not a use
- rework F4: function/task-local block keys never collide
- TODO §65.4 filed (root lookup for
tb.…paths) - rework 2 (R1–R4): path-qualified file names;
WholeSet::rootedbuilt once per set - rework 3: rename warnings and mentions scoped to the declaration
- rework 4 (H1–H4): the home set; fragments' plain uses said
- rework 5 (K1–K3, N1–N3): unscoped on any doubt
- QA closing-check P1 (a shadowing parameter no longer hides a dotted body spelling) and P2 (a default argument spelling the name is said)
- TODO §65.6 filed (rename inside included fragments)
- independent review (
oct_review.md): H-1, H-2, M-1, M-2 fixed; M-3 (these docs)
Work log
2026-09-30 — dev agent. Reproduced with a probe: end : g_lane and
disable blk already resolved; g_lane beside the loop was NotFound (the
header scope), g_one.w recorded no tail (block not a member scope), and
g_lane[0].lane_q recorded no tail (index stops the spine). The brief's note
that lane_q "is found through that path" held only for the MCP's textual
edit_item scan; the semantic layer recorded nothing for it, so renaming
lane_q also left g_lane[0].lane_q behind — fixed by the same change.
Decisions:
- Fixed resolution in
vlog_semanticrather than teaching the rename a special case: every consumer (hover, definition, references, completion, rename, verifier) now agrees on one answer, and the verifier needs nothing new — a missed segment is a reference that stops resolving, which the existing print already refuses. This is why invariant 4's attack tests pin the existing check rather than a new forgiveness. - The index-transparent spine was chosen over marking indexed links: the
links that can continue are exactly those whose element type equals the
recorded type (argued under Assumptions), so no marker is needed and the
MemberSite::Unitpath spelling is unchanged. - Moved the generate binders to
bind/generate.rs(item.rs was at 620). - Also fixed on the way, because a rename would otherwise corrupt: a
closing label of a same-label second arm (and of the
lbl: beginprefix form) was not recorded, so a rename rewrote the opening labels and leftend : old.
Tests flipped from pinning the old behaviour (each intentionally):
vlog_semantic/tests/member_access.rs
(a_head_this_crate_cannot_type_records_no_tail_at_all: blk.inner now
resolves), vlog_refactor/tests/rename.rs
(…generate_block_scoped_net_named_through_an_instance_is_renamed_with_its_path),
vlog_refactor/tests/rename_bind.rs
(a_bind_target_reached_through_a_generate_block_is_followed_and_a_broken_one_warned_about
— still warns for a path naming a block the target lacks),
lucisv_server/src/nav.rs (three tests: a block-scoped net now leaves its
file), lucisv_mcp/tests/qa_m7.rs
(qa_rework_renaming_a_generate_label_never_leaves_a_path_through_it_behind).
OpenTitan (eval clone ~/.cache/lucisv-eval/ot/hw, lucisv-mcp release
binary, whole hw root): gen_rf_base_ff (otbn_rf_base.sv:182) renamed
"2 sites in 2 files" — the label and the cross-file path
u_otbn_core.u_otbn_rf_base.gen_rf_base_ff… in
dv/verilator/otbn_top_sim.sv:527; its four spellings inside `ASSERT
arguments in otbn.sv are warnings. g_rf_flops in otbn_rf_base_ff.sv:51
(ibex's same-named block in ibex_register_file_ff.sv untouched; find
lists both) renamed 1 site, otbn.sv's macro spellings warned. gen_mai
(otbn_core.sv:1166) renamed 1 site; otbn.sv's macro spellings warned and
otbn_trace_if.sv's 28 upward-reference lines (an interface bound into
otbn_core, naming gen_mai it does not declare) warned as unresolved,
not edited. The four edited files lex and parse (lucisv format --check
exit 1, not 2) and lint identically modulo the names; clone restored with
git checkout -- ., status clean.
Gates (2026-09-30): fmt clean; clippy -D warnings clean; workspace
lib/bins/tests 74 suites (72 + 2 new), 4 974 passed (was 4 936); doc-tests
6 suites, 1 passed; corpus gate 814/820.
New tests: vlog_semantic/tests/generate_blocks.rs (10),
vlog_refactor/tests/rename_generate_label.rs (15),
vlog_refactor/src/check/qa_block_paths.rs (8),
lucisv_server/src/server/tests/rename_generate_label.rs (5).
2026-09-30 — dev agent, rework after QA (lead rulings on F1–F4).
- F1 (a rename is never silently partial): new
rename/paths.rs,Scope::unresolved_path_warnings— every file of the given set whose word census (WorkspaceIndex::files_mentioning) holds the old name and whose text has it beside a./[is lexed and analysed; anametoken that is a path segment (a.before it, or one after it past element selects), is no declaration, and has no reference (or aNotFoundone) is listed, one warning per file: "probe.sv:2,3,4: a hierarchical path throughstate_qwas not resolved to any declaration, so it was left unchanged; check whether it reaches the renamed one." A segment resolved to a different declaration is silent (u_y.state_q). In an edited file a segment with no reference at all stays with the existing stray scan (its "a hierarchical or member tail" sentence), so nothing is said twice. Runs for every declaration kind. NewWarnTrace::pathsstage. LSP: the warnings reach the client throughreport_scopelike every rename warning (test with an openprobe.sv); MCP:warning:lines. QA's F1 test un-ignored and asserting the warning, the moved declaration and both untouched files; a net case added. Opentitan,rename entropy_src_main_sm.state_q(engine alone, release, 3 976 files): 2.25 s, the new stage 12.5 ms, 10 new warnings, all real upward/DV paths (chip_if.sv,pwrmgr_if.sv,prim_*_assert_fpv.sv, …). Over MCP: 125.5 / 125.4 s before (0.59.0: 126.4 s) — almost all of itWholeSet::rooted, quadratic per warning, which the 10 new warnings would have made 134 s;edit.rsnow roots all warnings in one call: 3.3 s, output otherwise byte-identical (handshake above for the other callers).### 65.4in TODO.md holds the real fix (resolving atb.…root). - F2:
Scope::sibling_arm_warnings— when the renamed declaration's scope is a generate arm whose label another arm of the same parent shares (the arm's owner, or for a repeat label the label use the binder records in the enclosing scope inside the arm), and that arm declares the same name, a warning names it (b.sv:5, "a pathg.xnow names only the renamed arm's declaration"). No refusal, no extra edit. QA's test un-ignored with the warning asserted. - F3:
Binder::declarerecords a redeclaration as a use of the first declaration only when both or neither are blocks;duplicate-declarationgainedcollides(block beside net/var/param/localparam/instance). Tests:generate_blocks.rs(both orders), the lint's two new unit tests,undriven_net's "a label spelled like a net is not a read of it". The two new region duplicates QA listed stay. Opentitan lint differential against the 0.59.0lucisv: default rules 1 158 = 1 158, all 74 rules (--no-gitignore) 24 619 = 24 619, JSON byte-identical — 0 added, 0 removed, any rule. - F4:
member_keyqualifies a function/task-local block (m.ff().fb); QA's test un-ignored and asserting that key.
2026-09-30 — dev agent, rework 2 after QA's re-check (lead rulings R1–R4, item 5).
- R1:
Scope::name_of/name_at(andscope::name_among, shared with the port offers so an offer and its refactoring agree) name a file by its base name when it is unique in the set and by the path the caller gave otherwise. Every rename warning (the define/macro/SVA/unfinished/stray scans, the implicit-connection sentences, the path and arm warnings) and the verifier's refusals (check::verify,verify_move, the ledger, the implicit checks — which now take the shown name instead of a path), and the multi-file port/extract/inline sentences, use it. Single-file refusals about the requested file itself ("does not lex/parse", "not one of the files") keepdisplay. MCP:WholeSet::rootedbuilds its spelling table once per set (names_of: full path for a shared base name, base name otherwise) and rewrites both — my handshake, granted; the one-call join inedit.rsis gone again,port.rs/find.rspay one pass over the table per sentence. Tests:rename_generate_label.rs(a/x_if.sv+b/x_if.sv→ two path-named lines, a unique one bare),qa_m7.rs(two findabledv/{a,b}/x_if.svlines). Flipped:qa_m7qa_rework_a_shared_base_name_is_named_by_path_or_left_aloneandwire.rsengine_sentences_name_files_root_relative(a sharedp1.sv/cell.svis now namedrtl/y/p1.sv/rtl/cell.sv, where it used to stay bare). Opentitanstate_q: 11 path warnings, 11 distinct root-relative files (the old 10 were 11 minus onewarnings.dedup()of two identical barepwrmgr_if.svlines); all 116 files the answer names exist underhw/. - R3: the arm scan moved to
rename/arms.rsand walks every enclosing label: the chain of arm labels from the renamed declaration up (label_chain), then every arm the dotted chain reaches from its root (reachable_arms), each label's arms being its owned scope plus the arms its redeclarations opened (Semantics::duplicates, matched by span — no more reference-span heuristics). Warnsin another arm labelledg.h``. QA's R3 test un-ignored. - R2: an escaped old name skips the census (which holds no escaped identifier) and is narrowed by text alone. QA's R2 test un-ignored.
- R4:
duplicate-declaration'scollides(semantics, kind, first): a block label beside any non-block declaration (ports ANSI and non-ANSI, genvar, typedef, function, task, …), and two block labels unless the first opens a generate scope (two proceduralbegin : blk, two statement labels). Tests: seven shapes flagged, if- and case-arms clean. Opentitan differential against 0.59.0: default 1 158 = 1 158, all 74 rules 24 619 = 24 619, JSON byte-identical — nothing added or removed. - Item 5:
mentions::Focus::named— the(file, line)pairs the rename's path warnings name (parsed back from the rooted warnings byedit.rs::path_warned) are not listed underunresolved:. Flipped:wire.rsrename_lists_the_old_names_unresolved_mentions(dv/probe_if.sv:6is now the path warning, not a mention). - MCP
rename entropy_src_main_sm.state_qon the eval clone (release, whole set): 3.52 / 3.53 s (rework 1: 3.3 s; before it 125.5 s); clone restored. - Gates: fmt clean; clippy
-D warningsclean; doc-tests 6 suites, 1 passed; corpus 814/820. Workspace lib/bins/tests: the first run was killed by the guard (cargo test --workspace --lib --bins --tests, 1 700 s wall) after 40 suites, sitting at the start oftests/rename_implicit.rs(that suite alone: 24 passed in 0.02 s) withsyspolicydat 66 % CPU and a Time Machine backup running — the lane 65.3 stall shape, on freshly linked test binaries; limit not raised. The identical re-run finished in 2 min 31 s: 76 suites, 5 028 passed, 0 failed, 51 ignored.
2026-09-30 — dev agent, rework 3 (lead's inspection: rename warnings and
mentions scoped to the renamed declaration). New rename/scoped.rs
(Scoping: the member test, keeps, keeps_define_body, spellings);
ArgumentSite carries dotted and the bare offsets, DefineSite a
body_dotted; the macro-argument, `define-body and SVA-fallback scans
filter through it (the path, unfinished and stray scans are unchanged).
MCP: Focus::local in mentions.rs, set by edit.rs (Told::member),
port.rs (always a member) and find.rs (member_files). The rules are
under Assumptions. Tests: vlog_refactor/tests/rename_warning_scope.rs
(3: two modules' ASSERTs — only the renamed one's bare argument and the
other's dotted one; a foreign define only when dotted; a package parameter
still warned in every module), qa_m7.rs
a_members_rename_lists_only_its_own_mentions_and_dotted_ones_elsewhere.
Tests that pinned the flood, changed to spell the mention after a . so
they keep testing what they test: qa_f1.rs
qa_mentions_find_every_kind_and_only_whole_words (the CRLF fixture) and
qa_mentions_are_capped_at_50_with_the_edited_file_first (the 60 far
comments), qa_m2.rs qa_uses_never_include_a_comment_a_string_or_macro_text
(third.sv, which now also holds a bare spelling that is not listed).
Opentitan, MCP rename entropy_src_main_sm.state_q (release, whole set,
clone restored after each): 274 lines / 61 276 bytes → 72 lines / 12 368
bytes, 3.22 / 3.19 s; the remaining macro warnings are dotted spellings
(otbn_core.sv ASSERTs through instance paths, the fpv VIPs, pwrmgr.sv,
rv_plic.sv). It still holds the three census-task-c fixes:
ip/entropy_src/rtl/entropy_src_main_sm.sv:44 (macro argument, warning and
mention), ip/entropy_src/dv/env/entropy_src_path_if.sv:25 (the ".state_q"
string) and top_earlgrey/dv/env/chip_if.sv (path warning 1175,1231,1241,1251
and mention 1167). hmac_core.StIdle: 48 lines / 5 937 bytes / 20 foreign
macro warnings (14.2 s, the rework-0 binary) → 3 lines / 286 bytes / none
(4.6 s). Flipped as well: lucisv_server/src/rename.rs
a_macro_file_the_rename_does_read_is_warned_about_exactly_once — its
far.svh argument now spells u_far.sig (a bare sig in far's own
macro is far's word and is rightly not warned about), which keeps the
engine-vs-census exactly-once check alive. Gates: fmt, clippy clean;
workspace 77 suites, 5 033 passed, 0 failed, 51 ignored (first attempt
stopped at that server test, not by the guard); doc-tests 6 suites, 1
passed; corpus 814/820.
2026-09-30 — dev agent, rework 4 (QA final H1–H4; the lead's corrected
ruling: "the declaring file" becomes the declaration's home set). New
rename/home.rs (home_set/home_of: the include closure both ways plus
the edited files, with the included / around split; invoked_from: the
macros a home-set file invokes, through define bodies transitively);
scoped.rs reworked around it (Scoping holds the unit, the home set and
the invoked macros; binds_into for H3; Scope::fragment_use_warnings for
H4). The bare-spelling rule is home-set-wide except in the declaring file,
which keeps the lookup; a define body is news when invoked from the home
set. MCP Focus::local is the home set (vlog_refactor::home_set), so
prim_util_memload.svh is listed again for prim_ram_1p.mem. QA's four
tests un-ignored; H4's now asserts the warning and an unedited fragment (its
rename is TODO §65.6). A bug met on the way: bind lexes as an identifier,
not a keyword. Eval clone (release, restored after each): entropy_src_main_sm.state_q
72 lines / 12 368 bytes / 3.19–3.20 s (unchanged from rework 3: its home
set is itself, prim_assert.sv and that file's includes, and none of those
spells state_q bare); prim_sum_tree.clk_i (root hw/ip/prim): 8 lines,
warns rtl/prim_assert.sv:17 (ASSERT_DEFAULT_CLK), rtl/prim_flop_macros.sv:12
(PRIM_FLOP_CLK) and :44, 0.15 s; prim_ram_1p.mem (file
ip/prim_generic/rtl/prim_ram_1p.sv): 48 lines / 5 855 bytes, 3.2 s —
prim_util_memload.svh:29,39,51,68 is the H4 warning and its comment lines
12,24,32,43 are mentions again; the other text warnings are dotted macro
bodies (…u_mem.mem paths) and unresolved .mem paths in DV. Gates:
fmt, clippy -D warnings clean; workspace 78 suites, 5 045 passed, 0
failed, 51 ignored (no guard kill); doc-tests 6 suites, 1 passed; corpus
814/820.
2026-09-30 — dev agent, rework 5 (QA K1–K3, N1–N3; the principle: a
warning is dropped only when the spelling provably cannot reach the
declaration). home.rs: a Graph of resolved includes built once per
rename (base-name map, then path suffix), with the upward closure transitive
(N3) and Home::unknown set by an unresolvable include in the
include-related set (K3); home_set returns None then, and lucisv-mcp
lists every mention. macro_names skips strings and comments (N2).
scoped.rs: Scoping::scoped = a member with a known home set, so K1 and K3
fall back to unscoped; the home set (and H4's fragment scan) is computed for
every rename, so K1's m2.sv plain use is said; files_binding_into adds
bind files (K2); the bare rule is unconditional only for included/including
files, and edited files get the lookup, which only the declaring file can
satisfy (N1); a macro parameter named like the declaration silences its body
(N2). QA's four rework-4 tests un-ignored unchanged; new
rename_warning_scope.rs test an_instantiating_modules_own_bare_spelling_is_not_news
(three instantiating modules asserting on their own clk_i: one warning,
the declaring module's own).
Eval clone (release, MCP, clone restored after each; lines exclude the blank tail, as QA counts):
| rename | rework 4 (QA) | rework 5 | time |
|---|---|---|---|
entropy_src_main_sm.state_q |
71 / 12 367 B | 71 / 12 367 B | 3.25 s |
hmac_core.StIdle |
2 / 285 | 2 / 285 | 2.87 s |
uart_core.rx_fifo_rvalid |
2 / 285 | 2 / 285 | 2.85 s |
prim_ram_1p.mem (prim_generic) |
47 / 5 854 | 50 / 6 336 | 3.28 s |
prim_sum_tree.clk_i (root hw/ip/prim) |
7 / 535 | 7 / 535 | 0.15 s |
prim_count.clk_i (root hw/ip/prim) |
30 / 4 522 | 29 / 4 311 | 0.16 s |
prim_flop.clk_i (prim+prim_generic copy) |
63 / 13 foreign | 50 / 6 380, 0 foreign | 0.16 s |
prim_flop.rst_ni (same copy) |
77 / 29 foreign | 48 / 6 656, 0 foreign | 0.16 s |
None falls back. mem's +3 lines are K2: three DV define bodies spelling
mem bare (MEM_BKDR_UTIL_FILE_OP, two MEM_ARRAY_SUB) are invoked from
files holding a bind by instance path, which counts as a bind into the
unit. prim_count's −1 is N1 (a foreign clk_i in an edited file). The
prim_flop answers keep the three prim_assert.sv/prim_flop_macros.sv
body warnings; the rest are the .clk_i → .clk_x(clk_i) connection lines.
The unscoped fallback on opentitan: 237 files have an include the engine
cannot resolve — 230 in DV (almost all uvm_macros.svh, which is not in the
tree) and 7 elsewhere (tlul_assert.sv → uvm_macros.svh, three ibex files
→ formal_tb_frag.svh, aes_tb_pkg.sv → `REQUESTS_FILE, two
riscv-dv). Of 1 826 files declaring a module or interface, 341 have an
unknown home set and a member rename there is warned unscoped; outside DV
that is tlul_assert.sv, ibex_icache.sv, ibex_multdiv_fast.sv,
ibex_multdiv_slow.sv (and prim_assert.sv, which declares no member). More
than the "two DV cases" expected: a plain include naming a file outside the
set is unknown by the ruling, and every UVM file includes uvm_macros.svh.
Gates: fmt, clippy -D warnings clean; workspace lib/bins/tests — the first
run was cut by the guard at 1 700 s while starting
vlog_semantic/tests/sva.rs, syspolicyd at 134 % CPU (the lane 65.3
stall); the one re-run: 78 suites, 5 059 passed, 0 failed, 51 ignored;
doc-tests 6 suites, 1 passed; corpus 814/820.
2026-10-06 — fix for the independent review's H-1/H-2 (oct_review.md).
A bare macro argument outside the home set was dropped whatever the macro
did with it, and a bind produced by a macro was invisible to K2/H3 — both
silent missed renames, regressions against 0.59.0 (.x(x) built by
`CONN(state_q) broke the instantiation without a word). New
vlog_refactor/src/rename/carry.rs decides, per macro and formal position,
whether an argument is carried: the body spells the formal after a .
(past blanks and pastes), passes it to a carried position of another macro, or the macro expands to a `bind` into the declaring unit (a *binder*, directly or through a macro its body invokes; every position carried). A carried bare argument is news wherever it is written; so is an argument of a macro the set does not define, one past the formals, and one in a macro cycle (doubt). A binder's body is news (`keeps_define_body`) and a file invoking a binder is home (K2). `scoped::spellings` now also sees a `.` through a paste ( u_m.state_q), which only adds warnings.
Assumption: a bind is recognised only where bind is spelled in a
`define body of the set; an undefined macro's arguments are carried, but
the macro is not taken to expand to a bind. Tests:
vlog_refactor/tests/rename_macro_carry.rs (8: PC, PA, PA2, a passed-on
position and a non-carried one, PD body and argument, an undefined macro,
and a plain-expression macro that stays silent) and 4 unit tests in
carry.rs. OpenTitan (engine probe, whole hw, against the same tree with
carrying disabled): entropy_src_main_sm.state_q 47 = 47 warnings,
hmac_core.StIdle 0 = 0, prim_count.cnt_q 13 = 13, timing unchanged (~2.9 s)
— no noise added there.
2026-10-07 — fix for review M-1. The H4 fragment warning
(Scope::fragment_use_warnings) ignored the rename's own edits, so a use in
an include-related file that the rename did rewrite (a cross-file
reference, such as n.sv's instantiation of a renamed module m when
all.sv includes both) was reported as "left unchanged". Tokens covered by
an edit in that file are now skipped. Test:
tests/rename_warning_scope.rs
an_edited_use_in_an_include_related_file_is_not_said_to_be_left_unchanged
(fails with the skip disabled). Workspace: 80 suites, 5 077 passed, 0
failed, 51 ignored; the first run was cut by the guard at 1 800 s while
launching the freshly linked vlog_semantic/tests/struct_members binary
(syspolicyd at 71 % CPU: the §65.3 stall), limit not raised; the
identical re-run passed.
2026-10-07 — fix for review M-2. Scope::name_of scanned every source
per call, and define_warnings / macro_use_warnings named every file of
the set before looking for a site — two quadratic passes, about 0.5 s of an
opentitan rename. The base-name counts are now built once per set
(scope::BaseNames, kept on the Scope and on the port offers' Files;
name_among folded into it). Engine probe, whole hw,
entropy_src_main_sm.state_q: 2.95 s → 2.23 s (defines 326 → 7 ms, macro
arguments 394 → 77 ms), the same 47 warnings. Unit test
scope.rs a_file_name_another_file_shares_is_named_by_its_path.
2026-10-07 — docs for review M-3. "What changed" now covers the reworks
and the review fixes; the claim that the engine and the verifier were
"unchanged in code" was stale after rework 2 (the verifier names files by
name_of) and rework 3 (the warning modules) — what a rename rewrites is
unchanged, and the verifier still gained no normalization. Status lists
reworks 2–5, P1/P2 and §65.6. P1/P2: QA's closing check left
rework5_a_shadowing_parameter_does_not_hide_a_dotted_body_spelling and
rework5_a_default_argument_spelling_the_name_is_said ignored, but at
review time the tree already held the fix with no work-log entry: in
scoped.rs::keeps_define_body the unscoped fallback and a dotted body
spelling come before the shadowing-parameter check, and a parameter named
like the declaration silences nothing when a default argument spells the
name bare (DefineSite::default_bare, scanned in
warnings.rs::define_sites_with). Both tests run un-ignored and pass; their
stale doc comment ("rework 5 does not") is corrected. Topo row 40's second
half is marked answered; the CHANGELOG's two scoping bullets are merged.
2026-10-14 — fixes for review L-1–L-4, L-12, L-13.
- L-1 (
vlog_semantic/src/bind/mod.rs): the closing-label fallback for an unowned block now applies only to block constructs and only when the closing label spells the construct's own opening label (begin : xor thex:prefix);use_block_end_labelbeside the strictuse_end_label. A mismatchedend : aclosingb: beginand anendfunction : gbeside blockgrecord nothing. Tests:vlog_semantic/tests/generate_blocks.rs(2). - L-2 (
vlog_linterduplicate-declaration): two block labels are silent only when both may be arms of one generateif/case; aforblock or a procedural block beside a generate block is reported whichever comes first. OpenTitanlucisv check hw: 1 158 findings, identical to 0.60.0. - L-3 (
rename/scoped.rs::after_dot): a block comment between the.and the name (u_m./*x*/state_q) is still dotted. - L-4: a file that spells
bindbut does not lex counts as binding into the unit (K2), and an include-related fragment that does not lex is said ("could not read") instead of skipped. - L-12 (
rename/arms.rs):text.get(..)instead of an unchecked slice. - L-13: the
.*expansion, ANSI conversion, inline and extract messages name files byScope::name_of. Test:tests/expand.rs. L-3/L-4 tests (tests/rename_warning_scope.rs, 3) fail with the fixes disabled. Workspace suite: one full run cut by the guard at 1 800 s invlog_refactor/tests/corpus.rswithsyspolicydat 95 % andmediaanalysisdat 90 % CPU while a second worktree ran its own suite (the §65.3 stall); re-run per crate, each under its own guard.
QA log
2026-09-30 — QA agent (Opus). Verdict: PASS with findings — no regression found anywhere in the whole-design differential; two silent-partial shapes remain (F1, F2), both pre-existing in 0.59.0 for nets, F1 newly reachable for block labels because the MCP refusal is lifted.
A. Differential against the released 0.59.0 (binaries from the 0.59.0
vsix; new ones cargo build --release -p lucisv -p lucisv_mcp; eval clone
~/.cache/lucisv-eval/ot/hw, read-only, status clean afterwards):
lucisv check --output-format json hw: 1 158 findings old, 1 158 new, byte-identical JSON. Every rule (--selectall 74,--no-gitignore): 24 619 = 24 619, byte-identical. 0 added, 0 removed, any rule.lucisv format --check --no-cache --no-gitignore hw: 3 868 would reformat / 71 unchanged / 8 failed, stdout and stderr byte-identical.lucisv-mcp --read-onlyfind … refs:true, 21 names (entropy_src_main_sm.state_q,clk_i,prim_fifo_sync, genvarprim_arbiter_tree.offset, generate-block netprim_arbiter_tree.req_tree, parameterprim_fifo_sync.Depth, functionprim_util_pkg.vbits, typedefentropy_src_hw_if_req_t, modporttl_if.dut_host_mp, package constantentropy_src_pkg.CSRNG_BUS_WIDTH, andgen_rf_base_ff,g_rf_flops,rf_reg_q,gen_level,gen_sw_assigns,hw_key_sel_buf,gen_cmd_stage,u_csrng_cmd_stage,gen_ep_blk,gen_normal_fifo,gen_fsm_p): 19 identical, 2 strict supersets, nothing removed. Added sites, all real uses:gen_rf_base_ff+ip/otbn/dv/verilator/otbn_top_sim.sv:527(u_otbn_core.u_otbn_rf_base.gen_rf_base_ff.…);gen_fsm_p(aes_control.sv:275) +ip/aes/dv/err_injection_if/aes_err_injection_bind.sv:68andip/aes/dv/sva/aes_bind.sv:41,60,62,64,66(u_aes_control.gen_fsm[0].gen_fsm_p.…in bind connections).- Index (MCP, 3 944 files, two runs per arm, same session): cold build
2.28 / 2.29 s → 2.26 / 2.29 s; warm start 1.13 / 1.14 s → 1.16 / 1.16 s;
index-cache-mcp46 324 858 → 47 598 946 bytes (+1 274 088, +2.75 %).
B/C. Scope semantics and rename attacks — held: genvar never leaks (also
past a module signal of its name); a member lookup through a block never
climbs to the enclosing scope (g_l[0].clk is not the port); an unnamed
generate if and a bare begin … end inside a region still hide their nets;
a label named like a module is the lexical answer (sub.x); arr[0].f
resolves on a 2-D packed struct array and through a packed-array typedef, and
never on logic [3:0] v; v[0].f, a class queue q[0].m or an instance array
u_arr[1].sig; the unpacked struct array's u[1].f is warned about;
sibling loops with one label (illegal) — no crash, rename moves both labels;
escaped label \g$lane with its closing label and path; a label in both
arms of an ifdef; a label used only by its closing label; disable +
closing labels in functions, tasks, fork … join_none; g_a.g_b[2].x from
another file renamed at every level, from either file; a generate case
label in three arms from any arm or the path; a net inside a block renamed
through a two-file path; rename to a name the module already declares
(net ↔ label, label ↔ sibling label) refused; g_lane → its genvar gi
refused (a path inside the body would be captured); a → b → a restores every
byte; a same-named block in another module is never touched; LSP references
and rename through u_mid.u_leaf.g_l[1].s with every other file closed.
Verifier: the dev's 8 attacks pass; 5 more in
vlog_refactor/src/check/qa_block_attacks.rs (rebinding u_y.g_lane to the
wrong module's block, one arm of a same-label pair, the genvar capture — all
refused; a consistent extra rename of another module's same-named block is
accepted, as it is for a net: the verifier is a meaning check, and the
engine test above pins that the engine never emits it).
D. Flipped tests — each new expectation is right: member_access.rs
(blk.inner resolves: §23.6); rename.rs
a_generate_block_scoped_net_named_through_an_instance_is_renamed_with_its_path
(the tail through the block moves — same test, renamed, no assertion
dropped); rename_bind.rs (a bind target through tb.gen[0] is followed, a
broken tb.nogen[0] still warns — stricter than before); nav.rs ×3 (a
block-scoped net leaves its file and the other file's path is listed);
qa_m7.rs (the MCP renames g_lane with its path, 2 sites). No #[test]
was removed.
E. Index format — a 0.59.0 index-cache-mcp (header 2 20 0.59.0) given
to the new build is rebuilt (answer includes otbn_top_sim.sv:527, file
rewritten at 47 598 946 bytes); a stale LSP index-cache is ignored with
"not written by lucisv 0.59.0" on stderr, never written, answer correct.
(Cargo still says 0.59.0 — the FACTS_FORMAT field alone separates the
two stores, which is enough.)
Findings, by severity:
- F1 (medium; pre-existing for nets, new for block labels via MCP). A
hierarchical path rooted at a top-level module declared in another file
(
tb.dut.g_sw[0].buf_q, the opentitan DV shape) records no reference, and the stray scan (vlog_refactor/src/rename/warnings.rs:121,unaccounted_warningsat :352) runs only over the files the rename edits — so the rename is silently partial. Repro on a copy of opentitanip/keymgr_dpe/{rtl/*.sv,dv/tb.sv,dv/env/keymgr_dpe_if.sv}: MCPrename gen_sw_assigns gen_sw_asg→ "renamed 1 site in 1 file", only theuvm_infostring atkeymgr_dpe_if.sv:523warned;force tb.dut.gen_sw_assigns[i]…at :514, :515, :517 left unchanged, no warning. 0.59.0: the same rename was refused (R1);rename keymgr_dpe.hw_key_sel_bufis identically silent in 0.59.0 and now. Pinned (ignored):vlog_refactor/tests/qa_generate_label.rsa_path_rooted_at_another_files_top_module_is_never_silently_left_behind. - F2 (medium; pre-existing). Both arms of a generate
iflabelledg, each declaringx, andassign o = g.x;: renaming the first arm'sx→yrewritesg.x→g.yand leaves the second arm'sx—g.ynames nothing whenever that arm elaborates; no warning. (0.59.0 leftg.xuntouched, which broke the other arm.) Pinned (ignored):a_member_both_arms_declare_is_never_silently_split. A member only the second arm declares (g.b) is warned about — fine. - F3 (low; lint on edge code, zero effect on opentitan). With the region
no longer a scope: two
genvar i;in twogenerateregions andwire winside a region plus one outside are nowduplicate-declarationerrors (right per §27.3; were silent /instance-shadowing); a net and a block label of one name in one scope (illegal) draw noduplicate-declaration(Blockis notplain) and the net is reported "read but never driven" — the label counts as its use; a block-local net named like a module-level block label now drawsinstance-shadowing(acceptable). - F4 (low, latent).
Semantics::member_key(vlog_semantic/src/lib.rs:293) of a named block inside functionffisff.fb— the key moduleff's blockfbis filed under. No wrong answer found over the wire (lucisv_server/src/server/tests/qa_generate_label.rs); the pre-change code keyed a function local by the bare function name, the same class. Pinned (ignored):vlog_semantic/tests/qa_block_scopes.rsa_blocks_member_key_is_none_or_dotted_never_a_bare_colliding_name.
Fixed directly: nothing in production code. Tests added:
vlog_refactor/tests/qa_generate_label.rs (19, 2 ignored = F1, F2),
vlog_semantic/tests/qa_block_scopes.rs (10, 1 ignored = F4),
vlog_refactor/src/check/qa_block_attacks.rs (5; mod line in
check/mod.rs), lucisv_server/src/server/tests/qa_generate_label.rs (2;
mod line in server/tests/mod.rs).
Gates (2026-09-30, after QA's tests): cargo fmt --all clean; clippy
--workspace --all-targets -D warnings clean; workspace lib/bins/tests
76 suites, 5 007 passed, 0 failed, 54 ignored (dev 4 974 + 33 QA), guard
exit 0, no kill; doc-tests 6 suites, 1 passed. §65.1 QA box ticked; F1 and F2
are left for the lead's ruling (both silent partials exist for nets in 0.59.0;
F1 is the shape the lifted MCP refusal used to cover).
2026-09-30 — QA re-check of the rework (Opus). Verdict: PASS with findings. F1–F4 are fixed as ruled. No regression, no weakened assertion, two new silent shapes found (R2 low, R3 medium).
Eval clone renames (lucisv-mcp full mode, root hw, warm cache; every
rename was followed by git -C ~/.cache/lucisv-eval/ot checkout -- ., and
the clone is clean):
entropy_src_main_sm.state_q: 5 sites in 2 files. 10 path warnings and every line is a real unresolved path:otbn_trace_if.sv:644, the fpv assertions,rom_ctrl_fsm_bound_if.sv:268, and the`PATH_TO_DUT/`EDN_HIERroots inpwrmgr_if.sv/chip_if.sv. Cross-checked against everyrghit for.state_q/state_q[/state_q.(95 lines): each one is rewritten, resolves to another module'sstate_q(rv_plic,csrng_state_db), sits in a macro argument or string (the macro and mention lists), or is a flash_ctrl/pwrmgr_bind path already named by the unresolved-candidate warning. No miss, no false line. Time: 4.20 / 4.23 / 4.15 s. 0.59.0 took 130.4 s (cold) and 127.2 s (warm) for the same rename.prim_arbiter_tree.EnDataPort(13 sites in 9 files) andprim_util_pkg.vbits(224 sites in 115 files): no path warning;rgfinds no path spelling either.gen_sw_assigns(keymgr_dpe): the F1 repro now warnsip/keymgr_dpe/dv/env/keymgr_dpe_if.sv:514,515,517, and also keymgr'skeymgr_if.sv:468,469,471(another module's block behind the same unresolvabletb.dutroot — correctly "check whether").gen_rf_base_ffandgen_ep_blk: every non-macro site is rewritten.clk_iof a leaf could not be renamed onhw: it is refused by the >1 MiB pinmux file (unchanged behaviour). Onhw/ipit is refused by the implicit.clk_ifromtb.sv:31, and onip/primthere are 0 path warnings. Noise check on a DV copy (usb20 agent, clkmgr_if, dmi_test, prim_sum_tree): 16 lines of UVMcfg.bif.clk_i/this.drv.bus.clk_iclass-handle paths are warned. By the rule they are unresolved, so this is acceptable, but it is what a common port name will produce. Macro-rooted`CLKMGR_HIER…clk_ilines are both path-warned and listed underunresolved:— double-said, low.
Unit shapes (vlog_refactor/tests/qa_generate_label.rs, "Re-check"
section). These are named once per file with their lines: force, release,
$assertoff(0, tb.dut.g_sw[1]), a path split over three lines, and an
included .svh fragment. A path resolving to another module's same-named
block, a comment, a string and a named port connection to an unknown module
(.g_sw(1'b0)) are not warned. F2: three if arms, three case arms and an
ifdef-split pair each warn every other arm's line. F3: lint matrix over 17
files. A label beside a net (both orders), a variable, a localparam, a
parameter, an instance, a procedural label beside a module or task variable,
and a region-wrapped pair are now duplicate-declaration. Same-label arms
stay clean, and the net is no longer "undriven". Opentitan differential
redone: 1 158 = 1 158 default rules, 24 619 = 24 619 all rules,
byte-identical. F4: pk.pf().pb, cls.cm().cb, cls.ext().eb (out-of-body)
and ifc.it().ib (vlog_semantic/tests/qa_block_scopes.rs). No test file
lost a test or an assertion: the dev's four grew to 11/16/8/6 tests, and my
three formerly ignored tests now carry stronger assertions.
Findings:
- R1 (medium; pre-existing mechanism, new impact). A path warning names
its file by bare name whenever the set holds several files of that name.
vlog_refactor/src/scope.rs:340displayis basename-only, andlucisv_mcp/src/tools/source.rs:112rootedrewrites only unique names. Thestate_qrename printspwrmgr_if.sv:80,84three times (top_darjeeling / top_earlgrey / top_englishbreakfast) andchip_if.svtwice: 5 of 10 path warnings name no findable file and look duplicated. The same holds for the older kinds (tb.sv,pwrmgr_bind.sv,pwrmgr.sv:178×2). - R2 (low). An unresolved path through an escaped name is silent. The
census holds no escaped identifier (
vlog_semantic/src/words.rs:64), sopaths.rs:35'sfiles_mentioningfilter drops the file. Repro: ignored testrecheck_an_escaped_label_behind_an_unresolved_root_is_named. -
- R3 (medium; F2's remainder). Nested same-label arms: `if (P) begin : g
- if (Q) begin : h … end else begin : h … end end else begin : g if (1) begin
- h logic x; end end
withg.h.x. Renaming thexunderg's else arm is silent, whileg.h.xstill names the first arm'sx. Renaming the firstxwarns about line 6 but not line 10.paths.rs:64sibling_arm_warningsonly looks at the arms of the innermost label. Ignored testrecheck_sibling_arms_of_an_enclosing_label_are_warned_about`.
- R4 (low). Some label collisions draw no
duplicate-declaration(vlog_linter/src/rules/duplicate_declaration.rs:93collides): a label beside a port (ANSIinput logic gor non-ANSI), a genvar, a typedef or a function; and two procedural blocks of one label in one module (initial begin : blk … end initial begin : blk … end). All of these are illegal, but the rule is silent on them.
Tests added: 6 in qa_generate_label.rs (2 ignored = R2, R3), 1 in
qa_block_scopes.rs. Gates: fmt clean; clippy -D warnings clean; workspace
lib/bins/tests 76 suites, 5 023 passed, 0 failed, 53 ignored (dev 5 018 +
5; +2 ignored = R2, R3), guard exit 0; doc-tests 6 suites, 1 passed.
2026-09-30 — QA final pass, reworks 2 and 3 (Opus). Verdict: FAIL —
rework 3 hides real uses. Rework 2 holds in full. Rework 3's rule that a
bare spelling in any other file cannot name a module's member
(vlog_refactor/src/rename/scoped.rs:71-73, names_the_declaration), and
its rule that a foreign `define body is kept only when dotted
(scoped.rs:61, keeps_define_body), are false for text that the
preprocessor splices into the declaring module. 0.59.0 warned about all three
shapes below, and so did rework 2. Reproductions are the ignored tests in
vlog_refactor/tests/qa_warning_scope.rs. On 0.59.0 vs now through MCP
(scratch trees), each rename renames 3 sites and the new build prints nothing:
- H1 (HIGH, hidden use, regression). Module
mhas`include "m_assert.svh"in its body, and the fragment reads`ASSERT(StateKnown_A, !$isunknown(state_q)). Renamem.state_q: 0.59.0 says "appears in the arguments of the macro invocationASSERTat m_assert.svh:1" and lists the line underunresolved:. Now: no warning, no mention. - H2 (HIGH, hidden use, regression, opentitan). A header
`define CHK assert property (@(posedge clk) state_q != 0);is invoked as`CHKin the declaring module; the body warning is gone. The opentitan case is every module:prim_assert.sv:17`define ASSERT_DEFAULT_CLK clk_iandprim_flop_macros.sv:12(PRIM_FLOP_CLK). Renamingprim_sum_tree.clk_i(roothw/ip/prim) renames only the port. The three`ASSERTatprim_sum_tree.sv:150-152expand to@(posedge clk_i)and no longer compile. Rework 2 warned about both define bodies; rework 3 warns about neither, and drops them fromunresolved:too. - H3 (HIGH, hidden use, regression; rarer).
bind m chk u_chk (.s(Q(state_q)));in another file: the connection is evaluated inm`'s scope. It was warned; now it is silent. - H4 (HIGH, hidden use, pre-existing; its last hint is now gone). A bare
use in plain included code is never renamed or warned about, in either
version. Opentitan:
prim_util_memload.svh(included byprim_generic/prim_xilinxprim_ram_*/prim_rom) usesmem,Width,Depthbare ($readmemh(file, mem),mem[index] = …). Renamingprim_ram_1p.memon the eval clone gives "renamed 4 sites in 1 file" and leaves the fragment. 0.59.0 at least listedprim_util_memload.svh:12,24,32,43(its comments) underunresolved:. The new answer lists nothing:mentions.rsFocus::localdrops a bare mention outside the declaring file. - Suggested direction (the dev's to decide): count as "home" every file the
declaring file
includes (transitively), keep a define body that is invoked in a home file, and keep a macro argument in abindwhose target is the declaring unit.
What held. The same-file lookup: a function, a generate block and a
nested use warn; a shadowing inner state_q and a second module in the
same file do not. Unparsed assertion text and ifdef-disabled macro
arguments in the declaring file are warned. Eval clone (restored after each):
entropy_src_main_sm.state_q: 71 lines / 12 367 bytes, 4.26 s. It keepsentropy_src_main_sm.sv:44,entropy_src_path_if.sv:25and everychip_if.svline; the path warnings are now root-relative (the threepwrmgr_if.svare told apart). No header define body spellsstate_q, and the module includes onlyprim_assert.sv, so none of the ~230 dropped bare arguments can reach it.hmac_core.StIdle: 7 sites, no text warning; hmac_core includes onlyprim_assert.sv, and no define body spellsStIdle.gen_sw_assigns: 9 lines, bothuvm_infostrings and both path warnings.prim_fifo_sync.wvalid_i: refused (the fpv bind implicit.wvalid_i, unchanged behaviour).
Rework 2 checks.
- R1: three
probe.svat depths 0/1/3 are named/rtl/probe.sv,/rtl/x/probe.sv,/rtl/x/y/z/probe.svby the engine (which the LSP shows as is) andprobe.sv,x/probe.sv,x/y/z/probe.svby MCP. - R3: three-level
a.b.c.xwarns every other arm, from either end. - R2: an escaped net and an escaped label behind an unresolved root are both named.
- R4: the six collisions of the matrix are now
duplicate-declaration, and same-label arms stay clean. Default-rule opentitan differential: 1 158, byte-identical. - The item-5 dedupe holds (
wire.rs:dv/probe_if.sv:6is a path warning, not a mention).
The four re-spelled tests (qa_f1.rs CRLF and the 50-cap, qa_m2.rs
third.sv, lucisv_server/src/rename.rs
a_macro_file_the_rename_does_read_is_warned_about_exactly_once) still test
what they were written for: CRLF line numbers, the cap, a comment or string
never being a use, and one warning per macro file. Each one now also pins
the bare-elsewhere rule, which H1–H3 contest only for included, define and
bind text, not for these unrelated files.
Tests added: vlog_refactor/tests/qa_warning_scope.rs (9; 4 ignored = H1–H4).
Gates: fmt clean; clippy -D warnings clean; workspace lib/bins/tests 78
suites, 5 038 passed, 0 failed, 55 ignored, guard exit 0 (no kill); doc-tests
6 suites, 1 passed.
2026-09-30 — QA re-check of rework 4, the home set (Opus). Verdict:
PASS with findings. H1–H4 now hold: the four tests are un-ignored with
their assertions unchanged, and H4 still asserts "renamed or said". On the
eval clone every rename answers with warned lines that can reach the renamed
declaration. Three hidden-use shapes remain, marked HIGH by the rule but all
rare in opentitan (K1–K3). There is also one noise source that brings back
part of the flood for widely instantiated ports (N1). The attack tests are in
vlog_refactor/tests/qa_warning_scope.rs, "Rework 4".
Held. An include is followed when it is written as:
- a
../inc/relative path; - a bare name that matches a file three directories deep;
- an include inside an
ifdef; - an include with a trailing comment, or with CRLF.
Also held:
- A base name that matches two files takes both.
- Three include levels with an a → b → a cycle: no hang, the fragment is reached.
- H2 through two other define bodies (
OUTER→MID→INNER). - H3 by target name, by instance path (
bind tb.u_bus …), into an interface, and inside a generate block. - H4 never rewrites a fragment's own
mem, and a fragment that only an unrelated module includes stays silent.
Eval clone (MCP, warm cache, restored after each):
| rename | answer | time |
|---|---|---|
entropy_src_main_sm.state_q |
71 lines / 12 367 B | 4.34 s |
hmac_core.StIdle |
2 / 285 | 3.73 s |
uart_core.rx_fifo_rvalid |
2 / 285 | 3.75 s |
prim_ram_1p.mem |
47 / 5 854 | 4.14 s |
prim_sum_tree.clk_i (root hw/ip/prim) |
7 / 535 | 0.22 s |
prim_count.clk_i (root hw/ip/prim) |
30 / 4 522 | 0.23 s |
Notes on those answers:
prim_ram_1p.memwarnsprim_util_memload.svh:29,39,51,68, all real.prim_sum_tree.clk_iwarnsprim_assert.sv:17,prim_flop_macros.sv:12and:44, all real.prim_sum_tree.clk_ion roothwis refused (the >1 MiB pinmux file), and everyclk_i/rst_nirename on roothw/ipis refused (implicit.clk_ifromkeymgr_dpe/dv/tb.sv:31). Both refusals are unchanged behaviour.- Sampled warned lines: the
state_qset is unchanged from the final pass (all reachable).mem: the 17 define bodies aretbhierarchy macros spelling it dotted.prim_count.clk_i: 13 of its 14 macro-argument lines are in the declaring file. - The home set of a module that includes
prim_assert.svis small: 7 files forprim_count.sv.
Performance. home_set on the whole eval tree (3 976 files, release) takes
200 ms for prim_assert.sv, which reaches 602 files; prim_util_memload.svh
reaches 15 files in 7.5 ms and prim_count.sv 7 files in 2.9 ms. There is no
cap, but none is needed: the rules compute a home set only for a module or
interface member, and prim_assert.sv declares none.
Findings:
- K1 (HIGH, hidden use). A declaration written in an included fragment
(
decl.svh:logic shared_q;, included bym1andm2) sits at file scope. It has no enclosing unit, soScoping::newbuilds no home set (vlog_refactor/src/rename/scoped.rs:70,None => (Home::none(), …)), and H4 never runs. Renamingshared_qleavesm2's plainassign o = shared_q;unchanged and unsaid.m1's macro argument is warned only because nothing is filtered. Testrework4_a_declaration_in_a_fragment_shared_by_two_modules. - K2 (HIGH, hidden use, rare). Take a
bind m chk u (.s(SIG));where a header outside the home set has ``define SIG state_q``. The bind file is not home, soSIGis not ininvoked(scoped.rs:112,invoked_fromover home texts only), and the body is silent. Testrework4_a_macro_invoked_inside_a_bind_into_the_unit_is_followed. - K3 (HIGH, hidden use, rare). An include whose file name a macro builds
(
`include `FRAG) is not followed (home.rs:109,_ => continue). The fragment is silent. Opentitan has two such lines, both in DV (aes_tb_pkg.sv:39, riscv-dv'sinclude_file). Testrework4_an_include_built_by_a_macro_is_followed_or_said. - N1 (medium, noise). Every file the rename edits is home, and a bare
spelling in any non-declaring home file warns without a scope lookup
(
scoped.rs:125). So an instantiating module's ownclk_iin its own`ASSERTis reported.prim_flop.clk_ion aprim/rtl+prim_generic/rtlcopy: 29 files edited, 63 lines / 8 838 B, 13 macro-argument warnings, all 13 in other modules.prim_flop.rst_ni: 77 lines / 12 527 B, 29 of 29 foreign.- At opentitan scale (hundreds of instantiations) that is the flood again.
- Suggestion: run the
nearestlookup in edited files too, and keep the unconditional rule for pasted (included/including) files only.
- N2 (low, noise). A header macro whose parameter is named like the net
(
`define PARAM(state_q) (state_q + 1)) warns. So does a macro "invoked" only inside a string ($display("UNUSED")), becausemacro_names(home.rs:153) counts every backtick. Testrework4_a_parameter_named_like_the_net_and_a_string_invocation_are_not_news`. - N3 (low, observation). The upward closure is one level: a module
file included by a wrapper that another file includes does not make the
outer file home (
home.rs:56-68). K1 masks this for fragments today.
Tests added: 10 in qa_warning_scope.rs (4 ignored: K1, K2, K3, N2).
Gates: fmt and clippy -D warnings clean; workspace lib/bins/tests 78
suites, 5 051 passed (dev 5 045 + 6), 0 failed, 55 ignored, guard exit 0;
doc-tests 6 suites, 1 passed. Nothing new ticked.
2026-09-30 — QA closing check of rework 5 (Opus). Verdict: PASS with
findings. One narrow hidden-use shape (P1, high by the rule, contrived)
and one pre-existing low one (P2). The ruled fixes K1, K2, K3, N1, N2 and N3
all hold, and my K1/K2/K3/N2 tests pass un-ignored with assertions
unchanged. Tests are in vlog_refactor/tests/qa_warning_scope.rs, "Rework 5".
Held.
The unscoped fallback. prim_count_if.sv includes uvm_macros.svh, which
the set does not hold, so its home set is unknown. Renaming its members on
the eval clone (restored afterwards; git status clean):
path: 219 macro-argument warnings, the same set of lines as 0.59.0. 0.59.0's 5 define-body warnings are gone, and every one is correctly silent:MEM_BKDR_UTIL_FILE_OPand the fourxbar_macros.svhbodies all take a formal parameter namedpath, and their bodies spell only that parameter.signal_forced: 40 = 40.- Time: 4.4 s against 119 s for 0.59.0.
N1 (scope lookup in edited files):
- An edited instantiator with no
clk_iof its own, writing.clk_i(Q(clk_i))`, is silent. That is right: the renamed port is not visible there. The declaring module's own macro argument is still warned, and the connection's port name moves. - An edited file that includes the declaring module's fragment: the fragment is warned.
- A nested module that re-declares the name is silent.
K2: a bind by a two-level instance path (bind tb.u_top.u_m …) makes the
header body of its macro warn.
N3: a declaration three include levels below a module warns that module's macro argument and its plain use.
Eval spot-checks:
entropy_src_main_sm.state_q: 71 lines / 12 367 B, 4.25 s, withentropy_src_main_sm.sv:44present.prim_ram_1p.mem: 50 / 6 336, 4.22 s, withprim_util_memload.svh:29,39,51,68present. Three moretbdefine bodies than rework 4 are said (conservative).prim_flop.clk_i/rst_nion the prim + prim_generic copy: 29 files edited, 50 / 6 173 and 48 / 6 461, 0 foreign macro-argument warnings (rework 4: 13 and 29).
Findings:
- P1 (HIGH by the rule, contrived; hidden use, a regression against
0.59.0).
keeps_define_body(vlog_refactor/src/rename/scoped.rs:124) returnsfalseas soon as a formal parameter is named like the declaration. That check runs before thebody_dottedtest and before the!self.scopedfallback, so a body that also reaches the name through a path is silenced, even when the home set is unknown.- Repro:
`define PATHY(state_q) (state_q + u_m.state_q)invoked inm, then renamem.state_q. 0.59.0: "appears in the body of macroPATHY". Rework 5: nothing (engine and MCP). - Fix: silence only when no spelling in the body is dotted.
- Test
rework5_a_shadowing_parameter_does_not_hide_a_dotted_body_spelling(ignored).
- Repro:
- P2 (low, pre-existing in 0.59.0). A default argument spelling the name
(
`define DFLT(x = state_q) (x)invoked as`DFLT()) is never scanned. Testrework5_a_default_argument_spelling_the_name_is_said(ignored).
Tests added: 5 (2 ignored: P1, P2). Gates: fmt and clippy -D warnings
clean; workspace lib/bins/tests 78 suites, 5 062 passed (dev 5 059 + 3),
0 failed, 53 ignored, guard exit 0 (no kill); doc-tests 6 suites, 1 passed.
Nothing new ticked.