vlog_parser: a direction-less first ANSI port parses
IEEE 1800 §23.2.2.2 allows an ANSI header's first port to carry no
direction — the normal spelling for interface ports — but
parse_port_list classified any leading identifier as a non-ANSI list
and errored on what followed. One clause fixes it: a leading Ident is
ANSI when the parser's existing type-then-name lookahead
(at_typed_declarator, which already walks pkg:: chains, #() overrides
and packed dims) or the new 4-token modport lookahead (ident.ident
ident) says so; the complement is exactly the old non-ANSI list, and
macro-led lists never enter the clause. bus_if.mp was a second,
independent gap (it parsed in no position before) and is glued into
DataType::name the way pkg::t already was. No AST change — the new
ports are AnsiPort { dir: None }, the shape later ports always had.
Two match-widenings ride along: bind_data_type and type_def's
type_span read the pre-dot half as the type, and the modport half is
bindable by nothing — pinned for rename by QA.
The safety case, established twice (dev, then QA independently via a
worktree build): corpus 813/820 both sides, TSVs byte-identical, and
all 820 formatted outputs SHA-256-identical across the change; zero
snapshot churn; verify.rs untouched. QA's boundary AST-diff harness
(~20 shapes at the classification edge) and a 50-file
direction-stripping fuzz sweep found no misfire. The
previously-blocked fixtures flipped to first-port order; instantiate
now plans interface-typed port lists instead of refusing. The two
remaining unsupported shapes (generic interface ports, virtual
modport declarations) are pinned by a lead-added test so a future
round changes them on purpose.
24 tests added (dev 21 + QA 2 + lead 1).
docs/features/ansi-first-port/README.md
Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
662e323802
commit
839a28ec8d
10 files changed
+851
-31
No files matched your search
@@ -122,15 +122,22 @@ neither was done there:
|
||||
the request above lands, that function is deleted and nothing else in this
|
||||
module changes. *(It landed; the function is gone and nothing else in this
|
||||
module changed.)*
|
||||
2. **`vlog_parser`: an ANSI header whose *first* port carries no direction does
|
||||
not parse.** `module m (bus_if bus, input logic clk);` becomes an `Error`
|
||||
item, while `module m (input logic clk, bus_if bus);` parses fine — the
|
||||
list is classified ANSI-or-not from its first element, and a bare
|
||||
`type name` pair reads as neither a non-ANSI name list nor a directed port.
|
||||
`module m (bus_if.mp bus)` (a modport-qualified port) and
|
||||
`module m (my_pkg::state_t s)` do not parse either. Not this feature's to
|
||||
fix, and not a regression it caused: the tests here write the interface
|
||||
port second and say why.
|
||||
2. ~~**`vlog_parser`: an ANSI header whose *first* port carries no direction
|
||||
does not parse.**~~ **Delivered 2026-08-26 by `ansi-first-port`**
|
||||
(`docs/features/ansi-first-port/README.md`): the port list is now
|
||||
classified ANSI-or-not by what *follows* the first identifier, so all three
|
||||
shapes parse into ordinary `AnsiPort`s with `dir: None`, and
|
||||
`an_interface_port_reaches_its_interface` was flipped to write the
|
||||
interface port first (with the second-port ordering kept as its own
|
||||
assertion). Two tests were added here with it — a modport-qualified port
|
||||
and a package-scoped first port. The original request read: `module m
|
||||
(bus_if bus, input logic clk);` becomes an `Error` item, while `module m
|
||||
(input logic clk, bus_if bus);` parses fine — the list is classified
|
||||
ANSI-or-not from its first element, and a bare `type name` pair reads as
|
||||
neither a non-ANSI name list nor a directed port. `module m (bus_if.mp
|
||||
bus)` (a modport-qualified port) and `module m (my_pkg::state_t s)` do not
|
||||
parse either. Not this feature's to fix, and not a regression it caused:
|
||||
the tests here write the interface port second and say why.
|
||||
|
||||
## Status / TODO
|
||||
|
||||
@@ -159,6 +166,13 @@ neither was done there:
|
||||
were renamed and one changed behavior (a `package` of the type's name is
|
||||
now answered as `definition` answers it), each argued in that feature's
|
||||
work log.
|
||||
- [x] **Handshake 2 landed (2026-08-26, `ansi-first-port`):** the three header
|
||||
shapes parse, so `an_interface_port_reaches_its_interface` writes the
|
||||
interface port first (both orderings asserted), and two tests joined it —
|
||||
`a_modport_qualified_port_reaches_its_interface` and
|
||||
`a_package_scoped_first_port_reaches_its_typedef`. `type_span` matches a
|
||||
type name by the half before its `.` as well as by its last `::`
|
||||
segment, which is the one production line that changed. 47 tests.
|
||||
- [x] One e2e round trip: the capability in the real handshake, a cross-file
|
||||
package typedef, and a built-in answered with an empty array.
|
||||
- [x] TODO.md §9c checkbox; `docs/features/lucisv-server/README.md` capability
|
||||
@@ -357,6 +371,28 @@ neither was done there:
|
||||
one-hop rule, the conventions — is unchanged. Full rationale, consumer audit
|
||||
and corpus measurement: `docs/features/overlay-promotion/README.md`.
|
||||
|
||||
### 2026-08-26 — ansi-first-port dev agent (Handshake 2 landing)
|
||||
|
||||
- **The fixtures that wrote the port second are flipped.**
|
||||
`an_interface_port_reaches_its_interface` now declares
|
||||
`module m (bus_if bus, input logic clk);` — the spelling an interface port
|
||||
is actually written in — and keeps the old ordering as a second module in
|
||||
the same fixture, so the shape that used to be the only one that parsed is
|
||||
still pinned. Two tests joined it:
|
||||
`a_modport_qualified_port_reaches_its_interface` and
|
||||
`a_package_scoped_first_port_reaches_its_typedef`.
|
||||
- **One production line changed here, and it is a widening of a match, not of
|
||||
an answer.** `type_span` already matched a site's type name by its last
|
||||
`::` segment (a qualified type is two references and the second is the one
|
||||
worth jumping to); it now also matches the half before a `.`, because
|
||||
`vlog_parser` glues an interface port's modport onto the type name the same
|
||||
way it glues a `pkg::` qualifier, and `bind_data_type` records the interface
|
||||
half. Nothing else in this module moved: the answer is still
|
||||
`nav::definition` of a name the binder itself recorded, so a wrong jump
|
||||
would have to be a wrong *reference*, not a wrong match.
|
||||
- Full rationale, the parser change and the corpus measurement:
|
||||
`docs/features/ansi-first-port/README.md`.
|
||||
|
||||
## QA log
|
||||
|
||||
### 2026-08-26 — QA agent (continuation of an interrupted run)
|
||||
|
||||
Reference in new issue
Block a user