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

Subversion Repositories socgen

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

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

SOCGEN Datasheet:
\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  "     

    ${main_module_name}
    \n";

    913
       print HTML_FILE  "     

    \n";
    914
     
    915
       foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:doc/socgen:versions/socgen:version/socgen:name[text() = '$version']"))
    916
                 {
    917
                 $module_description        = $socgen_cfg->findnodes('../socgen:description/text()')->to_literal ;
    918
                 }
    919
       print HTML_FILE  " 
    \n";
    920
       print HTML_FILE  " 
    $module_description \n";
    921
       print HTML_FILE  " 
    \n";
    922
     
    923
       print HTML_FILE  "       
  • \n";
  • 924
       print HTML_FILE  "         

    SourceCode
    \n";

    925
       print HTML_FILE  "         

    \n";
    926
       print HTML_FILE  "         \n";
    927
     
    928
     
    929
       print HTML_FILE  "       
  • \n";
  • 930
       print HTML_FILE  "         

    Parameters
    \n";

    931
       print HTML_FILE  "         

    \n";
    932
       print HTML_FILE  "         \n";
    933
     
    934
       print HTML_FILE  "       
  • \n";
  • 935
       print HTML_FILE  "         

    Interface
    \n";

    936
       print HTML_FILE  "         

    \n";
    937
       print HTML_FILE  "         \n";
    938
     
    939
     
    940
       print HTML_FILE  "       
  • \n";
  • 941
       print HTML_FILE  "         

    Children
    \n";

    942
       print HTML_FILE  "         

    \n";
    943
       print HTML_FILE  "         \n";
    944
     
    945
     
    946
     
    947
       print HTML_FILE  "       
  • \n";
  • 948
       print HTML_FILE  "         

    Theory of Operation
    \n";

    949
       print HTML_FILE  "         

    \n";
    950
       print HTML_FILE  "         \n";
    951
     
    952
     
    953
       print HTML_FILE  "       \n";
    954
       print HTML_FILE  "     \n";
    955
       print HTML_FILE  "   \n";
    956
       print HTML_FILE  "   \n";
    957
     
    958
       if($interface_in_count >= $interface_out_count) {$max_lines = $interface_in_count }
    959
       else  {$max_lines = $interface_out_count }
    960
     
    961
       $scale = 1.0000;
    962
       $max_lines =(($max_lines *24)+110)* $scale;
    963
       $max_width = $interface_in_size +  $interface_out_size;
    964
       $max_width =(($max_width * 10) + 343) * $scale ;
    965
     
    966
       print HTML_FILE  " \"\"
    \n";
    967
       print HTML_FILE  " 
    \n";
    968
     
    969
       print HTML_FILE  " 

    Parameters

    \n";
    970
       print HTML_FILE  " 
    \n";
    971
       print HTML_FILE  " 
    \n";
    972
       print HTML_FILE  "   \n";
    973
       print HTML_FILE  " \n"; \n"; \n"; \n"; \n"; \n"; \n";  \n";
    974
       print HTML_FILE  "  
    975
     
    976
       print HTML_FILE  "   
    977
       print HTML_FILE  "      
    Name
    978
       print HTML_FILE  "      
    default
    979
       print HTML_FILE  "      
    Description
    980
       print HTML_FILE  "    
    981
     
    982
     
    983
     
    984
         foreach $html_line (@html_parameter_list)
    985
            {
    986
            print HTML_FILE  "${html_line}\n";
    987
            }
    988
     
    989
     
    990
     
    991
       print HTML_FILE  "   
    992
       print HTML_FILE  "  
    \n";
    993
       print HTML_FILE  " 


    \n";

    994
       print HTML_FILE  " 

    \n";
    995
       print HTML_FILE  " 


    \n";

    996
       print HTML_FILE  " 

    \n";
    997
       print HTML_FILE  " 


    \n";

    998
       print HTML_FILE  " 

    \n";
    999
       print HTML_FILE  " 


    \n";

    1000
     
    1001
       print HTML_FILE  " 
    \n";
    1002
       print HTML_FILE  " 

    \n";
    1003
     
    1004
       print HTML_FILE  " 

    Interface 
    \n";

    1005
       print HTML_FILE  "   \n";
    1006
       print HTML_FILE  " 

    \n";
    1007
       print HTML_FILE  " 
    \n";
    1008
       print HTML_FILE  " 
    \n";
    1009
       print HTML_FILE  " 
    \n";
    1010
     
    1011
     
    1012
       print HTML_FILE  "   \n";  \n";  \n";  \n";  \n";  \n";  \n";
    1013
       print HTML_FILE  "  cellpadding=\"4\" cellspacing=\"4\">  \n";
    1014
       print HTML_FILE  "   
    1015
       print HTML_FILE  "     
    1016
       print HTML_FILE  "       
    NAME
    1017
       print HTML_FILE  "       
    Type
    1018
       print HTML_FILE  "       
    Description
    1019
       print HTML_FILE  "     
    1020
         foreach $html_line (@html_interface_list)
    1021
            {
    1022
            print HTML_FILE  "${html_line}\n";
    1023
            }
    1024
       print HTML_FILE  "   
    1025
       print HTML_FILE  "  
    \n";
    1026
       print HTML_FILE  " 


    \n";

    1027
       print HTML_FILE  " 

    \n";
    1028
     
    1029
     
    1030
     
    1031
       print HTML_FILE  " 

    Children

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


    \n";

    1097
       print HTML_FILE  " 

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

    powered by: WebSVN 2.1.0

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