Skip to content

feat(sv)!: support classes with properties, methods and constructors - #1689

Merged
mergify[bot] merged 1 commit into
masterfrom
stack/tignear/feat/string-class-heap/support-classes-props-methods-constructors--2389fee4
Oct 22, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
stack/tignear/feat/string-class-heap/support-classes-props-methods-constructors--2389fee4

Conversation

@tignear

@tignear tignear commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

SystemVerilog classes declared in a module now simulate. A class
variable is a 32-bit handle of an object in the simulator heap that
already holds strings (IEEE 1800-2023 8.4).

  • The heap keeps objects as their class id and property bytes, with the
    offsets of handle properties so that collection follows them from
    object to object. Operations through null record a fault that the
    runtime reports as a runtime error after the step.
  • The parser records class declarations: name, base, qualifiers,
    properties and methods.
  • The analyzer lays out each class (2-state integral properties up to
    64 bits, string and class handles; bases first) and rewrites
    property reads and writes into object operations that carry the
    layout. Methods become subroutines C::m whose first argument is
    this; a constructor, explicit or implicit, creates the object,
    runs the property initializers and returns the handle. Inside a
    method, properties shadow module names. extern methods use their
    out-of-block definitions; pure virtual methods and interface classes
    are not lowered.
  • A variable initialized with a bare new is kept when its type is a
    class instead of being dropped like a covergroup instance.
  • The frontend lowers object operations to calls of the heap helper.
  • Checkpoints keep objects. State files cannot record them:
    StateSchema::capture now returns a Result and fails with
    StateError::Objects while a variable holds an object.

4-state, real, array and wider properties, base-class constructors and
super, virtual method calls, static members and parameterized classes
remain unsupported.

sv-tests: 8.4, 8.5, 8.6, 8.12-assignment, 8.24, 8.26.5-implemented
class handle and 6.20.6-const now pass in both state modes (500 / 502).
Verilator and Icarus limitations on the new shared cases are recorded.

BREAKING CHANGE: StateSchema::capture returns
Result<StateFile, StateError>, StateError has an Objects variant
and ValueKind an ObjRef variant.

@tignear

tignear commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor Author

This pull request is part of a Mergify stack:

# Pull Request Link
1 feat(sv)!: support classes with properties, methods and constructors #1689 👈
2 feat(sv): support static class members, super and base constructors #1696
3 feat(sv): support virtual methods, abstract classes and interface class implementation #1724
4 feat(sv)!: support interface class handles and $cast of class handles #1758

@chatgpt-codex-connector

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 ⚠️ Failed 2026-10-21T07:03:54.847237Z
We couldn’t complete this review. Comment @codex review to try again.
dc442b6 PR opened
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@tignear
tignear force-pushed the stack/tignear/feat/string-class-heap/support-string-vars-their-operations--d79cec41 branch from a0c438a to 7539fd7 Compare October 21, 2026 07:34
@tignear
tignear force-pushed the stack/tignear/feat/string-class-heap/support-classes-props-methods-constructors--2389fee4 branch from dc442b6 to ff22f03 Compare October 21, 2026 07:34
@tignear

tignear commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Revision history

# Type Changes Reason Date
1 initial dc442b6 2026-10-21 07:33 UTC
2 content dc442b6 → ff22f03 Add the class group to the retained Verilator/Icarus reports for the excluded class cases. 2026-10-21 07:33 UTC
3 content ff22f03 → 84585ca Rebased onto master; merged conformance README, limitations and module lists with the latch/file-input/distribution changes and updated sv-tests totals to the new baseline. 2026-10-22 01:03 UTC
4 content 84585ca → d9257ae Rebased onto master; object operations in event expressions (#1681) are rejected. Derived-class properties now hide base properties of the same name (found through sv-tests 8.20), with a suite case a… 2026-10-22 04:25 UTC
5 content d9257ae → bd253bf 2026-10-22 08:43 UTC
6 content bd253bf → 20012bc 2026-10-22 14:08 UTC

@tignear
tignear force-pushed the stack/tignear/feat/string-class-heap/support-string-vars-their-operations--d79cec41 branch from 7539fd7 to ae04081 Compare October 22, 2026 01:04
@tignear
tignear force-pushed the stack/tignear/feat/string-class-heap/support-classes-props-methods-constructors--2389fee4 branch from ff22f03 to 84585ca Compare October 22, 2026 01:04
@mergify

mergify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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

@tignear
tignear force-pushed the stack/tignear/feat/string-class-heap/support-string-vars-their-operations--d79cec41 branch from ae04081 to e3cc1c1 Compare October 22, 2026 04:25
@tignear
tignear force-pushed the stack/tignear/feat/string-class-heap/support-classes-props-methods-constructors--2389fee4 branch from 84585ca to d9257ae Compare October 22, 2026 04:25
Base automatically changed from stack/tignear/feat/string-class-heap/support-string-vars-their-operations--d79cec41 to master October 22, 2026 08:00
@tignear
tignear force-pushed the stack/tignear/feat/string-class-heap/support-classes-props-methods-constructors--2389fee4 branch from d9257ae to bd253bf Compare October 22, 2026 08:44
@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 22, 2026
@mergify mergify Bot added the queued Mergify queue entry label Oct 22, 2026
@mergify

mergify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-22 10:46 UTC · Rule: changes · triggered by rule Queue explicitly requested merges
  • 🚫 Left the queue — 2026-10-22 12:05 UTC · at bd253bf0f41f6517512d3457cc1fb76d27058faf

This pull request spent 1 hour 19 minutes 31 seconds in the queue, with no time running CI.

Reason

The pull request conflicts with the base branch

The pull request was held in the queue, conflicting with at least one of 3 pull requests ahead of it. The conflict became a base branch one after #1741, #1744 merged.

Hint

You should update or rebase your pull request.

If you want to requeue this pull request, you can post a @mergifyio queue comment.

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

@mergify mergify Bot added dequeued Mergify stopped this queue entry; investigate before retrying and removed queued Mergify queue entry labels Oct 22, 2026
SystemVerilog classes declared in a module now simulate. A class
variable is a 32-bit handle of an object in the simulator heap that
already holds strings (IEEE 1800-2023 8.4).

- The heap keeps objects as their class id and property bytes, with the
  offsets of handle properties so that collection follows them from
  object to object. Operations through `null` record a fault that the
  runtime reports as a runtime error after the step.
- The parser records class declarations: name, base, qualifiers,
  properties and methods.
- The analyzer lays out each class (2-state integral properties up to
  64 bits, `string` and class handles; bases first) and rewrites
  property reads and writes into object operations that carry the
  layout. Methods become subroutines `C::m` whose first argument is
  `this`; a constructor, explicit or implicit, creates the object,
  runs the property initializers and returns the handle. Inside a
  method, properties shadow module names. `extern` methods use their
  out-of-block definitions; pure virtual methods and interface classes
  are not lowered.
- A variable initialized with a bare `new` is kept when its type is a
  class instead of being dropped like a covergroup instance.
- The frontend lowers object operations to calls of the heap helper.
- Checkpoints keep objects. State files cannot record them:
  `StateSchema::capture` now returns a `Result` and fails with
  `StateError::Objects` while a variable holds an object.

4-state, `real`, array and wider properties, base-class constructors and
`super`, virtual method calls, static members and parameterized classes
remain unsupported.

sv-tests: 8.4, 8.5, 8.6, 8.12-assignment, 8.24, 8.26.5-implemented
class handle and 6.20.6-const now pass in both state modes (500 / 502).
Verilator and Icarus limitations on the new shared cases are recorded.

BREAKING CHANGE: `StateSchema::capture` returns
`Result<StateFile, StateError>`, `StateError` has an `Objects` variant
and `ValueKind` an `ObjRef` variant.

Change-Id: I2389fee4f668b7d915cc475f31a0be37e4030255
@tignear
tignear force-pushed the stack/tignear/feat/string-class-heap/support-classes-props-methods-constructors--2389fee4 branch from bd253bf to 20012bc Compare October 22, 2026 14:09
@mergify mergify Bot removed the dequeued Mergify stopped this queue entry; investigate before retrying label Oct 22, 2026
@mergify mergify Bot added the queued Mergify queue entry label Oct 22, 2026
@mergify

mergify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 1 hour 14 minutes 53 seconds in the queue, including 1 hour 11 minutes 29 seconds running CI.

Required conditions to merge
  • check-success = Conventional Commit title
  • check-success = Queue validation
  • 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

@mergify
mergify Bot merged commit ce31782 into master Oct 22, 2026
30 checks passed
@mergify
mergify Bot deleted the stack/tignear/feat/string-class-heap/support-classes-props-methods-constructors--2389fee4 branch October 22, 2026 16:48
@mergify mergify Bot removed the queued Mergify queue entry label Oct 22, 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