Rename the tool to lucisv (Language Utility for Coding In SystemVerilog)

This commit is contained in:
lucio committed 2026-08-25 23:36:00 -07:00
1 parent a284e33110
commit eeaffafd56
188 files changed
+2825 -2802

No files matched your search

+36 -36
View File
@@ -2,13 +2,13 @@
## Goal
The first three lint rules vfmt writes against the *symbol table* rather than
The first three lint rules lucisv writes against the *symbol table* rather than
the syntax tree (TODO.md §8, M12): `unused-signal`, `undriven-net` and
`multiply-driven`. TODO.md §7's non-goal — "no semantic claims in v1 lint
rules; semantic rules only after `vlog_semantic` exists" — is crossed here,
which is the whole point: these are the rules Verible structurally cannot
write, because each one needs to know which declaration a name refers to. The
round also wires the analysis into `LintContext` so `vfmt check` and the
round also wires the analysis into `LintContext` so `lucisv check` and the
language server both reach it through the existing one-parse path, and pays
for it only when a semantic rule actually runs.
@@ -33,14 +33,14 @@ listed as a decision rather than left implicit.
`clocking` block's signals, and the implicit `.name` connection form.
- **A name a macro, a compiler directive, an attribute, a verbatim block
(`constraint`/`covergroup`/concurrent assertion) or an unparsed region
mentions is dropped from every judgement.** vfmt does not expand macros and
mentions is dropped from every judgement.** lucisv does not expand macros and
does not evaluate directives, so what those regions do to a signal is
unknowable. This is measured, not theoretical: it is what keeps
`` `ASSERT_KNOWN(FooKnown_A, foo) `` from making `foo` look unused.
- **A module that hides code is not judged at all.** Two ways to hide it: an
instance connected with `.*` (which reads and drives same-named signals
without writing any of their names down) and an `` `include`` written
*inside* the module body (arbitrary code vfmt does not follow — this is
*inside* the module body (arbitrary code lucisv does not follow — this is
exactly how `prim_rom.sv` loads its memory array). A file-level
`` `include`` does not blind anything: it brings in macro definitions, and
any macro *use* is already guarded above.
@@ -60,9 +60,9 @@ listed as a decision rather than left implicit.
- **The intentionally-unused convention is Verilator's, not Verible's.**
Verible has no unused-signal rule to be compatible with, so there is no
Verible spelling to match. Verilator's `--unused-regexp` defaults to
`*unused*`; vfmt exempts a name containing `unused` (case-insensitive) or
`*unused*`; lucisv exempts a name containing `unused` (case-insensitive) or
starting with `_`. It is not configurable this round — that waits on the
`lint` key in `vfmt.toml`, like every other rule setting.
`lint` key in `lucisv.toml`, like every other rule setting.
- **`analyze` is exact enough to lint on.** The `vlog-semantic` corpus test
asserts every one of its 95 193 name spans slices back to the name it
claims; these rules trust `references_of` for "is this used" and the
@@ -103,7 +103,7 @@ listed as a decision rather than left implicit.
`with_semantics(&Semantics)` (lends a caller's). `from_parse`'s signature
is **unchanged**, so no existing caller had to move.
- The analysis is lazy: a `LintContext` on which no semantic rule ever runs
never calls `analyze`. Measured — a default `vfmt check` over the corpus is
never calls `analyze`. Measured — a default `lucisv check` over the corpus is
byte-identical and time-identical to the one before this round.
- The signal table is built once per context and shared by all three rules,
so enabling three costs what enabling one costs. Also measured.
@@ -118,7 +118,7 @@ listed as a decision rather than left implicit.
than attempted: it changes a rule from single-file to project-wide, which
is a design decision, not a patch.
- *config-discovery's owner*: the intentionally-unused convention wants to be
a `vfmt.toml` setting (`[lint.unused-signal] ignore = "..."`), for the same
a `lucisv.toml` setting (`[lint.unused-signal] ignore = "..."`), for the same
reason the naming styles do. Restated, unchanged.
## The three rules
@@ -185,12 +185,12 @@ driver that is:
It also steps aside when a conditional-compilation directive
(`` `ifdef``/`` `else``/`` `endif``) is written between the first and last
driver — the preprocessor's spelling of the same exclusivity `generate` has.
vfmt parses both arms of an `` `ifdef`` as ordinary items, so without this
lucisv parses both arms of an `` `ifdef`` as ordinary items, so without this
guard the `` `ifdef FAST / `else `` pattern would report every time.
## The corpus measurement, and the on/off ruling
Release build, `vfmt check corpus --select <rule> --output-format json`, over
Release build, `lucisv check corpus --select <rule> --output-format json`, over
the 860 `.v`/`.sv`/`.svh` files in `corpus/` (Ibex, OpenTitan, PULP
common_cells, picorv32), 2026-08-25:
@@ -263,10 +263,10 @@ Same corpus, best of five runs, this machine:
| run | 1 thread | 10 cores |
|---|---:|---:|
| `vfmt check` before this round | 0.21 s | 0.07 s |
| `vfmt check` after (semantic rules off) | 0.22 s | 0.07 s |
| `vfmt check --select <defaults>,unused-signal` | 0.26 s | 0.07 s |
| `vfmt check --select <defaults>` + all three | 0.26 s | 0.07 s |
| `lucisv check` before this round | 0.21 s | 0.07 s |
| `lucisv check` after (semantic rules off) | 0.22 s | 0.07 s |
| `lucisv check --select <defaults>,unused-signal` | 0.26 s | 0.07 s |
| `lucisv check --select <defaults>` + all three | 0.26 s | 0.07 s |
Reading it: the default run is unchanged — proven byte-for-byte, not
inferred, by diffing the whole-corpus JSON and stderr of this build against a
@@ -286,14 +286,14 @@ disappears into the worker pool.
whole-word mention scan, the `.*` / `` `include`` blindness rule.
- [x] `unused-signal`, `undriven-net`, `multiply-driven` — registered,
documented, diagnose-only, off by default.
- [x] Server wiring: `vfmt_server` lends the document's own `Semantics`, so
- [x] Server wiring: `lucisv_server` lends the document's own `Semantics`, so
a keystroke never analyzes twice.
- [x] `force`/`release`/`deassign` classified as their own driver kinds, out
of `multiply-driven` entirely and half-out of `undriven-net` (QA
finding, fixed 2026-08-25).
- [x] 69 new unit tests: 23 in `signals.rs` (the classification), 43 across
the three rule modules, 2 in `context.rs` (lazy vs lent analysis), 1 in
`vfmt_server::lint` (the server reads the document's own table).
`lucisv_server::lint` (the server reads the document's own table).
- [x] 52 `.lint` cases across three new case files — 16 + 20 + 16 —
covering violating / clean / waived / unused-waiver and every guard.
- [x] Corpus measurement, per-finding judgement, and the on/off ruling above.
@@ -309,7 +309,7 @@ disappears into the worker pool.
unknown. Deliberately not done — it is a second resolution mechanism
and wants the workspace index behind it anyway.
- [ ] Per-rule configuration of the intentionally-unused convention — needs
the `vfmt.toml` `lint` key.
the `lucisv.toml` `lint` key.
## Work log
@@ -332,7 +332,7 @@ disappears into the worker pool.
one 658-line module (`signals.rs`, plus 275 lines of its own tests) and
`vlog_semantic` is untouched.
- **Lazy analysis — decision.** Making `from_parse` take a `Semantics`
would have forced every caller to build one, i.e. made `vfmt check` pay for
would have forced every caller to build one, i.e. made `lucisv check` pay for
an analysis nobody reads on a default run. Instead `LintContext` holds a
`OnceCell<Semantics>` filled on first use, plus `with_semantics` for the
server, which analyzes every buffer anyway. `from_parse`'s signature never
@@ -362,7 +362,7 @@ disappears into the worker pool.
clocking case is a `judgeable` test and not a `connected` one); an
expression statement that is not `x++` is a call whose arguments may be
`output` arguments.
- **The `` `ifdef`` guard for `multiply-driven`** exists because vfmt parses
- **The `` `ifdef`` guard for `multiply-driven`** exists because lucisv parses
both arms of a conditional as ordinary items — the same property that makes
`unused-signal` see through an `` `ifdef``. Two `always_comb` blocks in
opposite arms would otherwise report every time. Implemented as "is a
@@ -370,14 +370,14 @@ disappears into the worker pool.
narrow: a directive elsewhere in the file excuses nothing.
- **Part-selects: silence.** The task named this as the judgement call.
`a[0]` in one block and `a[1]` in another *is* illegal in `always_comb`, but
it is also the everyday shape of legacy `always` code, and vfmt does not
it is also the everyday shape of legacy `always` code, and lucisv does not
resolve bit ranges. Any partial driver takes the signal out of the rule.
- **On/off**: measured, judged per finding, ruled off for all three, with the
reasoning and the dissent for `multiply-driven` written above rather than
buried.
- **Scope**: `crates/vlog_linter/{Cargo.toml,src/context.rs,src/lib.rs,
src/signals.rs,src/rule_docs.rs,src/registry.rs,src/rules/**,tests/cases/**}`,
`crates/vfmt_server/src/lint.rs` (the two-line lend + one test, which the
`crates/lucisv_server/src/lint.rs` (the two-line lend + one test, which the
task authorized), this README, `docs/features/linter-core/README.md`'s rule
table, and the top-level `README.md`'s Linting section (the three rules and
their off-by-default footnote — changed because that section called the
@@ -391,7 +391,7 @@ disappears into the worker pool.
`git worktree`: 1474 — the delta is exactly this pass's 61 new tests);
`cargo test -p vlog_linter` 182 unit (was 122) + 14 case-harness + 1 doc. CLI smoke:
all three rules fire on a crafted module, the `_ignored` name is exempt, a
`// vfmt: waive unused-signal` suppresses its finding, the default run on
`// lucisv: waive unused-signal` suppresses its finding, the default run on
the same file is clean, and JSON carries `"fix":null`.
### 2026-08-25 — dev (QA follow-up: the `force`/`release` ruling)
@@ -450,7 +450,7 @@ QA's should-fix, and the lead's ruling on it, implemented in full.
three JSON outputs are byte-identical to the pre-fix run — the corpus's two
`force`/`release` files write through hierarchical paths these rules do not
track, which is exactly why the corpus never showed the bug. Default
`vfmt check` over the corpus is still byte-identical (stdout **and**
`lucisv check` over the corpus is still byte-identical (stdout **and**
stderr) to a `git worktree` build of `HEAD` a96c908.
- **README**: the `undriven-net` driver list now names `force` and states
that `release`/`deassign` are not drives; `multiply-driven`'s exclusion
@@ -480,7 +480,7 @@ flags as "closest to default-on."
--workspace` silent (forced rebuild by touching `lib.rs` first, per the
house discipline). `cargo test --workspace`: **1535 passed**, 0 failed,
summed from every `test result:` line — matches the claim exactly.
`node editors/vscode/smoke.js target/debug/vfmt-server`: `OK`. No `unsafe`;
`node editors/vscode/smoke.js target/debug/lucisv-server`: `OK`. No `unsafe`;
the only `.unwrap()`/`.expect()`/`panic!` in the five touched files
(`signals.rs:675-676`, `context.rs:355`) are inside `#[cfg(test)]` modules.
No `#[allow]` anywhere in the new code. `cargo tree -p vlog_linter -e
@@ -491,7 +491,7 @@ version stayed `0.4.2` (no bump), `TODO.md` untouched, confirmed by
**Byte-identical claim — verified myself, not re-trusted.** Built HEAD
(`a96c908`) in a `git worktree`, release profile, alongside the working
tree's release build. `vfmt check corpus --output-format json` from both
tree's release build. `lucisv check corpus --output-format json` from both
binaries: stdout **byte-identical**, stderr **byte-identical** (same
single lex-error line and the same "found 7932 violations, 1 file could
not be checked" summary — the corpus grew a naming-rule finding since the
@@ -606,7 +606,7 @@ and not told apart from each other. Two consequences, reproduced live:
assign q = a;
endmodule
```
`vfmt check --select multiply-driven` on this file: 1 violation,
`lucisv check --select multiply-driven` on this file: 1 violation,
`` `a` is driven both by a continuous assignment and by a procedural
block``. This is exactly the kind of finding CLAUDE.md and this
feature's own "not crying wolf" bar exist to prevent — a real,
@@ -634,7 +634,7 @@ and not told apart from each other. Two consequences, reproduced live:
assign q = a;
endmodule
```
`vfmt check --select undriven-net`: 0 violations, even though `a` is
`lucisv check --select undriven-net`: 0 violations, even though `a` is
never actually assigned a value anywhere in the file. This is the
silent/harmless direction (no false accusation), so it is not a
blocking bug, but it is a real behavior gap the doc doesn't own, and it
@@ -674,20 +674,20 @@ because the QA brief asked about "procedural continuous assign/deassign"
by name and the honest answer is "silently and safely out of scope," not
"handled."
**Waivers.** Spot-ran `// vfmt: waive <rule>` on the declaration/violation
**Waivers.** Spot-ran `// lucisv: waive <rule>` on the declaration/violation
line for all three rules live (not just the `.lint` harness, which was
also re-run: `cargo test -p vlog_linter --test lint_cases` — 14/14 green,
including the three new case files' own suites). Every waiver suppressed
its rule's finding as expected.
**Server parity.** `crates/vfmt_server/src/lint.rs`'s `context()` now
**Server parity.** `crates/lucisv_server/src/lint.rs`'s `context()` now
calls `.with_semantics(&doc.semantics)`, and the round's own test
(`a_semantic_rule_reads_the_documents_own_analysis`) proves both that a
semantic rule fires correctly through the server's `LintContext` and that
`context(doc).semantics()` is pointer-identical to `&doc.semantics` (the
lent table, not a second analysis) — read and re-run, passes. **Caveat
worth recording**: `vfmt_server::lint::violations`/`diagnostics` call
`lint(&context(doc), &default_rules())` only (`crates/vfmt_server/src/
worth recording**: `lucisv_server::lint::violations`/`diagnostics` call
`lint(&context(doc), &default_rules())` only (`crates/lucisv_server/src/
lint.rs:35-36`) — there is no server-side rule-selection surface yet, so
none of the three semantic rules can actually be *reached* through the
live LSP path today; the parity claim is true at the plumbing level (verified
@@ -700,7 +700,7 @@ editor today."
**Test-count reconciliation — exact, not approximate.** `grep -c
"#\[test\]"`: `signals.rs` 21, `rules/{unused_signal,undriven_net,
multiply_driven}.rs` 12+13+12=37, `context.rs` 9 total (2 new — the other
7 predate this round), `vfmt_server/src/lint.rs` 11 total (1 new). New
7 predate this round), `lucisv_server/src/lint.rs` 11 total (1 new). New
total: 21+37+2+1 = **61**, matching the claim exactly. `.lint` case
files: 15/15/13 `====` separators → 16/16/14 cases (one more case than
separators, per the format) = **46**, matching exactly. This precision
@@ -710,7 +710,7 @@ the narrative is trustworthy.
**Minor, cosmetic finding.** The Work log's "Scope" bullet
(`docs/features/semantic-lints/README.md`, the "2026-08-25 — dev" entry)
lists the touched files as `crates/vlog_linter/{...}`,
`crates/vfmt_server/src/lint.rs`, "this README, and
`crates/lucisv_server/src/lint.rs`, "this README, and
`docs/features/linter-core/README.md`'s rule table" — it does not mention
the top-level `README.md`, which `git diff HEAD -- README.md` shows *was*
changed (a "Linting" section update adding the three new rules and the
@@ -833,14 +833,14 @@ No new false positives or false negatives found in this pass.
**Test-count and case-count reconciliation, exact again.** `#[test]`
counts: `signals.rs` 23 (+2), `unused_signal.rs`/`undriven_net.rs`/
`multiply_driven.rs` 12+15+16=43 (+6), `context.rs` 9 (unchanged),
`vfmt_server/src/lint.rs` 11 (unchanged) → **8 new unit tests**, matching
`lucisv_server/src/lint.rs` 11 (unchanged) → **8 new unit tests**, matching
the claim exactly. `.lint` `====` separators: `unused_signal` 15
(unchanged, 16 cases), `undriven_net` 19 (+4, 20 cases), `multiply_driven`
15 (+2, 16 cases) → **6 new cases**, totalling **52** (16+20+16), matching
both the round-2 claim and the arithmetic in `Status/TODO`.
**Byte-identical claim, re-verified with a fresh worktree build.** Built
HEAD (`a96c908`) in a new `git worktree`, release profile. `vfmt check
HEAD (`a96c908`) in a new `git worktree`, release profile. `lucisv check
corpus --output-format json`: stdout and stderr byte-identical to the
working tree's release build (same exit 2, same single lex-error line,
same summary line). Also diffed the new `--select <rule>` corpus outputs
@@ -884,7 +884,7 @@ extension was the correct call for the right reason: driver semantics is
a lint concept, and the binder discards the context it would need by
design. QA's force/release find was real — the fix's two independent
layers (own DriverKind; override-excludes-entirely) each carry their own
only-test-that-goes-red, verified by sabotage twice over. Default `vfmt
only-test-that-goes-red, verified by sabotage twice over. Default `lucisv
check` output stays byte-identical to HEAD, worktree-diffed by three
different people now. Accepted; M12 checked off in the umbrella plan and
TODO §8. The path to default-on runs through the workspace-index