Skip to content

feat(sv)!: run always blocks with timing controls as processes - #1475

Merged
mergify[bot] merged 4 commits into
masterfrom
feature/sv-always-processes
Oct 18, 2026
Merged

mergify[bot] merged 4 commits into
masterfrom
feature/sv-always-processes

Conversation

@tignear

@tignear tignear commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1123, step 4, PR 2 of 6. Follows #1459 (merged).

What changes

Classification. An always that 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 the initial ones, in declaration order. Kernels of this kind:

  • always #5 clk = ~clk;
  • a level-sensitive always @(a or b) ... (feat(sv): support always and always_latch processes #431);
  • an edge list whose body has timing controls, as in always @(posedge clk) begin #1 ... end;
  • an always with 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_ff and 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.

Tests

  • timing.vtest: the 5 always-process cases run on all five backends. Exclusions left in this PR:

    Cases Reason Lands in
    14 non-variable event expressions PR 4
    2 timed tasks PR 5
    2 blocking stores of an edge-triggered always are committed with its nonblocking ones, not in the active region fix(sim): commit blocking flip-flop stores in the active region and nonblocking ones in the NBA region #1470 (PR 2b, next)

    Every 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_unknown runs too.

  • Slot budget: an_always_without_timing_exhausts_the_slot_budget covers 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_op and 9.4.2.1--event_or_op go from fail to pass. Simulated, a toggles every 5 time units. In the two event-list tests out updates 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.tsv is 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;
    • clippy -D warnings and fmt --check.

Perf

Same callgrind method as #1459: local SV gate, 200,000 minus 20,000 cycles, five runs each.

runs median
(a) pure RTL, #1459 head 1000631654, 1014896822, 1015487110, 1003685928, 1014353569 1,014,353,569
(a) pure RTL, this PR 1013346464, 1133981711, 1134813856, 1015130493, 1135054952 1,133,981,711
(b3) clock from always #5 clk = ~clk 1164942066, 1164394708, 1164506101, 1166335141, 1165315037 1,164,942,066

BREAKING CHANGE

celox_sv_analyzer::AnalyzerError has the new variant TimingControlOutsideProcess. always_latch is rejected as "always_latch process" instead of "always and always_latch processes".

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T04:15:44.378510Z 8439073 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 18, 2026
Base automatically changed from feature/sv-process-timing to master October 18, 2026 03:30
@mergify mergify Bot added the queued Mergify queue entry label Oct 18, 2026
@mergify

mergify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 41 minutes 46 seconds in the queue, with no time running CI.

Reason

The pull request #1475 has been manually updated

Waiting for
  • check-success = Queue validation
  • any of: [🛡 GitHub repository ruleset rule master]
    • check-neutral = @github-actions/Rust Test & NAPI Build
    • check-skipped = @github-actions/Rust Test & NAPI Build
    • check-success = @github-actions/Rust Test & NAPI Build
All conditions
  • check-success = Queue validation
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-neutral = @github-actions/Rust Test & NAPI Build
    • check-skipped = @github-actions/Rust Test & NAPI Build
    • check-success = @github-actions/Rust Test & NAPI Build
  • check-success = Conventional Commit title
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Lint & Format
    • check-neutral = @github-actions/Lint & Format
    • check-skipped = @github-actions/Lint & Format
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-neutral = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-skipped = @github-actions/NAPI Build (Linux ARM64 GNU)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Windows)
    • check-neutral = @github-actions/NAPI Build (Windows)
    • check-skipped = @github-actions/NAPI Build (Windows)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Ubuntu)
    • check-neutral = @github-actions/JS Test (Ubuntu)
    • check-skipped = @github-actions/JS Test (Ubuntu)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Windows)
    • check-neutral = @github-actions/JS Test (Windows)
    • check-skipped = @github-actions/JS Test (Windows)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Conventional Commit title
    • check-neutral = @github-actions/Conventional Commit title
    • check-skipped = @github-actions/Conventional Commit title

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +65 to +66
if has_timing_control(RefNode::StatementOrNull(&timing.nodes.1)) {
return AlwaysKind::Process;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@mergify mergify Bot added the queued Mergify queue entry label Oct 18, 2026
@mergify

mergify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

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
  • check-success = Conventional Commit title
  • check-success = Queue validation
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Lint & Format
    • check-neutral = @github-actions/Lint & Format
    • check-skipped = @github-actions/Lint & Format
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-neutral = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-skipped = @github-actions/NAPI Build (Linux ARM64 GNU)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Windows)
    • check-neutral = @github-actions/NAPI Build (Windows)
    • check-skipped = @github-actions/NAPI Build (Windows)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Rust Test & NAPI Build
    • check-neutral = @github-actions/Rust Test & NAPI Build
    • check-skipped = @github-actions/Rust Test & NAPI Build
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Ubuntu)
    • check-neutral = @github-actions/JS Test (Ubuntu)
    • check-skipped = @github-actions/JS Test (Ubuntu)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Windows)
    • check-neutral = @github-actions/JS Test (Windows)
    • check-skipped = @github-actions/JS Test (Windows)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Conventional Commit title
    • check-neutral = @github-actions/Conventional Commit title
    • check-skipped = @github-actions/Conventional Commit title

@mergify
mergify Bot merged commit 5a64598 into master Oct 18, 2026
30 checks passed
@mergify
mergify Bot deleted the feature/sv-always-processes branch October 18, 2026 05:16
@mergify mergify Bot removed the queued Mergify queue entry label Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-ready Request merging through Mergify after required checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant