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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [simulation/] [build_coverage] - Blame information for rev 131

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 119 jt_eaton
eval 'exec `which perl` -S $0 ${1+"$@"}'
2
   if 0;
3
 
4
#/**********************************************************************/
5
#/*                                                                    */
6
#/*             -------                                                */
7
#/*            /   SOC  \                                              */
8
#/*           /    GEN   \                                             */
9
#/*          /    TOOL    \                                            */
10
#/*          ==============                                            */
11
#/*          |            |                                            */
12
#/*          |____________|                                            */
13
#/*                                                                    */
14
#/*                                                                    */
15
#/*                                                                    */
16
#/*  Author(s):                                                        */
17
#/*      - John Eaton, jt_eaton@opencores.org                          */
18
#/*                                                                    */
19
#/**********************************************************************/
20
#/*                                                                    */
21 124 jt_eaton
#/*    Copyright (C) <2010-2013>                */
22 119 jt_eaton
#/*                                                                    */
23
#/*  This source file may be used and distributed without              */
24
#/*  restriction provided that this copyright statement is not         */
25
#/*  removed from the file and that any derivative work contains       */
26
#/*  the original copyright notice and the associated disclaimer.      */
27
#/*                                                                    */
28
#/*  This source file is free software; you can redistribute it        */
29
#/*  and/or modify it under the terms of the GNU Lesser General        */
30
#/*  Public License as published by the Free Software Foundation;      */
31
#/*  either version 2.1 of the License, or (at your option) any        */
32
#/*  later version.                                                    */
33
#/*                                                                    */
34
#/*  This source is distributed in the hope that it will be            */
35
#/*  useful, but WITHOUT ANY WARRANTY; without even the implied        */
36
#/*  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR           */
37
#/*  PURPOSE.  See the GNU Lesser General Public License for more      */
38
#/*  details.                                                          */
39
#/*                                                                    */
40
#/*  You should have received a copy of the GNU Lesser General         */
41
#/*  Public License along with this source; if not, download it        */
42
#/*  from http://www.opencores.org/lgpl.shtml                          */
43
#/*                                                                    */
44
#/**********************************************************************/
45
 
46
 
47
############################################################################
48
# General PERL config
49
############################################################################
50
use Getopt::Long;
51
use English;
52
use File::Basename;
53
use Cwd;
54
use XML::LibXML;
55
use lib './tools';
56
use sys::lib;
57
use yp::lib;
58
 
59
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
60
 
61
 
62
############################################################################
63
### Process the options
64
############################################################################
65
Getopt::Long::config("require_order", "prefix=-");
66
GetOptions("h","help",
67
           "work_site=s" => \$work_site,
68
           "vendor=s" => \$vendor,
69 131 jt_eaton
           "library=s" => \$library,
70 119 jt_eaton
           "version=s" => \$version,
71
           "component=s" => \$component,
72
) || die "(use '$program_name -h' for help)";
73
 
74
 
75
 
76
 
77
##############################################################################
78
## Help option
79
##############################################################################
80
if ( $opt_h or $opt_help  )
81 131 jt_eaton
  { print "\n build_coverage -work_site /work -vendor vendor_name -library library_name  -component component_name  -version version_name  ";
82 119 jt_eaton
    print "\n";
83
    exit 1;
84
  }
85
 
86
 
87
 
88
 
89
#############################################################################
90
##
91
##
92
#############################################################################
93
 
94
 
95
 
96 124 jt_eaton
my $home        =  cwd();
97 131 jt_eaton
my $prefix      = "${work_site}/${vendor}__${library}";
98 119 jt_eaton
 
99 131 jt_eaton
print "      Building Code Coverage and linting for  $work_site  $vendor $library    $component $version  \n" ;
100 119 jt_eaton
 
101
 
102
my $parser = XML::LibXML->new();
103
 
104
 
105 131 jt_eaton
my $socgen_file     = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
106 130 jt_eaton
my $sim_library_path ;
107 131 jt_eaton
my $lib_comp_sep             = yp::lib::find_lib_comp_sep($vendor,$library,$component);
108 130 jt_eaton
my $sim_comp_path            = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:comp_path/text()")->to_literal;
109 119 jt_eaton
 
110 130 jt_eaton
   if ($sim_comp_path)
111
      {
112
      $sim_library_path            ="${lib_comp_sep}${sim_comp_path}";
113
      }
114
   else
115
      {
116
      $sim_library_path            = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:library_path/text()")->to_literal;
117
      }
118 119 jt_eaton
 
119
 
120
 
121
 
122
 
123 125 jt_eaton
 
124 124 jt_eaton
  my $variant = "";
125 125 jt_eaton
 
126 124 jt_eaton
  if($version) {$variant = "${component}_${version}"}
127
  else         {$variant = "${component}"}
128 119 jt_eaton
 
129 124 jt_eaton
  #/*********************************************************************************************/
130
  #/                                                                                            */
131
  #/ build directories and makefiles for code coverage                                          */
132
  #/                                                                                            */
133
  #/*********************************************************************************************/
134 119 jt_eaton
 
135 130 jt_eaton
  foreach  my   $i_name ($socgen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage"))
136 124 jt_eaton
     {
137 119 jt_eaton
 
138 128 jt_eaton
 
139
     my $tool;
140
 
141
 
142 130 jt_eaton
     foreach  my   $i_name ($socgen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:tools/socgen:tool"))
143 128 jt_eaton
       {
144
       my($tool_name)     = $i_name ->findnodes('./text()')->to_literal ;
145
       unless($tool_name eq "coverage") {$tool = $tool_name}
146
       }
147
 
148 131 jt_eaton
     print "Code coverage directories  for  $tool  $library - $component  . ${version}.     -  $variant \n";
149 128 jt_eaton
 
150
 
151 131 jt_eaton
     my $path  = "${home}${work_site}/${vendor}__${library}${sim_library_path}/cov";
152 124 jt_eaton
     mkdir $path,0755             unless( -e $path );
153 131 jt_eaton
     my $path  = "${home}${work_site}/${vendor}__${library}${sim_library_path}/cov/${variant}";
154 124 jt_eaton
     mkdir $path,0755             unless( -e $path );
155 131 jt_eaton
     my $outfile ="${home}${work_site}/${vendor}__${library}${sim_library_path}/cov/${variant}/Makefile";
156 124 jt_eaton
     open MAKCOVFILE,">$outfile" or die "unable to open $outfile";
157 119 jt_eaton
 
158 124 jt_eaton
     print MAKCOVFILE "SHELL=/bin/sh \n";
159
     print MAKCOVFILE "MAKE=make \n";
160 128 jt_eaton
     print MAKCOVFILE "comp=${variant} \n";
161
     print MAKCOVFILE "tool=${tool} \n";
162 124 jt_eaton
     print MAKCOVFILE " \n";
163
     print MAKCOVFILE ".PHONY build_cdd:\n";
164
     print MAKCOVFILE "build_cdd:\n";
165 119 jt_eaton
 
166 130 jt_eaton
     foreach  my   $i_name ($socgen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage/socgen:cover/socgen:name"))
167 124 jt_eaton
       {
168
       my($cover_name)     = $i_name ->findnodes('./text()')->to_literal ;
169
       my($cover_inst)     = $i_name ->findnodes('../socgen:componentInstance/text()')->to_literal ;
170 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";
171 124 jt_eaton
       }
172 119 jt_eaton
 
173 124 jt_eaton
     print MAKCOVFILE " \n";
174
     print MAKCOVFILE ".PHONY score_cov:\n";
175
     print MAKCOVFILE "score_cov:\n";
176 119 jt_eaton
 
177 130 jt_eaton
     foreach  my   $i_name ($socgen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage/socgen:cover/socgen:name"))
178 124 jt_eaton
       {
179
       my($cover_name)     = $i_name ->findnodes('./text()')->to_literal ;
180
       my($cover_inst)     = $i_name ->findnodes('../componentInstance/text()')->to_literal ;
181 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";
182 124 jt_eaton
       }
183 119 jt_eaton
 
184 126 jt_eaton
 
185 124 jt_eaton
     print MAKCOVFILE " \n";
186
     print MAKCOVFILE ".PHONY report_cov:\n";
187
     print MAKCOVFILE "report_cov:\n";
188 119 jt_eaton
 
189 130 jt_eaton
     foreach  my   $i_name ($socgen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage/socgen:cover/socgen:name"))
190 124 jt_eaton
       {
191
       my($cover_name)     = $i_name ->findnodes('./text()')->to_literal ;
192
       my($cover_inst)     = $i_name ->findnodes('../componentInstance/text()')->to_literal ;
193
       print MAKCOVFILE  "\tcovered report -cdd ${cover_name}.cdd 2> ${cover_name}_rep_cov.log | tee >> ${cover_name}_rep_cov.log ;\\\n";
194
       }
195
     }
196 119 jt_eaton
 
197 125 jt_eaton
 
198 119 jt_eaton
 
199
 
200
 
201
 
202
 
203
 
204
 
205
 
206
 
207
 
208
 
209
 

powered by: WebSVN 2.1.0

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