Repository navigation
feat(cli): save state files at chosen cycles or times of a SystemVerilog run - #2030
Conversation
…log run Refs #2025 Change-Id: Ib71719ee9f5f4d322b2b673915f907156e26e1a0
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eef1fe6538
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .collect::<Result<Vec<_>, _>>()?; | ||
| simulation | ||
| .try_child_signal(&instances, var) | ||
| .map_err(|error| format!("--save-state-on {path}: {error}")) |
There was a problem hiding this comment.
Resolve interface member clocks without assuming module instances
For an interface clock such as Top.c.clk, this resolver treats c as a module instance and passes only clk as the variable path. However, the SV frontend's restore_interface_member_paths stores interface members as multi-segment variable paths within the enclosing module, and RuntimeProgram::instance_addr distinguishes those paths from instance paths. Consequently, a valid interface clock cannot be selected with --save-state-on, even when preserved with --live-signal. Resolve the complete reflected signal path, or distinguish the variable-path suffix from the module-instance prefix.
Useful? React with 👍 / 👎.
Merge Queue Status
This pull request spent 26 minutes 3 seconds in the queue, including 24 minutes 37 seconds running CI. Required conditions to merge
|
Refs #2025 (the SystemVerilog part; Veryl testbenches follow in a separate PR).
Summary
New
celox runoptions save path-keyed state files (Simulation::save_state, read bycelox state dump/diff) during a SystemVerilog run, on every backend:--save-state-on SIGNALSIGNAL, a hierarchical path such astb.clkortb.cpu[1].clk. The top module's name may be included or left out.--save-state-at N[,M...]<SIGNAL>-<N>.state.--save-state-at-time T[,U...]time-<T>.state, in units of the global time precision.--save-state-dir DIR.; created if missing).When a file is saved, defined so that two runs or simulators can be diffed:
Veryl runs reject the options for now. A Veryl testbench runs its ticks in batches inside
testbench.rs, so it needs a separate hook there, which comes in the follow-up PR.The implementation is in the CLI's step loop (
StateSavesincelox.rs). The library change is only aSimulation::try_child_signalthat resolves the path without panicking.Tests
sv_saves_state_files_at_cycles_and_times(run_cli.rs): a counter clocked byalways #5 clk = ~clk, run with the tiered, interpreter and native backends. It saves at cycles 2 and 5 and at time 32, then checks withcelox state dumpthat the files holdcount = 2at time 15,count = 5at time 45, andcount = 3at time 30. A cycle that is never reached fails the run.celox-vpitest suite with--features systemverilogpasses, and clippy is clean with and without the feature.Docs
docs/guide/cocotb.mdhas a new "Save state files during a SystemVerilog run" table (Japanese too).checkpoints.mdpoints to it from the state file section (both languages).