Repository navigation
feat(sv)!: defer assertions of combinational processes, module items and covers - #1878
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: 87fc9d661a
ℹ️ 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 ↓. |
87fc9d6 to
b3f39f3
Compare
713d3a6 to
4e94918
Compare
Revision history
|
b3f39f3 to
c9f6320
Compare
4e94918 to
a81005a
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c9f6320722
ℹ️ 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".
a81005a to
2ab3a7f
Compare
c9f6320 to
0e7031c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0e7031c286
ℹ️ 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".
0e7031c to
8821d4c
Compare
2ab3a7f to
78475a1
Compare
8821d4c to
736ab81
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
736ab81 to
4da191c
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. |
4da191c to
e3ce7bf
Compare
fce39bf to
1a5e079
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. |
e3ce7bf to
32b8420
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 32b8420710
ℹ️ 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".
32b8420 to
03fc450
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 03fc450068
ℹ️ 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".
03fc450 to
0857710
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 08577108d7
ℹ️ 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".
0857710 to
086b802
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 086b802c82
ℹ️ 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".
…and covers ## Summary The previous change deferred the actions of deferred assertions in processes. This one covers the rest of IEEE 1800-2023 16.4, the third part of SVA stage 1 (#89): - **Combinational processes** (`always_comb`, `always_latch`, and an `always` lowered as combinational logic) reported deferred assertions at once. Their flush point is each run of the process (16.4.2), and their actions now wait like those of other processes. - **Module items:** a deferred assertion was rejected (`module deferred immediate assertion`). It is now the same assertion in an `always_comb` (16.4.3). - **Deferred cover** (`cover #0`, `cover final`) was rejected. Its pass action now waits and matures like an assertion's. **Symbolic `always_comb`.** Combinational logic is fused and levelized, so the host decides when a process runs again: when its activation group is active (`comb_activation::active_sites`). This now also flushes its queue: - The SV frontend gives the action site of a deferred assertion `DeferredSite::Action` with the process's activation group as its queue. Lowering sets the group and shifts it like the other combinational sites. - Before the backend evaluates, the simulator takes in the events already issued, then flushes the queue of each active group that has deferred actions (`Simulator::flush_comb_deferred`). An earlier action of the group is discarded, and a new one waits. - A group can also run again because the evaluation changed one of its inputs, as through a continuous assignment; the backend then enables its observers itself. After the evaluation, the simulator reads those enables (the new `SimBackend::comb_capture_event_enabled`) and flushes what such a group had waiting from before (`Simulator::flush_comb_rerun_deferred`). Its new actions are still in the backend's buffer and wait. - A deferred `$fatal` has no fatal code in its observer: combinational logic settles, and the simulation ends when the action matures. **Gated processes.** An `always` that the frontend lowers as a gated imperative unit (`Ff::lower_comb_process`) reports a flush-point event at the start of each run, as an edge-triggered process does. **Module items.** The parser reads a module item that starts with `assert`, `assume` or `cover` (optionally labeled) followed by `#0` or `final` as an `always_comb` procedure whose body is the assertion (`Parser::static_deferred_assertion`), also in a generate region or block (`generate`, `if`/`for` generate blocks and generate `case`). **Slots without a step.** A design without events may never step, and the initial settle of combinational logic belongs to time zero. `Simulation::drain_runtime_events` therefore settles dirty combinational logic and then matures the queue when nothing more is due at the current time, which ends the slot. A fatal action found there is drained as a fatal report. A run with `set_fail_on` matures the slot itself before it checks the reports, also the actions of an earlier settle at that time, so a failure there stops the run. A run or step without it that leaves such a slot settles its logic if it is dirty and matures the actions waiting at that time first (`Simulation::end_idle_slot`, also in `advance_to`), also those of an earlier settle at that time such as `eval_comb`, so a deferred `$fatal` there ends the run at that time. **Untimed hosts.** A `Simulator` call is a time slot. Without a scheduler, the queue matures at the end of the public calls that settle combinational logic (`Simulator::end_untimed_slot`): `eval_comb`, an event drain, and a `modify` while a `RuntimeEventDrain` is active, besides the ticks and edges of the previous change. A settle inside a call, such as the one before the flip-flops of a tick, does not end the slot, so the settle after them can flush what failed in between. A drain returns a fatal action as a fatal report rather than failing (`Simulator::timed` tells timed hosts apart). ## Validation - New cases in `crates/celox/tests/sv_deferred_assertions.rs`: - `always_comb assert #0 (a == y)` with `assign y = ~x`: `a = 1; #0 x = 0;` reports nothing, since the run caused by the change of `y` flushes the first failure. Without the flush after the evaluation the failure was reported; - module-level `assert #0` in `generate ... endgenerate`, an `if` and a `for` generate block and a generate `case`: a glitch is flushed and a lasting failure reports once. Without the parser change they were parse errors; - `set_fail_on(Error)` with an `always_comb assert #0 (a) else $error` and no events: `run_until(10)` stops at 0 with the failure. Without the change it ran to 10. - without `set_fail_on`, an `always_comb assert #0 (a) else $fatal` with no events ends `run_until(10)` at 0 with an error, and so does `step()` with an `initial #5` scheduled. Without the change both returned `Ok`. The same holds after `eval_comb()` or `run_until(0)` already settled the logic, for a `step()` with nothing scheduled, for `advance_to(1)`, and with `set_fail_on` after `eval_comb()`. - `crates/celox/tests/sv_deferred_assertions.rs`, new cases on the interpreter, cranelift, native and wasm backends: - in `always_comb` (with `#0` and `final`), in `always @(a or b)` and as module items (`assert #0`, `assume final`): a glitch from `a = 1; #0 b = 1;` is flushed by the second run, and a lasting failure reports once; - `cover #0` reports its pass action for a lasting difference and nothing for a glitch; - a deferred `$fatal` in `always_comb` ends the run at the end of a slot in which the failure lasted, not in the slot of a glitch; - a module-level `assume #0` of a design without events reports after `run_until(0)`. Without the maturity in the drain it is not reported; - on a `Simulator`, an `always_comb` action matures when the initial settle or a `modify` settles combinational logic. - New non-backend cases: - a drain of a `Simulator` whose `always_comb` holds a failing `assert #0 ... else $fatal` returns the fatal report. Without the change the drain panicked; - with `always_ff @(posedge clk) q <= 1'b1` and `always_comb assert #0 (!clk || q)`, a tick after a host write reports nothing: the failure of the settle before the flip-flops is flushed by the one after them. Without the change it was reported; - the first drain of a `Simulation` with a failing module-level `assert #0` returns the report. Without the change only a second drain did. - Parser and analyzer: module-level deferred assertions (labeled or not, all three keywords, both deferrals) become `always_comb` procedures and analyze. The tests that expected rejection now check that, and that a deferred cover with an assignment action 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-sv-syntax, celox-runtime, celox-design, celox-slt, celox-test-suite, celox-vpi and celox-napi: 15,403 passed. After the maturity in the drain, celox, celox-vpi and celox-napi again: 14,025 passed. - sv-tests conformance (`conformance/sv-tests/run.py`): 12 runs go from fail to pass, and `expected.tsv` is updated: `16.2--assert0`, `--assert-final`, `--assume0`, `--assume-final`, `--cover0` and `--cover-final`, in both state modes. They are elaboration tests of module-level deferred assertions. Each was also simulated with the driver: - `assert0` and `assert-final` (`a = 1`) report nothing; - `assume0` and `assume-final`, whose `a` is an undriven input (0 or X), report `assume failed` from their default `$error`; - `cover0` and `cover-final` have no action. No other result changed. - `cargo clippy --workspace --all-targets` with CI's features and `-D warnings`, clippy of `celox` without default features, `cargo fmt --check`. ## BREAKING CHANGE - Deferred assertions in combinational processes report when they mature, and a re-run of the process discards them. - Module-level deferred assertions and deferred covers are accepted. Change-Id: Idc510d3a28cde5401f0327b296ab70cab8e67d19
086b802 to
71e4e4f
Compare
|
@Mergifyio queue |
Merge Queue Status
This pull request spent 53 minutes 44 seconds in the queue, including 27 minutes 9 seconds running CI. Required conditions to merge
|
Summary
The previous change deferred the actions of deferred assertions in processes. This one covers the rest of IEEE 1800-2023 16.4, the third part of SVA stage 1 (#89):
always_comb,always_latch, and analwayslowered as combinational logic) reported deferred assertions at once. Their flush point is each run of the process (16.4.2), and their actions now wait like those of other processes.module deferred immediate assertion). It is now the same assertion in analways_comb(16.4.3).cover #0,cover final) was rejected. Its pass action now waits and matures like an assertion's.Symbolic
always_comb. Combinational logic is fused and levelized, so the host decides when a process runs again: when its activation group is active (comb_activation::active_sites). This now also flushes its queue:DeferredSite::Actionwith the process's activation group as its queue. Lowering sets the group and shifts it like the other combinational sites.Simulator::flush_comb_deferred). An earlier action of the group is discarded, and a new one waits.SimBackend::comb_capture_event_enabled) and flushes what such a group had waiting from before (Simulator::flush_comb_rerun_deferred). Its new actions are still in the backend's buffer and wait.$fatalhas no fatal code in its observer: combinational logic settles, and the simulation ends when the action matures.Gated processes. An
alwaysthat the frontend lowers as a gated imperative unit (Ff::lower_comb_process) reports a flush-point event at the start of each run, as an edge-triggered process does.Module items. The parser reads a module item that starts with
assert,assumeorcover(optionally labeled) followed by#0orfinalas analways_combprocedure whose body is the assertion (Parser::static_deferred_assertion), also in a generate region or block (generate,if/forgenerate blocks and generatecase).Slots without a step. A design without events may never step, and the initial settle of combinational logic belongs to time zero.
Simulation::drain_runtime_eventstherefore settles dirty combinational logic and then matures the queue when nothing more is due at the current time, which ends the slot. A fatal action found there is drained as a fatal report. A run withset_fail_onmatures the slot itself before it checks the reports, also the actions of an earlier settle at that time, so a failure there stops the run. A run or step without it that leaves such a slot settles its logic if it is dirty and matures the actions waiting at that time first (Simulation::end_idle_slot, also inadvance_to), also those of an earlier settle at that time such aseval_comb, so a deferred$fatalthere ends the run at that time.Untimed hosts. A
Simulatorcall is a time slot. Without a scheduler, the queue matures at the end of the public calls that settle combinational logic (Simulator::end_untimed_slot):eval_comb, an event drain, and amodifywhile aRuntimeEventDrainis active, besides the ticks and edges of the previous change. A settle inside a call, such as the one before the flip-flops of a tick, does not end the slot, so the settle after them can flush what failed in between. A drain returns a fatal action as a fatal report rather than failing (Simulator::timedtells timed hosts apart).Validation
crates/celox/tests/sv_deferred_assertions.rs:always_comb assert #0 (a == y)withassign y = ~x:a = 1; #0 x = 0;reports nothing, since the run caused by the change ofyflushes the first failure. Without the flush after the evaluation the failure was reported;assert #0ingenerate ... endgenerate, anifand aforgenerate block and a generatecase: a glitch is flushed and a lasting failure reports once. Without the parser change they were parse errors;set_fail_on(Error)with analways_comb assert #0 (a) else $errorand no events:run_until(10)stops at 0 with the failure. Without the change it ran to 10.set_fail_on, analways_comb assert #0 (a) else $fatalwith no events endsrun_until(10)at 0 with an error, and so doesstep()with aninitial #5scheduled. Without the change both returnedOk. The same holds aftereval_comb()orrun_until(0)already settled the logic, for astep()with nothing scheduled, foradvance_to(1), and withset_fail_onaftereval_comb().crates/celox/tests/sv_deferred_assertions.rs, new cases on the interpreter, cranelift, native and wasm backends:always_comb(with#0andfinal), inalways @(a or b)and as module items (assert #0,assume final): a glitch froma = 1; #0 b = 1;is flushed by the second run, and a lasting failure reports once;cover #0reports its pass action for a lasting difference and nothing for a glitch;$fatalinalways_combends the run at the end of a slot in which the failure lasted, not in the slot of a glitch;assume #0of a design without events reports afterrun_until(0). Without the maturity in the drain it is not reported;Simulator, analways_combaction matures when the initial settle or amodifysettles combinational logic.Simulatorwhosealways_combholds a failingassert #0 ... else $fatalreturns the fatal report. Without the change the drain panicked;always_ff @(posedge clk) q <= 1'b1andalways_comb assert #0 (!clk || q), a tick after a host write reports nothing: the failure of the settle before the flip-flops is flushed by the one after them. Without the change it was reported;Simulationwith a failing module-levelassert #0returns the report. Without the change only a second drain did.always_combprocedures and analyze. The tests that expected rejection now check that, and that a deferred cover with an assignment action is rejected.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-sv-syntax, celox-runtime, celox-design, celox-slt, celox-test-suite, celox-vpi and celox-napi: 15,403 passed. After the maturity in the drain, celox, celox-vpi and celox-napi again: 14,025 passed.conformance/sv-tests/run.py): 12 runs go from fail to pass, andexpected.tsvis updated:16.2--assert0,--assert-final,--assume0,--assume-final,--cover0and--cover-final, in both state modes. They are elaboration tests of module-level deferred assertions. Each was also simulated with the driver:assert0andassert-final(a = 1) report nothing;assume0andassume-final, whoseais an undriven input (0 or X), reportassume failedfrom their default$error;cover0andcover-finalhave no action.No other result changed.
cargo clippy --workspace --all-targetswith CI's features and-D warnings, clippy ofceloxwithout default features,cargo fmt --check.BREAKING CHANGE