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

Subversion Repositories socgen

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

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

powered by: WebSVN 2.1.0

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