Repository navigation
Store associative array elements of multi-dimensional, offset and ascending packed types (§7.8, §7.4.1, #958) - #959
Closed
chuanseng-ng wants to merge 6 commits into
Closed
chuanseng-ng wants to merge 6 commits into
chuanseng-ng wants to merge 6 commits into
Conversation
…ending packed types (§7.8, §7.4.1, aionhw#958)
…nding packed types (§7.8, §7.4.1, aionhw#958)
…nding packed types (§7.8, §7.4.1, aionhw#958)
chuanseng-ng
force-pushed
the
fix/assoc-packed-elem
branch
from
November 9, 2026 01:12
53a2c8f to
f39388b
Compare
Owner
|
Integrated by cherry-pick with @chuanseng-ng's authorship preserved: f33558ea, 434a7be0 (#956, the commits of #957) and 204cfcd8, 80ac751a (#958). Follow-up 0741c8fe, 41ef2995: a part-select of a multi-dimensional packed element ( Published in xezim 603c9bf3 with xezim-core 212dde0. |
This was referenced Nov 9, 2026
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.
Fixes #958. Builds on #957: this branch contains its three commits, and the last three commits are this change.
An associative array's packed type describes its elements (§7.8, §7.4.1). For
logic [3:0][7:0] p [int],logic [8:1] r [int]andlogic [0:7] u [int],p[1] = 32'h11223344,r[1] = 8'h02andu[1] = 8'h80made no associative entry: the bookkeeping that describes a plain packed vector was also kept under the array's name, and the generic select paths tookp[1]as a select into a scalar signal namedpbefore the associative paths ran.Change.
packed_nested_select(src/compiler/simulator/collections.rs) returns early for an associative root, sop[1]is no longer read or written as packed element 1 of a scalarp.Simulator::new(src/compiler/simulator/initialization.rs) drops associative names frompacked_signal_elem_widths(which made the context-width read ofp[1]an 8-bit element) and fromascending_packed(whichcomplete_ascending_rangesfills from the packed range, makingu[1] = 8'h80a bit write). It runs aftercomplete_ascending_ranges.packed_full_dimskeeps them; the associative paths use it for selects into an element.assoc_elem_bit_write(src/compiler/simulator/assignments.rs) writes the whole slice of the leading packed dimension, sop[1][2] = 8'hFFwrites 8 bits instead of one.assoc_elem_select_read(from Read a select past an associative array's dimensions from the element (§7.8, §11.5.1, #956) #957) goes more than one packed dimension deep (p[1][1][4]).Result (ticket reproducer):
p=11223344 bits=32 n=1 p1=33 r=02 u=80/p=11ff3344343b6d75p=44 bits=8 n=0 p1=xxxxxxxx r=xx u=0/p=44p=11223344 bits=32 n=1 p1=33 r=02 u=80/p=11ff3344Tests.
tests/collections/assoc_packed_elem.rs, 6 tests, expected values from the reference simulator: a multi-dimensional element stored whole, offset and ascending elements, selects into a packed-array element, a bit of a packed-array element (p[1][1][4]), slice and bit writes into elements, and a slice write that creates an element on a 2-state array. All 6 fail on #957's branch without this change.Suite. Rebased on
5ca27d9e(pinned core5b0b02e) with #957; the only conflict was the test list intests/collections.rs. Full suite on this branch: 6348 passed, 0 failed, 1 ignored. No new clippy or rustfmt findings on the changed lines.Notes and caches. The last commit adds the
NOTES.mdentry. The change is in the interpreter and setup (src/compiler/simulator/); compiled-method instructions and the admit/decline decision are unchanged, soMETHOD_CACHE_COMPILER_SALTstays.Performance.
perfis not available on my machine (perf_event_paranoid=4), so no profile. The pruning inSimulator::newis a one-time pass over two maps at setup. On the select paths the added cost is one associative-name lookup inpacked_nested_select; the write and read helpers already ran for associative arrays.Known, not changed: an out-of-range part-select into an element's packed dimension (
p[1][15:8]onlogic [3:0][7:0]) reads the in-range byte instead of X; it is not covered by the tests.