Repository navigation
fix(sim): judge derived clocks after several nonblocking updates - #1901
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. |
|
Queued — the merge queue status continues in this comment ↓. |
Merge Queue Status
This pull request spent 3 minutes 51 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 #1847 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 ↓. |
When several updates publish in one NBA region, or a domain commits its blocking results in the active region, or publishes several evaluations, the runtime marks the edges among the updates as occurrences. It did not register their signals as sources of combinationally derived clocks, so the settle that followed kept only the marked occurrences and dropped the edge of a clock such as clk & ren. The derived clocks of a source that changed are now judged at that settle, as for the processes' writes. Fixes #1860. Change-Id: I5d30a1832ead72125172cfa3425a809cfafdb147
…commits Change-Id: Idb4448de658b44a14d031190bbd61bc5a5a2e596
Change-Id: I0d371af10f284bee80cf83580dccb19c6ce29825
94284e4 to
badea1a
Compare
Merge Queue Status
This pull request spent 1 hour 57 minutes 44 seconds in the queue, including 1 hour 55 minutes 57 seconds running CI. Required conditions to merge
|
Fixes #1860. Part of #1123.
Problem
The timed
Simulationlost the edge of a combinationally gated clock when the NBA region publishing its source clock held another update too:eat t=12/16/20 was 1 1 2. Icarus 13.0 andSimulatorgive 1 2 3.Cause
I confirmed it with a diagnostic run before changing code. At t=13 the settle after the NBA region saw
rclkandclktriggered, but onlyclkinscheduled_trigger_idsand no gating source.With several updates,
publish_nbarecords the transitions of each update and marks their edges withmark_occurrences, which fillsscheduled_trigger_ids. Unlikemark_scheduled_edges(the path for the processes' writes),mark_occurrencesnever pushed the source ontoround.gating_sources. So the followingsettle_markedre-marked only the scheduled ids, andjudge_derived_edgesnever judgedrclk.With a single update,
mark_occurrencesis not called,scheduled_trigger_idsstays empty, and the stable-edge scan findsrclk. That's why dropping theclk2writes hides the bug.Fix
mark_occurrencesnow registers a changed event signal with combinationally derived clocks as a gating source, asmark_scheduled_edgesdoes. The settle that follows judges the derived clocks from the settled state.Tests
One
timing.vtestcase per caller ofmark_occurrences, each checked withverify-sv-icarus/verify-sv-verilator:e= 1 2 3evaluate_before_inactive)cnt=2 w=4finish_publicationscnt=0 n=1 q=0e= 1 1 2. The other two already matched Icarus, and the fix keeps them.gq = q & enonly after both NBA updates, so the pulse ofqgives no edge ofgq(4.7). Verilator 5.052 doesn't wake the@(q)waiter for the NBA pulse at all, so the case joinssv_verilator_intermediate_writes, with the LIMITATIONS.md row and shard rows.CELOX_SCHEDULER=differentialover--test systemverilog, 4488 passed) and underCELOX_SCHEDULER=compiled(15 passed).tick_semanticscase isn't on master yet; it gets re-enabled when that PR lands or in this one if it lands first.Performance
Runtime Ir measured with callgrind (200k-cycle minus 20k-cycle runs, taskset), base 48f908e:
(c) never takes the changed path. Its profile shows only layout shifts of unchanged code:
run_timeinlined intostep_until,BinaryHeap::pushout of line inrearm_clocks, andcheck_waits+2.2M at 50k cycles with an identical body. Two builds of the same commit vary by about 0.25% on (c) (measured on #1829).Validation
Under the shared lock:
cargo test -p celox-runtime: 78 passed.-p celox --features systemverilog,sv-dpi --libplus--test systemverilogand the timed integration files (processes, state_file, checkpoint, comb_observer, runtime_api, simulation_step, time_state_and_delays, derived_register_clock, ff_comb_clock, tick_semantics, clock_gen_semantics): 5699 passed.--test systemverilog: 4488 passed. Compiledtiming::derived: 15 passed.retained_reports: 3 passed. clippy-D warningsand fmt are clean.expected.tsv.