Repository navigation
perf(sv): simulate sensitivity lists that cover their reads like always @* - #2087
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. |
|
b2_vm_dispatch_bit callgrind gate (release builds,
The default |
|
Queued — the merge queue status continues in this comment ↓. |
Merge Queue Status
This pull request spent 29 minutes 25 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 at least one of 2 pull requests ahead of it. The conflict became a base branch one after #2082, #2085 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 ↓. |
…ys @* rtlmeter's C906 simulated at about 88 cycles/s on the native backend (four-state). Most of the simulation phase went to `SimulationState::check_waits`: about 720 processes waited on level-sensitive lists, and every round compared the watched signals of all of them (about 3,000 small terms per round, 60 rounds per cycle). These processes are the core's generated combinational blocks, such as `always @(a or b[127:0] or c[14:12])`. Only an `always` whose list names exactly the variables of the implicit event expression was simulated like `always @*` (IEEE 1800-2023 9.4.2.2). A part-select in the list, whether of the whole variable or narrower, kept the block a process. A level-sensitive list now also simulates like `always @*` when it covers every bit its statement reads (longest static prefixes) and running the statement more often cannot be observed: - the statement calls no subroutine or system task and no system function that reads the simulation; - it reads no variable it writes, so a run whose inputs did not change writes the values it wrote last time; - it stores each variable at most once per run, so an extra run does not pulse a variable for its waiters (4.3, 9.4.2). A list that names whole variables through full-width part-selects is now exact as well. Blocks that store a variable twice, such as a default assignment followed by a `case`, stay processes in both state modes: Celox wakes waiters on intermediate values, so an extra run would be observable, including against Verilator in two-state mode. C906 hello (native, four-state, heliodor-dev): the simulation phase takes 10.6 s instead of 37.8 s, about 312 cycles/s instead of 88. `check_waits` falls from about half of the phase to under 5%. The comb processes cost frontend work; #2062 (one unit per process schedule, which this change builds on) recovers most of it. Closes #2079. - Shared cases `always_comb::covering_sensitivity_lists_settle_like_a_wildcard` and its four-state twin (the untimed harness builds a `Simulator`, which runs no processes) and `always_comb::multi_store_blocks_with_covering_lists_stay_processes` (an edge waiter counts no extra pulses), matching Icarus and Verilator. - The SystemVerilog reference describes the rule and its reason. Change-Id: I8fb99a7ef1dbc09969a27024f479ee5f795412e5
67c5dc7 to
c42418d
Compare
Merge Queue Status
This pull request spent 29 minutes 28 seconds in the queue, including 27 minutes 11 seconds running CI. Required conditions to merge
|
rtlmeter's C906 simulated at about 88 cycles/s on the native backend (four-state). Most of the simulation phase went to
SimulationState::check_waits: about 720 processes waited on level-sensitive lists, and every round compared the watched signals of all of them (about 3,000 small terms per round, 60 rounds per cycle). These processes are the core's generated combinational blocks, such asalways @(a or b[127:0] or c[14:12]). Only analwayswhose list names exactly the variables of the implicit event expression was simulated likealways @*(IEEE 1800-2023 9.4.2.2). A part-select in the list, whether of the whole variable or narrower, kept the block a process.A level-sensitive list now also simulates like
always @*when it covers every bit its statement reads (longest static prefixes) and running the statement more often cannot be observed:A list that names whole variables through full-width part-selects is now exact as well. Blocks that store a variable twice, such as a default assignment followed by a
case, stay processes in both state modes: Celox wakes waiters on intermediate values, so an extra run would be observable, including against Verilator in two-state mode.C906 hello (native, four-state, heliodor-dev): the simulation phase takes 10.6 s instead of 37.8 s, about 312 cycles/s instead of 88.
check_waitsfalls from about half of the phase to under 5%. The comb processes cost frontend work; #2062 (one unit per process schedule, which this change builds on) recovers most of it.Closes #2079.
always_comb::covering_sensitivity_lists_settle_like_a_wildcardand its four-state twin (the untimed harness builds aSimulator, which runs no processes) andalways_comb::multi_store_blocks_with_covering_lists_stay_processes(an edge waiter counts no extra pulses), matching Icarus and Verilator.Verification
cargo nextest run -p celox -p celox-test-suite -p celox-frontend-svwith CI's features: 14814 passed. clippy (workspace minus lydite,--all-targets -D warnings): clean.retained_reports: passed.verify-sv-icarus --filter always_comb::: 8/8 passed.verify-sv-verilator: 7 passed, 1 unsupported (the four-state twin).conformance/sv-tests/expected.tsv.always @(x[0]) begin p = 0; if (x[0]) p = 1; endwithalways @(posedge p) n++and a change of an unlisted bit ofx): Icarus and Verilator count 1; rewriting the block would count 2 in Celox, so multi-store blocks stay processes.check_waits+advance~56% → under 5% of the phase.--backend native):step_untilidentical (4,204,004,002), totals +0.01% (see comment).Rebased onto master after #2082 merged (9ccb91e); 14950 affected tests pass there.