Skip to content

SV parser keeps the sensitivity list; lowering picks the reset kind from it (reset unit 3) - #209

Open
junjihashimoto wants to merge 6 commits into
mainfrom
feat/sv-reset-kind
Open

junjihashimoto wants to merge 6 commits into
mainfrom
feat/sv-reset-kind

Conversation

@junjihashimoto

@junjihashimoto junjihashimoto commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Unit 3 of Issue sparkle-ved-reset. The design is notes/ved/VED-RESET-PARSER.md rev 2, approved at f3498fd.

Fix. The parser kept only the first edge of always @(...), and lowering made every register with a detected reset if asynchronous. A synchronous-reset register was therefore read back as asynchronous.

Change.

  • AST: alwaysBlock holds the whole sensitivity list, and the parser keeps every edge.
  • Lowering: classifies each list once into (clock, reset kind):
    • exactly one posedge clock;
    • sync: no other event;
    • async: exactly one more edge, on the detected reset as written in the source, with matching polarity, in any order;
    • same-polarity duplicates are merged into one;
    • everything else is refused with a message naming the edge: a third edge, both polarities, no-reset multi-edge, an unrelated signal, a negedge clock, * mixed with edges, an async event on a memory block, or an ambiguous same-name clock/reset.
    • Every branch uses this classification.
  • Emitter mirror prints the same list, so the round-trip contract now tells the two kinds apart. RoundtripProof carries the reset kind.
  • Docs: the Ex8_Roundtrip same-tree #guard is flipped; Ch07c and the EmitAst note are updated.

Controls. Tests/SVParser/ResetKindCheck.lean, 32 cases, accepted and refused, with the refusal messages checked.

Corpus. The XiangShan CI corpus (52 files) round-trips 52/52 before and after. 0 files changed and 0 are refused; notes/ved/VED-RESET-PARSER-corpus.md explains why: the corpus has only async posedge clock or posedge reset lists, clock-only blocks without a reset, and SRAM macros.

Out of scope: the default 0 init for registers missing from the reset branch, and general SV equivalence.

CI fix (0c775984): xiangshan-roundtrip.yml passes github-token to setup-oss-cad-suite. Without it, the action looked up releases unauthenticated, hit the per-IP API rate limit and failed the gate twice on this PR ("Unable to get download URL").

… classifies it once into (clock, reset kind); emitter mirror prints the same list
…8 guard flipped; Ch07c and EmitAst notes updated
…authenticated release lookups hit the per-IP API rate limit; runs 47242484498 attempts 1-2)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant