Fix display of streaming concat arguments

This commit is contained in:
이재욱 2026-07-07 08:37:45 +09:00
parent a5f4d40901
commit a2b125a33e
4 changed files with 39 additions and 0 deletions

View File

@ -8567,6 +8567,10 @@ class WidthVisitor final : public VNVisitor {
ch = std::tolower(ch);
switch (ch) {
case '?': // Unspecified by user, guess
if (VN_IS(subargp, StreamL) || VN_IS(subargp, StreamR)) {
subargp->v3error("Streaming concatenation cannot be used as an implicit "
"$display-like argument.");
}
if (dtypep->isDouble()) {
ch = 'g';
} else if (dtypep->isString()) {

View File

@ -0,0 +1,6 @@
%Error: t/t_display_stream_bad.v:11:15: Streaming concatenation cannot be used as an implicit $display-like argument.
: ... note: In instance 't'
11 | $display({<<{value}});
| ^~
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
%Error: Exiting due to

View File

@ -0,0 +1,16 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of either the GNU Lesser General Public License Version 3
# or the Perl Artistic License Version 2.0.
# SPDX-FileCopyrightText: 2026 Wilson Snyder
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('linter')
test.lint(fails=True, expect_filename=test.golden_filename)
test.passes()

View File

@ -0,0 +1,13 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2026 Wilson Snyder
// SPDX-License-Identifier: CC0-1.0
module t;
int value = 1;
initial begin
$display({<<{value}});
end
endmodule