Skip to content

feat(sv)!: support inherited randomization and rand_mode - #1787

Merged
mergify[bot] merged 1 commit into
masterfrom
stack/tignear/feat/sv-class-randomize/support-inherited-randomization-rand-mode--a8213f0f
Oct 23, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
stack/tignear/feat/sv-class-randomize/support-inherited-randomization-rand-mode--a8213f0f

Conversation

@tignear

@tignear tignear commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Randomize the concrete dynamic class through base handles, including inherited
rand properties and hooks. Add object/property rand_mode controls and temporary
randomize(member, ...) selection, with randomize(null) running hooks without
drawing values. Preserve modes through checkpoint/restore and differential checks.

Expose additional ObjectOp variants for random-mode heap operations. Constraints,
randc randomization, and non-integral randomization remain unsupported.

Add portable regressions plus wide-selection and checkpoint API tests, and update
English/Japanese reference documentation. Retain narrow external-tool exclusions:
Icarus cannot compile the four cases; Verilator passes two, but fails inherited
srandom compilation and disagrees on truncation of rand_mode's bit argument.

Validation:

  • Formatting and affected crate/test clippy checks pass.
  • Analyzer, heap, and SV frontend unit tests: 816 passed.
  • Differential SystemVerilog class tests: 159 passed.
  • Retained external evidence checks: 3 passed.
  • NAPI build and JS integration: 432 tests passed.
  • All four new shared cases exercised with Verilator and Icarus; tool limitations
    and original diagnostics retained in verification/repros.

Randomization signature discovery defers unsupported unused class layouts instead
of making unrelated interface class declarations fail. Add a regression for
inherited typedef and parameterized interface declarations.

CI regression validation: the release driver and unmodified official sv-tests
runner match all 2054 checked-in 2state/4state expectations with no baseline
changes. Analyzer unit tests (795), differential class tests (159), formatting,
and analyzer Clippy also pass after this fix.

Depends-On: #1767

@tignear

tignear commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor Author

This pull request is part of a Mergify stack:

# Pull Request Link
1 feat(sv)!: support unconstrained class randomization #1767
2 feat(sv)!: support inherited randomization and rand_mode #1787 👈

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T11:41:15.239956Z 726db2b New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@tignear
tignear force-pushed the stack/tignear/feat/sv-class-randomize/support-inherited-randomization-rand-mode--a8213f0f branch from 5c1a97b to aad2288 Compare October 23, 2026 02:39
@tignear

tignear commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Revision history

# Type Changes Reason Date
1 initial 5c1a97b 2026-10-23 02:37 UTC
2 content 5c1a97b → aad2288 Fix sv-tests regression: defer unsupported unused class layouts during randomization signature discovery. Preserve the existing conformance baseline; validate all 2054 mode runs locally. 2026-10-23 02:37 UTC
3 rebase aad2288 → 80d6a73 (rebase only) Rebase the dependent randomization controls on the refreshed base PR, preserving the sv-tests regression fix. 2026-10-23 05:49 UTC
4 rebase 80d6a73 → 726db2b (rebase only) Rebase dependent randomization controls after refreshing the base PR against master. 2026-10-23 11:36 UTC

@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 23, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aad228888b

ℹ️ 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".

Comment on lines +614 to +618
} else if let Some(owner) = native_class(tree, *expression, native, dimensions) {
(
None,
Some(owner),
bind_value(*expression, native, tree, dimensions, None)?,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject rand_mode through interface-class handles

When the receiver's static type is an interface class, native_class returns that interface here, so i.rand_mode(0) is accepted and the generated I::rand_mode dynamically mutates the implementing object's modes. Unlike randomize(), rand_mode() is not legal through an interface-class handle because the interface class has no data members, so this should produce a compile-time diagnostic rather than accepting nonconforming source (IEEE 1800-2017 §18.8).

Useful? React with 👍 / 👎.

@mergify

mergify Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

@tignear
tignear force-pushed the stack/tignear/feat/sv-class-randomize/support-inherited-randomization-rand-mode--a8213f0f branch from aad2288 to 80d6a73 Compare October 23, 2026 05:49
@tignear
tignear force-pushed the stack/tignear/feat/sv-class-randomize/support-unconstrained-class-randomization--f4e53d32 branch from 4b459d1 to f301ea0 Compare October 23, 2026 05:49

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 80d6a73b52

ℹ️ 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".

(
None,
Some(owner),
bind_value(*expression, native, tree, dimensions, None)?,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle super.rand_mode(...) as a call on this

Inside a derived instance method, an object-wide call such as super.rand_mode(0) reaches this branch because native_class resolves super to the base class, but then bind_value(super) rejects the standalone super expression. The ordinary method binder already represents a super receiver as Receiver::This; this path needs the same treatment so valid inherited rand_mode calls are not rejected during analysis.

Useful? React with 👍 / 👎.

Randomize the concrete dynamic class through base handles, including inherited
rand properties and hooks. Add object/property rand_mode controls and temporary
randomize(member, ...) selection, with randomize(null) running hooks without
drawing values. Preserve modes through checkpoint/restore and differential checks.

Expose additional ObjectOp variants for random-mode heap operations. Constraints,
randc randomization, and non-integral randomization remain unsupported.

Add portable regressions plus wide-selection and checkpoint API tests, and update
English/Japanese reference documentation. Retain narrow external-tool exclusions:
Icarus cannot compile the four cases; Verilator passes two, but fails inherited
srandom compilation and disagrees on truncation of rand_mode's bit argument.

Validation:
- Formatting and affected crate/test clippy checks pass.
- Analyzer, heap, and SV frontend unit tests: 816 passed.
- Differential SystemVerilog class tests: 159 passed.
- Retained external evidence checks: 3 passed.
- NAPI build and JS integration: 432 tests passed.
- All four new shared cases exercised with Verilator and Icarus; tool limitations
  and original diagnostics retained in verification/repros.

Randomization signature discovery defers unsupported unused class layouts instead
of making unrelated interface class declarations fail. Add a regression for
inherited typedef and parameterized interface declarations.

CI regression validation: the release driver and unmodified official sv-tests
runner match all 2054 checked-in 2state/4state expectations with no baseline
changes. Analyzer unit tests (795), differential class tests (159), formatting,
and analyzer Clippy also pass after this fix.

Change-Id: Ia8213f0f33deda93f2a187b22504f6fbb6c3cb63
@tignear
tignear force-pushed the stack/tignear/feat/sv-class-randomize/support-unconstrained-class-randomization--f4e53d32 branch from f301ea0 to ea71f96 Compare October 23, 2026 11:38
@tignear
tignear force-pushed the stack/tignear/feat/sv-class-randomize/support-inherited-randomization-rand-mode--a8213f0f branch from 80d6a73 to 726db2b Compare October 23, 2026 11:38
@mergify mergify Bot added the queued Mergify queue entry label Oct 23, 2026
@mergify

mergify Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 1 hour 6 minutes 7 seconds in the queue, including 57 minutes 42 seconds running CI.

Required conditions to merge
  • check-success = Conventional Commit title
  • check-success = Queue validation
  • depends-on = celox-sim/celox#1767 [⛓️ feat(sv)!: support unconstrained class randomization #1767]
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Lint & Format
    • check-neutral = @github-actions/Lint & Format
    • check-skipped = @github-actions/Lint & Format
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-neutral = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-skipped = @github-actions/NAPI Build (Linux ARM64 GNU)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Windows)
    • check-neutral = @github-actions/NAPI Build (Windows)
    • check-skipped = @github-actions/NAPI Build (Windows)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Rust Test & NAPI Build
    • check-neutral = @github-actions/Rust Test & NAPI Build
    • check-skipped = @github-actions/Rust Test & NAPI Build
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Ubuntu)
    • check-neutral = @github-actions/JS Test (Ubuntu)
    • check-skipped = @github-actions/JS Test (Ubuntu)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Windows)
    • check-neutral = @github-actions/JS Test (Windows)
    • check-skipped = @github-actions/JS Test (Windows)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Conventional Commit title
    • check-neutral = @github-actions/Conventional Commit title
    • check-skipped = @github-actions/Conventional Commit title

Base automatically changed from stack/tignear/feat/sv-class-randomize/support-unconstrained-class-randomization--f4e53d32 to master October 23, 2026 13:38
@mergify
mergify Bot merged commit d59616e into master Oct 23, 2026
36 of 40 checks passed
@mergify
mergify Bot deleted the stack/tignear/feat/sv-class-randomize/support-inherited-randomization-rand-mode--a8213f0f branch October 23, 2026 13:39
@mergify mergify Bot removed the queued Mergify queue entry label Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-ready Request merging through Mergify after required checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant