Skip to content

[LowerToHW] Add '0' to format string width #8354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

seldridge
Copy link
Member

Add a zero width to all format string substitutions when lowering from FIRRTL to HW/SV. E.g., this will lower %x into %0x. This is almost always preferred and avoids the need for (right now) adding width specifiers to Chisel and FIRRTL. While we would like to do this, we don't want to do it as passthrough from Chisel where Chisel users write Verilog format substitutions.

As @jackkoenig and I got to bottom of, there are non-standard format specifiers that people might want (e.g., %- for left justified) that tools support differently and we would like to figure out how to actually lower these if they matter.

Add a zero width to all format string substitutions when lowering from
FIRRTL to HW/SV.  E.g., this will lower `%x` into `%0x`.  This is almost
always preferred and avoids the need for (right now) adding width
specifiers to Chisel and FIRRTL.  While we would like to do this, we don't
want to do it as passthrough from Chisel where Chisel users write Verilog
format substitutions.

As @jackkoenig and I got to bottom of, there are non-standard format
specifiers that people might want (e.g., `%-` for left justified) that
tools support differently and we would like to figure out how to actually
lower these if they matter.

Signed-off-by: Schuyler Eldridge <[email protected]>
@seldridge seldridge requested a review from darthscsi as a code owner March 27, 2025 23:39
@seldridge seldridge requested review from fabianschuiki and removed request for darthscsi March 27, 2025 23:40
@seldridge seldridge merged commit a1b7ca6 into main Mar 28, 2025
5 checks passed
@seldridge seldridge deleted the dev/seldridge/add-zero-width-specifier-to-printf-substitutions branch March 28, 2025 00:33
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.

3 participants