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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_1_4/] [sw/] [run_regression.pl] - Blame information for rev 306

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

powered by: WebSVN 2.1.0

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