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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [verilog/] [gen_verilog] - Blame information for rev 130

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

\n \n \n \n \n" ); \n \n \n \n \n");
Line No. Rev Author Line
1 119 jt_eaton
eval 'exec `which perl` -S $0 ${1+"$@"}'
2
   if 0;
3
#/**********************************************************************/
4
#/*                                                                    */
5
#/*             -------                                                */
6
#/*            /   SOC  \                                              */
7
#/*           /    GEN   \                                             */
8
#/*          /    TOOL    \                                            */
9
#/*          ==============                                            */
10
#/*          |            |                                            */
11
#/*          |____________|                                            */
12
#/*                                                                    */
13
#/*                                                                    */
14
#/*                                                                    */
15
#/*                                                                    */
16
#/*  Author(s):                                                        */
17
#/*      - John Eaton, jt_eaton@opencores.org                          */
18
#/*                                                                    */
19
#/**********************************************************************/
20
#/*                                                                    */
21
#/*    Copyright (C) <2010-2011>                */
22
#/*                                                                    */
23
#/*  This source file may be used and distributed without              */
24
#/*  restriction provided that this copyright statement is not         */
25
#/*  removed from the file and that any derivative work contains       */
26
#/*  the original copyright notice and the associated disclaimer.      */
27
#/*                                                                    */
28
#/*  This source file is free software; you can redistribute it        */
29
#/*  and/or modify it under the terms of the GNU Lesser General        */
30
#/*  Public License as published by the Free Software Foundation;      */
31
#/*  either version 2.1 of the License, or (at your option) any        */
32
#/*  later version.                                                    */
33
#/*                                                                    */
34
#/*  This source is distributed in the hope that it will be            */
35
#/*  useful, but WITHOUT ANY WARRANTY; without even the implied        */
36
#/*  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR           */
37
#/*  PURPOSE.  See the GNU Lesser General Public License for more      */
38
#/*  details.                                                          */
39
#/*                                                                    */
40
#/*  You should have received a copy of the GNU Lesser General         */
41
#/*  Public License along with this source; if not, download it        */
42
#/*  from http://www.opencores.org/lgpl.shtml                          */
43
#/*                                                                    */
44
#/**********************************************************************/
45
 
46
 
47
############################################################################
48
# General PERL config
49
############################################################################
50
use Getopt::Long;
51
use English;
52
use File::Basename;
53
use Cwd;
54
use XML::LibXML;
55
use lib './tools';
56
use sys::lib;
57
use yp::lib;
58
 
59
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
60
 
61
 
62
############################################################################
63
### Process the options
64
############################################################################
65
Getopt::Long::config("require_order", "prefix=-");
66
GetOptions("h","help",
67 128 jt_eaton
           "envidentifier=s" => \$envidentifier,
68 119 jt_eaton
           "prefix=s" => \$prefix,
69
           "vendor=s" => \$vendor,
70
           "project=s" => \$project,
71
           "version=s" => \$version,
72
           "component=s" => \$component,
73
           "dest_dir=s" => \$dest_dir,
74
           "destination=s" => \$destination,
75
           "configuration=s" => \$configuration,
76 128 jt_eaton
           "autodoc=s"   => \$autodoc,
77
           "fragment","no_port","local_parameters","tb","debug","verbose","interface_only","html"
78 119 jt_eaton
) || die "(use '$program_name -h' for help)";
79
 
80
 
81
##############################################################################
82
## Help option
83
##############################################################################
84
if ( $opt_h  or $opt_help  )
85 128 jt_eaton
  { print "\n gen_verilog -envidentifier {sim/syn}  -prefix /work -vendor vendor_name -project project_name  -component component_name  -version version_name -fragment -no_port -local_parameters -destination destination -configuration configuration -dest_dir  ../verilog";
86 119 jt_eaton
    print "\n";
87
    exit 1;
88
  }
89
 
90
 
91 128 jt_eaton
 
92 122 jt_eaton
my $main_module_name = yp::lib::get_module_name($vendor,$project,$component,$version) ;
93 119 jt_eaton
 
94 125 jt_eaton
 
95
 
96
 
97 119 jt_eaton
#############################################################################
98
##
99
##
100
#############################################################################
101
 
102
 
103
$home = cwd();
104 130 jt_eaton
 
105
my $projects_dir = "/projects";
106 119 jt_eaton
my $variant;
107 128 jt_eaton
my $view;
108
 
109
 
110
my $interface_in_count   =0;
111
my $interface_out_count  =0;
112
my $interface_in_size    =0;
113
my $interface_out_size   =0;
114
 
115
 
116
 
117 119 jt_eaton
 if($version)       {$variant   = "${component}_${version}";}
118
 else               {$variant   = "${component}";}
119
 
120 128 jt_eaton
unless($destination) { $destination = $variant;}
121
unless($autodoc)     { $autodoc     = "/Geda";}
122 119 jt_eaton
 
123 130 jt_eaton
print "\n GEN_verilog    $prefix $vendor $project $component $version $configuration      $dest_dir  $destination   \n";
124 120 jt_eaton
 
125
 
126 127 jt_eaton
my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$project,$component);
127 130 jt_eaton
my $comp_xml_sep    = yp::lib::find_comp_xml_sep($vendor,$project,$component,$version);
128 121 jt_eaton
 
129 125 jt_eaton
 
130
 
131
 
132
my $parser = XML::LibXML->new();
133
 
134 130 jt_eaton
my $socgen_file              = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$project,$component));
135
my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$project,$component,$version));
136 128 jt_eaton
my $doc_library_path         = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:doc/socgen:library_path/text()")->to_literal;
137 125 jt_eaton
 
138 128 jt_eaton
 
139 130 jt_eaton
my $sim_library_path ;
140
my $lib_comp_sep             = yp::lib::find_lib_comp_sep($vendor,$project,$component);
141 128 jt_eaton
 
142 130 jt_eaton
 
143
 
144
my $sim_comp_path            = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:comp_path/text()")->to_literal;
145
 
146
if ($sim_comp_path)
147
{
148
$sim_library_path            ="${lib_comp_sep}${sim_comp_path}";
149
}
150
else
151
{
152
$sim_library_path            = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:library_path/text()")->to_literal;
153
}
154
 
155
 
156
 
157
 
158
 
159 128 jt_eaton
foreach my $X_view ($spirit_component_file->findnodes('//spirit:component/spirit:model/spirit:views/spirit:view'))
160
         {
161
         my($Xview_name)   = $X_view->findnodes('./spirit:name/text()')->to_literal ;
162
         my($Xview_envidentifier)   = $X_view->findnodes('./spirit:envIdentifier/text()')->to_literal ;
163
 
164
 
165
         if($envidentifier eq $Xview_envidentifier )
166
              {
167
              $view = $Xview_name;
168
              }
169
         }
170
 
171
 
172
 
173
 
174
 
175 130 jt_eaton
my $path  = "${home}${prefix}/${vendor}__${project}${lib_comp_sep}${component}${comp_xml_sep}/${dest_dir}";
176 125 jt_eaton
mkdir $path,0755             unless( -e $path );
177
 
178 130 jt_eaton
my $path  = "${home}${prefix}/${vendor}__${project}${lib_comp_sep}${component}${comp_xml_sep}/${dest_dir}/${view}";
179 125 jt_eaton
mkdir $path,0755             unless( -e $path );
180
 
181
my   @filelist_hier     =       ();
182
my   @instantiations    =       ();
183
my   @parameters        =       ();
184
my   %parameter_values  =       ();
185 128 jt_eaton
my   %parameter_descriptions  = ();
186 125 jt_eaton
 
187 126 jt_eaton
 
188
 
189
 
190 121 jt_eaton
if($opt_tb )
191
{
192
   print "Creating testbench for   $vendor $project $component  $version \n";
193
 
194
 
195 130 jt_eaton
   my $path  ="${home}${projects_dir}/${vendor}/${project}${sim_library_path}";
196 121 jt_eaton
   mkdir $path,0755             unless( -e $path );
197
 
198 130 jt_eaton
   my $path  ="${home}${projects_dir}/${vendor}/${project}${sim_library_path}/testbenches";
199 121 jt_eaton
   mkdir $path,0755             unless( -e $path );
200
 
201 130 jt_eaton
      $path  ="${home}${projects_dir}/${vendor}/${project}${sim_library_path}/testbenches/xml";
202 124 jt_eaton
   mkdir $path,0755             unless( -e $path );
203 121 jt_eaton
 
204 124 jt_eaton
 
205 130 jt_eaton
   $outfile ="${home}${projects_dir}/${vendor}/${project}${sim_library_path}/testbenches/xml/${variant}_dut.params.xml";
206 121 jt_eaton
   open TB_COMP_FILE,">$outfile" or die "unable to open $outfile";
207
 
208
   print TB_COMP_FILE  "\n";
209 122 jt_eaton
   print TB_COMP_FILE  "                                                 \n";
216 121 jt_eaton
   print TB_COMP_FILE  "
217
   print TB_COMP_FILE  "xmlns:spirit=\"http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009\"\n";
218 125 jt_eaton
   print TB_COMP_FILE  "xmlns:socgen=\"http://opencores.org\"\n";
219 121 jt_eaton
   print TB_COMP_FILE  "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
220
   print TB_COMP_FILE  "xsi:schemaLocation=\"http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009\n";
221
   print TB_COMP_FILE  "http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009/index.xsd\">\n";
222
   print TB_COMP_FILE  "${vendor}\n";
223
   print TB_COMP_FILE  "${project}\n";
224
   print TB_COMP_FILE  "${component}\n";
225
   print TB_COMP_FILE  "${version}_dut.params\n";
226
 
227
 
228 130 jt_eaton
   $outfile ="${home}${projects_dir}/${vendor}/${project}${sim_library_path}/testbenches/xml/${variant}_dutg.design.xml";
229 128 jt_eaton
   open TB_DESIGN_FILE,">$outfile" or die "unable to open $outfile";
230
 
231
 
232 121 jt_eaton
   print TB_DESIGN_FILE  "\n";
233 122 jt_eaton
   print TB_DESIGN_FILE  "                                                 \n";
240 121 jt_eaton
   print TB_DESIGN_FILE  "
241
   print TB_DESIGN_FILE  "xmlns:spirit=\"http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009\"\n";
242 125 jt_eaton
   print TB_DESIGN_FILE  "xmlns:socgen=\"http://opencores.org\"\n";
243 121 jt_eaton
   print TB_DESIGN_FILE  "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
244
   print TB_DESIGN_FILE  "xsi:schemaLocation=\"http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009\n";
245
   print TB_DESIGN_FILE  "http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009/index.xsd\">\n";
246
   print TB_DESIGN_FILE  "${vendor}\n";
247
   print TB_DESIGN_FILE  "${project}\n";
248
   print TB_DESIGN_FILE  "${component}\n";
249
   print TB_DESIGN_FILE  "${version}_dutg.design\n";
250
 
251
}
252
 
253
 
254 128 jt_eaton
 
255
 
256
 
257
 
258
 
259
 
260
 
261
 
262
 
263
 
264
 
265
 
266 121 jt_eaton
     #/**********************************************************************/
267
     #/*                                                                    */
268 124 jt_eaton
     #/* if configuration set then read parameters from socgen:componentConfiguration file      */
269 121 jt_eaton
     #/*                                                                    */
270
     #/**********************************************************************/
271
 
272
    if($configuration)
273
      {
274
      # print "XXX Reading configuration   $configuration \n";
275 128 jt_eaton
      unless ($socgen_file)      { print "No socgen ip file \n";};
276 121 jt_eaton
 
277 128 jt_eaton
      foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:configurations/socgen:configuration/socgen:parameters/socgen:parameter/socgen:name"))
278 121 jt_eaton
                {
279
                my($param_name)         = $socgen_cfg->findnodes('./text()')->to_literal ;
280
                my($param_value)        = $socgen_cfg->findnodes('../socgen:value/text()')->to_literal ;
281
                my($config_name)        = $socgen_cfg->findnodes('../../../socgen:name/text()')->to_literal ;
282
                if($config_name eq $configuration  )
283
                  {
284
                  unless(defined $parameter_values{$param_name}) {push ( @parameters,  "$param_name");};
285
                  $parameter_values{$param_name} = ${param_value};
286
                  }
287 128 jt_eaton
 
288 121 jt_eaton
                }
289
 
290
      }
291
 
292
 
293
 
294
 
295 119 jt_eaton
#/**********************************************************************/
296
#/*                                                                    */
297
#/* Every hier cell is constructed from the ipxact file with seperate  */
298
#/* version  for each view                                             */
299
#/*                                                                    */
300
#/* Start by opening the output file                                   */
301
#/* get fileset name                                                   */
302
#/* check that requested view exists                                   */
303
#/*                                                                    */
304
#/**********************************************************************/
305
 
306 120 jt_eaton
foreach my $comp_view ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:name[text() = '$view']"             ))
307 119 jt_eaton
   {
308 120 jt_eaton
   my($view_fileset_name)  = $comp_view->findnodes('../spirit:fileSetRef/spirit:localName/text()')->to_literal ;
309 130 jt_eaton
   $outfile ="${home}${prefix}/${vendor}__${project}${lib_comp_sep}${component}${comp_xml_sep}/${dest_dir}/${view}/${destination}";
310 120 jt_eaton
   open DEST_FILE,">$outfile" or die "unable to open $outfile";
311 122 jt_eaton
   unless ($opt_fragment){     print DEST_FILE  "\n module \n\n  $main_module_name \n ";}
312 119 jt_eaton
 
313 120 jt_eaton
   #/*****************************************************************************/
314
   #/*  wire_decs array holds all port and signal declarations                   */
315
   #/*  :::name:::node_input_output:::wire_reg:::scaler_vector:::left:::right::: */
316
   #/*****************************************************************************/
317 119 jt_eaton
 
318 120 jt_eaton
   @wire_decs = (  );
319 119 jt_eaton
 
320
 
321 120 jt_eaton
   #/**********************************************************************/
322
   #/*  inst_conns holds all instance connections                         */
323
   #/**********************************************************************/
324 119 jt_eaton
 
325 120 jt_eaton
   @inst_conns = (  );
326 119 jt_eaton
 
327 120 jt_eaton
   my @decl_names  = ();
328
   my %decl_dirs  = ();
329
   my %decl_types  = ();
330
   my %decl_vector = ();
331
   my %decl_lefts  = ();
332
   my %decl_rights = ();
333 119 jt_eaton
 
334 120 jt_eaton
   #  component file
335 126 jt_eaton
 
336 120 jt_eaton
   parse_component_file($spirit_component_file);
337 126 jt_eaton
  if($opt_verbose){print "parse design files \n"; }
338 128 jt_eaton
  parse_design_files($spirit_component_file);
339 126 jt_eaton
  if($opt_verbose){print "process design files \n"; }
340 120 jt_eaton
   process_design_files($spirit_component_file);
341 126 jt_eaton
  if($opt_verbose){print "process wire_decs \n"; }
342 119 jt_eaton
 
343 120 jt_eaton
   #/**********************************************************************/
344
   #/*                                                                    */
345
   #/* pack ports and nodes into hashes                                   */
346
   #/*                                                                    */
347
   #/**********************************************************************/
348 119 jt_eaton
 
349
 
350 120 jt_eaton
   @wire_decs      = sys::lib::trim_sort(@wire_decs);
351
   foreach $line (@wire_decs)
352
     {
353
     $_ = $line;
354 119 jt_eaton
        if(/:::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::/)
355
          {
356
          $q_index               = $1;
357
          $q_node_name           = $2;
358
          $q_direction           = $3;
359
          $q_type                = $4;
360
          $q_vector              = $5;
361
          $q_left                = $6;
362
          $q_right               = $7;
363
          $q_instance            = $8;
364
          $q_depth               = $9;
365
          $q_phy_name            = $10;
366
          $q_busref_name         = $11;
367
          $q_abslog_name         = $12;
368
 
369 126 jt_eaton
 
370
  if($opt_debug ){print  "XXXXX--    $line \n  ";}
371
 
372 119 jt_eaton
         push ( @decl_names,$q_index);
373
 
374
 
375
          if(  $decl_pnames{$q_index})
376
            {
377
            if(  $decl_pnames{$q_index} eq ${q_index})
378
              {
379
              $decl_pnames{$q_index}  = "${q_node_name}";
380
              }
381
            }
382
          else
383
            {
384
            $decl_pnames{$q_index}  = "${q_node_name}";
385
            }
386
 
387
 
388
          if(  $decl_dirs{$q_index})
389
            {
390
            if(  $decl_dirs{$q_index} eq "node")
391
              {
392
              $decl_dirs{$q_index}  = "${q_direction}";
393
              }
394
            }
395
          else
396
            {
397
            $decl_dirs{$q_index}  = "${q_direction}";
398
            }
399
 
400 126 jt_eaton
 
401
 
402
            if(  $decl_types{$q_index})
403
              {
404
              if(  $decl_types{$q_index} eq "wire")
405
                {
406
                $decl_types{$q_index}  = "${q_type}";
407
                }
408
              }
409
            else
410
              {
411
              $decl_types{$q_index}  = "${q_type}";
412
              }
413
 
414
 
415
 
416
 
417
 
418 119 jt_eaton
          if(  $decl_vector{$q_index})
419
            {  unless(  $decl_vector{$q_index} eq "vector"){ $decl_vector{$q_index}  = "${q_vector}";  }}
420
          else  { $decl_vector{$q_index}  = "${q_vector}"; }
421
 
422
          if( $q_vector eq "vector" )
423
            {
424
            if ( defined $decl_lefts{$q_index})
425
               {
426 126 jt_eaton
 
427
 
428
                $_ = $q_left;
429
                if(/(\D+)/)
430
                {
431
                $_ = $decl_lefts{$q_index};
432
                   if(/(\D+)/)
433
                   {
434 130 jt_eaton
                   print "Info:  $variant :: $q_node_name :    $q_left   is NOT  a number            $decl_lefts{$q_index}    is NOT  a number \n";
435 126 jt_eaton
                   #if($decl_lefts{$q_index}   <= $q_left  ) {$decl_lefts{$q_index}   = $q_left;}
436
                   }
437
                   else
438
                   {
439
                   $decl_lefts{$q_index}   = $q_left;
440
                   }
441
                }
442
                else
443
 
444
                {
445
 
446
                $_ = $decl_lefts{$q_index};
447
                   if(/(\D+)/)
448
                   {
449
                   #print "WARNING  $variant :: $q_node_name :    $q_left   is   a number            $decl_lefts{$q_index}    is NOT  a number \n";
450
                   #if($decl_lefts{$q_index}   <= $q_left  ) {$decl_lefts{$q_index}   = $q_left;}
451
                   }
452
                   else
453
                   {
454
                   #print "WARNING  $variant :: $q_node_name :    $q_left   is   a number            $decl_lefts{$q_index}    is   a number \n";
455
                   if($decl_lefts{$q_index}   <= $q_left  ) {$decl_lefts{$q_index}   = $q_left;}
456
                   }
457
                }
458 128 jt_eaton
               unless (defined $decl_rights{$q_index})  {$decl_rights{$q_index}  = $q_right;}
459 119 jt_eaton
               if($decl_rights{$q_index}  >= $q_right ) {$decl_rights{$q_index}  = $q_right;}
460
               }
461
            else
462
               {
463
               $decl_lefts{$q_index}   = $q_left;
464
               $decl_rights{$q_index}  = $q_right;
465
               }
466
            }
467
          }
468
        }
469
     @decl_names      = sys::lib::trim_sort(@decl_names);
470
 
471
 
472
 
473
 
474
 
475
     #/**********************************************************************/
476
     #/*                                                                    */
477 126 jt_eaton
     #/* All port and signal info is now loaded in hashes                   */
478
     #/* Resort on physical name                                            */
479 119 jt_eaton
     #/* Print out module header , parameters and ports                     */
480
     #/*                                                                    */
481
     #/**********************************************************************/
482
 
483
 
484
 
485
 
486 126 jt_eaton
   foreach my $decl_name (@decl_names)
487 120 jt_eaton
 
488 126 jt_eaton
     {
489 119 jt_eaton
 
490 126 jt_eaton
     my $phy_name = $decl_pnames{$decl_name};
491
 
492
     unless ($phy_name) {$phy_name =$decl_name }
493
 
494
     push ( @phy_names,$phy_name);
495
 
496 128 jt_eaton
 
497
     if($opt_debug ){print  "XX-p   $decl_name - $decl_vector{$decl_name} -  $decl_lefts{$decl_name} - $decl_rights{$decl_name} --      $phy_name -   $phy_vector{$phy_name} - $phy_lefts{$phy_name} -  $phy_rights{$phy_name}  \n  ";}
498
 
499
 
500 126 jt_eaton
     if(  $phy_dirs{$phy_name})
501
            {
502
            if(  $phy_dirs{$phy_name} eq "node")
503
              {
504
              $phy_dirs{$phy_name}   = "$decl_dirs{$decl_name}";
505
              }
506
            }
507
          else
508
            {
509
            $phy_dirs{$phy_name}  = "$decl_dirs{$decl_name}";
510
            }
511
 
512
            if(  $phy_types{$phy_name})
513
              {
514
              if(  $phy_types{$phy_name} eq "wire")
515
                {
516
                $phy_types{$phy_name}  = "$decl_types{$decl_name}";
517
                }
518
              }
519
            else
520
              {
521
              $phy_types{$phy_name}  = "$decl_types{$decl_name}";
522
              }
523
 
524
          if(  $phy_vector{$phy_name})
525
            {  unless(  $phy_vector{$phy_name} eq "vector"){ $phy_vector{$phy_name}  = "$decl_vector{$decl_name}";  }}
526
          else  { $phy_vector{$phy_name}  = "$decl_vector{$decl_name}"; }
527
 
528 128 jt_eaton
          if( $decl_vector{$decl_name} eq "vector" )
529 126 jt_eaton
            {
530
            if ( defined $phy_lefts{$phy_name})
531
               {
532
                $_ = $phy_lefts{$phy_name};
533
                if(/(\D+)/)
534
                {
535
                $_ = $phy_lefts{$phy_name};
536
                   if(/(\D+)/)
537
                   {
538
                   }
539
                   else
540
                   {
541
                   $phy_lefts{$phy_name}   = $decl_lefts{$decl_name};
542
                   }
543
                }
544
                else
545
                {
546
                $_ = $phy_lefts{$phy_name};
547
                   if(/(\D+)/)
548
                   {
549
                   }
550
                   else
551
                   {
552
                   if($phy_lefts{$phy_name}   <= $decl_lefts{$decl_name}  ) {$phy_lefts{$phy_name}   = $decl_lefts{$decl_name};}
553
                   }
554
                }
555 128 jt_eaton
               unless ( defined $phy_rights{$phy_name})                 {$phy_rights{$phy_name}  = $decl_rights{$decl_name};}
556 126 jt_eaton
               if($phy_rights{$phy_name}  >= $decl_rights{$decl_name} ) {$phy_rights{$phy_name}  = $decl_rights{$decl_name};}
557
               }
558
            else
559
               {
560
               $phy_lefts{$phy_name}   = $decl_lefts{$decl_name};
561
               $phy_rights{$phy_name}  = $decl_rights{$decl_name};
562
               }
563
            }
564 128 jt_eaton
     if($opt_debug ){print  "XX-q   $decl_name - $decl_vector{$decl_name} -  $decl_lefts{$decl_name} - $decl_rights{$decl_name} --      $phy_name -   $phy_vector{$phy_name} - $phy_lefts{$phy_name} -  $phy_rights{$phy_name}  \n  ";}
565
 
566
 
567
 
568 126 jt_eaton
   }
569
 
570
 
571
 
572
 
573
     @phy_names      = sys::lib::trim_sort(@phy_names);
574
 
575
 
576
 
577
 
578
 
579
 
580
 
581 119 jt_eaton
     #/**********************************************************************/
582
     #/*                                                                    */
583
     #/* Add any and all global parameters with their default values        */
584
     #/*                                                                    */
585
     #/**********************************************************************/
586
 
587
     unless ($opt_local_parameters)
588
     {
589
     my $first = 1;
590
     foreach my $parameter_name (@parameters)
591
        {
592
        my $parameter_value = $parameter_values{$parameter_name};
593
        if($first)
594
          {
595
          print DEST_FILE  "   #( parameter \n      ${parameter_name}=${parameter_value}";
596
          $first=0;
597
          }
598
        else  { print DEST_FILE  ",\n      ${parameter_name}=${parameter_value}";}
599
        }
600
 
601
     if    ($first == 0)   { print DEST_FILE  ")\n"; }
602
       }
603
 
604
 
605
     #/**********************************************************************/
606
     #/*                                                                    */
607
     #/* sort all  ports  with their type, size and direction               */
608
     #/*                                                                    */
609
     #/**********************************************************************/
610
 
611
 
612
     my @port_list  = ();
613
 
614
 
615 126 jt_eaton
     foreach $x_name (@phy_names)
616 119 jt_eaton
        {
617
        my $q_width  = "     ";
618 126 jt_eaton
        if( $phy_vector{$x_name} eq "vector" )  { $q_width = "[ $phy_lefts{$x_name} :  $phy_rights{$x_name}]"}
619 119 jt_eaton
 
620 126 jt_eaton
        if( $phy_dirs{$x_name} ne "node" )
621 119 jt_eaton
          {
622 126 jt_eaton
          push (@port_list,  "$phy_dirs{$x_name}   $phy_types{$x_name}    $q_width        ${x_name}");
623 119 jt_eaton
          }
624
        }
625
 
626
     @port_list      = sys::lib::trim_sort(@port_list);
627
 
628
 
629
     #/**********************************************************************/
630
     #/*                                                                    */
631
     #/* Now add all ports  with their type, size and direction             */
632
     #/*                                                                    */
633
     #/**********************************************************************/
634
 
635
 
636
     print DEST_FILE  "\n    ";
637
     $first = 1;
638
 
639
     foreach $port_line (@port_list)
640
        {
641
          if($first)
642
            {
643
            print DEST_FILE  " (\n ${port_line}";
644
            $first=0;
645
            }
646
          else
647
            {
648
            print DEST_FILE  ",\n ${port_line}";
649
            }
650
 
651
        }
652
 
653
     if    ($first == 0)   { print DEST_FILE  ");\n\n\n\n"; }
654
     elsif ($opt_no_port)  { print DEST_FILE  "\n\n\n\n";  }
655
     else                  { print DEST_FILE  "();\n\n\n\n";}
656
 
657 121 jt_eaton
 
658
 
659
 
660
 
661 119 jt_eaton
     #/**********************************************************************/
662
     #/*                                                                    */
663 121 jt_eaton
     #/* print wire decs for testbench                                      */
664
     #/*                                                                    */
665
     #/**********************************************************************/
666
 
667
 
668 126 jt_eaton
     foreach $x_name (@phy_names)
669 121 jt_eaton
        {
670
 
671 126 jt_eaton
        if( $phy_dirs{$x_name} ne "node" )
672 121 jt_eaton
          {
673 126 jt_eaton
    if ( $phy_vector{$x_name} eq "vector" )
674 121 jt_eaton
             {
675 126 jt_eaton
             push (@tb_adhoc_list,  "\n${x_name}<\/spirit:name>\n\n\n<\/spirit:adHocConnection>\n"     );
676 121 jt_eaton
             }
677
             else
678
            {
679 126 jt_eaton
            push (@tb_adhoc_list,  "\n${x_name}<\/spirit:name>\n\n\n<\/spirit:adHocConnection>\n"     );
680 121 jt_eaton
             }
681
 
682 126 jt_eaton
         }
683 121 jt_eaton
 
684
        }
685
 
686
     @tb_adhoc_list      = sys::lib::trim_sort(@tb_adhoc_list);
687
     print TB_DESIGN_FILE  "\n\n";
688
 
689
     foreach $adhoc_line (@tb_adhoc_list)
690
        {
691
 
692
            print TB_DESIGN_FILE  "${adhoc_line}\n";
693
 
694
 
695
        }
696
 
697
     print TB_DESIGN_FILE  "\n\n";
698
 
699
 
700
 
701
 
702
 
703
 
704
     #/**********************************************************************/
705
     #/*                                                                    */
706 128 jt_eaton
     #/* interfaces for html                                                */
707
     #/*                                                                    */
708
     #/**********************************************************************/
709
 
710
 
711
     foreach $x_name (@phy_names)
712
        {
713
 
714
        if( $phy_dirs{$x_name} ne "node" )
715
          {
716
 
717
         my $interface_name;
718
         my $interface_description;
719
 
720
         foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:doc/socgen:interfaces/socgen:interface/socgen:name[text() = '$x_name']"))
721
             {
722
             $interface_description        = $socgen_cfg->findnodes('../socgen:description/text()')->to_literal ;
723
 
724
             }
725
 
726
 
727
 
728
 
729
          if ( $phy_vector{$x_name} eq "vector" )
730
              { $interface_name  = "${x_name}[${phy_lefts{$x_name}}:${phy_rights{$x_name}} ]"  ; }
731
          else
732
              { $interface_name  = "${x_name}"; }
733
 
734
 
735
 
736
        if( $phy_dirs{$x_name} eq "input"  )
737
          { $interface_in_count  = $interface_in_count  +1 ;
738
            if(length($interface_name)   >=  $interface_in_size  ){$interface_in_size = length($interface_name)  };
739
          };
740
 
741
        if( $phy_dirs{$x_name} eq "output" )
742
          { $interface_out_count = $interface_out_count +1 ;
743
            if(length($interface_name)   >=  $interface_out_size  ){$interface_out_size = length($interface_name)  };
744
 
745
          };
746
        if( $phy_dirs{$x_name} eq "inout"  )
747
          {
748
          $interface_out_count = $interface_out_count +1 ;
749
            if(length($interface_name)   >=  $interface_out_size  ){$interface_out_size = length($interface_name)  };
750
 
751
          };
752
 
753
 
754
 
755
 
756
 
757
 
758
 
759
          push (@html_interface_list,"     
${interface_name}
$phy_dirs{$x_name}
${interface_description}
760
 
761
 
762
 
763
 
764
         }
765
 
766
        }
767
 
768
 
769
 
770
 
771
 
772
 
773
 
774
 
775
 
776
 
777
 
778
 
779
     #/**********************************************************************/
780
     #/*                                                                    */
781
     #/* Add parameters  to html file                                       */
782
     #/*                                                                    */
783
     #/**********************************************************************/
784
 
785
     foreach my $parameter_name (@parameters)
786
        {
787
        my $parameter_value       = $parameter_values{$parameter_name};
788
        my $parameter_description = $parameter_descriptions{$parameter_name};
789
        push (@html_parameter_list,"   
${parameter_name}
${parameter_value}
${parameter_description}
790
        }
791
 
792
 
793
 
794
 
795
 
796
 
797
 
798
     #/**********************************************************************/
799
     #/*                                                                    */
800 121 jt_eaton
     #/* Add parameters  to dut      */
801
     #/*                                                                    */
802
     #/**********************************************************************/
803
print TB_DESIGN_FILE    "\n\n";
804
 
805
 
806
 
807
 
808
print TB_DESIGN_FILE    "\n";
809
print TB_DESIGN_FILE    "dut\n";
810
print TB_DESIGN_FILE    "\n";
811
print TB_DESIGN_FILE    "\n";
812
 
813
 
814
     foreach my $parameter_name (@parameters)
815
        {
816
        print TB_DESIGN_FILE  " ${parameter_name}<\/spirit:configurableElementValue>\n";
817
        }
818
 
819
print TB_DESIGN_FILE    "\n";
820
print TB_DESIGN_FILE    "\n";
821
print TB_DESIGN_FILE    "\n";
822
print TB_DESIGN_FILE    "\n";
823
 
824
 
825
 
826
 
827
     #/**********************************************************************/
828
     #/*                                                                    */
829
     #/* Add parameters  to comp      */
830
     #/*                                                                    */
831
     #/**********************************************************************/
832
print TB_COMP_FILE    "\n\n";
833 125 jt_eaton
print TB_COMP_FILE    "                                                  \n";
834
print TB_COMP_FILE    "                                   \n";
835
print TB_COMP_FILE    "                                                 \n";
836
print TB_COMP_FILE    "              Dut                                   \n";
837
print TB_COMP_FILE    "                                                 \n";
838
print TB_COMP_FILE    "              
839
print TB_COMP_FILE    "                                   spirit:library=\"${project}\"                                    \n";
840
print TB_COMP_FILE    "                                   spirit:name=\"${component}\"                                    \n";
841
print TB_COMP_FILE    "                                   spirit:version=\"${version}_dutg.design\"/>                                   \n";
842
print TB_COMP_FILE    "                                                 \n";
843
print TB_COMP_FILE    "                                         \n";
844 121 jt_eaton
print TB_COMP_FILE    "\n";
845
 
846
 
847
 
848
 
849
 
850
     foreach my $parameter_name (@parameters)
851
        {
852
        my $parameter_value = $parameter_values{$parameter_name};
853
        print TB_COMP_FILE  "    ${parameter_name}${parameter_value}\n";
854
        }
855
 
856 128 jt_eaton
        print TB_COMP_FILE    "\n";
857
        print TB_COMP_FILE    "\n";
858
        print TB_COMP_FILE  "\n";
859 121 jt_eaton
 
860
 
861
 
862
 
863
 
864
 
865
 
866
 
867
 
868 128 jt_eaton
if($opt_html )
869
{
870
   print "Creating documentation for   $vendor $project $component  $version \n";
871 130 jt_eaton
   my $path  ="${home}${projects_dir}/${vendor}/${project}${doc_library_path}";
872 128 jt_eaton
   mkdir $path,0755             unless( -e $path );
873 121 jt_eaton
 
874
 
875 130 jt_eaton
   my $path  ="${home}${projects_dir}/${vendor}/${project}${doc_library_path}${autodoc}";
876 128 jt_eaton
   mkdir $path,0755             unless( -e $path );
877 121 jt_eaton
 
878
 
879 128 jt_eaton
 
880 130 jt_eaton
      $path  ="${home}${projects_dir}/${vendor}/${project}${doc_library_path}${autodoc}/html";
881 128 jt_eaton
   mkdir $path,0755             unless( -e $path );
882
 
883 130 jt_eaton
      $path  ="${home}${projects_dir}/${vendor}/${project}${doc_library_path}/html";
884 128 jt_eaton
   mkdir $path,0755             unless( -e $path );
885
 
886
 
887
 
888 130 jt_eaton
   $outfile ="${home}${projects_dir}/${vendor}/${project}${doc_library_path}/html/${main_module_name}.html";
889 128 jt_eaton
 
890
  unless( -e $outfile )
891
    {
892
    my $cmd = "cp  ${home}/tools/documentation/template.html   $outfile      ";
893
    if (system($cmd)) {}
894
    };
895
 
896 130 jt_eaton
   $outfile ="${home}${projects_dir}/${vendor}/${project}${doc_library_path}${autodoc}/html/${main_module_name}.html";
897 128 jt_eaton
   open HTML_FILE,">$outfile" or die "unable to open $outfile";
898
 
899
 
900
   print HTML_FILE  "   \n";
901
   print HTML_FILE  "   \n";
902
   print HTML_FILE  "   \n";
903
   print HTML_FILE  "     \n";
904
   print HTML_FILE  "   start  \n";
905
   print HTML_FILE  "     \n";
906
   print HTML_FILE  "     \n";
907
   print HTML_FILE  "     \n";
908
   print HTML_FILE  "     \n";
909
   print HTML_FILE  "     \n";
910
   print HTML_FILE  "     \n";
911
   print HTML_FILE  "     \n";
912
   print HTML_FILE  "     \n";
913
   print HTML_FILE  "   \n";
914
   print HTML_FILE  "   \n";
915
   print HTML_FILE  " 

SOCGEN Datasheet:
\n";

916
   print HTML_FILE  "   \n";
917
   print HTML_FILE  " 
\n";
918
   print HTML_FILE  " 
    \n";
919
   print HTML_FILE  "   
  • \n";
  • 920
       print HTML_FILE  "     

    ${main_module_name}
    \n";

    921
       print HTML_FILE  "     

    \n";
    922
     
    923
       foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:doc/socgen:versions/socgen:version/socgen:name[text() = '$version']"))
    924
                 {
    925
                 $module_description        = $socgen_cfg->findnodes('../socgen:description/text()')->to_literal ;
    926
                 }
    927
       print HTML_FILE  " 
    \n";
    928
       print HTML_FILE  " 
    $module_description \n";
    929
       print HTML_FILE  " 
    \n";
    930
     
    931
       print HTML_FILE  "       
  • \n";
  • 932
       print HTML_FILE  "         

    SourceCode
    \n";

    933
       print HTML_FILE  "         

    \n";
    934
       print HTML_FILE  "         \n";
    935
     
    936
     
    937
       print HTML_FILE  "       
  • \n";
  • 938
       print HTML_FILE  "         

    Parameters
    \n";

    939
       print HTML_FILE  "         

    \n";
    940
       print HTML_FILE  "         \n";
    941
     
    942
       print HTML_FILE  "       
  • \n";
  • 943
       print HTML_FILE  "         

    Interface
    \n";

    944
       print HTML_FILE  "         

    \n";
    945
       print HTML_FILE  "         \n";
    946
     
    947
     
    948
       print HTML_FILE  "       
  • \n";
  • 949
       print HTML_FILE  "         

    Children
    \n";

    950
       print HTML_FILE  "         

    \n";
    951
       print HTML_FILE  "         \n";
    952
     
    953
     
    954
     
    955
       print HTML_FILE  "       
  • \n";
  • 956
       print HTML_FILE  "         

    Theory of Operation
    \n";

    957
       print HTML_FILE  "         

    \n";
    958
       print HTML_FILE  "         \n";
    959
     
    960
     
    961
       print HTML_FILE  "       \n";
    962
       print HTML_FILE  "     \n";
    963
       print HTML_FILE  "   \n";
    964
       print HTML_FILE  "   \n";
    965
     
    966
       if($interface_in_count >= $interface_out_count) {$max_lines = $interface_in_count }
    967
       else  {$max_lines = $interface_out_count }
    968
     
    969
       $scale = 1.0000;
    970
       $max_lines =(($max_lines *24)+110)* $scale;
    971
       $max_width = $interface_in_size +  $interface_out_size;
    972
       $max_width =(($max_width * 10) + 343) * $scale ;
    973
     
    974
       print HTML_FILE  " \"\"
    \n";
    975
       print HTML_FILE  " 
    \n";
    976
     
    977
       print HTML_FILE  " 

    Parameters

    \n";
    978
       print HTML_FILE  " 
    \n";
    979
       print HTML_FILE  " 
    \n";
    980
       print HTML_FILE  "   \n";
    981
       print HTML_FILE  " \n"; \n"; \n"; \n"; \n"; \n"; \n";  \n";
    982
       print HTML_FILE  "  
    983
     
    984
       print HTML_FILE  "   
    985
       print HTML_FILE  "      
    Name
    986
       print HTML_FILE  "      
    default
    987
       print HTML_FILE  "      
    Description
    988
       print HTML_FILE  "    
    989
     
    990
     
    991
     
    992
         foreach $html_line (@html_parameter_list)
    993
            {
    994
            print HTML_FILE  "${html_line}\n";
    995
            }
    996
     
    997
     
    998
     
    999
       print HTML_FILE  "   
    1000
       print HTML_FILE  "  
    \n";
    1001
       print HTML_FILE  " 


    \n";

    1002
       print HTML_FILE  " 

    \n";
    1003
       print HTML_FILE  " 


    \n";

    1004
       print HTML_FILE  " 

    \n";
    1005
       print HTML_FILE  " 


    \n";

    1006
       print HTML_FILE  " 

    \n";
    1007
       print HTML_FILE  " 


    \n";

    1008
     
    1009
       print HTML_FILE  " 
    \n";
    1010
       print HTML_FILE  " 

    \n";
    1011
     
    1012
       print HTML_FILE  " 

    Interface 
    \n";

    1013
       print HTML_FILE  "   \n";
    1014
       print HTML_FILE  " 

    \n";
    1015
       print HTML_FILE  " 
    \n";
    1016
       print HTML_FILE  " 
    \n";
    1017
       print HTML_FILE  " 
    \n";
    1018
     
    1019
     
    1020
       print HTML_FILE  "   \n";  \n";  \n";  \n";  \n";  \n";  \n";
    1021
       print HTML_FILE  "  cellpadding=\"4\" cellspacing=\"4\">  \n";
    1022
       print HTML_FILE  "   
    1023
       print HTML_FILE  "     
    1024
       print HTML_FILE  "       
    NAME
    1025
       print HTML_FILE  "       
    Type
    1026
       print HTML_FILE  "       
    Description
    1027
       print HTML_FILE  "     
    1028
         foreach $html_line (@html_interface_list)
    1029
            {
    1030
            print HTML_FILE  "${html_line}\n";
    1031
            }
    1032
       print HTML_FILE  "   
    1033
       print HTML_FILE  "  
    \n";
    1034
       print HTML_FILE  " 


    \n";

    1035
       print HTML_FILE  " 

    \n";
    1036
     
    1037
     
    1038
     
    1039
       print HTML_FILE  " 

    Children

    \n";
    1040
       print HTML_FILE  " 
    \n";
    1041
       print HTML_FILE  "   \n";
    1042
       print HTML_FILE  " \n"; \n"; \n"; \n"; \n"; \n"; \n"; \n"; \n"; \n"; \n"; \n"; \n"; \n"; \n"; \n";  \n";
    1043
       print HTML_FILE  "  
    1044
     
    1045
       print HTML_FILE  "   
    1046
       print HTML_FILE  "      
    Instance
    1047
       print HTML_FILE  "      
    Vendor
    1048
       print HTML_FILE  "      
    Library
    1049
       print HTML_FILE  "      
    Component
    1050
       print HTML_FILE  "      
    Version
    1051
       print HTML_FILE  "    
    1052
     
    1053
         my @spirit_design_files       = yp::lib::find_ipxact_design_files($vendor,$project,$component,$version);
    1054
     
    1055
         foreach  my   $sd_file (@spirit_design_files)
    1056
         {
    1057
     
    1058
         $_ = $sd_file;
    1059
            if(/:::(\S+):::(\S+):::(\S+):::(\S+):::/)
    1060
              {
    1061
              $q_vendor            = $1;
    1062
              $q_library           = $2;
    1063
              $q_design            = $3;
    1064
              $q_version           = $4;
    1065 130 jt_eaton
              $sd_file             = $parser->parse_file(yp::lib::find_ipxact_design($q_vendor,$q_library,$q_design,$q_version));
    1066 128 jt_eaton
              }
    1067
     
    1068
              foreach  my   $x_name ($sd_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName"))
    1069
                {
    1070
                #/**********************************************************************/
    1071
                #/*                                                                    */
    1072
                #/* Lookup VLNV for each instantiated component                        */
    1073
                #/*                                                                    */
    1074
                #/**********************************************************************/
    1075
     
    1076
     
    1077
               my($instance_name)       = $x_name ->findnodes('./text()')->to_literal ;
    1078
               my($vendor_name)         = $x_name  ->findnodes('../spirit:componentRef/@spirit:vendor')->to_literal ;
    1079
               my($library_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:library')->to_literal ;
    1080
               my($component_name)      = $x_name  ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
    1081
               my($version_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
    1082
     
    1083
     
    1084
     
    1085
     
    1086
       print HTML_FILE  "   
    1087
       print HTML_FILE  "      
    $instance_name
    1088
       print HTML_FILE  "      
    $vendor_name
    1089
       print HTML_FILE  "      
    $library_name
    1090
       print HTML_FILE  "      
    $component_name
    1091
       print HTML_FILE  "      
    $version_name
    1092
       print HTML_FILE  "    
    1093
     
    1094
     
    1095
     
    1096
     
    1097
                }
    1098
     
    1099
     
    1100
         }
    1101
     
    1102
       print HTML_FILE  "   
    1103
       print HTML_FILE  "  
    \n";
    1104
       print HTML_FILE  " 


    \n";

    1105
       print HTML_FILE  " 

    \n";
    1106
     
    1107
     
    1108
     
    1109
     
    1110
       print HTML_FILE  " 
    \n";
    1111
       print HTML_FILE  " 
    \n";
    1112
       print HTML_FILE  " 
    \n";
    1113
       print HTML_FILE  " 
    \n";
    1114
       print HTML_FILE  " 
    \n";
    1115
       print HTML_FILE  " 
    \n";
    1116
       print HTML_FILE  " 
    \n";
    1117
       print HTML_FILE  " 
    \n";
    1118
     
    1119
       print HTML_FILE  " \"\"
    \n";
    1120
       print HTML_FILE  " 
    \n";
    1121
     
    1122
       print HTML_FILE  " 
    \n";
    1123
       print HTML_FILE  " 
    \n";
    1124
       print HTML_FILE  " 
    \n";
    1125
       print HTML_FILE  " 
    \n";
    1126
       print HTML_FILE  " 
    \n";
    1127
       print HTML_FILE  " 
    \n";
    1128
       print HTML_FILE  " 
    \n";
    1129
       print HTML_FILE  " 
    \n";
    1130
       print HTML_FILE  " 
    \n";
    1131
       print HTML_FILE  " 
    \n";
    1132
       print HTML_FILE  " 
    \n";
    1133
       print HTML_FILE  " 
    \n";
    1134
       print HTML_FILE  " 
    \n";
    1135
       print HTML_FILE  " 
    \n";
    1136
       print HTML_FILE  " 
    \n";
    1137
       print HTML_FILE  " 
    \n";
    1138
       print HTML_FILE  " 
    \n";
    1139
       print HTML_FILE  " 
    \n";
    1140
       print HTML_FILE  " 
    \n";
    1141
       print HTML_FILE  " 
    \n";
    1142
       print HTML_FILE  " 
    \n";
    1143
       print HTML_FILE  " 
    \n";
    1144
       print HTML_FILE  " 
    \n";
    1145
       print HTML_FILE  " 
    \n";
    1146
       print HTML_FILE  "   \n";
    1147
       print HTML_FILE  "   \n";
    1148
     
    1149
    }
    1150
     
    1151
     
    1152
     
    1153
     
    1154
     
    1155
     
    1156
     
    1157
     
    1158 121 jt_eaton
         #/**********************************************************************/
    1159
         #/*                                                                    */
    1160 119 jt_eaton
         #/* Add any and all local parameters with their default values         */
    1161
         #/*                                                                    */
    1162
         #/**********************************************************************/
    1163
     
    1164
         if ($opt_local_parameters)
    1165
         {
    1166
         foreach my $parameter_name (@parameters)
    1167
            {
    1168
            my $parameter_value = $parameter_values{${parameter_name}};
    1169
            print DEST_FILE  "parameter ${parameter_name} = ${parameter_value};\n";
    1170
            }
    1171
         }
    1172
     
    1173
         #/**********************************************************************/
    1174
         #/*                                                                    */
    1175
         #/* Add all internal wires and regs with their sizes                   */
    1176
         #/*                                                                    */
    1177
         #/**********************************************************************/
    1178 121 jt_eaton
     
    1179
         my @wire_nodes = ();
    1180 119 jt_eaton
     
    1181 121 jt_eaton
     
    1182 126 jt_eaton
         foreach $x_name (@phy_names)
    1183 119 jt_eaton
            {
    1184
            my $q_width  = "     ";
    1185 126 jt_eaton
            if( $phy_vector{$x_name} eq "vector" ){ $q_width = "[ $phy_lefts{$x_name} :  $phy_rights{$x_name}]"}
    1186
            if( $phy_dirs{$x_name} eq "node" )    { push @wire_nodes,     "$phy_types{$x_name}     $q_width              ${x_name};";}
    1187 119 jt_eaton
            }
    1188
     
    1189 121 jt_eaton
         @wire_nodes      = sys::lib::trim_sort(@wire_nodes);
    1190
     
    1191 128 jt_eaton
     
    1192
         unless ($opt_interface_only)
    1193
         {
    1194 121 jt_eaton
         foreach my $wire_node (@wire_nodes)
    1195
         {
    1196
         print DEST_FILE  "${wire_node}\n";
    1197
         }
    1198
     
    1199 119 jt_eaton
         print DEST_FILE  "\n\n\n";
    1200 120 jt_eaton
     
    1201 119 jt_eaton
     
    1202 120 jt_eaton
         while(   my $line_out      = shift(@instantiations))             {  print DEST_FILE  "$line_out";}
    1203 119 jt_eaton
     
    1204 128 jt_eaton
     
    1205
     
    1206
     
    1207 119 jt_eaton
         #/**********************************************************************/
    1208
         #/*                                                                    */
    1209
         #/* After all the data from the ip-xact file has been entered we now   */
    1210
         #/* insert any and all verilog fragments at the end before closing     */
    1211
         #/* the module                                                         */
    1212
         #/*                                                                    */
    1213
         #/**********************************************************************/
    1214
     
    1215
     
    1216
         foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:fileSets/spirit:fileSet/spirit:file/spirit:name"))
    1217
            {
    1218
            my($rtl_file)       = $i_name ->findnodes('./text()')->to_literal;
    1219 120 jt_eaton
            my($file_type)      = $i_name ->findnodes('../spirit:userFileType/text()')->to_literal;
    1220 119 jt_eaton
            my($view_file)      = $i_name ->findnodes('../../spirit:name/text()')->to_literal ;
    1221
     
    1222 120 jt_eaton
            if(($file_type eq "fragment")&& (($view_file eq $view_fileset_name)))
    1223 119 jt_eaton
              {
    1224 130 jt_eaton
              $SRCFILE ="${home}${prefix}/${vendor}__${project}${lib_comp_sep}${component}${comp_xml_sep}/${rtl_file}";
    1225 119 jt_eaton
              open(SRCFILE) or die("Could not open src file.  $SRCFILE ");
    1226
              foreach $line ()
    1227
                 {
    1228
                 chomp($line);
    1229
                 print DEST_FILE  "${line}\n";
    1230
                 }
    1231
              }
    1232
            }
    1233 128 jt_eaton
     
    1234
          }
    1235
     
    1236
     
    1237
     
    1238 119 jt_eaton
         unless ($opt_fragment ) {print DEST_FILE  "\n\n\n  endmodule\n\n";}
    1239 120 jt_eaton
     
    1240 119 jt_eaton
       }
    1241
     
    1242
     
    1243
     
    1244
     
    1245
     
    1246
     
    1247
     
    1248
     
    1249
     
    1250
     
    1251 120 jt_eaton
     
    1252 119 jt_eaton
    #/*********************************************************************************************/
    1253
    #/                                                                                            */
    1254 125 jt_eaton
    #/ this routine does not follow busses down into componentRef                                 */
    1255 119 jt_eaton
    #/                                                                                            */
    1256
    #/                                                                                            */
    1257
    #/                                                                                            */
    1258
    #/                                                                                            */
    1259
    #/*********************************************************************************************/
    1260
     
    1261
     
    1262
     
    1263
     
    1264
    sub parse_busInterface
    1265
       {
    1266
       my @params     = @_;
    1267
       my $depth      = pop(@params);
    1268
       my $busref     = pop(@params);
    1269
       my $version    = pop(@params);
    1270
       my $component  = pop(@params);
    1271
       my $project    = pop(@params);
    1272
       my $vendor     = pop(@params);
    1273
     
    1274
       my $home = cwd();
    1275
     
    1276
       my @out_stack  = ();
    1277
     
    1278 126 jt_eaton
      if($opt_verbose){print "parse_busInterface $vendor $project $component $version \n"; }
    1279 119 jt_eaton
     
    1280
     
    1281 120 jt_eaton
     
    1282 119 jt_eaton
       my $busInterfaceTest = 0;
    1283
     
    1284 128 jt_eaton
     
    1285
     
    1286
     
    1287
    my  @filelist =       yp::lib::parse_component_brothers("$vendor","$project","$component","$version");
    1288
     
    1289
    foreach $line (@filelist)
    1290
       {
    1291
       $_ = $line;
    1292
       if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
    1293
         {
    1294
         $new_project        = $2;
    1295
         $new_component      = $3;
    1296
         $new_vendor         = $1;
    1297
         $new_version        = $4;
    1298
     
    1299 130 jt_eaton
    #     print " FFFFFFFFFFFFFFFF  Brother      $new_vendor  $new_project  $new_component $new_version \n" ;
    1300 128 jt_eaton
     
    1301 130 jt_eaton
        my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_project,$new_component,$new_version));
    1302 128 jt_eaton
     
    1303
     
    1304 119 jt_eaton
       my @mas_slave;
    1305
         push @mas_slave  , "master";
    1306
         push @mas_slave  , "slave";
    1307
     
    1308
         foreach my $seek_type (@mas_slave)
    1309
            {
    1310
     
    1311
     
    1312
         foreach my $bus_iface ($spirit_component_file->findnodes("//spirit:component/spirit:busInterfaces/spirit:busInterface/spirit:${seek_type}"))
    1313
            {
    1314
            my($fff_cname)         = $bus_iface->findnodes('../spirit:name/text()')->to_literal ;
    1315
            my($fff_vendor)        = $bus_iface->findnodes('../spirit:abstractionType/@spirit:vendor')->to_literal ;
    1316
            my($fff_library)       = $bus_iface->findnodes('../spirit:abstractionType/@spirit:library')->to_literal ;
    1317
            my($fff_name)          = $bus_iface->findnodes('../spirit:abstractionType/@spirit:name')->to_literal ;
    1318
            my($fff_version)       = $bus_iface->findnodes('../spirit:abstractionType/@spirit:version')->to_literal ;
    1319
     
    1320
     
    1321
            foreach my $port_face ($spirit_component_file->findnodes('//spirit:component/spirit:busInterfaces/spirit:busInterface/spirit:portMaps/spirit:portMap/spirit:logicalPort'))
    1322
               {
    1323
     
    1324
               my($fff_xxx_name)      = $port_face->findnodes('../../../spirit:name/text()')->to_literal ;
    1325
     
    1326
               my($fff_log_name)      = $port_face->findnodes('./spirit:name/text()')->to_literal ;
    1327
               my($fff_phy_name)      = $port_face->findnodes('../spirit:physicalPort/spirit:name/text()')->to_literal ;
    1328
               my($fff_type_name)     = $port_face->findnodes('../spirit:physicalPort/spirit:wireTypeDefs/spirit:wireTypeDef/spirit:typeName/text()')->to_literal ;
    1329
               my($fff_int_name)      = $port_face->findnodes('../../../spirit:name/text()')->to_literal ;
    1330
     
    1331
               my($fff_left_value)    = $port_face->findnodes('../spirit:physicalPort/spirit:wire/spirit:vector/spirit:left/text()')->to_literal ;
    1332
               my($fff_right_value)   = $port_face->findnodes('../spirit:physicalPort/spirit:wire/spirit:vector/spirit:right/text()')->to_literal ;
    1333
     
    1334
               unless ($fff_type_name)  {$fff_type_name = "wire";};
    1335
     
    1336
               if(  ( $fff_xxx_name  eq  $busref) && (  $busref eq   $fff_cname  )       )
    1337
                 {
    1338
                 $busInterfaceTest = 1;
    1339 125 jt_eaton
     
    1340
     
    1341
     
    1342 130 jt_eaton
                 my $spirit_abstractor_filename     = yp::lib::find_ipxact_abstractionDefinition($fff_vendor,$fff_library,$fff_name,$fff_version);
    1343 125 jt_eaton
     
    1344 130 jt_eaton
                 unless($spirit_abstractor_filename){ print "  $fff_vendor $fff_library $fff_name $fff_version  \n";            }
    1345 125 jt_eaton
     
    1346
     
    1347 130 jt_eaton
                 my $spirit_abstractor_file     = ($parser->parse_file($spirit_abstractor_filename ) ) || die "(OOPs $fff_vendor $fff_library $fff_name $fff_version )";
    1348 119 jt_eaton
     
    1349
     
    1350
     
    1351
                 foreach my $abstr_view ($spirit_abstractor_file->findnodes("//spirit:abstractionDefinition/spirit:ports/spirit:port/spirit:logicalName[text() = '$fff_log_name']"))
    1352
                    {
    1353
     
    1354 130 jt_eaton
                    my $fff_direction = "";
    1355
                    if     ( $seek_type eq "master")
    1356
                       {
    1357
                       my($sss_m_dir)         = $abstr_view->findnodes('../spirit:wire/spirit:onMaster/spirit:direction/text()')->to_literal ;
    1358
                       if    ($sss_m_dir eq "in")  { $sss_m_dir = "input";}
    1359
                       elsif ($sss_m_dir eq "out") { $sss_m_dir = "output";}
    1360
                       $fff_direction = $sss_m_dir;
    1361
                       }
    1362 119 jt_eaton
     
    1363 130 jt_eaton
                    elsif ( $seek_type eq "slave" )
    1364
                       {
    1365
                       my($sss_s_dir)         = $abstr_view->findnodes('../spirit:wire/spirit:onSlave/spirit:direction/text()')->to_literal ;
    1366
                       if    ($sss_s_dir eq "in")  { $sss_s_dir = "input";}
    1367
                       elsif ($sss_s_dir eq "out") { $sss_s_dir = "output";}
    1368 119 jt_eaton
     
    1369 130 jt_eaton
                       $fff_direction = $sss_s_dir;
    1370
                       }
    1371 119 jt_eaton
     
    1372 130 jt_eaton
                      if($fff_left_value ne "")
    1373
                        { push @out_stack, ":::${depth}:::${fff_log_name}:::${fff_phy_name}:::${fff_direction}:::${fff_type_name}:::vector:::${fff_left_value}:::${$fff_right_value}:::"; }
    1374
                      else
    1375
                        { push @out_stack, ":::${depth}:::${fff_log_name}:::${fff_phy_name}:::${fff_direction}:::${fff_type_name}:::scaler:::none:::none:::";    }
    1376 119 jt_eaton
     
    1377
     
    1378
                    }
    1379
                 }
    1380
     
    1381
               }
    1382
           }
    1383
     
    1384
    }
    1385
     
    1386
     
    1387 128 jt_eaton
    }
    1388 119 jt_eaton
     
    1389 128 jt_eaton
    }
    1390 119 jt_eaton
     
    1391
     
    1392
           if ( $busInterfaceTest){
    1393
                                  @out_stack      = sys::lib::trim_sort(@out_stack);
    1394
                                  return(@out_stack);
    1395
                                  }
    1396
     
    1397
     
    1398 125 jt_eaton
         my @spirit_design_files       = yp::lib::find_ipxact_design_files($vendor,$project,$component,$version);
    1399 120 jt_eaton
     
    1400
         foreach  my   $sd_file (@spirit_design_files)
    1401 119 jt_eaton
         {
    1402
     
    1403 125 jt_eaton
         $_ = $sd_file;
    1404
            if(/:::(\S+):::(\S+):::(\S+):::(\S+):::/)
    1405
              {
    1406
              $q_vendor            = $1;
    1407
              $q_library           = $2;
    1408
              $q_design            = $3;
    1409
              $q_version           = $4;
    1410 130 jt_eaton
              $sd_file             = $parser->parse_file(yp::lib::find_ipxact_design($q_vendor,$q_library,$q_design,$q_version));
    1411 125 jt_eaton
              }
    1412 120 jt_eaton
     
    1413
         foreach  my   $x_name ($sd_file->findnodes('//spirit:hierConnections/spirit:hierConnection/@spirit:interfaceRef'))
    1414 119 jt_eaton
            {
    1415
            my($hierConn_name)                   = $x_name ->to_literal ;
    1416
            my($hierConn_comref_name)            = $x_name ->findnodes('../spirit:interface/@spirit:componentRef')->to_literal ;
    1417
            my($hierConn_busref_name)            = $x_name ->findnodes('../spirit:interface/@spirit:busRef')->to_literal ;
    1418
            if($busref eq  $hierConn_name)
    1419
              {
    1420 120 jt_eaton
              foreach  my   $x_name ($sd_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName[text() = '$hierConn_comref_name']"))
    1421 119 jt_eaton
                {
    1422
                #/**********************************************************************/
    1423
                #/*                                                                    */
    1424
                #/* Lookup VLNV for each instantiated component                        */
    1425
                #/*                                                                    */
    1426
                #/**********************************************************************/
    1427
     
    1428
                my($vendor_name)         = $x_name  ->findnodes('../spirit:componentRef/@spirit:vendor')->to_literal ;
    1429
                my($library_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:library')->to_literal ;
    1430
                my($component_name)      = $x_name  ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
    1431
                my($version_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
    1432
                $depth = $depth +1;
    1433
                @out_stack = parse_busInterface ($vendor_name, $library_name,$component_name,$version_name,$hierConn_busref_name,$depth );
    1434
                }
    1435
              }
    1436
            }
    1437 120 jt_eaton
     
    1438
         }
    1439
     
    1440 128 jt_eaton
     
    1441
     
    1442
     
    1443 119 jt_eaton
            @out_stack      = sys::lib::trim_sort(@out_stack);
    1444
            return(@out_stack);
    1445 120 jt_eaton
     
    1446 119 jt_eaton
     
    1447
       }
    1448
     
    1449
     
    1450
     
    1451
     
    1452 120 jt_eaton
     
    1453
     
    1454
     
    1455
     
    1456
     
    1457
     
    1458
     
    1459
     
    1460
     
    1461
     
    1462 119 jt_eaton
    #/*********************************************************************************************/
    1463
    #/                                                                                            */
    1464
    #/                                                                                            */
    1465
    #/                                                                                            */
    1466
    #/                                                                                            */
    1467
    #/                                                                                            */
    1468
    #/                                                                                            */
    1469
    #/*********************************************************************************************/
    1470
     
    1471
     
    1472
     
    1473
     
    1474 120 jt_eaton
    sub parse_design_files
    1475
       {
    1476
       my @params     = @_;
    1477
       my $spirit_component_file      = pop(@params);
    1478
     
    1479 126 jt_eaton
       #print "\n";
    1480 125 jt_eaton
     
    1481
     
    1482
     
    1483
     
    1484
     
    1485
     
    1486
      foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
    1487 120 jt_eaton
        {
    1488 125 jt_eaton
                my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
    1489
                my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
    1490
                my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
    1491
                my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
    1492 130 jt_eaton
                parse_design_files($parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version )) );
    1493 125 jt_eaton
       }
    1494 120 jt_eaton
     
    1495
     
    1496 125 jt_eaton
     
    1497
     
    1498 120 jt_eaton
      foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:hierarchyRef"))
    1499
        {
    1500
                my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
    1501
                my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
    1502
                my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
    1503
                my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
    1504 130 jt_eaton
                if(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version ))
    1505
                  {
    1506
                  parse_design_file($parser->parse_file(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version )) );
    1507
                  }
    1508 120 jt_eaton
     
    1509
     
    1510
     
    1511
     
    1512
     
    1513
      }
    1514
     
    1515
    }
    1516
     
    1517
     
    1518
     
    1519
     
    1520
     
    1521
     
    1522
     
    1523
    #/*********************************************************************************************/
    1524
    #/                                                                                            */
    1525
    #/                                                                                            */
    1526
    #/                                                                                            */
    1527
    #/                                                                                            */
    1528
    #/                                                                                            */
    1529
    #/                                                                                            */
    1530
    #/*********************************************************************************************/
    1531
     
    1532
     
    1533
     
    1534
     
    1535
    sub process_design_files
    1536
       {
    1537
       my @params     = @_;
    1538
       my $spirit_component_file      = pop(@params);
    1539
     
    1540 126 jt_eaton
       #print "\n";
    1541 125 jt_eaton
     
    1542
     
    1543
     
    1544
     
    1545
     
    1546
     
    1547
     
    1548
      foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
    1549 120 jt_eaton
        {
    1550 125 jt_eaton
                my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
    1551
                my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
    1552
                my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
    1553
                my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
    1554 130 jt_eaton
                process_design_files($parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version )) );
    1555 120 jt_eaton
        }
    1556
     
    1557
     
    1558 125 jt_eaton
     
    1559
     
    1560
     
    1561
     
    1562 120 jt_eaton
      foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:hierarchyRef"))
    1563
        {
    1564
                my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
    1565
                my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
    1566
                my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
    1567
                my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
    1568 130 jt_eaton
                if( yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version )  )
    1569
                  {
    1570
                  if($opt_verbose){print "process_design_file  $new_vendor $new_library $new_name $new_version  \n"; }
    1571
                  process_design_file($parser->parse_file(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version )) );
    1572
                  }
    1573
        }
    1574 120 jt_eaton
     
    1575
    }
    1576
     
    1577
     
    1578
     
    1579
     
    1580
     
    1581
     
    1582
     
    1583
     
    1584
     
    1585
     
    1586
    #/*********************************************************************************************/
    1587
    #/                                                                                            */
    1588
    #/                                                                                            */
    1589
    #/                                                                                            */
    1590
    #/                                                                                            */
    1591
    #/                                                                                            */
    1592
    #/                                                                                            */
    1593
    #/*********************************************************************************************/
    1594
     
    1595
     
    1596
     
    1597
     
    1598 119 jt_eaton
    sub parse_design_file
    1599
       {
    1600
       my @params     = @_;
    1601
       my $spirit_design_file      = pop(@params);
    1602
     
    1603
     
    1604
     
    1605
     
    1606 120 jt_eaton
     
    1607 126 jt_eaton
    #print "\n";
    1608 120 jt_eaton
    foreach my $new_comp ($spirit_design_file->findnodes("//spirit:design/spirit:vendor"))
    1609
       {
    1610
       my($new_vendor)          = $new_comp->findnodes('./text()')->to_literal ;
    1611
       my($new_library)         = $new_comp->findnodes('../spirit:library/text()')->to_literal ;
    1612
       my($new_name)            = $new_comp->findnodes('../spirit:name/text()')->to_literal ;
    1613
       my($new_version)         = $new_comp->findnodes('../spirit:version/text()')->to_literal ;
    1614 126 jt_eaton
       #print "WARNING  $new_vendor $new_library $new_name $new_version  DESIGN \n";
    1615 120 jt_eaton
       }
    1616
     
    1617
     
    1618
     
    1619
     
    1620 126 jt_eaton
         #/**********************************************************************/
    1621
         #/*                                                                    */
    1622
         #/* Add all internal wires and regs with their sizes                   */
    1623
         #/*                                                                    */
    1624
         #/**********************************************************************/
    1625
     
    1626
         foreach  my   $i_name ($spirit_design_file->findnodes("//spirit:design/spirit:vendorExtensions/socgen:nodes/socgen:node/spirit:name"))
    1627
            {
    1628
            my($node_name)       = $i_name ->findnodes('./text()')->to_literal ;
    1629
            my($node_busdef)     = $i_name ->findnodes('../socgen:busDef/text()')->to_literal ;
    1630
            my($node_left)       = $i_name ->findnodes('../spirit:wire/spirit:vector/spirit:left/text()')->to_literal ;
    1631
            my($node_right)      = $i_name ->findnodes('../spirit:wire/spirit:vector/spirit:right/text()')->to_literal ;
    1632
            my($node_type)       = $i_name ->findnodes('../spirit:typeName/text()')->to_literal ;
    1633
     
    1634
            unless($node_busdef){   $node_busdef =    $node_name;     }
    1635 120 jt_eaton
     
    1636 126 jt_eaton
            if(  $node_left ne "" ) { push @wire_decs , ":::${node_busdef}:::${node_name}:::node:::${node_type}:::vector:::${node_left}:::${$node_right}:::none:::0:::${node_name}:::XXX:::${node_name}:::"; }
    1637
            else                     { push @wire_decs , ":::${node_busdef}:::${node_name}:::node:::${node_type}:::scaler:::none:::none:::none:::0:::${node_name}:::XXX:::${node_name}:::";   }
    1638 120 jt_eaton
     
    1639 126 jt_eaton
            }
    1640
     
    1641
     
    1642
     
    1643
     
    1644
     
    1645
     
    1646
     
    1647
     
    1648 119 jt_eaton
         #/**********************************************************************/
    1649
         #/*                                                                    */
    1650
         #/* Read each hierConnection and enter signals into wire_decs          */
    1651
         #/*                                                                    */
    1652
         #/**********************************************************************/
    1653
         foreach  my   $x_name ($spirit_design_file->findnodes('//spirit:hierConnections/spirit:hierConnection/@spirit:interfaceRef'))
    1654
            {
    1655
            my($hierConn_name)                   = $x_name ->to_literal ;
    1656
            my($hierConn_comref_name)            = $x_name ->findnodes('../spirit:interface/@spirit:componentRef')->to_literal ;
    1657
            my($hierConn_busref_name)            = $x_name ->findnodes('../spirit:interface/@spirit:busRef')->to_literal ;
    1658
     
    1659
            foreach  my   $x_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName"))
    1660
               {
    1661
               #/**********************************************************************/
    1662
               #/*                                                                    */
    1663
               #/* Lookup VLNV for each instantiated component                        */
    1664
               #/*                                                                    */
    1665
               #/**********************************************************************/
    1666
     
    1667
               my($instance_name)       = $x_name ->findnodes('./text()')->to_literal ;
    1668
              my($vendor_name)         = $x_name  ->findnodes('../spirit:componentRef/@spirit:vendor')->to_literal ;
    1669
             my($library_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:library')->to_literal ;
    1670
             my($component_name)      = $x_name  ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
    1671
             my($version_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
    1672
     
    1673
               if( "$instance_name" eq  "$hierConn_comref_name"     )
    1674
                 {
    1675
                 my  @filelist_sub = parse_busInterface($vendor_name, $library_name,$component_name,$version_name,$hierConn_busref_name,"1" );
    1676
               #/**********************************************************************/
    1677
               #/*                                                                    */
    1678
               #/* follow bus all the way to it's source                              */
    1679
               #/*                                                                    */
    1680
               #/**********************************************************************/
    1681
     
    1682
                 foreach $xxline (@filelist_sub)
    1683
                    {
    1684
                    $_ = $xxline;
    1685
                    if(/:::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::/)
    1686
                      {
    1687
                      $k_depth               = $1;
    1688
                      $k_log_name            = $2;
    1689
                      $k_phy_name            = $3;
    1690
                      $k_direction           = $4;
    1691
                      $k_type                = $5;
    1692
                      $k_vector              = $6;
    1693
                      $k_left                = $7;
    1694
                      $k_right               = $8;
    1695
                      push  @wire_decs,":::${hierConn_name}_${k_log_name}:::${hierConn_name}_${k_log_name}:::${k_direction}:::wire:::${k_vector}:::${k_left}:::${k_right}:::${hierConn_comref_name}:::${k_depth}:::${k_phy_name}:::${hierConn_busref_name}:::${k_log_name}:::";
    1696
                      }
    1697
                    }
    1698
                 }
    1699
               }
    1700
            }
    1701
     
    1702
     
    1703
     
    1704
     
    1705
     
    1706
         #/**************************************************************************/
    1707
         #/*                                                                        */
    1708
         #/* Read each  interconnection and enter sub signals into wire_decs        */
    1709
         #/*                                                                        */
    1710
         #/**************************************************************************/
    1711
     
    1712
     
    1713
     
    1714
     
    1715
         foreach  my   $x_name ($spirit_design_file->findnodes('//spirit:interconnections/spirit:interconnection/spirit:activeInterface/@spirit:componentRef'))
    1716
            {
    1717
            my($hierConn_comref_name)            = $x_name ->to_literal;
    1718
            my($hierConn_busref_name)            = $x_name ->findnodes('../@spirit:busRef')->to_literal ;
    1719
            my($hierConn_name)                   = $x_name ->findnodes('../../spirit:name/text()')->to_literal ;
    1720
     
    1721
            foreach  my   $x_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName"))
    1722
               {
    1723
               #/**********************************************************************/
    1724
               #/*                                                                    */
    1725
               #/* Lookup VLNV for each instantiated component                        */
    1726
               #/*                                                                    */
    1727
               #/**********************************************************************/
    1728
     
    1729
               my($instance_name)       = $x_name ->findnodes('./text()')->to_literal ;
    1730
               my($vendor_name)         = $x_name  ->findnodes('../spirit:componentRef/@spirit:vendor')->to_literal ;
    1731
               my($library_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:library')->to_literal ;
    1732
               my($component_name)      = $x_name  ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
    1733
               my($version_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
    1734
     
    1735
     
    1736
     
    1737
               if( "$instance_name" eq  "$hierConn_comref_name"     )
    1738
                 {
    1739
     
    1740
     
    1741
     
    1742
               #/**********************************************************************/
    1743
               #/*                                                                    */
    1744
               #/* follow bus all the way to it's source                              */
    1745
               #/*                                                                    */
    1746
               #/**********************************************************************/
    1747
     
    1748
     
    1749
                 my  @filelist_sub = parse_busInterface($vendor_name, $library_name,$component_name,$version_name,$hierConn_busref_name,"1" );
    1750
                 foreach $xxline (@filelist_sub)
    1751
                    {
    1752
     
    1753
     
    1754
                    $_ = $xxline;
    1755
                    if(/:::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::/)
    1756
                      {
    1757
                      $k_depth               = $1;
    1758
                      $k_log_name            = $2;
    1759
                      $k_phy_name            = $3;
    1760
                      $k_direction           = $4;
    1761
                      $k_type                = $5;
    1762
                      $k_vector              = $6;
    1763
                      $k_left                = $7;
    1764
                      $k_right               = $8;
    1765
     
    1766
     
    1767
                      push  @wire_decs,":::${hierConn_name}_${k_log_name}:::${hierConn_name}_${k_log_name}:::node:::wire:::${k_vector}:::${k_left}:::${k_right}:::${hierConn_comref_name}:::${k_depth}:::${k_phy_name}:::${hierConn_busref_name}:::${k_log_name}:::";
    1768
                      }
    1769
                    }
    1770
                 }
    1771
               }
    1772
            }
    1773
     
    1774
     
    1775
     
    1776
         #/*******************************************************************************/
    1777
         #/*                                                                             */
    1778
         #/* Read each  interconnection and enter modified signals into wire_decs        */
    1779
         #/*                                                                             */
    1780
         #/*******************************************************************************/
    1781
     
    1782
     
    1783
     
    1784
     
    1785
     
    1786
            foreach  my  $k_name ($spirit_design_file->findnodes('//spirit:interconnections/spirit:interconnection/spirit:activeInterface/spirit:portMaps/spirit:portMap/spirit:logicalPort/spirit:name'))
    1787
               {
    1788
               my($lp_name)                = $k_name ->to_literal;
    1789
               my($lp_pname)               = $k_name ->findnodes('../../spirit:physicalPort/spirit:name/text()')->to_literal ;
    1790
               my($lp_left)                = $k_name ->findnodes('../../spirit:physicalPort/spirit:wire/spirit:vector/spirit:left/text()')->to_literal ;
    1791
               my($lp_right)               = $k_name ->findnodes('../../spirit:physicalPort/spirit:wire/spirit:vector/spirit:right/text()')->to_literal ;
    1792
               my($lp_componentref_name)   = $k_name ->findnodes('../../../../@spirit:componentRef')->to_literal ;
    1793
               my($lp_busref_name)         = $k_name ->findnodes('../../../../@spirit:busRef')->to_literal ;
    1794
               my($lp_interconnect_name)   = $k_name ->findnodes('../../../../../spirit:name/text()')->to_literal ;
    1795
     
    1796
     
    1797
               if ( $lp_pname eq '' ) { $lp_pname ="${lp_interconnect_name}_${lp_name}";}
    1798
               if ( $lp_left  eq '' ) { $lp_left ="none";}
    1799
               if ( $lp_right eq '' ) { $lp_right ="none";}
    1800
     
    1801
     
    1802
     
    1803
              if ( $lp_left  eq 'none' )
    1804
              {
    1805
               push  @wire_decs,":::${lp_interconnect_name}_${lp_name}:::${lp_pname}:::node:::wire:::scaler:::none:::none:::${lp_componentref_name}:::0:::${lp_interconnect_name}_${lp_name}:::${lp_busref_name}:::${lp_pname}:::";
    1806
              }
    1807
              else
    1808
              {
    1809
               push  @wire_decs,":::${lp_interconnect_name}_${lp_name}:::${lp_pname}:::node:::wire:::vector:::${lp_left}:::${lp_right}:::${lp_componentref_name}:::0:::${lp_interconnect_name}_${lp_name}:::${lp_busref_name}:::${lp_pname}:::";
    1810
              }
    1811
               }
    1812
     
    1813
     
    1814
     
    1815
     
    1816
     
    1817
     
    1818
     
    1819
     
    1820
         #/**********************************************************************/
    1821
         #/*                                                                    */
    1822
         #/* Read all adHocConnections and load instance connect info into array*/
    1823
         #/*                                                                    */
    1824
         #/**********************************************************************/
    1825
     
    1826
     
    1827
         foreach  my   $i_xame ($spirit_design_file->findnodes('//spirit:adHocConnections/spirit:adHocConnection/spirit:internalPortReference/@spirit:componentRef'))
    1828
            {
    1829
            my($comp_name)    = $i_xame ->to_literal;
    1830
            my($int_value)    = $i_xame ->findnodes('../../spirit:name/text()')->to_literal ;
    1831 126 jt_eaton
            my($tied_value)   = $i_xame ->findnodes('../../@spirit:tiedValue')->to_literal ;
    1832 119 jt_eaton
            my($int_name)     = $i_xame ->findnodes('../@spirit:portRef')->to_literal ;
    1833 126 jt_eaton
            my($vec_name)     = $i_xame ->findnodes('../../spirit:externalPortReference/@spirit:portRef')->to_literal ;
    1834
            my($vec_left)     = $i_xame ->findnodes('../../spirit:externalPortReference/@spirit:left')->to_literal ;
    1835
            my($vec_right)    = $i_xame ->findnodes('../../spirit:externalPortReference/@spirit:right')->to_literal ;
    1836 124 jt_eaton
     
    1837
     
    1838 126 jt_eaton
    # print "XXXXXX  $comp_name  $int_name  ( $int_value  $tied_value  )   $vec_name $vec_left $vec_right  \n";
    1839 124 jt_eaton
     
    1840 126 jt_eaton
     
    1841
            unless ($int_value)
    1842
             {$int_value = "_DUMMY_";
    1843
             }
    1844
     
    1845
     
    1846
            if($tied_value )
    1847
              {
    1848
              push @inst_conns , ":::${comp_name}:::adhoc:::${int_name}:::${tied_value}:::scaler:::none:::none:::";
    1849
              }
    1850
            elsif($vec_left ne "")
    1851 119 jt_eaton
              {
    1852
              push @inst_conns , ":::${comp_name}:::adhoc:::${int_name}:::${int_value}:::vector:::${vec_left}:::${vec_right}:::";
    1853 126 jt_eaton
              push @wire_decs  , ":::${vec_name}:::${int_value}:::node:::wire:::vector:::${vec_left}:::${$vec_right}:::none:::0:::${int_value}:::XXX:::${vec_name}:::";
    1854 119 jt_eaton
              }
    1855
            else
    1856
              {
    1857
              push @inst_conns , ":::${comp_name}:::adhoc:::${int_name}:::${int_value}:::scaler:::none:::none:::";
    1858 126 jt_eaton
              push @wire_decs  , ":::${vec_name}:::${int_value}:::node:::wire:::scaler:::none:::none:::none:::0:::${int_value}:::XXX:::${vec_name}:::";
    1859 119 jt_eaton
              }
    1860 126 jt_eaton
     
    1861
     
    1862 119 jt_eaton
            }
    1863
     
    1864
     
    1865
     
    1866
     
    1867
     
    1868
     
    1869
     
    1870
     
    1871
     
    1872
     
    1873 126 jt_eaton
     
    1874
     
    1875 119 jt_eaton
     
    1876
     
    1877
     
    1878
     
    1879
     
    1880
     
    1881
     
    1882
         #/**********************************************************************/
    1883
         #/*                                                                    */
    1884
         #/* extract bus instance connections from wire_decs                    */
    1885
         #/*                                                                    */
    1886
         #/**********************************************************************/
    1887
     
    1888 126 jt_eaton
         #print "+-+";
    1889 119 jt_eaton
     
    1890
     
    1891
     
    1892
         my @inst_names  = ();
    1893
         my @inst_Inames  = ();
    1894
         my %inst_ports  = ();
    1895
         my %inst_sigs   = ();
    1896
         my %inst_vector = ();
    1897
         my %inst_left   = ();
    1898
         my %inst_right  = ();
    1899
     
    1900
     
    1901
         foreach $line (@wire_decs)
    1902
            {
    1903
            $_ = $line;
    1904 128 jt_eaton
     
    1905
     
    1906 119 jt_eaton
            if(/:::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::/)
    1907
              {
    1908
              my $t_index               = $1;
    1909
              my $t_node_name           = $2;
    1910
              my $t_direction           = $3;
    1911
              my $t_type                = $4;
    1912
              my $t_vector              = $5;
    1913
              my $t_left                = $6;
    1914
              my $t_right               = $7;
    1915
              my $t_instance            = $8;
    1916
              my $t_depth               = $9;
    1917
              my $t_phy_name            = $10;
    1918
              my $t_busref_name         = $11;
    1919
              my $t_abslog_name         = $12;
    1920
     
    1921
            if( 1)
    1922
              {
    1923
     
    1924
             push ( @inst_names, "${t_instance}_${t_busref_name}_${t_index}");
    1925
     
    1926
             $inst_Inames{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_instance}";
    1927
     
    1928
             if(  $inst_sigs{"${t_instance}_${t_busref_name}_${t_index}"})
    1929
                {
    1930
                if(  $inst_sigs{"${t_instance}_${t_busref_name}_${t_index}"} eq ${t_index})
    1931
                  {
    1932
                  $inst_sigs{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_node_name}";
    1933
                  }
    1934
                }
    1935
             else
    1936
                {
    1937
                $inst_sigs{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_node_name}";
    1938
                }
    1939
     
    1940
             if   ($t_depth >= 2 )      { $inst_ports{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_busref_name}_${t_abslog_name}" ;}
    1941
             elsif($t_depth == 1 )      { $inst_ports{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_phy_name}";}
    1942
     
    1943
             if(  $inst_vector{"${t_instance}_${t_busref_name}_${t_index}"})
    1944
                {
    1945
                if(  $inst_vector{"${t_instance}_${t_busref_name}_${t_index}"} eq "scaler")
    1946
                  {$inst_vector{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_vector}";}
    1947
                }
    1948
             else
    1949
                {$inst_vector{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_vector}";}
    1950
     
    1951
             unless(  $inst_left{"${t_instance}_${t_busref_name}_${t_index}"} eq '')
    1952
                {
    1953
                if(  $inst_left{"${t_instance}_${t_busref_name}_${t_index}"} eq "none")
    1954
                  {
    1955
                  $inst_left{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_left}";
    1956
                  }
    1957
                elsif(  $inst_left{"${t_instance}_${t_busref_name}_${t_index}"} < ${t_left})
    1958
                  {
    1959
                  $inst_left{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_left}";
    1960
                  }
    1961
                }
    1962
              else
    1963
                {
    1964
                $inst_left{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_left}";
    1965
                }
    1966
     
    1967
              unless(  $inst_right{"${t_instance}_${t_busref_name}_${t_index}"} eq '')
    1968
                {
    1969
                if(  $inst_right{"${t_instance}_${t_busref_name}_${t_index}"} eq "none")
    1970
                  {
    1971
                  $inst_right{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_right}";
    1972
                  }
    1973
                elsif(  $inst_right{"${t_instance}_${t_busref_name}_${t_index}"} < ${t_right})
    1974
                  {
    1975
                  $inst_right{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_right}";
    1976
                  }
    1977
                }
    1978
              else {$inst_right{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_right}";}
    1979
     
    1980
            }
    1981
          }
    1982
         }
    1983
         @inst_names = sys::lib::trim_sort(@inst_names);
    1984
         foreach $i_name (@inst_names)
    1985
             {
    1986
            unless($inst_Inames{$i_name} eq "none")
    1987
             {
    1988
             if($inst_vector{$i_name} eq "vector"  )
    1989
               {
    1990 126 jt_eaton
              push @inst_conns ,":::$inst_Inames{$i_name}:::adhoc:::$inst_ports{$i_name}:::$inst_sigs{$i_name}:::vector:::$inst_left{$i_name}:::$inst_right{$i_name}:::";
    1991 119 jt_eaton
              }
    1992
            else
    1993
              {
    1994 126 jt_eaton
              push @inst_conns ,":::$inst_Inames{$i_name}:::adhoc:::$inst_ports{$i_name}:::$inst_sigs{$i_name}:::scaler:::none:::none:::";
    1995 119 jt_eaton
     
    1996
               }
    1997
             }
    1998
             }
    1999 120 jt_eaton
         }
    2000 119 jt_eaton
     
    2001
     
    2002
     
    2003
     
    2004
     
    2005
     
    2006
     
    2007
     
    2008
     
    2009 120 jt_eaton
    #/*********************************************************************************************/
    2010
    #/                                                                                            */
    2011
    #/                                                                                            */
    2012
    #/                                                                                            */
    2013
    #/                                                                                            */
    2014
    #/                                                                                            */
    2015
    #/                                                                                            */
    2016
    #/*********************************************************************************************/
    2017 119 jt_eaton
     
    2018
     
    2019
     
    2020
     
    2021 120 jt_eaton
    sub process_design_file
    2022
       {
    2023
       my @params     = @_;
    2024
       my $spirit_design_file      = pop(@params);
    2025 119 jt_eaton
     
    2026
     
    2027
     
    2028
     
    2029
     
    2030 126 jt_eaton
    #print "\n";
    2031 120 jt_eaton
    foreach my $new_comp ($spirit_design_file->findnodes("//spirit:design/spirit:vendor"))
    2032
       {
    2033
       my($new_vendor)          = $new_comp->findnodes('./text()')->to_literal ;
    2034
       my($new_library)         = $new_comp->findnodes('../spirit:library/text()')->to_literal ;
    2035
       my($new_name)            = $new_comp->findnodes('../spirit:name/text()')->to_literal ;
    2036
       my($new_version)         = $new_comp->findnodes('../spirit:version/text()')->to_literal ;
    2037
    #   print "XXXXXX-  $new_vendor $new_library $new_name $new_version  DESIGN \n";
    2038
       }
    2039 119 jt_eaton
     
    2040
     
    2041
     
    2042 126 jt_eaton
     
    2043
     
    2044 119 jt_eaton
         #/**********************************************************************/
    2045
         #/*                                                                    */
    2046
         #/* Instantiate each component with parameters and port connections    */
    2047
         #/*                                                                    */
    2048
         #/* If the component doesn't have a instance name then this is skipped */
    2049
         #/*                                                                    */
    2050
         #/**********************************************************************/
    2051
     
    2052 126 jt_eaton
         #print "+-+";
    2053 119 jt_eaton
     
    2054
         push @instantiations  , "////////////////////////////////////////////////////////////////\n";
    2055
     
    2056 126 jt_eaton
     
    2057
         @inst_conns = sys::lib::trim_sort(@inst_conns);
    2058
     
    2059
     
    2060
     
    2061
     
    2062
     
    2063
     
    2064 119 jt_eaton
         foreach  my   $i_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName"))
    2065
            {
    2066
            my($instance_name)       = $i_name ->findnodes('./text()')->to_literal ;
    2067 122 jt_eaton
            my($vendor_name)         = $i_name  ->findnodes('../spirit:componentRef/@spirit:vendor')->to_literal ;
    2068
            my($library_name)        = $i_name  ->findnodes('../spirit:componentRef/@spirit:library')->to_literal ;
    2069 119 jt_eaton
            my($component_name)      = $i_name  ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
    2070
            my($version_name)        = $i_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
    2071
     
    2072 122 jt_eaton
            my $module_name = yp::lib::get_module_name($vendor_name,$library_name,$component_name,$version_name) ;
    2073
     
    2074
     
    2075 126 jt_eaton
     
    2076
     
    2077
     
    2078
     
    2079
     
    2080 119 jt_eaton
            if($instance_name)
    2081
              {
    2082 122 jt_eaton
              push @instantiations  , "$module_name\n";
    2083 119 jt_eaton
              $first = 1;
    2084
     
    2085
              foreach  my   $i_parameter ($spirit_design_file->findnodes("//spirit:componentInstance[spirit:instanceName/text() = '$instance_name']/spirit:configurableElementValues/spirit:configurableElementValue/\@spirit:referenceId"))
    2086
                 {
    2087
                 my($foo_name)       = $i_parameter ->to_literal ;
    2088
                 my($foo_value)      = $i_parameter ->findnodes('../text()')->to_literal ;
    2089 124 jt_eaton
     
    2090
     
    2091
     
    2092
     
    2093 119 jt_eaton
                 if($first)
    2094
                   {
    2095
                   push @instantiations  , "#( .${foo_name} (${foo_value})";
    2096
                   $first = 0;
    2097
                   }
    2098
                 else  {push @instantiations  , ",\n   .${foo_name} (${foo_value})";}
    2099
                 }
    2100
     
    2101
                 if($first == 0)  { push @instantiations  , ")\n";}
    2102
                 push @instantiations  , "$instance_name \n   (\n ";
    2103
                 $first = 1;
    2104
     
    2105 126 jt_eaton
     
    2106
     
    2107
     
    2108
                 foreach $line (@inst_conns)
    2109 119 jt_eaton
                    {
    2110
                    $_ = $line;
    2111
     
    2112
                    if(/:::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::/)
    2113
                      {
    2114
                      my $z_instance_name           = $1;
    2115
                      my $z_busRef_name   = $2;
    2116
                      my $z_port_name           = $3;
    2117
                      my $z_signal_name           = $4;
    2118
                      my $z_vecscal           = $5;
    2119
                      my $z_left           = $6;
    2120
                      my $z_right           = $7;
    2121 126 jt_eaton
     
    2122
                      if($opt_debug ){print  "YYYYYY--    $line  \n";}
    2123
     
    2124 119 jt_eaton
                      if($z_vecscal eq "vector")
    2125
                        {
    2126
                        if($z_left eq $z_right){$z_signal_name =  "${z_signal_name}[${z_left}]" ;}
    2127
                        else    {$z_signal_name =  "${z_signal_name}[${z_left}:${z_right}]" ;}
    2128
                        }
    2129 124 jt_eaton
     
    2130
                      if ($z_signal_name eq "_DUMMY_")  {$z_signal_name = "      ";}
    2131
     
    2132 119 jt_eaton
                      if($instance_name eq  $z_instance_name )
    2133
                        {
    2134
                        if($first)
    2135
                          {
    2136
                          push @instantiations  ,          "  .${z_port_name}         (${z_signal_name})";
    2137
                          $first =0;
    2138
                          }
    2139
                        else   {           push @instantiations  , ",\n   .${z_port_name}         (${z_signal_name})";}
    2140
                        }
    2141
                      }
    2142
                    }
    2143
     
    2144 126 jt_eaton
         #print ".";
    2145 119 jt_eaton
         push @instantiations  , ");\n\n";
    2146
         }
    2147
         }
    2148
         }
    2149
     
    2150
     
    2151
     
    2152
     
    2153
     
    2154
     
    2155
     
    2156 120 jt_eaton
     
    2157
     
    2158 119 jt_eaton
    #/*********************************************************************************************/
    2159
    #/                                                                                            */
    2160
    #/                                                                                            */
    2161
    #/                                                                                            */
    2162
    #/                                                                                            */
    2163
    #/                                                                                            */
    2164
    #/                                                                                            */
    2165
    #/*********************************************************************************************/
    2166
     
    2167
     
    2168
     
    2169
     
    2170
    sub parse_component_file
    2171
       {
    2172
       my @params     = @_;
    2173
       my $spirit_component_file      = pop(@params);
    2174
     
    2175
     
    2176 126 jt_eaton
    #print "\n";
    2177 120 jt_eaton
    foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:vendor"))
    2178
       {
    2179
       my($new_vendor)          = $new_comp->findnodes('./text()')->to_literal ;
    2180
       my($new_library)         = $new_comp->findnodes('../spirit:library/text()')->to_literal ;
    2181
       my($new_name)            = $new_comp->findnodes('../spirit:name/text()')->to_literal ;
    2182
       my($new_version)         = $new_comp->findnodes('../spirit:version/text()')->to_literal ;
    2183 126 jt_eaton
       if($opt_verbose){print "parse_component_file   $new_vendor $new_library $new_name $new_version  COMPONENT \n";}
    2184 120 jt_eaton
       }
    2185
     
    2186
     
    2187
     
    2188
     
    2189 121 jt_eaton
         #/**********************************************************************/
    2190
         #/*                                                                    */
    2191
         #/* parse parameters and values                                        */
    2192
         #/*                                                                    */
    2193
         #/**********************************************************************/
    2194
     
    2195
         foreach  my   $i_name ($spirit_component_file->findnodes('//spirit:model/spirit:modelParameters/spirit:modelParameter/spirit:name'))
    2196
            {
    2197
            my($parameter_name)     = $i_name ->to_literal;
    2198
            my($parameter_default)  = $i_name ->findnodes('../spirit:value/text()')->to_literal ;
    2199
     
    2200
            unless(defined $parameter_values{$parameter_name})
    2201
             {
    2202
             push ( @parameters,  "$parameter_name");
    2203 125 jt_eaton
             $parameter_values{$parameter_name} = ${parameter_default};
    2204 128 jt_eaton
    #         $parameter_descriptions{$parameter_name} = "Duhkkk";
    2205
     
    2206
     
    2207
             foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:doc/socgen:parameters/socgen:parameter/socgen:name[text() = '$parameter_name']"))
    2208
                 {
    2209
                 my($param_description)        = $socgen_cfg->findnodes('../socgen:description/text()')->to_literal ;
    2210
                 $parameter_descriptions{$parameter_name} = $param_description ;
    2211
                 }
    2212
     
    2213
     
    2214
     
    2215 125 jt_eaton
             };
    2216 121 jt_eaton
     
    2217
            }
    2218
     
    2219
     
    2220
     
    2221
     
    2222
     
    2223
     
    2224
     
    2225 125 jt_eaton
    foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
    2226 120 jt_eaton
       {
    2227 125 jt_eaton
        my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
    2228
        my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
    2229
        my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
    2230
        my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
    2231 130 jt_eaton
        if(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version))
    2232 120 jt_eaton
         {
    2233 130 jt_eaton
         parse_component_file($parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version))    );
    2234 120 jt_eaton
         }
    2235
     
    2236 125 jt_eaton
       }
    2237 120 jt_eaton
     
    2238
     
    2239
     
    2240
     
    2241
     
    2242 119 jt_eaton
         #/**********************************************************************/
    2243
         #/*                                                                    */
    2244
         #/* Read each  busInterface and save master/slave direction            */
    2245
         #/*                                                                    */
    2246
         #/**********************************************************************/
    2247
     
    2248
         my @mas_slave;
    2249
     
    2250
         push @mas_slave  , "master";
    2251
         push @mas_slave  , "slave";
    2252
     
    2253
         foreach $seek_type (@mas_slave)
    2254
            {
    2255
     
    2256
             foreach my $bus_iface ($spirit_component_file->findnodes("//spirit:component/spirit:busInterfaces/spirit:busInterface/spirit:${seek_type}"))
    2257
                {
    2258
                my($mmm_cname)         = $bus_iface->findnodes('../spirit:name/text()')->to_literal ;
    2259
                my($mmm_vendor)        = $bus_iface->findnodes('../spirit:abstractionType/@spirit:vendor')->to_literal ;
    2260
                my($mmm_library)       = $bus_iface->findnodes('../spirit:abstractionType/@spirit:library')->to_literal ;
    2261
                my($mmm_name)          = $bus_iface->findnodes('../spirit:abstractionType/@spirit:name')->to_literal ;
    2262
                my($mmm_version)       = $bus_iface->findnodes('../spirit:abstractionType/@spirit:version')->to_literal ;
    2263
     
    2264
                foreach my $port_face ($spirit_component_file->findnodes('//spirit:component/spirit:busInterfaces/spirit:busInterface/spirit:portMaps/spirit:portMap/spirit:logicalPort'))
    2265
                   {
    2266
                   my($rrr_log_name)      = $port_face->findnodes('./spirit:name/text()')->to_literal ;
    2267
                   my($rrr_phy_name)      = $port_face->findnodes('../spirit:physicalPort/spirit:name/text()')->to_literal ;
    2268
                   my($rrr_type_name)     = $port_face->findnodes('../spirit:physicalPort/spirit:wireTypeDefs/spirit:wireTypeDef/spirit:typeName/text()')->to_literal ;
    2269
                   my($rrr_int_name)      = $port_face->findnodes('../../../spirit:name/text()')->to_literal ;
    2270
                   my($rrr_left_value)    = $port_face->findnodes('../spirit:physicalPort/spirit:wire/spirit:vector/spirit:left/text()')->to_literal ;
    2271
                   my($rrr_right_value)   = $port_face->findnodes('../spirit:physicalPort/spirit:wire/spirit:vector/spirit:right/text()')->to_literal ;
    2272
     
    2273
                   unless ($rrr_type_name)  {$rrr_type_name = "wire";}
    2274
     
    2275
                   if(   $mmm_cname  eq  $rrr_int_name )
    2276
                     {
    2277
     
    2278 130 jt_eaton
                     my $spirit_abstractor_filename    = yp::lib::find_ipxact_abstractionDefinition($mmm_vendor,$mmm_library,$mmm_name,$mmm_version);
    2279 125 jt_eaton
     
    2280 130 jt_eaton
                     unless($spirit_abstractor_filename)                   {print "  $mmm_vendor $mmm_library $mmm_name $mmm_version  \n" }
    2281 125 jt_eaton
     
    2282 130 jt_eaton
                     my $spirit_abstractor_file    = ($parser->parse_file($spirit_abstractor_filename)
    2283 125 jt_eaton
     
    2284 122 jt_eaton
                    ) || die "(OOPs $mmm_vendor $mmm_library $mmm_name $mmm_version )";
    2285
     
    2286
     
    2287
     
    2288 119 jt_eaton
                     foreach my $abstr_view ($spirit_abstractor_file->findnodes("//spirit:abstractionDefinition/spirit:ports/spirit:port/spirit:logicalName[text() = '$rrr_log_name']"))
    2289
                        {
    2290 130 jt_eaton
                        my $rrr_direction = "";
    2291
                        if( $seek_type eq "master")
    2292
                          {
    2293
                          my($sss_m_dir)         = $abstr_view->findnodes('../spirit:wire/spirit:onMaster/spirit:direction/text()')->to_literal ;
    2294
                          if    ($sss_m_dir eq "in")  { $sss_m_dir = "input";}
    2295
                          elsif ($sss_m_dir eq "out") { $sss_m_dir = "output";}
    2296
                          $rrr_direction = $sss_m_dir;
    2297 119 jt_eaton
     
    2298 130 jt_eaton
                          }
    2299
                        else
    2300
                          {
    2301
                          my($sss_s_dir)         = $abstr_view->findnodes('../spirit:wire/spirit:onSlave/spirit:direction/text()')->to_literal ;
    2302
                          if    ($sss_s_dir eq "in")  { $sss_s_dir = "input";}
    2303
                          elsif ($sss_s_dir eq "out") { $sss_s_dir = "output";}
    2304
                          $rrr_direction = $sss_s_dir;
    2305 119 jt_eaton
     
    2306 130 jt_eaton
                          }
    2307
     
    2308
     
    2309
                         if($rrr_left_value ne "")
    2310 119 jt_eaton
                            {
    2311 130 jt_eaton
                            push @wire_decs , ":::${mmm_cname}_${rrr_log_name}:::${rrr_phy_name}:::${rrr_direction}:::${rrr_type_name}:::vector:::${rrr_left_value}:::${$rrr_right_value}:::none:::0:::${rrr_phy_name}:::XXX:::${rrr_log_name}:::";
    2312 119 jt_eaton
                            }
    2313
                          else
    2314
                            {
    2315 130 jt_eaton
                            push @wire_decs , ":::${mmm_cname}_${rrr_log_name}:::${rrr_phy_name}:::${rrr_direction}:::${rrr_type_name}:::scaler:::none:::none:::none:::0:::${rrr_phy_name}:::XXX:::${rrr_log_name}:::";
    2316 119 jt_eaton
                            }
    2317
                        }
    2318
                     }
    2319
                   }
    2320 122 jt_eaton
            }
    2321 119 jt_eaton
         }
    2322
     
    2323
     
    2324
     
    2325
     
    2326
         #/**********************************************************************/
    2327
         #/*                                                                    */
    2328
         #/* Read all ports and store into array                                */
    2329
         #/*                                                                    */
    2330
         #/**********************************************************************/
    2331
     
    2332
         foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:ports/spirit:port/spirit:name"))
    2333
            {
    2334
            my($port_name)       = $i_name ->findnodes('./text()')->to_literal ;
    2335
            my($direction)       = $i_name ->findnodes('../spirit:wire/spirit:direction/text()')->to_literal ;
    2336
            my($left)            = $i_name ->findnodes('../spirit:wire/spirit:vector/spirit:left/text()')->to_literal ;
    2337
            my($right)           = $i_name ->findnodes('../spirit:wire/spirit:vector/spirit:right/text()')->to_literal ;
    2338
            my($type)            = $i_name ->findnodes('../spirit:wireTypeDefs/spirit:wireTypeDef/spirit:typeName/text()')->to_literal ;
    2339
     
    2340
     
    2341
            if    ($direction eq "in")  { $direction = "input";}
    2342
            elsif ($direction eq "out") { $direction = "output";}
    2343
     
    2344
     
    2345 122 jt_eaton
            if($left ne "")  { push @wire_decs , ":::${port_name}:::${port_name}:::${direction}:::${type}:::vector:::${left}:::${right}:::none:::0:::${port_name}:::XXX:::${port_name}:::";  }
    2346 119 jt_eaton
            else       { push @wire_decs , ":::${port_name}:::${port_name}:::${direction}:::${type}:::scaler:::none:::none:::none:::0:::${port_name}:::XXX:::${port_name}:::";          }
    2347
            }
    2348
     
    2349
     
    2350
     
    2351
     
    2352
    }
    2353
     
    2354
     
    2355
    1
    2356
     

    powered by: WebSVN 2.1.0

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