URL
https://opencores.org/ocsvn/socgen/socgen/trunk
Subversion Repositories socgen
[/] [socgen/] [trunk/] [tools/] [simulation/] [build_coverage] - Rev 131
Go to most recent revision | Compare with Previous | Blame | View Log
eval 'exec `which perl` -S $0 ${1+"$@"}'
if 0;
#/**********************************************************************/
#/* */
#/* ------- */
#/* / SOC \ */
#/* / GEN \ */
#/* / TOOL \ */
#/* ============== */
#/* | | */
#/* |____________| */
#/* */
#/* */
#/* */
#/* Author(s): */
#/* - John Eaton, jt_eaton@opencores.org */
#/* */
#/**********************************************************************/
#/* */
#/* Copyright (C) <2010-2013> <Ouabache Design Works> */
#/* */
#/* This source file may be used and distributed without */
#/* restriction provided that this copyright statement is not */
#/* removed from the file and that any derivative work contains */
#/* the original copyright notice and the associated disclaimer. */
#/* */
#/* This source file is free software; you can redistribute it */
#/* and/or modify it under the terms of the GNU Lesser General */
#/* Public License as published by the Free Software Foundation; */
#/* either version 2.1 of the License, or (at your option) any */
#/* later version. */
#/* */
#/* This source is distributed in the hope that it will be */
#/* useful, but WITHOUT ANY WARRANTY; without even the implied */
#/* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR */
#/* PURPOSE. See the GNU Lesser General Public License for more */
#/* details. */
#/* */
#/* You should have received a copy of the GNU Lesser General */
#/* Public License along with this source; if not, download it */
#/* from http://www.opencores.org/lgpl.shtml */
#/* */
#/**********************************************************************/
############################################################################
# General PERL config
############################################################################
use Getopt::Long;
use English;
use File::Basename;
use Cwd;
use XML::LibXML;
use lib './tools';
use sys::lib;
use yp::lib;
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
############################################################################
### Process the options
############################################################################
Getopt::Long::config("require_order", "prefix=-");
GetOptions("h","help",
"work_site=s" => \$work_site,
"vendor=s" => \$vendor,
"library=s" => \$library,
"version=s" => \$version,
"component=s" => \$component,
) || die "(use '$program_name -h' for help)";
##############################################################################
## Help option
##############################################################################
if ( $opt_h or $opt_help )
{ print "\n build_coverage -work_site /work -vendor vendor_name -library library_name -component component_name -version version_name ";
print "\n";
exit 1;
}
#############################################################################
##
##
#############################################################################
my $home = cwd();
my $prefix = "${work_site}/${vendor}__${library}";
print " Building Code Coverage and linting for $work_site $vendor $library $component $version \n" ;
my $parser = XML::LibXML->new();
my $socgen_file = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
my $sim_library_path ;
my $lib_comp_sep = yp::lib::find_lib_comp_sep($vendor,$library,$component);
my $sim_comp_path = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:comp_path/text()")->to_literal;
if ($sim_comp_path)
{
$sim_library_path ="${lib_comp_sep}${sim_comp_path}";
}
else
{
$sim_library_path = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:library_path/text()")->to_literal;
}
my $variant = "";
if($version) {$variant = "${component}_${version}"}
else {$variant = "${component}"}
#/*********************************************************************************************/
#/ */
#/ build directories and makefiles for code coverage */
#/ */
#/*********************************************************************************************/
foreach my $i_name ($socgen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage"))
{
my $tool;
foreach my $i_name ($socgen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:tools/socgen:tool"))
{
my($tool_name) = $i_name ->findnodes('./text()')->to_literal ;
unless($tool_name eq "coverage") {$tool = $tool_name}
}
print "Code coverage directories for $tool $library - $component . ${version}. - $variant \n";
my $path = "${home}${work_site}/${vendor}__${library}${sim_library_path}/cov";
mkdir $path,0755 unless( -e $path );
my $path = "${home}${work_site}/${vendor}__${library}${sim_library_path}/cov/${variant}";
mkdir $path,0755 unless( -e $path );
my $outfile ="${home}${work_site}/${vendor}__${library}${sim_library_path}/cov/${variant}/Makefile";
open MAKCOVFILE,">$outfile" or die "unable to open $outfile";
print MAKCOVFILE "SHELL=/bin/sh \n";
print MAKCOVFILE "MAKE=make \n";
print MAKCOVFILE "comp=${variant} \n";
print MAKCOVFILE "tool=${tool} \n";
print MAKCOVFILE " \n";
print MAKCOVFILE ".PHONY build_cdd:\n";
print MAKCOVFILE "build_cdd:\n";
foreach my $i_name ($socgen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage/socgen:cover/socgen:name"))
{
my($cover_name) = $i_name ->findnodes('./text()')->to_literal ;
my($cover_inst) = $i_name ->findnodes('../socgen:componentInstance/text()')->to_literal ;
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";
}
print MAKCOVFILE " \n";
print MAKCOVFILE ".PHONY score_cov:\n";
print MAKCOVFILE "score_cov:\n";
foreach my $i_name ($socgen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage/socgen:cover/socgen:name"))
{
my($cover_name) = $i_name ->findnodes('./text()')->to_literal ;
my($cover_inst) = $i_name ->findnodes('../componentInstance/text()')->to_literal ;
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";
}
print MAKCOVFILE " \n";
print MAKCOVFILE ".PHONY report_cov:\n";
print MAKCOVFILE "report_cov:\n";
foreach my $i_name ($socgen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage/socgen:cover/socgen:name"))
{
my($cover_name) = $i_name ->findnodes('./text()')->to_literal ;
my($cover_inst) = $i_name ->findnodes('../componentInstance/text()')->to_literal ;
print MAKCOVFILE "\tcovered report -cdd ${cover_name}.cdd 2> ${cover_name}_rep_cov.log | tee >> ${cover_name}_rep_cov.log ;\\\n";
}
}
Go to most recent revision | Compare with Previous | Blame | View Log