Fix string cast on array call
This commit is contained in:
parent
4ff518de61
commit
c93f5256d4
|
|
@ -82,7 +82,8 @@ class CastVisitor final : public VNVisitor {
|
||||||
}
|
}
|
||||||
void ensureCast(AstNodeExpr* nodep) {
|
void ensureCast(AstNodeExpr* nodep) {
|
||||||
if (castSize(nodep->backp()) != castSize(nodep) || !nodep->user1()) {
|
if (castSize(nodep->backp()) != castSize(nodep) || !nodep->user1()) {
|
||||||
if (!nodep->isNull()) insertCast(nodep, castSize(nodep->backp()));
|
if (!nodep->isNull() && !nodep->isString() && !nodep->isDouble())
|
||||||
|
insertCast(nodep, castSize(nodep->backp()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// cppcheck-suppress constParameterPointer // lhsp might be changed
|
// cppcheck-suppress constParameterPointer // lhsp might be changed
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/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('simulator')
|
||||||
|
|
||||||
|
test.compile()
|
||||||
|
|
||||||
|
test.execute()
|
||||||
|
|
||||||
|
test.passes()
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
string path;
|
||||||
|
int offset;
|
||||||
|
int size;
|
||||||
|
} uvm_hdl_path_slice;
|
||||||
|
|
||||||
|
class ral_reg;
|
||||||
|
function void add_hdl_path(uvm_hdl_path_slice slices[], string kind = "RTL");
|
||||||
|
foreach (slices[i]) begin
|
||||||
|
$display("Add %s", slices[i].path);
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
endclass
|
||||||
|
|
||||||
|
class Cls;
|
||||||
|
|
||||||
|
rand ral_reg m_counters[4];
|
||||||
|
|
||||||
|
function new();
|
||||||
|
foreach (this.m_counters[i]) begin
|
||||||
|
this.m_counters[i] = new;
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function void build();
|
||||||
|
foreach (this.m_counters[i]) begin
|
||||||
|
int J = i;
|
||||||
|
// this.m_counters[J] = ral_reg_slave_B1_COUNTERS::type_id::create(
|
||||||
|
// $sformatf("COUNTERS[%0d]", J),, get_full_name());
|
||||||
|
this.m_counters[J].add_hdl_path('{'{$sformatf("COUNTERS[%0d]", J), -1, -1}});
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
endclass
|
||||||
|
|
||||||
|
initial begin
|
||||||
|
Cls c;
|
||||||
|
c = new;
|
||||||
|
c.build;
|
||||||
|
$finish;
|
||||||
|
end
|
||||||
|
|
||||||
|
endmodule
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
%Warning-CONSTRAINTIGN: t/t_constraint_array_index_unsup.v:13:11: Unsupported: item.index in array reduction constraint 'with' clause; treating as state
|
%Warning-CONSTRAINTIGN: t/t_constraint_array_index_unsup.v:13:10: Unsupported: item.index in array reduction constraint 'with' clause; treating as state
|
||||||
13 | data.sum() with (item.index) <= 10;
|
13 | data.sum() with (item.index) <= 10;
|
||||||
| ^~~
|
| ^~~
|
||||||
... For warning description see https://verilator.org/warn/CONSTRAINTIGN?v=latest
|
... For warning description see https://verilator.org/warn/CONSTRAINTIGN?v=latest
|
||||||
... Use "/* verilator lint_off CONSTRAINTIGN */" and lint_on around source to disable this message.
|
... Use "/* verilator lint_off CONSTRAINTIGN */" and lint_on around source to disable this message.
|
||||||
%Error: Exiting due to
|
%Error: Exiting due to
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
%Warning-CONSTRAINTIGN: t/t_constraint_array_limit.v:15:10: Constraint array reduction ignored (array size 32 exceeds --constraint-array-limit of 16), treating as state
|
%Warning-CONSTRAINTIGN: t/t_constraint_array_limit.v:16:22: Constraint array reduction ignored (array size 32 exceeds --constraint-array-limit of 16), treating as state
|
||||||
15 | data.sum() with (item) < 1000;
|
16 | constraint c {data.sum() with (item) < 1000;}
|
||||||
| ^~~
|
| ^~~
|
||||||
... For warning description see https://verilator.org/warn/CONSTRAINTIGN?v=latest
|
... For warning description see https://verilator.org/warn/CONSTRAINTIGN?v=latest
|
||||||
... Use "/* verilator lint_off CONSTRAINTIGN */" and lint_on around source to disable this message.
|
... Use "/* verilator lint_off CONSTRAINTIGN */" and lint_on around source to disable this message.
|
||||||
%Error: Exiting due to
|
%Error: Exiting due to
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue