Repository navigation
feat(sv)!: run always blocks with timing controls as processes - #1475
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. |
Merge Queue Status
This pull request spent 41 minutes 46 seconds in the queue, with no time running CI. ReasonThe pull request #1475 has been manually updated Waiting for
All conditions
Requeued — the merge queue status continues in this comment ↓. |
Change-Id: I813945293824eccb9a1ea9fa2b6228a5082b945b
An `always` that is neither combinational (`always_comb`, `always @*`) nor edge-triggered RTL (`always_ff`, or a leading edge list over a body without timing controls) is a process that repeats its statement forever (IEEE 1800-2023 9.2.2.1): `always #5 clk = ~clk`, a level-sensitive `always @(a or b)`, an edge list followed by timing in the body, and an `always` without any timing control, which the slot budget stops at time zero. These processes run as kernels next to the initial ones, in declaration order, and are never folded into initial state. Classification of combinational and flip-flop `always` blocks is unchanged, so their lowering is too. A timing control in `always_comb` or `always_ff` is reported as the language error it is (9.2.2.2, 9.2.2.4), and `always_latch` stays unsupported (#431). BREAKING CHANGE: `AnalyzerError` has the new variant `TimingControlOutsideProcess`, and an `always_latch` is rejected as "always_latch process" instead of "always and always_latch processes". Change-Id: I98222238a619747ed3629fc6f1e499840e419cbc
Enable the five timing cases of `always` processes on every backend, give the timed-task cases their actual reason, test that an `always` without timing exhausts the slot budget, and expect sv-tests `9.2.2.1--always`, `9.4.2.1--event_comma_op` and `9.4.2.1--event_or_op` to pass: simulated, the first toggles `a` every 5 time units and the others wake only on a change of their wires. Change-Id: Ibc88a7a4ca4cb9fcbec7066aa0f7f9bb68e1b260
Change-Id: I7f47a736828bf84dec906eca161314b39fcd1760
1eafa18 to
8439073
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 84390735ba
ℹ️ 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".
| if has_timing_control(RefNode::StatementOrNull(&timing.nodes.1)) { | ||
| return AlwaysKind::Process; |
There was a problem hiding this comment.
Preserve nonblocking assignments in timed always blocks
For a legal block such as always @(posedge clk) begin #1 q <= d; end, this branch classifies the construct as a process, but lower_initial_kernel in crates/celox-frontend-sv/src/lowering/ff.rs unconditionally rejects every process body containing a nonblocking assignment. Consequently, a common timed-always form covered by the new classification still fails during frontend lowering; process kernels need NBA scheduling support, or this case must remain explicitly unsupported until that support exists.
Useful? React with 👍 / 👎.
Merge Queue Status
This pull request spent 39 minutes 43 seconds in the queue, including 37 minutes 45 seconds running CI. Required conditions to merge
|
Part of #1123, step 4, PR 2 of 6. Follows #1459 (merged).
What changes
Classification. An
alwaysthat is neither combinational nor edge-triggered RTL is a process that repeats its statement forever (IEEE 1800-2023 9.2.2.1). It runs as a kernel next to theinitialones, in declaration order. Kernels of this kind:always #5 clk = ~clk;always @(a or b) ...(feat(sv): support always and always_latch processes #431);always @(posedge clk) begin #1 ... end;alwayswith no timing control at all. The slot budget stops it at time 0 with a runtime error instead of hanging.What doesn't change.
always_comb,always @*,always_ffand a leading edge list over a body without timing are classified exactly as before. Their lowering is unchanged: SIR is identical for all 368 untimed SV suite designs.Errors.
always_comboralways_ffis now the language error it is (9.2.2.2, 9.2.2.4):TimingControlOutsideProcess.always_latchstays unsupported (feat(sv): support always and always_latch processes #431).alwaysprocesses are never folded into initial state.Tests
timing.vtest: the 5always-process cases run on all five backends. Exclusions left in this PR:alwaysare committed with its nonblocking ones, not in the active regionEvery enabled case passes on every backend, and every failing one is excluded. With fix(sim): judge four-state edges of internally driven clocks by IEEE 1800 Table 9-2 #1414 on master,
four_state_edges_count_transitions_through_unknownruns too.Slot budget:
an_always_without_timing_exhausts_the_slot_budgetcovers the time-0 runtime error. It lowers the budgets, as the existing zero-time-loop test does; with the defaults it would take about 2^40 iterations.sv-tests conformance:
9.2.2.1--always,9.4.2.1--event_comma_opand9.4.2.1--event_or_opgo from fail to pass. Simulated,atoggles every 5 time units. In the two event-list testsoutupdates only when a wire changes. In four-state mode the wire's x→0 initialization at time 0 is such a change, and Icarus behaves the same way.expected.tsvis updated.Scoped runs, all passing:
cargo test -p celox --features systemverilog --test systemverilog: 2781 passed (rebased on master);--lib: 153 passed; golden call traces unchanged, no snapshot changes;cargo test -p celox-sv-analyzer -p celox-frontend-sv -p celox-test-suite;-D warningsandfmt --check.Perf
Same callgrind method as #1459: local SV gate, 200,000 minus 20,000 cycles, five runs each.
always #5 clk = ~clkinitial forever #5clock measured in feat(sv)!: run delays, event and level waits in initial processes #1459 (1.166G).BREAKING CHANGE
celox_sv_analyzer::AnalyzerErrorhas the new variantTimingControlOutsideProcess.always_latchis rejected as "always_latch process" instead of "always and always_latch processes".