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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [verilog/] [elab_verilog] - Blame information for rev 131

Go to most recent revision | 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
#/*                                                                    */
5
#/*             -------                                                */
6
#/*            /   SOC  \                                              */
7
#/*           /    GEN   \                                             */
8
#/*          /    TOOL    \                                            */
9
#/*          ==============                                            */
10
#/*          |            |                                            */
11
#/*          |____________|                                            */
12
#/*                                                                    */
13
#/*                                                                    */
14
#/*                                                                    */
15
#/*                                                                    */
16
#/*  Author(s):                                                        */
17
#/*      - John Eaton, jt_eaton@opencores.org                          */
18
#/*                                                                    */
19
#/**********************************************************************/
20
#/*                                                                    */
21
#/*    Copyright (C) <2010-2011>                */
22
#/*                                                                    */
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 Scalar::Util qw(looks_like_number);
55
use XML::LibXML;
56
use lib './tools';
57
use sys::lib;
58
use yp::lib;
59
use BerkeleyDB;
60
 
61
 
62
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
63
 
64
 
65
############################################################################
66
### Process the options
67
############################################################################
68
Getopt::Long::config("require_order", "prefix=-");
69
GetOptions("h","help",
70
           "envidentifier=s" => \$envidentifier,
71
           "prefix=s" => \$prefix,
72
           "vendor=s" => \$vendor,
73
           "library=s" => \$library,
74
           "component=s" => \$component,
75
           "version=s" => \$version,
76
           "env=s" => \$env,
77
           "tool=s" => \$tool,
78
           "unit=s" => \$unit,
79
           "name=s" => \$name
80
 
81
) || die "(use '$program_name -h' for help)";
82
 
83
 
84
##############################################################################
85
## Help option
86
##############################################################################
87
if ( $opt_h  or $opt_help  )
88
  { print "\n elab_verilog -envidentifier {sim/syn}  -prefix /work -vendor vendor_name -library library_name  -component component_name  -version version_name -env env -tool tool -unit unit -name name     \n";
89
    exit 1;
90
  }
91
 
92
 
93
 
94
#############################################################################
95
##
96
##
97
#############################################################################
98
 
99
$home = cwd();
100
 
101
unless ($prefix)
102
 {
103
 $prefix   = yp::lib::get_workspace();
104
 $prefix   =  "/${prefix}";
105
 }
106
 
107
 
108
my   $variant;
109
my   $configuration;
110
 
111
my $dest_dir            = "elab";
112
my $destination         = "${component}_${version}";
113
 
114
unless ($env ) {$env = "none";}
115
unless ($tool ){$tool = "none";}
116
unless ($unit ){$unit = "none";}
117
 
118
if($name)
119
  {
120
  $destination   = "${destination}_${name}";
121
  }
122
else
123
  {
124
  $name          = $version;
125
  $destination   = "${destination}";
126
  }
127
 
128
 
129
 
130
 
131
my $root                =      "root";
132
 
133
if($version)       {$variant   = "${component}_${version}";}
134
else               {$variant   = "${component}";}
135
 
136
#print "elab_verilog -prefix $prefix -vendor $vendor -library $library -component $component -version $version -env $env -tool $tool -unit $unit -name $name     \n";
137
 
138
 
139
my $parser = XML::LibXML->new();
140
 
141
 
142
my $socgen_file              = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
143
 
144
unless ($socgen_file)      { print "No socgen ip file   \n";};
145
 
146
 
147
my $comp_xml_sep    = yp::lib::find_comp_xml_sep($vendor,$library,$component,$version);
148
my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$library,$component);
149
 
150
 
151
#print "lib_comp_sep   $lib_comp_sep \n";
152
#print "comp_xml_sep   $comp_xml_sep \n";
153
 
154
 
155
 
156
 
157
my $path  = "${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/../${dest_dir}";
158
 
159
unless( -e $path )
160
        {
161
        print "$path does not exist... creating \n";
162
        my $cmd = "mkdir $path \n";
163
        if(system($cmd)){};
164
        }
165
 
166
 
167
 
168
$data_db_dir  = "${path}/${destination}";
169
 
170
 
171
 
172
 
173
unless(-e  $data_db_dir  )
174
        {
175
        my $cmd = "mkdir  $data_db_dir \n";
176
        if(system($cmd)){};
177
        }
178
 
179
 
180
$data_db_file  = "${path}/${destination}/${root}.db";
181
 
182
 
183
 
184
 
185
if(-e  $data_db_file  )
186
        {
187
        print "$data_db_file  does exist... removing  \n";
188
        my $cmd = "rm  $data_db_file \n";
189
        if(system($cmd)){};
190
        }
191
 
192
 
193
print "ELAB  $data_db_file  \n";
194
 
195
 
196
my $elab_db  = new BerkeleyDB::Hash( -Filename => "$data_db_file", -Flags => DB_CREATE ) or die "Cannot open $data_db_file: $!";
197
$elab_db->db_put( "component_${root}","${vendor}:${library}:${component}:${version}"  );
198
$elab_db->db_put( "component___root" ,"${vendor}:${library}:${component}:${version}"  );
199
 
200
 
201
 
202
foreach  my   $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:${env}/socgen:${tool}/socgen:${unit}/socgen:parameters/socgen:parameter"))
203
          {
204
          my($ise_param)             = $socgen_cfg ->findnodes('./socgen:value/text()')->to_literal ;
205
          my($ise_param_name)        = $socgen_cfg ->findnodes('./socgen:name/text()')->to_literal ;
206
          my($ise_new_name   )    = $socgen_cfg ->findnodes('../../socgen:name/text()')->to_literal ;
207
          if($name eq "${ise_new_name}")
208
             {
209
             if($ise_param_name)
210
               {
211
               $elab_db->db_put( "parameter_${root}__${ise_param_name}","${ise_param}"  );
212
               #print "XXXXXXXA $ise_param_name  $ise_param           $ise_new_name    \n";
213
               }
214
             }
215
          }
216
 
217
 
218
 
219
 
220
foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:${env}/socgen:${tool}/socgen:${unit}/socgen:variant"))
221
     {
222
     my($variant_name)     = $socgen_cfg->findnodes('./text()')->to_literal ;
223
     $configuration        = $socgen_cfg->findnodes('../socgen:configuration/text()')->to_literal ;
224
 
225
     #/**********************************************************************/
226
     #/*                                                                    */
227
     #/* if configuration set then read parameters from socgen:componentConfiguration file      */
228
     #/*                                                                    */
229
     #/**********************************************************************/
230
     if($variant_name eq $variant)
231
        {
232
        #print "XXXXXXXQ $variant_name  configuration $configuration  \n";
233
        foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:configurations/socgen:configuration/socgen:parameters/socgen:parameter/socgen:name"))
234
          {
235
          my($param_name)         = $socgen_cfg->findnodes('./text()')->to_literal ;
236
          my($param_value)        = $socgen_cfg->findnodes('../socgen:value/text()')->to_literal ;
237
          my($config_name)        = $socgen_cfg->findnodes('../../../socgen:name/text()')->to_literal ;
238
          #print "XXXXXXXQQ  $config_name  $param_name $param_value  \n";
239
 
240
 
241
          if($config_name eq $configuration  )
242
            {
243
            my $repo_data;
244
            $elab_db->db_get("parameter_${root}__${param_name}", $repo_data );
245
            unless ($repo_data)
246
              {
247
              #print "XXXXXXXB $param_name ${param_value} \n";
248
              $elab_db->db_put( "parameter_${root}__${param_name}","${param_value}"  );
249
              }
250
            }
251
          }
252
     }
253
}
254
 
255
 
256
 
257
 
258
 
259
 
260
elaborate( "${root}","${vendor}","${library}","${component}","${version}"  );
261
 
262
my $root                =      "root";
263
 
264
my $key;
265
my $value;
266
 
267
 
268
my @elab_list;
269
 
270
my $cursor = $elab_db ->db_cursor() ;
271
while ($cursor->c_get($key, $value, DB_NEXT) == 0)
272
   {
273
   #print "ELAB  $key,   $value  \n";
274
   ( ${key_type},@elab_list) = split( /\./ , $key);
275
 
276
   if(($key_type eq "component___${root}"))
277
      {
278
      #print "Component  $key -- $value @elab_list  \n";
279
      build_hierarchy ($value,"${path}/${destination}",$root,@elab_list);
280
      }
281
   }
282
my $status = $cursor->c_close() ;
283
 
284
 
285
 
286
 
287
$cursor = $elab_db ->db_cursor() ;
288
while ($cursor->c_get($key, $value, DB_NEXT) == 0)
289
   {
290
   $_ = $key;
291
   if(/parameter_${root}(\S+)__(\S+)/)
292
    {
293
    my $xpath = $1;
294
    my $parname = $2;
295
    $xpath =~ s/\./\//g;
296
    my $file_name = "${path}/${destination}/${root}/${xpath}/Index.db";
297
    my $param_db  = new BerkeleyDB::Hash( -Filename => "$file_name", -Flags => DB_CREATE ) or die "Cannot open ${file_name}: $!";
298
       $param_db->db_put( "$key","${value}");
299
       $param_db->db_close();
300
    #print "Parameter $key      ---  ${file_name}   $parname  $value \n";
301
    }
302
   }
303
$status = $cursor->c_close() ;
304
 
305
 
306
 
307
$cursor = $elab_db ->db_cursor() ;
308
while ($cursor->c_get($key, $value, DB_NEXT) == 0)
309
   {
310
   $_ = $key;
311
   if(/busInterface_${root}(\S+)__(\S+)/)
312
    {
313
    my $xpath = $1;
314
    my $parname = $2;
315
    $xpath =~ s/\./\//g;
316
    my $file_name = "${path}/${destination}/${root}/${xpath}/Index.db";
317
    my $param_db  = new BerkeleyDB::Hash( -Filename => "$file_name", -Flags => DB_CREATE ) or die "Cannot open ${file_name}: $!";
318
       $param_db->db_put( "$key","${value}");
319
       $param_db->db_close();
320
    #print "busInterface $key      ---  ${file_name}   $parname  $value \n";
321
    }
322
   }
323
$status = $cursor->c_close() ;
324
 
325
 
326
 
327
 
328
 
329
 
330
 
331
 
332
 
333
 
334
 
335
 
336
 
337
 
338
 
339
$elab_db->db_close();
340
 
341
 
342
 
343
 
344
 
345
 
346
 
347
 
348
 
349
 
350
 
351
#/*********************************************************************************************/
352
#/                                                                                            */
353
#/  Recursive entry point for all lower levels                                                */
354
#/                                                                                            */
355
#/                                                                                            */
356
#/                                                                                            */
357
#/                                                                                            */
358
#/*********************************************************************************************/
359
 
360
sub elaborate
361
   {
362
   my @params     = @_;
363
   my $elab_version        = pop(@params);
364
   my $elab_component      = pop(@params);
365
   my $elab_library        = pop(@params);
366
   my $elab_vendor         = pop(@params);
367
   my $elab_root           = pop(@params);
368
 
369
   my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($elab_vendor,$elab_library,$elab_component,$elab_version));
370
 
371
   #print "ELABORATING $elab_root  $elab_vendor $elab_library $elab_component $elab_version \n";
372
   parse_component_file($spirit_component_file,$elab_root);
373
   parse_design_files($spirit_component_file,$elab_root);
374
   #print "Exit $elab_root   \n";
375
   return;
376
}
377
 
378
 
379
 
380
 
381
#/*********************************************************************************************/
382
#/                                                                                            */
383
#/                                                                                            */
384
#/                                                                                            */
385
#/                                                                                            */
386
#/                                                                                            */
387
#/                                                                                            */
388
#/*********************************************************************************************/
389
 
390
 
391
 
392
 
393
sub parse_component_file
394
   {
395
   my @params     = @_;
396
   my $elab_root                 = pop(@params);
397
   my $spirit_component_file      = pop(@params);
398
 
399
 
400
 
401
foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:vendor"))
402
   {
403
   my($new_vendor)          = $new_comp->findnodes('./text()')->to_literal ;
404
   my($new_library)         = $new_comp->findnodes('../spirit:library/text()')->to_literal ;
405
   my($new_name)            = $new_comp->findnodes('../spirit:name/text()')->to_literal ;
406
   my($new_version)         = $new_comp->findnodes('../spirit:version/text()')->to_literal ;
407
 #  print "PARSE component file $elab_root $new_vendor $new_library $new_name    $new_version         \n";
408
 
409
 
410
 
411
 
412
 
413
     #/**********************************************************************/
414
     #/*                                                                    */
415
     #/* parse parameters and values                                        */
416
     #/*                                                                    */
417
     #/**********************************************************************/
418
 
419
     foreach  my   $i_name ($spirit_component_file->findnodes('//spirit:model/spirit:modelParameters/spirit:modelParameter/spirit:name'))
420
        {
421
        my($parameter_name)     = $i_name ->to_literal;
422
        my($parameter_default)  = $i_name ->findnodes('../spirit:value/text()')->to_literal ;
423
        my $repo_data;
424
        $elab_db->db_get("parameter_${elab_root}__${parameter_name}", $repo_data );
425
        unless ($repo_data)
426
            {
427
            #print "XXXXXXXC $parameter_name ${parameter_default} \n";
428
            $elab_db->db_put( "parameter_${elab_root}__${parameter_name}","${parameter_default}"  );
429
            }
430
        }
431
 
432
 
433
 
434
     #/**********************************************************************/
435
     #/*                                                                    */
436
     #/* parse businterfaces                                                */
437
     #/*                                                                    */
438
     #/**********************************************************************/
439
 
440
 
441
    my $main_module_name = yp::lib::get_module_name($new_vendor,$new_library,$new_name,$new_version);
442
 
443
    if($main_module_name)
444
    {
445
    my $io_busses_filename = yp::lib::get_io_busses_db_filename($new_vendor,$new_library,$new_name,$new_version);
446
    $comp_io_busses_db  = new BerkeleyDB::Hash( -Filename => "$io_busses_filename", -Flags => DB_CREATE ) or die "Cannot open $io_busses_filename    : $!";
447
    my $cursor = $comp_io_busses_db ->db_cursor() ;
448
    while ($cursor->c_get($key, $value, DB_NEXT) == 0)
449
      {
450
      ( ${key_type},${name},${sense}) = split( /\./ , $key);
451
      if($key_type eq "AbsDef")
452
        {
453
#        print "BUS-- ${elab_root}  |||  $name $sense  ===   $value  \n";
454
        my $repo_data;
455
        $elab_db->db_get("businterface_${elab_root}__${name}", $repo_data );
456
        unless ($repo_data)
457
            {
458
#            print "BUS--:::  \n";
459
            $elab_db->db_put( "busInterface_${elab_root}__${name}","busInterface:${sense}:${value}"  );
460
            }
461
        }
462
      }
463
    my $status = $cursor->c_close() ;
464
    }
465
 
466
 
467
 
468
 
469
 
470
        }
471
 
472
 
473
 
474
 
475
 
476
 
477
 
478
 
479
foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
480
   {
481
    my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
482
    my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
483
    my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
484
    my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
485
    if(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version))
486
     {
487
     parse_component_file($parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version)),$elab_root    );
488
     }
489
 
490
   }
491
}
492
 
493
 
494
 
495
 
496
 
497
 
498
#/*********************************************************************************************/
499
#/                                                                                            */
500
#/                                                                                            */
501
#/                                                                                            */
502
#/                                                                                            */
503
#/                                                                                            */
504
#/                                                                                            */
505
#/*********************************************************************************************/
506
 
507
 
508
 
509
 
510
sub parse_design_files
511
   {
512
   my @params     = @_;
513
   my $elab_root    = pop(@params);
514
   my $spirit_component_file      = pop(@params);
515
 
516
 
517
 
518
 
519
  foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
520
    {
521
            my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
522
            my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
523
            my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
524
            my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
525
            #print "PARSE design files $elab_root $new_vendor $new_library $new_name    $new_version         \n";
526
            parse_design_files($parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version )),$elab_root );
527
   }
528
 
529
 
530
 
531
 
532
  foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:hierarchyRef"))
533
    {
534
            my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
535
            my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
536
            my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
537
            my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
538
            if(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version ))
539
              {
540
              #print "PARSE DESIGN file $elab_root $new_vendor $new_library $new_name    $new_version         \n";
541
              parse_design_file($parser->parse_file(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version )),$elab_root   );
542
              }
543
  }
544
 
545
}
546
 
547
 
548
 
549
 
550
 
551
 
552
 
553
 
554
 
555
 
556
 
557
 
558
 
559
 
560
 
561
 
562
 
563
 
564
 
565
 
566
 
567
 
568
 
569
 
570
 
571
 
572
 
573
 
574
 
575
 
576
 
577
 
578
 
579
 
580
 
581
#/*********************************************************************************************/
582
#/                                                                                            */
583
#/                                                                                            */
584
#/                                                                                            */
585
#/                                                                                            */
586
#/                                                                                            */
587
#/                                                                                            */
588
#/*********************************************************************************************/
589
 
590
 
591
 
592
 
593
sub parse_design_file
594
   {
595
   my @params     = @_;
596
   my $elab_root               = pop(@params);
597
   my $spirit_design_file      = pop(@params);
598
 
599
   foreach my $new_comp ($spirit_design_file->findnodes("//spirit:design/spirit:vendor"))
600
     {
601
     my($new_vendor)          = $new_comp->findnodes('./text()')->to_literal ;
602
     my($new_library)         = $new_comp->findnodes('../spirit:library/text()')->to_literal ;
603
     my($new_name)            = $new_comp->findnodes('../spirit:name/text()')->to_literal ;
604
     my($new_version)         = $new_comp->findnodes('../spirit:version/text()')->to_literal ;
605
     #print "WARNING  $new_vendor $new_library $new_name $new_version  DESIGN \n";
606
 
607
     foreach  my   $x_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName"))
608
            {
609
            #/**********************************************************************/
610
            #/*                                                                    */
611
            #/* Lookup VLNV for each instantiated component                        */
612
            #/*                                                                    */
613
            #/**********************************************************************/
614
            my($instance_name)       = $x_name   ->findnodes('./text()')->to_literal ;
615
            my($vendor_name)         = $x_name  ->findnodes('../spirit:componentRef/@spirit:vendor')->to_literal ;
616
            my($library_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:library')->to_literal ;
617
            my($component_name)      = $x_name  ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
618
            my($version_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
619
            #print "INSTANCED $instance_name  $vendor_name $library_name $component_name $version_name   \n";
620
            $elab_db->db_put( "component___${elab_root}.${instance_name}","${vendor_name}:${library_name}:${component_name}:${version_name}"  );
621
 
622
            if  ($instance_name)
623
              {
624
 
625
 
626
 
627
            foreach  my   $i_parameter ($spirit_design_file->findnodes("//spirit:componentInstance[spirit:instanceName/text() = '$instance_name']/spirit:configurableElementValues/spirit:configurableElementValue/\@spirit:referenceId"))
628
             {
629
             my($foo_name)       = $i_parameter ->to_literal ;
630
             my($foo_value)      = $i_parameter ->findnodes('../text()')->to_literal ;
631
             my $repo_data;
632
             $elab_db->db_get("parameter_${elab_root}__${foo_value}", $repo_data );
633
             unless ($repo_data) {$repo_data = $foo_value};
634
             #print "PARAMETERE  $foo_name  $foo_value  $repo_data  \n";
635
             $elab_db->db_put( "parameter_${elab_root}.${instance_name}__${foo_name}","${repo_data}"  );
636
             }
637
 
638
             elaborate( "${elab_root}.${instance_name}","${vendor_name}","${library_name}","${component_name}","${version_name}"  );
639
 
640
             }
641
 
642
 
643
            }
644
      }
645
   }
646
 
647
 
648
 
649
 
650
 
651
 
652
 
653
 
654
 
655
 
656
 
657
 
658
 
659
 
660
 
661
 
662
 
663
 
664
 
665
 
666
 
667
 
668
 
669
 
670
 
671
 
672
 
673
 
674
 
675
 
676
 
677
 
678
 
679
 
680
 
681
 
682
 
683
 
684
 
685
 
686
 
687
 
688
#/*********************************************************************************************/
689
#/                                                                                            */
690
#/                                                                                            */
691
#/                                                                                            */
692
#/                                                                                            */
693
#/                                                                                            */
694
#/                                                                                            */
695
#/*********************************************************************************************/
696
 
697
sub build_hierarchy
698
   {
699
   my @params     = @_;
700
   my $vlnv       = shift(@params);
701
   my $path       = shift(@params);
702
   my $root       = shift(@params);
703
   my $top        = shift(@params);
704
   my $new_elab_db ;
705
   my $new_elab_db_file_name ;
706
 
707
 
708
 
709
   #print "Hier  $path \nHier- $root       $top    --- @params  \n";
710
   $path ="${path}/${root}";
711
   unless(-e $path)
712
     {
713
     $cmd ="mkdir ${path} \n";
714
     if(system($cmd)){}
715
     #print "Create Dir  ${path} \n";
716
     }
717
 
718
   unless (-e "${path}/${top}")
719
     {
720
     $cmd ="mkdir ${path}/${top} \n";
721
     if(system($cmd)){}
722
     }
723
 
724
   $new_elab_db_file_name  = "${path}/${top}/Index.db";
725
 
726
   if(@params)
727
     {
728
     build_hierarchy ("$vlnv","${path}","${top}",@params);
729
     }
730
   else
731
     {
732
     #print "CREATE $new_elab_db_file_name  \n";
733
     $new_elab_db  = new BerkeleyDB::Hash( -Filename => "$new_elab_db_file_name", -Flags => DB_CREATE ) or die "Cannot open $new_elab_db_file_name    : $!";
734
     $new_elab_db->db_put( "VLNV","${vlnv}"  );
735
#     print "VLNV  $vlnv \nVLNV -> $new_elab_db_file_name  \n";
736
     }
737
 
738
   return(0);
739
 
740
   }
741
 
742
 
743
 
744
 
745
1

powered by: WebSVN 2.1.0

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