Skip to content

Fold interface-port localparam generate bound nested in a generate block#4116

Merged
alaindargelas merged 1 commit into
chipsalliance:masterfrom
alainmarcel:fix-iface-localparam-nested-generate
Jul 14, 2026
Merged

Fold interface-port localparam generate bound nested in a generate block#4116
alaindargelas merged 1 commit into
chipsalliance:masterfrom
alainmarcel:fix-iface-localparam-nested-generate

Conversation

@alaindargelas

Copy link
Copy Markdown
Collaborator

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.

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>
@alaindargelas
alaindargelas merged commit 07c76c5 into chipsalliance:master Jul 14, 2026
6 of 14 checks passed
@linux-foundation-easycla

Copy link
Copy Markdown

CLA Missing ID

  • ✅ login: alaindargelas / name: alaindargelas (12e466e)
  • ❌ The email address for the commit (12e466e) is not linked to the GitHub account, preventing the EasyCLA check. Consult this Help Article and GitHub Help to resolve. (To view the commit's email address, add .patch at the end of this PR page's URL.) For further assistance with EasyCLA, please visit our EasyCLA portal and chat with our support bot.

One or more co-authors of this pull request were not found. You must specify co-authors in commit message trailer via:

Co-authored-by: name <email>

Supported Co-authored-by: formats include:

  1. Anything <id+login@users.noreply.github.com> - it will locate your GitHub user by id part.
  2. Anything <login@users.noreply.github.com> - it will locate your GitHub user by login part.
  3. Anything <public-email> - it will locate your GitHub user by public-email part. Note that this email must be made public on Github.
  4. Anything <other-email> - it will locate your GitHub user by other-email part but only if that email was used before for any other CLA as a main commit author.
  5. login <any-valid-email> - it will locate your GitHub user by login part, note that login part must be at least 3 characters long.

Alternatively, if the co-author should not be included, remove the Co-authored-by: line from the commit message.

Please update your commit message(s) by doing git commit --amend and then git push [--force] and then request re-running CLA check via commenting on this pull request:

/easycla

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