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 |
|
|
#/* Copyright (C) <2010-2011> */
|
22 |
|
|
#/* */
|
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 |
|
|
my $home = cwd();
|
97 |
|
|
my $prefix = "${work_site}/${vendor}__${project}";
|
98 |
|
|
|
99 |
|
|
print " Building Code Coverage and linting for $work_site $project $component \n" ;
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
my $parser = XML::LibXML->new();
|
103 |
|
|
|
104 |
|
|
my $socgen_ip_file = $parser->parse_file(yp::lib::find_socgen("socgen:ip",$vendor,$project,$component));
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
foreach my $comp ($socgen_ip_file->findnodes('//socgen:testbenches/socgen:testbench'))
|
112 |
|
|
{
|
113 |
|
|
|
114 |
|
|
my($version) = $comp->findnodes('./socgen:version/text()')->to_literal ;
|
115 |
|
|
|
116 |
|
|
my $variant = "";
|
117 |
|
|
if($version) {$variant = "${component}_${version}"}
|
118 |
|
|
else {$variant = "${component}"}
|
119 |
|
|
|
120 |
|
|
print " Code coverage directories for $project - $component . ${version}. - $variant \n";
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
#/*********************************************************************************************/
|
124 |
|
|
#/ */
|
125 |
|
|
#/ build directories and makefiles for code coverage */
|
126 |
|
|
#/ */
|
127 |
|
|
#/ */
|
128 |
|
|
#/ */
|
129 |
|
|
#/ */
|
130 |
|
|
#/*********************************************************************************************/
|
131 |
|
|
|
132 |
|
|
|
133 |
|
|
|
134 |
|
|
foreach my $i_name ($socgen_ip_file->findnodes("//socgen:ip/socgen:library_sim_path"))
|
135 |
|
|
{
|
136 |
|
|
my($library_path) = $i_name ->findnodes('./text()')->to_literal ;
|
137 |
|
|
|
138 |
|
|
#/*********************************************************************************************/
|
139 |
|
|
#/ */
|
140 |
|
|
#/ build directories and makefiles for code coverage */
|
141 |
|
|
#/ */
|
142 |
|
|
#/*********************************************************************************************/
|
143 |
|
|
|
144 |
|
|
|
145 |
|
|
my $path = "${home}${work_site}/${vendor}__${project}${library_path}/cov";
|
146 |
|
|
mkdir $path,0755 unless( -e $path );
|
147 |
|
|
my $path = "${home}${work_site}/${vendor}__${project}${library_path}/cov/${variant}";
|
148 |
|
|
mkdir $path,0755 unless( -e $path );
|
149 |
|
|
my $outfile ="${home}${work_site}/${vendor}__${project}${library_path}/cov/${variant}/Makefile";
|
150 |
|
|
open MAKCOVFILE,">$outfile" or die "unable to open $outfile";
|
151 |
|
|
|
152 |
|
|
#/*********************************************************************************************/
|
153 |
|
|
#/ */
|
154 |
|
|
#/ build directories and makefiles for linting */
|
155 |
|
|
#/ */
|
156 |
|
|
#/*********************************************************************************************/
|
157 |
|
|
|
158 |
|
|
$path = "${home}${work_site}/${vendor}__${project}${library_path}/lint";
|
159 |
|
|
mkdir $path,0755 unless( -e $path );
|
160 |
|
|
|
161 |
|
|
$path = "${home}${work_site}/${vendor}__${project}${library_path}/lint/${variant}";
|
162 |
|
|
mkdir $path,0755 unless( -e $path );
|
163 |
|
|
|
164 |
|
|
symlink( "${home}/tools/bin/Makefile.lint",
|
165 |
|
|
"${home}${prefix}${library_path}/lint/${variant}/Makefile");
|
166 |
|
|
}
|
167 |
|
|
|
168 |
|
|
|
169 |
|
|
|
170 |
|
|
|
171 |
|
|
|
172 |
|
|
print MAKCOVFILE "SHELL=/bin/sh \n";
|
173 |
|
|
print MAKCOVFILE "MAKE=make \n";
|
174 |
|
|
print MAKCOVFILE " \n";
|
175 |
|
|
print MAKCOVFILE " \n";
|
176 |
|
|
print MAKCOVFILE ".PHONY build_cdd:\n";
|
177 |
|
|
print MAKCOVFILE "build_cdd:\n";
|
178 |
|
|
|
179 |
|
|
|
180 |
|
|
foreach my $i_name ($socgen_ip_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage/socgen:cover/socgen:name"))
|
181 |
|
|
{
|
182 |
|
|
my($cover_name) = $i_name ->findnodes('./text()')->to_literal ;
|
183 |
|
|
my($cover_inst) = $i_name ->findnodes('../socgen:componentInstance/text()')->to_literal ;
|
184 |
|
|
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";
|
185 |
|
|
}
|
186 |
|
|
|
187 |
|
|
print MAKCOVFILE " \n";
|
188 |
|
|
print MAKCOVFILE ".PHONY score_cov:\n";
|
189 |
|
|
print MAKCOVFILE "score_cov:\n";
|
190 |
|
|
|
191 |
|
|
foreach my $i_name ($socgen_ip_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage/socgen:cover/socgen:name"))
|
192 |
|
|
{
|
193 |
|
|
my($cover_name) = $i_name ->findnodes('./text()')->to_literal ;
|
194 |
|
|
my($cover_inst) = $i_name ->findnodes('../componentInstance/text()')->to_literal ;
|
195 |
|
|
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";
|
196 |
|
|
}
|
197 |
|
|
|
198 |
|
|
print MAKCOVFILE " \n";
|
199 |
|
|
print MAKCOVFILE ".PHONY report_cov:\n";
|
200 |
|
|
print MAKCOVFILE "report_cov:\n";
|
201 |
|
|
|
202 |
|
|
foreach my $i_name ($socgen_ip_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage/socgen:cover/socgen:name"))
|
203 |
|
|
{
|
204 |
|
|
my($cover_name) = $i_name ->findnodes('./text()')->to_literal ;
|
205 |
|
|
my($cover_inst) = $i_name ->findnodes('../componentInstance/text()')->to_literal ;
|
206 |
|
|
print MAKCOVFILE "\tcovered report -cdd ${cover_name}.cdd 2> ${cover_name}_rep_cov.log | tee >> ${cover_name}_rep_cov.log ;\\\n";
|
207 |
|
|
}
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
|
211 |
|
|
|
212 |
|
|
}
|
213 |
|
|
|
214 |
|
|
|
215 |
|
|
|
216 |
|
|
|
217 |
|
|
|
218 |
|
|
|
219 |
|
|
|
220 |
|
|
|
221 |
|
|
|
222 |
|
|
|
223 |
|
|
|
224 |
|
|
|