Repository navigation
feat(sv): lower expression events and @* in processes - #1681
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 17 minutes 9 seconds in the queue, including 8 minutes 53 seconds running CI. ReasonThe merge conditions cannot be satisfied due to failing checks
Failing checks:
HintYou may have to fix your CI before adding the pull request to the queue again. Waiting for
All conditions
Requeued — the merge queue status continues in this comment ↓. |
Part of #1123, step 4 PR 4. An event item other than a whole module variable (selects, variable-index selects, any expression, pure function calls) becomes a hidden continuous assignment `$event[k] = expr`, and the wait term watches `$event[k]` (Rises, Falls or Changes). Each update of its value is an occurrence; an edge is one of the expression's LSB (IEEE 1800-2023 9.4.2, Table 9-2). Process-local and automatic operands are copied into `$event[k].arg[n]` before the process suspends, and the process stores the expression's value into `$event[k]`, so the event control samples it when it begins. The process only stores; detection stays the assignment plus the value baseline, and the store does not make `$event[k]` a counted signal. These variables are hidden from the signal listing and the waveform like the process slots, and persist in state files. `@*` in a process waits on the variables its statement reads (9.4.2.2). `iff`, impure calls and static task arguments stay rejected. Change-Id: Ifaff84d2abec60db0541d6ba8455b8815726c52a
f7bca37 to
dafc7c9
Compare
Merge Queue Status
This pull request spent 1 hour 26 minutes 45 seconds in the queue, including 1 hour 24 minutes 33 seconds running CI. Required conditions to merge
|
Part of #1123, step 4, PR 4: expression events in SV processes.
What is lowered
$event[k] = expr.$event[k]holding the IEEE payload bits, so a fractional change is still an event.$event[k], Rises | Falls | Changes);edgestill gives a Rises term and a Falls term.wake_if.$event[k].arg[n]beforesuspend_wait. The assignment reads those copies and the module-scope sources.$event[k], so the event control samples it when it begins.$event[k]a counted signal. The variables are hidden, so assembly declares no counters for them; a test checks this.@*/@(*)in a process waits on the variables its statement reads (9.4.2.2): right-hand sides, conditions, case items, arguments and left-hand-side indices.$event[...]and its copies are left out ofnamed_signals()and the VCD, like the$initial[...]process slots, and they are kept in state files.iff(feat(sv): support iff-qualified event controls in processes #1444), impure calls (impure callfin an event expression), and event expressions reading a static task argument. The last one is the same rule aswait.Tests
Exclusions: all 14
timing.rsexclusions are removed; each case passes on all five backends.New
timing.vtestcases, each first checked withverify-sv-icarus/verify-sv-verilator --fresh:expression_events_see_pulses_within_a_time_slot(a ^ b)within one slotreal_expression_events_see_fractional_changes@(r * 2.0)with changes below 1.0bit_select_edges_follow_the_selected_bit@(posedge v[3])whilev[0]stays 0part_select_events_see_pulses_of_the_selected_bitsvariable_index_events_follow_the_index@(q[i]), including an index changepure_function_events_change_with_the_resultevent_expressions_read_automatic_task_localst(0)/t(1)reproevent_controls_sample_the_expression_when_they_begina = 1; @(a ^ b);reproimplicit_event_controls_in_processes_wait_on_their_reads@*ininitial foreverand in analwayswith a delayExternal results:
t(0)/t(1)task case.a = 1; @(a ^ b);: it wakes the process. The case asserts the Verilator and spec behaviour, and is excluded for Icarus assv_icarus_expression_event_sample, with the pre-exclusion result inverification/repros/.@*ininitial forever("Unsupported: … in this context"). A standalonealways @*with a delay in its body does not terminate in Verilator. That case is excluded for Verilator assv_verilator_implicit_event_in_process.verification/sv/{icarus,verilator}/timing.jsonare refreshed from full freshtiming::runs. The diff only adds cases, including several that had been missing from the retained reports.Rust tests:
named_signalsleave the variables out, the state file keeps$event[0]and$event[0].arg[0]asState, and there are no counters;$time, static task argument;@*list.Extra cross-check: a probe of
@(mem[i]),@(posedge v[3] or negedge (a & b)),@(edge (a ^ b)),@(v[k])in aforloop,@*readingmem[i]and@(v[i +: 2])gave the same counts as Icarus at every step, at O0 and O1.Scoped runs, all passing after rebasing onto 3078a32:
--test systemverilog: 3394 passed;executor_call_traces*) unchanged;-p celox-sv-analyzer -p celox-frontend-sv -p celox-test-suite;-D warningsandfmt --check.sv-tests conformance example: verdicts are identical to
expected.tsv, both before and after the rebase. No fail→pass, so the file is unchanged. The 9.4.2 cases that still fail are rejected foralways_ffedge forms andiff.Perf
(a) Pure RTL.
SIR: for all 412 untimed SV suite designs, a digest of the optimized SIR plus the runtime program is byte-identical between master 8b0f2b1 and this branch on that base. Both sides' digests are stable across runs.
Callgrind on a local SV gate (not committed): 64 lanes of
always_ffaccumulators, ticked by the host.Equal.
(b) Design with an expression event, reported with no target. It is the same RTL with its own
always #5clock andinitial forever @(posedge (clk & en)) hits++. Same method: 1877220058, 1877220058, 1877217692, 1877220058, 1877217692, median 1,877,220,058 for 180,000 cycles.