From 609bfa46e8189eca595931ff9a420c4e6753d77c Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 11 Dec 2022 21:10:12 -0500 Subject: [PATCH] Fix ENUMVALUE on parameter, again (#3777). --- src/V3Width.cpp | 2 +- test_regress/t/t_cast_param_type.pl | 8 ++++++-- test_regress/t/t_cast_param_type.v | 13 +++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/V3Width.cpp b/src/V3Width.cpp index aa1de5970..a420d2a04 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -1979,7 +1979,7 @@ private: } void visit(AstCastWrap* nodep) override { // Inserted by V3Width only so we know has been resolved - UASSERT_OBJ(nodep->didWidth(), nodep, "CastWrap should have width'ed earlier"); + userIterateAndNext(nodep->lhsp(), WidthVP{nodep->dtypep(), BOTH}.p()); } void castSized(AstNode* nodep, AstNode* underp, int width) { const AstBasicDType* underDtp = VN_CAST(underp->dtypep(), BasicDType); diff --git a/test_regress/t/t_cast_param_type.pl b/test_regress/t/t_cast_param_type.pl index 09b2ce4eb..b46d46042 100755 --- a/test_regress/t/t_cast_param_type.pl +++ b/test_regress/t/t_cast_param_type.pl @@ -8,9 +8,13 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di # Version 2.0. # SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 -scenarios(linter => 1); +scenarios(simulator => 1); -lint( +compile( + ); + +execute( + check_finished => 1, ); ok(1); diff --git a/test_regress/t/t_cast_param_type.v b/test_regress/t/t_cast_param_type.v index 81b24c854..18a50fe0d 100644 --- a/test_regress/t/t_cast_param_type.v +++ b/test_regress/t/t_cast_param_type.v @@ -16,8 +16,21 @@ module SubB (); endmodule +function automatic letters_t lfunc(int a); + return letters_t'(1); +endfunction + module t (); + localparam FMT = lfunc(1); + SubA suba0 (); SubA #(.LETTER(letters_t'(1))) suba1 (); SubB #(.LETTER(letters_t'(1))) subb2 (); + + initial begin + if (lfunc(1) != B) $stop; + if (FMT != B) $stop; + $write("*-* All Finished *-*\n"); + $finish; + end endmodule