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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [verilog/] [elab_verilog] - 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
# General PERL config
35
############################################################################
36
use Getopt::Long;
37
use English;
38
use File::Basename;
39
use Cwd;
40
use Scalar::Util qw(looks_like_number);
41
use XML::LibXML;
42
use lib './tools';
43
use sys::lib;
44
use yp::lib;
45 134 jt_eaton
use math::lib;
46 131 jt_eaton
use BerkeleyDB;
47
 
48
 
49
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
50
 
51
 
52
############################################################################
53
### Process the options
54
############################################################################
55
Getopt::Long::config("require_order", "prefix=-");
56
GetOptions("h","help",
57
           "envidentifier=s" => \$envidentifier,
58
           "prefix=s" => \$prefix,
59
           "vendor=s" => \$vendor,
60
           "library=s" => \$library,
61
           "component=s" => \$component,
62
           "version=s" => \$version,
63 133 jt_eaton
           "configuration=s" => \$configuration,
64
           "dest_dir=s" => \$dest_dir,
65 131 jt_eaton
           "env=s" => \$env,
66
           "tool=s" => \$tool,
67
           "unit=s" => \$unit,
68
           "name=s" => \$name
69
 
70
) || die "(use '$program_name -h' for help)";
71
 
72
 
73 133 jt_eaton
 
74 131 jt_eaton
##############################################################################
75
## Help option
76
##############################################################################
77
if ( $opt_h  or $opt_help  )
78
  { 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";
79
    exit 1;
80
  }
81
 
82
 
83
 
84
#############################################################################
85
##
86
##
87
#############################################################################
88
 
89
$home = cwd();
90
 
91
unless ($prefix)
92
 {
93
 $prefix   = yp::lib::get_workspace();
94
 $prefix   =  "/${prefix}";
95
 }
96
 
97
 
98 134 jt_eaton
my $comp_xml_sep    = yp::lib::find_comp_xml_sep($vendor,$library,$component,$version);
99
my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$library,$component);
100 131 jt_eaton
 
101 133 jt_eaton
 
102
 
103 134 jt_eaton
my   $variant;
104 133 jt_eaton
 
105 131 jt_eaton
 
106 134 jt_eaton
 
107 131 jt_eaton
unless ($env ) {$env = "none";}
108
unless ($tool ){$tool = "none";}
109
unless ($unit ){$unit = "none";}
110
 
111
 
112
 
113
 
114
 
115 134 jt_eaton
 
116 131 jt_eaton
my $root                =      "root";
117
 
118
if($version)       {$variant   = "${component}_${version}";}
119
else               {$variant   = "${component}";}
120
 
121 134 jt_eaton
#print "./tools/verilog/elab_verilog -envidentifier $envidentifier -prefix $prefix -vendor $vendor -library $library -component $component -version $version -configuration $configuration -dest_dir   $dest_dir -env $env -tool $tool -unit $unit -name  $name  \n";
122 131 jt_eaton
 
123
 
124 134 jt_eaton
 
125
 
126 131 jt_eaton
my $parser = XML::LibXML->new();
127
 
128 134 jt_eaton
my $socgen_filename          = yp::lib::find_componentConfiguration($vendor,$library,$component);
129
unless ($socgen_filename)      { print "No socgen ip file $vendor,$library,$component   \n";};
130 131 jt_eaton
 
131 134 jt_eaton
my $socgen_file              = $parser->parse_file($socgen_filename);
132 131 jt_eaton
 
133
 
134
 
135
 
136 133 jt_eaton
my $path;
137 131 jt_eaton
 
138 134 jt_eaton
my $elab_db_filename;
139 131 jt_eaton
 
140
 
141 134 jt_eaton
if($name)
142
  {
143
  $elab_db_filename = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,$name);
144
  }
145
else
146
  {
147
  $elab_db_filename = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,"default");
148
  }
149 131 jt_eaton
 
150
 
151 134 jt_eaton
if(-e $elab_db_filename)
152
  {
153
  exit;
154
  # "$data_db_file Exists\n";
155
  }
156 131 jt_eaton
 
157 134 jt_eaton
print "ELAB_VERILOG ${vendor}_${library}_${component}_${version}  $env  $tool  $unit || $name || $data_db_file   \n";
158 131 jt_eaton
 
159
 
160 134 jt_eaton
my $elab_db  = new BerkeleyDB::Hash( -Filename => "$elab_db_filename", -Flags => DB_CREATE ) or die "Cannot open $elab_db_filename: $!";
161 131 jt_eaton
 
162 133 jt_eaton
$elab_db->db_put( "component___root" ,"${vendor}:${library}:${component}:${version}"  );
163 131 jt_eaton
 
164 133 jt_eaton
my $repo_data;
165 134 jt_eaton
if(defined $name && length $name >0)
166
{
167
$elab_db->db_get("VLNV___${vendor}:${library}:${component}:${version}:${name}", $repo_data );
168
$elab_db->db_put("VLNV___${vendor}:${library}:${component}:${version}:${name}","${repo_data}${root}:::"     );
169
}
170
else
171
{
172 133 jt_eaton
$elab_db->db_get("VLNV___${vendor}:${library}:${component}:${version}", $repo_data );
173
$elab_db->db_put("VLNV___${vendor}:${library}:${component}:${version}","${repo_data}${root}:::"     );
174 134 jt_eaton
}
175 131 jt_eaton
 
176
 
177
 
178
 
179
 
180
 
181
 
182 134 jt_eaton
my @bro_filelist = yp::lib::parse_component_brothers($vendor,$library,$component,$version);
183 131 jt_eaton
 
184 134 jt_eaton
foreach $bro (@bro_filelist)
185
  {
186
  my $ven;
187
  my $lib;
188
  my $cmp;
189
  my $ver;
190
  my $xxx;
191 131 jt_eaton
 
192
 
193 134 jt_eaton
  ( ${xxx},${ven},${lib},${cmp},${ver}) = split( /::/ , $bro);
194 131 jt_eaton
 
195 134 jt_eaton
#print " $bro  - ${ven} -${lib} -${cmp} -${ver} -${xxx} \n";
196
  my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($ven,$lib,$cmp,$ver));
197
 
198
 
199
my $loc_comp_xml_sep    = yp::lib::find_comp_xml_sep($ven,$lib,$cmp,$ver);
200
my $loc_lib_comp_sep    = yp::lib::find_lib_comp_sep($ven,$lib,$cmp);
201
 
202 135 jt_eaton
  foreach  my   $i_name ($spirit_component_file->findnodes("//ipxact:fileSets/ipxact:fileSet/ipxact:file/ipxact:name"))
203 134 jt_eaton
       {
204
       my($file_name)          = $i_name ->findnodes('./text()')->to_literal ;
205 135 jt_eaton
       my($file_logicalname)   = $i_name ->findnodes('../ipxact:logicalName/text()')->to_literal ;
206
       my($file_type)          = $i_name ->findnodes('../ipxact:fileType/text()')->to_literal ;
207
       my($file_usertype)      = $i_name ->findnodes('../ipxact:userFileType/text()')->to_literal ;
208
       my($fileSet_name)       = $i_name ->findnodes('../../ipxact:name/text()')->to_literal ;
209 134 jt_eaton
 
210
       if(${file_usertype} eq "libraryDir" )
211
       {
212
       $elab_db->db_put( "FILE_${file_type}_${fileSet_name}_${file_usertype}__${file_name}","${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/${file_name}"  );
213
 
214
       }
215
       else
216
 
217
       {
218
       $elab_db->db_put( "FILE_${file_type}_${fileSet_name}_${file_usertype}__${file_name}","${ven}__${lib}${loc_lib_comp_sep}${cmp}${loc_comp_xml_sep}/${file_name}"  );
219
 
220
       }
221
 
222
 
223
       }
224
 
225
 
226
 
227
}
228
 
229
 
230
 
231
 
232
 
233 131 jt_eaton
foreach  my   $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:${env}/socgen:${tool}/socgen:${unit}/socgen:parameters/socgen:parameter"))
234
          {
235
          my($ise_param)             = $socgen_cfg ->findnodes('./socgen:value/text()')->to_literal ;
236
          my($ise_param_name)        = $socgen_cfg ->findnodes('./socgen:name/text()')->to_literal ;
237 133 jt_eaton
          my($ise_new_name   )       = $socgen_cfg ->findnodes('../../socgen:name/text()')->to_literal ;
238 131 jt_eaton
          if($name eq "${ise_new_name}")
239
             {
240
             if($ise_param_name)
241
               {
242
               $elab_db->db_put( "parameter_${root}__${ise_param_name}","${ise_param}"  );
243
               }
244
             }
245 133 jt_eaton
 
246
          if($version eq "${ise_new_name}")
247
             {
248
             if($ise_param_name)
249
               {
250
               $elab_db->db_put( "parameter_${root}__${ise_param_name}","${ise_param}"  );
251
               }
252
             }
253 134 jt_eaton
          }
254 133 jt_eaton
 
255
 
256
 
257 131 jt_eaton
 
258
 
259 133 jt_eaton
     #/**********************************************************************/
260
     #/*                                                                    */
261
     #/* if configuration set then read parameters from socgen:componentConfiguration file      */
262
     #/*                                                                    */
263
     #/**********************************************************************/
264
     if(defined $configuration)
265
        {
266
          foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:configurations/socgen:configuration/socgen:parameters/socgen:parameter/socgen:name"))
267
          {
268
          my($param_name)         = $socgen_cfg->findnodes('./text()')->to_literal ;
269
          my($param_value)        = $socgen_cfg->findnodes('../socgen:value/text()')->to_literal ;
270
          my($config_name)        = $socgen_cfg->findnodes('../../../socgen:name/text()')->to_literal ;
271
          if($config_name eq $configuration  )
272
            {
273
            my $repo_data;
274
            $elab_db->db_get("parameter_${root}__${param_name}", $repo_data );
275
            unless (defined $repo_data)
276
              {
277
              $elab_db->db_put( "parameter_${root}__${param_name}","${param_value}"  );
278
              }
279
            }
280
          }
281
       }
282
 
283
 
284
 
285
 
286 134 jt_eaton
 
287
 
288
 
289
        foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:configurations/socgen:configuration/socgen:version[text() = '$version']/../socgen:parameters/socgen:parameter/socgen:name"))
290
          {
291
          my($param_name)         = $socgen_cfg->findnodes('./text()')->to_literal ;
292
          my($param_value)        = $socgen_cfg->findnodes('../socgen:value/text()')->to_literal ;
293
 
294
            my $repo_data;
295
            $elab_db->db_get("parameter_${root}__${param_name}", $repo_data );
296
            unless (defined $repo_data)
297
              {
298
              $elab_db->db_put( "parameter_${root}__${param_name}","${param_value}"  );
299
              }
300
          }
301
 
302
 
303 131 jt_eaton
foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:${env}/socgen:${tool}/socgen:${unit}/socgen:variant"))
304
     {
305
     my($variant_name)     = $socgen_cfg->findnodes('./text()')->to_literal ;
306 133 jt_eaton
     my $configuration        = $socgen_cfg->findnodes('../socgen:configuration/text()')->to_literal ;
307 131 jt_eaton
     #/**********************************************************************/
308
     #/*                                                                    */
309
     #/* if configuration set then read parameters from socgen:componentConfiguration file      */
310
     #/*                                                                    */
311
     #/**********************************************************************/
312
     if($variant_name eq $variant)
313
        {
314 133 jt_eaton
          foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:configurations/socgen:configuration/socgen:parameters/socgen:parameter/socgen:name"))
315 131 jt_eaton
          {
316
          my($param_name)         = $socgen_cfg->findnodes('./text()')->to_literal ;
317
          my($param_value)        = $socgen_cfg->findnodes('../socgen:value/text()')->to_literal ;
318
          my($config_name)        = $socgen_cfg->findnodes('../../../socgen:name/text()')->to_literal ;
319
          if($config_name eq $configuration  )
320
            {
321
            my $repo_data;
322
            $elab_db->db_get("parameter_${root}__${param_name}", $repo_data );
323 133 jt_eaton
            unless (defined $repo_data)
324 131 jt_eaton
              {
325 133 jt_eaton
              $elab_db->db_put( "parameter_${root}__${param_name}","${param_value}"  );
326 131 jt_eaton
              }
327
            }
328
          }
329 133 jt_eaton
       }
330
    }
331 131 jt_eaton
 
332
 
333
 
334
 
335
 
336
 
337 134 jt_eaton
 
338
 
339
 
340 131 jt_eaton
elaborate( "${root}","${vendor}","${library}","${component}","${version}"  );
341
 
342
my $root                =      "root";
343
 
344
my $key;
345
my $value;
346
 
347
 
348
my @elab_list;
349
 
350
 
351
 
352
 
353
 
354
 
355
 
356
 
357
 
358
 
359
 
360
 
361
 
362
 
363
 
364
 
365
$elab_db->db_close();
366
 
367
 
368
 
369
 
370
 
371
 
372
 
373
 
374
 
375
 
376
 
377
#/*********************************************************************************************/
378
#/                                                                                            */
379
#/  Recursive entry point for all lower levels                                                */
380
#/                                                                                            */
381
#/                                                                                            */
382
#/                                                                                            */
383
#/                                                                                            */
384
#/*********************************************************************************************/
385
 
386
sub elaborate
387
   {
388
   my @params     = @_;
389
   my $elab_version        = pop(@params);
390
   my $elab_component      = pop(@params);
391
   my $elab_library        = pop(@params);
392
   my $elab_vendor         = pop(@params);
393
   my $elab_root           = pop(@params);
394
 
395 134 jt_eaton
 
396
 
397
 
398
 
399
 
400
 
401
 
402
#   print "ELABORATING $elab_root  $elab_vendor $elab_library $elab_component $elab_version \n";
403 131 jt_eaton
   my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($elab_vendor,$elab_library,$elab_component,$elab_version));
404
 
405 134 jt_eaton
    my $io_busses_filename = yp::lib::get_io_busses_db_filename($elab_vendor,$elab_library,$elab_component,$elab_version,"default");
406
    my $comp_io_busses_db  = new BerkeleyDB::Hash( -Filename => "$io_busses_filename", -Flags => DB_CREATE ) or die "Cannot open $io_busses_filename    : $!";
407
    my $cursor = $comp_io_busses_db ->db_cursor() ;
408
    while ($cursor->c_get($key, $value, DB_NEXT) == 0)
409
      {
410
      my $name;
411
      my $sense;
412
      ( ${key_type},${name},${sense}) = split( /\./ , $key);
413
      if($key_type eq "AbsDef")
414
        {
415
#        print "BUS-- ${elab_root}  |||  $name $sense  ===   $value  \n";
416
        my $repo_data;
417
        $elab_db->db_get("businterface_${elab_root}__${name}", $repo_data );
418
        unless (defined $repo_data)
419
            {
420
#            print "BUS--:::  \n";
421
            $elab_db->db_put( "busInterface_${elab_root}__${name}","busInterface:${sense}:${value}"  );
422
            }
423
        }
424
      }
425
    my $status = $cursor->c_close() ;
426
 
427
 
428 131 jt_eaton
   parse_component_file($spirit_component_file,$elab_root);
429
   parse_design_files($spirit_component_file,$elab_root);
430 134 jt_eaton
#   print "Exit $elab_root   \n";
431 131 jt_eaton
   return;
432
}
433
 
434
 
435
 
436
 
437
#/*********************************************************************************************/
438
#/                                                                                            */
439
#/                                                                                            */
440
#/                                                                                            */
441
#/                                                                                            */
442
#/                                                                                            */
443
#/                                                                                            */
444
#/*********************************************************************************************/
445
 
446
 
447
 
448
 
449
sub parse_component_file
450
   {
451
   my @params     = @_;
452
   my $elab_root                 = pop(@params);
453
   my $spirit_component_file      = pop(@params);
454
 
455
 
456
 
457 135 jt_eaton
foreach my $new_comp ($spirit_component_file->findnodes("//ipxact:component/ipxact:vendor"))
458 131 jt_eaton
   {
459
   my($new_vendor)          = $new_comp->findnodes('./text()')->to_literal ;
460 135 jt_eaton
   my($new_library)         = $new_comp->findnodes('../ipxact:library/text()')->to_literal ;
461
   my($new_name)            = $new_comp->findnodes('../ipxact:name/text()')->to_literal ;
462
   my($new_version)         = $new_comp->findnodes('../ipxact:version/text()')->to_literal ;
463 134 jt_eaton
#   print "PARSE component file $elab_root $new_vendor $new_library $new_name    $new_version         \n";
464 131 jt_eaton
 
465
 
466
 
467 134 jt_eaton
  my $parent_socgen_filename              = yp::lib::find_componentConfiguration($new_vendor,$new_library,$new_name);
468 131 jt_eaton
 
469 134 jt_eaton
  if ($parent_socgen_filename)
470 131 jt_eaton
 
471 134 jt_eaton
    {
472
 
473
     my $parent_socgen_file    = $parser->parse_file($parent_socgen_filename);
474
        foreach my $socgen_cfg ($parent_socgen_file->findnodes("//socgen:componentConfiguration/socgen:configurations/socgen:configuration/socgen:version[text() = '$new_version']/../socgen:parameters/socgen:parameter/socgen:name"))
475
          {
476
          my($param_name)         = $socgen_cfg->findnodes('./text()')->to_literal ;
477
          my($param_default)      = $socgen_cfg->findnodes('../socgen:value/text()')->to_literal ;
478
#         print "KKKKKKKK  parameter_${elab_root}__${param_name}   $param_default \n";
479
          my $repo_data;
480
          $elab_db->db_get("parameter_${elab_root}__${param_name}", $repo_data );
481
        unless (defined $repo_data)
482
            {
483
            $elab_db->db_put( "parameter_${elab_root}__${param_name}","${param_default}"  );
484
                }
485
          }
486
     };
487
 
488 131 jt_eaton
     #/**********************************************************************/
489
     #/*                                                                    */
490
     #/* parse parameters and values                                        */
491
     #/*                                                                    */
492
     #/**********************************************************************/
493
 
494 135 jt_eaton
     foreach  my   $i_name ($spirit_component_file->findnodes('//ipxact:model/ipxact:modelParameters/ipxact:modelParameter/ipxact:name'))
495 131 jt_eaton
        {
496
        my($parameter_name)     = $i_name ->to_literal;
497 135 jt_eaton
        my($parameter_default)  = $i_name ->findnodes('../ipxact:value/text()')->to_literal ;
498 131 jt_eaton
        my $repo_data;
499
        $elab_db->db_get("parameter_${elab_root}__${parameter_name}", $repo_data );
500 133 jt_eaton
 
501
 
502
        unless (defined $repo_data)
503 131 jt_eaton
            {
504
            $elab_db->db_put( "parameter_${elab_root}__${parameter_name}","${parameter_default}"  );
505 134 jt_eaton
                }
506 131 jt_eaton
        }
507
    }
508
 
509
 
510
 
511
 
512
 
513
 
514
 
515
 
516
 
517
 
518 135 jt_eaton
foreach my $new_comp ($spirit_component_file->findnodes("//ipxact:component/ipxact:model/ipxact:views/ipxact:view/ipxact:vendorExtensions/ipxact:componentRef"))
519 131 jt_eaton
   {
520 135 jt_eaton
    my($new_vendor)        = $new_comp->findnodes('./@ipxact:vendor')->to_literal ;
521
    my($new_library)       = $new_comp->findnodes('./@ipxact:library')->to_literal ;
522
    my($new_name)          = $new_comp->findnodes('./@ipxact:name')->to_literal ;
523
    my($new_version)       = $new_comp->findnodes('./@ipxact:version')->to_literal ;
524 131 jt_eaton
    if(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version))
525
     {
526
     parse_component_file($parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version)),$elab_root    );
527
     }
528
 
529
   }
530
}
531
 
532
 
533
 
534
 
535
 
536
 
537
#/*********************************************************************************************/
538
#/                                                                                            */
539
#/                                                                                            */
540
#/                                                                                            */
541
#/                                                                                            */
542
#/                                                                                            */
543
#/                                                                                            */
544
#/*********************************************************************************************/
545
 
546
 
547
 
548
 
549
sub parse_design_files
550
   {
551
   my @params     = @_;
552
   my $elab_root    = pop(@params);
553
   my $spirit_component_file      = pop(@params);
554
 
555
 
556
 
557
 
558 135 jt_eaton
  foreach my $new_comp ($spirit_component_file->findnodes("//ipxact:component/ipxact:model/ipxact:views/ipxact:view/ipxact:vendorExtensions/ipxact:componentRef"))
559 131 jt_eaton
    {
560 135 jt_eaton
            my($new_vendor)        = $new_comp->findnodes('./@ipxact:vendor')->to_literal ;
561
            my($new_library)       = $new_comp->findnodes('./@ipxact:library')->to_literal ;
562
            my($new_name)          = $new_comp->findnodes('./@ipxact:name')->to_literal ;
563
            my($new_version)       = $new_comp->findnodes('./@ipxact:version')->to_literal ;
564 134 jt_eaton
#            print "PARSE design files $elab_root $new_vendor $new_library $new_name    $new_version         \n";
565 131 jt_eaton
            parse_design_files($parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version )),$elab_root );
566
   }
567
 
568
 
569
 
570
 
571 135 jt_eaton
  foreach my $new_comp ($spirit_component_file->findnodes("//ipxact:component/ipxact:model/ipxact:views/ipxact:view/ipxact:hierarchyRef"))
572 131 jt_eaton
    {
573 135 jt_eaton
            my($new_vendor)        = $new_comp->findnodes('./@ipxact:vendor')->to_literal ;
574
            my($new_library)       = $new_comp->findnodes('./@ipxact:library')->to_literal ;
575
            my($new_name)          = $new_comp->findnodes('./@ipxact:name')->to_literal ;
576
            my($new_version)       = $new_comp->findnodes('./@ipxact:version')->to_literal ;
577 131 jt_eaton
            if(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version ))
578
              {
579 135 jt_eaton
#              print "FFFFFFF   $new_vendor $new_library $new_name    $new_version   hierarchyRef      \n";
580 131 jt_eaton
              parse_design_file($parser->parse_file(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version )),$elab_root   );
581
              }
582
  }
583
 
584 135 jt_eaton
 
585
   foreach my $new_comp ($spirit_component_file->findnodes("//ipxact:component/ipxact:model/ipxact:views/ipxact:view/ipxact:designInstantiationRef/text()"))
586
     {
587
     my($designInsref_value)         = $new_comp  ->to_literal ;
588
     my($designInsref_name)          = $new_comp  ->findnodes('../../ipxact:name')->to_literal ;
589
 
590
   foreach my $new_comp ($spirit_component_file->findnodes("//ipxact:component/ipxact:model/ipxact:instantiations/ipxact:designInstantiation"))
591
        {
592
        my($t_ref)           = $new_comp->findnodes('./ipxact:name/text()')->to_literal ;
593
        my($t_vendor)        = $new_comp->findnodes('./ipxact:designRef/@vendor')->to_literal ;
594
        my($t_library)       = $new_comp->findnodes('./ipxact:designRef/@library')->to_literal ;
595
        my($t_name)          = $new_comp->findnodes('./ipxact:designRef/@name')->to_literal ;
596
        my($t_version)       = $new_comp->findnodes('./ipxact:designRef/@version')->to_literal ;
597
 
598
 
599
 
600
 
601
        if($t_ref eq $designInsref_name )
602
        {
603
            if(yp::lib::find_ipxact_design($t_vendor,$t_library,$t_name,$t_version ))
604
              {
605
#              print "FFFFFFF   $t_vendor $t_library $t_name    $t_version   designInstantiationRef      \n";
606
              parse_design_file($parser->parse_file(yp::lib::find_ipxact_design($t_vendor,$t_library,$t_name,$t_version )),$elab_root   );
607
              }
608
        }
609
        }
610
     }
611
 
612
 
613
 
614
 
615
 
616
 
617
 
618
 
619 131 jt_eaton
}
620
 
621
 
622
 
623
 
624
 
625
 
626
 
627
 
628
 
629
 
630
 
631
 
632
 
633
 
634
 
635
 
636
 
637
 
638
 
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
sub parse_design_file
668
   {
669
   my @params     = @_;
670
   my $elab_root               = pop(@params);
671
   my $spirit_design_file      = pop(@params);
672
 
673 135 jt_eaton
   foreach my $new_comp ($spirit_design_file->findnodes("//ipxact:design/ipxact:vendor"))
674 131 jt_eaton
     {
675
     my($new_vendor)          = $new_comp->findnodes('./text()')->to_literal ;
676 135 jt_eaton
     my($new_library)         = $new_comp->findnodes('../ipxact:library/text()')->to_literal ;
677
     my($new_name)            = $new_comp->findnodes('../ipxact:name/text()')->to_literal ;
678
     my($new_version)         = $new_comp->findnodes('../ipxact:version/text()')->to_literal ;
679 134 jt_eaton
  #   print "WARNING  $new_vendor $new_library $new_name $new_version  DESIGN \n";
680 131 jt_eaton
 
681 135 jt_eaton
     foreach  my   $x_name ($spirit_design_file->findnodes("//ipxact:design/ipxact:componentInstances/ipxact:componentInstance/ipxact:instanceName"))
682 131 jt_eaton
            {
683
            #/**********************************************************************/
684
            #/*                                                                    */
685
            #/* Lookup VLNV for each instantiated component                        */
686
            #/*                                                                    */
687
            #/**********************************************************************/
688
            my($instance_name)       = $x_name   ->findnodes('./text()')->to_literal ;
689 135 jt_eaton
            my($vendor_name)         = $x_name  ->findnodes('../ipxact:componentRef/@vendor')->to_literal ;
690
            my($library_name)        = $x_name  ->findnodes('../ipxact:componentRef/@library')->to_literal ;
691
            my($component_name)      = $x_name  ->findnodes('../ipxact:componentRef/@name')->to_literal ;
692
            my($version_name)        = $x_name  ->findnodes('../ipxact:componentRef/@version')->to_literal ;
693 134 jt_eaton
       #     print "INSTANCED $instance_name  $vendor_name $library_name $component_name $version_name   \n";
694 131 jt_eaton
            $elab_db->db_put( "component___${elab_root}.${instance_name}","${vendor_name}:${library_name}:${component_name}:${version_name}"  );
695
 
696 133 jt_eaton
            my $repo_data;
697 134 jt_eaton
            if(defined $name && length $name >0)
698
            {
699
            $elab_db->db_get("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}:${name}", $repo_data );
700
            $elab_db->db_put("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}:${name}","${repo_data}${elab_root}.${instance_name}:::");
701
            }
702
            else
703
            {
704 133 jt_eaton
            $elab_db->db_get("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}", $repo_data );
705
            $elab_db->db_put("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}","${repo_data}${elab_root}.${instance_name}:::");
706 134 jt_eaton
            }
707
            my $cmd ="./tools/verilog/elab_verilog -vendor ${vendor_name} -library ${library_name} -component ${component_name} -version ${version_name}\n";
708 133 jt_eaton
 
709 134 jt_eaton
            if(system($cmd)){}
710
 
711
 
712
 
713 131 jt_eaton
            if  ($instance_name)
714
              {
715 135 jt_eaton
            foreach  my   $i_parameter ($spirit_design_file->findnodes("//ipxact:componentInstance[ipxact:instanceName/text() = '$instance_name']/ipxact:configurableElementValues/ipxact:configurableElementValue/\@referenceId"))
716 131 jt_eaton
             {
717
             my($foo_name)       = $i_parameter ->to_literal ;
718
             my($foo_value)      = $i_parameter ->findnodes('../text()')->to_literal ;
719 133 jt_eaton
 
720 134 jt_eaton
             my $fee_value       = $foo_value;
721
             my $p_key;
722
             my $p_value;
723
             my $p_cursor = $elab_db ->db_cursor() ;
724
             while ($p_cursor->c_get($p_key, $p_value, DB_NEXT) == 0)
725
                 {
726
                 $_ = $p_key;
727
                 #   print  "--->  $p_key   $p_value   \n";
728
                 if(/parameter_${elab_root}__(\S+)/)
729
                   {
730
                   if($1 eq $p_value)
731
                     {
732
                     print "DDDDDDDDDDDDDDDDDDDDDDDDDD  $p_key $p_value \n";
733
                     }
734
                   else
735
                    {
736
                   $fee_value   = math::lib::parse($fee_value,$1,$p_value);
737
                    }
738
                   }
739
                 }
740
              my $status = $p_cursor->c_close() ;
741
 
742
 
743
 
744
 
745
 
746
# replace this!!!
747
#  scan for all names in db_get("parameter_${elab_root}__${name}", $repo_data
748
# and substitute $repo_data anywhere in $foo_value
749
# then run $foo_value thru sys/math
750
 
751
 
752 133 jt_eaton
             $_ = $foo_value;
753
             my $t_name;
754
             my $t_op;
755 131 jt_eaton
             my $repo_data;
756 133 jt_eaton
 
757
             if(/(\S+)[+](\S+)/)
758
              {
759
              $t_name = $1;
760
              $t_op   = $2;
761
              $elab_db->db_get("parameter_${elab_root}__${t_name}", $repo_data );
762
              unless  (defined $repo_data)
763
               {
764
               $repo_data = $foo_value ;
765
               }
766
              else
767
               {
768
               $repo_data = $repo_data + $t_op ;
769
               }
770
              }
771
             else
772 134 jt_eaton
 
773
# end replace
774
 
775 133 jt_eaton
              {
776
              $elab_db->db_get("parameter_${elab_root}__${foo_value}", $repo_data );
777
              unless  (defined $repo_data)
778
               {
779
               $repo_data = $foo_value ;
780
               }
781
              }
782
 
783 134 jt_eaton
              $elab_db->db_put( "parameter_${elab_root}.${instance_name}__${foo_name}","${repo_data}"  );
784
              $elab_db->db_put( "Parameter_${elab_root}.${instance_name}__${foo_name}","${foo_value}"  );
785
              $elab_db->db_put( "Xarameter_${elab_root}.${instance_name}__${foo_name}","${fee_value}"  );
786
#             print "PARAMETERE  ${elab_root}.${instance_name}   $foo_name  p_  $repo_data   P_ $foo_value  X_  $fee_value \n";
787 131 jt_eaton
             }
788
 
789
             elaborate( "${elab_root}.${instance_name}","${vendor_name}","${library_name}","${component_name}","${version_name}"  );
790
             }
791
            }
792
      }
793
   }
794
 
795
 
796
 
797
 
798
1

powered by: WebSVN 2.1.0

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