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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [yp/] [lib.pm] - Blame information for rev 133

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

Line No. Rev Author Line
1 117 jt_eaton
#/**********************************************************************/
2
#/*                                                                    */
3
#/*             -------                                                */
4
#/*            /   SOC  \                                              */
5
#/*           /    GEN   \                                             */
6
#/*          /    TOOL    \                                            */
7
#/*          ==============                                            */
8
#/*          |            |                                            */
9
#/*          |____________|                                            */
10
#/*                                                                    */
11
#/*                                                                    */
12
#/*                                                                    */
13
#/*  Author(s):                                                        */
14
#/*      - John Eaton, jt_eaton@opencores.org                          */
15
#/*                                                                    */
16
#/**********************************************************************/
17
#/*                                                                    */
18
#/*    Copyright (C) <2010-2011>  <Ouabache Design Works>              */
19
#/*                                                                    */
20
#/*  This source file may be used and distributed without              */
21
#/*  restriction provided that this copyright statement is not         */
22
#/*  removed from the file and that any derivative work contains       */
23
#/*  the original copyright notice and the associated disclaimer.      */
24
#/*                                                                    */
25
#/*  This source file is free software; you can redistribute it        */
26
#/*  and/or modify it under the terms of the GNU Lesser General        */
27
#/*  Public License as published by the Free Software Foundation;      */
28
#/*  either version 2.1 of the License, or (at your option) any        */
29
#/*  later version.                                                    */
30
#/*                                                                    */
31
#/*  This source is distributed in the hope that it will be            */
32
#/*  useful, but WITHOUT ANY WARRANTY; without even the implied        */
33
#/*  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR           */
34
#/*  PURPOSE.  See the GNU Lesser General Public License for more      */
35
#/*  details.                                                          */
36
#/*                                                                    */
37
#/*  You should have received a copy of the GNU Lesser General         */
38
#/*  Public License along with this source; if not, download it        */
39
#/*  from http://www.opencores.org/lgpl.shtml                          */
40
#/*                                                                    */
41
#/**********************************************************************/
42
 
43
 
44
 
45
 
46
 
47
 
48
use strict;
49
 
50
package yp::lib;
51
 
52
 
53 130 jt_eaton
############################################################################
54 131 jt_eaton
# General PERL config
55 130 jt_eaton
############################################################################
56 131 jt_eaton
use Getopt::Long;
57
use English;
58
use File::Basename;
59
use Cwd;
60
use XML::LibXML;
61
use lib './tools';
62
use sys::lib;
63 130 jt_eaton
use BerkeleyDB;
64
 
65
 
66 131 jt_eaton
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
67 130 jt_eaton
 
68
 
69
 
70
 
71 131 jt_eaton
 
72
 
73
my $home         = cwd();
74
 
75
 
76
my $parser = XML::LibXML->new();
77
 
78
 
79
 
80
my    $workspace_xml    = $parser->parse_file("${home}/workspace.xml");
81
my @repos =();
82
my $repo;
83
 
84
 
85
foreach my $repo ($workspace_xml->findnodes('//socgen:workspace/socgen:repos/socgen:repo'))
86
                  {
87
                  my $repo_name  = $repo->findnodes('./socgen:name/text()')->to_literal ;
88
                  push  @repos,$repo_name;
89
                  }
90
 
91
 
92
 
93
 
94
 
95
 
96
 
97
my $number_of_cpus;
98
my $workspace;
99
my $yellow_pages;
100
my $io_ports;
101
my $doc_dir;
102
 
103
 
104
foreach my $repo ($workspace_xml->findnodes('//socgen:workspace'))
105
                  {
106
                  $number_of_cpus  = $repo->findnodes('./socgen:number_of_cpus/text()')->to_literal ;
107
                  $workspace       = $repo->findnodes('./socgen:build_dir/text()')->to_literal ;
108
                  $yellow_pages    = $repo->findnodes('./socgen:yp_dir/text()')->to_literal ;
109
                  $io_ports        = $repo->findnodes('./socgen:ports_dir/text()')->to_literal ;
110
                  $doc_dir         = $repo->findnodes('./socgen:doc_dir/text()')->to_literal ;
111
 
112
                  }
113
 
114 133 jt_eaton
unless(defined $number_of_cpus)  {    $number_of_cpus = 1;         }
115
unless(defined $workspace     )  {    $workspace      = "work";    }
116
unless(defined $yellow_pages  )  {    $yellow_pages   = "yp";      }
117
unless(defined $io_ports      )  {    $io_ports       = "io_ports";}
118
unless(defined $doc_dir       )  {    $doc_dir        = "doc_dir"; }
119 131 jt_eaton
 
120
#print "number_of_cpus  $number_of_cpus  \n";
121
#print "workspace       $workspace  \n";
122
#print "yellow_pages    $yellow_pages  \n";
123
#print "io_ports        $io_ports  \n";
124
 
125
my $path  = "${home}/${yellow_pages}";
126
 
127
unless( -e $path )
128
{
129
print "$path does not exist \n";
130
my $cmd = "./tools/yp/create_yp $path \n";
131
if(system($cmd)){};
132
}
133
 
134
my $repo_db                     = new BerkeleyDB::Hash( -Filename => "${yellow_pages}/repo.dbm", -Flags => DB_CREATE ) or die "Cannot open file: $!";
135
my $component_db                = new BerkeleyDB::Hash( -Filename => "${yellow_pages}/component.dbm", -Flags => DB_CREATE ) or die "Cannot open file: $!";
136
my $design_db                   = new BerkeleyDB::Hash( -Filename => "${yellow_pages}/design.dbm", -Flags => DB_CREATE ) or die "Cannot open file: $!";
137
my $abstractionDefinition_db    = new BerkeleyDB::Hash( -Filename => "${yellow_pages}/abstractionDefinition.dbm", -Flags => DB_CREATE ) or die "Cannot open file: $!";
138
my $busDefinition_db            = new BerkeleyDB::Hash( -Filename => "${yellow_pages}/busDefinition.dbm", -Flags => DB_CREATE ) or die "Cannot open file: $!";
139
my $libraryConfiguration_db     = new BerkeleyDB::Hash( -Filename => "${yellow_pages}/libraryConfiguration.dbm", -Flags => DB_CREATE ) or die "Cannot open file: $!";
140
my $componentConfiguration_db   = new BerkeleyDB::Hash( -Filename => "${yellow_pages}/componentConfiguration.dbm", -Flags => DB_CREATE ) or die "Cannot open file: $!";
141
 
142
 
143 118 jt_eaton
#/***********************************************************************************************/
144 131 jt_eaton
#/  get_workspace                                                                               */
145
#/                                                                                              */
146
#/  returns name for the workspace subdirectory under ${home}                                   */
147
#/                                                                                              */
148
#/  my $workspace = yp::lib::get_workspace();                                                   */
149
#/                                                                                              */
150
#/***********************************************************************************************/
151
 
152
sub get_workspace
153
   {
154
   return("${workspace}");
155
   }
156
 
157
 
158
 
159
#/***********************************************************************************************/
160
#/  get_yp                                                                                      */
161
#/                                                                                              */
162
#/  returns name for the yellow_pages subdirectory under ${home}                                */
163
#/                                                                                              */
164
#/  my $workspace = yp::lib::get_yp();                                                          */
165
#/                                                                                              */
166
#/***********************************************************************************************/
167
 
168
sub get_yp
169
   {
170
   return("${yellow_pages}");
171
   }
172
 
173
 
174
 
175
 
176
 
177
#/***********************************************************************************************/
178
#/  get_io_ports                                                                                */
179
#/                                                                                              */
180
#/  returns name for the io_ports subdirectory under ${home}                                    */
181
#/                                                                                              */
182
#/  my $workspace = yp::lib::get_io_ports();                                                    */
183
#/                                                                                              */
184
#/***********************************************************************************************/
185
 
186
sub get_io_ports
187
   {
188
   return("${io_ports}");
189
   }
190
 
191
#/***********************************************************************************************/
192
#/  get_doc_dir                                                                                 */
193
#/                                                                                              */
194
#/  returns name for the documentation  subdirectory under ${home}                              */
195
#/                                                                                              */
196
#/  my $workspace = yp::lib::get_doc_dir ();                                                    */
197
#/                                                                                              */
198
#/***********************************************************************************************/
199
 
200
sub get_doc_dir
201
   {
202
   return("${doc_dir}");
203
   }
204
 
205
 
206
 
207 133 jt_eaton
#/***********************************************************************************************/
208
#/  get_number_of_cpus                                                                          */
209
#/                                                                                              */
210
#/  returns number of cpus available for tool usage                                             */
211
#/                                                                                              */
212
#/  my $number_of_cpus = yp::lib::get_number_of_cpus ();                                        */
213
#/                                                                                              */
214
#/***********************************************************************************************/
215 131 jt_eaton
 
216 133 jt_eaton
sub get_number_of_cpus
217
   {
218
   return("${number_of_cpus}");
219
   }
220
 
221
 
222
 
223
 
224 131 jt_eaton
#/***************************************************************************************************/
225
#/  get_io_ports_db_filename                                                                        */
226
#/                                                                                                  */
227
#/  returns full path name to io_ports database filename                                            */
228
#/                                                                                                  */
229
#/  my $io_ports_filename = yp::lib::get_io_ports_db_filename($vendor,$library,$component,$version);*/
230
#/                                                                                                  */
231
#/***************************************************************************************************/
232
 
233
sub get_io_ports_db_filename
234
   {
235
   my @params     = @_;
236
   my $version    = pop(@params);
237
   my $component  = pop(@params);
238
   my $library    = pop(@params);
239
   my $vendor     = pop(@params);
240
   my $main_module_name = yp::lib::get_module_name($vendor,$library,$component,$version) ;
241 133 jt_eaton
   my $io_ports_db_filename = "${home}/${io_ports}/${vendor}__${library}/${component}/${main_module_name}/PORTS.dbm";
242 131 jt_eaton
 
243
   if(-e ${io_ports_db_filename } )
244
     {
245
     return("${io_ports_db_filename}");
246
     }
247
   my $cmd = "./tools/verilog/gen_ports    -vendor $vendor -library  $library  -component $component  -version $version   ";
248
   if (system($cmd)) {}
249
   return("${io_ports_db_filename}");
250
   }
251
 
252
 
253
 
254
 
255
 
256 133 jt_eaton
#/******************************************************************************************************/
257
#/  get_io_busses_db_filename                                                                          */
258
#/                                                                                                     */
259
#/  returns full path name to io_busses database filename                                              */
260
#/                                                                                                     */
261
#/  my $io_busses_filename = yp::lib::get_io_busses_db_filename($vendor,$library,$component,$version); */
262
#/                                                                                                     */
263
#/******************************************************************************************************/
264 131 jt_eaton
 
265
sub get_io_busses_db_filename
266
   {
267
   my @params     = @_;
268
   my $version    = pop(@params);
269
   my $component  = pop(@params);
270
   my $library    = pop(@params);
271
   my $vendor     = pop(@params);
272
   my $main_module_name = yp::lib::get_module_name($vendor,$library,$component,$version) ;
273 133 jt_eaton
   my $io_busses_db_filename = "${home}/${io_ports}/${vendor}__${library}/${component}/${main_module_name}/BUSSES.dbm";
274 131 jt_eaton
 
275
   if(-e ${io_busses_db_filename } )
276
     {
277
     return("${io_busses_db_filename}");
278
     }
279
   my $cmd = "./tools/verilog/gen_ports    -vendor $vendor -library  $library  -component $component  -version $version   ";
280
   if (system($cmd)) {}
281
   return("${io_busses_db_filename}");
282
   }
283
 
284
 
285
 
286
 
287
 
288 133 jt_eaton
#/***********************************************************************************************************/
289
#/  get_elab_db_filename                                                                                    */
290
#/                                                                                                          */
291
#/  returns full path name to elab database filename                                                        */
292
#/                                                                                                          */
293
#/  my $elab_filename = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,$configuration); */
294
#/                                                                                                          */
295
#/***********************************************************************************************************/
296 131 jt_eaton
 
297 133 jt_eaton
sub get_elab_db_filename
298
   {
299
   my @params     = @_;
300
   my $configuration    = pop(@params);
301
   my $version    = pop(@params);
302
   my $component  = pop(@params);
303
   my $library    = pop(@params);
304
   my $vendor     = pop(@params);
305
 
306
   my $elab_db_filename;
307 131 jt_eaton
 
308 133 jt_eaton
   if($configuration eq "default")
309
   {
310
    $elab_db_filename = "${home}/dbs/${vendor}_${library}_${component}_${version}.db";
311
   }
312
   else
313
   {
314
    $elab_db_filename = "${home}/dbs/${vendor}_${library}_${component}_${version}_${configuration}.db";
315
   }
316
 
317
   return("${elab_db_filename}");
318
   }
319
 
320
 
321
 
322
 
323
 
324
 
325
 
326 131 jt_eaton
#/***************************************************************************************************/
327
#/  get_signals                                                                                     */
328
#/                                                                                                  */
329
#/  returns array of all signals in a component                                                     */
330
#/                                                                                                  */
331
#/  my @signals  = yp::lib::get_signals($vendor,$library,$component,$version);                      */
332
#/                                                                                                  */
333
#/***************************************************************************************************/
334
 
335
sub get_signals
336
   {
337
   my @params     = @_;
338
   my $version    = pop(@params);
339
   my $component  = pop(@params);
340
   my $library    = pop(@params);
341
   my $vendor     = pop(@params);
342
 
343 133 jt_eaton
   my $io_ports_db_filename = yp::lib::get_io_ports_db_filename($vendor,$library,$component,$version);
344 131 jt_eaton
   unless (-e ${io_ports_db_filename } )
345
      {
346
 
347
      my $cmd = "./tools/verilog/gen_ports    -vendor $vendor -library  $library  -component $component  -version $version   ";
348
      if (system($cmd)) {}
349
         $cmd = "./tools/verilog/gen_signals  -vendor $vendor -library  $library  -component $component  -version $version   ";
350
      if (system($cmd)) {}
351
      }
352
 
353
 
354
 
355
   my  $ports_db   = new BerkeleyDB::Hash( -Filename => $io_ports_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${io_ports_db_filename}: $!";
356
   my  @signals  = ();
357
   my  $key;
358
   my  $value;
359
   my  $port_cursor = $ports_db->db_cursor() ;
360
       while ($port_cursor->c_get($key, $value, DB_NEXT) == 0)
361
          {
362
 
363
          push (@signals, $value);
364
          }
365
   my  $status = $port_cursor->c_close() ;
366
 
367
       @signals      = sys::lib::trim_sort(@signals);
368
   return(@signals);
369
   }
370
 
371
 
372
 
373
 
374
 
375 133 jt_eaton
 
376
 
377 131 jt_eaton
#/***************************************************************************************************/
378 133 jt_eaton
#/  get_Parameters                                                                                  */
379
#/                                                                                                  */
380
#/  returns array of all instance parameters in a component                                         */
381
#/                                                                                                  */
382
#/  my @parameters  = yp::lib::get_Parameters($vendor,$library,$component,$version,$instance,$configuration);      */
383
#/                                                                                                  */
384
#/***************************************************************************************************/
385
 
386
sub get_Parameters
387
   {
388
   my @params     = @_;
389
   my $configuration = pop(@params);
390
   my $instance   = pop(@params);
391
   my $version    = pop(@params);
392
   my $component  = pop(@params);
393
   my $library    = pop(@params);
394
   my $vendor     = pop(@params);
395
   my $elab_db_filename = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,$configuration);
396
   my  $ports_db   = new BerkeleyDB::Hash( -Filename => $elab_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${elab_db_filename}: $!";
397
   my  @parameters  = ();
398
   my  $key;
399
   my  $value;
400
   my  $port_cursor = $ports_db->db_cursor() ;
401
       while ($port_cursor->c_get($key, $value, DB_NEXT) == 0)
402
          {
403
          my $parameter_root;
404
          my $parameter;
405
          ( $parameter_root,$parameter) = split( /\__/ , $key);
406
          if($parameter_root eq "Parameter_${instance}")
407
            {
408
            push (@parameters, "${parameter}::${value}");
409
            }
410
          }
411
 
412
   my  $status = $port_cursor->c_close() ;
413
 
414
       @parameters      = sys::lib::trim_sort(@parameters);
415
   return(@parameters);
416
   }
417
 
418
 
419
 
420
 
421
#/***************************************************************************************************/
422
#/  get_parameters                                                                                  */
423
#/                                                                                                  */
424
#/  returns array of all parameters in a component                                                  */
425
#/                                                                                                  */
426
#/  my @parameters  = yp::lib::get_parameters($vendor,$library,$component,$version,$configuration);                */
427
#/                                                                                                  */
428
#/***************************************************************************************************/
429
 
430
sub get_parameters
431
   {
432
   my @params     = @_;
433
   my $configuration    = pop(@params);
434
   my $version    = pop(@params);
435
   my $component  = pop(@params);
436
   my $library    = pop(@params);
437
   my $vendor     = pop(@params);
438
   my $elab_db_filename = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,$configuration);
439
   my  $ports_db   = new BerkeleyDB::Hash( -Filename => $elab_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${elab_db_filename}: $!";
440
   my  @parameters  = ();
441
   my  $key;
442
   my  $value;
443
   my  $port_cursor = $ports_db->db_cursor() ;
444
       while ($port_cursor->c_get($key, $value, DB_NEXT) == 0)
445
          {
446
          my $parameter_root;
447
          my $parameter;
448
          ( $parameter_root,$parameter) = split( /\__/ , $key);
449
          if($parameter_root eq "parameter_root")
450
            {
451
            push (@parameters, "${parameter}::${value}");
452
            }
453
          }
454
 
455
   my  $status = $port_cursor->c_close() ;
456
 
457
       @parameters      = sys::lib::trim_sort(@parameters);
458
   return(@parameters);
459
   }
460
 
461
 
462
 
463
 
464
 
465
 
466
#/***************************************************************************************************/
467
#/  get_instance_names                                                                              */
468
#/                                                                                                  */
469
#/  returns array of all instance_names in a component                                              */
470
#/                                                                                                  */
471
#/  my @instance_names  = yp::lib::get_instance_names($vendor,$library,$component,$version,$configuration);        */
472
#/                                                                                                  */
473
#/***************************************************************************************************/
474
 
475
sub get_instance_names
476
   {
477
   my @params     = @_;
478
   my $configuration    = pop(@params);
479
   my $version    = pop(@params);
480
   my $component  = pop(@params);
481
   my $library    = pop(@params);
482
   my $vendor     = pop(@params);
483
   my $elab_db_filename = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,$configuration);
484
   my  $ports_db   = new BerkeleyDB::Hash( -Filename => $elab_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${elab_db_filename}: $!";
485
   my  @instance_names  = ();
486
   my  $field1;
487
   my  $field2;
488
   my  $key;
489
   my  $value;
490
#   print "QQQQQQQQQQ  get_instance_names $vendor,$library,$component,$version \n ";
491
 
492
   my  $port_cursor = $ports_db->db_cursor() ;
493
       while ($port_cursor->c_get($key, $value, DB_NEXT) == 0)
494
          {
495
          ( $field1,$field2) = split( /\./ , $key);
496
 
497
 
498
          if(($field1 eq "component___root")&& ($key eq "${field1}.${field2}"   )  )
499
            {
500
 
501
            push (@instance_names, "${field2}");
502
            }
503
          }
504
 
505
   my  $status = $port_cursor->c_close() ;
506
 
507
       @instance_names      = sys::lib::trim_sort(@instance_names);
508
   return(@instance_names);
509
   }
510
 
511
 
512
 
513
#/***********************************************************************************************************/
514
#/  get_instance_module_name                                                                                */
515
#/                                                                                                          */
516
#/  returns the module anme of an instance                                                                  */
517
#/                                                                                                          */
518
#/  my $module_name  = yp::lib::get_instance_module_name($vendor,$library,$component,$version,$instance,$configuration );  */
519
#/                                                                                                          */
520
#/***********************************************************************************************************/
521
 
522
sub get_instance_module_name
523
   {
524
   my @params     = @_;
525
   my $configuration   = pop(@params);
526
   my $instance   = pop(@params);
527
   my $version    = pop(@params);
528
   my $component  = pop(@params);
529
   my $library    = pop(@params);
530
   my $vendor     = pop(@params);
531
   my $elab_db_filename = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,$configuration);
532
   my $elab_db   = new BerkeleyDB::Hash( -Filename => $elab_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${elab_db_filename}: $!";
533
   my $module_name;
534
   my $module_vlnv;
535
   my $module_vendor;
536
   my $module_library;
537
   my $module_component;
538
   my $module_version;
539
   $elab_db->db_get("component___root.${instance}", $module_vlnv );
540
   ( $module_vendor,$module_library,$module_component,$module_version) = split( /\:/ , $module_vlnv);
541
     $module_name = yp::lib::get_module_name($module_vendor,$module_library,$module_component,$module_version) ;
542
   return($module_name);
543
   }
544
 
545
 
546
 
547
 
548
 
549
 
550
#/*********************************************************************************************************/
551
#/  get_instance_conns                                                                                    */
552
#/                                                                                                        */
553
#/  returns array of all connections to an instance                                                       */
554
#/                                                                                                        */
555
#/  my @inst_conns  = yp::lib::get_instance_conns($vendor,$library,$component,$version,$instance);        */
556
#/                                                                                                        */
557
#/*********************************************************************************************************/
558
 
559
sub get_instance_conns
560
   {
561
   my @params     = @_;
562
   my $instance   = pop(@params);
563
   my $version    = pop(@params);
564
   my $component  = pop(@params);
565
   my $library    = pop(@params);
566
   my $vendor     = pop(@params);
567
 
568
   my $io_busses_db_filename = yp::lib::get_io_busses_db_filename($vendor,$library,$component,$version);
569
 
570
 
571
 
572
 
573
   unless (-e ${io_busses_db_filename } )
574
      {
575
 
576
      my $cmd = "./tools/verilog/gen_ports    -vendor $vendor -library  $library  -component $component  -version $version   ";
577
      if (system($cmd)) {}
578
         $cmd = "./tools/verilog/gen_signals  -vendor $vendor -library  $library  -component $component  -version $version   ";
579
      if (system($cmd)) {}
580
      }
581
 
582
 
583
 
584
   my  $ports_db   = new BerkeleyDB::Hash( -Filename => $io_busses_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${io_busses_db_filename}: $!";
585
   my  @inst_conns  = ();
586
   my  $key;
587
   my  $value;
588
   my  $port_cursor = $ports_db->db_cursor() ;
589
       while ($port_cursor->c_get($key, $value, DB_NEXT) == 0)
590
          {
591
          my $Instance;
592
          my $instance_name;
593
          my $instance_busref;
594
          ( $Instance,$instance_name,$instance_busref) = split( /\./ , $key);
595
          if(($Instance eq "Instance")&& ($instance eq $instance_name))
596
            {
597
            my $new_key;
598
            my $new_value;
599
            my  $bus_cursor = $ports_db->db_cursor() ;
600
          while ($bus_cursor->c_get($new_key, $new_value, DB_NEXT) == 0)
601
          {
602
          my $IXstance;
603
          my $IX_inst;
604
          my $IX_busref;
605
          my $IX_port;
606
          ( $IXstance,$IX_inst,$IX_busref,$IX_port) = split( /\./ , $new_key);
607
          if(($IXstance eq "IXstance") && ($IX_inst eq $instance_name) &&($IX_busref eq $instance_busref) )
608
            {
609
            my $logname;
610
            my $direction;
611
            my $wire;
612
            my $vector;
613
            my $left;
614
            my $right;
615
            my $port;
616
            ($logname,$direction,$wire,$vector,$left,$right,$port ) = split( /\:/ , $new_value);
617
            my $type;
618
            my $signal;
619
 
620
            $ports_db->db_get("BusRef.${value}.${IX_port}", $new_value );
621
 
622
 
623
            ($logname,$type,$wire,$vector,$left,$right,$signal ) = split( /\:/ , $new_value);
624
 
625
 
626
               if($vector eq "vector")
627
                {
628
                push (@inst_conns, ".${port}      ( ${signal}[${left}:${right}]  )");
629
                }
630
               else
631
                {
632
                push (@inst_conns, ".${port}      ( ${signal}  )");
633
                }
634
            }
635
          }
636
          my  $status = $bus_cursor->c_close() ;
637
 
638
 
639
 
640
 
641
 
642
 
643
            }
644
          }
645
   my  $status = $port_cursor->c_close() ;
646
 
647
       @inst_conns      = sys::lib::trim_sort(@inst_conns);
648
   return(@inst_conns);
649
   }
650
 
651
 
652
 
653
 
654
#/*********************************************************************************************************/
655
#/  get_instance_adhoc_conns                                                                                    */
656
#/                                                                                                        */
657
#/  returns array of all connections to an instance                                                       */
658
#/                                                                                                        */
659
#/  my @inst_conns  = yp::lib::get_instance_adhoc_conns($vendor,$library,$component,$version,$instance);  */
660
#/                                                                                                        */
661
#/*********************************************************************************************************/
662
 
663
sub get_instance_adhoc_conns
664
   {
665
   my @params     = @_;
666
   my $instance   = pop(@params);
667
   my $version    = pop(@params);
668
   my $component  = pop(@params);
669
   my $library    = pop(@params);
670
   my $vendor     = pop(@params);
671
 
672
   my $io_busses_db_filename = yp::lib::get_io_busses_db_filename($vendor,$library,$component,$version);
673
 
674
   unless (-e ${io_busses_db_filename } )
675
      {
676
 
677
      my $cmd = "./tools/verilog/gen_ports    -vendor $vendor -library  $library  -component $component  -version $version   ";
678
      if (system($cmd)) {}
679
         $cmd = "./tools/verilog/gen_signals  -vendor $vendor -library  $library  -component $component  -version $version   ";
680
      if (system($cmd)) {}
681
      }
682
 
683
 
684
 
685
   my  $ports_db   = new BerkeleyDB::Hash( -Filename => $io_busses_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${io_busses_db_filename}: $!";
686
   my  @inst_conns  = ();
687
   my  $key;
688
   my  $value;
689
   my  $port_cursor = $ports_db->db_cursor() ;
690
       while ($port_cursor->c_get($key, $value, DB_NEXT) == 0)
691
          {
692
 
693
          my $adhoc_inst;
694
          my $port;
695
          ( $adhoc_inst,$port) = split( /\__/ , $key);
696
          if($adhoc_inst eq "AdHoc_${instance}")
697
             {
698
                 my $sig1;
699
                 my $sig2;
700
                 my $wire;
701
                 my $vector;
702
                 my $left;
703
                 my $right;
704
 
705
 
706
 
707
          ( $sig1,$sig2,$wire,$vector,$left,$right) = split( /\:/ , $value);
708
 
709
                 if($sig1 eq "***") {$sig1 = "   ";}
710
              if($vector eq "vector")
711
              {
712
               push (@inst_conns, " .${port}      ( ${sig1}[${left}:${right}] )");
713
              }
714
              else
715
              {
716
               push (@inst_conns, " .${port}      ( ${sig1}  )");
717
              }
718
 
719
             }
720
 
721
          }
722
   my  $status = $port_cursor->c_close() ;
723
 
724
       @inst_conns      = sys::lib::trim_sort(@inst_conns);
725
   return(@inst_conns);
726
   }
727
 
728
 
729
 
730
 
731
 
732
 
733
 
734
 
735
#/***************************************************************************************************/
736 131 jt_eaton
#/  get_busses                                                                                     */
737
#/                                                                                                  */
738
#/  returns array of all busses in a component                                                     */
739
#/                                                                                                  */
740
#/  my @signals  = yp::lib::get_busses($vendor,$library,$component,$version);                      */
741
#/                                                                                                  */
742
#/***************************************************************************************************/
743
 
744
sub get_busses
745
   {
746
   my @params     = @_;
747
   my $version    = pop(@params);
748
   my $component  = pop(@params);
749
   my $library    = pop(@params);
750
   my $vendor     = pop(@params);
751
 
752
 
753 133 jt_eaton
   my $io_busses_db_filename = yp::lib::get_io_busses_db_filename($vendor,$library,$component,$version);
754
 
755 131 jt_eaton
   unless (-e ${io_busses_db_filename } )
756
      {
757
 
758
      my $cmd = "./tools/verilog/gen_ports    -vendor $vendor -library  $library  -component $component  -version $version   ";
759
      if (system($cmd)) {}
760
      }
761
 
762
   my  $ports_db   = new BerkeleyDB::Hash( -Filename => $io_busses_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${io_busses_db_filename}: $!";
763
   my  @busses  = ();
764
   my  $key;
765
   my  $value;
766
   my  ${key_type};
767
   my  ${busref};
768
   my  ${conn};
769
   my  ${log_name};
770
   my  ${direction};
771
   my  ${type};
772
   my  ${vector};
773
   my  ${left};
774
   my  ${right};
775
   my  ${phy_name};
776
   my  $port_cursor = $ports_db->db_cursor() ;
777
       while ($port_cursor->c_get($key, $value, DB_NEXT) == 0)
778
          {
779
          ( ${key_type},${busref},${conn}) = split( /\./ , $key);
780
          ( ${log_name},${direction},${type},${vector},${left},${right},${phy_name}) = split ':', $value;
781
 
782
           if(($key_type eq "BusRef"))
783
              {
784
              push (@busses,  "${busref}:::${conn}:::${phy_name}:::${log_name}:::${direction}:::${type}:::${vector}:::${left}:::${right}");
785
              }
786
          }
787
   my  $status = $port_cursor->c_close() ;
788
 
789
   @busses      = sys::lib::trim_sort(@busses);
790
   return(@busses);
791
   }
792
 
793
 
794
#/***************************************************************************************************/
795
#/  get_absDef_db_filename                                                                          */
796
#/                                                                                                  */
797
#/  returns full path name to abstractionDefinition database filename                               */
798
#/                                                                                                  */
799
#/  my $absDef_filename = yp::lib::get_absDef_db_filename($vendor,$library,$component,$version);    */
800
#/                                                                                                  */
801
#/***************************************************************************************************/
802
 
803
sub get_absDef_db_filename
804
   {
805
   my @params     = @_;
806
   my $version    = pop(@params);
807
   my $component  = pop(@params);
808
   my $library    = pop(@params);
809
   my $vendor     = pop(@params);
810
   my $absDef_db_filename = "${io_ports}/${vendor}__${library}/${component}/${component}_${version}_ABSDEF.dbm";
811
 
812
   if(-e ${absDef_db_filename } )
813
     {
814
     return("${absDef_db_filename}");
815
     }
816
   my $cmd = "./tools/busdefs/gen_busdef    -vendor $vendor -library $library  -component $component  -version $version   ";
817
   if (system($cmd)) {}
818
 
819
   return("${absDef_db_filename}");
820
   }
821
 
822
 
823
 
824
 
825
 
826
 
827
 
828
 
829
 
830
#/***********************************************************************************************/
831 130 jt_eaton
#/  find_ipxact_component                                                                       */
832 118 jt_eaton
#/                                                                                              */
833 130 jt_eaton
#/  returns full path name to ip-xact component file                                            */
834 118 jt_eaton
#/                                                                                              */
835 130 jt_eaton
#/  my $spirit_type_file = yp::lib::find_ipxact_component($vendor,$library,$component,$version);*/
836 118 jt_eaton
#/                                                                                              */
837
#/***********************************************************************************************/
838 117 jt_eaton
 
839 130 jt_eaton
sub find_ipxact_component
840 117 jt_eaton
   {
841
   my @params     = @_;
842
   my $version    = pop(@params);
843
   my $component  = pop(@params);
844 130 jt_eaton
   my $library    = pop(@params);
845 117 jt_eaton
   my $vendor     = pop(@params);
846 130 jt_eaton
   my $comp_data;
847
   my $component_version;
848
   my $component_xml;
849
   my $comp_xml_sep;
850
      $component_db->db_get("${vendor}__${library}_${component}_${version}", $comp_data );
851
      ( $component_xml, $comp_xml_sep,$component_version ) = split ':', $comp_data;
852 117 jt_eaton
 
853 130 jt_eaton
      return("$component_xml");
854 118 jt_eaton
   }
855
 
856
 
857
 
858 130 jt_eaton
#/***********************************************************************************************/
859
#/  find_ipxact_design                                                                          */
860
#/                                                                                              */
861
#/  returns full path name to ip-xact design file                                               */
862
#/                                                                                              */
863
#/  my $spirit_type_file = yp::lib::find_ipxact_design($vendor,$library,$component,$version);   */
864
#/                                                                                              */
865
#/***********************************************************************************************/
866 118 jt_eaton
 
867 130 jt_eaton
sub find_ipxact_design
868 117 jt_eaton
   {
869
   my @params     = @_;
870
   my $version    = pop(@params);
871
   my $component  = pop(@params);
872 130 jt_eaton
   my $library    = pop(@params);
873 117 jt_eaton
   my $vendor     = pop(@params);
874 130 jt_eaton
   my $data;
875
   my $design_xml_sep ;
876
   my $design_xml_file ;
877
   my $design_version;
878 117 jt_eaton
 
879 130 jt_eaton
      $design_db->db_get("${vendor}__${library}_${component}_${version}", $data );
880
      ( $design_xml_file, $design_xml_sep,$design_version ) = split ':', $data;
881 117 jt_eaton
 
882 130 jt_eaton
      return("$design_xml_file");
883 117 jt_eaton
   }
884
 
885
 
886 130 jt_eaton
#/**************************************************************************************************************/
887
#/  find_ipxact_abstractionDefinition                                                                          */
888
#/                                                                                                             */
889
#/  returns full path name to ip-xact abstractionDefinition file                                               */
890
#/                                                                                                             */
891
#/  my $spirit_type_file = yp::lib::find_ipxact_abstractionDefinition($vendor,$library,$component,$version);   */
892
#/                                                                                                             */
893
#/**************************************************************************************************************/
894 117 jt_eaton
 
895 130 jt_eaton
sub find_ipxact_abstractionDefinition
896 117 jt_eaton
   {
897
   my @params     = @_;
898
   my $version    = pop(@params);
899
   my $component  = pop(@params);
900 130 jt_eaton
   my $library    = pop(@params);
901 117 jt_eaton
   my $vendor     = pop(@params);
902
 
903 130 jt_eaton
   my $data;
904
   my $design_xml_sep ;
905
   my $design_xml_file ;
906
   my $design_version;
907 131 jt_eaton
   my $design_name;
908
   my $design_library;
909
   my $design_vendor;
910 117 jt_eaton
 
911 131 jt_eaton
 
912 130 jt_eaton
      $abstractionDefinition_db->db_get("${vendor}__${library}_${component}_${version}", $data );
913 131 jt_eaton
      ( $design_xml_file, $design_xml_sep,$design_version,$design_name,$design_library,$design_vendor ) = split ':', $data;
914 117 jt_eaton
 
915 130 jt_eaton
      return("$design_xml_file");
916 117 jt_eaton
 
917
   }
918
 
919
 
920
 
921 130 jt_eaton
#/**************************************************************************************************************/
922
#/  find_ipxact_busDefinition                                                                                  */
923
#/                                                                                                             */
924
#/  returns full path name to ip-xact busDefinition file                                                       */
925
#/                                                                                                             */
926
#/  my $spirit_type_file = yp::lib::find_ipxact_busDefinition($vendor,$library,$component,$version);           */
927
#/                                                                                                             */
928
#/**************************************************************************************************************/
929 117 jt_eaton
 
930 130 jt_eaton
sub find_ipxact_busDefinition
931 117 jt_eaton
   {
932
   my @params     = @_;
933
   my $version    = pop(@params);
934
   my $component  = pop(@params);
935 130 jt_eaton
   my $library    = pop(@params);
936 117 jt_eaton
   my $vendor     = pop(@params);
937
 
938 130 jt_eaton
   my $data;
939
   my $design_xml_sep ;
940
   my $design_xml_file ;
941
   my $design_version;
942 117 jt_eaton
 
943
 
944 130 jt_eaton
      $busDefinition_db->db_get("${vendor}__${library}_${component}_${version}", $data );
945
      ( $design_xml_file, $design_xml_sep,$design_version ) = split ':', $data;
946 117 jt_eaton
 
947 130 jt_eaton
      return("$design_xml_file");
948 117 jt_eaton
   }
949
 
950
 
951
 
952 130 jt_eaton
#/**************************************************************************************************************/
953
#/  find_libraryConfiguration                                                                                  */
954
#/                                                                                                             */
955
#/  returns full path name to socgen  libraryConfiguration xml file                                            */
956
#/                                                                                                             */
957
#/  my $socgen_file = yp::lib::find_libraryConfiguration($vendor,$library);                                    */
958
#/                                                                                                             */
959
#/**************************************************************************************************************/
960 117 jt_eaton
 
961 130 jt_eaton
sub find_libraryConfiguration
962 117 jt_eaton
   {
963
   my @params     = @_;
964 130 jt_eaton
   my $library    = pop(@params);
965 117 jt_eaton
   my $vendor     = pop(@params);
966
 
967 130 jt_eaton
   my $libraryConfiguration_xml;
968
      $libraryConfiguration_db->db_get("${vendor}__${library}", $libraryConfiguration_xml );
969
   return("$libraryConfiguration_xml");
970 117 jt_eaton
   }
971
 
972
 
973 130 jt_eaton
#/**************************************************************************************************************/
974
#/  find_componentConfiguration                                                                                */
975
#/                                                                                                             */
976
#/  returns full path name to socgen  componentConfiguration xml file                                          */
977
#/                                                                                                             */
978
#/  my $socgen_file = yp::lib::find_componentConfiguration($vendor,$library,$component);                       */
979
#/                                                                                                             */
980
#/**************************************************************************************************************/
981 117 jt_eaton
 
982 130 jt_eaton
sub find_componentConfiguration
983 117 jt_eaton
   {
984
   my @params     = @_;
985
   my $component  = pop(@params);
986 130 jt_eaton
   my $library    = pop(@params);
987 117 jt_eaton
   my $vendor     = pop(@params);
988
 
989 130 jt_eaton
   my $componentConfiguration_xml;
990
      $componentConfiguration_db->db_get("${vendor}__${library}_${component}", $componentConfiguration_xml );
991
   return("$componentConfiguration_xml");
992 117 jt_eaton
   }
993
 
994
 
995
 
996
 
997 130 jt_eaton
#/**************************************************************************************************************/
998 131 jt_eaton
#/  find_component_repo                                                                                        */
999
#/                                                                                                             */
1000
#/  returns repository that containing component                                                               */
1001
#/                                                                                                             */
1002
#/  my $repo_name = yp::lib::find_component_repo($vendor,$library,$component);                                 */
1003
#/                                                                                                             */
1004
#/**************************************************************************************************************/
1005
 
1006
sub find_component_repo   {
1007
   my @params     = @_;
1008
   my $component  = pop(@params);
1009
   my $library    = pop(@params);
1010
   my $vendor     = pop(@params);
1011
 
1012
   my $type;
1013
   my $name;
1014
   my $lib_comp_sep;
1015
   my $repo_dir;
1016
   my $repo_data;
1017
 
1018
      $repo_db->db_get("${vendor}__${library}_${component}", $repo_data );
1019
   ( $type,$name, $lib_comp_sep, $repo_dir ) = split ':', $repo_data;
1020
   return("${repo_dir}");
1021
   }
1022
 
1023
 
1024
 
1025
 
1026
#/**************************************************************************************************************/
1027
#/  find_library_repo                                                                                          */
1028
#/                                                                                                             */
1029
#/  returns repository containing library                                                                      */
1030
#/                                                                                                             */
1031
#/  my $repo_name = yp::lib::find_library_repo($vendor,$library);                                              */
1032
#/                                                                                                             */
1033
#/**************************************************************************************************************/
1034
 
1035
sub find_library_repo   {
1036
   my @params     = @_;
1037
   my $library    = pop(@params);
1038
   my $vendor     = pop(@params);
1039
 
1040
   my $type;
1041
   my $name;
1042
   my $status;
1043
   my $library_path;
1044
   my $repo_dir;
1045
   my $repo_data;
1046
 
1047
      $repo_db->db_get("${vendor}__${library}", $repo_data );
1048
   ( $type,$name, $library_path,$status, $repo_dir ) = split ':', $repo_data;
1049
   return("${repo_dir}");
1050
   }
1051
 
1052
 
1053
 
1054
 
1055
#/**************************************************************************************************************/
1056 130 jt_eaton
#/  find_lib_comp_sep                                                                                          */
1057
#/                                                                                                             */
1058
#/  returns libraries path to components                                                                       */
1059
#/                                                                                                             */
1060
#/  my $lib_comp_sep = yp::lib::find_lib_comp_sep($vendor,$library,$component);                                */
1061
#/                                                                                                             */
1062
#/**************************************************************************************************************/
1063 120 jt_eaton
 
1064 117 jt_eaton
sub find_lib_comp_sep
1065
   {
1066
   my @params     = @_;
1067 127 jt_eaton
   my $component  = pop(@params);
1068 130 jt_eaton
   my $library    = pop(@params);
1069 117 jt_eaton
   my $vendor     = pop(@params);
1070
 
1071 130 jt_eaton
   my $type;
1072
   my $name;
1073
   my $lib_comp_sep;
1074 131 jt_eaton
   my $repo_dir;
1075 130 jt_eaton
   my $repo_data;
1076 117 jt_eaton
 
1077 130 jt_eaton
      $repo_db->db_get("${vendor}__${library}_${component}", $repo_data );
1078 131 jt_eaton
   ( $type,$name, $lib_comp_sep, $repo_dir ) = split ':', $repo_data;
1079 130 jt_eaton
   return("${lib_comp_sep}");
1080 120 jt_eaton
   }
1081 117 jt_eaton
 
1082 120 jt_eaton
 
1083 131 jt_eaton
 
1084 130 jt_eaton
#/***********************************************************************************************/
1085
#/  find_ipxact_comp_xml_sep                                                                    */
1086
#/                                                                                              */
1087
#/                                                                                              */
1088
#/                                                                                              */
1089
#/  my $comp_xml_sep = yp::lib::find_ipxact_component($vendor,$library,$component,$version);    */
1090
#/                                                                                              */
1091
#/***********************************************************************************************/
1092 120 jt_eaton
 
1093 130 jt_eaton
sub find_comp_xml_sep
1094 120 jt_eaton
   {
1095
   my @params     = @_;
1096
   my $version    = pop(@params);
1097
   my $component  = pop(@params);
1098 130 jt_eaton
   my $library    = pop(@params);
1099 120 jt_eaton
   my $vendor     = pop(@params);
1100 130 jt_eaton
   my $comp_data;
1101
   my $comp_version;
1102
   my $comp_xml_sep;
1103
   my $component_xml;
1104
      $component_db->db_get("${vendor}__${library}_${component}_${version}", $comp_data );
1105
      ( $component_xml, $comp_xml_sep, $comp_version) = split ':', $comp_data;
1106
      return("$comp_xml_sep");
1107 120 jt_eaton
   }
1108 117 jt_eaton
 
1109
 
1110
 
1111
 
1112 120 jt_eaton
 
1113
 
1114
#/*********************************************************************************************/
1115
#/  find_lib_sw_dir                                                                           */
1116
#/                                                                                            */
1117
#/  returns  library sw directory                                                             */
1118
#/                                                                                            */
1119
#/   my $file_lib_sw_dir = yp::lib::find_file_lib_sw_dir($vendor,$library);                   */
1120
#/                                                                                            */
1121
#/*********************************************************************************************/
1122 117 jt_eaton
 
1123 120 jt_eaton
sub find_lib_sw_dir
1124
   {
1125
   my @params     = @_;
1126 130 jt_eaton
   my $library    = pop(@params);
1127 120 jt_eaton
   my $vendor     = pop(@params);
1128 130 jt_eaton
   my $parser     = XML::LibXML->new();
1129 117 jt_eaton
 
1130 130 jt_eaton
   my $lib_sw_dir ;
1131
  if(yp::lib::find_libraryConfiguration($vendor,$library))
1132
   {
1133
   my $socgen_libraryConfiguration= $parser->parse_file(yp::lib::find_libraryConfiguration($vendor,$library));
1134
      $lib_sw_dir  = $socgen_libraryConfiguration->findnodes('//socgen:libraryConfiguration/socgen:lib_sw_dir/text()')->to_literal ;
1135 120 jt_eaton
   }
1136
 
1137 130 jt_eaton
      return("/${lib_sw_dir}");
1138 120 jt_eaton
 
1139 130 jt_eaton
   }
1140 120 jt_eaton
 
1141
 
1142
 
1143
 
1144 131 jt_eaton
 
1145
 
1146
#/**************************************************************************************************************/
1147
#/  get_vendor_status                                                                                          */
1148
#/                                                                                                             */
1149
#/  returns vendor status                                                                                      */
1150
#/                                                                                                             */
1151
#/  my $vendor_status = yp::lib::get_vendor_status($vendor);                                                   */
1152
#/                                                                                                             */
1153
#/**************************************************************************************************************/
1154
 
1155
sub get_vendor_status   {
1156
   my @params     = @_;
1157
   my $vendor     = pop(@params);
1158
 
1159
   my $type;
1160
   my $name;
1161
   my $status;
1162
   my $repo_dir;
1163
   my $repo_data;
1164
 
1165
      $repo_db->db_get("${vendor}", $repo_data );
1166
   ( $type,$name, $status, $repo_dir ) = split ':', $repo_data;
1167
   return("${status}");
1168
   }
1169
 
1170
 
1171
 
1172
 
1173
#/**************************************************************************************************************/
1174
#/  set_vendor_status                                                                                          */
1175
#/                                                                                                             */
1176
#/  sets vendor status                                                                                         */
1177
#/                                                                                                             */
1178
#/  my $vendor_status = yp::lib::set_vendor_status($vendor,$status);                                           */
1179
#/                                                                                                             */
1180
#/**************************************************************************************************************/
1181
 
1182
sub set_vendor_status   {
1183
   my @params     = @_;
1184
   my $status     = pop(@params);
1185
   my $vendor     = pop(@params);
1186
 
1187
   my $type;
1188
   my $name;
1189
   my $old_status;
1190
   my $repo_dir;
1191
   my $repo_data;
1192
   my @repo_info;
1193
 
1194
      $repo_db->db_get("${vendor}", $repo_data );
1195
   ( $type,$name, $old_status, $repo_dir ) = split ':', $repo_data;
1196
 
1197
   my @repo_info  = ("vendor","$vendor","$status","$repo_dir" );
1198
   $repo_db->db_put( $vendor, join(':', @repo_info) );
1199
 
1200
   return("${status}");
1201
   }
1202
 
1203
 
1204
 
1205
 
1206
#/**************************************************************************************************************/
1207
#/  get_library_status                                                                                         */
1208
#/                                                                                                             */
1209
#/  returns library status                                                                                     */
1210
#/                                                                                                             */
1211
#/  my $library_status = yp::lib::get_library_status($vendor);                                                 */
1212
#/                                                                                                             */
1213
#/**************************************************************************************************************/
1214
 
1215
sub get_library_status   {
1216
   my @params     = @_;
1217
   my $library     = pop(@params);
1218
   my $vendor     = pop(@params);
1219
 
1220
   my $type;
1221
   my $name;
1222
   my $library_path;
1223
   my $status;
1224
   my $repo_dir;
1225
   my $repo_data;
1226
 
1227
      $repo_db->db_get("${vendor}_${library}", $repo_data );
1228
   ( $type,$name,$library_path, $status, $repo_dir ) = split ':', $repo_data;
1229
   return("${status}");
1230
   }
1231
 
1232
 
1233
 
1234
 
1235
#/**************************************************************************************************************/
1236
#/  set_library_status                                                                                         */
1237
#/                                                                                                             */
1238
#/  sets library status                                                                                        */
1239
#/                                                                                                             */
1240
#/  my $library_status = yp::lib::set_library_status($vendor,$library,$status);                                */
1241
#/                                                                                                             */
1242
#/**************************************************************************************************************/
1243
 
1244
sub set_library_status   {
1245
   my @params     = @_;
1246
   my $status     = pop(@params);
1247
   my $library    = pop(@params);
1248
   my $vendor     = pop(@params);
1249
 
1250
   my $type;
1251
   my $name;
1252
   my $old_status;
1253
   my $library_path;
1254
   my $repo_dir;
1255
   my $repo_data;
1256
   my @repo_info;
1257
 
1258
      $repo_db->db_get("${vendor}_${library}", $repo_data );
1259
   ( $type,$name,$library_path, $old_status, $repo_dir ) = split ':', $repo_data;
1260
 
1261
   my @repo_info  = ("library","$library","$library_path","$status","$repo_dir" );
1262
   $repo_db->db_put( "${vendor}_${library}", join(':', @repo_info) );
1263
 
1264
   return("${status}");
1265
   }
1266
 
1267
 
1268
 
1269
 
1270
 
1271
 
1272
 
1273
 
1274
 
1275
 
1276
 
1277
 
1278
 
1279 117 jt_eaton
#/*********************************************************************************************/
1280
#/  find_vendors                                                                              */
1281
#/                                                                                            */
1282
#/  returns  array of all vendors                                                             */
1283
#/                                                                                            */
1284 130 jt_eaton
#/   my @vendors = yp::lib::find_vendors();                                                   */
1285 117 jt_eaton
#/                                                                                            */
1286
#/*********************************************************************************************/
1287
 
1288
sub find_vendors
1289
   {
1290 130 jt_eaton
   my $key;
1291
   my $value;
1292
   my $type;
1293
   my $name;
1294
   my $path;
1295 131 jt_eaton
   my $repo_dir;
1296 117 jt_eaton
   my @vendors = ();
1297
 
1298 130 jt_eaton
   my $cursor = $repo_db->db_cursor() ;
1299
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
1300
   {
1301 131 jt_eaton
   ( $type,$name, $path,$repo_dir ) = split ':', $value;
1302 130 jt_eaton
   if($type  eq "vendor")
1303 117 jt_eaton
     {
1304 130 jt_eaton
      push (@vendors,$name );
1305
      }
1306 117 jt_eaton
   }
1307 130 jt_eaton
     @vendors = trim_sort(@vendors);
1308
     return (@vendors);
1309
   }
1310 117 jt_eaton
 
1311
 
1312
 
1313
#/*********************************************************************************************/
1314
#/  find_libraries                                                                            */
1315
#/                                                                                            */
1316
#/  returns  array of all libraries from a vendor                                             */
1317
#/                                                                                            */
1318 130 jt_eaton
#/   my @libraries = yp::lib::find_libraries($vendor);                                        */
1319 117 jt_eaton
#/                                                                                            */
1320
#/*********************************************************************************************/
1321
 
1322
sub find_libraries
1323
   {
1324
   my @params     = @_;
1325
   my $vendor    = pop(@params);
1326 130 jt_eaton
   my $type;
1327
   my $key;
1328
   my $value;
1329
   my $name;
1330 131 jt_eaton
   my $status;
1331 130 jt_eaton
   my $path;
1332 131 jt_eaton
   my $repo_dir;
1333 117 jt_eaton
   my @libraries = ();
1334
 
1335 130 jt_eaton
   my $cursor = $repo_db->db_cursor() ;
1336
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
1337
   {
1338 131 jt_eaton
   ( $type,$name, $path,$status, $repo_dir) = split ':', $value;
1339 130 jt_eaton
 
1340
 
1341
   if(($type  eq "library")&& ($key eq "${vendor}__${name}")          )
1342 117 jt_eaton
     {
1343 130 jt_eaton
      push (@libraries,$name );
1344
      }
1345
   }
1346 117 jt_eaton
   @libraries = trim_sort(@libraries);
1347
   return (@libraries);
1348
   }
1349
 
1350
 
1351
#/*********************************************************************************************/
1352
#/  find_components                                                                           */
1353
#/                                                                                            */
1354
#/  returns  array of all components from a vendors library                                   */
1355
#/                                                                                            */
1356 130 jt_eaton
#/   my @components = yp::lib::find_components($vendor,$library);                                      */
1357 117 jt_eaton
#/                                                                                            */
1358
#/*********************************************************************************************/
1359
 
1360
sub find_components
1361
   {
1362
   my @params     = @_;
1363
   my $library    = pop(@params);
1364 130 jt_eaton
   my $vendor     = pop(@params);
1365
   my $type;
1366
   my $key;
1367
   my $value;
1368
   my $name;
1369
   my $path;
1370 131 jt_eaton
   my $repo_dir;
1371 117 jt_eaton
   my @components = ();
1372 130 jt_eaton
   my $cursor = $repo_db->db_cursor() ;
1373
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
1374
      {
1375 131 jt_eaton
      ( $type,$name, $path,$repo_dir ) = split ':', $value;
1376 130 jt_eaton
      if(($type  eq "component")&& ($key eq "${vendor}__${library}_${name}"))
1377
         { push (@components,$name );}
1378
      }
1379 117 jt_eaton
   @components = trim_sort(@components);
1380
   return (@components);
1381
   }
1382
 
1383
 
1384
 
1385
 
1386
#/*********************************************************************************************/
1387 130 jt_eaton
#/  find_component_versions                                                                   */
1388 117 jt_eaton
#/                                                                                            */
1389 130 jt_eaton
#/  returns  array of all versions os a component                                             */
1390 117 jt_eaton
#/                                                                                            */
1391 130 jt_eaton
#/   my @components = yp::lib::find_component_versions($vendor,$library,$component);          */
1392 117 jt_eaton
#/                                                                                            */
1393
#/*********************************************************************************************/
1394
 
1395 130 jt_eaton
sub find_component_versions
1396 117 jt_eaton
   {
1397
   my @params     = @_;
1398 130 jt_eaton
   my $component  = pop(@params);
1399 117 jt_eaton
   my $library    = pop(@params);
1400 130 jt_eaton
   my $vendor     = pop(@params);
1401 117 jt_eaton
 
1402 130 jt_eaton
   my $xml_file;
1403
   my $key;
1404
   my $value;
1405
   my $comp_xml_sep;
1406
   my $version;
1407
 
1408 117 jt_eaton
   my @versions = ();
1409 130 jt_eaton
   my $cursor = $component_db->db_cursor() ;
1410
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
1411
      {
1412
      ( $xml_file,$comp_xml_sep, $version ) = split ':', $value;
1413
      if(($key eq "${vendor}__${library}_${component}_${version}"))
1414
         {
1415
         push (@versions,$version );
1416
         }
1417
      }
1418
   @versions = trim_sort(@versions);
1419
   return (@versions);
1420
   }
1421 117 jt_eaton
 
1422
 
1423 130 jt_eaton
 
1424
 
1425
 
1426
#/************************************************************************************************************************/
1427
#/  find_abstractionDefinition_versions                                                                                  */
1428
#/                                                                                                                       */
1429
#/  returns  array of all versions os a abstractionDefinition                                                            */
1430
#/                                                                                                                       */
1431
#/   my @abstractionDefinitions = yp::lib::find_abstractionDefinition_versions($vendor,$library,$abstractionDefinition); */
1432
#/                                                                                                                       */
1433
#/************************************************************************************************************************/
1434
 
1435
sub find_abstractionDefinition_versions
1436
   {
1437
   my @params     = @_;
1438
   my $abstractionDefinition  = pop(@params);
1439
   my $library    = pop(@params);
1440
   my $vendor     = pop(@params);
1441
 
1442
   my $xml_file;
1443
   my $key;
1444
   my $value;
1445
   my $comp_xml_sep;
1446 131 jt_eaton
   my $design_vendor;
1447
   my $design_library;
1448
   my $design_name;
1449
   my $design_version;
1450 130 jt_eaton
 
1451
   my @versions = ();
1452
   my $cursor = $abstractionDefinition_db->db_cursor() ;
1453
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
1454
      {
1455 131 jt_eaton
      ( $xml_file,$comp_xml_sep, $design_version,$design_name,$design_library,$design_vendor ) = split ':', $value;
1456
      if(($key eq "${vendor}__${library}_${abstractionDefinition}_${design_version}"))
1457 130 jt_eaton
         {
1458 131 jt_eaton
         push (@versions,$design_version );
1459 130 jt_eaton
         }
1460
      }
1461 117 jt_eaton
   @versions = trim_sort(@versions);
1462
   return (@versions);
1463
   }
1464
 
1465
 
1466 131 jt_eaton
#/*********************************************************************************************/
1467
#/  find_abstractionDefinitions                                                                */
1468
#/                                                                                            */
1469
#/  returns  array of all         abstractionDefinitions   vendor__library_abstractionDefinition_version      */
1470
#/                                                                                            */
1471
#/   my @abstractionDefinitions = yp::lib::find_abstractionDefinitions();                     */
1472
#/                                                                                            */
1473
#/*********************************************************************************************/
1474 117 jt_eaton
 
1475
 
1476
 
1477
 
1478 131 jt_eaton
 
1479
 
1480
 
1481
 
1482
 
1483
 
1484
sub find_abstractionDefinitions
1485
   {
1486
   my $key;
1487
   my $value;
1488
   my $type;
1489
   my $name;
1490
   my $path;
1491
 
1492
   my $design_xml_file;
1493
   my $design_xml_sep;
1494
 
1495
   my $design_version;
1496
   my $design_name;
1497
   my $design_library;
1498
   my $design_vendor;
1499
 
1500
 
1501
   my @abstractionDefinitions = ();
1502
 
1503
   my $cursor = $abstractionDefinition_db->db_cursor() ;
1504
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
1505
         {
1506
 
1507
         ( $design_xml_file, $design_xml_sep,$design_version,$design_name,$design_library,$design_vendor ) = split ':', $value;
1508
         push (@abstractionDefinitions,"${design_vendor}:${design_library}:${design_name}:${design_version}" );
1509
         @abstractionDefinitions = trim_sort(@abstractionDefinitions);
1510
         }
1511
         return (@abstractionDefinitions);
1512
   }
1513
 
1514
 
1515 130 jt_eaton
#/************************************************************************************************************************/
1516
#/  find_busDefinition_versions                                                                                  */
1517
#/                                                                                                                       */
1518
#/  returns  array of all versions os a busDefinition                                                            */
1519
#/                                                                                                                       */
1520
#/   my @busDefinitions = yp::lib::find_busDefinition_versions($vendor,$library,$busDefinition); */
1521
#/                                                                                                                       */
1522
#/************************************************************************************************************************/
1523 117 jt_eaton
 
1524 130 jt_eaton
sub find_busDefinition_versions
1525 117 jt_eaton
   {
1526
   my @params     = @_;
1527 130 jt_eaton
   my $busDefinition  = pop(@params);
1528
   my $library    = pop(@params);
1529 117 jt_eaton
   my $vendor     = pop(@params);
1530
 
1531 130 jt_eaton
   my $xml_file;
1532
   my $key;
1533
   my $value;
1534
   my $comp_xml_sep;
1535
   my $version;
1536 117 jt_eaton
 
1537 130 jt_eaton
   my @versions = ();
1538
   my $cursor = $busDefinition_db->db_cursor() ;
1539
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
1540
      {
1541
      ( $xml_file,$comp_xml_sep, $version ) = split ':', $value;
1542
      if(($key eq "${vendor}__${library}_${busDefinition}_${version}"))
1543
         {
1544
         push (@versions,$version );
1545
         }
1546
      }
1547
   @versions = trim_sort(@versions);
1548
   return (@versions);
1549 117 jt_eaton
   }
1550
 
1551 122 jt_eaton
#/*********************************************************************************************/
1552
#/  get_module_name                                                                           */
1553
#/                                                                                            */
1554
#/  returns module name for component                                                         */
1555
#/                                                                                            */
1556
#/   my $module_name = yp::lib::get_module_name($vendor,$library,$component,$version);        */
1557
#/                                                                                            */
1558
#/*********************************************************************************************/
1559 117 jt_eaton
 
1560 122 jt_eaton
sub get_module_name
1561
   {
1562
   my @params     = @_;
1563
   my $version    = pop(@params);
1564
   my $component  = pop(@params);
1565 125 jt_eaton
   my $library    = pop(@params);
1566 122 jt_eaton
   my $vendor     = pop(@params);
1567
 
1568 125 jt_eaton
   my $name_depth =2;
1569 122 jt_eaton
 
1570 125 jt_eaton
   my $parser     = XML::LibXML->new();
1571
 
1572 131 jt_eaton
   my $socgen_component_filename  = yp::lib::find_componentConfiguration($vendor,$library,$component);
1573
   unless($socgen_component_filename)
1574
      {
1575 133 jt_eaton
          return("${component}_${version}");
1576 131 jt_eaton
      }
1577
   my $socgen_component_file  = $parser->parse_file($socgen_component_filename);
1578 125 jt_eaton
 
1579
   foreach my $new_comp ($socgen_component_file->findnodes("//socgen:componentConfiguration"))
1580
     {
1581
     $name_depth        = $new_comp->findnodes('./socgen:ip_name_depth/text()')->to_literal ;
1582
     }
1583 127 jt_eaton
  if($name_depth eq "0"){   return("${library}");}
1584 125 jt_eaton
  if($name_depth eq "1"){   return("${component}");}
1585
  if($name_depth eq "2"){   return("${component}_${version}");}
1586
  if($name_depth eq "3"){   return("${library}_${component}_${version}");}
1587
  if($name_depth eq "4"){   return("${vendor}_${library}_${component}_${version}");}
1588 122 jt_eaton
 
1589
   }
1590
 
1591
 
1592 130 jt_eaton
#/*********************************************************************************************/
1593 125 jt_eaton
#/  parse_component_file                                                                      */
1594
#/                                                                                            */
1595
#/  returns design names for component                                                        */
1596
#/                                                                                            */
1597
#/   my @filelist = yp::lib::parse_component_file($vendor,$library,$component,$version);      */
1598
#/                                                                                            */
1599
#/*********************************************************************************************/
1600 117 jt_eaton
 
1601
 
1602
 
1603 125 jt_eaton
sub parse_component_file
1604
   {
1605
   my @params     = @_;
1606
   my $version    = pop(@params);
1607
   my $component  = pop(@params);
1608
   my $library    = pop(@params);
1609
   my $vendor     = pop(@params);
1610
 
1611
   my $parser     = XML::LibXML->new();
1612
 
1613
 
1614 130 jt_eaton
   my $spirit_cmp_filename =yp::lib::find_ipxact_component($vendor,$library,$component,$version );
1615 125 jt_eaton
 
1616
   unless($spirit_cmp_filename)
1617
      {
1618 126 jt_eaton
      print("spirit:component MISSING   $vendor,$library,$component,$version \n");
1619 125 jt_eaton
      }
1620
 
1621 126 jt_eaton
 
1622 130 jt_eaton
   my $spirit_component_file  = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$library,$component,$version ));
1623 125 jt_eaton
 
1624
 
1625
   my $line;
1626
 
1627
   my      @filelist_acc = (  );
1628
   push(@filelist_acc,"::${vendor}::${library}::${component}::${version}::");
1629
 
1630
   foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
1631
     {
1632
     my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
1633
     my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
1634
     my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
1635
     my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
1636 128 jt_eaton
     my @filelist_sub       = parse_component_fileX($new_vendor,$new_library,$new_name,$new_version);
1637 125 jt_eaton
                              foreach $line (@filelist_sub) { push(@filelist_acc,"$line"); }
1638
     }
1639
 
1640
   foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:hierarchyRef"))
1641
     {
1642
     my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
1643
     my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
1644
     my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
1645
     my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
1646
 
1647 130 jt_eaton
     if(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version ))
1648 125 jt_eaton
             {
1649 130 jt_eaton
             my $spirit_design_file = $parser->parse_file(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version ));
1650 125 jt_eaton
             foreach  my   $i_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:componentRef/\@spirit:vendor"))
1651
                {
1652
                my($vendor_name)         = $i_name  ->to_literal ;
1653
                my($library_name)        = $i_name  ->findnodes('../@spirit:library')->to_literal ;
1654
                my($component_name)      = $i_name  ->findnodes('../@spirit:name')->to_literal ;
1655
                my($version_name)        = $i_name  ->findnodes('../@spirit:version')->to_literal ;
1656
 
1657
                push(@filelist_acc,"::${vendor_name}::${library_name}::${component_name}::${version_name}::");
1658 128 jt_eaton
                my  @filelist_sub = parse_component_fileX($vendor_name,$library_name,$component_name,$version_name);
1659 125 jt_eaton
                  foreach $line (@filelist_sub) { push(@filelist_acc,"$line"); }
1660 130 jt_eaton
                }
1661
             }
1662 125 jt_eaton
     }
1663
 
1664
   @filelist_acc     =       sys::lib::trim_sort(@filelist_acc);
1665
   return(@filelist_acc);
1666
}
1667
 
1668
 
1669
 
1670
 
1671
 
1672 128 jt_eaton
sub parse_component_fileX
1673
   {
1674
   my @params     = @_;
1675
   my $version    = pop(@params);
1676
   my $component  = pop(@params);
1677
   my $library    = pop(@params);
1678
   my $vendor     = pop(@params);
1679 125 jt_eaton
 
1680 128 jt_eaton
   my $parser     = XML::LibXML->new();
1681 125 jt_eaton
 
1682 128 jt_eaton
 
1683 130 jt_eaton
   my $spirit_cmp_filename =yp::lib::find_ipxact_component($vendor,$library,$component,$version );
1684 128 jt_eaton
 
1685
   unless($spirit_cmp_filename)
1686
      {
1687
      print("spirit:component MISSING   $vendor,$library,$component,$version \n");
1688
      }
1689
 
1690
 
1691 130 jt_eaton
   my $spirit_component_file  = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$library,$component,$version ));
1692 128 jt_eaton
 
1693
 
1694
   my $line;
1695
 
1696
   my      @filelist_acc = (  );
1697 130 jt_eaton
 
1698 128 jt_eaton
 
1699
   foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
1700
     {
1701
     my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
1702
     my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
1703
     my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
1704
     my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
1705
     my @filelist_sub       = parse_component_fileX($new_vendor,$new_library,$new_name,$new_version);
1706
                              foreach $line (@filelist_sub) { push(@filelist_acc,"$line"); }
1707
     }
1708
 
1709
   foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:hierarchyRef"))
1710
     {
1711
     my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
1712
     my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
1713
     my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
1714
     my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
1715
 
1716 130 jt_eaton
     if(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version ))
1717
          {
1718
          my $spirit_design_file = $parser->parse_file(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version ));
1719
          foreach  my   $i_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:componentRef/\@spirit:vendor"))
1720 128 jt_eaton
                {
1721
                my($vendor_name)         = $i_name  ->to_literal ;
1722
                my($library_name)        = $i_name  ->findnodes('../@spirit:library')->to_literal ;
1723
                my($component_name)      = $i_name  ->findnodes('../@spirit:name')->to_literal ;
1724
                my($version_name)        = $i_name  ->findnodes('../@spirit:version')->to_literal ;
1725
 
1726
                push(@filelist_acc,"::${vendor_name}::${library_name}::${component_name}::${version_name}::");
1727
                my  @filelist_sub = parse_component_fileX($vendor_name,$library_name,$component_name,$version_name);
1728
                  foreach $line (@filelist_sub) { push(@filelist_acc,"$line"); }
1729
                }
1730 130 jt_eaton
 
1731 128 jt_eaton
           }
1732
     }
1733
 
1734
   @filelist_acc     =       sys::lib::trim_sort(@filelist_acc);
1735
   return(@filelist_acc);
1736
}
1737
 
1738
 
1739
 
1740
 
1741
 
1742
 
1743
#/*********************************************************************************************/
1744
#/  parse_component_brothers                                                                  */
1745
#/                                                                                            */
1746
#/  returns names for component brothers                                                      */
1747
#/                                                                                            */
1748
#/   my @filelist = yp::lib::parse_component_brother($vendor,$library,$component,$version);   */
1749
#/                                                                                            */
1750
#/*********************************************************************************************/
1751
 
1752
sub parse_component_brothers
1753
   {
1754
   my @params     = @_;
1755
   my $version    = pop(@params);
1756
   my $component  = pop(@params);
1757
   my $library    = pop(@params);
1758
   my $vendor     = pop(@params);
1759
 
1760
   my $parser     = XML::LibXML->new();
1761 130 jt_eaton
   unless (yp::lib::find_ipxact_component($vendor,$library,$component,$version)){print "Missing Component  $vendor, $library, $component, $version \n";  }
1762
   my $spirit_component_file  = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$library,$component,$version ));
1763 128 jt_eaton
 
1764
   my $line;
1765
   my      @filelist_acc = (  );
1766
   push(@filelist_acc,"::${vendor}::${library}::${component}::${version}::");
1767
 
1768
   foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
1769
     {
1770
     my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
1771
     my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
1772
     my($new_component)     = $new_comp->findnodes('./@spirit:name')->to_literal ;
1773
     my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
1774
     push(@filelist_acc,"::${new_vendor}::${new_library}::${new_component}::${new_version}::");
1775
     }
1776
 
1777
   return(@filelist_acc);
1778
}
1779
 
1780 125 jt_eaton
#/*****************************************************************************************************/
1781
#/  find_ipxact_design_files                                                                          */
1782
#/                                                                                                    */
1783
#/  returns parser tokens  to ip-xact design files referred to by component file vlnv                 */
1784
#/                                                                                                    */
1785
#/  my @spirit_design_files = yp::lib::find_ipxact_design_file($vendor,$library,$component,$version);  */
1786
#/                                                                                                    */
1787
#/*****************************************************************************************************/
1788
 
1789
sub find_ipxact_design_files
1790
   {
1791
   my @params     = @_;
1792
   my $version    = pop(@params);
1793
   my $component  = pop(@params);
1794 130 jt_eaton
   my $library    = pop(@params);
1795 125 jt_eaton
   my $vendor     = pop(@params);
1796
 
1797
 
1798
   my @design_files = ();
1799
   my $parser           = XML::LibXML->new();
1800 130 jt_eaton
   unless (yp::lib::find_ipxact_component($vendor,$library,$component,$version)){print "Missing Component  $vendor, $library, $component, $version \n";  }
1801
   my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$library,$component,$version));
1802 125 jt_eaton
 
1803
   foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
1804
     {
1805
     my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
1806
     my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
1807
     my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
1808
     my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
1809
     my @filelist_sub       = yp::lib::find_ipxact_design_files($new_vendor,$new_library,$new_name,$new_version);
1810 130 jt_eaton
                              foreach my $line (@filelist_sub) { push(@design_files,"$line"); }     }
1811 125 jt_eaton
 
1812
   foreach my $comp_view ($spirit_component_file->findnodes('//spirit:component/spirit:model/spirit:views/spirit:view'))
1813
      {
1814
      my($hier_ref_vendor)         = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:vendor')->to_literal ;
1815
      my($hier_ref_library)        = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:library')->to_literal ;
1816 130 jt_eaton
      my($hier_ref_design)         = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:name')->to_literal ;
1817 125 jt_eaton
      my($hier_ref_version)        = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:version')->to_literal ;
1818 130 jt_eaton
      if(find_ipxact_design($hier_ref_vendor,$hier_ref_library,$hier_ref_design,$hier_ref_version))
1819
        {
1820
        push(@design_files,":::${hier_ref_vendor}:::${hier_ref_library}:::${hier_ref_design}:::${hier_ref_version}:::");
1821
        }
1822 125 jt_eaton
      }
1823 130 jt_eaton
     return(@design_files);
1824
   }
1825 125 jt_eaton
 
1826 130 jt_eaton
sub trim_sort {
1827
   my @output_files  = @_;
1828
   my %trim = ();
1829
   foreach my $descriptor (@output_files) { $trim{$descriptor}  = 1; }
1830
   my @k = keys %trim;
1831
   @output_files =  sort(sort @k);
1832
   return(@output_files);
1833 125 jt_eaton
   }
1834
 
1835
 
1836 117 jt_eaton
1;

powered by: WebSVN 2.1.0

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