Skip to content

feat(sv)!: support string variables and their operations - #1688

Merged
mergify[bot] merged 1 commit into
masterfrom
stack/tignear/feat/string-class-heap/support-string-vars-their-operations--d79cec41
Oct 22, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
stack/tignear/feat/string-class-heap/support-string-vars-their-operations--d79cec41

Conversation

@tignear

@tignear tignear commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

SystemVerilog string variables, function arguments and results now
simulate as 32-bit handles into the heap introduced for testbench
strings (IEEE 1800-2023 6.16).

  • The analyzer rewrites operators, methods and conversions with a
    string operand into string operations: equality stays an integral
    comparison of handles, ordering compares contents, and concatenation,
    replication with a run-time count, s[i], casts and the len,
    getc, putc, toupper, tolower, compare, icompare,
    substr, atoi and itoa families lower to them. A string literal
    or integral value assigned or cast to a string contributes its bytes;
    NUL bytes are removed.
  • Compiled code reaches the heap through one helper, called as an
    ExternCall with the reserved HEAP_HELPER_ID. Every backend passes
    the state pointer first, and the helper finds the heap through a new
    state header slot. Buffers build new strings in place and are interned
    when frozen, so equal contents keep equal handles.
  • Each backend owns its heap, so hosts that keep only the backend, such
    as NAPI, keep their strings. StateImage captures the heap, so every
    checkpoint restores it. Handles are never reused, so a stale copy that
    is only compared cannot match a later string.
  • The heap is collected after each timed step and each tick. Runtime
    events still in the backend's buffer are read first, which replaces
    string arguments by their contents. Concurrent testbench processes
    block the tick collection, since their saved temporaries are outside
    state memory.
  • %s and format-less display print string values. Typed string
    parameters keep their packed text. Unpacked arrays of strings are
    rejected, since their element and character selects are not yet told
    apart.

Twenty-one sv-tests cases now pass in both state modes; each was
simulated and its values checked. New shared cases pass on Verilator;
Icarus 13.0 lacks the string methods, recorded as a reviewed limitation.

BREAKING CHANGE: SimBackend requires heap and heap_mut. The state
header grows to 48 bytes and the native image container version to 22,
so earlier images must be rebuilt. StateSchema::capture and load read
the backend's heap; capture_with_heap and load_with_heap are removed.

Refs #1400

@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 string variables and their operations #1688 👈
2 feat(sv)!: support classes with properties, methods and constructors #1689
3 feat(sv): support static class members, super and base constructors #1696
4 feat(sv): support virtual methods, abstract classes and interface class implementation #1724

@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-21T05:44:17.982737Z
We couldn’t complete this review. Comment @codex review to try again.
a0c438a 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 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Revision history

# Type Changes Reason Date
1 initial a0c438a 2026-10-21 07:33 UTC
2 content a0c438a → 7539fd7 Add the string group to the retained Verilator/Icarus reports so the excluded string cases have their reviewed rows (retained_reports test). 2026-10-21 07:33 UTC
3 content 7539fd7 → ae04081 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 ae04081 → e3cc1c1 Rebased onto master after #1679 merged; event variables of #1681 get the string flag and string operations count as pure in event expressions. 2026-10-22 04:25 UTC

@mergify

mergify Bot commented Oct 21, 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/keep-strings-heap-referenced-state-memory--dff2d83d branch from ed3261e to 4289f08 Compare October 22, 2026 01:04
@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
Base automatically changed from stack/tignear/feat/string-class-heap/keep-strings-heap-referenced-state-memory--dff2d83d to master October 22, 2026 03:54
SystemVerilog `string` variables, function arguments and results now
simulate as 32-bit handles into the heap introduced for testbench
strings (IEEE 1800-2023 6.16).

- The analyzer rewrites operators, methods and conversions with a
  string operand into string operations: equality stays an integral
  comparison of handles, ordering compares contents, and concatenation,
  replication with a run-time count, `s[i]`, casts and the `len`,
  `getc`, `putc`, `toupper`, `tolower`, `compare`, `icompare`,
  `substr`, `atoi` and `itoa` families lower to them. A string literal
  or integral value assigned or cast to a string contributes its bytes;
  NUL bytes are removed.
- Compiled code reaches the heap through one helper, called as an
  `ExternCall` with the reserved `HEAP_HELPER_ID`. Every backend passes
  the state pointer first, and the helper finds the heap through a new
  state header slot. Buffers build new strings in place and are interned
  when frozen, so equal contents keep equal handles.
- Each backend owns its heap, so hosts that keep only the backend, such
  as NAPI, keep their strings. `StateImage` captures the heap, so every
  checkpoint restores it. Handles are never reused, so a stale copy that
  is only compared cannot match a later string.
- The heap is collected after each timed step and each `tick`. Runtime
  events still in the backend's buffer are read first, which replaces
  string arguments by their contents. Concurrent testbench processes
  block the `tick` collection, since their saved temporaries are outside
  state memory.
- `%s` and format-less display print string values. Typed `string`
  parameters keep their packed text. Unpacked arrays of strings are
  rejected, since their element and character selects are not yet told
  apart.

Twenty-one sv-tests cases now pass in both state modes; each was
simulated and its values checked. New shared cases pass on Verilator;
Icarus 13.0 lacks the string methods, recorded as a reviewed limitation.

BREAKING CHANGE: `SimBackend` requires `heap` and `heap_mut`. The state
header grows to 48 bytes and the native image container version to 22,
so earlier images must be rebuilt. `StateSchema::capture` and `load` read
the backend's heap; `capture_with_heap` and `load_with_heap` are removed.

Refs #1400

Change-Id: Id79cec4106b91e786ac4517811392d67c4c8ec00
@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 commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 1 hour 45 minutes 25 seconds in the queue, including 1 hour 43 minutes 36 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 added the queued Mergify queue entry label Oct 22, 2026
@mergify
mergify Bot merged commit de5cf34 into master Oct 22, 2026
32 of 33 checks passed
@mergify
mergify Bot deleted the stack/tignear/feat/string-class-heap/support-string-vars-their-operations--d79cec41 branch October 22, 2026 08:00
@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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant