Skip to content

fix(sv): preserve signedness of power expressions - #1718

Merged
mergify[bot] merged 1 commit into
masterfrom
stack/tignear/fix/sv-power-signedness/preserve-signedness-power-expressions--0cf4f9c8
Oct 22, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
stack/tignear/fix/sv-power-signedness/preserve-signedness-power-expressions--0cf4f9c8

Conversation

@tignear

@tignear tignear commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

The SV frontend classified every power expression as unsigned. Expressions
such as $signed(error) / 2**4 consequently zero-extended negative errors;
a 13-bit -384 became 7808 and divided to 488 instead of -24. This prevented
Taxi's PTP control loops from locking.

Use the base's signedness in both expression and port-connection classifiers,
with a self-determined exponent (IEEE 1800-2023 11.6.1, Table 11-21).
Add classifier tests and shared two-state/four-state regressions covering
constant and dynamic powers, signed/unsigned bases and destinations, sized
casts, and continuous/always_comb/always_ff execution.

Validation:

  • SV common suite on all five backend variants: 3658 passed, 20 existing ignores.
  • SV frontend unit tests: 3 passed.
  • New cases: Icarus 2 passed; Verilator 1 passed, four-state case unsupported.
  • Minimal reproducer at O0 and O1: five input vectors each, no mismatches.
  • Original Taxi clock_cdc[96] and td_leaf full tests pass at O1/two-state with inferred_latch=warn; original sources unchanged.
  • cargo fmt and affected library/integration clippy checks pass with warnings denied.

The SV frontend classified every power expression as unsigned. Expressions
such as $signed(error) / 2**4 consequently zero-extended negative errors;
a 13-bit -384 became 7808 and divided to 488 instead of -24. This prevented
Taxi's PTP control loops from locking.

Use the base's signedness in both expression and port-connection classifiers,
with a self-determined exponent (IEEE 1800-2023 11.6.1, Table 11-21).
Add classifier tests and shared two-state/four-state regressions covering
constant and dynamic powers, signed/unsigned bases and destinations, sized
casts, and continuous/always_comb/always_ff execution.

Validation:
- SV common suite on all five backend variants: 3658 passed, 20 existing ignores.
- SV frontend unit tests: 3 passed.
- New cases: Icarus 2 passed; Verilator 1 passed, four-state case unsupported.
- Minimal reproducer at O0 and O1: five input vectors each, no mismatches.
- Original Taxi clock_cdc[96] and td_leaf full tests pass at O1/two-state with inferred_latch=warn; original sources unchanged.
- cargo fmt and affected library/integration clippy checks pass with warnings denied.

Change-Id: I0cf4f9c8176f5e537ff239b7d8a0eb644ef54d8a
@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-22T02:22:07.552286Z
We couldn’t complete this review. Comment @codex review to try again.
835973b 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 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

This pull request spent 1 hour 45 minutes 49 seconds in the queue, including 1 hour 43 minutes 36 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 21b6bb9 into master Oct 22, 2026
30 checks passed
@mergify
mergify Bot deleted the stack/tignear/fix/sv-power-signedness/preserve-signedness-power-expressions--0cf4f9c8 branch October 22, 2026 08:00
@mergify mergify Bot removed the queued Mergify queue entry label Oct 22, 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