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

Subversion Repositories socgen

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

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

powered by: WebSVN 2.1.0

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