Skip to content

[ImportVerilog] Support %p format specifier for int, string, and struct - #10865

Open
VecoMr wants to merge 1 commit into
llvm:mainfrom
VecoMr:add-p-format
Open

[ImportVerilog] Support %p format specifier for int, string, and struct#10865
VecoMr wants to merge 1 commit into
llvm:mainfrom
VecoMr:add-p-format

Conversation

@VecoMr

@VecoMr VecoMr commented Jul 20, 2026

Copy link
Copy Markdown
Member

$display("%p", ...) and friends failed with "unsupported format specifier `%p`" for any argument, since the format-string parser's switch had no case for it.

%p (IEEE § 21.2.1.7) auto-formats its argument as a SystemVerilog assignment pattern: integers use the calling task's default radix, strings are quoted, and structs recurse field by field as '{name:value, ...}.

Limitation:

Enums, packed unions, %0p, arrays, classes, and dynamic collections are explicitly rejected with a clear diagnostic.

Signed-off-by: adouard <alexandre.douard@ens-lyon.fr>
@circt-bot

circt-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

Results of circt-tests run for 905d6b9 compared to results for e1b33ef: no change to test results.

@fzi-hielscher

Copy link
Copy Markdown
Contributor

They really went to town with the format specifiers in SV.

Is there a specific reason to not support arrays and maybe even enums and unions? Also, if I'm reading the LRM correctly, we could simply treat %p and %0p as the same.

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.

2 participants