Skip to content

fix(sv): resolve constant functions in unpacked array dimensions - #1612

Merged
mergify[bot] merged 1 commit into
masterfrom
stack/tignear/fix/sv-unpacked-constant-functions/resolve-constant-funcs-unpacked-array-dimensions--088feda3
Oct 20, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
stack/tignear/fix/sv-unpacked-constant-functions/resolve-constant-funcs-unpacked-array-dimensions--088feda3

Conversation

@tignear

@tignear tignear commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Unpacked dimensions such as logic [7:0] v [f(1)] passed analysis but
failed during lowering because the analyzer's constant-function environment
was no longer available. Retain the evaluated bounds in analyzer IR and use
them when constructing signal layouts and procedural array bounds. Keep the
original expressions for declaration contracts and later specialization.

Add shared regressions for module-local, imported and qualified package
functions, multidimensional and negative ranges, and parameterized array
ports with loop-based constant functions. Verify that symbolic contracts
remain available after publishing their resolved bounds.

Fixes #1438.

Validation on the current master base:

  • Analyzer: 753 passed; 3 existing ignores; 2 doctests passed.
  • Frontend unit test passed. SV integration: 3,001 passed; 90 existing
    ignores, including all 10 added shared-case execution variants.
  • Formatting, analyzer/frontend/suite Clippy with warnings denied, and diff
    checks pass.
  • The unchanged shared cases previously passed both Verilator and Icarus
    (2 each); external simulation was not repeated for this rebase.

The rebase retained both master's timed-task analyzer regressions and this
change's unpacked-bound regression at their shared insertion point.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 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-20T14:43:31.479130Z 89d92d7 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 20, 2026
@mergify mergify Bot added the queued Mergify queue entry label Oct 20, 2026
@mergify

mergify Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-20 12:27 UTC · Rule: changes · triggered by rule Queue explicitly requested merges
  • 🚫 Left the queue — 2026-10-20 14:17 UTC · at 3af7a102b61c98ec300c1acc4cdcc888bf029c9f

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

Reason

Pull request #1612 has been dequeued

Queue conditions are not satisfied:

  • -conflict

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting 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 20, 2026
Unpacked dimensions such as `logic [7:0] v [f(1)]` passed analysis but
failed during lowering because the analyzer's constant-function environment
was no longer available. Retain the evaluated bounds in analyzer IR and use
them when constructing signal layouts and procedural array bounds. Keep the
original expressions for declaration contracts and later specialization.

Add shared regressions for module-local, imported and qualified package
functions, multidimensional and negative ranges, and parameterized array
ports with loop-based constant functions. Verify that symbolic contracts
remain available after publishing their resolved bounds.

Fixes #1438.

Validation on the current master base:
- Analyzer: 753 passed; 3 existing ignores; 2 doctests passed.
- Frontend unit test passed. SV integration: 3,001 passed; 90 existing
  ignores, including all 10 added shared-case execution variants.
- Formatting, analyzer/frontend/suite Clippy with warnings denied, and diff
  checks pass.
- The unchanged shared cases previously passed both Verilator and Icarus
  (2 each); external simulation was not repeated for this rebase.

The rebase retained both master's timed-task analyzer regressions and this
change's unpacked-bound regression at their shared insertion point.

Change-Id: I088feda3ff78b7b924ef3a06d394f2a26c39ffa9
@tignear
tignear force-pushed the stack/tignear/fix/sv-unpacked-constant-functions/resolve-constant-funcs-unpacked-array-dimensions--088feda3 branch from 3af7a10 to 89d92d7 Compare October 20, 2026 14:39
@tignear

tignear commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

Revision history

# Type Changes Reason Date
1 initial 3af7a10 2026-10-20 14:37 UTC
2 content 3af7a10 → 89d92d7 Resolve PR #1612 conflicts with current master while preserving constant-function unpacked dimension regressions 2026-10-20 14:37 UTC

@mergify mergify Bot removed the dequeued Mergify stopped this queue entry; investigate before retrying label Oct 20, 2026

@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: 89d92d7889

ℹ️ 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".

constants,
parameter_types,
))
.or_else(|| range.resolved_bounds())

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 Avoid multiplying cached unpacked widths twice

When both a packed range and an unpacked range call user constant functions (for example, logic [word_width()-1:0] data [depth()]), this fallback lets the unpacked range proceed, but signal_type_from_sv still falls back to typ.resolved_width() for the unresolved packed range. That value already includes every unpacked dimension, and the function subsequently multiplies it by array_dims again, so an 8-bit, depth-2 array is lowered as 32 bits instead of 16 and can silently corrupt layout and indexing. Preserve a packed-only resolved width or resolved packed bounds rather than using the type's total width.

Useful? React with 👍 / 👎.

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

mergify Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 2 hours 16 minutes 19 seconds in the queue, including 1 hour 58 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 18c15fe into master Oct 20, 2026
31 checks passed
@mergify
mergify Bot deleted the stack/tignear/fix/sv-unpacked-constant-functions/resolve-constant-funcs-unpacked-array-dimensions--088feda3 branch October 20, 2026 17:23
@mergify mergify Bot removed the queued Mergify queue entry label Oct 20, 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.

feat(sv): accept constant function calls in unpacked array dimensions

1 participant