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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [sys/] [build_elab_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
 
4 135 jt_eaton
#/****************************************************************************/
5
#/*                                                                          */
6
#/*   SOCGEN Design for Reuse toolset                                        */
7
#/*                                                                          */
8
#/*   Version 1.0.0                                                          */
9
#/*                                                                          */
10
#/*   Author(s):                                                             */
11
#/*      - John Eaton, z3qmtr45@gmail.com                                    */
12
#/*                                                                          */
13
#/****************************************************************************/
14
#/*                                                                          */
15
#/*                                                                          */
16
#/*             Copyright 2016 John T Eaton                                  */
17
#/*                                                                          */
18
#/* Licensed under the Apache License, Version 2.0 (the "License");          */
19
#/* you may not use this file except in compliance with the License.         */
20
#/* You may obtain a copy of the License at                                  */
21
#/*                                                                          */
22
#/*    http://www.apache.org/licenses/LICENSE-2.0                            */
23
#/*                                                                          */
24
#/* Unless required by applicable law or agreed to in writing, software      */
25
#/* distributed under the License is distributed on an "AS IS" BASIS,        */
26
#/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
27
#/* See the License for the specific language governing permissions and      */
28
#/* limitations under the License.                                           */
29
#/*                                                                          */
30
#/*                                                                          */
31
#/****************************************************************************/
32 131 jt_eaton
 
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 134 jt_eaton
use BerkeleyDB;
46 133 jt_eaton
use Parallel::ForkManager;
47 131 jt_eaton
 
48
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
49
 
50
 
51
############################################################################
52
### Process the options
53
############################################################################
54
Getopt::Long::config("require_order", "prefix=-");
55
GetOptions("h","help",
56
) || die "(use '$program_name -h' for help)";
57
 
58
 
59
 
60
 
61
##############################################################################
62
## Help option
63
##############################################################################
64
if ( $opt_h or $opt_help  )
65 133 jt_eaton
  { print "\n build_elab_master";
66 131 jt_eaton
    print "\n";
67
    exit 1;
68
  }
69
 
70
 
71
my $parser = XML::LibXML->new();
72
 
73
 
74
 
75
 
76
#/**********************************************************************/
77
#/*  Process each library by finding any ip-xact file in any component */
78
#/*                                                                    */
79
#/*  Each ip-xact file is parsed and it's filename and the names of any*/
80
#/*  modules that it uses are saved.                                   */
81
#/*                                                                    */
82
#/*                                                                    */
83
#/**********************************************************************/
84
 
85 133 jt_eaton
my @elab_cmds = ();
86
my @des_cmds = ();
87
my @gen_cmds = ();
88 134 jt_eaton
my @top_levels =();
89
my @children =();
90 133 jt_eaton
 
91 134 jt_eaton
 
92
print "Build_elab_master \n";
93
 
94 133 jt_eaton
my $number_of_cpus   = yp::lib::get_number_of_cpus();
95
 
96 131 jt_eaton
my $home = cwd();
97
 
98
my $prefix   = yp::lib::get_workspace();
99
   $prefix   = "/${prefix}";
100
 
101
my @vendors = yp::lib::find_vendors();
102
 
103
foreach my $vendor (@vendors)
104
 {
105
 
106
 my $vendor_status    =  yp::lib::get_vendor_status($vendor);
107
 if($vendor_status eq "active")
108
   {
109
   my @libraries = yp::lib::find_libraries($vendor);
110
   foreach my $library (@libraries)
111
     {
112
 
113
     my $library_status   =  yp::lib::get_library_status($vendor,$library);
114
     if($library_status eq "active")
115
         {
116
 
117
 
118
 
119
 
120
 
121 134 jt_eaton
 
122 131 jt_eaton
my @components   = yp::lib::find_components($vendor,$library);
123
 
124
foreach my $component (@components)
125
   {
126
   my $socgen_filename     = yp::lib::find_componentConfiguration($vendor,$library,$component);
127
   if($socgen_filename)
128
   {
129
   my $socgen_file     = $parser->parse_file($socgen_filename);
130
 
131 133 jt_eaton
 
132 134 jt_eaton
 
133 131 jt_eaton
   #/*********************************************************************************************/
134 133 jt_eaton
   #/   elaborate  each testbench                                                                */
135 131 jt_eaton
   #/                                                                                            */
136
   #/*********************************************************************************************/
137
 
138 133 jt_eaton
   foreach  my   $j_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:testbenches/socgen:testbench/socgen:variant"))
139
      {
140 134 jt_eaton
 
141 133 jt_eaton
      my $testbench_variant            = $j_name ->findnodes('./text()')->to_literal ;
142
      my $testbench_version            = $j_name ->findnodes('../socgen:version/text()')->to_literal ;
143 134 jt_eaton
      my $testbench_config             = $j_name ->findnodes('../socgen:configuration/text()')->to_literal ;
144 133 jt_eaton
      my $testbench_instance           = $j_name ->findnodes('../socgen:bus/socgen:instance/text()')->to_literal ;
145
      my $testbench_bus_name           = $j_name ->findnodes('../socgen:bus/socgen:bus_name/text()')->to_literal ;
146
 
147
 
148 134 jt_eaton
if(defined $testbench_config   && length $testbench_config > 0)
149 133 jt_eaton
{
150 134 jt_eaton
$cmd ="./tools/verilog/elab_verilog  -vendor ${vendor} -library ${library} -component   ${component}  -version ${testbench_version} -configuration ${testbench_config}  \n";
151 133 jt_eaton
}
152
else
153
{
154 134 jt_eaton
$cmd ="./tools/verilog/elab_verilog  -vendor ${vendor} -library ${library} -component   ${component}  -version ${testbench_version}   \n";
155 133 jt_eaton
}
156
 
157 134 jt_eaton
 
158 133 jt_eaton
       push @elab_cmds, $cmd;
159
 
160
$cmd ="./tools/verilog/gen_root   -vendor ${vendor}  -library ${library}  -component ${component} -version ${testbench_version}  \n  ";
161
       push @gen_cmds, $cmd;
162
 
163
$cmd ="./tools/verilog/gen_design   -vendor ${vendor}  -library ${library}  -component ${component} -version ${testbench_version} \n    ";
164
       push @des_cmds, $cmd;
165
 
166
    if  ($testbench_instance)
167
         {
168
$cmd ="./tools/verilog/trace_bus -prefix  ${prefix}  -vendor ${vendor}  -library ${library}  -component ${component} -version ${testbench_version}  -path $testbench_instance  -bus_name $testbench_bus_name  ";
169
 
170
       push @gen_cmds, $cmd;
171
         }
172
      }
173
 
174
 
175
 
176
 
177
 
178
 
179
   #/*********************************************************************************************/
180
   #/   elaborate for each test                                                                  */
181
   #/                                                                                            */
182
   #/*********************************************************************************************/
183
 
184 131 jt_eaton
   foreach  my   $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:icarus/socgen:test/socgen:name"))
185
      {
186
      my $test_name            = $i_name ->findnodes('./text()')->to_literal ;
187
      my $test_variant          = $i_name ->findnodes('../socgen:variant/text()')->to_literal ;
188
 
189
#      print "XXXX $vendor $library $component  $test_variant   $test_name  \n ";
190
 
191
 
192
   foreach  my   $j_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:testbenches/socgen:testbench/socgen:variant"))
193
      {
194
      my $testbench_variant            = $j_name ->findnodes('./text()')->to_literal ;
195 133 jt_eaton
      my $testbench_version            = $j_name ->findnodes('../socgen:version/text()')->to_literal ;
196
      my $testbench_instance           = $j_name ->findnodes('../socgen:bus/socgen:instance/text()')->to_literal ;
197
      my $testbench_bus_name           = $j_name ->findnodes('../socgen:bus/socgen:bus_name/text()')->to_literal ;
198 131 jt_eaton
 
199
 
200
      if($test_variant eq $testbench_variant )
201
       {
202
#       print "YYYY $prefix  $vendor $library $component   $testbench_version  $test_name   \n ";
203
 
204 133 jt_eaton
#print "ELAB_XXXXX  test_variant  $vendor $library \n";
205 131 jt_eaton
 
206 134 jt_eaton
push @top_levels,  "${vendor}::${library}::${component}::${testbench_version}::${test_name}";
207 133 jt_eaton
 
208 134 jt_eaton
$cmd ="./tools/verilog/elab_verilog  -vendor ${vendor} -library ${library} -component   ${component}  -version ${testbench_version}  -env sim -tool icarus -unit test -name  $test_name  \n";
209
 
210 133 jt_eaton
       push @elab_cmds, $cmd;
211
 
212
 
213
 
214
$cmd ="./tools/verilog/gen_root   -vendor ${vendor} -library ${library} -component   ${component}  -version ${testbench_version}  -name  $test_name  \n";
215 134 jt_eaton
 
216 133 jt_eaton
       push @gen_cmds, $cmd;
217
 
218
$cmd ="./tools/verilog/gen_design   -vendor ${vendor} -library ${library} -component   ${component}  -version ${testbench_version}  -name  $test_name  \n";
219 134 jt_eaton
 
220 133 jt_eaton
       push @des_cmds, $cmd;
221
 
222
 
223
 
224
 
225 131 jt_eaton
    if  ($testbench_instance)
226
         {
227
 
228 133 jt_eaton
$cmd ="./tools/verilog/trace_bus -prefix  ${prefix}  -vendor ${vendor}  -library ${library}  -component ${component} -version ${testbench_version}  -path $testbench_instance  -bus_name $testbench_bus_name  -test_name  $test_name ";
229 131 jt_eaton
 
230 133 jt_eaton
       push @gen_cmds, $cmd;
231 131 jt_eaton
         }
232 133 jt_eaton
       }
233 131 jt_eaton
 
234 133 jt_eaton
      }
235
      }
236 131 jt_eaton
 
237 133 jt_eaton
 
238
 
239
 
240
 
241
 
242
 
243
 
244
   #/*********************************************************************************************/
245
   #/   elaborate for each chip                                                                  */
246
   #/                                                                                            */
247
   #/*********************************************************************************************/
248 131 jt_eaton
 
249 135 jt_eaton
   foreach  my   $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:syn/socgen:fpgas/socgen:fpga/socgen:name"))
250 133 jt_eaton
      {
251
      my $chip_name            = $i_name ->findnodes('./text()')->to_literal ;
252
      my $chip_variant          = $i_name ->findnodes('../socgen:variant/text()')->to_literal ;
253 131 jt_eaton
 
254 133 jt_eaton
#      print "XXXX $vendor $library $component  $chip_variant   $chip_name  \n ";
255 131 jt_eaton
 
256
 
257 133 jt_eaton
   foreach  my   $j_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:syn/socgen:fpgas/socgen:fpga/socgen:variant"))
258
      {
259
      my $fpga_variant            = $j_name ->findnodes('./text()')->to_literal ;
260
      my $fpga_version                 = $j_name ->findnodes('../socgen:version/text()')->to_literal ;
261
 
262
 
263
      if($chip_variant eq $fpga_variant )
264
       {
265
#       print "YYYY $prefix  $vendor $library $component   $fpga_version  $chip_name   \n ";
266
 
267
#print "ELAB_XXXXX  test_variant  $vendor $library \n";
268
 
269 134 jt_eaton
push @top_levels,  "${vendor}::${library}::${component}::${fpga_version}::${chip_name}";
270 133 jt_eaton
$cmd ="./tools/verilog/elab_verilog  -vendor ${vendor} -library ${library} -component   ${component}  -version ${fpga_version}  -env syn -tool ise -unit chip -name $chip_name  \n";
271
 
272
        push @elab_cmds, $cmd;
273
 
274
 
275
 
276
$cmd ="./tools/verilog/gen_root   -vendor ${vendor} -library ${library} -component   ${component}  -version ${fpga_version}  -name  $chip_name  \n";
277
 
278
       push @gen_cmds, $cmd;
279
 
280
$cmd ="./tools/verilog/gen_design   -vendor ${vendor} -library ${library} -component   ${component}  -version ${fpga_version}  -name  $chip_name  \n";
281
 
282
       push @des_cmds, $cmd;
283 134 jt_eaton
       }
284 133 jt_eaton
 
285 134 jt_eaton
      }
286
      }
287 133 jt_eaton
 
288
 
289
 
290
 
291 134 jt_eaton
 
292
 
293
 
294
 
295
   #/*********************************************************************************************/
296
   #/   elaborate for each rtlcheck                                                              */
297
   #/                                                                                            */
298
   #/*********************************************************************************************/
299
 
300
   foreach  my   $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:rtl_check/socgen:lint/socgen:name"))
301
      {
302
      my $lint_name            = $i_name ->findnodes('./text()')->to_literal ;
303
      my $lint_variant          = $i_name ->findnodes('../socgen:variant/text()')->to_literal ;
304
 
305
   foreach  my   $j_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:testbenches/socgen:testbench/socgen:variant"))
306
      {
307
      my $testbench_variant            = $j_name ->findnodes('./text()')->to_literal ;
308
      my $testbench_version                 = $j_name ->findnodes('../socgen:version/text()')->to_literal ;
309
 
310
      if($lint_variant eq $testbench_variant )
311
       {
312
       $cmd ="./tools/verilog/elab_verilog  -vendor ${vendor} -library ${library} -component   ${component}  -version ${testbench_version}  -env sim -tool rtl_check -unit lint -name $lint_name  \n";
313
        push @elab_cmds, $cmd;
314 133 jt_eaton
       }
315
 
316 131 jt_eaton
      }
317 133 jt_eaton
      }
318 131 jt_eaton
 
319 133 jt_eaton
 
320 134 jt_eaton
  #/**********************************************************************************************/
321
   #/   elaborate for each top module                                                            */
322
   #/                                                                                            */
323
   #/*********************************************************************************************/
324 133 jt_eaton
 
325 134 jt_eaton
   foreach  my   $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:configurations/socgen:configuration/socgen:version"))
326
      {
327
      my $version_name          = $i_name ->findnodes('./text()')->to_literal ;
328
      my $configuration         = $i_name ->findnodes('../socgen:name/text()')->to_literal ;
329
$cmd ="./tools/verilog/elab_verilog  -vendor ${vendor} -library ${library} -component   ${component}  -version ${version_name} -configuration ${configuration}\n";
330
        push @elab_cmds, $cmd;
331
      }
332 133 jt_eaton
 
333
 
334 134 jt_eaton
}
335 133 jt_eaton
 
336
 
337
 
338 134 jt_eaton
}
339 133 jt_eaton
 
340
 
341
 
342
 
343 134 jt_eaton
         }
344
     }
345
   }
346
 }
347 133 jt_eaton
 
348
 
349
 
350
 
351
 
352 134 jt_eaton
@elab_cmds      = sys::lib::trim_sort(@elab_cmds);
353 133 jt_eaton
 
354 134 jt_eaton
print "Start elab_cmds \n";
355 133 jt_eaton
 
356 134 jt_eaton
foreach $cmd (@elab_cmds)
357
 {
358 133 jt_eaton
 
359 134 jt_eaton
# $manager->start and next;
360
#print "$cmd";
361
  if (system($cmd)) {}
362
# $manager->finish;
363
 }
364 133 jt_eaton
 
365
 
366 134 jt_eaton
print "End elab_cmds \n";
367 133 jt_eaton
 
368
 
369
 
370
 
371
 
372
 
373
 
374
 
375
 
376
 
377 131 jt_eaton
 
378 133 jt_eaton
 
379 134 jt_eaton
@top_levels     = sys::lib::trim_sort(@top_levels);
380
 
381
 
382
foreach $level (@top_levels)
383
 {
384
 
385
 ( $ven,$lib,$cmp,$ver,$nam) = split( /\::/ , $level);
386
 
387
 my $elab_db_filename = yp::lib::get_elab_db_filename($ven,$lib,$cmp,$ver,"default");
388
 
389
 my $elab_db  = new BerkeleyDB::Hash( -Filename => "$elab_db_filename", -Flags => DB_CREATE ) or die "Cannot open $elab_db_filename: $!";
390
 
391
 my $key;
392
 my $value;
393
 
394
 $cursor = $elab_db ->db_cursor() ;
395
 while ($cursor->c_get($key, $value, DB_NEXT) == 0)
396
   {
397
 
398
#   print "$key \n";
399
my $VLNV;
400
my $vlnv;
401
 
402
 
403
   ( ${VLNV},${vlnv}) = split( /___root./ , $key);
404
   if($VLNV eq "component")
405
     {
406
     if($vlnv)
407
       {
408
       push @children,$value;
409
 
410
       }
411
     }
412 131 jt_eaton
}
413 134 jt_eaton
}
414 131 jt_eaton
 
415 134 jt_eaton
@children     = sys::lib::trim_sort(@children);
416 131 jt_eaton
 
417 134 jt_eaton
foreach my $child (@children)
418
 {
419
 my $ven;
420
 my $lib;
421
 my $cmp;
422
 my $ver;
423
 ( ${ven},${lib},${cmp},${ver}) = split( /:/ , $child);
424 131 jt_eaton
 
425 134 jt_eaton
 
426
 
427
 my $child_filename     = yp::lib::find_componentConfiguration($ven,$lib,$cmp);
428
 if($child_filename)
429
    {
430
    my $socgen_file     = $parser->parse_file($child_filename);
431
    foreach  my   $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:configurations/socgen:configuration/socgen:version"))
432
      {
433
      my $version_name          = $i_name ->findnodes('./text()')->to_literal ;
434
      my $configuration         = $i_name ->findnodes('../socgen:name/text()')->to_literal ;
435
      $cmd ="./tools/verilog/elab_verilog  -vendor ${ven} -library ${lib} -component   ${cmp}  -version ${version_name} -configuration ${configuration}\n";
436
 
437
      if (system($cmd)) {}
438
      }
439
    }
440
 }
441
 
442
 
443
 
444
 
445
 
446
 
447
 
448
 
449 133 jt_eaton
@des_cmds       = sys::lib::trim_sort(@des_cmds);
450
@gen_cmds       = sys::lib::trim_sort(@gen_cmds);
451 131 jt_eaton
 
452 133 jt_eaton
 
453 134 jt_eaton
#print "Execute cmds \n";
454 133 jt_eaton
 
455 134 jt_eaton
my $manager = new Parallel::ForkManager( $number_of_cpus );
456 133 jt_eaton
 
457
 
458
 
459
 
460
#$manager->wait_all_children;
461
 
462
 
463 134 jt_eaton
 
464
 
465
 
466
 
467
 
468 133 jt_eaton
foreach $cmd (@des_cmds)
469
 {
470
      if (system($cmd)) {}
471
 }
472
 
473 134 jt_eaton
print "End des_cmds \n";
474 133 jt_eaton
 
475
foreach $cmd (@gen_cmds)
476
 {
477
# $manager->start and next;
478 134 jt_eaton
  if (system($cmd)) {}
479 133 jt_eaton
# $manager->finish;
480
 }
481
 
482
#$manager->wait_all_children;
483
 
484 134 jt_eaton
print "End All \n";
485 133 jt_eaton
 
486
 
487
 
488
 
489
 
490
 
491
 
492 134 jt_eaton
 
493
 
494
 
495
 
496
 
497
 
498
 
499
 

powered by: WebSVN 2.1.0

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