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]
|
* Support static function variables (#3830). [Ryszard Rozak, Antmicro Ltd]
|
||||||
* Fix real parameters of infinity and NaN.
|
* Fix real parameters of infinity and NaN.
|
||||||
* Fix pattern assignment to unpacked structs (#3510). [Mostafa Garnal]
|
* 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
|
Verilator 5.006 2023-01-22
|
||||||
|
|
|
||||||
|
|
@ -714,12 +714,24 @@ private:
|
||||||
<< vdtypep->prettyDTypeNameQ()
|
<< vdtypep->prettyDTypeNameQ()
|
||||||
<< " data type");
|
<< " data type");
|
||||||
}
|
}
|
||||||
// Don't iterate lhsp as SELF, the potential Concat below needs
|
if (VN_IS(nodep->lhsp(), Concat)) {
|
||||||
// the adtypep passed down to recognize the QueueDType
|
// Convert to concat directly, and visit(AstConst) will convert.
|
||||||
userIterateAndNext(nodep->lhsp(), WidthVP{vdtypep, BOTH}.p());
|
// Don't iterate lhsp as SELF, the potential Concat below needs
|
||||||
nodep->replaceWith(nodep->lhsp()->unlinkFrBack());
|
// the adtypep passed down to recognize the QueueDType
|
||||||
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
userIterateAndNext(nodep->lhsp(), WidthVP{vdtypep, BOTH}.p());
|
||||||
return;
|
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)) {
|
if (VN_IS(vdtypep, AssocArrayDType)) {
|
||||||
nodep->v3warn(E_UNSUPPORTED, "Unsupported: Replication to form "
|
nodep->v3warn(E_UNSUPPORTED, "Unsupported: Replication to form "
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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;
|
||||||
|
|
@ -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)}};
|
17 | localparam bit_int_t count_bits [1:0] = {2{$bits(count_t)}};
|
||||||
| ^
|
| ^
|
||||||
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
|
... 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
|
%Error: Exiting due to
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
@ -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