diff --git a/test_regress/t/t_array_index_increment.pl b/test_regress/t/t_array_index_increment.pl new file mode 100755 index 000000000..c9adf6d32 --- /dev/null +++ b/test_regress/t/t_array_index_increment.pl @@ -0,0 +1,21 @@ +#!/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(simulator => 1); + +compile( + ); + +execute( + check_finished => 1, + ); + +ok(1); +1; + diff --git a/test_regress/t/t_array_index_increment.v b/test_regress/t/t_array_index_increment.v new file mode 100644 index 000000000..fe30087f7 --- /dev/null +++ b/test_regress/t/t_array_index_increment.v @@ -0,0 +1,27 @@ +module t (/*AUTOARG*/ + // Inputs + clk + ); + input clk; + + localparam string TEST_STRING = "test"; + localparam CHECK_DECREMENT = decrement_array_idx(); + localparam CHECK_INCREMENT = increment_array_idx(); + + function byte decrement_array_idx(); + int pos = TEST_STRING.len() - 1; + decrement_array_idx = TEST_STRING[--pos]; + endfunction + + function byte increment_array_idx(); + int pos = 0; + increment_array_idx = TEST_STRING[++pos]; + endfunction + + initial begin + if (CHECK_DECREMENT != "s") $stop; + if (CHECK_INCREMENT != "e") $stop; + $write("*-* All Finished *-*\n"); + $finish; + end +endmodule