Repository navigation
fix(sv): keep the bit ranges a child reads from its input ports - #1960
Merged
Merged
Conversation
Flattening splits combinational paths at the bit boundaries each variable is accessed at, and propagates boundaries across port connections. Input ports only passed the parent's boundaries to the child, so where a child read its input port in parts the connected parent variable stayed one range. A parent that fed other bits of the child's output back into that variable then formed a combinational loop that does not exist; written in one module, the same logic simulates. The boundaries of the child port now propagate to the parent variable when the connection is one range as wide as the port, mapped onto that range, so the parent is split as it is when it reads the bits itself. Closes #1955 Change-Id: I24f244b6bb1f0b940eef0f1fbae08573ca011747
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
|
Queued — the merge queue status continues in this comment ↓. |
Contributor
Merge Queue Status
This pull request spent 40 minutes 38 seconds in the queue, including 39 minutes 10 seconds running CI. Required conditions to merge
|
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.
Closes #1955.
What
A combinational path through a child module's input port lost bit precision, so Celox reported a combinational loop that does not exist. Written in a single module, the same logic simulates. rtlmeter's C906 hits this between
aq_ifu_pcgenandaq_ifu_btb. A minimal repro:Before:
Combinational loop detected: tar[7:0] -> b.tar[7:0] -> b.ifpc_in[7:4] -> ifpc_out[7:0] -> fetch[3:0]. Icarus and Verilator print59.Why
Flattening atomizes combinational paths at the bit boundaries each variable is accessed at (
propagate_boundaries→atomize_logic_paths). Boundaries cross port connections in both directions for output ports, but only parent → child for input ports. The child readsifpc_in[7:4], but the parent'sifpc_outnever got the boundary at bit 4. It stayed one nodeifpc_out[7:0], which depends onfetch[3:0], and that closed the cycle. In one module the readifpc_out[7:4]itself gives the boundary.Fix
propagate_boundariesnow also propagates the child port's boundaries to the parent variable when the input connection is a single range as wide as the port. They are mapped onto that range, so.ifpc_in(x[11:4])splitsxat 8. Other connection expressions keep the current behavior.Validation
hierarchy::child_ports_keep_the_bit_ranges_they_read(the repro) andhierarchy::child_ports_keep_the_bit_ranges_of_selected_connections(a part-select connection) pass on every Celox backend,verify-sv-icarus2/2 andverify-sv-verilator2/2.cargo nextest run -p celox -p celox-frontend-core -p celox-frontend-sv -p celox-frontend-veryl -p celox-test-suite -p celox-vpi --features celox/systemverilog: 14595 passed.retained_reportspasses; sv-tests verdicts are unchanged. Clippy (workspace, all targets) and fmt are clean.Performance
Callgrind, release profile,
b2_vm_dispatch_bit.sv(200k cycles), master de79c93 vs this branch: simulation (step_until, inclusive) is identical at 4,188,404,075. The whole process is 51,003,705,225 vs 51,003,789,351 (+0.0002%).