Fix parameter implicit type from string (#6414).

This commit is contained in:
Wilson Snyder 2025-09-09 19:49:11 -04:00
parent a9f95f2f08
commit 220a3faf7c
4 changed files with 46 additions and 0 deletions

View File

@ -35,6 +35,7 @@ Verilator 5.041 devel
* Fix address sanitizer issues (#6406). [Geza Lore]
* Fix timing control under fork under function (#6407). [Krzysztof Bieganski, Antmicro Ltd.]
* Fix memory leaks (#6411). [Geza Lore]
* Fix parameter implicit type from string (#6414). [Alex Solomatnikov]
Verilator 5.040 2025-08-30

View File

@ -2489,6 +2489,9 @@ class WidthVisitor final : public VNVisitor {
if (nodep->valuep()->isDouble()) {
nodep->dtypeSetDouble();
VL_DANGLING(bdtypep);
} else if (nodep->valuep()->isString()) {
nodep->dtypeSetString();
VL_DANGLING(bdtypep);
} else {
int width = 0;
const AstBasicDType* const valueBdtypep = nodep->valuep()->dtypep()->basicp();

View File

@ -0,0 +1,18 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2025 by Wilson Snyder. 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-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.compile()
test.execute()
test.passes()

View File

@ -0,0 +1,24 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2025 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
// verilog_format: off
`define stop $stop
`define checks(gotv,expv) do if ((gotv) != (expv)) begin $write("%%Error: %s:%0d: got='%s' exp='%s'\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0);
// verilog_format: on
module t;
sub u_sub ();
endmodule
module sub #(
parameter INDEX = 4096
);
parameter STRG = $sformatf("stringed[%0d]", INDEX);
initial begin
`checks(STRG, "stringed[4096]");
$finish;
end
endmodule