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

Subversion Repositories socgen

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

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

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
           "view=s" => \$view,
68
           "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 121 jt_eaton
           "fragment","no_port","local_parameters","tb"
77 119 jt_eaton
) || die "(use '$program_name -h' for help)";
78
 
79
 
80
 
81
##############################################################################
82
## Help option
83
##############################################################################
84
if ( $opt_h  or $opt_help  )
85
  { print "\n gen_verilog -view {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
    print "\n";
87
    exit 1;
88
  }
89
 
90
print "\n  GEN_verilog  $view  $prefix $vendor $project $component $version    $dest_dir  $destination \n";
91
 
92 122 jt_eaton
my $main_module_name = yp::lib::get_module_name($vendor,$project,$component,$version) ;
93 119 jt_eaton
 
94
#############################################################################
95
##
96
##
97
#############################################################################
98
 
99
 
100
$home = cwd();
101
my $variant;
102
 if($version)       {$variant   = "${component}_${version}";}
103
 else               {$variant   = "${component}";}
104
 
105
 
106 120 jt_eaton
 
107 121 jt_eaton
#if( ($prefix eq "/work") ){$opt_tb = 1;}
108 120 jt_eaton
 
109 121 jt_eaton
 
110
if($opt_tb )
111
{
112
   print "Creating testbench for   $vendor $project $component  $version \n";
113
 
114
 
115
   my $path  ="${home}/projects/${vendor}/${project}/ip/${component}/sim";
116
   mkdir $path,0755             unless( -e $path );
117
 
118 124 jt_eaton
   my $path  ="${home}/projects/${vendor}/${project}/ip/${component}/sim/testbenches";
119 121 jt_eaton
   mkdir $path,0755             unless( -e $path );
120
 
121 124 jt_eaton
      $path  ="${home}/projects/${vendor}/${project}/ip/${component}/sim/testbenches/xml";
122
   mkdir $path,0755             unless( -e $path );
123 121 jt_eaton
 
124 124 jt_eaton
 
125
   $outfile ="${home}/projects/${vendor}/${project}/ip/${component}/sim/testbenches/xml/${variant}_dut.params.xml";
126 121 jt_eaton
   open TB_COMP_FILE,">$outfile" or die "unable to open $outfile";
127
 
128 124 jt_eaton
   $outfile ="${home}/projects/${vendor}/${project}/ip/${component}/sim/testbenches/xml/${variant}_dutg.design.xml";
129 121 jt_eaton
   open TB_DESIGN_FILE,">$outfile" or die "unable to open $outfile";
130
 
131 122 jt_eaton
 
132 121 jt_eaton
   print TB_COMP_FILE  "\n";
133 122 jt_eaton
   print TB_COMP_FILE  "                                                 \n";
140 121 jt_eaton
   print TB_COMP_FILE  "
141
   print TB_COMP_FILE  "xmlns:spirit=\"http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009\"\n";
142
   print TB_COMP_FILE  "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
143
   print TB_COMP_FILE  "xsi:schemaLocation=\"http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009\n";
144
   print TB_COMP_FILE  "http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009/index.xsd\">\n";
145
   print TB_COMP_FILE  "${vendor}\n";
146
   print TB_COMP_FILE  "${project}\n";
147
   print TB_COMP_FILE  "${component}\n";
148
   print TB_COMP_FILE  "${version}_dut.params\n";
149
 
150
 
151
   print TB_DESIGN_FILE  "\n";
152 122 jt_eaton
   print TB_DESIGN_FILE  "                                                 \n";
159 121 jt_eaton
   print TB_DESIGN_FILE  "
160
   print TB_DESIGN_FILE  "xmlns:spirit=\"http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009\"\n";
161
   print TB_DESIGN_FILE  "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
162
   print TB_DESIGN_FILE  "xsi:schemaLocation=\"http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009\n";
163
   print TB_DESIGN_FILE  "http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009/index.xsd\">\n";
164
   print TB_DESIGN_FILE  "${vendor}\n";
165
   print TB_DESIGN_FILE  "${project}\n";
166
   print TB_DESIGN_FILE  "${component}\n";
167
   print TB_DESIGN_FILE  "${version}_dutg.design\n";
168
 
169
 
170
 
171
 
172
 
173
}
174
 
175
 
176 119 jt_eaton
my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$project);
177
my $comp_xml_sep    = yp::lib::find_ipxact_component_path("spirit:component",$vendor,$project,$component,$version);
178
 
179
my $parser = XML::LibXML->new();
180
 
181
 
182
my $path  = "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}";
183
mkdir $path,0755             unless( -e $path );
184
 
185
my $path  = "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}/${view}";
186
mkdir $path,0755             unless( -e $path );
187
 
188
my   @filelist_hier     =       ();
189
my   @instantiations    =       ();
190
my   @parameters        =       ();
191
my   %parameter_values  =       ();
192
 
193
print  "  Building verilog for ${project} ${component}  ${variant} \n  ";
194 124 jt_eaton
my $sogen_file                  = $parser->parse_file(yp::lib::find_socgen("socgen:componentConfiguration",$vendor,$project,$component));
195 119 jt_eaton
my $spirit_component_file           = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$vendor,$project,$component,$version));
196
 
197
 
198 121 jt_eaton
 
199
 
200
     #/**********************************************************************/
201
     #/*                                                                    */
202 124 jt_eaton
     #/* if configuration set then read parameters from socgen:componentConfiguration file      */
203 121 jt_eaton
     #/*                                                                    */
204
     #/**********************************************************************/
205
 
206
    if($configuration)
207
      {
208
      # print "XXX Reading configuration   $configuration \n";
209 124 jt_eaton
      unless ($sogen_file)      { print "No socgen ip file \n";};
210 121 jt_eaton
 
211 124 jt_eaton
      foreach my $socgen_cfg ($sogen_file->findnodes("//socgen:componentConfiguration/socgen:configurations/socgen:configuration/socgen:parameters/socgen:parameter/socgen:name"))
212 121 jt_eaton
                {
213
                my($param_name)         = $socgen_cfg->findnodes('./text()')->to_literal ;
214
                my($param_value)        = $socgen_cfg->findnodes('../socgen:value/text()')->to_literal ;
215
                my($config_name)        = $socgen_cfg->findnodes('../../../socgen:name/text()')->to_literal ;
216
                if($config_name eq $configuration  )
217
                  {
218
                  unless(defined $parameter_values{$param_name}) {push ( @parameters,  "$param_name");};
219
                  $parameter_values{$param_name} = ${param_value};
220
                  }
221
                }
222
 
223
      }
224
 
225
 
226
 
227
 
228 119 jt_eaton
#/**********************************************************************/
229
#/*                                                                    */
230
#/* Every hier cell is constructed from the ipxact file with seperate  */
231
#/* version  for each view                                             */
232
#/*                                                                    */
233
#/* Start by opening the output file                                   */
234
#/* get fileset name                                                   */
235
#/* check that requested view exists                                   */
236
#/*                                                                    */
237
#/**********************************************************************/
238
 
239 120 jt_eaton
foreach my $comp_view ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:name[text() = '$view']"             ))
240 119 jt_eaton
   {
241 120 jt_eaton
   my($view_fileset_name)  = $comp_view->findnodes('../spirit:fileSetRef/spirit:localName/text()')->to_literal ;
242
   $outfile ="${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}/${view}/${destination}";
243
   open DEST_FILE,">$outfile" or die "unable to open $outfile";
244 122 jt_eaton
   unless ($opt_fragment){     print DEST_FILE  "\n module \n\n  $main_module_name \n ";}
245 119 jt_eaton
 
246 120 jt_eaton
   #/*****************************************************************************/
247
   #/*  wire_decs array holds all port and signal declarations                   */
248
   #/*  :::name:::node_input_output:::wire_reg:::scaler_vector:::left:::right::: */
249
   #/*****************************************************************************/
250 119 jt_eaton
 
251 120 jt_eaton
   @wire_decs = (  );
252 119 jt_eaton
 
253
 
254 120 jt_eaton
   #/**********************************************************************/
255
   #/*  inst_conns holds all instance connections                         */
256
   #/**********************************************************************/
257 119 jt_eaton
 
258 120 jt_eaton
   @inst_conns = (  );
259 119 jt_eaton
 
260 120 jt_eaton
   my @decl_names  = ();
261
   my %decl_dirs  = ();
262
   my %decl_types  = ();
263
   my %decl_vector = ();
264
   my %decl_lefts  = ();
265
   my %decl_rights = ();
266 119 jt_eaton
 
267 120 jt_eaton
   #  component file
268
   parse_component_file($spirit_component_file);
269
   parse_design_files($spirit_component_file);
270
   process_design_files($spirit_component_file);
271 119 jt_eaton
 
272 120 jt_eaton
   #/**********************************************************************/
273
   #/*                                                                    */
274
   #/* pack ports and nodes into hashes                                   */
275
   #/*                                                                    */
276
   #/**********************************************************************/
277 119 jt_eaton
 
278
 
279 120 jt_eaton
   @wire_decs      = sys::lib::trim_sort(@wire_decs);
280
   foreach $line (@wire_decs)
281
     {
282
     $_ = $line;
283 119 jt_eaton
        if(/:::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::/)
284
          {
285
          $q_index               = $1;
286
          $q_node_name           = $2;
287
          $q_direction           = $3;
288
          $q_type                = $4;
289
          $q_vector              = $5;
290
          $q_left                = $6;
291
          $q_right               = $7;
292
          $q_instance            = $8;
293
          $q_depth               = $9;
294
          $q_phy_name            = $10;
295
          $q_busref_name         = $11;
296
          $q_abslog_name         = $12;
297
 
298
 
299
 
300
 
301
         push ( @decl_names,$q_index);
302
 
303
 
304
          if(  $decl_pnames{$q_index})
305
            {
306
            if(  $decl_pnames{$q_index} eq ${q_index})
307
              {
308
              $decl_pnames{$q_index}  = "${q_node_name}";
309
              }
310
            }
311
          else
312
            {
313
            $decl_pnames{$q_index}  = "${q_node_name}";
314
            }
315
 
316
 
317
          if(  $decl_dirs{$q_index})
318
            {
319
            if(  $decl_dirs{$q_index} eq "node")
320
              {
321
              $decl_types{$q_index}  = "${q_type}";
322
              $decl_dirs{$q_index}  = "${q_direction}";
323
              }
324
            }
325
          else
326
            {
327
            $decl_types{$q_index}  = "${q_type}";
328
            $decl_dirs{$q_index}  = "${q_direction}";
329
            }
330
 
331
          if(  $decl_vector{$q_index})
332
            {  unless(  $decl_vector{$q_index} eq "vector"){ $decl_vector{$q_index}  = "${q_vector}";  }}
333
          else  { $decl_vector{$q_index}  = "${q_vector}"; }
334
 
335
          if( $q_vector eq "vector" )
336
            {
337
            if ( defined $decl_lefts{$q_index})
338
               {
339
               if($decl_lefts{$q_index}   <= $q_left  ) {$decl_lefts{$q_index}   = $q_left;}
340
               if($decl_rights{$q_index}  >= $q_right ) {$decl_rights{$q_index}  = $q_right;}
341
               }
342
            else
343
               {
344
               $decl_lefts{$q_index}   = $q_left;
345
               $decl_rights{$q_index}  = $q_right;
346
               }
347
            }
348
          }
349
        }
350
     @decl_names      = sys::lib::trim_sort(@decl_names);
351
 
352
 
353
 
354
 
355
 
356
     #/**********************************************************************/
357
     #/*                                                                    */
358
     #/* All port and signal info is now loaded in hashes, print out verilog*/
359
     #/*                                                                    */
360
     #/* Print out module header , parameters and ports                     */
361
     #/*                                                                    */
362
     #/**********************************************************************/
363
 
364
 
365
 
366
 
367 120 jt_eaton
 
368 119 jt_eaton
 
369
     #/**********************************************************************/
370
     #/*                                                                    */
371
     #/* Add any and all global parameters with their default values        */
372
     #/*                                                                    */
373
     #/**********************************************************************/
374
 
375
     unless ($opt_local_parameters)
376
     {
377
     my $first = 1;
378
     foreach my $parameter_name (@parameters)
379
        {
380
        my $parameter_value = $parameter_values{$parameter_name};
381
        if($first)
382
          {
383
          print DEST_FILE  "   #( parameter \n      ${parameter_name}=${parameter_value}";
384
          $first=0;
385
          }
386
        else  { print DEST_FILE  ",\n      ${parameter_name}=${parameter_value}";}
387
        }
388
 
389
     if    ($first == 0)   { print DEST_FILE  ")\n"; }
390
       }
391
 
392
 
393
     #/**********************************************************************/
394
     #/*                                                                    */
395
     #/* sort all  ports  with their type, size and direction               */
396
     #/*                                                                    */
397
     #/**********************************************************************/
398
 
399
 
400
     my @port_list  = ();
401
 
402
 
403
     foreach $x_name (@decl_names)
404
        {
405
        my $q_width  = "     ";
406
        if( $decl_vector{$x_name} eq "vector" )  { $q_width = "[ $decl_lefts{$x_name} :  $decl_rights{$x_name}]"}
407
 
408
        if( $decl_dirs{$x_name} ne "node" )
409
          {
410
          push (@port_list,  "$decl_dirs{$x_name}   $decl_types{$x_name}    $q_width        $decl_pnames{$x_name}");
411
          }
412
        }
413
 
414
     @port_list      = sys::lib::trim_sort(@port_list);
415
 
416
 
417
     #/**********************************************************************/
418
     #/*                                                                    */
419
     #/* Now add all ports  with their type, size and direction             */
420
     #/*                                                                    */
421
     #/**********************************************************************/
422
 
423
 
424
     print DEST_FILE  "\n    ";
425
     $first = 1;
426
 
427
     foreach $port_line (@port_list)
428
        {
429
          if($first)
430
            {
431
            print DEST_FILE  " (\n ${port_line}";
432
            $first=0;
433
            }
434
          else
435
            {
436
            print DEST_FILE  ",\n ${port_line}";
437
            }
438
 
439
        }
440
 
441
     if    ($first == 0)   { print DEST_FILE  ");\n\n\n\n"; }
442
     elsif ($opt_no_port)  { print DEST_FILE  "\n\n\n\n";  }
443
     else                  { print DEST_FILE  "();\n\n\n\n";}
444
 
445 121 jt_eaton
 
446
 
447
 
448
 
449
 
450 119 jt_eaton
     #/**********************************************************************/
451
     #/*                                                                    */
452 121 jt_eaton
     #/* print wire decs for testbench                                      */
453
     #/*                                                                    */
454
     #/**********************************************************************/
455
 
456
     my @tb_node_list  = ();
457
 
458
 
459
     foreach $x_name (@decl_names)
460
        {
461
 
462
        if( $decl_dirs{$x_name} ne "node" )
463
          {
464
    if ( $decl_vector{$x_name} eq "vector" )
465
             {
466
          push (@tb_node_list,  "\n${decl_pnames{$x_name}}<\/spirit:name>\nwire<\/spirit:typeName><\/spirit:wireTypeDef><\/spirit:wireTypeDefs>\n${decl_lefts{$x_name}}<\/spirit:left>${decl_rights{$x_name}}<\/spirit:right><\/spirit:vector><\/spirit:wire>\n<\/node>\n"     );
467
             }
468
             else
469
      {
470
          push (@tb_node_list,  "\n${decl_pnames{$x_name}}<\/spirit:name>\nwire<\/spirit:typeName><\/spirit:wireTypeDef><\/spirit:wireTypeDefs>\n<\/node>\n"     );
471
             }
472
 
473
 
474
              }
475
 
476
        }
477
 
478
     @tb_node_list      = sys::lib::trim_sort(@tb_node_list);
479
     print TB_DESIGN_FILE  "\n\n";
480
 
481
     foreach $node_line (@tb_node_list)
482
        {
483
 
484
            print TB_DESIGN_FILE  "${node_line}\n";
485
 
486
 
487
        }
488
 
489
     print TB_DESIGN_FILE  "\n\n";
490
 
491
 
492
 
493
 
494
 
495
 
496
     #/**********************************************************************/
497
     #/*                                                                    */
498
     #/* print wire decs for testbench                                      */
499
     #/*                                                                    */
500
     #/**********************************************************************/
501
 
502
     my @tb_node_list  = ();
503
 
504
 
505
     foreach $x_name (@decl_names)
506
        {
507
 
508
        if( $decl_dirs{$x_name} ne "node" )
509
          {
510
    if ( $decl_vector{$x_name} eq "vector" )
511
             {
512
    push (@tb_adhoc_list,  "\n${decl_pnames{$x_name}}[${decl_lefts{$x_name}}:${decl_rights{$x_name}}]<\/spirit:name>\n\n<\/spirit:adHocConnection>\n"     );
513
             }
514
             else
515
            {
516
 
517
    push (@tb_adhoc_list,  "\n${decl_pnames{$x_name}}<\/spirit:name>\n\n<\/spirit:adHocConnection>\n"     );
518
 
519
             }
520
 
521
 
522
              }
523
 
524
        }
525
 
526
     @tb_adhoc_list      = sys::lib::trim_sort(@tb_adhoc_list);
527
     print TB_DESIGN_FILE  "\n\n";
528
 
529
     foreach $adhoc_line (@tb_adhoc_list)
530
        {
531
 
532
            print TB_DESIGN_FILE  "${adhoc_line}\n";
533
 
534
 
535
        }
536
 
537
     print TB_DESIGN_FILE  "\n\n";
538
 
539
 
540
 
541
 
542
 
543
 
544
     #/**********************************************************************/
545
     #/*                                                                    */
546
     #/* Add parameters  to dut      */
547
     #/*                                                                    */
548
     #/**********************************************************************/
549
print TB_DESIGN_FILE    "\n\n";
550
 
551
 
552
 
553
 
554
print TB_DESIGN_FILE    "\n";
555
print TB_DESIGN_FILE    "dut\n";
556
print TB_DESIGN_FILE    "\n";
557
print TB_DESIGN_FILE    "\n";
558
 
559
 
560
     foreach my $parameter_name (@parameters)
561
        {
562
        print TB_DESIGN_FILE  " ${parameter_name}<\/spirit:configurableElementValue>\n";
563
        }
564
 
565
print TB_DESIGN_FILE    "\n";
566
print TB_DESIGN_FILE    "\n";
567
print TB_DESIGN_FILE    "\n";
568
print TB_DESIGN_FILE    "\n";
569
 
570
 
571
 
572
 
573
     #/**********************************************************************/
574
     #/*                                                                    */
575
     #/* Add parameters  to comp      */
576
     #/*                                                                    */
577
     #/**********************************************************************/
578
print TB_COMP_FILE    "\n\n";
579
 
580
#print TB_COMP_FILE    "                                                  \n";
581
#print TB_COMP_FILE    "                                   \n";
582
#print TB_COMP_FILE    "                                                 \n";
583
#print TB_COMP_FILE    "              Dut                                   \n";
584
#print TB_COMP_FILE    "                                                 \n";
585
#print TB_COMP_FILE    "              
586
#print TB_COMP_FILE    "                                   spirit:library=\"${project}\"                                    \n";
587
#print TB_COMP_FILE    "                                   spirit:name=\"${component}\"                                    \n";
588
#print TB_COMP_FILE    "                                   spirit:version=\"${version}_dutg.design\"/>                                   \n";
589
#print TB_COMP_FILE    "                                                 \n";
590
#print TB_COMP_FILE    "                                         \n";
591
 
592
 
593
 
594
print TB_COMP_FILE    "\n";
595
 
596
 
597
 
598
 
599
 
600
     foreach my $parameter_name (@parameters)
601
        {
602
        my $parameter_value = $parameter_values{$parameter_name};
603
        print TB_COMP_FILE  "    ${parameter_name}${parameter_value}\n";
604
        }
605
 
606
print TB_COMP_FILE    "\n";
607
print TB_COMP_FILE    "\n";
608
 
609
 
610
 
611
 
612
   print TB_COMP_FILE  "\n";
613
 
614
 
615
 
616
 
617
 
618
 
619
 
620
 
621
 
622
     #/**********************************************************************/
623
     #/*                                                                    */
624 119 jt_eaton
     #/* Add any and all local parameters with their default values         */
625
     #/*                                                                    */
626
     #/**********************************************************************/
627
 
628
     if ($opt_local_parameters)
629
     {
630
     foreach my $parameter_name (@parameters)
631
        {
632
        my $parameter_value = $parameter_values{${parameter_name}};
633
        print DEST_FILE  "parameter ${parameter_name} = ${parameter_value};\n";
634
        }
635
     }
636
 
637
     #/**********************************************************************/
638
     #/*                                                                    */
639
     #/* Add all internal wires and regs with their sizes                   */
640
     #/*                                                                    */
641
     #/**********************************************************************/
642 121 jt_eaton
 
643
     my @wire_nodes = ();
644 119 jt_eaton
 
645 121 jt_eaton
 
646 119 jt_eaton
     foreach $x_name (@decl_names)
647
        {
648
        my $q_width  = "     ";
649
        if( $decl_vector{$x_name} eq "vector" ){ $q_width = "[ $decl_lefts{$x_name} :  $decl_rights{$x_name}]"}
650 121 jt_eaton
        if( $decl_dirs{$x_name} eq "node" )    { push @wire_nodes,     "$decl_types{$x_name}     $q_width              $decl_pnames{$x_name};";}
651 119 jt_eaton
        }
652
 
653 121 jt_eaton
     @wire_nodes      = sys::lib::trim_sort(@wire_nodes);
654
 
655
     foreach my $wire_node (@wire_nodes)
656
     {
657
     print DEST_FILE  "${wire_node}\n";
658
     }
659
 
660 119 jt_eaton
     print DEST_FILE  "\n\n\n";
661 120 jt_eaton
 
662 119 jt_eaton
 
663 120 jt_eaton
     while(   my $line_out      = shift(@instantiations))             {  print DEST_FILE  "$line_out";}
664 119 jt_eaton
 
665
     #/**********************************************************************/
666
     #/*                                                                    */
667
     #/* After all the data from the ip-xact file has been entered we now   */
668
     #/* insert any and all verilog fragments at the end before closing     */
669
     #/* the module                                                         */
670
     #/*                                                                    */
671
     #/**********************************************************************/
672
 
673
 
674
     foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:fileSets/spirit:fileSet/spirit:file/spirit:name"))
675
        {
676
        my($rtl_file)       = $i_name ->findnodes('./text()')->to_literal;
677 120 jt_eaton
        my($file_type)      = $i_name ->findnodes('../spirit:userFileType/text()')->to_literal;
678 119 jt_eaton
        my($view_file)      = $i_name ->findnodes('../../spirit:name/text()')->to_literal ;
679
 
680 120 jt_eaton
        if(($file_type eq "fragment")&& (($view_file eq $view_fileset_name)))
681 119 jt_eaton
          {
682
          $SRCFILE ="${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${rtl_file}";
683
          open(SRCFILE) or die("Could not open src file.  $SRCFILE ");
684
          foreach $line ()
685
             {
686
             chomp($line);
687
             print DEST_FILE  "${line}\n";
688
             }
689
          }
690
        }
691
     unless ($opt_fragment ) {print DEST_FILE  "\n\n\n  endmodule\n\n";}
692 120 jt_eaton
 
693 119 jt_eaton
   }
694
 
695
 
696
 
697
 
698
 
699
 
700
 
701
 
702
 
703
 
704 120 jt_eaton
 
705 119 jt_eaton
#/*********************************************************************************************/
706
#/                                                                                            */
707
#/                                                                                            */
708
#/                                                                                            */
709
#/                                                                                            */
710
#/                                                                                            */
711
#/                                                                                            */
712
#/*********************************************************************************************/
713
 
714
 
715
 
716
 
717
sub parse_busInterface
718
   {
719
   my @params     = @_;
720
   my $depth      = pop(@params);
721
   my $busref     = pop(@params);
722
   my $version    = pop(@params);
723
   my $component  = pop(@params);
724
   my $project    = pop(@params);
725
   my $vendor     = pop(@params);
726
 
727
   my $home = cwd();
728
 
729
   my @out_stack  = ();
730
 
731
 
732
   my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$vendor,$project,$component,$version));
733 120 jt_eaton
   my @spirit_design_files       = yp::lib::find_ipxact_design_files($vendor,$project,$component,$version);
734 119 jt_eaton
 
735 120 jt_eaton
 
736 119 jt_eaton
   my $busInterfaceTest = 0;
737
 
738
   my @mas_slave;
739
     push @mas_slave  , "master";
740
     push @mas_slave  , "slave";
741
 
742
     foreach my $seek_type (@mas_slave)
743
        {
744
 
745
 
746
     foreach my $bus_iface ($spirit_component_file->findnodes("//spirit:component/spirit:busInterfaces/spirit:busInterface/spirit:${seek_type}"))
747
        {
748
        my($fff_cname)         = $bus_iface->findnodes('../spirit:name/text()')->to_literal ;
749
        my($fff_vendor)        = $bus_iface->findnodes('../spirit:abstractionType/@spirit:vendor')->to_literal ;
750
        my($fff_library)       = $bus_iface->findnodes('../spirit:abstractionType/@spirit:library')->to_literal ;
751
        my($fff_name)          = $bus_iface->findnodes('../spirit:abstractionType/@spirit:name')->to_literal ;
752
        my($fff_version)       = $bus_iface->findnodes('../spirit:abstractionType/@spirit:version')->to_literal ;
753
 
754
 
755
        foreach my $port_face ($spirit_component_file->findnodes('//spirit:component/spirit:busInterfaces/spirit:busInterface/spirit:portMaps/spirit:portMap/spirit:logicalPort'))
756
           {
757
 
758
           my($fff_xxx_name)      = $port_face->findnodes('../../../spirit:name/text()')->to_literal ;
759
 
760
           my($fff_log_name)      = $port_face->findnodes('./spirit:name/text()')->to_literal ;
761
           my($fff_phy_name)      = $port_face->findnodes('../spirit:physicalPort/spirit:name/text()')->to_literal ;
762
           my($fff_type_name)     = $port_face->findnodes('../spirit:physicalPort/spirit:wireTypeDefs/spirit:wireTypeDef/spirit:typeName/text()')->to_literal ;
763
           my($fff_int_name)      = $port_face->findnodes('../../../spirit:name/text()')->to_literal ;
764
 
765
           my($fff_left_value)    = $port_face->findnodes('../spirit:physicalPort/spirit:wire/spirit:vector/spirit:left/text()')->to_literal ;
766
           my($fff_right_value)   = $port_face->findnodes('../spirit:physicalPort/spirit:wire/spirit:vector/spirit:right/text()')->to_literal ;
767
 
768
           unless ($fff_type_name)  {$fff_type_name = "wire";};
769
 
770
           if(  ( $fff_xxx_name  eq  $busref) && (  $busref eq   $fff_cname  )       )
771
             {
772
             $busInterfaceTest = 1;
773
             my $busdef_parser = XML::LibXML->new();
774 122 jt_eaton
#print "XXX  $fff_vendor $fff_library $fff_name $fff_version  \n";
775
             my $spirit_abstractor_file     = ($parser->parse_file(yp::lib::find_ipxact("spirit:abstractionDefinition",$fff_vendor,$fff_library,$fff_name,$fff_version))
776 119 jt_eaton
 
777
 
778 122 jt_eaton
                ) || die "(OOPs $fff_vendor $fff_library $fff_name $fff_version )";
779 119 jt_eaton
 
780
 
781
 
782
             foreach my $abstr_view ($spirit_abstractor_file->findnodes("//spirit:abstractionDefinition/spirit:ports/spirit:port/spirit:logicalName[text() = '$fff_log_name']"))
783
                {
784
                my($sss_m_dir)         = $abstr_view->findnodes('../spirit:wire/spirit:onMaster/spirit:direction/text()')->to_literal ;
785
                my($sss_s_dir)         = $abstr_view->findnodes('../spirit:wire/spirit:onSlave/spirit:direction/text()')->to_literal ;
786
 
787
                    if    ($sss_m_dir eq "in")  { $sss_m_dir = "input";}
788
                    elsif ($sss_m_dir eq "out") { $sss_m_dir = "output";}
789
 
790
                    if    ($sss_s_dir eq "in")  { $sss_s_dir = "input";}
791
                    elsif ($sss_s_dir eq "out") { $sss_s_dir = "output";}
792
 
793
 
794
                my $fff_direction = "";
795
 
796
 
797
                  if    ( $seek_type eq "master")  { $fff_direction = $sss_m_dir;     }
798
                  elsif ( $seek_type eq "slave" )  { $fff_direction = $sss_s_dir;     }
799
 
800
                  my $fff_dir = "";
801
                  if   ($fff_direction  eq "in" )  {$fff_dir = "input" ;}
802
                  elsif($fff_direction  eq "out" ) {$fff_dir = "output" ;}
803
                  else                             {$fff_dir = $fff_direction;     }
804
 
805 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}:::"; }
806 119 jt_eaton
                  else                { push @out_stack, ":::${depth}:::${fff_log_name}:::${fff_phy_name}:::${fff_dir}:::${fff_type_name}:::scaler:::none:::none:::";    }
807
 
808
 
809
                }
810
             }
811
 
812
           }
813
       }
814
 
815
}
816
 
817
 
818
 
819
 
820
 
821
       if ( $busInterfaceTest){
822
                              @out_stack      = sys::lib::trim_sort(@out_stack);
823
                              return(@out_stack);
824
                              }
825
 
826
 
827 120 jt_eaton
 
828
 
829
     foreach  my   $sd_file (@spirit_design_files)
830 119 jt_eaton
     {
831
 
832 120 jt_eaton
 
833
     foreach  my   $x_name ($sd_file->findnodes('//spirit:hierConnections/spirit:hierConnection/@spirit:interfaceRef'))
834 119 jt_eaton
        {
835
        my($hierConn_name)                   = $x_name ->to_literal ;
836
        my($hierConn_comref_name)            = $x_name ->findnodes('../spirit:interface/@spirit:componentRef')->to_literal ;
837
        my($hierConn_busref_name)            = $x_name ->findnodes('../spirit:interface/@spirit:busRef')->to_literal ;
838
        if($busref eq  $hierConn_name)
839
          {
840 120 jt_eaton
          foreach  my   $x_name ($sd_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName[text() = '$hierConn_comref_name']"))
841 119 jt_eaton
            {
842
            #/**********************************************************************/
843
            #/*                                                                    */
844
            #/* Lookup VLNV for each instantiated component                        */
845
            #/*                                                                    */
846
            #/**********************************************************************/
847
 
848
            my($vendor_name)         = $x_name  ->findnodes('../spirit:componentRef/@spirit:vendor')->to_literal ;
849
            my($library_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:library')->to_literal ;
850
            my($component_name)      = $x_name  ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
851
            my($version_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
852
            $depth = $depth +1;
853
            @out_stack = parse_busInterface ($vendor_name, $library_name,$component_name,$version_name,$hierConn_busref_name,$depth );
854
            }
855
          }
856
        }
857 120 jt_eaton
 
858
     }
859
 
860 119 jt_eaton
        @out_stack      = sys::lib::trim_sort(@out_stack);
861
        return(@out_stack);
862 120 jt_eaton
 
863 119 jt_eaton
 
864
   }
865
 
866
 
867
 
868
 
869 120 jt_eaton
 
870
 
871
 
872
 
873
 
874
 
875
 
876
 
877
 
878
 
879 119 jt_eaton
#/*********************************************************************************************/
880
#/                                                                                            */
881
#/                                                                                            */
882
#/                                                                                            */
883
#/                                                                                            */
884
#/                                                                                            */
885
#/                                                                                            */
886
#/*********************************************************************************************/
887
 
888
 
889
 
890
 
891 120 jt_eaton
sub parse_design_files
892
   {
893
   my @params     = @_;
894
   my $spirit_component_file      = pop(@params);
895
 
896
   print "\n";
897
   foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:vendor"))
898
    {
899
    my($new_vendor)          = $new_comp->findnodes('./text()')->to_literal ;
900
    my($new_library)         = $new_comp->findnodes('../spirit:library/text()')->to_literal ;
901
    my($new_name)            = $new_comp->findnodes('../spirit:name/text()')->to_literal ;
902
    my($new_version)         = $new_comp->findnodes('../spirit:version/text()')->to_literal ;
903
#    print "XXXXXX  $new_vendor $new_library $new_name $new_version  COMPONENT \n";
904
    }
905
 
906
 
907
  foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:hierarchyRef"))
908
    {
909
            my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
910
            my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
911
            my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
912
            my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
913
 
914
 
915
           my $foo = yp::lib::find_file_type($new_vendor,$new_library,$new_name,$new_version) ;
916
 
917
#              print "XXXXXZ  $new_vendor $new_library $new_name $new_version $foo\n";
918
 
919
     if($foo eq "spirit:component")
920
     {
921
        parse_design_files($parser->parse_file(yp::lib::find_ipxact("spirit:component",$new_vendor,$new_library,$new_name,$new_version )) );
922
     }
923
 
924
     elsif($foo eq "spirit:design")
925
     {
926
        parse_design_file($parser->parse_file(yp::lib::find_ipxact("spirit:design",$new_vendor,$new_library,$new_name,$new_version )) );
927
#              print "XXXXXA+  $new_vendor $new_library $new_name $new_version \n";
928
 
929
      }
930
 
931
     elsif($foo eq "spirit:designConfiguration")
932
     {
933
 
934
        my $spirit_designCfg_file
935
         = $parser->parse_file(yp::lib::find_ipxact("spirit:designConfiguration",$new_vendor,$new_library,$new_name,$new_version ));
936
 
937
        foreach my $design_ref_view ($spirit_designCfg_file->findnodes('//spirit:designConfiguration'))
938
           {
939
           my($hier_xref_vendor)         = $design_ref_view->findnodes('./spirit:designRef/@spirit:vendor')->to_literal ;
940
           my($hier_xref_library)        = $design_ref_view->findnodes('./spirit:designRef/@spirit:library')->to_literal ;
941
           my($hier_xref_component)      = $design_ref_view->findnodes('./spirit:designRef/@spirit:name')->to_literal ;
942
           my($hier_xref_version)        = $design_ref_view->findnodes('./spirit:designRef/@spirit:version')->to_literal ;
943
          parse_design_file($parser->parse_file(yp::lib::find_ipxact("spirit:design",$hier_xref_vendor,$hier_xref_library,$hier_xref_component,$hier_xref_version)));
944
#           print "XXXXXA-  $hier_xref_vendor $hier_xref_library $hier_xref_component $hier_xref_version \n";
945
           }
946
     }
947
 
948
  }
949
 
950
}
951
 
952
 
953
 
954
 
955
 
956
 
957
 
958
#/*********************************************************************************************/
959
#/                                                                                            */
960
#/                                                                                            */
961
#/                                                                                            */
962
#/                                                                                            */
963
#/                                                                                            */
964
#/                                                                                            */
965
#/*********************************************************************************************/
966
 
967
 
968
 
969
 
970
sub process_design_files
971
   {
972
   my @params     = @_;
973
   my $spirit_component_file      = pop(@params);
974
 
975
   print "\n";
976
   foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:vendor"))
977
    {
978
    my($new_vendor)          = $new_comp->findnodes('./text()')->to_literal ;
979
    my($new_library)         = $new_comp->findnodes('../spirit:library/text()')->to_literal ;
980
    my($new_name)            = $new_comp->findnodes('../spirit:name/text()')->to_literal ;
981
    my($new_version)         = $new_comp->findnodes('../spirit:version/text()')->to_literal ;
982
#    print "xXXXXX  $new_vendor $new_library $new_name $new_version  COMPONENT \n";
983
    }
984
 
985
 
986
  foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:hierarchyRef"))
987
    {
988
            my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
989
            my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
990
            my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
991
            my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
992
 
993
 
994
           my $foo = yp::lib::find_file_type($new_vendor,$new_library,$new_name,$new_version) ;
995
 
996
#              print "xXXXXZ  $new_vendor $new_library $new_name $new_version $foo\n";
997
 
998
     if($foo eq "spirit:component")
999
     {
1000
        process_design_files($parser->parse_file(yp::lib::find_ipxact("spirit:component",$new_vendor,$new_library,$new_name,$new_version )) );
1001
     }
1002
 
1003
     elsif($foo eq "spirit:design")
1004
     {
1005
        process_design_file($parser->parse_file(yp::lib::find_ipxact("spirit:design",$new_vendor,$new_library,$new_name,$new_version )) );
1006
#              print "xXXXXA+  $new_vendor $new_library $new_name $new_version \n";
1007
 
1008
      }
1009
 
1010
     elsif($foo eq "spirit:designConfiguration")
1011
     {
1012
 
1013
        my $spirit_designCfg_file
1014
         = $parser->parse_file(yp::lib::find_ipxact("spirit:designConfiguration",$new_vendor,$new_library,$new_name,$new_version ));
1015
 
1016
        foreach my $design_ref_view ($spirit_designCfg_file->findnodes('//spirit:designConfiguration'))
1017
           {
1018
           my($hier_xref_vendor)         = $design_ref_view->findnodes('./spirit:designRef/@spirit:vendor')->to_literal ;
1019
           my($hier_xref_library)        = $design_ref_view->findnodes('./spirit:designRef/@spirit:library')->to_literal ;
1020
           my($hier_xref_component)      = $design_ref_view->findnodes('./spirit:designRef/@spirit:name')->to_literal ;
1021
           my($hier_xref_version)        = $design_ref_view->findnodes('./spirit:designRef/@spirit:version')->to_literal ;
1022
          process_design_file($parser->parse_file(yp::lib::find_ipxact("spirit:design",$hier_xref_vendor,$hier_xref_library,$hier_xref_component,$hier_xref_version)));
1023
#           print "xXXXXA-  $hier_xref_vendor $hier_xref_library $hier_xref_component $hier_xref_version \n";
1024
           }
1025
     }
1026
 
1027
  }
1028
 
1029
}
1030
 
1031
 
1032
 
1033
 
1034
 
1035
 
1036
 
1037
 
1038
 
1039
 
1040
#/*********************************************************************************************/
1041
#/                                                                                            */
1042
#/                                                                                            */
1043
#/                                                                                            */
1044
#/                                                                                            */
1045
#/                                                                                            */
1046
#/                                                                                            */
1047
#/*********************************************************************************************/
1048
 
1049
 
1050
 
1051
 
1052 119 jt_eaton
sub parse_design_file
1053
   {
1054
   my @params     = @_;
1055
   my $spirit_design_file      = pop(@params);
1056
 
1057
 
1058
 
1059
 
1060 120 jt_eaton
 
1061
print "\n";
1062
foreach my $new_comp ($spirit_design_file->findnodes("//spirit:design/spirit:vendor"))
1063
   {
1064
   my($new_vendor)          = $new_comp->findnodes('./text()')->to_literal ;
1065
   my($new_library)         = $new_comp->findnodes('../spirit:library/text()')->to_literal ;
1066
   my($new_name)            = $new_comp->findnodes('../spirit:name/text()')->to_literal ;
1067
   my($new_version)         = $new_comp->findnodes('../spirit:version/text()')->to_literal ;
1068
#   print "XXXXXX  $new_vendor $new_library $new_name $new_version  DESIGN \n";
1069
   }
1070
 
1071
 
1072
 
1073
 
1074
 
1075
 
1076 119 jt_eaton
     #/**********************************************************************/
1077
     #/*                                                                    */
1078
     #/* Read each hierConnection and enter signals into wire_decs          */
1079
     #/*                                                                    */
1080
     #/**********************************************************************/
1081
     foreach  my   $x_name ($spirit_design_file->findnodes('//spirit:hierConnections/spirit:hierConnection/@spirit:interfaceRef'))
1082
        {
1083
        my($hierConn_name)                   = $x_name ->to_literal ;
1084
        my($hierConn_comref_name)            = $x_name ->findnodes('../spirit:interface/@spirit:componentRef')->to_literal ;
1085
        my($hierConn_busref_name)            = $x_name ->findnodes('../spirit:interface/@spirit:busRef')->to_literal ;
1086
 
1087
        foreach  my   $x_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName"))
1088
           {
1089
           #/**********************************************************************/
1090
           #/*                                                                    */
1091
           #/* Lookup VLNV for each instantiated component                        */
1092
           #/*                                                                    */
1093
           #/**********************************************************************/
1094
 
1095
           my($instance_name)       = $x_name ->findnodes('./text()')->to_literal ;
1096
          my($vendor_name)         = $x_name  ->findnodes('../spirit:componentRef/@spirit:vendor')->to_literal ;
1097
         my($library_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:library')->to_literal ;
1098
         my($component_name)      = $x_name  ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
1099
         my($version_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
1100
 
1101
           if( "$instance_name" eq  "$hierConn_comref_name"     )
1102
             {
1103
             my  @filelist_sub = parse_busInterface($vendor_name, $library_name,$component_name,$version_name,$hierConn_busref_name,"1" );
1104
           #/**********************************************************************/
1105
           #/*                                                                    */
1106
           #/* follow bus all the way to it's source                              */
1107
           #/*                                                                    */
1108
           #/**********************************************************************/
1109
 
1110
             foreach $xxline (@filelist_sub)
1111
                {
1112
                $_ = $xxline;
1113
                if(/:::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::/)
1114
                  {
1115
                  $k_depth               = $1;
1116
                  $k_log_name            = $2;
1117
                  $k_phy_name            = $3;
1118
                  $k_direction           = $4;
1119
                  $k_type                = $5;
1120
                  $k_vector              = $6;
1121
                  $k_left                = $7;
1122
                  $k_right               = $8;
1123
                  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}:::";
1124
                  }
1125
                }
1126
             }
1127
           }
1128
        }
1129
 
1130
 
1131
 
1132
 
1133
 
1134
     #/**************************************************************************/
1135
     #/*                                                                        */
1136
     #/* Read each  interconnection and enter sub signals into wire_decs        */
1137
     #/*                                                                        */
1138
     #/**************************************************************************/
1139
 
1140
 
1141
 
1142
 
1143
     foreach  my   $x_name ($spirit_design_file->findnodes('//spirit:interconnections/spirit:interconnection/spirit:activeInterface/@spirit:componentRef'))
1144
        {
1145
        my($hierConn_comref_name)            = $x_name ->to_literal;
1146
        my($hierConn_busref_name)            = $x_name ->findnodes('../@spirit:busRef')->to_literal ;
1147
        my($hierConn_name)                   = $x_name ->findnodes('../../spirit:name/text()')->to_literal ;
1148
 
1149
        foreach  my   $x_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName"))
1150
           {
1151
           #/**********************************************************************/
1152
           #/*                                                                    */
1153
           #/* Lookup VLNV for each instantiated component                        */
1154
           #/*                                                                    */
1155
           #/**********************************************************************/
1156
 
1157
           my($instance_name)       = $x_name ->findnodes('./text()')->to_literal ;
1158
           my($vendor_name)         = $x_name  ->findnodes('../spirit:componentRef/@spirit:vendor')->to_literal ;
1159
           my($library_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:library')->to_literal ;
1160
           my($component_name)      = $x_name  ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
1161
           my($version_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
1162
 
1163
 
1164
 
1165
           if( "$instance_name" eq  "$hierConn_comref_name"     )
1166
             {
1167
 
1168
 
1169
 
1170
           #/**********************************************************************/
1171
           #/*                                                                    */
1172
           #/* follow bus all the way to it's source                              */
1173
           #/*                                                                    */
1174
           #/**********************************************************************/
1175
 
1176
 
1177
             my  @filelist_sub = parse_busInterface($vendor_name, $library_name,$component_name,$version_name,$hierConn_busref_name,"1" );
1178
             foreach $xxline (@filelist_sub)
1179
                {
1180
 
1181
 
1182
                $_ = $xxline;
1183
                if(/:::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::/)
1184
                  {
1185
                  $k_depth               = $1;
1186
                  $k_log_name            = $2;
1187
                  $k_phy_name            = $3;
1188
                  $k_direction           = $4;
1189
                  $k_type                = $5;
1190
                  $k_vector              = $6;
1191
                  $k_left                = $7;
1192
                  $k_right               = $8;
1193
 
1194
 
1195
                  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}:::";
1196
                  }
1197
                }
1198
             }
1199
           }
1200
        }
1201
 
1202
 
1203
 
1204
     #/*******************************************************************************/
1205
     #/*                                                                             */
1206
     #/* Read each  interconnection and enter modified signals into wire_decs        */
1207
     #/*                                                                             */
1208
     #/*******************************************************************************/
1209
 
1210
 
1211
 
1212
 
1213
 
1214
        foreach  my  $k_name ($spirit_design_file->findnodes('//spirit:interconnections/spirit:interconnection/spirit:activeInterface/spirit:portMaps/spirit:portMap/spirit:logicalPort/spirit:name'))
1215
           {
1216
           my($lp_name)                = $k_name ->to_literal;
1217
           my($lp_pname)               = $k_name ->findnodes('../../spirit:physicalPort/spirit:name/text()')->to_literal ;
1218
           my($lp_left)                = $k_name ->findnodes('../../spirit:physicalPort/spirit:wire/spirit:vector/spirit:left/text()')->to_literal ;
1219
           my($lp_right)               = $k_name ->findnodes('../../spirit:physicalPort/spirit:wire/spirit:vector/spirit:right/text()')->to_literal ;
1220
           my($lp_componentref_name)   = $k_name ->findnodes('../../../../@spirit:componentRef')->to_literal ;
1221
           my($lp_busref_name)         = $k_name ->findnodes('../../../../@spirit:busRef')->to_literal ;
1222
           my($lp_interconnect_name)   = $k_name ->findnodes('../../../../../spirit:name/text()')->to_literal ;
1223
 
1224
 
1225
           if ( $lp_pname eq '' ) { $lp_pname ="${lp_interconnect_name}_${lp_name}";}
1226
           if ( $lp_left  eq '' ) { $lp_left ="none";}
1227
           if ( $lp_right eq '' ) { $lp_right ="none";}
1228
 
1229
 
1230
 
1231
          if ( $lp_left  eq 'none' )
1232
          {
1233
           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}:::";
1234
          }
1235
          else
1236
          {
1237
           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}:::";
1238
          }
1239
           }
1240
 
1241
 
1242
 
1243
 
1244
 
1245
 
1246
 
1247
 
1248
 
1249
 
1250
 
1251
     #/**********************************************************************/
1252
     #/*                                                                    */
1253
     #/* Read all adHocConnections and load instance connect info into array*/
1254
     #/*                                                                    */
1255
     #/**********************************************************************/
1256
 
1257
 
1258
     foreach  my   $i_xame ($spirit_design_file->findnodes('//spirit:adHocConnections/spirit:adHocConnection/spirit:internalPortReference/@spirit:componentRef'))
1259
        {
1260
        my($comp_name)    = $i_xame ->to_literal;
1261
        my($int_value)    = $i_xame ->findnodes('../../spirit:name/text()')->to_literal ;
1262
        my($int_name)     = $i_xame ->findnodes('../@spirit:portRef')->to_literal ;
1263
        my($vec_left)     = $i_xame ->findnodes('../@spirit:left')->to_literal ;
1264
        my($vec_right)    = $i_xame ->findnodes('../@spirit:right')->to_literal ;
1265
 
1266 124 jt_eaton
 
1267
        unless ($int_value)  {$int_value = "_DUMMY_";}
1268
 
1269
 
1270 119 jt_eaton
        if($vec_left ne "")
1271
          {
1272
          my $vecs = "";
1273
          if($vec_left ne $vec_right ){$vecs ="[${vec_left}:${vec_right}]";}
1274
          else                        {$vecs ="[${vec_right}]";}
1275
          push @inst_conns , ":::${comp_name}:::adhoc:::${int_name}:::${int_value}:::vector:::${vec_left}:::${vec_right}:::";
1276
          }
1277
        else
1278
          {
1279
          push @inst_conns , ":::${comp_name}:::adhoc:::${int_name}:::${int_value}:::scaler:::none:::none:::";
1280
          }
1281
        }
1282
 
1283
 
1284
 
1285
     #/**********************************************************************/
1286
     #/*                                                                    */
1287
     #/* Add all internal wires and regs with their sizes                   */
1288
     #/*                                                                    */
1289
     #/**********************************************************************/
1290
 
1291
     foreach  my   $i_name ($spirit_design_file->findnodes("//spirit:design/nodes/node/spirit:name"))
1292
        {
1293 122 jt_eaton
        my($node_name)       = $i_name ->findnodes('./text()')->to_literal ;
1294
        my($node_left)       = $i_name ->findnodes('../spirit:wire/spirit:vector/spirit:left/text()')->to_literal ;
1295
        my($node_right)      = $i_name ->findnodes('../spirit:wire/spirit:vector/spirit:right/text()')->to_literal ;
1296
        my($node_type)       = $i_name ->findnodes('../spirit:wireTypeDefs/spirit:wireTypeDef/spirit:typeName/text()')->to_literal ;
1297 119 jt_eaton
 
1298 122 jt_eaton
        if(  $node_left ne "" ) { push @wire_decs , ":::${node_name}:::${node_name}:::node:::${node_type}:::vector:::${node_left}:::${$node_right}:::none:::0:::${node_name}:::XXX:::${node_name}:::"; }
1299
        else                     { push @wire_decs , ":::${node_name}:::${node_name}:::node:::${node_type}:::scaler:::none:::none:::none:::0:::${node_name}:::XXX:::${node_name}:::";   }
1300 119 jt_eaton
 
1301
        }
1302
 
1303
 
1304
 
1305
 
1306
 
1307
 
1308
 
1309
 
1310
 
1311
 
1312
 
1313
 
1314
 
1315
     #/**********************************************************************/
1316
     #/*                                                                    */
1317
     #/* extract bus instance connections from wire_decs                    */
1318
     #/*                                                                    */
1319
     #/**********************************************************************/
1320
 
1321
     print "+-+";
1322
 
1323
 
1324
 
1325
     my @inst_names  = ();
1326
     my @inst_Inames  = ();
1327
     my %inst_ports  = ();
1328
     my %inst_sigs   = ();
1329
     my %inst_vector = ();
1330
     my %inst_left   = ();
1331
     my %inst_right  = ();
1332
 
1333
 
1334
     foreach $line (@wire_decs)
1335
        {
1336
        $_ = $line;
1337
        if(/:::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::/)
1338
          {
1339
          my $t_index               = $1;
1340
          my $t_node_name           = $2;
1341
          my $t_direction           = $3;
1342
          my $t_type                = $4;
1343
          my $t_vector              = $5;
1344
          my $t_left                = $6;
1345
          my $t_right               = $7;
1346
          my $t_instance            = $8;
1347
          my $t_depth               = $9;
1348
          my $t_phy_name            = $10;
1349
          my $t_busref_name         = $11;
1350
          my $t_abslog_name         = $12;
1351
 
1352
        if( 1)
1353
          {
1354
 
1355
         push ( @inst_names, "${t_instance}_${t_busref_name}_${t_index}");
1356
 
1357
         $inst_Inames{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_instance}";
1358
 
1359
         if(  $inst_sigs{"${t_instance}_${t_busref_name}_${t_index}"})
1360
            {
1361
            if(  $inst_sigs{"${t_instance}_${t_busref_name}_${t_index}"} eq ${t_index})
1362
              {
1363
              $inst_sigs{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_node_name}";
1364
              }
1365
            }
1366
         else
1367
            {
1368
            $inst_sigs{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_node_name}";
1369
            }
1370
 
1371
         if   ($t_depth >= 2 )      { $inst_ports{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_busref_name}_${t_abslog_name}" ;}
1372
         elsif($t_depth == 1 )      { $inst_ports{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_phy_name}";}
1373
 
1374
         if(  $inst_vector{"${t_instance}_${t_busref_name}_${t_index}"})
1375
            {
1376
            if(  $inst_vector{"${t_instance}_${t_busref_name}_${t_index}"} eq "scaler")
1377
              {$inst_vector{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_vector}";}
1378
            }
1379
         else
1380
            {$inst_vector{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_vector}";}
1381
 
1382
         unless(  $inst_left{"${t_instance}_${t_busref_name}_${t_index}"} eq '')
1383
            {
1384
            if(  $inst_left{"${t_instance}_${t_busref_name}_${t_index}"} eq "none")
1385
              {
1386
              $inst_left{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_left}";
1387
              }
1388
            elsif(  $inst_left{"${t_instance}_${t_busref_name}_${t_index}"} < ${t_left})
1389
              {
1390
              $inst_left{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_left}";
1391
              }
1392
            }
1393
          else
1394
            {
1395
            $inst_left{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_left}";
1396
            }
1397
 
1398
          unless(  $inst_right{"${t_instance}_${t_busref_name}_${t_index}"} eq '')
1399
            {
1400
            if(  $inst_right{"${t_instance}_${t_busref_name}_${t_index}"} eq "none")
1401
              {
1402
              $inst_right{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_right}";
1403
              }
1404
            elsif(  $inst_right{"${t_instance}_${t_busref_name}_${t_index}"} < ${t_right})
1405
              {
1406
              $inst_right{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_right}";
1407
              }
1408
            }
1409
          else {$inst_right{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_right}";}
1410
 
1411
        }
1412
      }
1413
     }
1414
     @inst_names = sys::lib::trim_sort(@inst_names);
1415
     foreach $i_name (@inst_names)
1416
         {
1417
        unless($inst_Inames{$i_name} eq "none")
1418
         {
1419
         if($inst_vector{$i_name} eq "vector"  )
1420
           {
1421
          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}:::\n";
1422
          }
1423
        else
1424
          {
1425
          push @inst_conns ,":::$inst_Inames{$i_name}:::adhoc:::$inst_ports{$i_name}:::$inst_sigs{$i_name}:::scaler:::none:::none:::\n";
1426
 
1427
           }
1428
         }
1429
         }
1430 120 jt_eaton
     }
1431 119 jt_eaton
 
1432
 
1433
 
1434
 
1435
 
1436
 
1437
 
1438
 
1439
 
1440 120 jt_eaton
#/*********************************************************************************************/
1441
#/                                                                                            */
1442
#/                                                                                            */
1443
#/                                                                                            */
1444
#/                                                                                            */
1445
#/                                                                                            */
1446
#/                                                                                            */
1447
#/*********************************************************************************************/
1448 119 jt_eaton
 
1449
 
1450
 
1451
 
1452 120 jt_eaton
sub process_design_file
1453
   {
1454
   my @params     = @_;
1455
   my $spirit_design_file      = pop(@params);
1456 119 jt_eaton
 
1457
 
1458
 
1459
 
1460
 
1461 120 jt_eaton
print "\n";
1462
foreach my $new_comp ($spirit_design_file->findnodes("//spirit:design/spirit:vendor"))
1463
   {
1464
   my($new_vendor)          = $new_comp->findnodes('./text()')->to_literal ;
1465
   my($new_library)         = $new_comp->findnodes('../spirit:library/text()')->to_literal ;
1466
   my($new_name)            = $new_comp->findnodes('../spirit:name/text()')->to_literal ;
1467
   my($new_version)         = $new_comp->findnodes('../spirit:version/text()')->to_literal ;
1468
#   print "XXXXXX-  $new_vendor $new_library $new_name $new_version  DESIGN \n";
1469
   }
1470 119 jt_eaton
 
1471
 
1472
 
1473
     #/**********************************************************************/
1474
     #/*                                                                    */
1475
     #/* Instantiate each component with parameters and port connections    */
1476
     #/*                                                                    */
1477
     #/* If the component doesn't have a instance name then this is skipped */
1478
     #/*                                                                    */
1479
     #/**********************************************************************/
1480
 
1481
     print "+-+";
1482
 
1483
     push @instantiations  , "////////////////////////////////////////////////////////////////\n";
1484
 
1485
     foreach  my   $i_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName"))
1486
        {
1487
        my($instance_name)       = $i_name ->findnodes('./text()')->to_literal ;
1488 122 jt_eaton
        my($vendor_name)         = $i_name  ->findnodes('../spirit:componentRef/@spirit:vendor')->to_literal ;
1489
        my($library_name)        = $i_name  ->findnodes('../spirit:componentRef/@spirit:library')->to_literal ;
1490 119 jt_eaton
        my($component_name)      = $i_name  ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
1491
        my($version_name)        = $i_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
1492
 
1493 122 jt_eaton
        my $module_name = yp::lib::get_module_name($vendor_name,$library_name,$component_name,$version_name) ;
1494
 
1495
 
1496 119 jt_eaton
        if($instance_name)
1497
          {
1498 122 jt_eaton
          push @instantiations  , "$module_name\n";
1499 119 jt_eaton
          $first = 1;
1500
 
1501
          foreach  my   $i_parameter ($spirit_design_file->findnodes("//spirit:componentInstance[spirit:instanceName/text() = '$instance_name']/spirit:configurableElementValues/spirit:configurableElementValue/\@spirit:referenceId"))
1502
             {
1503
             my($foo_name)       = $i_parameter ->to_literal ;
1504
             my($foo_value)      = $i_parameter ->findnodes('../text()')->to_literal ;
1505 124 jt_eaton
 
1506
 
1507
 
1508
 
1509 119 jt_eaton
             if($first)
1510
               {
1511
               push @instantiations  , "#( .${foo_name} (${foo_value})";
1512
               $first = 0;
1513
               }
1514
             else  {push @instantiations  , ",\n   .${foo_name} (${foo_value})";}
1515
             }
1516
 
1517
             if($first == 0)  { push @instantiations  , ")\n";}
1518
             push @instantiations  , "$instance_name \n   (\n ";
1519
             $first = 1;
1520
              @per_inst = sys::lib::trim_sort(@inst_conns);
1521
 
1522
             foreach $line (@per_inst)
1523
                {
1524
                $_ = $line;
1525
 
1526
                if(/:::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::/)
1527
                  {
1528
                  my $z_instance_name           = $1;
1529
                  my $z_busRef_name   = $2;
1530
                  my $z_port_name           = $3;
1531
                  my $z_signal_name           = $4;
1532
                  my $z_vecscal           = $5;
1533
                  my $z_left           = $6;
1534
                  my $z_right           = $7;
1535
                  if($z_vecscal eq "vector")
1536
                    {
1537
                    if($z_left eq $z_right){$z_signal_name =  "${z_signal_name}[${z_left}]" ;}
1538
                    else    {$z_signal_name =  "${z_signal_name}[${z_left}:${z_right}]" ;}
1539
                    }
1540 124 jt_eaton
 
1541
                  if ($z_signal_name eq "_DUMMY_")  {$z_signal_name = "      ";}
1542
 
1543 119 jt_eaton
                  if($instance_name eq  $z_instance_name )
1544
                    {
1545
                    if($first)
1546
                      {
1547
                      push @instantiations  ,          "  .${z_port_name}         (${z_signal_name})";
1548
                      $first =0;
1549
                      }
1550
                    else   {           push @instantiations  , ",\n   .${z_port_name}         (${z_signal_name})";}
1551
                    }
1552
                  }
1553
                }
1554
 
1555
     print ".";
1556
     push @instantiations  , ");\n\n";
1557
     }
1558
     }
1559
     }
1560
 
1561
 
1562
 
1563
 
1564
 
1565
 
1566
 
1567 120 jt_eaton
 
1568
 
1569 119 jt_eaton
#/*********************************************************************************************/
1570
#/                                                                                            */
1571
#/                                                                                            */
1572
#/                                                                                            */
1573
#/                                                                                            */
1574
#/                                                                                            */
1575
#/                                                                                            */
1576
#/*********************************************************************************************/
1577
 
1578
 
1579
 
1580
 
1581
sub parse_component_file
1582
   {
1583
   my @params     = @_;
1584
   my $spirit_component_file      = pop(@params);
1585
 
1586
 
1587
 
1588
 
1589 120 jt_eaton
print "\n";
1590
foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:vendor"))
1591
   {
1592
   my($new_vendor)          = $new_comp->findnodes('./text()')->to_literal ;
1593
   my($new_library)         = $new_comp->findnodes('../spirit:library/text()')->to_literal ;
1594
   my($new_name)            = $new_comp->findnodes('../spirit:name/text()')->to_literal ;
1595
   my($new_version)         = $new_comp->findnodes('../spirit:version/text()')->to_literal ;
1596 121 jt_eaton
#    print "XXXXXX  $new_vendor $new_library $new_name $new_version  COMPONENT \n";
1597 120 jt_eaton
   }
1598
 
1599
 
1600
 
1601
 
1602 121 jt_eaton
     #/**********************************************************************/
1603
     #/*                                                                    */
1604
     #/* parse parameters and values                                        */
1605
     #/*                                                                    */
1606
     #/**********************************************************************/
1607
 
1608
     foreach  my   $i_name ($spirit_component_file->findnodes('//spirit:model/spirit:modelParameters/spirit:modelParameter/spirit:name'))
1609
        {
1610
        my($parameter_name)     = $i_name ->to_literal;
1611
        my($parameter_default)  = $i_name ->findnodes('../spirit:value/text()')->to_literal ;
1612
 
1613
        unless(defined $parameter_values{$parameter_name})
1614
         {
1615
         push ( @parameters,  "$parameter_name");
1616
        $parameter_values{$parameter_name} = ${parameter_default};
1617
        };
1618
 
1619
        }
1620
 
1621
 
1622
 
1623
 
1624
 
1625
 
1626
 
1627 120 jt_eaton
foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:hierarchyRef"))
1628
   {
1629
            my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
1630
            my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
1631
            my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
1632
            my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
1633
 
1634 121 jt_eaton
            my $foo = yp::lib::find_file_type($new_vendor,$new_library,$new_name,$new_version) ;
1635 120 jt_eaton
 
1636
     if($foo eq "spirit:component")
1637
     {
1638
     my $spirit_sub_component_file           = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$new_vendor,$new_library,$new_name,$new_version));
1639
     parse_component_file($spirit_sub_component_file);
1640
     }
1641
 
1642
     elsif($foo eq "spirit:design")
1643
     {
1644
 
1645
 
1646
      }
1647
 
1648
     elsif($foo eq "spirit:designConfiguration")
1649
     {
1650
 
1651
        my $spirit_designCfg_file
1652
         = $parser->parse_file(yp::lib::find_ipxact("spirit:designConfiguration",$new_vendor,$new_library,$new_name,$new_version ));
1653
 
1654
        foreach my $design_ref_view ($spirit_designCfg_file->findnodes('//spirit:designConfiguration'))
1655
           {
1656
           my($hier_xref_vendor)         = $design_ref_view->findnodes('./spirit:designRef/@spirit:vendor')->to_literal ;
1657
           my($hier_xref_library)        = $design_ref_view->findnodes('./spirit:designRef/@spirit:library')->to_literal ;
1658
           my($hier_xref_component)      = $design_ref_view->findnodes('./spirit:designRef/@spirit:name')->to_literal ;
1659
           my($hier_xref_version)        = $design_ref_view->findnodes('./spirit:designRef/@spirit:version')->to_literal ;
1660
 
1661
           my $spirit_design_file           = $parser->parse_file(yp::lib::find_ipxact("spirit:design",$hier_xref_vendor,$hier_xref_library,$hier_xref_component,$hier_xref_version));
1662
 
1663
#              print "XXXXXA  $hier_xref_vendor $hier_xref_library $hier_xref_component $hier_xref_version \n";
1664
           }
1665
     }
1666
 
1667
  }
1668
 
1669
 
1670
 
1671 119 jt_eaton
     #/**********************************************************************/
1672
     #/*                                                                    */
1673
     #/* Read each  busInterface and save master/slave direction            */
1674
     #/*                                                                    */
1675
     #/**********************************************************************/
1676
 
1677
     my @mas_slave;
1678
 
1679
     push @mas_slave  , "master";
1680
     push @mas_slave  , "slave";
1681
 
1682
     foreach $seek_type (@mas_slave)
1683
        {
1684
 
1685
         foreach my $bus_iface ($spirit_component_file->findnodes("//spirit:component/spirit:busInterfaces/spirit:busInterface/spirit:${seek_type}"))
1686
            {
1687
            my($mmm_cname)         = $bus_iface->findnodes('../spirit:name/text()')->to_literal ;
1688
            my($mmm_vendor)        = $bus_iface->findnodes('../spirit:abstractionType/@spirit:vendor')->to_literal ;
1689
            my($mmm_library)       = $bus_iface->findnodes('../spirit:abstractionType/@spirit:library')->to_literal ;
1690
            my($mmm_name)          = $bus_iface->findnodes('../spirit:abstractionType/@spirit:name')->to_literal ;
1691
            my($mmm_version)       = $bus_iface->findnodes('../spirit:abstractionType/@spirit:version')->to_literal ;
1692
 
1693
            foreach my $port_face ($spirit_component_file->findnodes('//spirit:component/spirit:busInterfaces/spirit:busInterface/spirit:portMaps/spirit:portMap/spirit:logicalPort'))
1694
               {
1695
               my($rrr_log_name)      = $port_face->findnodes('./spirit:name/text()')->to_literal ;
1696
               my($rrr_phy_name)      = $port_face->findnodes('../spirit:physicalPort/spirit:name/text()')->to_literal ;
1697
               my($rrr_type_name)     = $port_face->findnodes('../spirit:physicalPort/spirit:wireTypeDefs/spirit:wireTypeDef/spirit:typeName/text()')->to_literal ;
1698
               my($rrr_int_name)      = $port_face->findnodes('../../../spirit:name/text()')->to_literal ;
1699
               my($rrr_left_value)    = $port_face->findnodes('../spirit:physicalPort/spirit:wire/spirit:vector/spirit:left/text()')->to_literal ;
1700
               my($rrr_right_value)   = $port_face->findnodes('../spirit:physicalPort/spirit:wire/spirit:vector/spirit:right/text()')->to_literal ;
1701
 
1702
               unless ($rrr_type_name)  {$rrr_type_name = "wire";}
1703
 
1704
               if(   $mmm_cname  eq  $rrr_int_name )
1705
                 {
1706
 
1707
                 my $busdef_parser = XML::LibXML->new();
1708 123 jt_eaton
#                 print "XXXXXX  $mmm_vendor $mmm_library $mmm_name $mmm_version  \n";
1709 122 jt_eaton
                 my $spirit_abstractor_file    = ($parser->parse_file(yp::lib::find_ipxact("spirit:abstractionDefinition",$mmm_vendor,$mmm_library,$mmm_name,$mmm_version))
1710 119 jt_eaton
 
1711 122 jt_eaton
                ) || die "(OOPs $mmm_vendor $mmm_library $mmm_name $mmm_version )";
1712
 
1713
 
1714
 
1715 119 jt_eaton
                 foreach my $abstr_view ($spirit_abstractor_file->findnodes("//spirit:abstractionDefinition/spirit:ports/spirit:port/spirit:logicalName[text() = '$rrr_log_name']"))
1716
                    {
1717
                    my($sss_m_dir)         = $abstr_view->findnodes('../spirit:wire/spirit:onMaster/spirit:direction/text()')->to_literal ;
1718
                    my($sss_s_dir)         = $abstr_view->findnodes('../spirit:wire/spirit:onSlave/spirit:direction/text()')->to_literal ;
1719
 
1720
                    if    ($sss_m_dir eq "in")  { $sss_m_dir = "input";}
1721
                    elsif ($sss_m_dir eq "out") { $sss_m_dir = "output";}
1722
 
1723
                    if    ($sss_s_dir eq "in")  { $sss_s_dir = "input";}
1724
                    elsif ($sss_s_dir eq "out") { $sss_s_dir = "output";}
1725
 
1726
                    my $rrr_direction = "";
1727
 
1728
                    if( $seek_type eq "master") {        $rrr_direction = $sss_m_dir;}
1729
                    else                        {        $rrr_direction = $sss_s_dir;}
1730
 
1731
                    my $rrr_dir = "";
1732
                    if   ($rrr_direction  eq "in" )  {$rrr_dir = "input" ;}
1733
                    elsif($rrr_direction  eq "out" ) {$rrr_dir = "output" ;}
1734
                    else                             {$rrr_dir = $rrr_direction;     }
1735
 
1736 122 jt_eaton
                    if($rrr_left_value ne "")
1737 119 jt_eaton
                        {
1738
                        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}:::";
1739
                        }
1740
                      else
1741
                        {
1742
                        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}:::";
1743
                        }
1744
                    }
1745
                 }
1746
               }
1747 122 jt_eaton
        }
1748 119 jt_eaton
     }
1749
 
1750
 
1751
 
1752
 
1753
     #/**********************************************************************/
1754
     #/*                                                                    */
1755
     #/* Read all ports and store into array                                */
1756
     #/*                                                                    */
1757
     #/**********************************************************************/
1758
 
1759
     foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:ports/spirit:port/spirit:name"))
1760
        {
1761
        my($port_name)       = $i_name ->findnodes('./text()')->to_literal ;
1762
        my($direction)       = $i_name ->findnodes('../spirit:wire/spirit:direction/text()')->to_literal ;
1763
        my($left)            = $i_name ->findnodes('../spirit:wire/spirit:vector/spirit:left/text()')->to_literal ;
1764
        my($right)           = $i_name ->findnodes('../spirit:wire/spirit:vector/spirit:right/text()')->to_literal ;
1765
        my($type)            = $i_name ->findnodes('../spirit:wireTypeDefs/spirit:wireTypeDef/spirit:typeName/text()')->to_literal ;
1766
 
1767
 
1768
        if    ($direction eq "in")  { $direction = "input";}
1769
        elsif ($direction eq "out") { $direction = "output";}
1770
 
1771
 
1772 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}:::";  }
1773 119 jt_eaton
        else       { push @wire_decs , ":::${port_name}:::${port_name}:::${direction}:::${type}:::scaler:::none:::none:::none:::0:::${port_name}:::XXX:::${port_name}:::";          }
1774
        }
1775
 
1776
 
1777
 
1778
 
1779
}
1780
 
1781
 
1782
1
1783
 

powered by: WebSVN 2.1.0

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