Skip to content

fix(compiler): const→reg in Verilog codegen, 5 FPGA specs parse in Yosys#363

Merged
gHashTag merged 1 commit intomasterfrom
fix/fpga-const-reg-codegen
Apr 8, 2026
Merged

fix(compiler): const→reg in Verilog codegen, 5 FPGA specs parse in Yosys#363
gHashTag merged 1 commit intomasterfrom
fix/fpga-const-reg-codegen

Conversation

@gHashTag
Copy link
Copy Markdown
Owner

@gHashTag gHashTag commented Apr 8, 2026

Summary

  • const→reg fix: Function-local const declarations now emit reg in Verilog instead of commented-out // const. This makes variables visible to Yosys and fixes cascading parse errors.

Verification

Module Yosys Parse Yosys synth_xilinx
uart.v PASS PASS
spi.v PASS PASS
top_level.v PASS PASS
mac.v PASS FAIL (parser-level 0 = ... issue)
bridge.v PASS FAIL (parser-level & & issue)
zerodsp_top (wrapper) PASS PASS (3 submodules)

Full synthesis with UART + SPI + TopLevel: 112 cells, 27 FDRE, 3 submodules.

Closes #359

Previously, const declarations in function bodies were emitted as
commented-out '// const ...' in Verilog, making variables invisible to
the synthesizer and causing cascading errors (assignments to 0).

Now both const and var declarations emit 'reg' in Verilog, which is
correct for function-local variables in synthesizable RTL.

Also: all 5 FPGA specs pass Yosys Verilog frontend parsing.
Synthesis passes with 3 instantiated modules (UART, SPI, TopLevel).
MAC and Bridge have remaining parser-level issues (tracked separately).

Closes #359
@gHashTag gHashTag merged commit 4ff2815 into master Apr 8, 2026
8 checks passed
gHashTag pushed a commit that referenced this pull request Apr 14, 2026
Closes #363

Co-Authored-By: Claude Opus 4.6 <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.

feat(fpga): instantiate UART/SPI/TopLevel modules in synthesis, fix type-suffixed literals

1 participant