Repository navigation
feat(sv): accept loop temporaries shared by plain edge always blocks - #1950
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. |
|
Queued — the merge queue status continues in this comment ↓. |
Merge Queue Status
This pull request spent 37 minutes 11 seconds in the queue, with no time running CI. ReasonPull request #1950 has been dequeued Queue conditions are not satisfied:
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Requeued — the merge queue status continues in this comment ↓. |
Several plain edge-triggered `always` processes may write one variable, such as the `integer i` that C906's aq_biu_req_arbiter uses as the index of two `always @(posedge clk)` loops. Only always_comb, always_latch and always_ff restrict a variable to one process (IEEE 1800-2023 9.2.2.2, 9.2.2.4); otherwise the last write determines the value (6.5). Celox rejected the design with "multiple variable drivers for `i`". A variable other than an unpacked array that only plain edge processes write, and only by blocking assignments, is now accepted. Those processes read and write its stable state directly, as a blocking assignment updates the variable at once (10.4.1): a process reads its own preceding writes, a later edge sees the other process's writes, and the last write stays even when a coincident process does not write the variable. The usual per-process working seed and commit would let such a process commit the pre-edge value over another process's write. The handling is per variable; designs without such variables lower as before. always_ff overlap and nonblocking writes from several processes stay rejected. Closes #1945 Change-Id: I2bcf163f2ca3ebc3b62c1e6c8fad0c4720f54958
b04fc57 to
7c97e18
Compare
Merge Queue Status
This pull request spent 52 minutes 34 seconds in the queue, including 45 minutes 47 seconds running CI. Required conditions to merge
|
What
Several plain edge-triggered
alwaysprocesses may now write the same variable, such as theinteger ithat C906'saq_biu_req_arbiteruses as the index of twoalways @(posedge clk)loops. Before this change Celox rejected the design with "multiple variable drivers fori".Only
always_comb,always_latchandalways_ffrestrict a variable to one process (IEEE 1800-2023 9.2.2.2, 9.2.2.4). Otherwise a variable may have several procedural writers, and the last write determines its value (6.5).How it lowers (per variable)
shared_edge_variablesfinds variables that are not unpacked arrays and that only plain edge processes write, all by blocking assignments. The edge lowering (Ff::with_shared_variables) then reads and writes their stable state directly, without a per-process working seed or commit. A blocking assignment updates the variable at once (10.4.1). So:The ordinary seed/commit protocol could not provide that last point. Each process seeds its working copy from the pre-edge value and commits it back, so a process that conditionally skips the write would commit the stale value over the other process's write.
Still rejected: overlap that involves
always_ff(#1865 covers diagnostics), and nonblocking writes to the variable from several processes. Designs without such variables lower exactly as before.Validation
procedural.vtest: same-clock loops with a read after the loop, a read before the write and a conditional writer; two clocks with a coincident edge; and the C906 async-reset arbiter pattern. They pass on all five Celox backends and on Icarus 13.0, Verilator 5.052 and xezim (verify-sv-{icarus,verilator,xezim} --filter procedural::). They also give the same per-tick trace as Verilator in both state modes, and in a variant where one writer calls$display(scheduled kernel path).rejects_loop_indices_shared_with_always_ff(always_ff/always_ff, always_ff/always, always/always_ff, and a nonblocking + blocking pair).cargo nextest run -p celox --features systemverilog --test systemverilog --test diagnostic_policy --test sv_scheduled_host_requests: 4777 passed (after rebasing on the current master).cargo nextest run -p celox-test-suite --features verilator,icarus,xezim(retained reports): 81 passed;-p celox-frontend-sv: passed.conformance/sv-tests/run.py --state-mode both --expected conformance/sv-tests/expected.tsv): matches the expectations, no change.cargo fmt --check,cargo clippy -p celox-frontend-sv -p celox --all-targets --features celox/systemverilog: clean.Performance
Unaffected designs generate identical code.
b2_vm_dispatch_bit(no shared writers), native backend, callgrind scoped toSimulationState::step_until, based9e44c9221vs this change:The rest of the gap is in Rust host functions (
settle_pass,get_as, ...). Their source is unchanged; they differ only because the two binaries were built separately. For the target workload, C906's arbiter is now accepted; it was rejected before, so there is no before/after timing to compare.Closes #1945