Repository navigation
fix(sv)!: defer the actions of deferred assertions in processes - #1877
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. |
|
This pull request is part of a Mergify stack:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 713d3a65ed
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Queued — the merge queue status continues in this comment ↓. |
713d3a6 to
4e94918
Compare
693f32a to
3df1b35
Compare
Revision history
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4e949181a0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
3df1b35 to
7b255b9
Compare
a81005a to
2ab3a7f
Compare
7b255b9 to
0eb27bd
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2ab3a7f56c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
0eb27bd to
bac33ca
Compare
2ab3a7f to
78475a1
Compare
bac33ca to
305f5a5
Compare
78475a1 to
6ea4a3b
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
1 similar comment
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
6ea4a3b to
fce39bf
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
`assert #0`, `assume #0`, `assert final` and `assume final` in a process reported at once, like simple immediate assertions. Glitches that a deferred assertion exists to hide were therefore reported. IEEE 1800-2023 16.4 instead has the action wait in the process's deferred assertion report queue: - its arguments are evaluated when the assertion executes; - a flush point of the process discards what waits (16.4.2): a resume from an event control or a wait, but not a resume after a delay; - what is left matures in the Observed region (`#0`) or the Postponed region (`final`) of the time slot. This is the second part of SVA stage 1 (#89). **Flush points as events.** - The SV frontend gives a process that holds a deferred assertion, directly or in a subroutine it calls, a flush-point event site (`DeferredSite::FlushPoint`). A process kernel reports it whenever it wakes from an event control or a wait (`ProcessKernelBuilder::flush_deferred_at`, in `wake_if`). An edge-triggered process reports it at the start of each evaluation, which is a resume from its event control. - The site of a deferred action is `DeferredSite::Action { queue, region }`, where `queue` is the flush-point site of its process. Assembly offsets it like the other sites of the instance. - A deferred `$fatal` does not stop the evaluation; it ends the simulation when it matures. - The SV frontend also finds a deferred assertion in a subroutine that only the default of an omitted argument, or a timing control (`wait`, an event control or a delay), calls. **The queue on the host.** - `PendingRuntimeEvents`, which the simulator's drain and `RuntimeEventDrain` share, holds back the events of action sites in issue order. A flush-point event discards those of its queue. - When the slot is over, `mature` queues what is left: the `#0` actions, then the `final` ones, up to the first fatal one, after which the simulation ends. Events of the slot's active regions, such as `$display` output, come before them. - Nothing is needed for designs without deferred assertions: the site table is empty and `Simulator::deferred_assertions` is false. - Events lost to a full event buffer (`Missed`) may have held a deferred `$fatal`. In a design with a fatal deferred action they end the simulation when the slot matures, with `missed N runtime events, which may have held a deferred $fatal`. **The end of a time slot.** - A step of the runtime ends before its slot when a process waits for zero time, and `try_finish_timed_step` is called at the end of every step. The new `HostBoundary::try_end_time_slot` is called only when no more work is due at that time; the simulator matures the queue there. - A design with deferred assertions runs the runtime's loop (`CompiledSlots::None`), which tells the two apart. - A `Simulator` call is a time slot, so the queue matures after each run of a domain (`fire`), after `tick_events`, and after `edge` and `edges` through derived domains (`note_edge`), which also serve `tick` of a clock with derived domains. **Analyzer.** - The deferral of an immediate assertion is recorded in `AssertionSite::deferral` (previously always `None`). - A deferred action must be one display or severity task call (16.4). User subroutines would run in the Reactive region, which Celox does not model, so they are rejected. Deferred assertions in `always_comb`, `always_latch` and `always` processes lowered as combinational logic still report at once. Module-level ones and deferred cover stay rejected. The next change handles combinational processes. - New `crates/celox/tests/sv_deferred_assertions.rs` on the interpreter, cranelift, native and wasm backends: - a resume from `@(a or b)` flushes the failure of the first execution, while the immediate assertion beside it reports; - the `a3`/`a4` example of 16.4.2: `a3` reports and `a4` is flushed; - `$display` output, then `#0` actions (fail and pass), then `final` ones in one slot; - an edge-triggered process: one edge reports, and a second edge in the slot flushes; - a deferred `$fatal` stops the run at the end of its slot and is drained as a fatal report; - a `Simulator` tick matures the action of an `always_ff`; - a timed `Simulation` built from a reloaded native image flushes the glitch and reports the lasting failure as the in-process build does (`native_simulation_image::deferred_assertions_run_from_the_image`); - `edges` and ticks of a clock with a derived domain mature each call's actions: 9 reports for 2 `edges` periods and 4 ticks. Without `note_edge` maturing none are drained; - a function called only from the default of an omitted argument holds a `#0` assertion: its report follows the `$display` after the call. Without the default scan it comes first; - a deferred `$fatal` followed by 2,000 `$display`s in its slot still ends the run, with a `missed` error; - a `final` action after an `#0` `$fatal` does not mature. Without the change it was drained; - a function called only by a `wait` condition holds an `#0` assertion: its report follows the `$display` after the wait. Without the change it came first; - an action of two statements is rejected. - `cargo nextest run` with CI's features (`celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus`) on celox, celox-frontend-{core,sv,veryl}, celox-sv-analyzer, celox-runtime, celox-design, celox-slt, celox-test-suite, celox-vpi and celox-napi: 15,270 passed, after updating the two analyzer tests that gave deferred assertions assignment actions, which 16.4 does not allow (they now use a `$info` action, and check that the header's deferral makes an assignment action an error). - sv-tests conformance (`conformance/sv-tests/run.py`): unchanged from `expected.tsv`. - `cargo clippy --workspace --all-targets` with CI's features and `-D warnings`, clippy of `celox` without default features, `cargo fmt --check`. - `celox_design::RuntimeEventSite` has the new field `deferred`, of the new type `DeferredSite`. The native image container version is 36. - Deferred assertions in processes report when they mature, at the end of their time slot, and a flush point discards them. Change-Id: I1062591d4b559e6f6fa13de6f7a435b7790c02e5
fce39bf to
1a5e079
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@Mergifyio queue |
Merge Queue Status
This pull request spent 36 minutes 54 seconds in the queue, including 34 minutes 54 seconds running CI. Required conditions to merge
|
assert #0,assume #0,assert finalandassume finalin a process reported at once, like simple immediate assertions. Glitches that a deferred assertion exists to hide were therefore reported. IEEE 1800-2023 16.4 instead has the action wait in the process's deferred assertion report queue:#0) or the Postponed region (final) of the time slot.This is the second part of SVA stage 1 (#89).
Flush points as events.
DeferredSite::FlushPoint). A process kernel reports it whenever it wakes from an event control or a wait (ProcessKernelBuilder::flush_deferred_at, inwake_if). An edge-triggered process reports it at the start of each evaluation, which is a resume from its event control.DeferredSite::Action { queue, region }, wherequeueis the flush-point site of its process. Assembly offsets it like the other sites of the instance.$fataldoes not stop the evaluation; it ends the simulation when it matures.wait, an event control or a delay), calls.The queue on the host.
PendingRuntimeEvents, which the simulator's drain andRuntimeEventDrainshare, holds back the events of action sites in issue order. A flush-point event discards those of its queue.maturequeues what is left: the#0actions, then thefinalones, up to the first fatal one, after which the simulation ends. Events of the slot's active regions, such as$displayoutput, come before them.Simulator::deferred_assertionsis false.Missed) may have held a deferred$fatal. In a design with a fatal deferred action they end the simulation when the slot matures, withmissed N runtime events, which may have held a deferred $fatal.The end of a time slot.
try_finish_timed_stepis called at the end of every step. The newHostBoundary::try_end_time_slotis called only when no more work is due at that time; the simulator matures the queue there.CompiledSlots::None), which tells the two apart.Simulatorcall is a time slot, so the queue matures after each run of a domain (fire), aftertick_events, and afteredgeandedgesthrough derived domains (note_edge), which also servetickof a clock with derived domains.Analyzer.
AssertionSite::deferral(previously alwaysNone).Deferred assertions in
always_comb,always_latchandalwaysprocesses lowered as combinational logic still report at once. Module-level ones and deferred cover stay rejected. The next change handles combinational processes.New
crates/celox/tests/sv_deferred_assertions.rson the interpreter, cranelift, native and wasm backends:@(a or b)flushes the failure of the first execution, while the immediate assertion beside it reports;a3/a4example of 16.4.2:a3reports anda4is flushed;$displayoutput, then#0actions (fail and pass), thenfinalones in one slot;$fatalstops the run at the end of its slot and is drained as a fatal report;Simulatortick matures the action of analways_ff;Simulationbuilt from a reloaded native image flushes the glitch and reports the lasting failure as the in-process build does (native_simulation_image::deferred_assertions_run_from_the_image);edgesand ticks of a clock with a derived domain mature each call's actions: 9 reports for 2edgesperiods and 4 ticks. Withoutnote_edgematuring none are drained;#0assertion: its report follows the$displayafter the call. Without the default scan it comes first;$fatalfollowed by 2,000$displays in its slot still ends the run, with amissederror;finalaction after an#0$fataldoes not mature. Without the change it was drained;waitcondition holds an#0assertion: its report follows the$displayafter the wait. Without the change it came first;cargo nextest runwith CI's features (celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus) on celox, celox-frontend-{core,sv,veryl}, celox-sv-analyzer, celox-runtime, celox-design, celox-slt, celox-test-suite, celox-vpi and celox-napi: 15,270 passed, after updating the two analyzer tests that gave deferred assertions assignment actions, which 16.4 does not allow (they now use a$infoaction, and check that the header's deferral makes an assignment action an error).sv-tests conformance (
conformance/sv-tests/run.py): unchanged fromexpected.tsv.cargo clippy --workspace --all-targetswith CI's features and-D warnings, clippy ofceloxwithout default features,cargo fmt --check.celox_design::RuntimeEventSitehas the new fielddeferred, of the new typeDeferredSite. The native image container version is 36.Deferred assertions in processes report when they mature, at the end of their time slot, and a flush point discards them.