Skip to content

feat(sv)!: support $stop and $exit - #1402

Merged
mergify[bot] merged 2 commits into
masterfrom
feature/sv-stop-exit
Oct 18, 2026
Merged

mergify[bot] merged 2 commits into
masterfrom
feature/sv-stop-exit

Conversation

@tignear

@tignear tignear commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • $stop (IEEE 1800-2023 20.2) suspends the simulation.
    • In a process kernel (an initial block), the process returns with a new ProcessStatus::Stop (status code 9), keeping its place first among the ready processes.
    • The scheduler settles combinational logic and saves the round in progress, its process phase included. Simulation::step / run_until then return with the new is_stopped() set.
    • The next step continues that same round, so the stopping process resumes after the $stop (also inside loops and functions). The processes waiting in that round run next. Edges made before the stop still trigger their domains, and the end of the time step (NBA region, finish_timed_step, VCD) happens once.
    • run_until_bounded returns false at a stop.
    • While suspended, checkpoint() and save_state() fail with the new CheckpointError::Stopped, because a checkpoint cannot hold a half-finished time step. Restoring a checkpoint discards a suspended round.
    • In always processes, $stop is reported as the new RuntimeEvent::Stop, as $finish is reported as Finish.
    • The diagnostic-level argument prints nothing.
    • Hosts without an interactive mode end the run at $stop, as vvp -n does and as vpi_control(vpiStop) already did: the VPI host, the Veryl testbench and the sv-tests runner.
  • $exit (24.7) ends the initial procedures of the program block that calls it. Celox has no program blocks, and 24.7 ignores a call from anywhere else, so it is a no-op. The spec's optional warning is not issued, because SV has no warning plumbing yet.
  • NAPI / TypeScript: Simulation.isStopped().

Compatibility

Breaking change:

  • The public enums RuntimeEvent, RuntimeEventKind, ProcessStatus, celox_runtime::timing::Halt and CheckpointError each gain a Stop / Stopped variant, so exhaustive matches downstream need a new arm.

Testing

  • New Celox tests:
    • suspension and continuation through step and run_until, inside a runtime loop and a function, with a second process that waits;
    • checkpoints refused while stopped;
    • an edge made before a stop that triggers its flip-flop after the resume;
    • Stop events from always_ff / always_comb;
    • $exit ignored, and $exit(1) rejected.
  • sv-tests at the pinned revision: chapter-20/20.2--stop.sv and 20.2--exit.sv now pass. The whole suite matches the updated expected.tsv.
  • cargo test -p celox --features systemverilog --no-fail-fast and cargo test -p celox-runtime -p celox-design -p celox-frontend-core -p celox-frontend-sv -p celox-vpi -p celox-napi: 11577 passed, 0 failed.
  • cargo clippy --workspace --all-targets, cargo check -p celox-napi, and the TypeScript typecheck.
  • $stop has no shared suite case: Icarus (vvp -n) and Verilator both end the run at it, so its suspension cannot be compared there.

@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-17T01:45:04.033811Z 191620d 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.

Base automatically changed from feature/sv-random to master October 17, 2026 07:40
@mergify

mergify Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

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

@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 17, 2026
@tignear
tignear force-pushed the feature/sv-stop-exit branch from 191620d to f72c621 Compare October 17, 2026 21:58
@mergify mergify Bot added the queued Mergify queue entry label Oct 17, 2026
@mergify

mergify Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-17 22:32 UTC · Rule: changes · triggered by rule Queue explicitly requested merges
  • 🚫 Left the queue — 2026-10-17 23:00 UTC · at f72c62143f4bdf191061eed305bc9d10e344f08b

This pull request spent 28 minutes 20 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 2 pull requests ahead of it. The conflict became a base branch one after #1391 merged.

Automatic conflict resolution can merge a conflict like this one instead of stopping on it, but only in a queue using the merge-batch or fast-forward merge method.

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 17, 2026
@tignear
tignear force-pushed the feature/sv-stop-exit branch from f72c621 to ec85136 Compare October 17, 2026 23:12
@mergify mergify Bot removed the dequeued Mergify stopped this queue entry; investigate before retrying label Oct 17, 2026
$stop in a process kernel suspends the simulation (IEEE 1800-2023 20.2):
the process returns with the new Stop status, the scheduler settles
combinational logic, saves the round in progress and returns with
is_stopped() set. The next step continues that round after the $stop,
so edges made before it still trigger their domains. Checkpoints and
state files are refused while suspended. Outside a kernel, $stop is
reported as RuntimeEvent::Stop, as $finish is reported as Finish. Batch
hosts end the run at it.

$exit is ignored: Celox has no program blocks, and 24.7 ignores a call
from outside one.

BREAKING CHANGE: RuntimeEvent, RuntimeEventKind, ProcessStatus, Halt and
CheckpointError gain a Stop/Stopped variant.

Change-Id: Ia7467b814439b7542423436ce48b87e1a2d0597f
@tignear
tignear force-pushed the feature/sv-stop-exit branch from ec85136 to aa048d5 Compare October 18, 2026 00:48
@mergify mergify Bot added the queued Mergify queue entry label Oct 18, 2026
@mergify

mergify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 40 minutes 37 seconds in the queue, including 39 minutes 6 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 83c76d5 into master Oct 18, 2026
30 checks passed
@mergify
mergify Bot deleted the feature/sv-stop-exit branch October 18, 2026 01:58
@mergify mergify Bot removed the queued Mergify queue entry label Oct 18, 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