Repository navigation
fix(sim)!: reject designs with processes in untimed Simulator builds - #1720
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
392a5f0 to
b3a0012
Compare
|
Queued — the merge queue status continues in this comment ↓. |
Merge Queue Status
This pull request spent 35 minutes 44 seconds in the queue, with no time running CI. ReasonThe 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. HintYou should update or rebase your pull request. If you want to requeue this pull request, you can post a Requeued — the merge queue status continues in this comment ↓. |
b3a0012 to
ce3dd6c
Compare
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
ce3dd6c to
e249b0a
Compare
Merge Queue Status
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
|
Closes #1712. Part of #1123.
An untimed
Simulatorruns no process kernel. Until now it still built designs that had one, with no error, so the processes silently never ran. Affected processes includedalways @(a) y = a + b;,initial #5 x = 1;, timed tasks in edge procedures,initialblocks that call system tasks, and runtime declaration initializers. Building aSimulatorfor such a design now fails with a typed error.What fails, and how
Every
Simulatorbuild 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/TSSimulator.fromFrontendArtifactandcelox vpi build. Each returnsSimulatorErrorKind::ProcessRequiresSimulation(ProcessOrigin), which names the first process:ProcessOrigincarries the construct (initial,always,always_ff,declaration initializer, orprocessfor SDK artifacts),path:line:column, and the elaborated instance scope. The SV analyzer now records aProcessSiteon initial/always/FF processes. Lowering resolves it intoRuntimeSchema::process_origins, and native images keep it.Untimed
initialblocks:Simulatornever ran any of them, it only folds constant ones into initial values. Those are constant writes with constantif/forand$readmemh/$readmemb, plus constant declaration initializers. They produce no kernel and keep working;constant_initial_state_builds_an_untimed_simulatorchecks 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_simulationwas 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, andSimulation::from_sources(..).with_sv_sources(..)runs it.Tests
New:
crates/celox/tests/sv_untimed_processes.rs:compile_native, with origin and location checked:always @(a) y = a + b;,initial #5 x = 1;, a timed task inalways @(posedge clk),always_ffwith$fwrite, first-of-several naming, a child instance (Top.child), and an SV child under a Veryl top.Simulation.Simulator.crates/celox/tests/processes.rs::untimed_simulator_rejects_processescovers 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: theon_every_backend!macro and allSimulation::new(<Simulator build>)wraps now build throughSimulation::from_frontend/from_sv_sources/builder. The macro's native-image round trip is removed becausecompile_nativenow rejects process designs. The unused$topargument is dropped.crates/celox/src/simulation.rs:process_tests::check_all_backends: the native-image step now asserts thatcompile_nativefails withProcessRequiresSimulation.four_state_edge_tests::on_every_backend!buildsSimulations.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).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_rejectedsv_scheduled_host_requests::folded_host_request_keeps_the_scheduled_process_requirementsv_vcd::initial_vcd_tasks_require_timed_simulation_on_every_backendsystemverilog::file_io::edge_host_requests_require_the_timed_apisystemverilog::review_regressions::{timed_task_edge_processes_allow_initialization_and_disjoint_drivers, waits_on_automatic_task_arguments_still_compile}now buildSimulation.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) buildSimulationand inspect its program through the newSimulation::program(), which returns the compiled program likeSimulator::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, onSimulation; it also checks that the initial's$displayruns.urandom_comb_runs_when_untimed_initials_are_skipped→urandom_comb_runs_untimed, whose design has noinitial.celox-vpiCLI testsdiagnostics::{run_and_build_share_project_target_and_cli_diagnostic_precedence, inferred_latch_uses_common_diagnostics_for_run_and_build}andproject_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}: thevpi buildstep now compiles the design without itsinitialtestbench process, because a cocotb image runs no HDL process. Therunstep is unchanged.The sv-tests driver (
examples/sv_tests.rs) elaborates throughSimulation, so elaboration verdicts don't depend on whether a design has processes.Validation
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 libsimulation::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--ignoredtests).celox-test-suite --features verilator,icarus: 76 tests.packages/celoxvitest with the debug NAPI addon: 432 tests.-D warningsand fmt.expected.tsvexactly. No verdict changed.BREAKING CHANGE
Simulatorfor a design with a process kernel now fails with the newSimulatorErrorKind::ProcessRequiresSimulationvariant. Previously it built a simulator that never ran the process. This includescompile_native, native images,celox vpi buildand the NAPI/TSSimulatorfactories. UseSimulation.RuntimeSchemagainsprocess_origins.HostRequestSitelosesrequires_timed_simulation.