Skip to content

feat(sv): run plain always blocks without the flip-flop shape as processes - #1729

Merged
mergify[bot] merged 4 commits into
masterfrom
fix/sv-always-event-processes
Oct 23, 2026
Merged

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

Conversation

@tignear

@tignear tignear commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Part of #1123. Fixes #1708.

IEEE 1800-2023 9.2.2.4 restricts only always_ff to the shape of a flip-flop. Celox now runs a plain always whose event control does not have that shape as a process. The process waits on the same event control, using the expression-event lowering from #1681. Before this change, such a block was rejected as if it were an always_ff.

Form Before Now
always @(posedge v[0]), @(posedge (a & b)), @(edge a), @(posedge c or b) "always_ff event expression" process
always @(posedge bus) with a multi-bit bus "multi-bit always_ff event signal" process; the edge is judged on the LSB (Table 9-2)
always @(posedge a or posedge b) n <= n + 1; with no reset test in the body "always_ff event control" process that wakes on either edge

Where the decision is made:

  • Analyzer: ff_process::always_falls_back_to_process decides events that are not edges of a variable. The FF collector and the process collector both use it.
  • Frontend: runs_as_process handles shapes that only the frontend can judge: there is no clock/reset split, or an event signal is wider than one bit. It moves these blocks to ordinary processes through Module::run_edge_processes_as_processes. Unlike scheduled edge processes, they are not marked scheduled_edge.

always_ff with these forms stays rejected. Its messages still say always_ff, and since a plain always no longer reaches those paths, they now appear only when the source says always_ff.

Fix included: posedge, negedge and edge of a real are illegal (6.12). On master, a process waiting on one, such as initial @(posedge r), was accepted and never woke. Now it raises a new language error, AnalyzerError::RealEdgeEvent. Without this fix, sv-tests 6.12--real_edge (should_fail) would have regressed. It used to be rejected only because a real is 64 bits wide.

Interaction with #1712: in a Simulator, these blocks are now processes. A Simulator does not run processes today, and #1712 (branch fix/simulator-rejects-processes) turns that into an error. That PR will cover these blocks as well. This PR doesn't touch the Simulator path.

Perf

(a) Pure RTL is unchanged. For every one of the 438 untimed SV suite cases, the optimized SIR (TraceOptions::post_optimized_sir, Debug text hashed) is byte-identical between master and this branch. Blocks of the flip-flop shape never reach the new code: the frontend clones the module only when some block falls back.

Tests

  • New vtests, which pass on Celox, Icarus and Verilator:

    • plain_always_expression_edges_run_as_processes
    • plain_always_multi_bit_edges_follow_the_lsb
    • plain_always_edges_without_a_reset_run_as_processes

    The retained Icarus and Verilator reports were refreshed from fresh runs, and the diff only adds these three cases.

  • edge_events_of_reals_are_errors.

  • The pinned rejections from docs(sv): document timing controls in processes #1716 now use the always_ff forms.

  • sv-tests: 9.4.2--event_control_edge goes from fail to pass in 2state and 4state. I checked this by simulation: with a toggling clock, Celox matches Icarus and Verilator (a=15, then a=0). expected.tsv is updated, and there are no other changes.

  • --test systemverilog, the analyzer, frontend-sv and test-suite crates, clippy -D warnings, fmt and docs:build all pass.

@chatgpt-codex-connector

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 ⚠️ Failed 2026-10-22T05:25:49.618252Z
We couldn’t complete this review. Comment @codex review to try again.
a7cacb6 PR opened
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@mergify

mergify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

@tignear
tignear force-pushed the fix/sv-always-event-processes branch from a7cacb6 to 746a3e2 Compare October 22, 2026 13:55
@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 22, 2026
@mergify mergify Bot added the queued Mergify queue entry label Oct 22, 2026
@mergify

mergify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-22 15:14 UTC · Rule: changes · triggered by rule Queue explicitly requested merges
  • 🚫 Left the queue — 2026-10-22 15:36 UTC · at 746a3e23f52060b320d8960e4edf841dfc37354e

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

Reason

The pull request conflicts with the base branch

Hint

You should update or rebase your pull request.

If you want to requeue this pull request, you can post a @mergifyio queue comment.

Requeued — the merge queue status continues in this comment ↓.

@mergify mergify Bot added dequeued Mergify stopped this queue entry; investigate before retrying and removed queued Mergify queue entry labels Oct 22, 2026
@tignear tignear removed merge-ready Request merging through Mergify after required checks dequeued Mergify stopped this queue entry; investigate before retrying labels Oct 22, 2026
@mergify mergify Bot added the dequeued Mergify stopped this queue entry; investigate before retrying label Oct 22, 2026
@tignear
tignear force-pushed the fix/sv-always-event-processes branch from 746a3e2 to 0ff6c70 Compare October 22, 2026 16:57
@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 22, 2026
@mergify mergify Bot removed the dequeued Mergify stopped this queue entry; investigate before retrying label Oct 22, 2026
@tignear
tignear force-pushed the fix/sv-always-event-processes branch from 0ff6c70 to d7741b6 Compare October 22, 2026 21:14
@tignear tignear added merge-ready Request merging through Mergify after required checks and removed merge-ready Request merging through Mergify after required checks labels Oct 22, 2026
@mergify mergify Bot added the queued Mergify queue entry label Oct 22, 2026
@mergify

mergify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-22 22:17 UTC · Rule: changes · triggered by rule Queue explicitly requested merges
  • 🚫 Left the queue — 2026-10-22 23:29 UTC · at d7741b66405d3ad23266a33c813f70c01a90a473

This pull request spent 1 hour 12 minutes 13 seconds in the queue, with no time running CI.

Reason

The pull request conflicts with the base branch

The pull request was held in the queue, conflicting with at least one of 3 pull requests ahead of it. The conflict became a base branch one after #1726 merged.

Hint

You should update or rebase your pull request.

If you want to requeue this pull request, you can post a @mergifyio queue comment.

Requeued — the merge queue status continues in this comment ↓.

@mergify mergify Bot added dequeued Mergify stopped this queue entry; investigate before retrying and removed queued Mergify queue entry labels Oct 22, 2026
@tignear tignear removed merge-ready Request merging through Mergify after required checks dequeued Mergify stopped this queue entry; investigate before retrying labels Oct 22, 2026
@mergify mergify Bot added the dequeued Mergify stopped this queue entry; investigate before retrying label Oct 22, 2026
@tignear
tignear force-pushed the fix/sv-always-event-processes branch from d7741b6 to 502b43d Compare October 23, 2026 00:07
@mergify mergify Bot removed the dequeued Mergify stopped this queue entry; investigate before retrying label Oct 23, 2026
@tignear tignear added merge-ready Request merging through Mergify after required checks and removed merge-ready Request merging through Mergify after required checks labels Oct 23, 2026
@tignear
tignear force-pushed the fix/sv-always-event-processes branch from 502b43d to c87decc Compare October 23, 2026 01:37
@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 23, 2026
@mergify mergify Bot added the queued Mergify queue entry label Oct 23, 2026
@mergify

mergify Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-23 02:51 UTC · Rule: changes · triggered by rule Queue explicitly requested merges
  • 🚫 Left the queue — 2026-10-23 03:41 UTC · at c87decc9c747fab1dd3b7a3db3a873f0c046b7eb

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

Reason

The pull request conflicts with the base branch

The pull request was held in the queue, conflicting with at least one of 3 pull requests ahead of it. The conflict became a base branch one after #1776, #1783 merged.

Hint

You should update or rebase your pull request.

If you want to requeue this pull request, you can post a @mergifyio queue comment.

Requeued — the merge queue status continues in this comment ↓.

@mergify mergify Bot added dequeued Mergify stopped this queue entry; investigate before retrying and removed queued Mergify queue entry labels Oct 23, 2026
@tignear tignear removed merge-ready Request merging through Mergify after required checks dequeued Mergify stopped this queue entry; investigate before retrying labels Oct 23, 2026
A real has no least significant bit to judge an edge on, and IEEE
1800-2023 6.12 prohibits posedge, negedge and edge of a real. A process
waiting on one was accepted and never woke; it is now an error.

Change-Id: If5c69702c6a335e0ca9a8f0621451d23335be3fa
…esses

IEEE 1800-2023 9.2.2.4 restricts only always_ff to the shape of a
flip-flop. A plain always whose event control is not a clock and
asynchronous resets of one-bit variables now runs as a process waiting
on the same event control, instead of being rejected: an edge of a
select or an expression, `edge`, an item without an edge next to edges,
a multi-bit edge signal (judged on its least significant bit), and
several edges of which the body tests none as a reset.

Blocks of the flip-flop shape stay on the flip-flop path, lowered as
before. always_ff of the other shapes stays rejected.

Fixes #1708.

Change-Id: Ic4652f6e110243b39566bbf2ed1d2ab3f81a2f7e
Change-Id: I8638596a6f136bca76c8d2cfa844f258f36c3d38
Change-Id: Ic07f6d1941094224ee0e090dc8381f0a424f3198
@mergify mergify Bot added the dequeued Mergify stopped this queue entry; investigate before retrying label Oct 23, 2026
@tignear
tignear force-pushed the fix/sv-always-event-processes branch from c87decc to d8d628e Compare October 23, 2026 04:49
@mergify mergify Bot removed the dequeued Mergify stopped this queue entry; investigate before retrying label Oct 23, 2026
@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 23, 2026
@mergify mergify Bot added the queued Mergify queue entry label Oct 23, 2026
@mergify

mergify Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 1 hour 17 minutes 10 seconds in the queue, including 1 hour 14 minutes 59 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 9eb6fe6 into master Oct 23, 2026
30 checks passed
@mergify
mergify Bot deleted the fix/sv-always-event-processes branch October 23, 2026 07:24
@mergify mergify Bot removed the queued Mergify queue entry label Oct 23, 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.

SV: lower plain always with non-FF event forms as a process

1 participant