Skip to content

test(gen-verilog): guard nested-if/else reg-decl hoist (#1741) - #1751

Merged
gHashTag merged 1 commit into
masterfrom
claude/youthful-dewdney-e29e8e
Aug 6, 2026
Merged

gHashTag merged 1 commit into
masterfrom
claude/youthful-dewdney-e29e8e

Conversation

@gHashTag

@gHashTag gHashTag commented Aug 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds a regression test for the gen-verilog function-local reg hoist, covering the nested if/else shape that the existing test (while_loop_with_locals_lowers_and_elaborates) did not exercise.

The emitter fix itself already landed in master via #1741 (fix(gen-verilog): hoist function-local reg decls to body top). This PR is test-only (plus a docs/NOW.md entry) — it locks in the exact scenario that motivated #1741 so it cannot silently regress.

Refs #1697 (harden the codegen backend / conformance).

What the new test does

nested_if_else_locals_lower_and_elaborate reproduces the gft_mul_offset_full_p shape:

  • a second same-block local declared after a leading statement (carry; carry = ...; sum;)
  • a local declared inside an else branch (result)

It asserts:

  1. all locals (carry, sum, result) are declared before the first statement in begin : mul_offset_body,
  2. none are re-declared mid-block, and
  3. the output elaborates under iverilog -g2012 (skips gracefully when iverilog is absent).

Verified that this test fails against the pre-#1741 emitter (interleaved reg [31:0] sum; → iverilog exit 2) and passes on current master.

Test

cargo test --release --test verilog_decl_hoist
# 2 passed

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-08-06 08:34:24 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 1
PRs with All Checks Green 49
READY 0
FAILING 1
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=9393a1c6258f != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

The existing #1741 regression test covered only the while-loop shape. Add a
second case reproducing GF-T's gft_mul_offset_full_p: a second same-block local
declared after a leading statement (carry; carry=...; sum;) plus a local inside
an else branch (result). On the pre-fix emitter this emitted a reg declaration
after a procedural statement, which iverilog -g2012 rejects. Asserts all locals
are hoisted before the first statement, none re-declared mid-block, and the
output elaborates under Icarus Verilog. Also refreshes docs/NOW.md.

Refs #1697

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@gHashTag
gHashTag force-pushed the claude/youthful-dewdney-e29e8e branch from 4f648b5 to 48789b1 Compare August 6, 2026 08:42
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-08-06 08:43:12 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 0
PRs with All Checks Green 50
READY 0
FAILING 0
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=9393a1c6258f != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag
gHashTag merged commit a892b46 into master Aug 6, 2026
18 checks passed
@gHashTag
gHashTag deleted the claude/youthful-dewdney-e29e8e branch October 26, 2026 04:51
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