Skip to content

fix(sim)!: reject designs with processes in untimed Simulator builds - #1720

Merged
mergify[bot] merged 1 commit into
masterfrom
feature/fix/simulator-rejects-processes
Oct 22, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
feature/fix/simulator-rejects-processes

Conversation

@tignear

@tignear tignear commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1712. Part of #1123.

An untimed Simulator runs no process kernel. Until now it still built designs that had one, with no error, so the processes silently never ran. Affected processes included always @(a) y = a + b;, initial #5 x = 1;, timed tasks in edge procedures, initial blocks that call system tasks, and runtime declaration initializers. Building a Simulator for such a design now fails with a typed error.

What fails, and how

Every Simulator build path checks the design. That covers interpreter, Cranelift, WASM, tiered, native, compile_native / compile_native_with_trace, build_native_from_image, build_with_trace, frontend SDK artifacts, NAPI/TS Simulator.fromFrontendArtifact and celox vpi build. Each returns SimulatorErrorKind::ProcessRequiresSimulation(ProcessOrigin), which names the first process:

`always` at processes.sv:2:3 in `Top` is a process, which Simulator does not run; build a Simulation instead

ProcessOrigin carries the construct (initial, always, always_ff, declaration initializer, or process for SDK artifacts), path:line:column, and the elaborated instance scope. The SV analyzer now records a ProcessSite on initial/always/FF processes. Lowering resolves it into RuntimeSchema::process_origins, and native images keep it.

Untimed initial blocks: Simulator never ran any of them, it only folds constant ones into initial values. Those are constant writes with constant if/for and $readmemh/$readmemb, plus constant declaration initializers. They produce no kernel and keep working; constant_initial_state_builds_an_untimed_simulator checks this.

The new check covers the earlier per-feature checks for distributions, source VCD controls, formatted input and edge host requests. Every host-request site belongs to a process, so these designs now get the new error instead of the old messages. HostRequestSite::requires_timed_simulation was read only by those checks, so it is removed.

The NAPI addon has no SV frontend, so NAPI/TS can only reach this through frontend artifacts. Veryl sources produce no kernels; the Veryl case is an SV child under a Veryl top (Simulator::from_mixed_sources). That case is tested and rejected, and Simulation::from_sources(..).with_sv_sources(..) runs it.

Tests

New:

  • crates/celox/tests/sv_untimed_processes.rs:
    • Rejected on every untimed backend plus compile_native, with origin and location checked: always @(a) y = a + b;, initial #5 x = 1;, a timed task in always @(posedge clk), always_ff with $fwrite, first-of-several naming, a child instance (Top.child), and an SV child under a Veryl top.
    • The same designs run in Simulation.
    • Constant initial state still builds a Simulator.
  • crates/celox/tests/processes.rs::untimed_simulator_rejects_processes covers SDK frontend artifacts.
  • packages/celox/src/e2e.test.ts "rejects a process in an untimed simulator" covers NAPI/TS.

Existing tests changed:

  • crates/celox/src/simulation/runtime_core_tests.rs: the on_every_backend! macro and all Simulation::new(<Simulator build>) wraps now build through Simulation::from_frontend/from_sv_sources/builder. The macro's native-image round trip is removed because compile_native now rejects process designs. The unused $top argument is dropped.
  • crates/celox/src/simulation.rs:
    • process_tests::check_all_backends: the native-image step now asserts that compile_native fails with ProcessRequiresSimulation.
    • four_state_edge_tests::on_every_backend! builds Simulations.
  • sv_declaration_startup::plain_simulator_does_not_execute_initial_kernels → plain_simulator_rejects_initial_kernels (expects the error and checks the declaration initializer's origin).
  • sv_ordinary_host_requests::one_shot_initial_host_keeps_existing_untimed_builder_boundary → one_shot_initial_host_requires_simulation (expects the error).
  • These now check the error kind instead of the old message text:
    • sv_ordinary_host_requests::{ordinary_edge_host_calls_require_timed_simulation, repeating_host_requirement_does_not_bootstrap_an_immediate_body}
    • sv_distributions::{distribution_initial_requires_timed_simulation, distribution_edge_requires_timed_simulation}
    • sv_scan::pure_sscanf_allows_checkpoint_and_untimed_build_is_rejected
    • sv_scheduled_host_requests::folded_host_request_keeps_the_scheduled_process_requirement
    • sv_vcd::initial_vcd_tasks_require_timed_simulation_on_every_backend
    • systemverilog::file_io::edge_host_requests_require_the_timed_api
  • systemverilog::review_regressions::{timed_task_edge_processes_allow_initialization_and_disjoint_drivers, waits_on_automatic_task_arguments_still_compile} now build Simulation.
  • systemverilog::timing::{nonblocking_sites_stage_only_unobserved_targets_with_one_writer, narrow_nonblocking_updates_cover_staged_and_queued_sites} (from perf(sv)!: stage nonblocking updates of a target with one writer #1684) build Simulation and inspect its program through the new Simulation::program(), which returns the compiled program like Simulator::program().
  • systemverilog::system_functions:
    • urandom_comb_skipped_initials_work_on_interpreter_and_tiered → urandom_comb_runs_next_to_an_initial_process_on_interpreter_and_tiered, on Simulation; it also checks that the initial's $display runs.
    • urandom_comb_runs_when_untimed_initials_are_skipped → urandom_comb_runs_untimed, whose design has no initial.
  • celox-vpi CLI tests diagnostics::{run_and_build_share_project_target_and_cli_diagnostic_precedence, inferred_latch_uses_common_diagnostics_for_run_and_build} and project_cli::{sv_cli_defaults_to_two_state_for_run_and_native_images, timescale_reaches_run_and_native_images_with_target_and_cli_precedence, sv_parameter_literals_preserve_types_across_project_target_and_cli, state_mode_merges_project_target_and_cli_for_run_and_native_build, top_parameters_merge_common_target_and_cli_without_editing_sv}: the vpi build step now compiles the design without its initial testbench process, because a cocotb image runs no HDL process. The run step is unchanged.

The sv-tests driver (examples/sv_tests.rs) elaborates through Simulation, so elaboration verdicts don't depend on whether a design has processes.

Validation

  • Locally, scoped with CI features. No failures remain.
    • celox --features systemverilog: a run of the whole crate (12.9k tests) found every affected test; then a focused re-run of 1479 tests covering the affected binaries and all lib simulation:: tests.
    • celox-sv-analyzer, celox-frontend-sv, celox-frontend-core, celox-design, celox-runtime, celox-sir-opt, celox-frontend-sdk: 1372 tests.
    • celox-vpi --features systemverilog: 139 tests, plus the cocotb e2e suite (5 --ignored tests).
    • celox-test-suite --features verilator,icarus: 76 tests.
    • packages/celox vitest with the debug NAPI addon: 432 tests.
    • clippy -D warnings and fmt.
  • SIR digest: pre- and post-optimized SIR text of every untimed SV suite case and every Veryl suite case emitted as SV is byte-identical to the base (1232 designs, build status included).
  • sv-tests conformance, run locally with the official runner at the pinned revision in both state modes, matches expected.tsv exactly. No verdict changed.

BREAKING CHANGE

  • Building a Simulator for a design with a process kernel now fails with the new SimulatorErrorKind::ProcessRequiresSimulation variant. Previously it built a simulator that never ran the process. This includes compile_native, native images, celox vpi build and the NAPI/TS Simulator factories. Use Simulation.
  • RuntimeSchema gains process_origins.
  • HostRequestSite loses requires_timed_simulation.
  • The native image container version is now 27.

@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-22T02:38:49.030422Z
We couldn’t complete this review. Comment @codex review to try again.
392a5f0 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 feature/fix/simulator-rejects-processes branch from 392a5f0 to b3a0012 Compare October 22, 2026 04:11
@mergify

mergify Bot commented Oct 22, 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 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 05:36 UTC · Rule: changes · triggered by rule Queue explicitly requested merges
  • 🚫 Left the queue — 2026-10-22 06:11 UTC · at b3a0012b3bc16e0c1f2be9fc504d78f385cff3a6

This pull request spent 35 minutes 44 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 1 pull request ahead of it. The conflict became a base branch one after #1684 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
@tignear tignear removed merge-ready Request merging through Mergify after required checks dequeued Mergify stopped this queue entry; investigate before retrying labels Oct 22, 2026
@mergify mergify Bot added the dequeued Mergify stopped this queue entry; investigate before retrying label Oct 22, 2026
@tignear
tignear force-pushed the feature/fix/simulator-rejects-processes branch from b3a0012 to ce3dd6c Compare October 22, 2026 08:14
@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 22, 2026
@mergify mergify Bot removed the dequeued Mergify stopped this queue entry; investigate before retrying label Oct 22, 2026
An untimed Simulator runs no process kernel, yet it built designs with
one without any error: `always @(a) y = a + b;`, `initial #5 x = 1;`,
timed tasks in edge procedures and initial blocks calling system tasks
silently did nothing. Every Simulator build path (interpreter, Cranelift,
WASM, tiered, native, compile_native, native images, frontend SDK
artifacts, NAPI/TS) now fails with
SimulatorErrorKind::ProcessRequiresSimulation, which names the first
process: its construct, source location and instance scope. Constant
initial blocks and declaration initializers are still folded into
initial values.

The SV analyzer records where each initial/always/always_ff process is
written; lowering carries it into RuntimeSchema::process_origins. The
per-feature checks for distributions, VCD controls, formatted input and
edge host requests are subsumed by the new check, and
HostRequestSite::requires_timed_simulation, read only by them, is
removed. The sv-tests driver elaborates through Simulation.

Closes #1712

BREAKING CHANGE: building a Simulator (including compile_native, native
images, `celox vpi build` and NAPI/TS Simulator factories) for a design
with a process kernel now fails with the new
SimulatorErrorKind::ProcessRequiresSimulation variant instead of
building a simulator that never runs the process. Use Simulation.
RuntimeSchema gains process_origins, HostRequestSite loses
requires_timed_simulation, and the native image container version is
bumped to 27.

Change-Id: I53034381ecf4d548ca769e5806cdd3f12a1b822c
@tignear
tignear force-pushed the feature/fix/simulator-rejects-processes branch from ce3dd6c to e249b0a Compare October 22, 2026 13:02
@tignear tignear added merge-ready Request merging through Mergify after required checks and removed merge-ready Request merging through Mergify after required checks labels 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 14:08 UTC · Rule: changes · triggered by rule Queue explicitly requested merges
  • ✅ Checks passed · on draft merge queue: checking #1720 on master (32f5b06) #1755
  • ✅ Merged — 2026-10-22 15:36 UTC · at 8af0a413463548096bfdf9832be3d0ad0bd27432 · merge

This pull request spent 1 hour 28 minutes 2 seconds in the queue, including 1 hour 25 minutes 55 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 mentioned this pull request Oct 22, 2026
40 of 71 tasks
@mergify
mergify Bot merged commit 8af0a41 into master Oct 22, 2026
30 checks passed
@mergify
mergify Bot deleted the feature/fix/simulator-rejects-processes branch October 22, 2026 15:36
@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.

Simulator silently ignores process kernels

1 participant