| 1 |
119 |
jt_eaton |
eval 'exec `which perl` -S $0 ${1+"$@"}'
|
| 2 |
|
|
if 0;
|
| 3 |
135 |
jt_eaton |
#/****************************************************************************/
|
| 4 |
|
|
#/* */
|
| 5 |
|
|
#/* SOCGEN Design for Reuse toolset */
|
| 6 |
|
|
#/* */
|
| 7 |
|
|
#/* Version 1.0.0 */
|
| 8 |
|
|
#/* */
|
| 9 |
|
|
#/* Author(s): */
|
| 10 |
|
|
#/* - John Eaton, z3qmtr45@gmail.com */
|
| 11 |
|
|
#/* */
|
| 12 |
|
|
#/****************************************************************************/
|
| 13 |
|
|
#/* */
|
| 14 |
|
|
#/* */
|
| 15 |
|
|
#/* Copyright 2016 John T Eaton */
|
| 16 |
|
|
#/* */
|
| 17 |
|
|
#/* Licensed under the Apache License, Version 2.0 (the "License"); */
|
| 18 |
|
|
#/* you may not use this file except in compliance with the License. */
|
| 19 |
|
|
#/* You may obtain a copy of the License at */
|
| 20 |
|
|
#/* */
|
| 21 |
|
|
#/* http://www.apache.org/licenses/LICENSE-2.0 */
|
| 22 |
|
|
#/* */
|
| 23 |
|
|
#/* Unless required by applicable law or agreed to in writing, software */
|
| 24 |
|
|
#/* distributed under the License is distributed on an "AS IS" BASIS, */
|
| 25 |
|
|
#/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
|
| 26 |
|
|
#/* See the License for the specific language governing permissions and */
|
| 27 |
|
|
#/* limitations under the License. */
|
| 28 |
|
|
#/* */
|
| 29 |
|
|
#/* */
|
| 30 |
|
|
#/****************************************************************************/
|
| 31 |
119 |
jt_eaton |
|
| 32 |
|
|
|
| 33 |
|
|
############################################################################
|
| 34 |
|
|
# General PERL config
|
| 35 |
|
|
############################################################################
|
| 36 |
|
|
use Getopt::Long;
|
| 37 |
|
|
use English;
|
| 38 |
|
|
use File::Basename;
|
| 39 |
|
|
use Cwd;
|
| 40 |
|
|
use XML::LibXML;
|
| 41 |
|
|
use lib './tools';
|
| 42 |
|
|
use sys::lib;
|
| 43 |
|
|
use yp::lib;
|
| 44 |
|
|
|
| 45 |
|
|
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
|
| 46 |
|
|
|
| 47 |
|
|
|
| 48 |
|
|
############################################################################
|
| 49 |
|
|
### Process the options
|
| 50 |
|
|
############################################################################
|
| 51 |
|
|
Getopt::Long::config("require_order", "prefix=-");
|
| 52 |
|
|
GetOptions("h","help",
|
| 53 |
|
|
"work_site=s" => \$work_site,
|
| 54 |
|
|
"vendor=s" => \$vendor,
|
| 55 |
131 |
jt_eaton |
"library=s" => \$library,
|
| 56 |
119 |
jt_eaton |
"version=s" => \$version,
|
| 57 |
|
|
"component=s" => \$component,
|
| 58 |
|
|
) || die "(use '$program_name -h' for help)";
|
| 59 |
|
|
|
| 60 |
|
|
|
| 61 |
|
|
|
| 62 |
|
|
|
| 63 |
|
|
##############################################################################
|
| 64 |
|
|
## Help option
|
| 65 |
|
|
##############################################################################
|
| 66 |
|
|
if ( $opt_h or $opt_help )
|
| 67 |
131 |
jt_eaton |
{ print "\n build_coverage -work_site /work -vendor vendor_name -library library_name -component component_name -version version_name ";
|
| 68 |
119 |
jt_eaton |
print "\n";
|
| 69 |
|
|
exit 1;
|
| 70 |
|
|
}
|
| 71 |
|
|
|
| 72 |
|
|
|
| 73 |
|
|
|
| 74 |
|
|
|
| 75 |
|
|
#############################################################################
|
| 76 |
|
|
##
|
| 77 |
|
|
##
|
| 78 |
|
|
#############################################################################
|
| 79 |
|
|
|
| 80 |
|
|
|
| 81 |
|
|
|
| 82 |
124 |
jt_eaton |
my $home = cwd();
|
| 83 |
131 |
jt_eaton |
my $prefix = "${work_site}/${vendor}__${library}";
|
| 84 |
119 |
jt_eaton |
|
| 85 |
131 |
jt_eaton |
print " Building Code Coverage and linting for $work_site $vendor $library $component $version \n" ;
|
| 86 |
119 |
jt_eaton |
|
| 87 |
|
|
|
| 88 |
|
|
my $parser = XML::LibXML->new();
|
| 89 |
|
|
|
| 90 |
|
|
|
| 91 |
131 |
jt_eaton |
my $socgen_file = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
|
| 92 |
130 |
jt_eaton |
my $sim_library_path ;
|
| 93 |
131 |
jt_eaton |
my $lib_comp_sep = yp::lib::find_lib_comp_sep($vendor,$library,$component);
|
| 94 |
130 |
jt_eaton |
my $sim_comp_path = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:comp_path/text()")->to_literal;
|
| 95 |
119 |
jt_eaton |
|
| 96 |
130 |
jt_eaton |
if ($sim_comp_path)
|
| 97 |
|
|
{
|
| 98 |
|
|
$sim_library_path ="${lib_comp_sep}${sim_comp_path}";
|
| 99 |
|
|
}
|
| 100 |
|
|
else
|
| 101 |
|
|
{
|
| 102 |
|
|
$sim_library_path = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:library_path/text()")->to_literal;
|
| 103 |
|
|
}
|
| 104 |
119 |
jt_eaton |
|
| 105 |
|
|
|
| 106 |
|
|
|
| 107 |
|
|
|
| 108 |
|
|
|
| 109 |
125 |
jt_eaton |
|
| 110 |
124 |
jt_eaton |
my $variant = "";
|
| 111 |
125 |
jt_eaton |
|
| 112 |
124 |
jt_eaton |
if($version) {$variant = "${component}_${version}"}
|
| 113 |
|
|
else {$variant = "${component}"}
|
| 114 |
119 |
jt_eaton |
|
| 115 |
124 |
jt_eaton |
#/*********************************************************************************************/
|
| 116 |
|
|
#/ */
|
| 117 |
|
|
#/ build directories and makefiles for code coverage */
|
| 118 |
|
|
#/ */
|
| 119 |
|
|
#/*********************************************************************************************/
|
| 120 |
119 |
jt_eaton |
|
| 121 |
130 |
jt_eaton |
foreach my $i_name ($socgen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage"))
|
| 122 |
124 |
jt_eaton |
{
|
| 123 |
119 |
jt_eaton |
|
| 124 |
128 |
jt_eaton |
|
| 125 |
|
|
my $tool;
|
| 126 |
|
|
|
| 127 |
|
|
|
| 128 |
130 |
jt_eaton |
foreach my $i_name ($socgen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:tools/socgen:tool"))
|
| 129 |
128 |
jt_eaton |
{
|
| 130 |
|
|
my($tool_name) = $i_name ->findnodes('./text()')->to_literal ;
|
| 131 |
|
|
unless($tool_name eq "coverage") {$tool = $tool_name}
|
| 132 |
|
|
}
|
| 133 |
|
|
|
| 134 |
131 |
jt_eaton |
print "Code coverage directories for $tool $library - $component . ${version}. - $variant \n";
|
| 135 |
128 |
jt_eaton |
|
| 136 |
|
|
|
| 137 |
131 |
jt_eaton |
my $path = "${home}${work_site}/${vendor}__${library}${sim_library_path}/cov";
|
| 138 |
124 |
jt_eaton |
mkdir $path,0755 unless( -e $path );
|
| 139 |
131 |
jt_eaton |
my $path = "${home}${work_site}/${vendor}__${library}${sim_library_path}/cov/${variant}";
|
| 140 |
124 |
jt_eaton |
mkdir $path,0755 unless( -e $path );
|
| 141 |
131 |
jt_eaton |
my $outfile ="${home}${work_site}/${vendor}__${library}${sim_library_path}/cov/${variant}/Makefile";
|
| 142 |
124 |
jt_eaton |
open MAKCOVFILE,">$outfile" or die "unable to open $outfile";
|
| 143 |
119 |
jt_eaton |
|
| 144 |
124 |
jt_eaton |
print MAKCOVFILE "SHELL=/bin/sh \n";
|
| 145 |
|
|
print MAKCOVFILE "MAKE=make \n";
|
| 146 |
128 |
jt_eaton |
print MAKCOVFILE "comp=${variant} \n";
|
| 147 |
|
|
print MAKCOVFILE "tool=${tool} \n";
|
| 148 |
124 |
jt_eaton |
print MAKCOVFILE " \n";
|
| 149 |
|
|
print MAKCOVFILE ".PHONY build_cdd:\n";
|
| 150 |
|
|
print MAKCOVFILE "build_cdd:\n";
|
| 151 |
119 |
jt_eaton |
|
| 152 |
130 |
jt_eaton |
foreach my $i_name ($socgen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage/socgen:cover/socgen:name"))
|
| 153 |
124 |
jt_eaton |
{
|
| 154 |
|
|
my($cover_name) = $i_name ->findnodes('./text()')->to_literal ;
|
| 155 |
|
|
my($cover_inst) = $i_name ->findnodes('../socgen:componentInstance/text()')->to_literal ;
|
| 156 |
128 |
jt_eaton |
print MAKCOVFILE "\tcovered score -f ../../testbenches/filelists/${variant}.COV -i $cover_inst -t $cover_name -o ${cover_name}.cdd 2> ${cover_name}.log | tee >> ${cover_name}.log ;\\\n";
|
| 157 |
124 |
jt_eaton |
}
|
| 158 |
119 |
jt_eaton |
|
| 159 |
124 |
jt_eaton |
print MAKCOVFILE " \n";
|
| 160 |
|
|
print MAKCOVFILE ".PHONY score_cov:\n";
|
| 161 |
|
|
print MAKCOVFILE "score_cov:\n";
|
| 162 |
119 |
jt_eaton |
|
| 163 |
130 |
jt_eaton |
foreach my $i_name ($socgen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage/socgen:cover/socgen:name"))
|
| 164 |
124 |
jt_eaton |
{
|
| 165 |
|
|
my($cover_name) = $i_name ->findnodes('./text()')->to_literal ;
|
| 166 |
|
|
my($cover_inst) = $i_name ->findnodes('../componentInstance/text()')->to_literal ;
|
| 167 |
128 |
jt_eaton |
print MAKCOVFILE "\tcovered score -cdd ${cover_name}.cdd -vcd ../../${tool}/\$(TEST)/TestBench.vcd 2>> ${cover_name}_sco_cov.log | tee >> ${cover_name}_sco_cov.log ;\\\n";
|
| 168 |
124 |
jt_eaton |
}
|
| 169 |
119 |
jt_eaton |
|
| 170 |
126 |
jt_eaton |
|
| 171 |
124 |
jt_eaton |
print MAKCOVFILE " \n";
|
| 172 |
|
|
print MAKCOVFILE ".PHONY report_cov:\n";
|
| 173 |
|
|
print MAKCOVFILE "report_cov:\n";
|
| 174 |
119 |
jt_eaton |
|
| 175 |
130 |
jt_eaton |
foreach my $i_name ($socgen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage/socgen:cover/socgen:name"))
|
| 176 |
124 |
jt_eaton |
{
|
| 177 |
|
|
my($cover_name) = $i_name ->findnodes('./text()')->to_literal ;
|
| 178 |
|
|
my($cover_inst) = $i_name ->findnodes('../componentInstance/text()')->to_literal ;
|
| 179 |
|
|
print MAKCOVFILE "\tcovered report -cdd ${cover_name}.cdd 2> ${cover_name}_rep_cov.log | tee >> ${cover_name}_rep_cov.log ;\\\n";
|
| 180 |
|
|
}
|
| 181 |
|
|
}
|
| 182 |
119 |
jt_eaton |
|
| 183 |
125 |
jt_eaton |
|
| 184 |
119 |
jt_eaton |
|
| 185 |
|
|
|
| 186 |
|
|
|
| 187 |
|
|
|
| 188 |
|
|
|
| 189 |
|
|
|
| 190 |
|
|
|
| 191 |
|
|
|
| 192 |
|
|
|
| 193 |
|
|
|
| 194 |
|
|
|
| 195 |
|
|
|