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

Subversion Repositories socgen

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

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 134 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,config); */
262
#/                                                                                                            */
263
#/*************************************************************************************************************/
264
 
265
sub get_io_busses_db_filename
266
   {
267
   my @params     = @_;
268
   my $config     = pop(@params);
269
   my $version    = pop(@params);
270
   my $component  = pop(@params);
271
   my $library    = pop(@params);
272
   my $vendor     = pop(@params);
273
   my $main_module_name = yp::lib::get_module_name($vendor,$library,$component,$version) ;
274
   my $io_busses_db_filename;
275
 
276
   if(defined $config && length $config > 0)
277
   {
278
   $io_busses_db_filename = "${home}/${io_ports}/${vendor}__${library}/${component}/${main_module_name}/BUSSES.dbm";
279
   }
280
   else
281
   {
282
   $io_busses_db_filename = "${home}/${io_ports}/${vendor}__${library}/${component}/${main_module_name}/${config}/BUSSES.dbm";
283
   }
284
 
285
 
286
   if(-e ${io_busses_db_filename } )
287
     {
288
     return("${io_busses_db_filename}");
289
     }
290
   my $cmd = "./tools/verilog/gen_ports    -vendor $vendor -library  $library  -component $component  -version $version   ";
291
   if (system($cmd)) {}
292
   return("${io_busses_db_filename}");
293
   }
294
 
295
 
296
 
297 133 jt_eaton
#/******************************************************************************************************/
298 134 jt_eaton
#/  get_io_busses_name_db_filename                                                                     */
299 133 jt_eaton
#/                                                                                                     */
300 134 jt_eaton
#/  returns full path name to io_busses database named filename                                        */
301 133 jt_eaton
#/                                                                                                     */
302 134 jt_eaton
#/  my $io_busses_filename = yp::lib::get_io_busses_name_db_filename($vendor,$library,$component,$version); */
303 133 jt_eaton
#/                                                                                                     */
304
#/******************************************************************************************************/
305 131 jt_eaton
 
306 134 jt_eaton
sub get_io_busses_named_db_filename
307 131 jt_eaton
   {
308
   my @params     = @_;
309 134 jt_eaton
   my $name       = pop(@params);
310 131 jt_eaton
   my $version    = pop(@params);
311
   my $component  = pop(@params);
312
   my $library    = pop(@params);
313
   my $vendor     = pop(@params);
314
   my $main_module_name = yp::lib::get_module_name($vendor,$library,$component,$version) ;
315 134 jt_eaton
   my $io_busses_db_filename = "${home}/${io_ports}/${vendor}__${library}/${component}/${main_module_name}_${name}/BUSSES.dbm";
316 131 jt_eaton
 
317
   if(-e ${io_busses_db_filename } )
318
     {
319
     return("${io_busses_db_filename}");
320
     }
321
   my $cmd = "./tools/verilog/gen_ports    -vendor $vendor -library  $library  -component $component  -version $version   ";
322
   if (system($cmd)) {}
323
   return("${io_busses_db_filename}");
324
   }
325
 
326
 
327
 
328
 
329
 
330 133 jt_eaton
#/***********************************************************************************************************/
331
#/  get_elab_db_filename                                                                                    */
332
#/                                                                                                          */
333
#/  returns full path name to elab database filename                                                        */
334
#/                                                                                                          */
335
#/  my $elab_filename = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,$configuration); */
336
#/                                                                                                          */
337
#/***********************************************************************************************************/
338 131 jt_eaton
 
339 133 jt_eaton
sub get_elab_db_filename
340
   {
341
   my @params     = @_;
342
   my $configuration    = pop(@params);
343
   my $version    = pop(@params);
344
   my $component  = pop(@params);
345
   my $library    = pop(@params);
346
   my $vendor     = pop(@params);
347
 
348
   my $elab_db_filename;
349 131 jt_eaton
 
350 134 jt_eaton
   mkdir "${home}/dbs",0755  unless (-e "${home}/dbs" );
351
 
352
   if($configuration eq "xxxxxx")
353 133 jt_eaton
   {
354
    $elab_db_filename = "${home}/dbs/${vendor}_${library}_${component}_${version}.db";
355
   }
356
   else
357
   {
358
    $elab_db_filename = "${home}/dbs/${vendor}_${library}_${component}_${version}_${configuration}.db";
359
   }
360
 
361
   return("${elab_db_filename}");
362
   }
363
 
364
 
365
 
366
 
367 134 jt_eaton
#/***********************************************************************************************************/
368
#/  get_design_db_file                                                                                      */
369
#/                                                                                                          */
370
#/  returns full path name to design database filename                                                      */
371
#/                                                                                                          */
372
#/  my $design_db_file = yp::lib::get_design_db_file;  */
373
#/                                                                                                          */
374
#/***********************************************************************************************************/
375 133 jt_eaton
 
376 134 jt_eaton
sub get_design_db_file
377
   {
378 133 jt_eaton
 
379 134 jt_eaton
   mkdir "${home}/dbs",0755  unless (-e "${home}/dbs" );
380
   return("${home}/dbs/design.dbm");
381
   }
382 133 jt_eaton
 
383 134 jt_eaton
 
384
 
385
 
386
 
387
 
388 131 jt_eaton
#/***************************************************************************************************/
389 134 jt_eaton
#/  get_component configs                                                                           */
390
#/                                                                                                  */
391
#/  returns array of config_n's for component                                                       */
392
#/                                                                                                  */
393
#/  my @configs  = yp::lib::get_component_configs($vendor,$library,$component,$version);            */
394
#/                                                                                                  */
395
#/***************************************************************************************************/
396
 
397
sub get_component_configs
398
   {
399
   my @params     = @_;
400
   my $version    = pop(@params);
401
   my $component  = pop(@params);
402
   my $library    = pop(@params);
403
   my $vendor     = pop(@params);
404
 
405
   my $main_module_name = yp::lib::get_module_name($vendor,$library,$component,$version) ;
406
   my $Config_db_file = "${io_ports}/${vendor}__${library}/${component}/${main_module_name}/Config.db";
407
 
408
   unless(-e $Config_db_file  ){return();}
409
 
410
   my  $config_db   = new BerkeleyDB::Hash( -Filename => $Config_db_file, -Flags => DB_CREATE ) or die "Cannot open ${Config_db_file}: $!";
411
   my  @configs  = ();
412
   my  $key;
413
   my  $value;
414
   my  $port_cursor = $config_db->db_cursor() ;
415
       while ($port_cursor->c_get($key, $value, DB_NEXT) == 0)
416
          {
417
          push (@configs, $key);
418
          }
419
   my  $status = $port_cursor->c_close() ;
420
       $config_db   -> db_close();
421
   return(@configs);
422
 
423
   }
424
 
425
 
426
 
427
 
428
 
429
 
430
 
431
 
432
#/***************************************************************************************************/
433 131 jt_eaton
#/  get_signals                                                                                     */
434
#/                                                                                                  */
435
#/  returns array of all signals in a component                                                     */
436
#/                                                                                                  */
437
#/  my @signals  = yp::lib::get_signals($vendor,$library,$component,$version);                      */
438
#/                                                                                                  */
439
#/***************************************************************************************************/
440
 
441
sub get_signals
442
   {
443
   my @params     = @_;
444
   my $version    = pop(@params);
445
   my $component  = pop(@params);
446
   my $library    = pop(@params);
447
   my $vendor     = pop(@params);
448
 
449 133 jt_eaton
   my $io_ports_db_filename = yp::lib::get_io_ports_db_filename($vendor,$library,$component,$version);
450 131 jt_eaton
   unless (-e ${io_ports_db_filename } )
451
      {
452
 
453
      my $cmd = "./tools/verilog/gen_ports    -vendor $vendor -library  $library  -component $component  -version $version   ";
454
      if (system($cmd)) {}
455
         $cmd = "./tools/verilog/gen_signals  -vendor $vendor -library  $library  -component $component  -version $version   ";
456
      if (system($cmd)) {}
457
      }
458
 
459
 
460
 
461
   my  $ports_db   = new BerkeleyDB::Hash( -Filename => $io_ports_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${io_ports_db_filename}: $!";
462
   my  @signals  = ();
463
   my  $key;
464
   my  $value;
465
   my  $port_cursor = $ports_db->db_cursor() ;
466
       while ($port_cursor->c_get($key, $value, DB_NEXT) == 0)
467
          {
468
 
469
          push (@signals, $value);
470
          }
471
   my  $status = $port_cursor->c_close() ;
472
 
473
       @signals      = sys::lib::trim_sort(@signals);
474 134 jt_eaton
 
475
       $ports_db   -> db_close();
476 131 jt_eaton
   return(@signals);
477
   }
478
 
479
 
480
 
481
 
482
 
483 133 jt_eaton
 
484
 
485 131 jt_eaton
#/***************************************************************************************************/
486 133 jt_eaton
#/  get_Parameters                                                                                  */
487
#/                                                                                                  */
488
#/  returns array of all instance parameters in a component                                         */
489
#/                                                                                                  */
490
#/  my @parameters  = yp::lib::get_Parameters($vendor,$library,$component,$version,$instance,$configuration);      */
491
#/                                                                                                  */
492
#/***************************************************************************************************/
493
 
494
sub get_Parameters
495
   {
496
   my @params     = @_;
497
   my $configuration = pop(@params);
498
   my $instance   = pop(@params);
499
   my $version    = pop(@params);
500
   my $component  = pop(@params);
501
   my $library    = pop(@params);
502
   my $vendor     = pop(@params);
503
   my $elab_db_filename = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,$configuration);
504
   my  $ports_db   = new BerkeleyDB::Hash( -Filename => $elab_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${elab_db_filename}: $!";
505
   my  @parameters  = ();
506
   my  $key;
507
   my  $value;
508
   my  $port_cursor = $ports_db->db_cursor() ;
509
       while ($port_cursor->c_get($key, $value, DB_NEXT) == 0)
510
          {
511
          my $parameter_root;
512
          my $parameter;
513
          ( $parameter_root,$parameter) = split( /\__/ , $key);
514
          if($parameter_root eq "Parameter_${instance}")
515
            {
516
            push (@parameters, "${parameter}::${value}");
517
            }
518
          }
519
 
520
   my  $status = $port_cursor->c_close() ;
521 134 jt_eaton
       $ports_db   -> db_close();
522 133 jt_eaton
       @parameters      = sys::lib::trim_sort(@parameters);
523
   return(@parameters);
524
   }
525
 
526
 
527
 
528
 
529
#/***************************************************************************************************/
530
#/  get_parameters                                                                                  */
531
#/                                                                                                  */
532
#/  returns array of all parameters in a component                                                  */
533
#/                                                                                                  */
534
#/  my @parameters  = yp::lib::get_parameters($vendor,$library,$component,$version,$configuration);                */
535
#/                                                                                                  */
536
#/***************************************************************************************************/
537
 
538
sub get_parameters
539
   {
540
   my @params     = @_;
541
   my $configuration    = pop(@params);
542
   my $version    = pop(@params);
543
   my $component  = pop(@params);
544
   my $library    = pop(@params);
545
   my $vendor     = pop(@params);
546
   my $elab_db_filename = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,$configuration);
547
   my  $ports_db   = new BerkeleyDB::Hash( -Filename => $elab_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${elab_db_filename}: $!";
548
   my  @parameters  = ();
549
   my  $key;
550
   my  $value;
551
   my  $port_cursor = $ports_db->db_cursor() ;
552
       while ($port_cursor->c_get($key, $value, DB_NEXT) == 0)
553
          {
554
          my $parameter_root;
555
          my $parameter;
556
          ( $parameter_root,$parameter) = split( /\__/ , $key);
557
          if($parameter_root eq "parameter_root")
558
            {
559
            push (@parameters, "${parameter}::${value}");
560
            }
561
          }
562
 
563
   my  $status = $port_cursor->c_close() ;
564 134 jt_eaton
       $ports_db   -> db_close();
565 133 jt_eaton
       @parameters      = sys::lib::trim_sort(@parameters);
566
   return(@parameters);
567
   }
568
 
569
 
570
 
571
 
572
 
573
 
574
#/***************************************************************************************************/
575
#/  get_instance_names                                                                              */
576
#/                                                                                                  */
577
#/  returns array of all instance_names in a component                                              */
578
#/                                                                                                  */
579
#/  my @instance_names  = yp::lib::get_instance_names($vendor,$library,$component,$version,$configuration);        */
580
#/                                                                                                  */
581
#/***************************************************************************************************/
582
 
583
sub get_instance_names
584
   {
585
   my @params     = @_;
586
   my $configuration    = pop(@params);
587
   my $version    = pop(@params);
588
   my $component  = pop(@params);
589
   my $library    = pop(@params);
590
   my $vendor     = pop(@params);
591
   my $elab_db_filename = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,$configuration);
592
   my  $ports_db   = new BerkeleyDB::Hash( -Filename => $elab_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${elab_db_filename}: $!";
593
   my  @instance_names  = ();
594
   my  $field1;
595
   my  $field2;
596
   my  $key;
597
   my  $value;
598
 
599 134 jt_eaton
 
600 133 jt_eaton
   my  $port_cursor = $ports_db->db_cursor() ;
601
       while ($port_cursor->c_get($key, $value, DB_NEXT) == 0)
602
          {
603
          ( $field1,$field2) = split( /\./ , $key);
604
 
605
 
606
          if(($field1 eq "component___root")&& ($key eq "${field1}.${field2}"   )  )
607
            {
608
 
609
            push (@instance_names, "${field2}");
610
            }
611
          }
612
 
613
   my  $status = $port_cursor->c_close() ;
614 134 jt_eaton
       $ports_db   -> db_close();
615 133 jt_eaton
       @instance_names      = sys::lib::trim_sort(@instance_names);
616
   return(@instance_names);
617
   }
618
 
619
 
620
 
621
#/***********************************************************************************************************/
622
#/  get_instance_module_name                                                                                */
623
#/                                                                                                          */
624 134 jt_eaton
#/  returns the module name of an instance                                                                  */
625 133 jt_eaton
#/                                                                                                          */
626
#/  my $module_name  = yp::lib::get_instance_module_name($vendor,$library,$component,$version,$instance,$configuration );  */
627
#/                                                                                                          */
628
#/***********************************************************************************************************/
629
 
630
sub get_instance_module_name
631
   {
632
   my @params     = @_;
633
   my $configuration   = pop(@params);
634
   my $instance   = pop(@params);
635
   my $version    = pop(@params);
636
   my $component  = pop(@params);
637
   my $library    = pop(@params);
638
   my $vendor     = pop(@params);
639
   my $elab_db_filename = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,$configuration);
640
   my $elab_db   = new BerkeleyDB::Hash( -Filename => $elab_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${elab_db_filename}: $!";
641
   my $module_name;
642
   my $module_vlnv;
643
   my $module_vendor;
644
   my $module_library;
645
   my $module_component;
646
   my $module_version;
647
   $elab_db->db_get("component___root.${instance}", $module_vlnv );
648
   ( $module_vendor,$module_library,$module_component,$module_version) = split( /\:/ , $module_vlnv);
649
     $module_name = yp::lib::get_module_name($module_vendor,$module_library,$module_component,$module_version) ;
650 134 jt_eaton
       $elab_db   -> db_close();
651 133 jt_eaton
   return($module_name);
652
   }
653
 
654
 
655
 
656
 
657 134 jt_eaton
#/*************************************************************************************************************/
658
#/  get_instance_vlnvc                                                                                        */
659
#/                                                                                                            */
660
#/  returns the ven,lib,cmp,ver,cfg  name for a components instance                                           */
661
#/                                                                                                            */
662
#/  my $vlnvc  = yp::lib::get_instance_vlnvc($vendor,$library,$component,$version,$instance,$configuration ); */
663
#/                                                                                                            */
664
#/*************************************************************************************************************/
665 133 jt_eaton
 
666 134 jt_eaton
sub get_instance_vlnvc
667
   {
668
   my @params     = @_;
669
   my $configuration     = pop(@params);
670
   my $instance          = pop(@params);
671
   my $version           = pop(@params);
672
   my $component         = pop(@params);
673
   my $library           = pop(@params);
674
   my $vendor            = pop(@params);
675
   my $elab_db_filename  = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,$configuration);
676
   my $elab_db           = new BerkeleyDB::Hash( -Filename => $elab_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${elab_db_filename}: $!";
677 133 jt_eaton
 
678 134 jt_eaton
   my $module_vlnv;
679
 
680
   $elab_db->db_get("component___root.${instance}", $module_vlnv );
681
       $elab_db   -> db_close();
682
   return($module_vlnv);
683
   }
684
 
685
 
686
 
687
 
688
 
689
 
690 133 jt_eaton
#/*********************************************************************************************************/
691
#/  get_instance_conns                                                                                    */
692
#/                                                                                                        */
693
#/  returns array of all connections to an instance                                                       */
694
#/                                                                                                        */
695
#/  my @inst_conns  = yp::lib::get_instance_conns($vendor,$library,$component,$version,$instance);        */
696
#/                                                                                                        */
697
#/*********************************************************************************************************/
698
 
699
sub get_instance_conns
700
   {
701
   my @params     = @_;
702
   my $instance   = pop(@params);
703
   my $version    = pop(@params);
704
   my $component  = pop(@params);
705
   my $library    = pop(@params);
706
   my $vendor     = pop(@params);
707
 
708 134 jt_eaton
   my $io_busses_db_filename = yp::lib::get_io_busses_db_filename($vendor,$library,$component,$version,"default");
709 133 jt_eaton
 
710
 
711
 
712
 
713
   unless (-e ${io_busses_db_filename } )
714
      {
715
 
716
      my $cmd = "./tools/verilog/gen_ports    -vendor $vendor -library  $library  -component $component  -version $version   ";
717
      if (system($cmd)) {}
718
         $cmd = "./tools/verilog/gen_signals  -vendor $vendor -library  $library  -component $component  -version $version   ";
719
      if (system($cmd)) {}
720
      }
721
 
722
 
723
 
724
   my  $ports_db   = new BerkeleyDB::Hash( -Filename => $io_busses_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${io_busses_db_filename}: $!";
725
   my  @inst_conns  = ();
726
   my  $key;
727
   my  $value;
728
   my  $port_cursor = $ports_db->db_cursor() ;
729
       while ($port_cursor->c_get($key, $value, DB_NEXT) == 0)
730
          {
731
          my $Instance;
732
          my $instance_name;
733
          my $instance_busref;
734
          ( $Instance,$instance_name,$instance_busref) = split( /\./ , $key);
735
          if(($Instance eq "Instance")&& ($instance eq $instance_name))
736
            {
737
            my $new_key;
738
            my $new_value;
739
            my  $bus_cursor = $ports_db->db_cursor() ;
740
          while ($bus_cursor->c_get($new_key, $new_value, DB_NEXT) == 0)
741
          {
742
          my $IXstance;
743
          my $IX_inst;
744
          my $IX_busref;
745
          my $IX_port;
746
          ( $IXstance,$IX_inst,$IX_busref,$IX_port) = split( /\./ , $new_key);
747
          if(($IXstance eq "IXstance") && ($IX_inst eq $instance_name) &&($IX_busref eq $instance_busref) )
748
            {
749
            my $logname;
750
            my $direction;
751
            my $wire;
752
            my $vector;
753
            my $left;
754
            my $right;
755
            my $port;
756
            ($logname,$direction,$wire,$vector,$left,$right,$port ) = split( /\:/ , $new_value);
757
            my $type;
758
            my $signal;
759
 
760
            $ports_db->db_get("BusRef.${value}.${IX_port}", $new_value );
761
 
762
 
763
            ($logname,$type,$wire,$vector,$left,$right,$signal ) = split( /\:/ , $new_value);
764
 
765
 
766
               if($vector eq "vector")
767
                {
768
                push (@inst_conns, ".${port}      ( ${signal}[${left}:${right}]  )");
769
                }
770
               else
771
                {
772
                push (@inst_conns, ".${port}      ( ${signal}  )");
773
                }
774
            }
775
          }
776
          my  $status = $bus_cursor->c_close() ;
777
 
778
 
779
 
780
 
781
 
782
 
783
            }
784
          }
785
   my  $status = $port_cursor->c_close() ;
786 134 jt_eaton
       $ports_db   -> db_close();
787 133 jt_eaton
       @inst_conns      = sys::lib::trim_sort(@inst_conns);
788
   return(@inst_conns);
789
   }
790
 
791
 
792
 
793
 
794
#/*********************************************************************************************************/
795
#/  get_instance_adhoc_conns                                                                                    */
796
#/                                                                                                        */
797
#/  returns array of all connections to an instance                                                       */
798
#/                                                                                                        */
799
#/  my @inst_conns  = yp::lib::get_instance_adhoc_conns($vendor,$library,$component,$version,$instance);  */
800
#/                                                                                                        */
801
#/*********************************************************************************************************/
802
 
803
sub get_instance_adhoc_conns
804
   {
805
   my @params     = @_;
806
   my $instance   = pop(@params);
807
   my $version    = pop(@params);
808
   my $component  = pop(@params);
809
   my $library    = pop(@params);
810
   my $vendor     = pop(@params);
811
 
812 134 jt_eaton
   my $io_busses_db_filename = yp::lib::get_io_busses_db_filename($vendor,$library,$component,$version,"default");
813 133 jt_eaton
 
814
   unless (-e ${io_busses_db_filename } )
815
      {
816
 
817
      my $cmd = "./tools/verilog/gen_ports    -vendor $vendor -library  $library  -component $component  -version $version   ";
818
      if (system($cmd)) {}
819
         $cmd = "./tools/verilog/gen_signals  -vendor $vendor -library  $library  -component $component  -version $version   ";
820
      if (system($cmd)) {}
821
      }
822
 
823
 
824
 
825
   my  $ports_db   = new BerkeleyDB::Hash( -Filename => $io_busses_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${io_busses_db_filename}: $!";
826
   my  @inst_conns  = ();
827
   my  $key;
828
   my  $value;
829
   my  $port_cursor = $ports_db->db_cursor() ;
830
       while ($port_cursor->c_get($key, $value, DB_NEXT) == 0)
831
          {
832
 
833
          my $adhoc_inst;
834
          my $port;
835
          ( $adhoc_inst,$port) = split( /\__/ , $key);
836
          if($adhoc_inst eq "AdHoc_${instance}")
837
             {
838
                 my $sig1;
839
                 my $sig2;
840
                 my $wire;
841
                 my $vector;
842
                 my $left;
843
                 my $right;
844
 
845
 
846
 
847
          ( $sig1,$sig2,$wire,$vector,$left,$right) = split( /\:/ , $value);
848
 
849
                 if($sig1 eq "***") {$sig1 = "   ";}
850
              if($vector eq "vector")
851
              {
852
               push (@inst_conns, " .${port}      ( ${sig1}[${left}:${right}] )");
853
              }
854
              else
855
              {
856
               push (@inst_conns, " .${port}      ( ${sig1}  )");
857
              }
858
 
859
             }
860
 
861
          }
862
   my  $status = $port_cursor->c_close() ;
863 134 jt_eaton
       $ports_db   -> db_close();
864 133 jt_eaton
       @inst_conns      = sys::lib::trim_sort(@inst_conns);
865
   return(@inst_conns);
866
   }
867
 
868
 
869
 
870
 
871
 
872
 
873
 
874
 
875
#/***************************************************************************************************/
876 131 jt_eaton
#/  get_busses                                                                                     */
877
#/                                                                                                  */
878
#/  returns array of all busses in a component                                                     */
879
#/                                                                                                  */
880
#/  my @signals  = yp::lib::get_busses($vendor,$library,$component,$version);                      */
881
#/                                                                                                  */
882
#/***************************************************************************************************/
883
 
884
sub get_busses
885
   {
886
   my @params     = @_;
887
   my $version    = pop(@params);
888
   my $component  = pop(@params);
889
   my $library    = pop(@params);
890
   my $vendor     = pop(@params);
891
 
892
 
893 134 jt_eaton
   my $io_busses_db_filename = yp::lib::get_io_busses_db_filename($vendor,$library,$component,$version,"default");
894 133 jt_eaton
 
895 131 jt_eaton
   unless (-e ${io_busses_db_filename } )
896
      {
897
 
898
      my $cmd = "./tools/verilog/gen_ports    -vendor $vendor -library  $library  -component $component  -version $version   ";
899
      if (system($cmd)) {}
900
      }
901
 
902
   my  $ports_db   = new BerkeleyDB::Hash( -Filename => $io_busses_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${io_busses_db_filename}: $!";
903
   my  @busses  = ();
904
   my  $key;
905
   my  $value;
906
   my  ${key_type};
907
   my  ${busref};
908
   my  ${conn};
909
   my  ${log_name};
910
   my  ${direction};
911
   my  ${type};
912
   my  ${vector};
913
   my  ${left};
914
   my  ${right};
915
   my  ${phy_name};
916
   my  $port_cursor = $ports_db->db_cursor() ;
917
       while ($port_cursor->c_get($key, $value, DB_NEXT) == 0)
918
          {
919
          ( ${key_type},${busref},${conn}) = split( /\./ , $key);
920
          ( ${log_name},${direction},${type},${vector},${left},${right},${phy_name}) = split ':', $value;
921
 
922
           if(($key_type eq "BusRef"))
923
              {
924
              push (@busses,  "${busref}:::${conn}:::${phy_name}:::${log_name}:::${direction}:::${type}:::${vector}:::${left}:::${right}");
925
              }
926
          }
927
   my  $status = $port_cursor->c_close() ;
928 134 jt_eaton
       $ports_db   -> db_close();
929 131 jt_eaton
   @busses      = sys::lib::trim_sort(@busses);
930
   return(@busses);
931
   }
932
 
933
 
934 134 jt_eaton
 
935 131 jt_eaton
#/***************************************************************************************************/
936 134 jt_eaton
#/  get_files                                                                                       */
937
#/                                                                                                  */
938
#/  returns array of all verilog usertypes in a component                                           */
939
#/                                                                                                  */
940
#/  my @fragments  = yp::lib::get_fragments($vendor,$library,$component,$version,$fileSet_name);    */
941
#/                                                                                                  */
942
#/***************************************************************************************************/
943
 
944
sub get_files
945
   {
946
   my @params     = @_;
947
   my $userType       = pop(@params);
948
   my $fileSet_name   = pop(@params);
949
   my $version        = pop(@params);
950
   my $component      = pop(@params);
951
   my $library        = pop(@params);
952
   my $vendor         = pop(@params);
953
   my $elab_db_filename = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,"default");
954
   my  $elab_db   = new BerkeleyDB::Hash( -Filename => $elab_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${elab_db_filename}: $!";
955
   my  @files  = ();
956
   my  $key;
957
   my  $value;
958
   my  $port_cursor = $elab_db->db_cursor() ;
959
       while ($port_cursor->c_get($key, $value, DB_NEXT) == 0)
960
          {
961
          my $FILE_root;
962
          my $fragment;
963
          ( $FILE_root,$fragment) = split( /\__/ , $key);
964
          if($FILE_root eq "FILE_verilogSource_${fileSet_name}_${userType}")
965
            {
966
            push (@files, "${value}");
967
            }
968
          }
969
 
970
   my  $status = $port_cursor->c_close() ;
971
       $elab_db   -> db_close();
972
       @files      = sys::lib::trim_sort(@files);
973
   return(@files);
974
   }
975
 
976
 
977
 
978
 
979
 
980
 
981
 
982
#/***************************************************************************************************/
983 131 jt_eaton
#/  get_absDef_db_filename                                                                          */
984
#/                                                                                                  */
985
#/  returns full path name to abstractionDefinition database filename                               */
986
#/                                                                                                  */
987
#/  my $absDef_filename = yp::lib::get_absDef_db_filename($vendor,$library,$component,$version);    */
988
#/                                                                                                  */
989
#/***************************************************************************************************/
990
 
991
sub get_absDef_db_filename
992
   {
993
   my @params     = @_;
994
   my $version    = pop(@params);
995
   my $component  = pop(@params);
996
   my $library    = pop(@params);
997
   my $vendor     = pop(@params);
998
   my $absDef_db_filename = "${io_ports}/${vendor}__${library}/${component}/${component}_${version}_ABSDEF.dbm";
999
 
1000
   if(-e ${absDef_db_filename } )
1001
     {
1002
     return("${absDef_db_filename}");
1003
     }
1004
   my $cmd = "./tools/busdefs/gen_busdef    -vendor $vendor -library $library  -component $component  -version $version   ";
1005
   if (system($cmd)) {}
1006
 
1007
   return("${absDef_db_filename}");
1008
   }
1009
 
1010
 
1011
 
1012
 
1013
 
1014
 
1015
 
1016
 
1017
 
1018
#/***********************************************************************************************/
1019 130 jt_eaton
#/  find_ipxact_component                                                                       */
1020 118 jt_eaton
#/                                                                                              */
1021 130 jt_eaton
#/  returns full path name to ip-xact component file                                            */
1022 118 jt_eaton
#/                                                                                              */
1023 130 jt_eaton
#/  my $spirit_type_file = yp::lib::find_ipxact_component($vendor,$library,$component,$version);*/
1024 118 jt_eaton
#/                                                                                              */
1025
#/***********************************************************************************************/
1026 117 jt_eaton
 
1027 130 jt_eaton
sub find_ipxact_component
1028 117 jt_eaton
   {
1029
   my @params     = @_;
1030
   my $version    = pop(@params);
1031
   my $component  = pop(@params);
1032 130 jt_eaton
   my $library    = pop(@params);
1033 117 jt_eaton
   my $vendor     = pop(@params);
1034 130 jt_eaton
   my $comp_data;
1035
   my $component_version;
1036
   my $component_xml;
1037
   my $comp_xml_sep;
1038
      $component_db->db_get("${vendor}__${library}_${component}_${version}", $comp_data );
1039
      ( $component_xml, $comp_xml_sep,$component_version ) = split ':', $comp_data;
1040 117 jt_eaton
 
1041 130 jt_eaton
      return("$component_xml");
1042 118 jt_eaton
   }
1043
 
1044
 
1045
 
1046 130 jt_eaton
#/***********************************************************************************************/
1047
#/  find_ipxact_design                                                                          */
1048
#/                                                                                              */
1049
#/  returns full path name to ip-xact design file                                               */
1050
#/                                                                                              */
1051
#/  my $spirit_type_file = yp::lib::find_ipxact_design($vendor,$library,$component,$version);   */
1052
#/                                                                                              */
1053
#/***********************************************************************************************/
1054 118 jt_eaton
 
1055 130 jt_eaton
sub find_ipxact_design
1056 117 jt_eaton
   {
1057
   my @params     = @_;
1058
   my $version    = pop(@params);
1059
   my $component  = pop(@params);
1060 130 jt_eaton
   my $library    = pop(@params);
1061 117 jt_eaton
   my $vendor     = pop(@params);
1062 130 jt_eaton
   my $data;
1063
   my $design_xml_sep ;
1064
   my $design_xml_file ;
1065
   my $design_version;
1066 117 jt_eaton
 
1067 130 jt_eaton
      $design_db->db_get("${vendor}__${library}_${component}_${version}", $data );
1068
      ( $design_xml_file, $design_xml_sep,$design_version ) = split ':', $data;
1069 117 jt_eaton
 
1070 130 jt_eaton
      return("$design_xml_file");
1071 117 jt_eaton
   }
1072
 
1073
 
1074 130 jt_eaton
#/**************************************************************************************************************/
1075
#/  find_ipxact_abstractionDefinition                                                                          */
1076
#/                                                                                                             */
1077
#/  returns full path name to ip-xact abstractionDefinition file                                               */
1078
#/                                                                                                             */
1079
#/  my $spirit_type_file = yp::lib::find_ipxact_abstractionDefinition($vendor,$library,$component,$version);   */
1080
#/                                                                                                             */
1081
#/**************************************************************************************************************/
1082 117 jt_eaton
 
1083 130 jt_eaton
sub find_ipxact_abstractionDefinition
1084 117 jt_eaton
   {
1085
   my @params     = @_;
1086
   my $version    = pop(@params);
1087
   my $component  = pop(@params);
1088 130 jt_eaton
   my $library    = pop(@params);
1089 117 jt_eaton
   my $vendor     = pop(@params);
1090
 
1091 130 jt_eaton
   my $data;
1092
   my $design_xml_sep ;
1093
   my $design_xml_file ;
1094
   my $design_version;
1095 131 jt_eaton
   my $design_name;
1096
   my $design_library;
1097
   my $design_vendor;
1098 117 jt_eaton
 
1099 131 jt_eaton
 
1100 130 jt_eaton
      $abstractionDefinition_db->db_get("${vendor}__${library}_${component}_${version}", $data );
1101 131 jt_eaton
      ( $design_xml_file, $design_xml_sep,$design_version,$design_name,$design_library,$design_vendor ) = split ':', $data;
1102 117 jt_eaton
 
1103 130 jt_eaton
      return("$design_xml_file");
1104 117 jt_eaton
 
1105
   }
1106
 
1107
 
1108
 
1109 130 jt_eaton
#/**************************************************************************************************************/
1110
#/  find_ipxact_busDefinition                                                                                  */
1111
#/                                                                                                             */
1112
#/  returns full path name to ip-xact busDefinition file                                                       */
1113
#/                                                                                                             */
1114
#/  my $spirit_type_file = yp::lib::find_ipxact_busDefinition($vendor,$library,$component,$version);           */
1115
#/                                                                                                             */
1116
#/**************************************************************************************************************/
1117 117 jt_eaton
 
1118 130 jt_eaton
sub find_ipxact_busDefinition
1119 117 jt_eaton
   {
1120
   my @params     = @_;
1121
   my $version    = pop(@params);
1122
   my $component  = pop(@params);
1123 130 jt_eaton
   my $library    = pop(@params);
1124 117 jt_eaton
   my $vendor     = pop(@params);
1125
 
1126 130 jt_eaton
   my $data;
1127
   my $design_xml_sep ;
1128
   my $design_xml_file ;
1129
   my $design_version;
1130 117 jt_eaton
 
1131
 
1132 130 jt_eaton
      $busDefinition_db->db_get("${vendor}__${library}_${component}_${version}", $data );
1133
      ( $design_xml_file, $design_xml_sep,$design_version ) = split ':', $data;
1134 117 jt_eaton
 
1135 130 jt_eaton
      return("$design_xml_file");
1136 117 jt_eaton
   }
1137
 
1138
 
1139
 
1140 130 jt_eaton
#/**************************************************************************************************************/
1141
#/  find_libraryConfiguration                                                                                  */
1142
#/                                                                                                             */
1143
#/  returns full path name to socgen  libraryConfiguration xml file                                            */
1144
#/                                                                                                             */
1145
#/  my $socgen_file = yp::lib::find_libraryConfiguration($vendor,$library);                                    */
1146
#/                                                                                                             */
1147
#/**************************************************************************************************************/
1148 117 jt_eaton
 
1149 130 jt_eaton
sub find_libraryConfiguration
1150 117 jt_eaton
   {
1151
   my @params     = @_;
1152 130 jt_eaton
   my $library    = pop(@params);
1153 117 jt_eaton
   my $vendor     = pop(@params);
1154
 
1155 130 jt_eaton
   my $libraryConfiguration_xml;
1156
      $libraryConfiguration_db->db_get("${vendor}__${library}", $libraryConfiguration_xml );
1157
   return("$libraryConfiguration_xml");
1158 117 jt_eaton
   }
1159
 
1160
 
1161 130 jt_eaton
#/**************************************************************************************************************/
1162
#/  find_componentConfiguration                                                                                */
1163
#/                                                                                                             */
1164
#/  returns full path name to socgen  componentConfiguration xml file                                          */
1165
#/                                                                                                             */
1166
#/  my $socgen_file = yp::lib::find_componentConfiguration($vendor,$library,$component);                       */
1167
#/                                                                                                             */
1168
#/**************************************************************************************************************/
1169 117 jt_eaton
 
1170 130 jt_eaton
sub find_componentConfiguration
1171 117 jt_eaton
   {
1172
   my @params     = @_;
1173
   my $component  = pop(@params);
1174 130 jt_eaton
   my $library    = pop(@params);
1175 117 jt_eaton
   my $vendor     = pop(@params);
1176
 
1177 130 jt_eaton
   my $componentConfiguration_xml;
1178
      $componentConfiguration_db->db_get("${vendor}__${library}_${component}", $componentConfiguration_xml );
1179
   return("$componentConfiguration_xml");
1180 117 jt_eaton
   }
1181
 
1182
 
1183
 
1184
 
1185 130 jt_eaton
#/**************************************************************************************************************/
1186 131 jt_eaton
#/  find_component_repo                                                                                        */
1187
#/                                                                                                             */
1188
#/  returns repository that containing component                                                               */
1189
#/                                                                                                             */
1190
#/  my $repo_name = yp::lib::find_component_repo($vendor,$library,$component);                                 */
1191
#/                                                                                                             */
1192
#/**************************************************************************************************************/
1193
 
1194
sub find_component_repo   {
1195
   my @params     = @_;
1196
   my $component  = pop(@params);
1197
   my $library    = pop(@params);
1198
   my $vendor     = pop(@params);
1199
 
1200
   my $type;
1201
   my $name;
1202
   my $lib_comp_sep;
1203
   my $repo_dir;
1204
   my $repo_data;
1205
 
1206
      $repo_db->db_get("${vendor}__${library}_${component}", $repo_data );
1207
   ( $type,$name, $lib_comp_sep, $repo_dir ) = split ':', $repo_data;
1208
   return("${repo_dir}");
1209
   }
1210
 
1211
 
1212
 
1213
 
1214
#/**************************************************************************************************************/
1215
#/  find_library_repo                                                                                          */
1216
#/                                                                                                             */
1217
#/  returns repository containing library                                                                      */
1218
#/                                                                                                             */
1219
#/  my $repo_name = yp::lib::find_library_repo($vendor,$library);                                              */
1220
#/                                                                                                             */
1221
#/**************************************************************************************************************/
1222
 
1223
sub find_library_repo   {
1224
   my @params     = @_;
1225
   my $library    = pop(@params);
1226
   my $vendor     = pop(@params);
1227
 
1228
   my $type;
1229
   my $name;
1230
   my $status;
1231
   my $library_path;
1232
   my $repo_dir;
1233
   my $repo_data;
1234
 
1235
      $repo_db->db_get("${vendor}__${library}", $repo_data );
1236
   ( $type,$name, $library_path,$status, $repo_dir ) = split ':', $repo_data;
1237
   return("${repo_dir}");
1238
   }
1239
 
1240
 
1241
 
1242
 
1243
#/**************************************************************************************************************/
1244 130 jt_eaton
#/  find_lib_comp_sep                                                                                          */
1245
#/                                                                                                             */
1246
#/  returns libraries path to components                                                                       */
1247
#/                                                                                                             */
1248
#/  my $lib_comp_sep = yp::lib::find_lib_comp_sep($vendor,$library,$component);                                */
1249
#/                                                                                                             */
1250
#/**************************************************************************************************************/
1251 120 jt_eaton
 
1252 117 jt_eaton
sub find_lib_comp_sep
1253
   {
1254
   my @params     = @_;
1255 127 jt_eaton
   my $component  = pop(@params);
1256 130 jt_eaton
   my $library    = pop(@params);
1257 117 jt_eaton
   my $vendor     = pop(@params);
1258
 
1259 130 jt_eaton
   my $type;
1260
   my $name;
1261
   my $lib_comp_sep;
1262 131 jt_eaton
   my $repo_dir;
1263 130 jt_eaton
   my $repo_data;
1264 117 jt_eaton
 
1265 130 jt_eaton
      $repo_db->db_get("${vendor}__${library}_${component}", $repo_data );
1266 131 jt_eaton
   ( $type,$name, $lib_comp_sep, $repo_dir ) = split ':', $repo_data;
1267 130 jt_eaton
   return("${lib_comp_sep}");
1268 120 jt_eaton
   }
1269 117 jt_eaton
 
1270 120 jt_eaton
 
1271 131 jt_eaton
 
1272 130 jt_eaton
#/***********************************************************************************************/
1273
#/  find_ipxact_comp_xml_sep                                                                    */
1274
#/                                                                                              */
1275
#/                                                                                              */
1276
#/                                                                                              */
1277
#/  my $comp_xml_sep = yp::lib::find_ipxact_component($vendor,$library,$component,$version);    */
1278
#/                                                                                              */
1279
#/***********************************************************************************************/
1280 120 jt_eaton
 
1281 130 jt_eaton
sub find_comp_xml_sep
1282 120 jt_eaton
   {
1283
   my @params     = @_;
1284
   my $version    = pop(@params);
1285
   my $component  = pop(@params);
1286 130 jt_eaton
   my $library    = pop(@params);
1287 120 jt_eaton
   my $vendor     = pop(@params);
1288 130 jt_eaton
   my $comp_data;
1289
   my $comp_version;
1290
   my $comp_xml_sep;
1291
   my $component_xml;
1292
      $component_db->db_get("${vendor}__${library}_${component}_${version}", $comp_data );
1293
      ( $component_xml, $comp_xml_sep, $comp_version) = split ':', $comp_data;
1294
      return("$comp_xml_sep");
1295 120 jt_eaton
   }
1296 117 jt_eaton
 
1297
 
1298
 
1299
 
1300 120 jt_eaton
 
1301
 
1302
#/*********************************************************************************************/
1303
#/  find_lib_sw_dir                                                                           */
1304
#/                                                                                            */
1305
#/  returns  library sw directory                                                             */
1306
#/                                                                                            */
1307
#/   my $file_lib_sw_dir = yp::lib::find_file_lib_sw_dir($vendor,$library);                   */
1308
#/                                                                                            */
1309
#/*********************************************************************************************/
1310 117 jt_eaton
 
1311 120 jt_eaton
sub find_lib_sw_dir
1312
   {
1313
   my @params     = @_;
1314 130 jt_eaton
   my $library    = pop(@params);
1315 120 jt_eaton
   my $vendor     = pop(@params);
1316 130 jt_eaton
   my $parser     = XML::LibXML->new();
1317 117 jt_eaton
 
1318 130 jt_eaton
   my $lib_sw_dir ;
1319
  if(yp::lib::find_libraryConfiguration($vendor,$library))
1320
   {
1321
   my $socgen_libraryConfiguration= $parser->parse_file(yp::lib::find_libraryConfiguration($vendor,$library));
1322
      $lib_sw_dir  = $socgen_libraryConfiguration->findnodes('//socgen:libraryConfiguration/socgen:lib_sw_dir/text()')->to_literal ;
1323 120 jt_eaton
   }
1324
 
1325 130 jt_eaton
      return("/${lib_sw_dir}");
1326 120 jt_eaton
 
1327 130 jt_eaton
   }
1328 120 jt_eaton
 
1329
 
1330
 
1331
 
1332 131 jt_eaton
 
1333
 
1334
#/**************************************************************************************************************/
1335
#/  get_vendor_status                                                                                          */
1336
#/                                                                                                             */
1337
#/  returns vendor status                                                                                      */
1338
#/                                                                                                             */
1339
#/  my $vendor_status = yp::lib::get_vendor_status($vendor);                                                   */
1340
#/                                                                                                             */
1341
#/**************************************************************************************************************/
1342
 
1343
sub get_vendor_status   {
1344
   my @params     = @_;
1345
   my $vendor     = pop(@params);
1346
 
1347
   my $type;
1348
   my $name;
1349
   my $status;
1350
   my $repo_dir;
1351
   my $repo_data;
1352
 
1353
      $repo_db->db_get("${vendor}", $repo_data );
1354
   ( $type,$name, $status, $repo_dir ) = split ':', $repo_data;
1355
   return("${status}");
1356
   }
1357
 
1358
 
1359
 
1360
 
1361
#/**************************************************************************************************************/
1362
#/  set_vendor_status                                                                                          */
1363
#/                                                                                                             */
1364
#/  sets vendor status                                                                                         */
1365
#/                                                                                                             */
1366
#/  my $vendor_status = yp::lib::set_vendor_status($vendor,$status);                                           */
1367
#/                                                                                                             */
1368
#/**************************************************************************************************************/
1369
 
1370
sub set_vendor_status   {
1371
   my @params     = @_;
1372
   my $status     = pop(@params);
1373
   my $vendor     = pop(@params);
1374
 
1375
   my $type;
1376
   my $name;
1377
   my $old_status;
1378
   my $repo_dir;
1379
   my $repo_data;
1380
   my @repo_info;
1381
 
1382
      $repo_db->db_get("${vendor}", $repo_data );
1383
   ( $type,$name, $old_status, $repo_dir ) = split ':', $repo_data;
1384
 
1385
   my @repo_info  = ("vendor","$vendor","$status","$repo_dir" );
1386
   $repo_db->db_put( $vendor, join(':', @repo_info) );
1387
 
1388
   return("${status}");
1389
   }
1390
 
1391
 
1392
 
1393
 
1394
#/**************************************************************************************************************/
1395
#/  get_library_status                                                                                         */
1396
#/                                                                                                             */
1397
#/  returns library status                                                                                     */
1398
#/                                                                                                             */
1399
#/  my $library_status = yp::lib::get_library_status($vendor);                                                 */
1400
#/                                                                                                             */
1401
#/**************************************************************************************************************/
1402
 
1403
sub get_library_status   {
1404
   my @params     = @_;
1405
   my $library     = pop(@params);
1406
   my $vendor     = pop(@params);
1407
 
1408
   my $type;
1409
   my $name;
1410
   my $library_path;
1411
   my $status;
1412
   my $repo_dir;
1413
   my $repo_data;
1414
 
1415
      $repo_db->db_get("${vendor}_${library}", $repo_data );
1416
   ( $type,$name,$library_path, $status, $repo_dir ) = split ':', $repo_data;
1417
   return("${status}");
1418
   }
1419
 
1420
 
1421
 
1422
 
1423
#/**************************************************************************************************************/
1424
#/  set_library_status                                                                                         */
1425
#/                                                                                                             */
1426
#/  sets library status                                                                                        */
1427
#/                                                                                                             */
1428
#/  my $library_status = yp::lib::set_library_status($vendor,$library,$status);                                */
1429
#/                                                                                                             */
1430
#/**************************************************************************************************************/
1431
 
1432
sub set_library_status   {
1433
   my @params     = @_;
1434
   my $status     = pop(@params);
1435
   my $library    = pop(@params);
1436
   my $vendor     = pop(@params);
1437
 
1438
   my $type;
1439
   my $name;
1440
   my $old_status;
1441
   my $library_path;
1442
   my $repo_dir;
1443
   my $repo_data;
1444
   my @repo_info;
1445
 
1446
      $repo_db->db_get("${vendor}_${library}", $repo_data );
1447
   ( $type,$name,$library_path, $old_status, $repo_dir ) = split ':', $repo_data;
1448
 
1449
   my @repo_info  = ("library","$library","$library_path","$status","$repo_dir" );
1450
   $repo_db->db_put( "${vendor}_${library}", join(':', @repo_info) );
1451
 
1452
   return("${status}");
1453
   }
1454
 
1455
 
1456
 
1457
 
1458
 
1459
 
1460
 
1461
 
1462
 
1463
 
1464
 
1465
 
1466
 
1467 117 jt_eaton
#/*********************************************************************************************/
1468
#/  find_vendors                                                                              */
1469
#/                                                                                            */
1470
#/  returns  array of all vendors                                                             */
1471
#/                                                                                            */
1472 130 jt_eaton
#/   my @vendors = yp::lib::find_vendors();                                                   */
1473 117 jt_eaton
#/                                                                                            */
1474
#/*********************************************************************************************/
1475
 
1476
sub find_vendors
1477
   {
1478 130 jt_eaton
   my $key;
1479
   my $value;
1480
   my $type;
1481
   my $name;
1482
   my $path;
1483 131 jt_eaton
   my $repo_dir;
1484 117 jt_eaton
   my @vendors = ();
1485
 
1486 130 jt_eaton
   my $cursor = $repo_db->db_cursor() ;
1487
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
1488
   {
1489 131 jt_eaton
   ( $type,$name, $path,$repo_dir ) = split ':', $value;
1490 130 jt_eaton
   if($type  eq "vendor")
1491 117 jt_eaton
     {
1492 130 jt_eaton
      push (@vendors,$name );
1493
      }
1494 117 jt_eaton
   }
1495 130 jt_eaton
     @vendors = trim_sort(@vendors);
1496
     return (@vendors);
1497
   }
1498 117 jt_eaton
 
1499
 
1500
 
1501
#/*********************************************************************************************/
1502
#/  find_libraries                                                                            */
1503
#/                                                                                            */
1504
#/  returns  array of all libraries from a vendor                                             */
1505
#/                                                                                            */
1506 130 jt_eaton
#/   my @libraries = yp::lib::find_libraries($vendor);                                        */
1507 117 jt_eaton
#/                                                                                            */
1508
#/*********************************************************************************************/
1509
 
1510
sub find_libraries
1511
   {
1512
   my @params     = @_;
1513
   my $vendor    = pop(@params);
1514 130 jt_eaton
   my $type;
1515
   my $key;
1516
   my $value;
1517
   my $name;
1518 131 jt_eaton
   my $status;
1519 130 jt_eaton
   my $path;
1520 131 jt_eaton
   my $repo_dir;
1521 117 jt_eaton
   my @libraries = ();
1522
 
1523 130 jt_eaton
   my $cursor = $repo_db->db_cursor() ;
1524
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
1525
   {
1526 131 jt_eaton
   ( $type,$name, $path,$status, $repo_dir) = split ':', $value;
1527 130 jt_eaton
 
1528
 
1529
   if(($type  eq "library")&& ($key eq "${vendor}__${name}")          )
1530 117 jt_eaton
     {
1531 130 jt_eaton
      push (@libraries,$name );
1532
      }
1533
   }
1534 117 jt_eaton
   @libraries = trim_sort(@libraries);
1535
   return (@libraries);
1536
   }
1537
 
1538
 
1539
#/*********************************************************************************************/
1540
#/  find_components                                                                           */
1541
#/                                                                                            */
1542
#/  returns  array of all components from a vendors library                                   */
1543
#/                                                                                            */
1544 130 jt_eaton
#/   my @components = yp::lib::find_components($vendor,$library);                                      */
1545 117 jt_eaton
#/                                                                                            */
1546
#/*********************************************************************************************/
1547
 
1548
sub find_components
1549
   {
1550
   my @params     = @_;
1551
   my $library    = pop(@params);
1552 130 jt_eaton
   my $vendor     = pop(@params);
1553
   my $type;
1554
   my $key;
1555
   my $value;
1556
   my $name;
1557
   my $path;
1558 131 jt_eaton
   my $repo_dir;
1559 117 jt_eaton
   my @components = ();
1560 130 jt_eaton
   my $cursor = $repo_db->db_cursor() ;
1561
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
1562
      {
1563 131 jt_eaton
      ( $type,$name, $path,$repo_dir ) = split ':', $value;
1564 130 jt_eaton
      if(($type  eq "component")&& ($key eq "${vendor}__${library}_${name}"))
1565
         { push (@components,$name );}
1566
      }
1567 117 jt_eaton
   @components = trim_sort(@components);
1568
   return (@components);
1569
   }
1570
 
1571
 
1572
 
1573
 
1574
#/*********************************************************************************************/
1575 130 jt_eaton
#/  find_component_versions                                                                   */
1576 117 jt_eaton
#/                                                                                            */
1577 130 jt_eaton
#/  returns  array of all versions os a component                                             */
1578 117 jt_eaton
#/                                                                                            */
1579 130 jt_eaton
#/   my @components = yp::lib::find_component_versions($vendor,$library,$component);          */
1580 117 jt_eaton
#/                                                                                            */
1581
#/*********************************************************************************************/
1582
 
1583 130 jt_eaton
sub find_component_versions
1584 117 jt_eaton
   {
1585
   my @params     = @_;
1586 130 jt_eaton
   my $component  = pop(@params);
1587 117 jt_eaton
   my $library    = pop(@params);
1588 130 jt_eaton
   my $vendor     = pop(@params);
1589 117 jt_eaton
 
1590 130 jt_eaton
   my $xml_file;
1591
   my $key;
1592
   my $value;
1593
   my $comp_xml_sep;
1594
   my $version;
1595
 
1596 117 jt_eaton
   my @versions = ();
1597 130 jt_eaton
   my $cursor = $component_db->db_cursor() ;
1598
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
1599
      {
1600
      ( $xml_file,$comp_xml_sep, $version ) = split ':', $value;
1601
      if(($key eq "${vendor}__${library}_${component}_${version}"))
1602
         {
1603
         push (@versions,$version );
1604
         }
1605
      }
1606
   @versions = trim_sort(@versions);
1607
   return (@versions);
1608
   }
1609 117 jt_eaton
 
1610
 
1611 130 jt_eaton
 
1612
 
1613
 
1614
#/************************************************************************************************************************/
1615
#/  find_abstractionDefinition_versions                                                                                  */
1616
#/                                                                                                                       */
1617
#/  returns  array of all versions os a abstractionDefinition                                                            */
1618
#/                                                                                                                       */
1619
#/   my @abstractionDefinitions = yp::lib::find_abstractionDefinition_versions($vendor,$library,$abstractionDefinition); */
1620
#/                                                                                                                       */
1621
#/************************************************************************************************************************/
1622
 
1623
sub find_abstractionDefinition_versions
1624
   {
1625
   my @params     = @_;
1626
   my $abstractionDefinition  = pop(@params);
1627
   my $library    = pop(@params);
1628
   my $vendor     = pop(@params);
1629
 
1630
   my $xml_file;
1631
   my $key;
1632
   my $value;
1633
   my $comp_xml_sep;
1634 131 jt_eaton
   my $design_vendor;
1635
   my $design_library;
1636
   my $design_name;
1637
   my $design_version;
1638 130 jt_eaton
 
1639
   my @versions = ();
1640
   my $cursor = $abstractionDefinition_db->db_cursor() ;
1641
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
1642
      {
1643 131 jt_eaton
      ( $xml_file,$comp_xml_sep, $design_version,$design_name,$design_library,$design_vendor ) = split ':', $value;
1644
      if(($key eq "${vendor}__${library}_${abstractionDefinition}_${design_version}"))
1645 130 jt_eaton
         {
1646 131 jt_eaton
         push (@versions,$design_version );
1647 130 jt_eaton
         }
1648
      }
1649 117 jt_eaton
   @versions = trim_sort(@versions);
1650
   return (@versions);
1651
   }
1652
 
1653
 
1654 131 jt_eaton
#/*********************************************************************************************/
1655
#/  find_abstractionDefinitions                                                                */
1656
#/                                                                                            */
1657
#/  returns  array of all         abstractionDefinitions   vendor__library_abstractionDefinition_version      */
1658
#/                                                                                            */
1659
#/   my @abstractionDefinitions = yp::lib::find_abstractionDefinitions();                     */
1660
#/                                                                                            */
1661
#/*********************************************************************************************/
1662 117 jt_eaton
 
1663
 
1664
 
1665
 
1666 131 jt_eaton
 
1667
 
1668
 
1669
 
1670
 
1671
 
1672
sub find_abstractionDefinitions
1673
   {
1674
   my $key;
1675
   my $value;
1676
   my $type;
1677
   my $name;
1678
   my $path;
1679
 
1680
   my $design_xml_file;
1681
   my $design_xml_sep;
1682
 
1683
   my $design_version;
1684
   my $design_name;
1685
   my $design_library;
1686
   my $design_vendor;
1687
 
1688
 
1689
   my @abstractionDefinitions = ();
1690
 
1691
   my $cursor = $abstractionDefinition_db->db_cursor() ;
1692
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
1693
         {
1694
 
1695
         ( $design_xml_file, $design_xml_sep,$design_version,$design_name,$design_library,$design_vendor ) = split ':', $value;
1696
         push (@abstractionDefinitions,"${design_vendor}:${design_library}:${design_name}:${design_version}" );
1697
         @abstractionDefinitions = trim_sort(@abstractionDefinitions);
1698
         }
1699
         return (@abstractionDefinitions);
1700
   }
1701
 
1702
 
1703 130 jt_eaton
#/************************************************************************************************************************/
1704
#/  find_busDefinition_versions                                                                                  */
1705
#/                                                                                                                       */
1706
#/  returns  array of all versions os a busDefinition                                                            */
1707
#/                                                                                                                       */
1708
#/   my @busDefinitions = yp::lib::find_busDefinition_versions($vendor,$library,$busDefinition); */
1709
#/                                                                                                                       */
1710
#/************************************************************************************************************************/
1711 117 jt_eaton
 
1712 130 jt_eaton
sub find_busDefinition_versions
1713 117 jt_eaton
   {
1714
   my @params     = @_;
1715 130 jt_eaton
   my $busDefinition  = pop(@params);
1716
   my $library    = pop(@params);
1717 117 jt_eaton
   my $vendor     = pop(@params);
1718
 
1719 130 jt_eaton
   my $xml_file;
1720
   my $key;
1721
   my $value;
1722
   my $comp_xml_sep;
1723
   my $version;
1724 117 jt_eaton
 
1725 130 jt_eaton
   my @versions = ();
1726
   my $cursor = $busDefinition_db->db_cursor() ;
1727
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
1728
      {
1729
      ( $xml_file,$comp_xml_sep, $version ) = split ':', $value;
1730
      if(($key eq "${vendor}__${library}_${busDefinition}_${version}"))
1731
         {
1732
         push (@versions,$version );
1733
         }
1734
      }
1735
   @versions = trim_sort(@versions);
1736
   return (@versions);
1737 117 jt_eaton
   }
1738
 
1739 122 jt_eaton
#/*********************************************************************************************/
1740
#/  get_module_name                                                                           */
1741
#/                                                                                            */
1742
#/  returns module name for component                                                         */
1743
#/                                                                                            */
1744
#/   my $module_name = yp::lib::get_module_name($vendor,$library,$component,$version);        */
1745
#/                                                                                            */
1746
#/*********************************************************************************************/
1747 117 jt_eaton
 
1748 122 jt_eaton
sub get_module_name
1749
   {
1750
   my @params     = @_;
1751
   my $version    = pop(@params);
1752
   my $component  = pop(@params);
1753 125 jt_eaton
   my $library    = pop(@params);
1754 122 jt_eaton
   my $vendor     = pop(@params);
1755
 
1756 125 jt_eaton
   my $name_depth =2;
1757 122 jt_eaton
 
1758 125 jt_eaton
   my $parser     = XML::LibXML->new();
1759
 
1760 131 jt_eaton
   my $socgen_component_filename  = yp::lib::find_componentConfiguration($vendor,$library,$component);
1761
   unless($socgen_component_filename)
1762
      {
1763 134 jt_eaton
          return("");
1764 131 jt_eaton
      }
1765
   my $socgen_component_file  = $parser->parse_file($socgen_component_filename);
1766 125 jt_eaton
 
1767
   foreach my $new_comp ($socgen_component_file->findnodes("//socgen:componentConfiguration"))
1768
     {
1769
     $name_depth        = $new_comp->findnodes('./socgen:ip_name_depth/text()')->to_literal ;
1770
     }
1771 127 jt_eaton
  if($name_depth eq "0"){   return("${library}");}
1772 125 jt_eaton
  if($name_depth eq "1"){   return("${component}");}
1773
  if($name_depth eq "2"){   return("${component}_${version}");}
1774
  if($name_depth eq "3"){   return("${library}_${component}_${version}");}
1775
  if($name_depth eq "4"){   return("${vendor}_${library}_${component}_${version}");}
1776 122 jt_eaton
 
1777
   }
1778
 
1779
 
1780 130 jt_eaton
#/*********************************************************************************************/
1781 125 jt_eaton
#/  parse_component_file                                                                      */
1782
#/                                                                                            */
1783
#/  returns design names for component                                                        */
1784
#/                                                                                            */
1785
#/   my @filelist = yp::lib::parse_component_file($vendor,$library,$component,$version);      */
1786
#/                                                                                            */
1787
#/*********************************************************************************************/
1788 117 jt_eaton
 
1789
 
1790
 
1791 125 jt_eaton
sub parse_component_file
1792
   {
1793
   my @params     = @_;
1794
   my $version    = pop(@params);
1795
   my $component  = pop(@params);
1796
   my $library    = pop(@params);
1797
   my $vendor     = pop(@params);
1798
 
1799
   my $parser     = XML::LibXML->new();
1800
 
1801
 
1802 130 jt_eaton
   my $spirit_cmp_filename =yp::lib::find_ipxact_component($vendor,$library,$component,$version );
1803 125 jt_eaton
 
1804
   unless($spirit_cmp_filename)
1805
      {
1806 126 jt_eaton
      print("spirit:component MISSING   $vendor,$library,$component,$version \n");
1807 125 jt_eaton
      }
1808
 
1809 126 jt_eaton
 
1810 130 jt_eaton
   my $spirit_component_file  = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$library,$component,$version ));
1811 125 jt_eaton
 
1812
 
1813
   my $line;
1814
 
1815
   my      @filelist_acc = (  );
1816
   push(@filelist_acc,"::${vendor}::${library}::${component}::${version}::");
1817
 
1818
   foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
1819
     {
1820
     my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
1821
     my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
1822
     my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
1823
     my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
1824 128 jt_eaton
     my @filelist_sub       = parse_component_fileX($new_vendor,$new_library,$new_name,$new_version);
1825 125 jt_eaton
                              foreach $line (@filelist_sub) { push(@filelist_acc,"$line"); }
1826
     }
1827
 
1828
   foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:hierarchyRef"))
1829
     {
1830
     my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
1831
     my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
1832
     my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
1833
     my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
1834
 
1835 130 jt_eaton
     if(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version ))
1836 125 jt_eaton
             {
1837 130 jt_eaton
             my $spirit_design_file = $parser->parse_file(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version ));
1838 125 jt_eaton
             foreach  my   $i_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:componentRef/\@spirit:vendor"))
1839
                {
1840
                my($vendor_name)         = $i_name  ->to_literal ;
1841
                my($library_name)        = $i_name  ->findnodes('../@spirit:library')->to_literal ;
1842
                my($component_name)      = $i_name  ->findnodes('../@spirit:name')->to_literal ;
1843
                my($version_name)        = $i_name  ->findnodes('../@spirit:version')->to_literal ;
1844
 
1845
                push(@filelist_acc,"::${vendor_name}::${library_name}::${component_name}::${version_name}::");
1846 128 jt_eaton
                my  @filelist_sub = parse_component_fileX($vendor_name,$library_name,$component_name,$version_name);
1847 125 jt_eaton
                  foreach $line (@filelist_sub) { push(@filelist_acc,"$line"); }
1848 130 jt_eaton
                }
1849
             }
1850 125 jt_eaton
     }
1851
 
1852
   @filelist_acc     =       sys::lib::trim_sort(@filelist_acc);
1853
   return(@filelist_acc);
1854
}
1855
 
1856
 
1857
 
1858
 
1859
 
1860 128 jt_eaton
sub parse_component_fileX
1861
   {
1862
   my @params     = @_;
1863
   my $version    = pop(@params);
1864
   my $component  = pop(@params);
1865
   my $library    = pop(@params);
1866
   my $vendor     = pop(@params);
1867 125 jt_eaton
 
1868 128 jt_eaton
   my $parser     = XML::LibXML->new();
1869 125 jt_eaton
 
1870 128 jt_eaton
 
1871 130 jt_eaton
   my $spirit_cmp_filename =yp::lib::find_ipxact_component($vendor,$library,$component,$version );
1872 128 jt_eaton
 
1873
   unless($spirit_cmp_filename)
1874
      {
1875
      print("spirit:component MISSING   $vendor,$library,$component,$version \n");
1876
      }
1877
 
1878
 
1879 130 jt_eaton
   my $spirit_component_file  = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$library,$component,$version ));
1880 128 jt_eaton
 
1881
 
1882
   my $line;
1883
 
1884
   my      @filelist_acc = (  );
1885 130 jt_eaton
 
1886 128 jt_eaton
 
1887
   foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
1888
     {
1889
     my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
1890
     my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
1891
     my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
1892
     my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
1893
     my @filelist_sub       = parse_component_fileX($new_vendor,$new_library,$new_name,$new_version);
1894
                              foreach $line (@filelist_sub) { push(@filelist_acc,"$line"); }
1895
     }
1896
 
1897
   foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:hierarchyRef"))
1898
     {
1899
     my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
1900
     my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
1901
     my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
1902
     my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
1903
 
1904 130 jt_eaton
     if(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version ))
1905
          {
1906
          my $spirit_design_file = $parser->parse_file(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version ));
1907
          foreach  my   $i_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:componentRef/\@spirit:vendor"))
1908 128 jt_eaton
                {
1909
                my($vendor_name)         = $i_name  ->to_literal ;
1910
                my($library_name)        = $i_name  ->findnodes('../@spirit:library')->to_literal ;
1911
                my($component_name)      = $i_name  ->findnodes('../@spirit:name')->to_literal ;
1912
                my($version_name)        = $i_name  ->findnodes('../@spirit:version')->to_literal ;
1913
 
1914
                push(@filelist_acc,"::${vendor_name}::${library_name}::${component_name}::${version_name}::");
1915
                my  @filelist_sub = parse_component_fileX($vendor_name,$library_name,$component_name,$version_name);
1916
                  foreach $line (@filelist_sub) { push(@filelist_acc,"$line"); }
1917
                }
1918 130 jt_eaton
 
1919 128 jt_eaton
           }
1920
     }
1921
 
1922
   @filelist_acc     =       sys::lib::trim_sort(@filelist_acc);
1923
   return(@filelist_acc);
1924
}
1925
 
1926
 
1927
 
1928
 
1929
 
1930
 
1931
#/*********************************************************************************************/
1932
#/  parse_component_brothers                                                                  */
1933
#/                                                                                            */
1934
#/  returns names for component brothers                                                      */
1935
#/                                                                                            */
1936 134 jt_eaton
#/   my @filelist = yp::lib::parse_component_brothers($vendor,$library,$component,$version);   */
1937 128 jt_eaton
#/                                                                                            */
1938
#/*********************************************************************************************/
1939
 
1940
sub parse_component_brothers
1941
   {
1942
   my @params     = @_;
1943
   my $version    = pop(@params);
1944
   my $component  = pop(@params);
1945
   my $library    = pop(@params);
1946
   my $vendor     = pop(@params);
1947
 
1948
   my $parser     = XML::LibXML->new();
1949 130 jt_eaton
   unless (yp::lib::find_ipxact_component($vendor,$library,$component,$version)){print "Missing Component  $vendor, $library, $component, $version \n";  }
1950
   my $spirit_component_file  = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$library,$component,$version ));
1951 128 jt_eaton
 
1952
   my $line;
1953
   my      @filelist_acc = (  );
1954
   push(@filelist_acc,"::${vendor}::${library}::${component}::${version}::");
1955
 
1956
   foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
1957
     {
1958
     my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
1959
     my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
1960
     my($new_component)     = $new_comp->findnodes('./@spirit:name')->to_literal ;
1961
     my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
1962
     push(@filelist_acc,"::${new_vendor}::${new_library}::${new_component}::${new_version}::");
1963
     }
1964
 
1965
   return(@filelist_acc);
1966
}
1967
 
1968 125 jt_eaton
#/*****************************************************************************************************/
1969
#/  find_ipxact_design_files                                                                          */
1970
#/                                                                                                    */
1971
#/  returns parser tokens  to ip-xact design files referred to by component file vlnv                 */
1972
#/                                                                                                    */
1973
#/  my @spirit_design_files = yp::lib::find_ipxact_design_file($vendor,$library,$component,$version);  */
1974
#/                                                                                                    */
1975
#/*****************************************************************************************************/
1976
 
1977
sub find_ipxact_design_files
1978
   {
1979
   my @params     = @_;
1980
   my $version    = pop(@params);
1981
   my $component  = pop(@params);
1982 130 jt_eaton
   my $library    = pop(@params);
1983 125 jt_eaton
   my $vendor     = pop(@params);
1984
 
1985
 
1986
   my @design_files = ();
1987
   my $parser           = XML::LibXML->new();
1988 130 jt_eaton
   unless (yp::lib::find_ipxact_component($vendor,$library,$component,$version)){print "Missing Component  $vendor, $library, $component, $version \n";  }
1989
   my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$library,$component,$version));
1990 125 jt_eaton
 
1991
   foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
1992
     {
1993
     my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
1994
     my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
1995
     my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
1996
     my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
1997
     my @filelist_sub       = yp::lib::find_ipxact_design_files($new_vendor,$new_library,$new_name,$new_version);
1998 130 jt_eaton
                              foreach my $line (@filelist_sub) { push(@design_files,"$line"); }     }
1999 125 jt_eaton
 
2000
   foreach my $comp_view ($spirit_component_file->findnodes('//spirit:component/spirit:model/spirit:views/spirit:view'))
2001
      {
2002
      my($hier_ref_vendor)         = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:vendor')->to_literal ;
2003
      my($hier_ref_library)        = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:library')->to_literal ;
2004 130 jt_eaton
      my($hier_ref_design)         = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:name')->to_literal ;
2005 125 jt_eaton
      my($hier_ref_version)        = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:version')->to_literal ;
2006 130 jt_eaton
      if(find_ipxact_design($hier_ref_vendor,$hier_ref_library,$hier_ref_design,$hier_ref_version))
2007
        {
2008
        push(@design_files,":::${hier_ref_vendor}:::${hier_ref_library}:::${hier_ref_design}:::${hier_ref_version}:::");
2009
        }
2010 125 jt_eaton
      }
2011 130 jt_eaton
     return(@design_files);
2012
   }
2013 125 jt_eaton
 
2014 130 jt_eaton
sub trim_sort {
2015
   my @output_files  = @_;
2016
   my %trim = ();
2017
   foreach my $descriptor (@output_files) { $trim{$descriptor}  = 1; }
2018
   my @k = keys %trim;
2019
   @output_files =  sort(sort @k);
2020
   return(@output_files);
2021 125 jt_eaton
   }
2022
 
2023
 
2024 117 jt_eaton
1;

powered by: WebSVN 2.1.0

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