diff --git a/Changes b/Changes index f3462377c..dbdc75759 100644 --- a/Changes +++ b/Changes @@ -8,6 +8,8 @@ The contributors that suggested a given feature are shown in []. Thanks! *** Fix ordering of arrayed cell wide connections, bug1202 partial. [Mike Popoloski] +**** Support module port parameters without defaults, bug 1213. [Mike Popoloski] + **** Fix LITENDIAN warning on arrayed cells, bug1202. [Mike Popoloski] **** Fix enum ranges without colons, bug1204. [Mike Popoloski] diff --git a/src/verilog.y b/src/verilog.y index 5f0de37a0..b4bdb2f02 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -2002,6 +2002,8 @@ param_assignment: // ==IEEE: param_assignment // // note exptOrDataType being a data_type is only for yPARAMETER yTYPE id/*new-parameter*/ variable_dimensionListE sigAttrListE '=' exprOrDataType /**/ { $$ = VARDONEA($1,*$1, $2, $3); $$->valuep($5); } + | id/*new-parameter*/ variable_dimensionListE sigAttrListE + /**/ { $$ = VARDONEA($1,*$1, $2, $3); } ; list_of_param_assignments: // ==IEEE: list_of_param_assignments diff --git a/test_regress/t/t_param_default.pl b/test_regress/t/t_param_default.pl new file mode 100644 index 000000000..134a79f9e --- /dev/null +++ b/test_regress/t/t_param_default.pl @@ -0,0 +1,18 @@ +#!/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. + +compile ( + ); + +execute ( + check_finished=>1, + ); + +ok(1); +1; diff --git a/test_regress/t/t_param_default.v b/test_regress/t/t_param_default.v new file mode 100644 index 000000000..117569913 --- /dev/null +++ b/test_regress/t/t_param_default.v @@ -0,0 +1,19 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2003 by Wilson Snyder. + +module m #(parameter int Foo); +endmodule + +module t (/*AUTOARG*/); + + m #(10) foo(); + + initial begin + if (foo.Foo != 10) $stop; + $write("*-* All Finished *-*\n"); + $finish; + end + +endmodule diff --git a/test_regress/t/t_param_default_bad.pl b/test_regress/t/t_param_default_bad.pl new file mode 100644 index 000000000..e95dd024a --- /dev/null +++ b/test_regress/t/t_param_default_bad.pl @@ -0,0 +1,19 @@ +#!/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. + +compile ( + fails=>1, + expect=> +'%Error: Internal Error: t/t_param_default_bad.v:6: ../V3Param.cpp:269: Parameter without initial value +%Error: Internal Error: See the manual and http://www.veripool.org/verilator for more assistance. +.*%Error: Command Failed.*', + ); + +ok(1); +1; diff --git a/test_regress/t/t_param_default_bad.v b/test_regress/t/t_param_default_bad.v new file mode 100644 index 000000000..16ab64e8d --- /dev/null +++ b/test_regress/t/t_param_default_bad.v @@ -0,0 +1,13 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2003 by Wilson Snyder. + +module m #(parameter int Foo); +endmodule + +module t (/*AUTOARG*/); + + m foo(); + +endmodule