Fold generate-for bound reading an interface-port localparam (sub.BYT)#4115
Merged
alaindargelas merged 1 commit intoJul 14, 2026
Conversation
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>
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.
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, sosub.BYTstayed 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-levelbase.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.