Skip to content

fix(codegen): iverilog-clean gen-verilog + BPSK modem spec#1250

Merged
gHashTag merged 1 commit into
masterfrom
fix/gen-verilog-on-master
Jul 1, 2026
Merged

fix(codegen): iverilog-clean gen-verilog + BPSK modem spec#1250
gHashTag merged 1 commit into
masterfrom
fix/gen-verilog-on-master

Conversation

@gHashTag

@gHashTag gHashTag commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Closes #1245. Makes t27c gen-verilog emit iverilog-compilable, simulatable RTL for datapath specs, and adds the trios-mesh BPSK modem core as specs/fpga/bpsk.t27.

Backend fixes (bootstrap/src/compiler.rs)

  1. const/var run dropparse_const_decl now consumes the trailing ; (a stray ; made the module-body loop skip subsequent decls). uart: 1 -> 8 localparams, 31 -> 0 iverilog errors.
  2. literals0x/0b/_ integer literals render as decimal (valid Verilog).
  3. guarded early return — rewritten to if/else so the return is not clobbered (last-write-wins).
  4. struct-field regs — declared under the holding var name (matches field access).
  5. zero-arg functions — get an unused dummy input (Verilog forbids port-less functions).
  6. named begin blocks — Verilog-2001 forbids local decls in unnamed blocks.

Existing ExprCast cast handling kept as-is (master's validated version).

New specs/fpga/bpsk.t27 (ZeroDSP_BPSK)

BPSK serializer + Barker-13 preamble + integer correlator + threshold sync. iverilog-compiles AND simulates: 13 embedded test assertions pass; hierarchical checks give correlate(Barker)=13, inversion=-13, sidelobes -5/+5, sync gate, frame=21. uart/mac now iverilog-clean too (fpga clean 1 -> 3 of 34).

Validation

  • suite: parse / typecheck / gen(Zig/Rust/Verilog/C) 514/514.
  • No numeric/L6 change. Follow-up: committed seals for other specs whose Verilog changed need a reseal sweep (not included here to keep the diff focused).

phi^2 + phi^-2 = 3 | TRINITY

Port of the gen-verilog/parser fixes to master so datapath specs compile &
simulate: (1) parse_const_decl consumes trailing ';' -> consecutive const/var
runs no longer dropped (uart 1->8 localparams, 31->0 iverilog errors);
(2) integer literals render as decimal (0x/0b/_ -> valid Verilog); (3) guarded
early return rewritten to if/else; (4) struct-field regs named by the holding
var; (5) zero-arg functions get a dummy input; (6) function bodies use named
begin blocks. Existing ExprCast handling kept.

New specs/fpga/bpsk.t27 (ZeroDSP_BPSK, trios-mesh BPSK modem core) iverilog-
compiles AND simulates: 13 embedded test assertions pass; correlate(Barker)=13,
inversion=-13, sidelobes -5/+5, sync gate, frame=21. uart/mac clean too.

Closes #1245
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 1, 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 Jul 1, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-07-01 19:07:10 UTC

Summary

Status Count
Total Open PRs 15
PRs with Failing Checks 9
PRs with All Checks Green 6
READY 4
FAILING 9
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=16664105c99c != manifest seal=49e55df6d444.
    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 701d79b into master Jul 1, 2026
26 of 28 checks passed
@gHashTag
gHashTag deleted the fix/gen-verilog-on-master branch July 1, 2026 19:11
gHashTag added a commit that referenced this pull request Jul 2, 2026
#1255)

Reseal every spec so suite seal-verify is green after the gen-verilog change
(#1250) shifted gen-hashes for most specs; also clears pre-existing spec-hash
drift + missing seals. Three spec pairs shared a module name and collided on
their <dir>_<Module>.json seal (FeedForward, String, malformed "[]const u8") ->
rename the second of each pair (FeedForwardNetwork / SacredGovernance /
FacultyBoard). Suite: parse/typecheck/gen(x4)/seal-verify 514/514.

Closes #1254

Co-authored-by: gHashTag <deborahnelson8788726@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.

gen-verilog: 5 lowering defects block iverilog-clean RTL from non-trivial specs

2 participants