Skip to content

feat(sv): support $sformatf and $sformat - #2402

Merged
mergify[bot] merged 1 commit into
masterfrom
stack/tignear/feat/sv-uvm-string-format/support-sformatf-sformat--fe5fd5bc
Oct 28, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
stack/tignear/feat/sv-uvm-string-format/support-sformatf-sformat--fe5fd5bc

Conversation

@tignear

@tignear tignear commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Implement formatting to a string (IEEE 1800-2023 21.3.3). The analyzer binds
$sformatf(format, args...) as a string operation, so it is typed string
wherever a string value is valid: assignments, function results, arguments,
concatenations and conditional operands. $sformat(output, format, args...)
assigns the same value to a string variable, a function's return variable or
a string class property.

A call with conversions is a synchronous host request of the scheduled
process. The host renders the format with the $display renderer, so every
conversion, field width, X/Z digit and %m scope matches $display, and
interns the text as the result. A literal format is fixed at compile time and
its %t values are scaled as the analyzer scales those of $display; a
string or integral format is read when the call runs and the host scales
its %t values. A literal without conversions or arguments is a constant.
Integral outputs, %p and the $swrite family remain unsupported.

A host request in a later input of a subroutine call would otherwise lose the
registers computed for earlier inputs across the suspension, so those inputs
are kept, converted to their formals, in temporaries; operands of string,
object and container operations are materialized as the heap helpers already
do. A cached transitive check finds subroutines
that make host requests, including in the defaults of omitted arguments. A
format read at run time keeps bytes that are not UTF-8.
$display now resolves every string-valued argument, not only string
identifiers, so a string conditional prints its text.

The shared string_format cases compare $sformatf and $sformat with
$display on all backends and in a native image. Verilator 5.052 passes all
of them (the four-state case is unsupported there); Icarus 13.0 limitations
(string conditional crash, class-property output, integral format) and an
xezim 0.11.3 integral-format bug are retained with evidence.

@tignear

tignear commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

This pull request is part of a Mergify stack:

# Pull Request Link
1 feat(sv): support $sformatf and $sformat #2402 👈
2 feat(sv): support the $swrite family #2403
3 feat(sv): support %p for integral, string, handle and container values #2423

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 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-28T19:17:28.014863Z 85f9c72 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.

@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: 290e01820f

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

@mergify

mergify Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

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

@tignear
tignear force-pushed the stack/tignear/feat/sv-uvm-string-format/support-sformatf-sformat--fe5fd5bc branch from 290e018 to 27e5a3d Compare October 28, 2026 08:40
@tignear

tignear commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Revision history

# Type Changes Reason Date
1 initial 290e018 2026-10-28 08:40 UTC
2 content 290e018 → 27e5a3d Address Codex review 5679124714: check omitted-argument defaults (and nested defaults) when deciding whether a call can make a host request, evaluate subroutine inputs before a later host request, an… 2026-10-28 08:40 UTC
3 content 27e5a3d → d484bec 2026-10-28 10:18 UTC
4 content d484bec → 3703011 2026-10-28 11:31 UTC
5 content 3703011 → f7aeb22 Sync with master after #2322: Format host requests use family 7 (Process took 6), and $sformatf bypasses the new operand materialization in string_call, which truncated its format literal to 32 bits. 2026-10-28 12:53 UTC
6 content f7aeb22 → 5ab0f09 2026-10-28 13:52 UTC
7 content 5ab0f09 → bfa9061 2026-10-28 16:23 UTC
8 content bfa9061 → 242cd1f 2026-10-28 17:51 UTC
9 content 242cd1f → 85f9c72 2026-10-28 19:14 UTC

@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: 27e5a3d152

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

@tignear
tignear force-pushed the stack/tignear/feat/sv-uvm-string-format/support-sformatf-sformat--fe5fd5bc branch from 27e5a3d to d484bec Compare October 28, 2026 10:19

@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: d484becb4f

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

@tignear
tignear force-pushed the stack/tignear/feat/sv-uvm-string-format/support-sformatf-sformat--fe5fd5bc branch from d484bec to 3703011 Compare October 28, 2026 11:32

@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: 3703011934

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

@tignear
tignear force-pushed the stack/tignear/feat/sv-uvm-string-format/support-sformatf-sformat--fe5fd5bc branch from 3703011 to f7aeb22 Compare October 28, 2026 12:54
@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 28, 2026
@tignear
tignear force-pushed the stack/tignear/feat/sv-uvm-string-format/support-sformatf-sformat--fe5fd5bc branch from f7aeb22 to 5ab0f09 Compare October 28, 2026 13:52
@mergify mergify Bot added the queued Mergify queue entry label Oct 28, 2026
@mergify

mergify Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue

21 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Wed 28 Oct, 14:50 · rule changes · triggered by rule Queue explicitly requested merges
  • 🚫 Left the queue 15:11 · 5ab0f09

Reason

The pull request conflicts with master

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 ↓.

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot added dequeued Mergify stopped this queue entry; investigate before retrying and removed queued Mergify queue entry labels Oct 28, 2026
@tignear
tignear force-pushed the stack/tignear/feat/sv-uvm-string-format/support-sformatf-sformat--fe5fd5bc branch from 5ab0f09 to bfa9061 Compare October 28, 2026 16:23
@mergify mergify Bot removed the dequeued Mergify stopped this queue entry; investigate before retrying label Oct 28, 2026
@tignear
tignear force-pushed the stack/tignear/feat/sv-uvm-string-format/support-sformatf-sformat--fe5fd5bc branch from bfa9061 to 242cd1f Compare October 28, 2026 17:52

@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: 242cd1fc09

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

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

mergify Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue

1 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Wed 28 Oct, 18:17 · rule changes · triggered by rule Queue explicitly requested merges
  • 🚫 Left the queue 18:18 · 242cd1f

Reason

The pull request conflicts with master

Conflicting file: crates/celox-design/src/lib.rs

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 ↓.

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot added dequeued Mergify stopped this queue entry; investigate before retrying and removed queued Mergify queue entry labels Oct 28, 2026
Implement formatting to a string (IEEE 1800-2023 21.3.3). The analyzer binds
`$sformatf(format, args...)` as a string operation, so it is typed `string`
wherever a string value is valid: assignments, function results, arguments,
concatenations and conditional operands. `$sformat(output, format, args...)`
assigns the same value to a string variable, a function's return variable or
a string class property.

A call with conversions is a synchronous host request of the scheduled
process. The host renders the format with the `$display` renderer, so every
conversion, field width, X/Z digit and `%m` scope matches `$display`, and
interns the text as the result. A literal format is fixed at compile time and
its `%t` values are scaled as the analyzer scales those of `$display`; a
`string` or integral format is read when the call runs and the host scales
its `%t` values. A literal without conversions or arguments is a constant.
Integral outputs, `%p` and the `$swrite` family remain unsupported.

A host request in a later input of a subroutine call would otherwise lose the
registers computed for earlier inputs across the suspension, so those inputs
are kept, converted to their formals, in temporaries; operands of string,
object and container operations are materialized as the heap helpers already
do. A cached transitive check finds subroutines
that make host requests, including in the defaults of omitted arguments. A
format read at run time keeps bytes that are not UTF-8.
`$display` now resolves every string-valued argument, not only string
identifiers, so a string conditional prints its text.

The shared string_format cases compare `$sformatf` and `$sformat` with
`$display` on all backends and in a native image. Verilator 5.052 passes all
of them (the four-state case is unsupported there); Icarus 13.0 limitations
(string conditional crash, class-property output, integral format) and an
xezim 0.11.3 integral-format bug are retained with evidence.

Change-Id: Ife5fd5bc64ccbecb7a73976fc8b68f22e5216d53
@tignear
tignear force-pushed the stack/tignear/feat/sv-uvm-string-format/support-sformatf-sformat--fe5fd5bc branch from 242cd1f to 85f9c72 Compare October 28, 2026 19:15
@mergify mergify Bot added queued Mergify queue entry and removed dequeued Mergify stopped this queue entry; investigate before retrying labels Oct 28, 2026
@mergify

mergify Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

✅ Merged into master as f1e07ae at 20:55 UTC

1 h 14 min in the queue, 1 h 12 min of it CI.

So far

Merge conditions: 7 of 7 met

The batch, tested on draft #2486

Condition Required by
✅ check-success = Conventional Commit title —
✅ check-success = Queue validation —
✅ any of: check-success = @github-actions/Lint & Format, check-neutral = @github-actions/Lint & Format, check-skipped = @github-actions/Lint & Format GitHub repository ruleset rule master
✅ any of: check-success = @github-actions/Rust Test & NAPI Build, check-neutral = @github-actions/Rust Test & NAPI Build, check-skipped = @github-actions/Rust Test & NAPI Build GitHub repository ruleset rule master
✅ any of: check-success = @github-actions/JS Test (Ubuntu), check-neutral = @github-actions/JS Test (Ubuntu), check-skipped = @github-actions/JS Test (Ubuntu) GitHub repository ruleset rule master
✅ any of: check-success = @github-actions/Conventional Commit title, check-neutral = @github-actions/Conventional Commit title, check-skipped = @github-actions/Conventional Commit title GitHub repository ruleset rule master
✅ any of: check-success = @github-actions/Queue validation, check-neutral = @github-actions/Queue validation, check-skipped = @github-actions/Queue validation GitHub repository ruleset rule master

Times in UTC · dashboard · how the merge queue works

@mergify
mergify Bot merged commit f1e07ae into master Oct 28, 2026
23 checks passed
@mergify
mergify Bot deleted the stack/tignear/feat/sv-uvm-string-format/support-sformatf-sformat--fe5fd5bc branch October 28, 2026 20:55
@mergify mergify Bot removed the queued Mergify queue entry label Oct 28, 2026
@github-actions github-actions Bot mentioned this pull request Oct 31, 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