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

Subversion Repositories socgen

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

Compare with Previous | Blame | View Log

eval 'exec `which perl` -S $0 ${1+"$@"}'
   if 0;
#/****************************************************************************/
#/*                                                                          */
#/*   SOCGEN Design for Reuse toolset                                        */
#/*                                                                          */
#/*   Version 1.0.0                                                          */
#/*                                                                          */
#/*   Author(s):                                                             */
#/*      - John Eaton, z3qmtr45@gmail.com                                    */
#/*                                                                          */
#/****************************************************************************/
#/*                                                                          */
#/*                                                                          */
#/*             Copyright 2016 John T Eaton                                  */ 
#/*                                                                          */
#/* Licensed under the Apache License, Version 2.0 (the "License");          */
#/* you may not use this file except in compliance with the License.         */
#/* You may obtain a copy of the License at                                  */
#/*                                                                          */
#/*    http://www.apache.org/licenses/LICENSE-2.0                            */
#/*                                                                          */
#/* Unless required by applicable law or agreed to in writing, software      */
#/* distributed under the License is distributed on an "AS IS" BASIS,        */
#/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
#/* See the License for the specific language governing permissions and      */
#/* limitations under the License.                                           */
#/*                                                                          */
#/*                                                                          */
#/****************************************************************************/


############################################################################
# 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";
       }
     }

  
 











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.