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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_1_0/] [sw/] [run_regression.pl] - Blame information for rev 292

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

powered by: WebSVN 2.1.0

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