diff --git a/test_regress/t/t_var_static.pl b/test_regress/t/t_var_static.pl new file mode 100755 index 000000000..823ae5c9b --- /dev/null +++ b/test_regress/t/t_var_static.pl @@ -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. + +$Self->{vlt} and $Self->unsupported("Verilator unsupported, bug546"); + +compile ( + ); + +execute ( + check_finished=>1, + ); + +ok(1); +1; diff --git a/test_regress/t/t_var_static.v b/test_regress/t/t_var_static.v new file mode 100644 index 000000000..2e38c75b2 --- /dev/null +++ b/test_regress/t/t_var_static.v @@ -0,0 +1,69 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2014 by Wilson Snyder. + +module t (/*AUTOARG*/ + // Inputs + clk + ); + + input clk; + + function int f_no_no (); + int st = 2; st++; return st; + endfunction + function int f_no_st (); + static int st = 2; st++; return st; + endfunction + function int f_no_au (); + automatic int st = 2; st++; return st; + endfunction + + function static int f_st_no (); + int st = 2; st++; return st; + endfunction + function static int f_st_st (); + static int st = 2; st++; return st; + endfunction + function static int f_st_au (); + automatic int st = 2; st++; return st; + endfunction + + function automatic int f_au_no (); + int st = 2; st++; return st; + endfunction + function automatic int f_au_st (); + static int st = 2; st++; return st; + endfunction + function automatic int f_au_au (); + automatic int st = 2; st++; return st; + endfunction + + initial begin + if (f_no_no() != 3) $stop; + if (f_no_no() != 4) $stop; + if (f_no_st() != 3) $stop; + if (f_no_st() != 4) $stop; + if (f_no_au() != 3) $stop; + if (f_no_au() != 3) $stop; + // + if (f_st_no() != 3) $stop; + if (f_st_no() != 4) $stop; + if (f_st_st() != 3) $stop; + if (f_st_st() != 4) $stop; + if (f_st_au() != 3) $stop; + if (f_st_au() != 3) $stop; + // + if (f_au_no() != 3) $stop; + if (f_au_no() != 3) $stop; + if (f_au_st() != 3) $stop; + if (f_au_st() != 4) $stop; + if (f_au_au() != 3) $stop; + if (f_au_au() != 3) $stop; + // + $write("*-* All Finished *-*\n"); + $finish; + end + +endmodule