diff --git a/Changes b/Changes index bab2ffb71..2ce61d1ea 100644 --- a/Changes +++ b/Changes @@ -123,6 +123,7 @@ Verilator 5.047 devel * Fix missing temporary for DfgSplicePacked (#7361). [Geza Lore, Testorrent USA, Inc.] * Fix virtual interface function calls binding to wrong instance (#7363). [Yilou Wang] * Fix false ASSIGNIN on interface input port connections (#7365). [Yilou Wang] +* Fix string `inside` queue (#7373). Verilator 5.046 2026-02-28 diff --git a/src/V3Width.cpp b/src/V3Width.cpp index d789dcb83..b6c7da9fd 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -3286,7 +3286,7 @@ class WidthVisitor final : public VNVisitor { for (AstNode *nextip, *itemp = nodep->itemsp(); itemp; itemp = nextip) { nextip = itemp->nextp(); // iterate may cause the node to get replaced // InsideRange will get replaced with Lte&Gte and finalized later - if (!VN_IS(itemp, InsideRange)) + if (!VN_IS(itemp, InsideRange) && !itemp->dtypep()->isNonPackedArray()) iterateCheck(nodep, "Inside Item", itemp, CONTEXT_DET, FINAL, expDTypep, EXTEND_EXP); } diff --git a/test_regress/t/t_inside_queue_elem.v b/test_regress/t/t_inside_queue_elem.v index 9eabc717d..b7968aac2 100644 --- a/test_regress/t/t_inside_queue_elem.v +++ b/test_regress/t/t_inside_queue_elem.v @@ -4,14 +4,43 @@ // SPDX-FileCopyrightText: 2024 Antmicro // 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; + function string validate_time_precision(string precision); + static string valid_precision[$] = '{"ps", "ns", "us", "ms", "s"}; + if (!(precision inside {valid_precision})) begin + return "none"; + end + return precision; + endfunction + initial begin automatic int q[$] = {1, 2}; + string s; if (!(1 inside {q[0], q[1]})) $stop; if (3 inside {q[0], q[1]}) $stop; + s = validate_time_precision("ps"); + `checks(s, "ps"); + s = validate_time_precision("ns"); + `checks(s, "ns"); + s = validate_time_precision("us"); + `checks(s, "us"); + s = validate_time_precision("ms"); + `checks(s, "ms"); + s = validate_time_precision("s"); + `checks(s, "s"); + s = validate_time_precision("random"); + `checks(s, "none"); + s = validate_time_precision(""); + `checks(s, "none"); + $write("*-* All Finished *-*\n"); $finish; end