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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_0_1_beta/] [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 70 arniml
# $Id: run_regression.pl,v 1.4 2004-04-18 19:02:25 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
 
29 48 arniml
 
30 35 arniml
use strict;
31
 
32 61 arniml
use Getopt::Std;
33
 
34
 
35
sub print_usage {
36
    print <<EOU;
37
Runs regression tests in \$VERIF_DIR.
38
Usage:
39
 run_regression.pl [-d]
40
  -d : Perform a dump compare on each test with the i8039 simulator.
41
EOU
42
}
43
 
44
 
45
my %options;
46 35 arniml
my (@asm_files, $asm_file);
47
my (%cells, $cell, $cell_dir, $tag);
48
my $pwd;
49 61 arniml
my $dump_compare = 0;
50 35 arniml
 
51
 
52
##############################################################################
53
# Commands to call the different VHDL simulators.
54
# 
55
# GHDL
56 61 arniml
my $ghdl_simulator     = './tb_behav_c0';
57
my $ghdl_simulator_vcd = $ghdl_simulator.' --vcd=temp.vcd';
58 35 arniml
#
59
# Choose simulator:
60 61 arniml
my $vhdl_simulator     = $ghdl_simulator;
61
my $vhdl_simulator_vcd = $ghdl_simulator_vcd;
62 35 arniml
#
63
##############################################################################
64
 
65
 
66 61 arniml
# process command line options
67
if (!getopts('d', \%options)) {
68
    print_usage();
69
    exit(1);
70
}
71
 
72
if (exists($options{'d'})) {
73
    $dump_compare = 1;
74
}
75
 
76 35 arniml
$pwd = `pwd`;
77
chomp($pwd);
78
 
79
 
80
@asm_files = `find \$VERIF_DIR -name '*.asm'`;
81
 
82
 
83
foreach $asm_file (@asm_files) {
84
    chomp($asm_file);
85
    # strip off assembler file names
86
    $asm_file =~ s/\/[^\/]+\.asm//;
87
    # strip off verification directory
88
    $asm_file =~ s/$ENV{'VERIF_DIR'}\///;
89
    $cells{$asm_file} = 1;
90
}
91
 
92
while (($cell, $tag) = each(%cells)) {
93
    $cell_dir = "$ENV{'VERIF_DIR'}/$cell";
94
 
95
    if (chdir($cell_dir)) {
96
        print("Processing $cell\n");
97
 
98
        system('sh', '-c', 'rm -f $SIM_DIR/t48_rom.hex');
99 70 arniml
        system('sh', '-c', 'make -f $VERIF_DIR/include/Makefile.cell clean');
100 35 arniml
        system('sh', '-c', 'make -f $VERIF_DIR/include/Makefile.cell simu clean');
101
        if ($? == 0) {
102
            chdir($ENV{'SIM_DIR'});
103
            system('sh', '-c', 'ls -l t48_rom.hex');
104 61 arniml
            system('sh', '-c', $dump_compare > 0 ? $vhdl_simulator_vcd : $vhdl_simulator);
105
 
106
            if ($dump_compare) {
107
                system('sh', '-c', 'rm -f dump sim.dump vhdl.dump');
108
                system('sh', '-c',
109
                       'vcd2vec.pl -s ../../sw/dump_compare.signals < temp.vcd | vec2dump.pl > vhdl.dump');
110
                system('sh', '-c', 'i8039 -f t48_rom.hex -d > dump');
111
                system('sh', '-c', 'egrep \':.+\|\' dump | sed -e \'s/[^|]*. *//\' > sim.dump');
112
                system('sh', '-c', 'diff -b -q sim.dump vhdl.dump');
113
                print("Dump Compare: ");
114
                if ($? == 0) {
115
                    print("PASS\n");
116
                } else {
117
                    print("FAIL\n");
118
                }
119
                system('sh', '-c', 'rm -f dump sim.dump vhdl.dump temp.vcd');
120
            }
121
 
122 35 arniml
        } else {
123
            print("Error: Cannot make cell $cell!\n");
124
        }
125
    } else {
126
        print("Error: Cannot change to directory $cell_dir!\n");
127
    }
128
}
129
 
130
chdir($pwd);

powered by: WebSVN 2.1.0

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