Skip to content

feat(sv): support %p for integral, string, handle and container values - #2423

Open
tignear wants to merge 1 commit into
masterfrom
stack/tignear/feat/sv-uvm-string-format/support-p-integral-string-handle-container-values--71740968
Open

tignear wants to merge 1 commit into
masterfrom
stack/tignear/feat/sv-uvm-string-format/support-p-integral-string-handle-container-values--71740968

Conversation

@tignear

@tignear tignear commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Implement the assignment pattern format (IEEE 1800-2023 21.2.1.6) for
$display, $write, the file output and severity tasks, $sformatf,
$sformat and $swrite. The analyzer rewrites each %p of a literal format
into a conversion the formatter already has: an integral value prints as
%0d, a real as an unformatted real, a string or string literal as its text
in quotes, a class handle as null or @ and its handle, and a queue,
dynamic array or associative array as %s of a new heap operation that
renders '{e0, e1} or '{k0:e0} with decimal integral elements (X/Z digits
per 21.2.1.3), quoted strings and handles. The pattern is evaluated once on
every backend and needs no scheduled process. %p of enums, packed
structures, unpacked arrays and containers of enums or aggregates is rejected
instead of printing a plain integral value. A %p of a format read at run
time prints a string in quotes and any other value as %0d.

The shared pattern_format cases compare $display with $sformatf; xezim
0.11.3 agrees on queues, dynamic arrays, strings and integers. Verilator
5.052 prints integral elements in hexadecimal and string literals as values,
Icarus 13.0 lacks %p of containers, and xezim prints null elements as 0;
these are retained with standalone observations.

Depends-On: #2403

@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 🔄 Running since 2026-10-28T19:15:21.144481Z 8760a15 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: 31f876b6e4

ℹ️ 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 thread crates/celox-sv-analyzer/src/ast/procedural.rs
Comment thread crates/celox-sv-analyzer/src/ast/expression_binding/format_patterns.rs Outdated
@mergify

mergify Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@tignear
tignear force-pushed the stack/tignear/feat/sv-uvm-string-format/support-p-integral-string-handle-container-values--71740968 branch from 31f876b to 94b58d2 Compare October 28, 2026 11:32
@tignear
tignear force-pushed the stack/tignear/feat/sv-uvm-string-format/support-swrite-family--e03af764 branch from 0ed3f7e to 91edc39 Compare October 28, 2026 11:32
@tignear

tignear commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Revision history

# Type Changes Reason Date
1 initial 31f876b 2026-10-28 11:31 UTC
2 content 31f876b → 94b58d2 Address Codex review on #2402/#2403/#2423: container operands across host requests, default conversions and %p rewrites before renaming, native ids kept through format merging, value-based %p string … 2026-10-28 11:31 UTC
3 content 94b58d2 → cd0b4ea 2026-10-28 12:53 UTC
4 content cd0b4ea → e080ef5 Address Codex review 4400065824/4400809357: %p classifies a selected or popped element by its element type: class handles print as handles, enum elements are rejected. 2026-10-28 13:52 UTC
5 content e080ef5 → 484d94b Sync with master (#2411 ref arguments, #2446): ref formals are captured before inputs and skipped by the host-request scan. Address Codex 4401461491/4401473527: retained string_format reports keep on… 2026-10-28 16:23 UTC
6 content 484d94b → f04ebef Sync with master (#2390 enum domains, #2407, #2429): handle Callee::Lookup in host-request detection, use enum_domain/packed_enum for %p enum rejection. Address Codex 4403245993/4403246006/4403246691… 2026-10-28 17:51 UTC
7 rebase f04ebef → 8760a15 (rebase only) 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: 94b58d297b

ℹ️ 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 thread crates/celox-sv-analyzer/src/ast/expression_binding/format_patterns.rs Outdated
@tignear
tignear force-pushed the stack/tignear/feat/sv-uvm-string-format/support-p-integral-string-handle-container-values--71740968 branch from 94b58d2 to cd0b4ea Compare October 28, 2026 12:54
@tignear
tignear force-pushed the stack/tignear/feat/sv-uvm-string-format/support-swrite-family--e03af764 branch from 91edc39 to b2997d3 Compare October 28, 2026 12:54

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

ℹ️ 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-swrite-family--e03af764 branch from b2997d3 to 8f07632 Compare October 28, 2026 13:52
@tignear
tignear force-pushed the stack/tignear/feat/sv-uvm-string-format/support-p-integral-string-handle-container-values--71740968 branch from cd0b4ea to e080ef5 Compare October 28, 2026 13: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: e080ef5658

ℹ️ 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 thread crates/celox-sv-analyzer/src/ast/expression_binding/format_patterns.rs Outdated
@tignear
tignear force-pushed the stack/tignear/feat/sv-uvm-string-format/support-swrite-family--e03af764 branch from 8f07632 to ce4dbef Compare October 28, 2026 16:23
@tignear
tignear force-pushed the stack/tignear/feat/sv-uvm-string-format/support-p-integral-string-handle-container-values--71740968 branch from e080ef5 to 484d94b Compare October 28, 2026 16:23

@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: 484d94b906

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

@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: 484d94b906

ℹ️ 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-swrite-family--e03af764 branch from ce4dbef to 5edf99e Compare October 28, 2026 17:52
@tignear
tignear force-pushed the stack/tignear/feat/sv-uvm-string-format/support-p-integral-string-handle-container-values--71740968 branch from 484d94b to f04ebef Compare October 28, 2026 17:52
Implement the assignment pattern format (IEEE 1800-2023 21.2.1.6) for
`$display`, `$write`, the file output and severity tasks, `$sformatf`,
`$sformat` and `$swrite`. The analyzer rewrites each `%p` of a literal format
into a conversion the formatter already has: an integral value prints as
`%0d`, a real as an unformatted real, a string or string literal as its text
in quotes, a class handle as `null` or `@` and its handle, and a queue,
dynamic array or associative array as `%s` of a new heap operation that
renders `'{e0, e1}` or `'{k0:e0}` with decimal integral elements (X/Z digits
per 21.2.1.3), quoted strings and handles. The pattern is evaluated once on
every backend and needs no scheduled process. `%p` of enums, packed
structures, unpacked arrays and containers of enums or aggregates is rejected
instead of printing a plain integral value. A `%p` of a format read at run
time prints a string in quotes and any other value as `%0d`.

The shared pattern_format cases compare `$display` with `$sformatf`; xezim
0.11.3 agrees on queues, dynamic arrays, strings and integers. Verilator
5.052 prints integral elements in hexadecimal and string literals as values,
Icarus 13.0 lacks `%p` of containers, and xezim prints null elements as 0;
these are retained with standalone observations.

Change-Id: I71740968a3ed2d3674385e21b7d58766b7329f35
@tignear
tignear force-pushed the stack/tignear/feat/sv-uvm-string-format/support-p-integral-string-handle-container-values--71740968 branch from f04ebef to 8760a15 Compare October 28, 2026 19:15
@tignear
tignear force-pushed the stack/tignear/feat/sv-uvm-string-format/support-swrite-family--e03af764 branch from 5edf99e to 0e81942 Compare October 28, 2026 19:15

@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: 8760a1560c

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

!ty.members.is_empty() || !ty.unpacked_ranges.is_empty(),
);
}
Ok(Pattern::Integral)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Check enum result types before the integral fallback

For typedef enum { A, B } e_t, both $display("%p", A) and $sformatf("%p", e_t'(1)) bypass the enum checks and are rewritten to %0d: enum constants have no variable shape, and casts are not inspected here. Enum-valued methods such as v.next() also reach this fallback. These expressions silently produce numeric output instead of the explicit unsupported-enum diagnostic provided for enum variables. Use the existing enums::domain expression-type resolver, which already recognizes constants, casts and enum methods, before selecting the integral conversion.

Useful? React with 👍 / 👎.

Base automatically changed from stack/tignear/feat/sv-uvm-string-format/support-swrite-family--e03af764 to master October 28, 2026 20:59

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant