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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [simulation/] [build_sim_master] - Blame information for rev 135

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 131 jt_eaton
eval 'exec `which perl` -S $0 ${1+"$@"}'
2
   if 0;
3 135 jt_eaton
#/****************************************************************************/
4
#/*                                                                          */
5
#/*   SOCGEN Design for Reuse toolset                                        */
6
#/*                                                                          */
7
#/*   Version 1.0.0                                                          */
8
#/*                                                                          */
9
#/*   Author(s):                                                             */
10
#/*      - John Eaton, z3qmtr45@gmail.com                                    */
11
#/*                                                                          */
12
#/****************************************************************************/
13
#/*                                                                          */
14
#/*                                                                          */
15
#/*             Copyright 2016 John T Eaton                                  */
16
#/*                                                                          */
17
#/* Licensed under the Apache License, Version 2.0 (the "License");          */
18
#/* you may not use this file except in compliance with the License.         */
19
#/* You may obtain a copy of the License at                                  */
20
#/*                                                                          */
21
#/*    http://www.apache.org/licenses/LICENSE-2.0                            */
22
#/*                                                                          */
23
#/* Unless required by applicable law or agreed to in writing, software      */
24
#/* distributed under the License is distributed on an "AS IS" BASIS,        */
25
#/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
26
#/* See the License for the specific language governing permissions and      */
27
#/* limitations under the License.                                           */
28
#/*                                                                          */
29
#/*                                                                          */
30
#/****************************************************************************/
31 131 jt_eaton
 
32
 
33
 
34
############################################################################
35
# General PERL config
36
############################################################################
37
use Getopt::Long;
38
use English;
39
use File::Basename;
40
use Cwd;
41
use XML::LibXML;
42
use lib './tools';
43
use sys::lib;
44
use yp::lib;
45
use Parallel::ForkManager;
46
 
47
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
48
 
49
 
50
############################################################################
51
### Process the options
52
############################################################################
53
Getopt::Long::config("require_order", "prefix=-");
54
GetOptions("h","help",
55
) || die "(use '$program_name -h' for help)";
56
 
57
 
58
 
59
 
60
##############################################################################
61
## Help option
62
##############################################################################
63
if ( $opt_h or $opt_help  )
64
  { print "\n build_sim_master";
65
    print "\n";
66
    exit 1;
67
  }
68
 
69
 
70
my $parser = XML::LibXML->new();
71
 
72
 
73
my $cmd;
74
my @cmds = ();
75
my @cov_cmds = ();
76
my @rep_cmds = ();
77
 
78
 
79
 
80
#/**********************************************************************/
81
#/*  Process each library by finding any ip-xact file in any component */
82
#/*                                                                    */
83
#/*  Each ip-xact file is parsed and it's filename and the names of any*/
84
#/*  modules that it uses are saved.                                   */
85
#/*                                                                    */
86
#/*                                                                    */
87
#/**********************************************************************/
88
 
89
my $home = cwd();
90
 
91
my $prefix   = yp::lib::get_workspace();
92
   $prefix   = "/${prefix}";
93
 
94 133 jt_eaton
my $number_of_cpus   = yp::lib::get_number_of_cpus();
95
 
96 131 jt_eaton
my @vendors = yp::lib::find_vendors();
97
 
98
foreach my $vendor (@vendors)
99
 {
100
 my $vendor_status    =  yp::lib::get_vendor_status($vendor);
101
 if($vendor_status eq "active")
102
   {
103
   my @libraries = yp::lib::find_libraries($vendor);
104
   foreach my $library (@libraries)
105
     {
106
     my $library_status   =  yp::lib::get_library_status($vendor,$library);
107
     if($library_status eq "active")
108
         {
109
         print " $vendor $library \n";
110
         my @components   = yp::lib::find_components($vendor,$library);
111
 
112
         foreach my $component (@components)
113
            {
114
            my $socgen_filename     = yp::lib::find_componentConfiguration($vendor,$library,$component);
115
 
116
            if($socgen_filename)
117
               {
118
               my $socgen_file     = $parser->parse_file($socgen_filename);
119
               my $sim_library_path ;
120
               my $lib_comp_sep             = yp::lib::find_lib_comp_sep($vendor,$library,$component);
121
               my $sim_comp_path            = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:comp_path/text()")->to_literal;
122
 
123
               if ($sim_comp_path)
124
                  {
125
                  $sim_library_path            ="${lib_comp_sep}${sim_comp_path}";
126
                  }
127
               else
128
                  {
129
                  $sim_library_path            = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:library_path/text()")->to_literal;
130
                  }
131
 
132
 
133
               foreach  my   $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:icarus/socgen:test/socgen:name"))
134
                 {
135
                 my($sim_name)     = $i_name ->findnodes('./text()')->to_literal ;
136
                 my($sim_configuration)  = $i_name ->findnodes('../socgen:configuration/text()')->to_literal ;
137
                 my($sim_variant)  = $i_name ->findnodes('../socgen:variant/text()')->to_literal ;
138
                 $cmd ="./tools/simulation/run_icarus  $vendor   $library $sim_library_path $sim_name     $sim_variant \n";
139
                 push @cmds,$cmd;
140
                 }
141
 
142
               foreach  my   $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:verilator/socgen:test/socgen:name"))
143
                 {
144
                 my($sim_name)     = $i_name ->findnodes('./text()')->to_literal ;
145
                 my($sim_configuration)  = $i_name ->findnodes('../socgen:configuration/text()')->to_literal ;
146
                 my($sim_variant)  = $i_name ->findnodes('../socgen:variant/text()')->to_literal ;
147
                 $cmd ="./tools/simulation/run_verilator  $vendor   $library $sim_library_path $sim_name     $sim_variant \n";
148
                 push @cmds,$cmd;
149
                 }
150
 
151
 
152
 
153
               foreach  my   $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:rtl_check/socgen:lint/socgen:name"))
154
                 {
155
                 my($sim_name)           = $i_name ->findnodes('./text()')->to_literal ;
156
                 my($sim_configuration)  = $i_name ->findnodes('../socgen:configuration/text()')->to_literal ;
157
                 my($sim_variant)        = $i_name ->findnodes('../socgen:variant/text()')->to_literal ;
158
                 print "  lint     $sim_name        $sim_configuration   $sim_variant   ";
159 135 jt_eaton
                 $cmd ="./tools/simulation/run_lint  $vendor   $library $sim_library_path $sim_name     $sim_variant \n";
160 131 jt_eaton
                 push @cmds,$cmd;
161
                 }
162
 
163
 
164
 
165
 
166
 
167
               #/*********************************************************************************************/
168
               #/   create coverage database .cdd file                                                       */
169
               #/                                                                                            */
170
               #/*********************************************************************************************/
171
 
172
               foreach  my   $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:testbenches/socgen:testbench/socgen:tools/socgen:tool"))
173
                  {
174
                  my($tb_tool)     = $i_name ->findnodes('./text()')->to_literal ;
175
                  my($tb_variant)  = $i_name ->findnodes('../../socgen:variant/text()')->to_literal ;
176
                  my($tb_version)  = $i_name ->findnodes('../../socgen:version/text()')->to_literal ;
177
                  if($tb_tool eq "coverage")
178
                    {
179
                    print "  COVERAGEs   $tb_tool          $tb_variant  $tb_version \n";
180
                    $cmd= "cd ./${prefix}/${vendor}__${library}${sim_library_path}/cov/${tb_variant};make build_cdd \n";
181
                    push @cmds,$cmd;
182
 
183
                    foreach  my   $i_name ($socgen_file->findnodes("//socgen:test/socgen:variant"))
184
                       {
185
                       my($test_variant)     = $i_name ->findnodes('./text()')->to_literal ;
186
                       my($test_name)        = $i_name ->findnodes('../socgen:name/text()')->to_literal ;
187
 
188
                       if($tb_variant eq $test_variant  )
189
                           {
190
                           print "  $tb_variant  $test_variant $test_name \n";
191
                           $cmd= "cd ./${prefix}/${vendor}__${library}${sim_library_path}/cov/${tb_variant};make score_cov TEST=${test_name} \n";
192
                           push @cov_cmds,$cmd;
193
                           }
194
                       }
195
                    $cmd= "cd ./${prefix}/${vendor}__${library}${sim_library_path}/cov/${tb_variant};make report_cov \n";
196
                    push @rep_cmds,$cmd;
197
                    }
198
                  }
199
 
200
 
201
 
202
 
203
   }
204
 
205
}
206
         }
207
     }
208
   }
209
 }
210
 
211
 
212 133 jt_eaton
my $manager = new Parallel::ForkManager( $number_of_cpus );
213 131 jt_eaton
 
214
     foreach $cmd (@cmds)
215
      {
216
      $manager->start and next;
217
      system($cmd);
218
      $manager->finish;
219
      }
220
 
221
      $manager->wait_all_children;
222
      print "run_sims COMPLETE \n";
223
 
224
 
225
 
226
 
227
 
228
     foreach $cmd (@cov_cmds)
229
      {
230
      $manager->start and next;
231
      system($cmd);
232
      $manager->finish;
233
      }
234
 
235
      $manager->wait_all_children;
236
      print "coverage COMPLETE \n";
237
 
238
 
239
 
240
 
241
     foreach $cmd (@rep_cmds)
242
      {
243
      $manager->start and next;
244
      system($cmd);
245
      $manager->finish;
246
      }
247
 
248
      $manager->wait_all_children;
249
      print "coverage reports COMPLETE \n";
250
 
251
 
252
 
253
 
254
 
255
 

powered by: WebSVN 2.1.0

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