[Moore][ImportVerilog] Replace $sformat/$swrite string dispatch with ksn#10557
Open
VecoMr wants to merge 1 commit into
Open
[Moore][ImportVerilog] Replace $sformat/$swrite string dispatch with ksn#10557VecoMr wants to merge 1 commit into
VecoMr wants to merge 1 commit into
Conversation
Move $sformat/ handling from the fallback path in visit(ExpressionStatement) into visitSystemCall, replacing string comparisons with ksn::KnownSystemName dispatch already used for all other system tasks. This also adds the previously missing $swrite[boh] variants with corresponding tests in basic.sv. Signed-off-by: adouard <alexandre.douard@ens-lyon.fr>
fabianschuiki
approved these changes
Jun 3, 2026
Contributor
fabianschuiki
left a comment
There was a problem hiding this comment.
LGTM! 🥳 Thanks for doing this cleanup! 😄
TaoBi22
approved these changes
Jun 4, 2026
Contributor
TaoBi22
left a comment
There was a problem hiding this comment.
Thanks! There seems to be a possible crash but LGTM modulo that
| // However, Section 21.3.3 explains that the output of $sformat/$swrite | ||
| // is assigned as if it were cast from a string literal (Section 5.9), | ||
| // so this implementation casts the string to the target value. | ||
| if (isSWrite) { |
Contributor
There was a problem hiding this comment.
Can we make sure that args contains the expected number of arguments? I'd hoped Slang would handle this but having checked it seems that if we feed in too few arguments we hit a crash.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move
$sformat/$swritehandling from the fallback path invisit(ExpressionStatement)intovisitSystemCall, replacing string comparisons withksn::KnownSystemNamedispatch already used for all other system tasks.This also adds the previously missing
$swrite[boh]variants with corresponding tests inbasic.sv.