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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_0_6_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 132 arniml
# $Id: run_regression.pl,v 1.8 2004-09-12 00:30:53 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 126 arniml
my $dump_compare_cell = 0;
51 35 arniml
 
52
 
53
##############################################################################
54
# Commands to call the different VHDL simulators.
55
# 
56
# GHDL
57 132 arniml
my $ghdl_simulator     = './tb_behav_c0 --assert-level=error';
58 61 arniml
my $ghdl_simulator_vcd = $ghdl_simulator.' --vcd=temp.vcd';
59 35 arniml
#
60
# Choose simulator:
61 61 arniml
my $vhdl_simulator     = $ghdl_simulator;
62
my $vhdl_simulator_vcd = $ghdl_simulator_vcd;
63 35 arniml
#
64
##############################################################################
65
 
66
 
67 61 arniml
# process command line options
68
if (!getopts('d', \%options)) {
69
    print_usage();
70
    exit(1);
71
}
72
 
73
if (exists($options{'d'})) {
74
    $dump_compare = 1;
75
}
76
 
77 35 arniml
$pwd = `pwd`;
78
chomp($pwd);
79
 
80
 
81 96 arniml
@asm_files = `find \$VERIF_DIR/black_box -name '*.asm'`;
82 104 arniml
push(@asm_files, `find \$VERIF_DIR/white_box -name '*.asm'`);
83 35 arniml
 
84
 
85
foreach $asm_file (@asm_files) {
86
    chomp($asm_file);
87
    # strip off assembler file names
88
    $asm_file =~ s/\/[^\/]+\.asm//;
89
    # strip off verification directory
90
    $asm_file =~ s/$ENV{'VERIF_DIR'}\///;
91
    $cells{$asm_file} = 1;
92
}
93
 
94
while (($cell, $tag) = each(%cells)) {
95
    $cell_dir = "$ENV{'VERIF_DIR'}/$cell";
96
 
97
    if (chdir($cell_dir)) {
98
        print("Processing $cell\n");
99
 
100 126 arniml
        $dump_compare_cell = -e 'no_dump_compare' ? 0 : $dump_compare;
101
 
102 35 arniml
        system('sh', '-c', 'rm -f $SIM_DIR/t48_rom.hex');
103 70 arniml
        system('sh', '-c', 'make -f $VERIF_DIR/include/Makefile.cell clean');
104 35 arniml
        system('sh', '-c', 'make -f $VERIF_DIR/include/Makefile.cell simu clean');
105
        if ($? == 0) {
106
            chdir($ENV{'SIM_DIR'});
107
            system('sh', '-c', 'ls -l t48_rom.hex');
108 126 arniml
            system('sh', '-c', $dump_compare_cell > 0 ? $vhdl_simulator_vcd : $vhdl_simulator);
109 61 arniml
 
110 126 arniml
            if ($dump_compare_cell) {
111 61 arniml
                system('sh', '-c', 'rm -f dump sim.dump vhdl.dump');
112
                system('sh', '-c',
113
                       'vcd2vec.pl -s ../../sw/dump_compare.signals < temp.vcd | vec2dump.pl > vhdl.dump');
114 126 arniml
                system('sh', '-c', 'i8039 -f t48_rom.hex -x t48_ext_rom.hex -d > dump');
115 61 arniml
                system('sh', '-c', 'egrep \':.+\|\' dump | sed -e \'s/[^|]*. *//\' > sim.dump');
116
                system('sh', '-c', 'diff -b -q sim.dump vhdl.dump');
117
                print("Dump Compare: ");
118
                if ($? == 0) {
119
                    print("PASS\n");
120
                } else {
121
                    print("FAIL\n");
122
                }
123
                system('sh', '-c', 'rm -f dump sim.dump vhdl.dump temp.vcd');
124 126 arniml
            } elsif ($dump_compare) {
125
                print("Dump Compare: Excluded\n");
126 61 arniml
            }
127
 
128 35 arniml
        } else {
129
            print("Error: Cannot make cell $cell!\n");
130
        }
131
    } else {
132
        print("Error: Cannot change to directory $cell_dir!\n");
133
    }
134
}
135
 
136
chdir($pwd);

powered by: WebSVN 2.1.0

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