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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [simulation/] [build_coverage] - Rev 127

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,
           "project=s" => \$project,
           "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 -project project_name  -component component_name  -version version_name  ";
    print "\n";
    exit 1;
  }




#############################################################################
## 
## 
#############################################################################



my $home        =  cwd();
my $prefix      = "${work_site}/${vendor}__${project}";
my $sim_library_path ;



print "      Building Code Coverage and linting for  $work_site  $vendor $project    $component $version  \n" ;


my $parser = XML::LibXML->new();

my $sogen_file     = $parser->parse_file(yp::lib::find_socgen("socgen:componentConfiguration",$vendor,$project,$component));

$sim_library_path = $sogen_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 ($sogen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage"))
     {
     print "          Code coverage directories  for    $project - $component  . ${version}.     -  $variant \n"; 

     my $path  = "${home}${work_site}/${vendor}__${project}${sim_library_path}/cov";
     mkdir $path,0755             unless( -e $path );
     my $path  = "${home}${work_site}/${vendor}__${project}${sim_library_path}/cov/${variant}";
     mkdir $path,0755             unless( -e $path );
     my $outfile ="${home}${work_site}/${vendor}__${project}${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 " \n";
     print MAKCOVFILE " \n";
     print MAKCOVFILE ".PHONY 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"))
       {
       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 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 ".PHONY 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"))
       {
       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 ../../icarus/\$(TEST)/TestBench.vcd  2>> ${cover_name}_sco_cov.log | tee >> ${cover_name}_sco_cov.log ;\\\n";
       }





     print MAKCOVFILE " \n";
     print MAKCOVFILE ".PHONY score_cov_ver:\n";
     print MAKCOVFILE "score_cov_ver:\n";  

     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_inst)     = $i_name ->findnodes('../componentInstance/text()')->to_literal ;
       print MAKCOVFILE  "\tcovered score -cdd ${cover_name}.cdd  -vcd ../../verilator/\$(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 ($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_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

powered by: WebSVN 2.1.0

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