Fix %% on elaboration severity tasks (#5922).
This commit is contained in:
parent
0a3de7c74a
commit
f5312b83b9
1
Changes
1
Changes
|
@ -71,6 +71,7 @@ Verilator 5.035 devel
|
|||
* Fix segfault in fork synchronization (#5906). [Krzysztof Bieganski, Antmicro Ltd.]
|
||||
* Fix `new this` (#5909).
|
||||
* Fix LATCH warning for automatic variables (#5918). [Yutetsu TAKATSUKASA]
|
||||
* Fix %% on elaboration severity tasks (#5922). [Ethan Sifferman]
|
||||
|
||||
|
||||
Verilator 5.034 2025-02-24
|
||||
|
|
|
@ -3249,7 +3249,7 @@ class ConstVisitor final : public VNVisitor {
|
|||
}
|
||||
}
|
||||
if (m_doNConst && anyconst) {
|
||||
// UINFO(9," Display in "<<nodep->text()<<endl);
|
||||
// UINFO(9, " Display in " << nodep->text() << endl);
|
||||
string newFormat;
|
||||
string fmt;
|
||||
bool inPct = false;
|
||||
|
@ -3265,9 +3265,9 @@ class ConstVisitor final : public VNVisitor {
|
|||
inPct = false;
|
||||
fmt += ch;
|
||||
switch (std::tolower(ch)) {
|
||||
case '%': break; // %% - just output a %
|
||||
case 'm': break; // %m - auto insert "name"
|
||||
case 'l': break; // %l - auto insert "library"
|
||||
case '%': break; // %% - still %%
|
||||
case 'm': break; // %m - still %m - auto insert "name"
|
||||
case 'l': break; // %l - still %l - auto insert "library"
|
||||
case 't': // FALLTHRU
|
||||
case '^': // %t/%^ - don't know $timeformat so can't constify
|
||||
if (argp) argp = argp->nextp();
|
||||
|
|
|
@ -100,6 +100,20 @@ string VString::quoteAny(const string& str, char tgt, char esc) {
|
|||
return result;
|
||||
}
|
||||
|
||||
string VString::dequotePercent(const string& str) {
|
||||
string result;
|
||||
char last = '\0';
|
||||
for (const char c : str) {
|
||||
if (last == '%' && c == '%') {
|
||||
last = '\0';
|
||||
} else {
|
||||
result += c;
|
||||
last = c;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
string VString::quoteStringLiteralForShell(const string& str) {
|
||||
string result;
|
||||
const char dquote = '"';
|
||||
|
|
|
@ -99,6 +99,8 @@ public:
|
|||
static string quoteBackslash(const string& str) { return quoteAny(str, '\\', '\\'); }
|
||||
// Replace any %'s with %%
|
||||
static string quotePercent(const string& str) { return quoteAny(str, '%', '%'); }
|
||||
// Replace any %%'s with %
|
||||
static string dequotePercent(const string& str);
|
||||
// Surround a raw string by double quote and escape if necessary
|
||||
// e.g. input abc's becomes "\"abc\'s\""
|
||||
static string escapeStringForPath(const string& str);
|
||||
|
|
|
@ -5463,7 +5463,7 @@ class WidthVisitor final : public VNVisitor {
|
|||
userIterateChildren(nodep, WidthVP{SELF, BOTH}.p());
|
||||
if (!m_paramsOnly) {
|
||||
V3Const::constifyParamsEdit(nodep->fmtp()); // fmtp may change
|
||||
string text = nodep->fmtp()->text();
|
||||
string text = VString::dequotePercent(nodep->fmtp()->text());
|
||||
if (text.empty()) text = "Elaboration system task message (IEEE 1800-2023 20.11)";
|
||||
switch (nodep->displayType()) {
|
||||
case VDisplayType::DT_INFO: nodep->v3warn(USERINFO, text); break;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
[0] -Info: t_assert_comp.v:23: top.t
|
||||
[0] -Info: t_assert_comp.v:24: top.t: User run-time info
|
||||
[0] -Info: t_assert_comp.v:25: top.t: Percent=% PctPct=%% Ten=10
|
||||
[0] %Warning: t_assert_comp.v:26: top.t
|
||||
[0] %Warning: t_assert_comp.v:27: top.t: User run-time warning
|
||||
[0] %Warning: t_assert_comp.v:28: top.t: 1
|
||||
*-* All Finished *-*
|
|
@ -13,6 +13,6 @@ test.scenarios('simulator')
|
|||
|
||||
test.compile(verilator_flags2=['--assert'], nc_flags2=['+assert'])
|
||||
|
||||
test.execute()
|
||||
test.execute(expect_filename=test.golden_filename)
|
||||
|
||||
test.passes()
|
||||
|
|
|
@ -6,13 +6,27 @@
|
|||
|
||||
module t (/*AUTOARG*/);
|
||||
|
||||
localparam TEN = 10;
|
||||
localparam string PCTPCT = "%%";
|
||||
|
||||
if (0) begin
|
||||
$info("User compile-time info");
|
||||
$warning("User compile-time warning");
|
||||
$error("User compile-time error");
|
||||
$info;
|
||||
$info("User elaboration-time info");
|
||||
$info("Percent=%% PctPct=%s Ten=%0d", PCTPCT, TEN);
|
||||
$warning;
|
||||
$warning("User elaboration-time warning");
|
||||
$warning(1); // Check can convert arguments to format
|
||||
$error("User elaboration-time error");
|
||||
end
|
||||
|
||||
initial begin
|
||||
$info;
|
||||
$info("User run-time info");
|
||||
$info("Percent=%% PctPct=%s Ten=%0d", PCTPCT, TEN);
|
||||
$warning;
|
||||
$warning("User run-time warning");
|
||||
$warning(1); // Check can convert arguments to format
|
||||
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
|
|
|
@ -1,43 +1,47 @@
|
|||
-Info: t/t_assert_comp_bad.v:10:7: Elaboration system task message (IEEE 1800-2023 20.11)
|
||||
-Info: t/t_assert_comp_bad.v:13:7: Elaboration system task message (IEEE 1800-2023 20.11)
|
||||
: ... note: In instance 't'
|
||||
10 | $info;
|
||||
13 | $info;
|
||||
| ^~~~~
|
||||
-Info: t/t_assert_comp_bad.v:11:7: User elaboration-time info
|
||||
-Info: t/t_assert_comp_bad.v:14:7: User elaboration-time info
|
||||
: ... note: In instance 't'
|
||||
11 | $info("User elaboration-time info");
|
||||
14 | $info("User elaboration-time info");
|
||||
| ^~~~~
|
||||
%Warning-USERWARN: t/t_assert_comp_bad.v:12:7: Elaboration system task message (IEEE 1800-2023 20.11)
|
||||
-Info: t/t_assert_comp_bad.v:15:7: Percent=% PctPct=%% Ten=10
|
||||
: ... note: In instance 't'
|
||||
15 | $info("Percent=%% PctPct=%s Ten=%0d", PCTPCT, TEN);
|
||||
| ^~~~~
|
||||
%Warning-USERWARN: t/t_assert_comp_bad.v:16:7: Elaboration system task message (IEEE 1800-2023 20.11)
|
||||
: ... note: In instance 't'
|
||||
12 | $warning;
|
||||
16 | $warning;
|
||||
| ^~~~~~~~
|
||||
... For warning description see https://verilator.org/warn/USERWARN?v=latest
|
||||
... Use "/* verilator lint_off USERWARN */" and lint_on around source to disable this message.
|
||||
%Warning-USERWARN: t/t_assert_comp_bad.v:13:7: User elaboration-time warning
|
||||
%Warning-USERWARN: t/t_assert_comp_bad.v:17:7: User elaboration-time warning
|
||||
: ... note: In instance 't'
|
||||
13 | $warning("User elaboration-time warning");
|
||||
17 | $warning("User elaboration-time warning");
|
||||
| ^~~~~~~~
|
||||
%Warning-USERWARN: t/t_assert_comp_bad.v:14:7: 1
|
||||
%Warning-USERWARN: t/t_assert_comp_bad.v:18:7: 1
|
||||
: ... note: In instance 't'
|
||||
14 | $warning(1);
|
||||
18 | $warning(1);
|
||||
| ^~~~~~~~
|
||||
%Warning-USERERROR: t/t_assert_comp_bad.v:15:7: Elaboration system task message (IEEE 1800-2023 20.11)
|
||||
%Warning-USERERROR: t/t_assert_comp_bad.v:19:7: Elaboration system task message (IEEE 1800-2023 20.11)
|
||||
: ... note: In instance 't'
|
||||
15 | $error;
|
||||
19 | $error;
|
||||
| ^~~~~~
|
||||
... For warning description see https://verilator.org/warn/USERERROR?v=latest
|
||||
... Use "/* verilator lint_off USERERROR */" and lint_on around source to disable this message.
|
||||
%Warning-USERERROR: t/t_assert_comp_bad.v:16:7: User elaboration-time error
|
||||
%Warning-USERERROR: t/t_assert_comp_bad.v:20:7: User elaboration-time error
|
||||
: ... note: In instance 't'
|
||||
16 | $error("User elaboration-time error");
|
||||
20 | $error("User elaboration-time error");
|
||||
| ^~~~~~
|
||||
%Warning-USERFATAL: t/t_assert_comp_bad.v:17:7: User elaboration-time fatal
|
||||
%Warning-USERFATAL: t/t_assert_comp_bad.v:21:7: User elaboration-time fatal
|
||||
: ... note: In instance 't'
|
||||
17 | $fatal(0, "User elaboration-time fatal");
|
||||
21 | $fatal(0, "User elaboration-time fatal");
|
||||
| ^~~~~~
|
||||
... For warning description see https://verilator.org/warn/USERFATAL?v=latest
|
||||
... Use "/* verilator lint_off USERFATAL */" and lint_on around source to disable this message.
|
||||
%Warning-USERFATAL: t/t_assert_comp_bad.v:18:7: Elaboration system task message (IEEE 1800-2023 20.11)
|
||||
%Warning-USERFATAL: t/t_assert_comp_bad.v:22:7: Elaboration system task message (IEEE 1800-2023 20.11)
|
||||
: ... note: In instance 't'
|
||||
18 | $fatal;
|
||||
22 | $fatal;
|
||||
| ^~~~~~
|
||||
%Error: Exiting due to
|
||||
|
|
|
@ -6,9 +6,13 @@
|
|||
|
||||
module t (/*AUTOARG*/);
|
||||
|
||||
localparam TEN = 10;
|
||||
localparam string PCTPCT = "%%";
|
||||
|
||||
if (1) begin
|
||||
$info;
|
||||
$info("User elaboration-time info");
|
||||
$info("Percent=%% PctPct=%s Ten=%0d", PCTPCT, TEN);
|
||||
$warning;
|
||||
$warning("User elaboration-time warning");
|
||||
$warning(1); // Check can convert arguments to format
|
||||
|
|
Loading…
Reference in New Issue