Tests: add test for incrementing/decrementing array index
Signed-off-by: Maciej Sobkowski <msobkowski@antmicro.com>
This commit is contained in:
parent
75ebe7a4be
commit
9d80b65281
|
|
@ -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;
|
||||
|
||||
|
|
@ -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
|
||||
Loading…
Reference in New Issue