diff --git a/docs/CONTRIBUTORS b/docs/CONTRIBUTORS index af3f4e00d..338d08311 100644 --- a/docs/CONTRIBUTORS +++ b/docs/CONTRIBUTORS @@ -110,6 +110,7 @@ Ilya Barkov Iru Cai Ivan Vnučec Iztok Jeras +JAEUK LEE Jaeuk Lee (이재욱) Jake Merdich Jakub Michalski diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 46f2b0f0b..46fc29914 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -972,13 +972,9 @@ class WidthVisitor final : public VNVisitor { bool streamImplicitUseAllowed(const AstNodeStream* nodep) const { const AstNode* backp = nodep->backp(); while (true) { - if (const AstArg* const argp = VN_CAST(backp, Arg)) { - backp = argp->backp(); - } else if (const AstSFormatArg* const argp = VN_CAST(backp, SFormatArg)) { - backp = argp->backp(); - } else if (VN_IS(backp, CvtArrayToArray) || VN_IS(backp, CvtArrayToPacked) - || VN_IS(backp, CvtPackedToArray) || VN_IS(backp, CvtPackString) - || VN_IS(backp, CvtUnpackedToQueue)) { + if (VN_IS(backp, Arg) || VN_IS(backp, SFormatArg) || VN_IS(backp, CvtArrayToArray) + || VN_IS(backp, CvtArrayToPacked) || VN_IS(backp, CvtPackedToArray) + || VN_IS(backp, CvtPackString) || VN_IS(backp, CvtUnpackedToQueue)) { backp = backp->backp(); } else { break; diff --git a/test_regress/t/t_display_stream_bad.out b/test_regress/t/t_display_stream_bad.out index 823853243..f667f0005 100644 --- a/test_regress/t/t_display_stream_bad.out +++ b/test_regress/t/t_display_stream_bad.out @@ -1,42 +1,42 @@ -%Error: t/t_display_stream_bad.v:14:15: Streaming concatenation cannot be used in an implicitly cast context (IEEE 1800-2023 11.4.17) - : ... note: In instance 't' - : ... Suggest use a cast - 14 | result = {<<{value}} + 1; - | ^~ - ... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance. -%Error: t/t_display_stream_bad.v:15:23: Streaming concatenation cannot be used in an implicitly cast context (IEEE 1800-2023 11.4.17) - : ... note: In instance 't' - : ... Suggest use a cast - 15 | result = value + {<<{value}}; - | ^~ -%Error: t/t_display_stream_bad.v:16:26: Streaming concatenation cannot be used in an implicitly cast context (IEEE 1800-2023 11.4.17) - : ... note: In instance 't' - : ... Suggest use a cast - 16 | result = value[0] ? {<<{value}} : other; - | ^~ -%Error: t/t_display_stream_bad.v:17:16: Streaming concatenation cannot be used in an implicitly cast context (IEEE 1800-2023 11.4.17) - : ... note: In instance 't' - : ... Suggest use a cast - 17 | result = {{<<{value}}}; - | ^~ -%Error: t/t_display_stream_bad.v:18:14: Streaming concatenation cannot be used in an implicitly cast context (IEEE 1800-2023 11.4.17) - : ... note: In instance 't' - : ... Suggest use a cast - 18 | flag = ({<<{value}} == other); - | ^~ %Error: t/t_display_stream_bad.v:19:15: Streaming concatenation cannot be used in an implicitly cast context (IEEE 1800-2023 11.4.17) : ... note: In instance 't' : ... Suggest use a cast - 19 | $display({<<{value}}); + 19 | result = {<<{value}} + 1; | ^~ -%Error: t/t_display_stream_bad.v:20:22: Streaming concatenation cannot be used in an implicitly cast context (IEEE 1800-2023 11.4.17) + ... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance. +%Error: t/t_display_stream_bad.v:20:23: Streaming concatenation cannot be used in an implicitly cast context (IEEE 1800-2023 11.4.17) : ... note: In instance 't' : ... Suggest use a cast - 20 | $display("%0d", {<<{value}}); + 20 | result = value + {<<{value}}; + | ^~ +%Error: t/t_display_stream_bad.v:21:26: Streaming concatenation cannot be used in an implicitly cast context (IEEE 1800-2023 11.4.17) + : ... note: In instance 't' + : ... Suggest use a cast + 21 | result = value[0] ? {<<{value}} : other; + | ^~ +%Error: t/t_display_stream_bad.v:22:16: Streaming concatenation cannot be used in an implicitly cast context (IEEE 1800-2023 11.4.17) + : ... note: In instance 't' + : ... Suggest use a cast + 22 | result = {{<<{value}}}; + | ^~ +%Error: t/t_display_stream_bad.v:23:14: Streaming concatenation cannot be used in an implicitly cast context (IEEE 1800-2023 11.4.17) + : ... note: In instance 't' + : ... Suggest use a cast + 23 | flag = ({<<{value}} == other); + | ^~ +%Error: t/t_display_stream_bad.v:24:15: Streaming concatenation cannot be used in an implicitly cast context (IEEE 1800-2023 11.4.17) + : ... note: In instance 't' + : ... Suggest use a cast + 24 | $display({<<{value}}); + | ^~ +%Error: t/t_display_stream_bad.v:25:22: Streaming concatenation cannot be used in an implicitly cast context (IEEE 1800-2023 11.4.17) + : ... note: In instance 't' + : ... Suggest use a cast + 25 | $display("%0d", {<<{value}}); | ^~ -%Error: t/t_display_stream_bad.v:21:29: Streaming concatenation cannot be used in an implicitly cast context (IEEE 1800-2023 11.4.17) +%Error: t/t_display_stream_bad.v:26:29: Streaming concatenation cannot be used in an implicitly cast context (IEEE 1800-2023 11.4.17) : ... note: In instance 't' : ... Suggest use a cast - 21 | void'($sformatf("%0d", {<<{value}})); + 26 | void'($sformatf("%0d", {<<{value}})); | ^~ %Error: Exiting due to diff --git a/test_regress/t/t_display_stream_bad.v b/test_regress/t/t_display_stream_bad.v index 9c534a277..6df222cf7 100644 --- a/test_regress/t/t_display_stream_bad.v +++ b/test_regress/t/t_display_stream_bad.v @@ -10,7 +10,12 @@ module t; int result; bit flag; + function automatic int passthrough(input int arg); + return arg; + endfunction + initial begin + result = passthrough({<<{value}}); result = {<<{value}} + 1; result = value + {<<{value}}; result = value[0] ? {<<{value}} : other;