Fix string `inside` queue (#7373).

Fixes #7373.
This commit is contained in:
Wilson Snyder 2026-04-04 14:43:06 -04:00
parent 94f3e16a6c
commit 2796294396
3 changed files with 31 additions and 1 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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