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 |
125 |
jt_eaton |
{ print "\n build_coverage -work_site /work -vendor vendor_name -project project_name -component component_name -version version_name ";
|
82 |
119 |
jt_eaton |
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 |
125 |
jt_eaton |
print " Building Code Coverage and linting for $work_site $vendor $project $component $version \n" ;
|
103 |
119 |
jt_eaton |
|
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 |
125 |
jt_eaton |
$library_path = $sogen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:library_path/text()")->to_literal;
|
110 |
119 |
jt_eaton |
|
111 |
|
|
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
|
116 |
125 |
jt_eaton |
|
117 |
|
|
|
118 |
|
|
|
119 |
124 |
jt_eaton |
my $variant = "";
|
120 |
125 |
jt_eaton |
|
121 |
124 |
jt_eaton |
if($version) {$variant = "${component}_${version}"}
|
122 |
|
|
else {$variant = "${component}"}
|
123 |
119 |
jt_eaton |
|
124 |
124 |
jt_eaton |
#/*********************************************************************************************/
|
125 |
|
|
#/ */
|
126 |
|
|
#/ build directories and makefiles for code coverage */
|
127 |
|
|
#/ */
|
128 |
|
|
#/*********************************************************************************************/
|
129 |
119 |
jt_eaton |
|
130 |
124 |
jt_eaton |
foreach my $i_name ($sogen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage"))
|
131 |
|
|
{
|
132 |
|
|
print " Code coverage directories for $project - $component . ${version}. - $variant \n";
|
133 |
119 |
jt_eaton |
|
134 |
124 |
jt_eaton |
my $path = "${home}${work_site}/${vendor}__${project}${library_path}/cov";
|
135 |
|
|
mkdir $path,0755 unless( -e $path );
|
136 |
|
|
my $path = "${home}${work_site}/${vendor}__${project}${library_path}/cov/${variant}";
|
137 |
|
|
mkdir $path,0755 unless( -e $path );
|
138 |
|
|
my $outfile ="${home}${work_site}/${vendor}__${project}${library_path}/cov/${variant}/Makefile";
|
139 |
|
|
open MAKCOVFILE,">$outfile" or die "unable to open $outfile";
|
140 |
119 |
jt_eaton |
|
141 |
124 |
jt_eaton |
print MAKCOVFILE "SHELL=/bin/sh \n";
|
142 |
|
|
print MAKCOVFILE "MAKE=make \n";
|
143 |
|
|
print MAKCOVFILE " \n";
|
144 |
|
|
print MAKCOVFILE " \n";
|
145 |
|
|
print MAKCOVFILE ".PHONY build_cdd:\n";
|
146 |
|
|
print MAKCOVFILE "build_cdd:\n";
|
147 |
119 |
jt_eaton |
|
148 |
124 |
jt_eaton |
foreach my $i_name ($sogen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage/socgen:cover/socgen:name"))
|
149 |
|
|
{
|
150 |
|
|
my($cover_name) = $i_name ->findnodes('./text()')->to_literal ;
|
151 |
|
|
my($cover_inst) = $i_name ->findnodes('../socgen:componentInstance/text()')->to_literal ;
|
152 |
|
|
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";
|
153 |
|
|
}
|
154 |
119 |
jt_eaton |
|
155 |
124 |
jt_eaton |
print MAKCOVFILE " \n";
|
156 |
|
|
print MAKCOVFILE ".PHONY score_cov:\n";
|
157 |
|
|
print MAKCOVFILE "score_cov:\n";
|
158 |
119 |
jt_eaton |
|
159 |
124 |
jt_eaton |
foreach my $i_name ($sogen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage/socgen:cover/socgen:name"))
|
160 |
|
|
{
|
161 |
|
|
my($cover_name) = $i_name ->findnodes('./text()')->to_literal ;
|
162 |
|
|
my($cover_inst) = $i_name ->findnodes('../componentInstance/text()')->to_literal ;
|
163 |
|
|
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";
|
164 |
|
|
}
|
165 |
119 |
jt_eaton |
|
166 |
124 |
jt_eaton |
print MAKCOVFILE " \n";
|
167 |
|
|
print MAKCOVFILE ".PHONY report_cov:\n";
|
168 |
|
|
print MAKCOVFILE "report_cov:\n";
|
169 |
119 |
jt_eaton |
|
170 |
124 |
jt_eaton |
foreach my $i_name ($sogen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage/socgen:cover/socgen:name"))
|
171 |
|
|
{
|
172 |
|
|
my($cover_name) = $i_name ->findnodes('./text()')->to_literal ;
|
173 |
|
|
my($cover_inst) = $i_name ->findnodes('../componentInstance/text()')->to_literal ;
|
174 |
|
|
print MAKCOVFILE "\tcovered report -cdd ${cover_name}.cdd 2> ${cover_name}_rep_cov.log | tee >> ${cover_name}_rep_cov.log ;\\\n";
|
175 |
|
|
}
|
176 |
|
|
}
|
177 |
119 |
jt_eaton |
|
178 |
125 |
jt_eaton |
|
179 |
119 |
jt_eaton |
|
180 |
|
|
|
181 |
|
|
|
182 |
|
|
|
183 |
|
|
|
184 |
|
|
|
185 |
|
|
|
186 |
|
|
|
187 |
|
|
|
188 |
|
|
|
189 |
|
|
|
190 |
|
|
|