Repository navigation
fix(sv): preserve guarded division types through casts - #1766
Merged
Conversation
Casts of divisions and remainders could fail with unknown operand signedness because the internal zero-divisor guard has an untyped unknown arm. Infer the guard's signedness and width from its operation, and avoid inserting guards again when binding an enclosing expression. This also preserves signed arithmetic in four-state lowering instead of creating nested unsigned muxes. Evaluate signing-cast operands in their original type before changing the result sign, so unsigned'(a / b) does not turn a signed division unsigned. Add two shared regressions for mixed signs, parameter divisors, narrowing, nested divisions, signing/type casts, and four-state zero-divisor results. Validation: - Full SV suite: 3952 passed, 20 existing ignored across five backends. - Analyzer unit tests: 791 passed, 3 existing ignored. - Shared suite unit tests: 46 passed, 2 existing ignored. - Icarus: both new cases passed. Verilator: ordinary case passed; the adapter reports the four-state case unsupported due to four-state expectations. - Affected library/harness Clippy (-D warnings), cargo fmt and diff checks pass. - Unchanged Taxi sources with O1/two-state pass 29 cocotb tests across mac_ctrl_rx[8], mac_ctrl_tx[8], and zircon_ip_len_cksum[32], with zero skips. Three other previously cast-blocked configurations now reach existing $size or SERDES array-range blockers. All 52 resolved SV source fingerprints match the original audit; no optimization settings or exclusions changed. Change-Id: I560b79b58966e9083629921a4dbf6563ff5d09f3
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. |
Contributor
Merge Queue Status
This pull request spent 1 hour 53 minutes 57 seconds in the queue, including 1 hour 10 minutes 18 seconds running CI. Required conditions to merge
|
This was referenced Oct 22, 2026
mergify
Bot
deleted the
stack/tignear/fix/sv-guarded-division-casts/preserve-guarded-division-types-casts--560b79b5
branch
October 22, 2026 20:23
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.
Casts of divisions and remainders could fail with unknown operand signedness
because the internal zero-divisor guard has an untyped unknown arm. Infer the
guard's signedness and width from its operation, and avoid inserting guards
again when binding an enclosing expression. This also preserves signed
arithmetic in four-state lowering instead of creating nested unsigned muxes.
Evaluate signing-cast operands in their original type before changing the
result sign, so unsigned'(a / b) does not turn a signed division unsigned.
Add two shared regressions for mixed signs, parameter divisors, narrowing,
nested divisions, signing/type casts, and four-state zero-divisor results.
Validation:
reports the four-state case unsupported due to four-state expectations.
mac_ctrl_rx[8], mac_ctrl_tx[8], and zircon_ip_len_cksum[32], with zero skips.
Three other previously cast-blocked configurations now reach existing
$size or SERDES array-range blockers. All 52 resolved SV source fingerprints
match the original audit; no optimization settings or exclusions changed.