Skip to content

Support VHDL loop control and IEEE logic conversions - #546

Merged
xtofalex merged 2 commits into
mainfrom
fix/vhdl-loop-control
Nov 20, 2026
Merged

xtofalex merged 2 commits into
mainfrom
fix/vhdl-loop-control

Conversation

@xtofalex

@xtofalex xtofalex commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Runtime VHDL functions and processes previously rejected exit and next inside static-range loops. This change unrolls those loops with merged loop and iteration activity flags, so transfers guard later variable updates and scheduled signal assignments. It also handles branches that mix loop transfers with function returns.

The frontend now accepts null internal array signals and variables without creating physical nets, lets architecture constants hide imported package constants, and lowers the IEEE to_bit, to_stdulogic, to_bitvector, to_stdlogicvector, and to_stdulogicvector conversions. Conversion handling checks named arguments and types, normalizes vector result bounds, and folds explicit metavalues through xmap. Synthetic regressions and loading documentation cover the resulting behavior.

Validation

  • CMake VHDL constructor suite: 284 tests passed.
  • Null-array read regressions pass with integer divide-by-zero traps enabled; invalid reads are diagnosed before stride calculations across direct, sliced, nested, and expression-result indexing.
  • VHDL lexer/parser/analyzer suites: 103 tests passed.
  • ctest --test-dir build -L determinism --no-tests=error --output-on-failure: passed, including new cross-process coverage of loop transfers, null arrays, constant hiding, conversions, live state, dumps, and snapshot round trips.
  • A synthetic 32-bit priority-counting function was proved equivalent to an independent priority encoder with kepler-formal, binary SEC at k=0, with 31/31 output bits covered. The local formal frontend required scalar gate primitives in the structural dump to be written as equivalent continuous assignments; mux and full-adder behavioral models were supplied.
  • Supplemental public-source integration audit with representative valid generic settings: 46/48 entity tops loaded. The remaining two stop at the same unsupported '-' assignment.
  • Sphinx HTML build with the built-in Alabaster theme: passed.
  • git diff --check: passed. Bazel validation was not run.

Follow-up

Selected assignments still elaborate a metavalue-only others alternative even when explicit alternatives cover every binary selector value. That handling, and the representation policy for a reachable VHDL '-', remain deferred. A follow-up should investigate general binary-domain coverage analysis with diagnostics for its assumptions, preserve explicit X/Z cases and rejection of unsupported reachable values, and add synthetic and formal regressions before changing lowering.

@codspeed

codspeed Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 13 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 111 untouched benchmarks


Comparing fix/vhdl-loop-control (9c05af9) with main (f1db5dd)

Open in CodSpeed

@codecov-commenter

codecov-commenter commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.95376% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/nl/formats/vhdl/VHDLRTLConstructor.cpp 95.95% 7 Missing ⚠️

📢 Thoughts on this report? Let us know!

@xtofalex
xtofalex merged commit 26ad2f5 into main Nov 20, 2026
92 checks passed
@xtofalex
xtofalex deleted the fix/vhdl-loop-control branch November 20, 2026 09:37
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.

2 participants