Fix assertion on streaming from queues

This commit is contained in:
Wilson Snyder 2025-09-20 20:52:46 -04:00
parent af54a26b43
commit 9af8e76e87
3 changed files with 52 additions and 2 deletions

View File

@ -2274,8 +2274,6 @@ class ConstVisitor final : public VNVisitor {
if (VN_IS(dstDTypep, UnpackArrayDType)) {
streamp = new AstCvtPackedToArray{nodep->fileline(), streamp, dstDTypep};
} else {
UASSERT_OBJ(sWidth >= dWidth, nodep,
"sWidth >= dWidth should have caused an error earlier");
if (dWidth == 0) {
streamp = new AstCvtPackedToArray{nodep->fileline(), streamp, dstDTypep};
} else if (sWidth >= dWidth) {

View File

@ -0,0 +1,18 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2025 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.compile()
test.execute()
test.passes()

View File

@ -0,0 +1,34 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2025 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t;
int i_header;
int i_len;
byte i_data[];
int i_crc;
int o_header;
int o_len;
byte o_data[];
int o_crc;
initial begin
byte pkt[$];
i_header = 12;
i_len = 5;
i_data = new[5];
i_crc = 42;
pkt = {<<8{i_header, i_len, i_data, i_crc}};
{<<8{o_header, o_len, o_data, o_crc}} = pkt;
$finish;
end
endmodule