Repository navigation
feat(sv): support tagged packed unions - #1883
mergify[bot] merged 1 commit into
Conversation
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 63c6fe0185
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
63c6fe0 to
f157ae2
Compare
Revision history
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f157ae208a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
f157ae2 to
23e5076
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 23e5076ac4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
23e5076 to
7eae8d9
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7eae8d9206
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if plan.tag.payload_width > width { | ||
| parts.push(Expr::Literal(format!( | ||
| "{}'bx", | ||
| plan.tag.payload_width - width | ||
| ))); |
There was a problem hiding this comment.
Compare only the active payload in tagged-union equality
In four-state simulation, constructors fill unused payload bits with X, but Finish::Binary in expression_binding/direct.rs still lowers tagged-union equality as ordinary packed-vector equality. For a union with void Empty and an eight-bit Full member, assigning tagged Empty to two variables and comparing them with == therefore produces X instead of true. Tagged-union equality must compare the tags and then only the active member's value, ignoring unused payload bits; otherwise comparisons involving void or shorter members return incorrect results.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Tracked in #1889. The observed X equality was reproduced, but the requested active-payload-only semantics still need a normative basis. The issue records the checked clauses and resolution criteria. Equality is unchanged; leaving this thread unresolved pending that investigation.
7eae8d9 to
4810a3e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4810a3e9cc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
4810a3e to
e69a9ed
Compare
|
Queued — the merge queue status continues in this comment ↓. |
e69a9ed to
3d77a16
Compare
Support scalar SystemVerilog tagged packed unions following IEEE 1800-2023 7.3.2 and 11.9: constructors and void members, nested/struct payloads, casts, context-typed function returns and argument defaults, signed values and wide four-state data. Defaults bind in the enclosing declaration scope. Check active tags on reads and writes, including output/inout arguments and system-function destinations/seeds. Retain writable actuals separately from their checks and recheck before copy-out. Preserve assignment sizing before checked temporaries, and keep checks effectful during expression inlining so unused arguments cannot discard them. Conditional and short-circuit paths only check accesses that execute. Require nominally compatible whole-union assignments, port connections and output/inout copy-out, including output-port concatenation elements. Reject integral formals/system outputs that could fabricate tags. Unpacked tagged unions, pattern matching and continuous or concatenation member drivers remain unsupported; port constructor expressions require an intermediate typed signal. Evaluate active tagged-member reads in constant functions while preserving guards, widths and signs. Reject time-function and timescale-query values before expression fast paths can bypass tagged-target type checks. Fixes #1909 Fixes #1910 Add nine portable shared cases and Celox runtime-error/type-rejection tests. Verilator 5.052 rejects seven two-state cases and cannot run the two four-state cases; Icarus 13.0 rejects all nine. Retain reviewed diagnostics without skipping cases or changing assertions, with both Rust and JS baseline checks. The review request for active-payload-only equality remains a specification investigation in #1889, with a four-state reproducer and the checked LRM clauses. It is not yet a confirmed defect; whole-value equality remains unchanged. Validation: - Prior full SystemVerilog integration suite: 4,540 passed, 20 existing ignored. - Updated tagged-union regressions: 68 passed across configured backends, including constant widths, signed and nested payloads, lazy branches and invalid tags. - Updated analyzer suite after master synchronization: 803 passed, 3 existing ignored; doctests passed. - SV frontend unit tests and doctests from the preceding revision. - Affected-crate and SystemVerilog test-target Clippy; cargo fmt --check. - Shared-suite retained-report tests and external report gates. - All 2,054 official sv-tests CI verdicts match the reviewed expectations; the tagged packed union simulation now passes in both state modes. - External changed cases with Verilator and Icarus; reviewed failures above. - node --test scripts/check-external-suite-report.test.mjs. Change-Id: I170d94817a52f2d1b382daf800f3908d8e94d5c3
3d77a16 to
da00920
Compare
Merge Queue Status
This pull request spent 2 hours 4 minutes 37 seconds in the queue, including 2 hours 3 minutes 19 seconds running CI. Required conditions to merge
|
Support scalar SystemVerilog tagged packed unions following IEEE 1800-2023
7.3.2 and 11.9: constructors and void members, nested/struct payloads, casts,
context-typed function returns and argument defaults, signed values and wide
four-state data. Defaults bind in the enclosing declaration scope.
Check active tags on reads and writes, including output/inout arguments and
system-function destinations/seeds. Retain writable actuals separately from
their checks and recheck before copy-out. Preserve assignment sizing before
checked temporaries, and keep checks effectful during expression inlining so
unused arguments cannot discard them. Conditional and short-circuit paths
only check accesses that execute.
Require nominally compatible whole-union assignments, port connections and
output/inout copy-out, including output-port concatenation elements. Reject
integral formals/system outputs that could
fabricate tags. Unpacked tagged unions, pattern matching and continuous or
concatenation member drivers remain unsupported; port constructor expressions
require an intermediate typed signal.
Evaluate active tagged-member reads in constant functions while preserving
guards, widths and signs. Reject time-function and timescale-query values
before expression fast paths can bypass tagged-target type checks.
Fixes #1909
Fixes #1910
Add nine portable shared cases and Celox runtime-error/type-rejection tests.
Verilator 5.052 rejects seven two-state cases and cannot run the two four-state
cases; Icarus 13.0 rejects all nine. Retain reviewed diagnostics without
skipping cases or changing assertions, with both Rust and JS baseline checks.
The review request for active-payload-only equality remains a specification
investigation in #1889, with a four-state reproducer and the checked LRM clauses.
It is not yet a confirmed defect; whole-value equality remains unchanged.
Validation:
constant widths, signed and nested payloads, lazy branches and invalid tags.
the tagged packed union simulation now passes in both state modes.