Repository navigation
fix(sv): run waiters of blocking edge writes before the NBA region - #1783
Merged
Merged
Conversation
A domain whose blocking results are observed (active_commits) committed them in the active region only when a zero delay was pending. In an ordinary round the process phase returned once the active region was empty and the domain published its blocking and nonblocking results together, so a process the blocking write woke ran after the edge's nonblocking updates (IEEE 1800-2023 4.5). When nothing is ready or inactive and a marked trigger evaluates such a domain, the process phase now evaluates it before the NBA region as it does before an inactive region: the processes its blocking results wake run in the active region, and the nonblocking results publish with the NBA region. Fixes #1721. Change-Id: I620f6bf29af4d7d5cba5e1782aa6ef7fb6d3eb1b
…dates Change-Id: I076b9f122c74f6ba75e8e635c8643c981cb88b2b
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. |
Contributor
|
Queued — the merge queue status continues in this comment ↓. |
Contributor
Merge Queue Status
This pull request spent 1 hour 40 minutes 37 seconds in the queue, including 57 minutes running CI. Required conditions to merge
|
This was referenced Oct 23, 2026
This was referenced Oct 23, 2026
tignear
added a commit
that referenced
this pull request
Oct 24, 2026
An event control item `expr iff condition` in a process (IEEE 1800-2023 9.4.2.3) is an event only if the condition holds when the occurrence of `expr` is detected. The item's terms are lowered as before; the condition becomes the term's gate: a one-bit module variable itself, or the hidden `$event[k]` assignment of its truth value, with copies of process-local operands sampled before the process suspends. The wait does not watch the gate's operands. The runtime judges a gated term only at checks after combinational logic settled, leaving its baseline untouched before then, and wakes the process only if the gate's least significant bit is a known 1; the occurrence is consumed either way. Designs without iff keep the ungated check loop. A plain `always` whose event has `iff` now runs as a process; `always_ff` keeps rejecting `iff` (#452). The Japanese guide also gets the active-region waiter order of #1783. Closes #1444. BREAKING CHANGE: celox_design::WaitSite has a new public field `gates`, and celox_design::schedule::TermModel a new field `gate`; struct literals of them must set it (`gates: Vec::new()`, `gate: None`). Change-Id: I59402e1356cac2aaf254082d1feef6348380447a
tignear
added a commit
that referenced
this pull request
Oct 24, 2026
An event control item `expr iff condition` in a process (IEEE 1800-2023 9.4.2.3) is an event only if the condition holds when the occurrence of `expr` is detected. The item's terms are lowered as before; the condition becomes the term's gate: a one-bit module variable itself, or the hidden `$event[k]` assignment of its truth value, with copies of process-local operands sampled before the process suspends. The wait does not watch the gate's operands. The runtime judges a gated term only at checks after combinational logic settled, leaving its baseline untouched before then, and wakes the process only if the gate's least significant bit is a known 1; the occurrence is consumed either way. Designs without iff keep the ungated check loop. A plain `always` whose event has `iff` now runs as a process; `always_ff` keeps rejecting `iff` (#452). The Japanese guide also gets the active-region waiter order of #1783. Closes #1444. BREAKING CHANGE: celox_design::WaitSite has a new public field `gates`, and celox_design::schedule::TermModel a new field `gate`; struct literals of them must set it (`gates: Vec::new()`, `gate: None`). Change-Id: I59402e1356cac2aaf254082d1feef6348380447a
tignear
added a commit
that referenced
this pull request
Oct 24, 2026
An event control item `expr iff condition` in a process (IEEE 1800-2023 9.4.2.3) is an event only if the condition holds when the occurrence of `expr` is detected. The item's terms are lowered as before; the condition becomes the term's gate: a one-bit module variable itself, or the hidden `$event[k]` assignment of its truth value, with copies of process-local operands sampled before the process suspends. The wait does not watch the gate's operands. The runtime judges a gated term only at checks after combinational logic settled, leaving its baseline untouched before then, and wakes the process only if the gate's least significant bit is a known 1; the occurrence is consumed either way. Designs without iff keep the ungated check loop. A plain `always` whose event has `iff` now runs as a process; `always_ff` keeps rejecting `iff` (#452). The Japanese guide also gets the active-region waiter order of #1783. Closes #1444. BREAKING CHANGE: celox_design::WaitSite has a new public field `gates`, and celox_design::schedule::TermModel a new field `gate`; struct literals of them must set it (`gates: Vec::new()`, `gate: None`). Change-Id: I59402e1356cac2aaf254082d1feef6348380447a
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1721. Part of #1123.
Problem
A process woken by a blocking write of an edge-triggered process ran only after that edge's nonblocking updates:
Icarus 13.0 prints
y=1 q=0,y=0 q=1. Celox printedq=1,q=2, as Verilator 5.052 does. IEEE 1800-2023 4.5 says the blocking write is an update event of the active region, and the NBA region starts only once the active and inactive regions are empty. So the waiter runs first and readsqfrom before the edge. The same ordering explains another symptom: withy = 1; y <= 0; y <= 1;from 0, the waiter did not wait again before the nonblocking updates and woke once per edge instead of the spec count.Cause
#1480 already splits a domain whose blocking results are observed (
active_commits: read by a process kernel, a wait term, another domain's evaluation, or used as an event signal). Its evaluation commits the blocking results, and its apply unit holds only the nonblocking ones. The runtime used that split only throughevaluate_before_inactive, andprocess_phasecalled it only when a#0process was pending. In an ordinary round the process phase returned as soon as the active region was empty.continue_roundthen published the domain's blocking and nonblocking results together, and the woken processes ran in the next round.Fix
In
process_phase, when no process is ready and none is inactive, and a marked trigger evaluates a domain inactive_commits, the domain is now evaluated before the NBA region. This is the same evaluation that already happens before an inactive region:continue_roundpublishes the deferred nonblocking results with the NBA region (apply_deferred).The trigger test (
active_commit_triggered) uses the same filter asevaluate_before_inactive, so a stale trigger hint of a cascaded domain does not start an early evaluation. No SIR changes: the runtime only changes one condition.Tests
New
timing.vtestcases run on every backend: native, cranelift, both parallel variants and wasm.y=1 q=0/y=0 q=1n=3 r=3q=2 r=1 s=1q=1/q=2, the secondn=2 r=2and the thirdr=2 s=2.sv_verilator_active_region_waiters. Its evidence is the standalone probes inverification/repros/sv_active_region_waiters_verilator.json; the LIMITATIONS.md row and the retained shard rows are added too.The docs (
systemverilog-reference.md,external-frontends.md) now state the order.Performance
Runtime Ir measured with callgrind (200k-cycle minus 20k-cycle runs, taskset, two runs each, identical results), base origin/master vs this branch:
active_commits[clk domain]is_empty()check. The small improvements are code layout.#0path.Validation
cargo test -p celox --features systemverilog --lib --test systemverilog: 4290 passed, 0 failed.cargo test -p celox-runtime: 76 passed, 0 failed.CELOX_SCHEDULER=differentialontiming::(refactor(runtime)!: run timed slots from SimulationState with a differential scheduler harness #1756 harness): 575 passed, 0 failed (thetiming::set also passes with the default scheduler).celox-test-suite --features external --test retained_reports: 3 passed.expected.tsv: 2state 543/394/90, 4state 545/392/90 (pass/fail/skip).cargo fmt --checkand clippy-D warningsare clean.