Skip to content

UHDM: a function-local UNPACKED array keeps one value per element -- st[0] ^ st[1] folded to 1 - #4206

Merged
alaindargelas merged 1 commit into
chipsalliance:masterfrom
alaindargelas:expreval-func-local-array-elements
Oct 4, 2026
Merged

alaindargelas merged 1 commit into
chipsalliance:masterfrom
alaindargelas:expreval-func-local-array-elements

Conversation

@alaindargelas

Copy link
Copy Markdown
Collaborator

Bumps UHDM to chipsalliance/UHDM#1161 (7c42de4).

ExprEval::setValueInInstance found a function-local reg [57:0] st [0:1] through getObject and took the flat packed-vector path: the variable's typespec is the ELEMENT's [57:0], so each element assignment wrote one bit at position index and the element read it back as that bit. st[0] ^ st[1] folded to 1 (verilog-ethernet's lfsr_mask, and every constant function that stages a table in a local array). An array_var now stores per element in a param_assign/array_expr, the representation reduceExpr's bit_select case already reads.

Test: tests/FuncLocalArrayElemFold with direct, for-loop and while-loop element reads of a local array; every output folds to 64'h0300000000000001.

Regression: 828 PASS / 1 DIFF / 0 FAIL. The one DIFF is the intended correction: TfItemUnpackedLocal's f0 now folds to 64'hC000000180000001, the XOR of its four table entries (was 1). Both goldens refreshed and ${SURELOG_DIR}-normalized.

Prepared with the assistance of Claude Code.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XshwvRJtjR5dA48M4b1CLM

…`st[0] ^ st[1]` folded to 1

Bumps UHDM for chipsalliance/UHDM#1161: ExprEval's setValueInInstance found
a function-local `reg [57:0] st [0:1]` through getObject and took the flat
packed-vector path -- the variable's typespec is the ELEMENT's `[57:0]`, so
each element assignment wrote ONE bit at position `index` and the element
read it back as that bit: `st[0] ^ st[1]` folded to 1 (verilog-ethernet's
lfsr_mask, and every constant function that stages a table in a local
array).  An array_var now stores per element in a param_assign/array_expr,
the representation reduceExpr's bit_select case already reads.

tests/FuncLocalArrayElemFold: direct, for-loop and while-loop element reads
of a local array; every output folds to 64'h0300000000000001.  Golden
refresh: TfItemUnpackedLocal's `f0` now folds to 64'hC000000180000001, the
XOR of its four table entries (was 1).

Prepared with the assistance of Claude Code.
@alaindargelas
alaindargelas merged commit 2e14585 into chipsalliance:master Oct 4, 2026
28 of 31 checks passed
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