diff --git a/test_regress/t/t_param_in_func_bad.out b/test_regress/t/t_param_in_func_bad.out new file mode 100644 index 000000000..e9b7f3081 --- /dev/null +++ b/test_regress/t/t_param_in_func_bad.out @@ -0,0 +1,7 @@ +%Error: t/t_param_in_func_bad.v:23: Unsupported: Parameters in functions. + localparam logic[7:0] digits[10] + ^~~~~~ +%Error: t/t_param_in_func_bad.v:27: Can't find definition of variable: 'digits' + return digits[d]; + ^~~~~~ +%Error: Exiting due to diff --git a/test_regress/t/t_param_in_func_bad.pl b/test_regress/t/t_param_in_func_bad.pl new file mode 100755 index 000000000..2cbb360e2 --- /dev/null +++ b/test_regress/t/t_param_in_func_bad.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 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. + +scenarios(simulator => 1); + +lint( + fails => 1, + expect_filename => $Self->{golden_filename}, + ); + +ok(1); +1; diff --git a/test_regress/t/t_param_in_func_bad.v b/test_regress/t/t_param_in_func_bad.v new file mode 100644 index 000000000..2efba2f38 --- /dev/null +++ b/test_regress/t/t_param_in_func_bad.v @@ -0,0 +1,28 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2019 by Driss Hafdi. + +module t (/*AUTOARG*/ + // Inputs + clk + ); + + input clk; + + logic [7:0] digit = getDigit(4'd1); + + initial begin + if (digit != "1") $stop; + $write("*-* All Finished *-*\n"); + $finish; + end +endmodule + +function automatic logic[7:0] getDigit(logic[3:0] d); + localparam logic[7:0] digits[10] + = '{ + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" + }; + return digits[d]; +endfunction