Skip to content

Fold generate-for bound reading an interface-port localparam (sub.BYT)#4115

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

Fold generate-for bound reading an interface-port localparam (sub.BYT)#4115
alaindargelas merged 1 commit into
chipsalliance:masterfrom
alainmarcel:fix-iface-localparam-generate-bound

Conversation

@alaindargelas

Copy link
Copy Markdown
Collaborator

A generate-for whose loop bound reads an interface localparam through the interface instance/port — for (i=0; i<sub.CFG_BUS_BYT; i++) in a module that takes the interface as a port — was silently dropped: the interface INSTANCE is not yet bound to the port at generate-elaboration time, so sub.BYT stayed a non-constant hier_path, getValue returned invalidValue, and the whole loop produced 0 gen scopes. This is the jeras/rp32 tcb_lite_lib_logsize2byteena byte-enable / read-data reshaping loops, whose absence left the fetch/read data path (sub.rsp.rdt) undriven (X) in the degu SoC.

Resolve such a <port>.<member> value read from the port's interface TYPE definition instead of the (not-yet-bound) instance: new CompileHelper::resolveInterfacePortMember looks up the port Signal on the component, gets its interface def (Signal::getInterfaceDef, or by type name), and evaluates the member param/localparam in that definition's context, returning the constant. Hooked in compileSelectExpression once the full dotted hname is known, for a plain 2-level base.member (no selects/brackets) under Reduce::Yes; deeper struct-field paths (sub.CFG.BUS.MOD) are left untouched.

New regression: tests/GenForIfaceLocalparamBound (asserts work@top.c.g[0..3]
are elaborated). Full regression: 784 PASS, 0 failures.

A generate-for whose loop bound reads an interface localparam through the
interface instance/port — `for (i=0; i<sub.CFG_BUS_BYT; i++)` in a module that
takes the interface as a port — was silently dropped: the interface INSTANCE is
not yet bound to the port at generate-elaboration time, so `sub.BYT` stayed a
non-constant hier_path, getValue returned invalidValue, and the whole loop
produced 0 gen scopes.  This is the jeras/rp32 tcb_lite_lib_logsize2byteena
byte-enable / read-data reshaping loops, whose absence left the fetch/read data
path (`sub.rsp.rdt`) undriven (X) in the degu SoC.

Resolve such a `<port>.<member>` value read from the port's interface TYPE
definition instead of the (not-yet-bound) instance: new
CompileHelper::resolveInterfacePortMember looks up the port Signal on the
component, gets its interface def (Signal::getInterfaceDef, or by type name),
and evaluates the member param/localparam in that definition's context,
returning the constant.  Hooked in compileSelectExpression once the full dotted
hname is known, for a plain 2-level `base.member` (no selects/brackets) under
Reduce::Yes; deeper struct-field paths (`sub.CFG.BUS.MOD`) are left untouched.

New regression: tests/GenForIfaceLocalparamBound (asserts work@top.c.g[0..3]
are elaborated).  Full regression: 784 PASS, 0 failures.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@alaindargelas
alaindargelas merged commit 367047f into chipsalliance:master Jul 14, 2026
5 of 13 checks passed
@linux-foundation-easycla

Copy link
Copy Markdown

CLA Missing ID

  • ✅ login: alaindargelas / name: alaindargelas (3ef83f4)
  • ❌ The email address for the commit (3ef83f4) 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