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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [simulation/] [build_coverage] - Diff between revs 124 and 125

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

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

powered by: WebSVN 2.1.0

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