Fold interface-port localparam generate bound nested in a generate block#4116
Merged
alaindargelas merged 1 commit intoJul 14, 2026
Conversation
Extends resolveInterfacePortMember (interface-port localparam value read, e.g. a generate-for bound `i < sub.CFG_BUS_BYT`) to walk UP the enclosing-scope chain. When the read sits inside a nested generate block — `generate if (ALIGNED) begin: aligned for (i=0; i<sub.BYT; i++) ... end` — the compile `component` is the gen-scope definition, which has no ports; the interface port `sub` lives on the enclosing MODULE definition. Walking getParentScope() finds it, so the bound folds and the loop unrolls. This is the jeras/rp32 tcb_lite_lib_logsize2byteena aligned/unaligned byte-enable and read/write-data reshaping loops; without the walk they dropped and the degu SoC fetch/read data path (`sub_rdt`/`man_wdt`/`man.req.byt`) was undriven (X). New regression: tests/GenForIfaceLocalparamNestedGen (asserts work@top.c.aligned.g[0..3] elaborate). Full regression: 785 PASS, 0 failures. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
One or more co-authors of this pull request were not found. You must specify co-authors in commit message trailer via: Supported
Alternatively, if the co-author should not be included, remove the Please update your commit message(s) by doing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extends resolveInterfacePortMember (interface-port localparam value read, e.g. a generate-for bound
i < sub.CFG_BUS_BYT) to walk UP the enclosing-scope chain. When the read sits inside a nested generate block —generate if (ALIGNED) begin: aligned for (i=0; i<sub.BYT; i++) ... end— the compilecomponentis the gen-scope definition, which has no ports; the interface portsublives on the enclosing MODULE definition. Walking getParentScope() finds it, so the bound folds and the loop unrolls.This is the jeras/rp32 tcb_lite_lib_logsize2byteena aligned/unaligned byte-enable and read/write-data reshaping loops; without the walk they dropped and the degu SoC fetch/read data path (
sub_rdt/man_wdt/man.req.byt) was undriven (X).New regression: tests/GenForIfaceLocalparamNestedGen (asserts
work@top.c.aligned.g[0..3] elaborate). Full regression: 785 PASS, 0 failures.