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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [simulation/] [build_coverage] - Blame information for rev 124

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

Line No. Rev Author Line
1 119 jt_eaton
eval 'exec `which perl` -S $0 ${1+"$@"}'
2
   if 0;
3
 
4
#/**********************************************************************/
5
#/*                                                                    */
6
#/*             -------                                                */
7
#/*            /   SOC  \                                              */
8
#/*           /    GEN   \                                             */
9
#/*          /    TOOL    \                                            */
10
#/*          ==============                                            */
11
#/*          |            |                                            */
12
#/*          |____________|                                            */
13
#/*                                                                    */
14
#/*                                                                    */
15
#/*                                                                    */
16
#/*  Author(s):                                                        */
17
#/*      - John Eaton, jt_eaton@opencores.org                          */
18
#/*                                                                    */
19
#/**********************************************************************/
20
#/*                                                                    */
21 124 jt_eaton
#/*    Copyright (C) <2010-2013>                */
22 119 jt_eaton
#/*                                                                    */
23
#/*  This source file may be used and distributed without              */
24
#/*  restriction provided that this copyright statement is not         */
25
#/*  removed from the file and that any derivative work contains       */
26
#/*  the original copyright notice and the associated disclaimer.      */
27
#/*                                                                    */
28
#/*  This source file is free software; you can redistribute it        */
29
#/*  and/or modify it under the terms of the GNU Lesser General        */
30
#/*  Public License as published by the Free Software Foundation;      */
31
#/*  either version 2.1 of the License, or (at your option) any        */
32
#/*  later version.                                                    */
33
#/*                                                                    */
34
#/*  This source is distributed in the hope that it will be            */
35
#/*  useful, but WITHOUT ANY WARRANTY; without even the implied        */
36
#/*  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR           */
37
#/*  PURPOSE.  See the GNU Lesser General Public License for more      */
38
#/*  details.                                                          */
39
#/*                                                                    */
40
#/*  You should have received a copy of the GNU Lesser General         */
41
#/*  Public License along with this source; if not, download it        */
42
#/*  from http://www.opencores.org/lgpl.shtml                          */
43
#/*                                                                    */
44
#/**********************************************************************/
45
 
46
 
47
############################################################################
48
# General PERL config
49
############################################################################
50
use Getopt::Long;
51
use English;
52
use File::Basename;
53
use Cwd;
54
use XML::LibXML;
55
use lib './tools';
56
use sys::lib;
57
use yp::lib;
58
 
59
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
60
 
61
 
62
############################################################################
63
### Process the options
64
############################################################################
65
Getopt::Long::config("require_order", "prefix=-");
66
GetOptions("h","help",
67
           "work_site=s" => \$work_site,
68
           "vendor=s" => \$vendor,
69
           "project=s" => \$project,
70
           "version=s" => \$version,
71
           "component=s" => \$component,
72
) || die "(use '$program_name -h' for help)";
73
 
74
 
75
 
76
 
77
##############################################################################
78
## Help option
79
##############################################################################
80
if ( $opt_h or $opt_help  )
81
  { print "\n build_coverage -work_site /work -project project_name  -component component_name";
82
    print "\n";
83
    exit 1;
84
  }
85
 
86
 
87
 
88
 
89
#############################################################################
90
##
91
##
92
#############################################################################
93
 
94
 
95
 
96 124 jt_eaton
my $home        =  cwd();
97
my $prefix      = "${work_site}/${vendor}__${project}";
98
my $library_path ;
99 119 jt_eaton
 
100 124 jt_eaton
 
101
 
102 119 jt_eaton
print "      Building Code Coverage and linting for  $work_site $project    $component   \n" ;
103
 
104
 
105
my $parser = XML::LibXML->new();
106
 
107 124 jt_eaton
my $sogen_file     = $parser->parse_file(yp::lib::find_socgen("socgen:componentConfiguration",$vendor,$project,$component));
108 119 jt_eaton
 
109 124 jt_eaton
foreach  my   $i_name ($sogen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:library_path"))
110
  {
111
  $library_path      = $i_name ->findnodes('./text()')->to_literal ;
112
  }
113 119 jt_eaton
 
114
 
115
 
116
 
117 124 jt_eaton
foreach my $comp ($sogen_file->findnodes('//socgen:sim/socgen:testbenches/socgen:testbench'))
118
  {
119 119 jt_eaton
 
120 124 jt_eaton
  my($version)  = $comp->findnodes('./socgen:version/text()')->to_literal ;
121 119 jt_eaton
 
122 124 jt_eaton
  my $variant = "";
123
  if($version) {$variant = "${component}_${version}"}
124
  else         {$variant = "${component}"}
125 119 jt_eaton
 
126 124 jt_eaton
  #/*********************************************************************************************/
127
  #/                                                                                            */
128
  #/ build directories and makefiles for code coverage                                          */
129
  #/                                                                                            */
130
  #/*********************************************************************************************/
131 119 jt_eaton
 
132 124 jt_eaton
  foreach  my   $i_name ($sogen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage"))
133
     {
134
     print "          Code coverage directories  for    $project - $component  . ${version}.     -  $variant \n";
135 119 jt_eaton
 
136 124 jt_eaton
     my $path  = "${home}${work_site}/${vendor}__${project}${library_path}/cov";
137
     mkdir $path,0755             unless( -e $path );
138
     my $path  = "${home}${work_site}/${vendor}__${project}${library_path}/cov/${variant}";
139
     mkdir $path,0755             unless( -e $path );
140
     my $outfile ="${home}${work_site}/${vendor}__${project}${library_path}/cov/${variant}/Makefile";
141
     open MAKCOVFILE,">$outfile" or die "unable to open $outfile";
142 119 jt_eaton
 
143 124 jt_eaton
     print MAKCOVFILE "SHELL=/bin/sh \n";
144
     print MAKCOVFILE "MAKE=make \n";
145
     print MAKCOVFILE " \n";
146
     print MAKCOVFILE " \n";
147
     print MAKCOVFILE ".PHONY build_cdd:\n";
148
     print MAKCOVFILE "build_cdd:\n";
149 119 jt_eaton
 
150 124 jt_eaton
     foreach  my   $i_name ($sogen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage/socgen:cover/socgen:name"))
151
       {
152
       my($cover_name)     = $i_name ->findnodes('./text()')->to_literal ;
153
       my($cover_inst)     = $i_name ->findnodes('../socgen:componentInstance/text()')->to_literal ;
154
       print MAKCOVFILE  "\tcovered score -f filelist.cov -i $cover_inst -t $cover_name -I ./ -v ./coverage.v -o ${cover_name}.cdd 2> ${cover_name}.log | tee >> ${cover_name}.log ;\\\n";
155
       }
156 119 jt_eaton
 
157 124 jt_eaton
     print MAKCOVFILE " \n";
158
     print MAKCOVFILE ".PHONY score_cov:\n";
159
     print MAKCOVFILE "score_cov:\n";
160 119 jt_eaton
 
161 124 jt_eaton
     foreach  my   $i_name ($sogen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage/socgen:cover/socgen:name"))
162
       {
163
       my($cover_name)     = $i_name ->findnodes('./text()')->to_literal ;
164
       my($cover_inst)     = $i_name ->findnodes('../componentInstance/text()')->to_literal ;
165
       print MAKCOVFILE  "\tcovered score -cdd ${cover_name}.cdd  -vcd ../../icarus/\$(TEST)/TestBench.vcd  2>> ${cover_name}_sco_cov.log | tee >> ${cover_name}_sco_cov.log ;\\\n";
166
       }
167 119 jt_eaton
 
168 124 jt_eaton
     print MAKCOVFILE " \n";
169
     print MAKCOVFILE ".PHONY report_cov:\n";
170
     print MAKCOVFILE "report_cov:\n";
171 119 jt_eaton
 
172 124 jt_eaton
     foreach  my   $i_name ($sogen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage/socgen:cover/socgen:name"))
173
       {
174
       my($cover_name)     = $i_name ->findnodes('./text()')->to_literal ;
175
       my($cover_inst)     = $i_name ->findnodes('../componentInstance/text()')->to_literal ;
176
       print MAKCOVFILE  "\tcovered report -cdd ${cover_name}.cdd 2> ${cover_name}_rep_cov.log | tee >> ${cover_name}_rep_cov.log ;\\\n";
177
       }
178
     }
179 119 jt_eaton
 
180 124 jt_eaton
  }
181 119 jt_eaton
 
182
 
183
 
184
 
185
 
186
 
187
 
188
 
189
 
190
 
191
 
192
 

powered by: WebSVN 2.1.0

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