From: Zachary Snow Date: Sun, 9 Aug 2020 15:31:57 +0000 (-0600) Subject: Allow %0s $display format specifier X-Git-Tag: working-ls180~321^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=96ec9acf84d6eba753d6a2482b78acbf293544a5;p=yosys.git Allow %0s $display format specifier --- diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index 66f22e113..3a652d6cd 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -89,7 +89,7 @@ std::string AstNode::process_format_str(const std::string &sformat, int next_arg case 'S': case 'd': case 'D': - if (got_len) + if (got_len && len_value != 0) goto unsupported_format; YS_FALLTHROUGH case 'x': diff --git a/tests/simple/string_format.v b/tests/simple/string_format.v new file mode 100644 index 000000000..ce45ca1e9 --- /dev/null +++ b/tests/simple/string_format.v @@ -0,0 +1,7 @@ +module top; + parameter STR = "something interesting"; + initial begin + $display("A: %s", STR); + $display("B: %0s", STR); + end +endmodule