Improve stream concat context coverage

This commit is contained in:
JAEUK LEE 2026-07-08 14:12:11 +09:00
parent 087d5c7280
commit c440c46bd0
4 changed files with 40 additions and 38 deletions

View File

@ -110,6 +110,7 @@ Ilya Barkov
Iru Cai Iru Cai
Ivan Vnučec Ivan Vnučec
Iztok Jeras Iztok Jeras
JAEUK LEE
Jaeuk Lee (이재욱) Jaeuk Lee (이재욱)
Jake Merdich Jake Merdich
Jakub Michalski Jakub Michalski

View File

@ -972,13 +972,9 @@ class WidthVisitor final : public VNVisitor {
bool streamImplicitUseAllowed(const AstNodeStream* nodep) const { bool streamImplicitUseAllowed(const AstNodeStream* nodep) const {
const AstNode* backp = nodep->backp(); const AstNode* backp = nodep->backp();
while (true) { while (true) {
if (const AstArg* const argp = VN_CAST(backp, Arg)) { if (VN_IS(backp, Arg) || VN_IS(backp, SFormatArg) || VN_IS(backp, CvtArrayToArray)
backp = argp->backp(); || VN_IS(backp, CvtArrayToPacked) || VN_IS(backp, CvtPackedToArray)
} else if (const AstSFormatArg* const argp = VN_CAST(backp, SFormatArg)) { || VN_IS(backp, CvtPackString) || VN_IS(backp, CvtUnpackedToQueue)) {
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)) {
backp = backp->backp(); backp = backp->backp();
} else { } else {
break; break;

View File

@ -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) %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' : ... note: In instance 't'
: ... Suggest use a cast : ... 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' : ... note: In instance 't'
: ... Suggest use a cast : ... 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' : ... note: In instance 't'
: ... Suggest use a cast : ... Suggest use a cast
21 | void'($sformatf("%0d", {<<{value}})); 26 | void'($sformatf("%0d", {<<{value}}));
| ^~ | ^~
%Error: Exiting due to %Error: Exiting due to

View File

@ -10,7 +10,12 @@ module t;
int result; int result;
bit flag; bit flag;
function automatic int passthrough(input int arg);
return arg;
endfunction
initial begin initial begin
result = passthrough({<<{value}});
result = {<<{value}} + 1; result = {<<{value}} + 1;
result = value + {<<{value}}; result = value + {<<{value}};
result = value[0] ? {<<{value}} : other; result = value[0] ? {<<{value}} : other;