Fix VL_UNLIKELY with constructors

This commit is contained in:
Wilson Snyder 2025-01-11 15:27:11 -05:00
parent 70814fa11a
commit fdf29b970f
4 changed files with 41 additions and 3 deletions

View File

@ -968,10 +968,10 @@ public:
putns(nodep, "if (");
if (!nodep->branchPred().unknown()) {
puts(nodep->branchPred().ascii());
puts("(");
puts("(("); // Two parens, so that VL_UNLIKELY((class<foo,bar>)) works
}
iterateAndNextConstNull(nodep->condp());
if (!nodep->branchPred().unknown()) puts(")");
if (!nodep->branchPred().unknown()) puts("))");
puts(") {\n");
iterateAndNextConstNull(nodep->thensp());
puts("}");

View File

@ -4574,8 +4574,8 @@ class WidthVisitor final : public VNVisitor {
if (patp) {
// Don't want the RHS an array
patp->dtypep(arrayDtp->subDTypep());
allConstant &= VN_IS(patp->lhssp(), Const);
patp->dtypep(arrayDtp->subDTypep());
AstNodeExpr* const valuep = patternMemberValueIterate(patp);
if (VN_IS(arrayDtp, UnpackArrayDType)) {
if (!newp) {

View File

@ -0,0 +1,19 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 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.top_filename = "t/t_hier_block_struct.v"
test.compile()
test.execute()
test.passes()

View File

@ -0,0 +1,19 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 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.top_filename = "t/t_param_array6.v"
test.compile(verilator_flags2=['-fno-slice'])
test.execute()
test.passes()