Fix missing error when parameter assigned to type, bug1575.

This commit is contained in:
Wilson Snyder 2019-10-29 18:38:59 -04:00
parent 171960635e
commit 8ce60e955f
8 changed files with 71 additions and 1 deletions

View File

@ -25,7 +25,7 @@ The contributors that suggested a given feature are shown in []. Thanks!
**** Fix multithreaded yield behavior when no work. [Patrick Stewart]
**** Fix bad-syntax crashes, bug1548, bug1550-1553, bug1557-1560, bug1563,
bug1573, bug1574. [Eric Rippey]
bug1573-1575. [Eric Rippey]
**** Benchmark --protect-lib runtime, bug1519. [Todd Strader]

View File

@ -3491,6 +3491,10 @@ private:
} else if (expDTypep->isString() && !underp->dtypep()->isString()) {
underp = spliceCvtString(underp);
underp = userIterateSubtreeReturnEdits(underp, WidthVP(SELF, FINAL).p());
} else if (VN_IS(underp, NodeDType)) { // Note the node itself, not node's data type
underp->v3error(ucfirst(nodep->prettyOperatorName())
<<" expected non-datatype "<<side
<<" but '"<<underp->name()<<"' is a datatype.");
} else {
AstBasicDType* expBasicp = expDTypep->basicp();
AstBasicDType* underBasicp = underp->dtypep()->basicp();

View File

@ -0,0 +1,4 @@
%Error: t/t_param_type_bad.v:8: Parameter type's initial value isn't a type: 'bad2'
localparam type bad2 = 2;
^~~~
%Error: Exiting due to

View File

@ -0,0 +1,20 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2003 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.
scenarios(vlt => 1);
lint(
# Bug1575 required trace to crash
verilator_flags2 => ["--trace"],
fails => 1,
expect_filename => $Self->{golden_filename},
);
ok(1);
1;

View File

@ -0,0 +1,9 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2019 by Wilson Snyder.
module t;
localparam type t = logic; // Fine
localparam type bad2 = 2; // Bad
endmodule

View File

@ -0,0 +1,4 @@
%Error: t/t_param_type_bad2.v:8: Parameter type's initial value isn't a type: 'bad2'
localparam type bad2 = 2;
^~~~
%Error: Exiting due to

View File

@ -0,0 +1,20 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2003 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.
scenarios(vlt => 1);
lint(
# Bug1575 required trace to crash
verilator_flags2 => ["--trace"],
fails => 1,
expect_filename => $Self->{golden_filename},
);
ok(1);
1;

View File

@ -0,0 +1,9 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2019 by Wilson Snyder.
module t;
localparam type t = logic; // Fine
localparam type bad2 = 2; // Bad
endmodule