mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
Fix single-element replication to dynarray/unpacked/queue (#3548).
This commit is contained in:
parent
6e3b957b30
commit
ef9f443532
1
Changes
1
Changes
@ -23,6 +23,7 @@ Verilator 5.007 devel
|
||||
* Support static function variables (#3830). [Ryszard Rozak, Antmicro Ltd]
|
||||
* Fix real parameters of infinity and NaN.
|
||||
* Fix pattern assignment to unpacked structs (#3510). [Mostafa Garnal]
|
||||
* Fix single-element replication to dynarray/unpacked/queue (#3548). [Gustav Svensk]
|
||||
|
||||
|
||||
Verilator 5.006 2023-01-22
|
||||
|
@ -714,12 +714,24 @@ private:
|
||||
<< vdtypep->prettyDTypeNameQ()
|
||||
<< " data type");
|
||||
}
|
||||
// Don't iterate lhsp as SELF, the potential Concat below needs
|
||||
// the adtypep passed down to recognize the QueueDType
|
||||
userIterateAndNext(nodep->lhsp(), WidthVP{vdtypep, BOTH}.p());
|
||||
nodep->replaceWith(nodep->lhsp()->unlinkFrBack());
|
||||
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||
return;
|
||||
if (VN_IS(nodep->lhsp(), Concat)) {
|
||||
// Convert to concat directly, and visit(AstConst) will convert.
|
||||
// Don't iterate lhsp as SELF, the potential Concat below needs
|
||||
// the adtypep passed down to recognize the QueueDType
|
||||
userIterateAndNext(nodep->lhsp(), WidthVP{vdtypep, BOTH}.p());
|
||||
nodep->replaceWith(nodep->lhsp()->unlinkFrBack());
|
||||
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||
return;
|
||||
} else { // int a[] = {lhs} -> same as '{lhs}
|
||||
auto* const newp = new AstPattern{
|
||||
nodep->fileline(),
|
||||
new AstPatMember{nodep->lhsp()->fileline(), nodep->lhsp()->unlinkFrBack(),
|
||||
nullptr, nullptr}};
|
||||
nodep->replaceWith(newp);
|
||||
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||
userIterate(newp, m_vup);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (VN_IS(vdtypep, AssocArrayDType)) {
|
||||
nodep->v3warn(E_UNSUPPORTED, "Unsupported: Replication to form "
|
||||
|
21
test_regress/t/t_dynarray_init.pl
Executable file
21
test_regress/t/t_dynarray_init.pl
Executable file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2019 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
|
||||
|
||||
scenarios(simulator => 1);
|
||||
|
||||
compile(
|
||||
);
|
||||
|
||||
execute(
|
||||
check_finished => 1,
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
36
test_regress/t/t_dynarray_init.v
Normal file
36
test_regress/t/t_dynarray_init.v
Normal file
@ -0,0 +1,36 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed under the Creative Commons Public Domain, for
|
||||
// any use, without warranty, 2020 by Wilson Snyder.
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
`define stop $stop
|
||||
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0)
|
||||
|
||||
module t (/*AUTOARG*/);
|
||||
|
||||
int a1[] = '{12, 13};
|
||||
int a2[] = {14, 15};
|
||||
int a3[] = '{16};
|
||||
int a4[] = {17};
|
||||
|
||||
initial begin
|
||||
`checkh(a1.size, 2);
|
||||
`checkh(a1[0], 12);
|
||||
`checkh(a1[1], 13);
|
||||
|
||||
`checkh(a2.size, 2);
|
||||
`checkh(a2[0], 14);
|
||||
`checkh(a2[1], 15);
|
||||
|
||||
`checkh(a3.size, 1);
|
||||
`checkh(a3[0], 16);
|
||||
|
||||
`checkh(a4.size, 1);
|
||||
`checkh(a4[0], 17);
|
||||
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
|
||||
endmodule
|
21
test_regress/t/t_queue_init.pl
Executable file
21
test_regress/t/t_queue_init.pl
Executable file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2019 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
|
||||
|
||||
scenarios(simulator => 1);
|
||||
|
||||
compile(
|
||||
);
|
||||
|
||||
execute(
|
||||
check_finished => 1,
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
36
test_regress/t/t_queue_init.v
Normal file
36
test_regress/t/t_queue_init.v
Normal file
@ -0,0 +1,36 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed under the Creative Commons Public Domain, for
|
||||
// any use, without warranty, 2020 by Wilson Snyder.
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
`define stop $stop
|
||||
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0)
|
||||
|
||||
module t (/*AUTOARG*/);
|
||||
|
||||
int a1[$] = '{12, 13};
|
||||
int a2[$] = {14, 15};
|
||||
int a3[$] = '{16};
|
||||
int a4[$] = {17};
|
||||
|
||||
initial begin
|
||||
`checkh(a1.size, 2);
|
||||
`checkh(a1[0], 12);
|
||||
`checkh(a1[1], 13);
|
||||
|
||||
`checkh(a2.size, 2);
|
||||
`checkh(a2[0], 14);
|
||||
`checkh(a2[1], 15);
|
||||
|
||||
`checkh(a3.size, 1);
|
||||
`checkh(a3[0], 16);
|
||||
|
||||
`checkh(a4.size, 1);
|
||||
`checkh(a4[0], 17);
|
||||
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
|
||||
endmodule
|
@ -3,4 +3,8 @@
|
||||
17 | localparam bit_int_t count_bits [1:0] = {2{$bits(count_t)}};
|
||||
| ^
|
||||
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
|
||||
%Error: t/t_unpacked_concat_bad.v:17:46: Assignment pattern missed initializing elements: 0
|
||||
: ... In instance t
|
||||
17 | localparam bit_int_t count_bits [1:0] = {2{$bits(count_t)}};
|
||||
| ^
|
||||
%Error: Exiting due to
|
||||
|
21
test_regress/t/t_unpacked_init.pl
Executable file
21
test_regress/t/t_unpacked_init.pl
Executable file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2019 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
|
||||
|
||||
scenarios(simulator => 1);
|
||||
|
||||
compile(
|
||||
);
|
||||
|
||||
execute(
|
||||
check_finished => 1,
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
32
test_regress/t/t_unpacked_init.v
Normal file
32
test_regress/t/t_unpacked_init.v
Normal file
@ -0,0 +1,32 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed under the Creative Commons Public Domain, for
|
||||
// any use, without warranty, 2020 by Wilson Snyder.
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
`define stop $stop
|
||||
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0)
|
||||
|
||||
module t (/*AUTOARG*/);
|
||||
|
||||
int a1[2] = '{12, 13};
|
||||
int a2[2] = {14, 15};
|
||||
int a3[1] = '{16};
|
||||
int a4[1] = {17};
|
||||
|
||||
initial begin
|
||||
`checkh(a1[0], 12);
|
||||
`checkh(a1[1], 13);
|
||||
|
||||
`checkh(a2[0], 14);
|
||||
`checkh(a2[1], 15);
|
||||
|
||||
`checkh(a3[0], 16);
|
||||
|
||||
`checkh(a4[0], 17);
|
||||
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
|
||||
endmodule
|
Loading…
Reference in New Issue
Block a user