Tests: Add t_class_param_nconst_bad test.

This commit is contained in:
Wilson Snyder 2021-12-12 15:26:29 -05:00
parent 77c005835d
commit 55976dbc25
5 changed files with 64 additions and 9 deletions

View File

@ -1,10 +1,14 @@
%Error-UNSUPPORTED: t/t_class_param.v:9:23: Unsupported: class parameters
: ... In instance t
9 | class Cls #(parameter P = 12);
| ^
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
%Error-UNSUPPORTED: t/t_class_param.v:20:11: Unsupported: parameterized classes
%Error-UNSUPPORTED: t/t_class_param.v:22:11: Unsupported: parameterized classes
: ... In instance t
20 | Cls #(.P(4)) c4;
22 | Cls #(.P(4)) c4;
| ^
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
%Error-UNSUPPORTED: t/t_class_param.v:7:23: Unsupported: class parameters
: ... In instance t
7 | class Cls #(parameter P = 12);
| ^
%Error-UNSUPPORTED: t/t_class_param.v:17:14: Unsupported: parameterized classes
: ... In instance t
17 | typedef Cls#(5) Cls5_t;
| ^
%Error: Exiting due to

View File

@ -4,8 +4,6 @@
// any use, without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/);
class Cls #(parameter P = 12);
bit [P-1:0] member;
function bit [P-1:0] get_member;
@ -16,14 +14,21 @@ class Cls #(parameter P = 12);
endfunction
endclass
typedef Cls#(5) Cls5_t;
module t (/*AUTOARG*/);
Cls c12;
Cls #(.P(4)) c4;
Cls5_t c5;
initial begin
c12 = new;
c4 = new;
c5 = new;
if (c12.P != 12) $stop;
if (c4.P != 4) $stop;
if (c5.P != 5) $stop;
if (c12.get_p() != 12) $stop;
if (c4.get_p() != 4) $stop;
// verilator lint_off WIDTH
@ -34,6 +39,9 @@ endclass
if (c4.member != 4'ha) $stop;
if (c12.get_member() != 12'haaa) $stop;
if (c4.get_member() != 4'ha) $stop;
if ($sformatf("%p", c12) != "'{member:'haaa}") $stop;
if ($sformatf("%p", c4) != "'{member:'ha}") $stop;
$write("*-* All Finished *-*\n");
$finish;
end

View File

@ -0,0 +1,10 @@
%Error-UNSUPPORTED: t/t_class_param_nconst_bad.v:12:11: Unsupported: parameterized classes
: ... In instance t
12 | Cls #(.PARAM($random)) c;
| ^~~~~
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
%Error-UNSUPPORTED: t/t_class_param_nconst_bad.v:7:23: Unsupported: class parameters
: ... In instance t
7 | class Cls #(parameter PARAM = 12);
| ^~~~~
%Error: Exiting due to

View File

@ -0,0 +1,19 @@
#!/usr/bin/env perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2020 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(linter => 1);
lint(
fails => 1,
expect_filename => $Self->{golden_filename},
);
ok(1);
1;

View File

@ -0,0 +1,14 @@
// 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
class Cls #(parameter PARAM = 12);
endclass
module t (/*AUTOARG*/);
Cls #(.PARAM($random)) c; // Bad param name
endmodule