OpenCores
URL https://opencores.org/ocsvn/t48/t48/trunk

Subversion Repositories t48

[/] [t48/] [tags/] [rel_1_3/] [sw/] [run_regression.pl] - Blame information for rev 333

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 35 arniml
#!/usr/bin/perl -w
2
#
3 48 arniml
# ############################################################################
4 35 arniml
#
5
# run_regression.pl
6
#
7 295 arniml
# $Id: run_regression.pl 311 2022-12-19 20:58:04Z arniml $
8 35 arniml
#
9 311 arniml
# Copyright (c) 2004-2022, Arnim Laeuger (arniml@opencores.org)
10 35 arniml
#
11
# All rights reserved
12
#
13 48 arniml
# ############################################################################
14 35 arniml
#
15 48 arniml
# Purpose:
16
# ========
17
#
18 35 arniml
# Runs regression suite over all testcells found in $VERIF_DIR.
19
#
20 61 arniml
# run_regression.pl [-d]
21
#  -d : Perform a dump compare on each test with the i8039 simulator.
22
#
23 35 arniml
# The testcells are identified by searching for the .asm file(s).
24
# Each testcell is built by calling the central Makefile.cell.
25
# The resulting hex-file is then copied to $SIM_DIR where the VHDL simulator
26
# is started.
27
#
28 267 arniml
# Exceptions for a testcell are defined by additional files.
29 311 arniml
#   no_gen   : don't execute the generic/default testbench tb_behav_c0
30
#   no_t48   : don't execute the t8048 testbench tb_t8048_behav_c0
31
#   no_t39   : don't execute the t8039 testbench tb_t8039_behav_c0
32
#   no_t41   : don't execute the t8041 testbench tb_t8041_behav_c0
33
#   no_t41a  : don't execute the t8041a testbench tb_t8041a_behav_c0
34
#   no_t42ah : don't execute the t8042ah testbench tb_t8042ah_behav_c0
35 267 arniml
#   no_dump_compare : don't include testcell when running dump compares
36
#   io_exp : use the testbenches containing the t8243 IO expander
37
#            tb_t8243_behav_c0
38
#            tb_t8048_t8243_behav_c0
39
#
40 35 arniml
 
41 48 arniml
 
42 35 arniml
use strict;
43
 
44 61 arniml
use Getopt::Std;
45
 
46
 
47
sub print_usage {
48
    print <<EOU;
49
Runs regression tests in \$VERIF_DIR.
50
Usage:
51
 run_regression.pl [-d]
52
  -d : Perform a dump compare on each test with the i8039 simulator.
53
EOU
54
}
55
 
56
 
57
my %options;
58 35 arniml
my (@asm_files, $asm_file);
59
my (%cells, $cell, $cell_dir, $tag);
60
my $pwd;
61 61 arniml
my $dump_compare = 0;
62 126 arniml
my $dump_compare_cell = 0;
63 267 arniml
my $io_exp_cell = 0;
64 35 arniml
 
65
 
66
##############################################################################
67
# Commands to call the different VHDL simulators.
68
# 
69
# GHDL
70 311 arniml
my %ghdl_simulators    = ('gen'   => './tb_behav_c0',
71
                          't48'   => './tb_t8048_behav_c0',
72
                          't39'   => './tb_t8039_behav_c0',
73
                          't41'   => './tb_t8041_behav_c0',
74
                          't41a'  => './tb_t8041a_behav_c0',
75
                          't42ah' => './tb_t8042ah_behav_c0');
76 267 arniml
my %ghdl_io_expanders  = ('gen' => './tb_t8243_behav_c0',
77
                          't48' => './tb_t8048_t8243_behav_c0');
78 241 arniml
my $ghdl_simulator_opt = '--assert-level=error --stop-time=20ms';
79
my $ghdl_simulator_vcd = './tb_behav_c0 --assert-level=error --vcd=temp.vcd';
80 35 arniml
#
81
# Choose simulator:
82 241 arniml
my %vhdl_simulators    = %ghdl_simulators;
83 267 arniml
my %vhdl_io_expanders  = %ghdl_io_expanders;
84 241 arniml
my $vhdl_simulator_opt = $ghdl_simulator_opt;
85 61 arniml
my $vhdl_simulator_vcd = $ghdl_simulator_vcd;
86 241 arniml
my ($vhdl_simulator_tag, $vhdl_simulator);
87 35 arniml
#
88
##############################################################################
89
 
90
 
91 61 arniml
# process command line options
92
if (!getopts('d', \%options)) {
93
    print_usage();
94
    exit(1);
95
}
96
 
97
if (exists($options{'d'})) {
98
    $dump_compare = 1;
99
}
100
 
101 35 arniml
$pwd = `pwd`;
102
chomp($pwd);
103
 
104
 
105 96 arniml
@asm_files = `find \$VERIF_DIR/black_box -name '*.asm'`;
106 104 arniml
push(@asm_files, `find \$VERIF_DIR/white_box -name '*.asm'`);
107 35 arniml
 
108
 
109
foreach $asm_file (@asm_files) {
110
    chomp($asm_file);
111
    # strip off assembler file names
112
    $asm_file =~ s/\/[^\/]+\.asm//;
113
    # strip off verification directory
114
    $asm_file =~ s/$ENV{'VERIF_DIR'}\///;
115
    $cells{$asm_file} = 1;
116
}
117
 
118
while (($cell, $tag) = each(%cells)) {
119
    $cell_dir = "$ENV{'VERIF_DIR'}/$cell";
120
 
121
    if (chdir($cell_dir)) {
122
        print("Processing $cell\n");
123
 
124 126 arniml
        $dump_compare_cell = -e 'no_dump_compare' ? 0 : $dump_compare;
125 267 arniml
        $io_exp_cell = -e 'io_exp' ? 1 : 0;
126 126 arniml
 
127 241 arniml
        system('rm -f $SIM_DIR/*.hex');
128 230 arniml
        system('make -f $VERIF_DIR/include/Makefile.cell clean');
129
        system('make -f $VERIF_DIR/include/Makefile.cell all clean');
130 35 arniml
        if ($? == 0) {
131
            chdir($ENV{'SIM_DIR'});
132 61 arniml
 
133 126 arniml
            if ($dump_compare_cell) {
134 241 arniml
                system($vhdl_simulator_vcd);
135 230 arniml
                system('rm -f dump sim.dump vhdl.dump');
136
                system('vcd2vec.pl -s ../../sw/dump_compare.signals < temp.vcd | vec2dump.pl > vhdl.dump');
137
                system('i8039 -f t48_rom.hex -x t48_ext_rom.hex -d > dump');
138
                system('egrep \':.+\|\' dump | sed -e \'s/[^|]*. *//\' > sim.dump');
139
                system('diff -b -q sim.dump vhdl.dump');
140 61 arniml
                print("Dump Compare: ");
141
                if ($? == 0) {
142
                    print("PASS\n");
143
                } else {
144
                    print("FAIL\n");
145
                }
146 230 arniml
                system('rm -f dump sim.dump vhdl.dump temp.vcd');
147 126 arniml
            } elsif ($dump_compare) {
148
                print("Dump Compare: Excluded\n");
149 241 arniml
            } else {
150 267 arniml
                # decide which simulator set is chosen for this cell
151
                my %cell_simulators = $io_exp_cell ? %vhdl_io_expanders :
152
                                                     %vhdl_simulators;
153
 
154 241 arniml
                # run all enabled simulators
155 267 arniml
                while (($vhdl_simulator_tag, $vhdl_simulator) = each %cell_simulators) {
156 241 arniml
                    if (! -e "$cell_dir/no_$vhdl_simulator_tag") {
157
                        print("Executing simulator $vhdl_simulator_tag\n");
158
                        system($vhdl_simulator." ".$vhdl_simulator_opt);
159
                    }
160
                }
161 61 arniml
            }
162
 
163 35 arniml
        } else {
164
            print("Error: Cannot make cell $cell!\n");
165
        }
166
    } else {
167
        print("Error: Cannot change to directory $cell_dir!\n");
168
    }
169
}
170
 
171
chdir($pwd);

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.