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

Subversion Repositories socgen

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

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
           "fragment","no_port","local_parameters"
77
) || 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
my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$project);
107
my $comp_xml_sep    = yp::lib::find_ipxact_component_path("spirit:component",$vendor,$project,$component,$version);
108
 
109
my $parser = XML::LibXML->new();
110
 
111
 
112
my $path  = "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}";
113
mkdir $path,0755             unless( -e $path );
114
 
115
my $path  = "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}/${view}";
116
mkdir $path,0755             unless( -e $path );
117
 
118
my   @filelist_hier     =       ();
119
my   @instantiations    =       ();
120
my   @parameters        =       ();
121
my   %parameter_values  =       ();
122
 
123
print  "  Building verilog for ${project} ${component}  ${variant} \n  ";
124
my $socgen_ip_file                  = $parser->parse_file(yp::lib::find_socgen("socgen:ip",$vendor,$project,$component));
125
my $spirit_component_file           = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$vendor,$project,$component,$version));
126
my $spirit_design_file              = yp::lib::find_ipxact_design_file($vendor,$project,$component,$version);
127
my $spirit_padring_file             = yp::lib::find_ipxact_padring_file($vendor,$project,$component,$version);
128
my $spirit_padring_design_file      = yp::lib::find_ipxact_padring_design_file($vendor,$project,$component,$version);
129
 
130
 
131
 
132
#/**********************************************************************/
133
#/*                                                                    */
134
#/* Every hier cell is constructed from the ipxact file with seperate  */
135
#/* version  for each view                                             */
136
#/*                                                                    */
137
#/* Start by opening the output file                                   */
138
#/* get fileset name                                                   */
139
#/* check that requested view exists                                   */
140
#/*                                                                    */
141
#/**********************************************************************/
142
 
143
foreach my $comp_view ($spirit_component_file->findnodes('//spirit:component/spirit:model/spirit:views/spirit:view/spirit:fileSetRef'))
144
   {
145
   my($view_fileset_name)  = $comp_view->findnodes('./spirit:localName/text()')->to_literal ;
146
   my($view_name)          = $comp_view->findnodes('../spirit:name/text()')->to_literal ;
147
 
148
   if($view eq $view_name)
149
     {
150
     $outfile ="${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}/${view}/${destination}";
151
     open DEST_FILE,">$outfile" or die "unable to open $outfile";
152
 
153
     unless ($opt_fragment){     print DEST_FILE  "\n module \n\n  $variant \n ";}
154
 
155
     #/*****************************************************************************/
156
     #/*  wire_decs array holds all port and signal declarations                   */
157
     #/*  :::name:::node_input_output:::wire_reg:::scaler_vector:::left:::right::: */
158
     #/*****************************************************************************/
159
 
160
     @wire_decs = (  );
161
 
162
 
163
     #/**********************************************************************/
164
     #/*  inst_conns holds all instance connections                         */
165
     #/**********************************************************************/
166
 
167
     @inst_conns = (  );
168
 
169
     my @decl_names  = ();
170
     my %decl_dirs  = ();
171
     my %decl_types  = ();
172
     my %decl_vector = ();
173
     my %decl_lefts  = ();
174
     my %decl_rights = ();
175
 
176
 
177
     if($spirit_padring_file) {parse_component_file($spirit_padring_file);}
178
 
179
     parse_component_file($spirit_component_file);
180
 
181
 
182
 
183
 
184
 
185
 
186
 
187
 
188
#  design file
189
 
190
    if($spirit_padring_design_file)   { parse_design_file($spirit_padring_design_file);     }
191
    if($spirit_design_file)           { parse_design_file($spirit_design_file);             }
192
 
193
 
194
 
195
 
196
 
197
 
198
 
199
     #/**********************************************************************/
200
     #/*                                                                    */
201
     #/* pack ports and nodes into hashes                                   */
202
     #/*                                                                    */
203
     #/**********************************************************************/
204
 
205
 
206
     @wire_decs      = sys::lib::trim_sort(@wire_decs);
207
     foreach $line (@wire_decs)
208
        {
209
#        print "X- $line  \n";
210
        $_ = $line;
211
        if(/:::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::/)
212
          {
213
          $q_index               = $1;
214
          $q_node_name           = $2;
215
          $q_direction           = $3;
216
          $q_type                = $4;
217
          $q_vector              = $5;
218
          $q_left                = $6;
219
          $q_right               = $7;
220
          $q_instance            = $8;
221
          $q_depth               = $9;
222
          $q_phy_name            = $10;
223
          $q_busref_name         = $11;
224
          $q_abslog_name         = $12;
225
 
226
 
227
 
228
 
229
         push ( @decl_names,$q_index);
230
 
231
 
232
          if(  $decl_pnames{$q_index})
233
            {
234
            if(  $decl_pnames{$q_index} eq ${q_index})
235
              {
236
              $decl_pnames{$q_index}  = "${q_node_name}";
237
              }
238
            }
239
          else
240
            {
241
            $decl_pnames{$q_index}  = "${q_node_name}";
242
            }
243
 
244
 
245
          if(  $decl_dirs{$q_index})
246
            {
247
            if(  $decl_dirs{$q_index} eq "node")
248
              {
249
              $decl_types{$q_index}  = "${q_type}";
250
              $decl_dirs{$q_index}  = "${q_direction}";
251
              }
252
            }
253
          else
254
            {
255
            $decl_types{$q_index}  = "${q_type}";
256
            $decl_dirs{$q_index}  = "${q_direction}";
257
            }
258
 
259
          if(  $decl_vector{$q_index})
260
            {  unless(  $decl_vector{$q_index} eq "vector"){ $decl_vector{$q_index}  = "${q_vector}";  }}
261
          else  { $decl_vector{$q_index}  = "${q_vector}"; }
262
 
263
          if( $q_vector eq "vector" )
264
            {
265
            if ( defined $decl_lefts{$q_index})
266
               {
267
               if($decl_lefts{$q_index}   <= $q_left  ) {$decl_lefts{$q_index}   = $q_left;}
268
               if($decl_rights{$q_index}  >= $q_right ) {$decl_rights{$q_index}  = $q_right;}
269
               }
270
            else
271
               {
272
               $decl_lefts{$q_index}   = $q_left;
273
               $decl_rights{$q_index}  = $q_right;
274
               }
275
            }
276
          }
277
        }
278
     @decl_names      = sys::lib::trim_sort(@decl_names);
279
 
280
 
281
 
282
 
283
 
284
     #/**********************************************************************/
285
     #/*                                                                    */
286
     #/* All port and signal info is now loaded in hashes, print out verilog*/
287
     #/*                                                                    */
288
     #/* Print out module header , parameters and ports                     */
289
     #/*                                                                    */
290
     #/**********************************************************************/
291
 
292
 
293
 
294
 
295
 
296
     #/**********************************************************************/
297
     #/*                                                                    */
298
     #/* parse parameters and values                                        */
299
     #/*                                                                    */
300
     #/**********************************************************************/
301
 
302
 
303
     foreach  my   $i_name ($spirit_component_file->findnodes('//spirit:model/spirit:modelParameters/spirit:modelParameter/spirit:name'))
304
        {
305
        my($parameter_name)     = $i_name ->to_literal;
306
        my($parameter_default)  = $i_name ->findnodes('../spirit:value/text()')->to_literal ;
307
 
308
        unless($parameter_values{$parameter_name}) {push ( @parameters,  "$parameter_name");};
309
        $parameter_values{$parameter_name} = ${parameter_default};
310
        }
311
 
312
 
313
 
314
 
315
 
316
 
317
 
318
     #/**********************************************************************/
319
     #/*                                                                    */
320
     #/* if configuration set then read parameters from socgen:ip file      */
321
     #/*                                                                    */
322
     #/**********************************************************************/
323
 
324
    if($configuration)
325
      {
326
      # print "XXX Reading configuration   $configuration \n";
327
      unless ($socgen_ip_file)      { print "No socgen ip file \n";};
328
 
329
 
330
 
331
      foreach my $socgen_cfg ($socgen_ip_file->findnodes("//socgen:ip/socgen:configurations/socgen:configuration/socgen:parameters/socgen:parameter/socgen:name"))
332
                {
333
                my($param_name)         = $socgen_cfg->findnodes('./text()')->to_literal ;
334
                my($param_value)        = $socgen_cfg->findnodes('../socgen:value/text()')->to_literal ;
335
                my($config_name)        = $socgen_cfg->findnodes('../../../socgen:name/text()')->to_literal ;
336
                if($config_name eq $configuration  )
337
                  {
338
#                  print "XXX $config_name $param_name $param_value \n";
339
                  unless($parameter_values{$param_name}) {push ( @parameters,  "$param_name");};
340
                  $parameter_values{$param_name} = ${param_value};
341
                  }
342
                }
343
 
344
 
345
      }
346
      else {print "No configuration \n";};
347
 
348
 
349
 
350
 
351
 
352
 
353
     #/**********************************************************************/
354
     #/*                                                                    */
355
     #/* Add any and all global parameters with their default values        */
356
     #/*                                                                    */
357
     #/**********************************************************************/
358
 
359
     unless ($opt_local_parameters)
360
     {
361
     my $first = 1;
362
     foreach my $parameter_name (@parameters)
363
        {
364
        my $parameter_value = $parameter_values{$parameter_name};
365
        if($first)
366
          {
367
          print DEST_FILE  "   #( parameter \n      ${parameter_name}=${parameter_value}";
368
          $first=0;
369
          }
370
        else  { print DEST_FILE  ",\n      ${parameter_name}=${parameter_value}";}
371
        }
372
 
373
     if    ($first == 0)   { print DEST_FILE  ")\n"; }
374
       }
375
 
376
 
377
     #/**********************************************************************/
378
     #/*                                                                    */
379
     #/* sort all  ports  with their type, size and direction               */
380
     #/*                                                                    */
381
     #/**********************************************************************/
382
 
383
 
384
     my @port_list  = ();
385
 
386
 
387
     foreach $x_name (@decl_names)
388
        {
389
        my $q_width  = "     ";
390
        if( $decl_vector{$x_name} eq "vector" )  { $q_width = "[ $decl_lefts{$x_name} :  $decl_rights{$x_name}]"}
391
 
392
        if( $decl_dirs{$x_name} ne "node" )
393
          {
394
          push (@port_list,  "$decl_dirs{$x_name}   $decl_types{$x_name}    $q_width        $decl_pnames{$x_name}");
395
          }
396
        }
397
 
398
 
399
     @port_list      = sys::lib::trim_sort(@port_list);
400
 
401
 
402
 
403
 
404
 
405
 
406
 
407
 
408
     #/**********************************************************************/
409
     #/*                                                                    */
410
     #/* Now add all ports  with their type, size and direction             */
411
     #/*                                                                    */
412
     #/**********************************************************************/
413
 
414
 
415
     print DEST_FILE  "\n    ";
416
     $first = 1;
417
 
418
     foreach $port_line (@port_list)
419
        {
420
          if($first)
421
            {
422
            print DEST_FILE  " (\n ${port_line}";
423
            $first=0;
424
            }
425
          else
426
            {
427
            print DEST_FILE  ",\n ${port_line}";
428
            }
429
 
430
        }
431
 
432
 
433
 
434
 
435
     if    ($first == 0)   { print DEST_FILE  ");\n\n\n\n"; }
436
     elsif ($opt_no_port)  { print DEST_FILE  "\n\n\n\n";  }
437
     else                  { print DEST_FILE  "();\n\n\n\n";}
438
 
439
 
440
 
441
 
442
     #/**********************************************************************/
443
     #/*                                                                    */
444
     #/* Add any and all local parameters with their default values         */
445
     #/*                                                                    */
446
     #/**********************************************************************/
447
 
448
     if ($opt_local_parameters)
449
     {
450
     foreach my $parameter_name (@parameters)
451
        {
452
        my $parameter_value = $parameter_values{${parameter_name}};
453
        print DEST_FILE  "parameter ${parameter_name} = ${parameter_value};\n";
454
        }
455
 
456
 
457
     }
458
 
459
 
460
 
461
 
462
 
463
 
464
     #/**********************************************************************/
465
     #/*                                                                    */
466
     #/* Add all internal wires and regs with their sizes                   */
467
     #/*                                                                    */
468
     #/**********************************************************************/
469
 
470
     foreach $x_name (@decl_names)
471
        {
472
        my $q_width  = "     ";
473
        if( $decl_vector{$x_name} eq "vector" ){ $q_width = "[ $decl_lefts{$x_name} :  $decl_rights{$x_name}]"}
474
        if( $decl_dirs{$x_name} eq "node" )    { print DEST_FILE     "$decl_types{$x_name}     $q_width              $decl_pnames{$x_name};\n";}
475
        }
476
 
477
     print DEST_FILE  "\n\n\n";
478
 
479
 
480
 
481
 
482
 
483
 
484
 
485
 
486
 
487
 
488
while(   my $line_out      = shift(@instantiations))
489
 
490
                    {  print DEST_FILE  "$line_out";}
491
 
492
 
493
 
494
 
495
     #/**********************************************************************/
496
     #/*                                                                    */
497
     #/* After all the data from the ip-xact file has been entered we now   */
498
     #/* insert any and all verilog fragments at the end before closing     */
499
     #/* the module                                                         */
500
     #/*                                                                    */
501
     #/**********************************************************************/
502
 
503
 
504
     foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:fileSets/spirit:fileSet/spirit:file/spirit:name"))
505
        {
506
        my($rtl_file)       = $i_name ->findnodes('./text()')->to_literal;
507
        my($file_type)      = $i_name ->findnodes('../spirit:fileType/text()')->to_literal;
508
        my($view_file)      = $i_name ->findnodes('../../spirit:name/text()')->to_literal ;
509
 
510
        if(($file_type eq "verilogFragment")&& (($view_file eq $view_fileset_name)))
511
          {
512
          $SRCFILE ="${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${rtl_file}";
513
          open(SRCFILE) or die("Could not open src file.  $SRCFILE ");
514
          foreach $line ()
515
             {
516
             chomp($line);
517
             print DEST_FILE  "${line}\n";
518
             }
519
          }
520
        }
521
     unless ($opt_fragment ) {print DEST_FILE  "\n\n\n  endmodule\n\n";}
522
     }
523
   }
524
 
525
#print  "\n";
526
 
527
 
528
 
529
 
530
 
531
 
532
 
533
 
534
 
535
#/*********************************************************************************************/
536
#/                                                                                            */
537
#/                                                                                            */
538
#/                                                                                            */
539
#/                                                                                            */
540
#/                                                                                            */
541
#/                                                                                            */
542
#/*********************************************************************************************/
543
 
544
 
545
 
546
 
547
sub parse_busInterface
548
   {
549
   my @params     = @_;
550
   my $depth      = pop(@params);
551
   my $busref     = pop(@params);
552
   my $version    = pop(@params);
553
   my $component  = pop(@params);
554
   my $project    = pop(@params);
555
   my $vendor     = pop(@params);
556
 
557
   my $home = cwd();
558
 
559
   my @out_stack  = ();
560
 
561
 
562
   my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$vendor,$project,$component,$version));
563
   my $spirit_design_file       = yp::lib::find_ipxact_design_file($vendor,$project,$component,$version);
564
 
565
   my $busInterfaceTest = 0;
566
 
567
   my @mas_slave;
568
     push @mas_slave  , "master";
569
     push @mas_slave  , "slave";
570
 
571
     foreach my $seek_type (@mas_slave)
572
        {
573
 
574
 
575
     foreach my $bus_iface ($spirit_component_file->findnodes("//spirit:component/spirit:busInterfaces/spirit:busInterface/spirit:${seek_type}"))
576
        {
577
        my($fff_cname)         = $bus_iface->findnodes('../spirit:name/text()')->to_literal ;
578
        my($fff_vendor)        = $bus_iface->findnodes('../spirit:abstractionType/@spirit:vendor')->to_literal ;
579
        my($fff_library)       = $bus_iface->findnodes('../spirit:abstractionType/@spirit:library')->to_literal ;
580
        my($fff_name)          = $bus_iface->findnodes('../spirit:abstractionType/@spirit:name')->to_literal ;
581
        my($fff_version)       = $bus_iface->findnodes('../spirit:abstractionType/@spirit:version')->to_literal ;
582
        my $fff_variant_name   = "";
583
        if($fff_version)         {$fff_variant_name = "${fff_name}_${fff_version}";}
584
        else                     {$fff_variant_name = "${fff_name}";}
585
 
586
 
587
 
588
 
589
        foreach my $port_face ($spirit_component_file->findnodes('//spirit:component/spirit:busInterfaces/spirit:busInterface/spirit:portMaps/spirit:portMap/spirit:logicalPort'))
590
           {
591
 
592
           my($fff_xxx_name)      = $port_face->findnodes('../../../spirit:name/text()')->to_literal ;
593
 
594
           my($fff_log_name)      = $port_face->findnodes('./spirit:name/text()')->to_literal ;
595
           my($fff_phy_name)      = $port_face->findnodes('../spirit:physicalPort/spirit:name/text()')->to_literal ;
596
           my($fff_type_name)     = $port_face->findnodes('../spirit:physicalPort/spirit:wireTypeDefs/spirit:wireTypeDef/spirit:typeName/text()')->to_literal ;
597
           my($fff_int_name)      = $port_face->findnodes('../../../spirit:name/text()')->to_literal ;
598
 
599
           my($fff_left_value)    = $port_face->findnodes('../spirit:physicalPort/spirit:wire/spirit:vector/spirit:left/text()')->to_literal ;
600
           my($fff_right_value)   = $port_face->findnodes('../spirit:physicalPort/spirit:wire/spirit:vector/spirit:right/text()')->to_literal ;
601
 
602
           unless ($fff_type_name)  {$fff_type_name = "wire";};
603
 
604
           if(  ( $fff_xxx_name  eq  $busref) && (  $busref eq   $fff_cname  )       )
605
             {
606
             $busInterfaceTest = 1;
607
             my $busdef_parser = XML::LibXML->new();
608
 
609
             my $spirit_abstractor_file     = $parser->parse_file(yp::lib::find_ipxact("spirit:abstractionDefinition",$fff_vendor,$fff_library,$fff_name,$fff_version));
610
 
611
 
612
 
613
 
614
             foreach my $abstr_view ($spirit_abstractor_file->findnodes("//spirit:abstractionDefinition/spirit:ports/spirit:port/spirit:logicalName[text() = '$fff_log_name']"))
615
                {
616
                my($sss_m_dir)         = $abstr_view->findnodes('../spirit:wire/spirit:onMaster/spirit:direction/text()')->to_literal ;
617
                my($sss_s_dir)         = $abstr_view->findnodes('../spirit:wire/spirit:onSlave/spirit:direction/text()')->to_literal ;
618
 
619
                    if    ($sss_m_dir eq "in")  { $sss_m_dir = "input";}
620
                    elsif ($sss_m_dir eq "out") { $sss_m_dir = "output";}
621
 
622
                    if    ($sss_s_dir eq "in")  { $sss_s_dir = "input";}
623
                    elsif ($sss_s_dir eq "out") { $sss_s_dir = "output";}
624
 
625
 
626
                my $fff_direction = "";
627
 
628
 
629
                  if    ( $seek_type eq "master")  { $fff_direction = $sss_m_dir;     }
630
                  elsif ( $seek_type eq "slave" )  { $fff_direction = $sss_s_dir;     }
631
 
632
                  my $fff_dir = "";
633
                  if   ($fff_direction  eq "in" )  {$fff_dir = "input" ;}
634
                  elsif($fff_direction  eq "out" ) {$fff_dir = "output" ;}
635
                  else                             {$fff_dir = $fff_direction;     }
636
 
637
                  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}:::"; }
638
                  else                { push @out_stack, ":::${depth}:::${fff_log_name}:::${fff_phy_name}:::${fff_dir}:::${fff_type_name}:::scaler:::none:::none:::";    }
639
 
640
 
641
                }
642
             }
643
 
644
           }
645
       }
646
 
647
}
648
 
649
 
650
 
651
 
652
 
653
       if ( $busInterfaceTest){
654
                              @out_stack      = sys::lib::trim_sort(@out_stack);
655
                              return(@out_stack);
656
                              }
657
 
658
    if($spirit_design_file)
659
 
660
     {
661
 
662
     foreach  my   $x_name ($spirit_design_file->findnodes('//spirit:hierConnections/spirit:hierConnection/@spirit:interfaceRef'))
663
        {
664
        my($hierConn_name)                   = $x_name ->to_literal ;
665
        my($hierConn_comref_name)            = $x_name ->findnodes('../spirit:interface/@spirit:componentRef')->to_literal ;
666
        my($hierConn_busref_name)            = $x_name ->findnodes('../spirit:interface/@spirit:busRef')->to_literal ;
667
        if($busref eq  $hierConn_name)
668
          {
669
          foreach  my   $x_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName[text() = '$hierConn_comref_name']"))
670
            {
671
            #/**********************************************************************/
672
            #/*                                                                    */
673
            #/* Lookup VLNV for each instantiated component                        */
674
            #/*                                                                    */
675
            #/**********************************************************************/
676
 
677
            my($vendor_name)         = $x_name  ->findnodes('../spirit:componentRef/@spirit:vendor')->to_literal ;
678
            my($library_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:library')->to_literal ;
679
            my($component_name)      = $x_name  ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
680
            my($version_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
681
            $depth = $depth +1;
682
            @out_stack = parse_busInterface ($vendor_name, $library_name,$component_name,$version_name,$hierConn_busref_name,$depth );
683
            }
684
          }
685
        }
686
        @out_stack      = sys::lib::trim_sort(@out_stack);
687
        return(@out_stack);
688
     }
689
 
690
   }
691
 
692
 
693
 
694
 
695
#/*********************************************************************************************/
696
#/                                                                                            */
697
#/                                                                                            */
698
#/                                                                                            */
699
#/                                                                                            */
700
#/                                                                                            */
701
#/                                                                                            */
702
#/*********************************************************************************************/
703
 
704
 
705
 
706
 
707
sub parse_design_file
708
   {
709
   my @params     = @_;
710
   my $spirit_design_file      = pop(@params);
711
 
712
 
713
 
714
 
715
     #/**********************************************************************/
716
     #/*                                                                    */
717
     #/* Read each hierConnection and enter signals into wire_decs          */
718
     #/*                                                                    */
719
     #/**********************************************************************/
720
     foreach  my   $x_name ($spirit_design_file->findnodes('//spirit:hierConnections/spirit:hierConnection/@spirit:interfaceRef'))
721
        {
722
        my($hierConn_name)                   = $x_name ->to_literal ;
723
        my($hierConn_comref_name)            = $x_name ->findnodes('../spirit:interface/@spirit:componentRef')->to_literal ;
724
        my($hierConn_busref_name)            = $x_name ->findnodes('../spirit:interface/@spirit:busRef')->to_literal ;
725
 
726
        foreach  my   $x_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName"))
727
           {
728
           #/**********************************************************************/
729
           #/*                                                                    */
730
           #/* Lookup VLNV for each instantiated component                        */
731
           #/*                                                                    */
732
           #/**********************************************************************/
733
 
734
           my($instance_name)       = $x_name ->findnodes('./text()')->to_literal ;
735
          my($vendor_name)         = $x_name  ->findnodes('../spirit:componentRef/@spirit:vendor')->to_literal ;
736
         my($library_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:library')->to_literal ;
737
         my($component_name)      = $x_name  ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
738
         my($version_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
739
 
740
           if( "$instance_name" eq  "$hierConn_comref_name"     )
741
             {
742
             my  @filelist_sub = parse_busInterface($vendor_name, $library_name,$component_name,$version_name,$hierConn_busref_name,"1" );
743
           #/**********************************************************************/
744
           #/*                                                                    */
745
           #/* follow bus all the way to it's source                              */
746
           #/*                                                                    */
747
           #/**********************************************************************/
748
 
749
             foreach $xxline (@filelist_sub)
750
                {
751
                $_ = $xxline;
752
                if(/:::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::/)
753
                  {
754
                  $k_depth               = $1;
755
                  $k_log_name            = $2;
756
                  $k_phy_name            = $3;
757
                  $k_direction           = $4;
758
                  $k_type                = $5;
759
                  $k_vector              = $6;
760
                  $k_left                = $7;
761
                  $k_right               = $8;
762
                  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}:::";
763
                  }
764
                }
765
             }
766
           }
767
        }
768
 
769
 
770
 
771
 
772
 
773
     #/**************************************************************************/
774
     #/*                                                                        */
775
     #/* Read each  interconnection and enter sub signals into wire_decs        */
776
     #/*                                                                        */
777
     #/**************************************************************************/
778
 
779
 
780
 
781
 
782
     foreach  my   $x_name ($spirit_design_file->findnodes('//spirit:interconnections/spirit:interconnection/spirit:activeInterface/@spirit:componentRef'))
783
        {
784
        my($hierConn_comref_name)            = $x_name ->to_literal;
785
        my($hierConn_busref_name)            = $x_name ->findnodes('../@spirit:busRef')->to_literal ;
786
        my($hierConn_name)                   = $x_name ->findnodes('../../spirit:name/text()')->to_literal ;
787
 
788
        foreach  my   $x_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName"))
789
           {
790
           #/**********************************************************************/
791
           #/*                                                                    */
792
           #/* Lookup VLNV for each instantiated component                        */
793
           #/*                                                                    */
794
           #/**********************************************************************/
795
 
796
           my($instance_name)       = $x_name ->findnodes('./text()')->to_literal ;
797
           my($vendor_name)         = $x_name  ->findnodes('../spirit:componentRef/@spirit:vendor')->to_literal ;
798
           my($library_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:library')->to_literal ;
799
           my($component_name)      = $x_name  ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
800
           my($version_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
801
 
802
 
803
 
804
           my $variant_name   = "";
805
           if($version_name)  {$variant_name = "${component_name}_${version_name}";}
806
           else               {$variant_name = "${component_name}";}
807
 
808
           if( "$instance_name" eq  "$hierConn_comref_name"     )
809
             {
810
 
811
 
812
 
813
           #/**********************************************************************/
814
           #/*                                                                    */
815
           #/* follow bus all the way to it's source                              */
816
           #/*                                                                    */
817
           #/**********************************************************************/
818
 
819
 
820
             my  @filelist_sub = parse_busInterface($vendor_name, $library_name,$component_name,$version_name,$hierConn_busref_name,"1" );
821
             foreach $xxline (@filelist_sub)
822
                {
823
 
824
 
825
                $_ = $xxline;
826
                if(/:::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::/)
827
                  {
828
                  $k_depth               = $1;
829
                  $k_log_name            = $2;
830
                  $k_phy_name            = $3;
831
                  $k_direction           = $4;
832
                  $k_type                = $5;
833
                  $k_vector              = $6;
834
                  $k_left                = $7;
835
                  $k_right               = $8;
836
 
837
 
838
                  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}:::";
839
                  }
840
                }
841
             }
842
           }
843
        }
844
 
845
 
846
 
847
     #/*******************************************************************************/
848
     #/*                                                                             */
849
     #/* Read each  interconnection and enter modified signals into wire_decs        */
850
     #/*                                                                             */
851
     #/*******************************************************************************/
852
 
853
 
854
 
855
 
856
 
857
        foreach  my  $k_name ($spirit_design_file->findnodes('//spirit:interconnections/spirit:interconnection/spirit:activeInterface/spirit:portMaps/spirit:portMap/spirit:logicalPort/spirit:name'))
858
           {
859
           my($lp_name)                = $k_name ->to_literal;
860
           my($lp_pname)               = $k_name ->findnodes('../../spirit:physicalPort/spirit:name/text()')->to_literal ;
861
           my($lp_left)                = $k_name ->findnodes('../../spirit:physicalPort/spirit:wire/spirit:vector/spirit:left/text()')->to_literal ;
862
           my($lp_right)               = $k_name ->findnodes('../../spirit:physicalPort/spirit:wire/spirit:vector/spirit:right/text()')->to_literal ;
863
           my($lp_componentref_name)   = $k_name ->findnodes('../../../../@spirit:componentRef')->to_literal ;
864
           my($lp_busref_name)         = $k_name ->findnodes('../../../../@spirit:busRef')->to_literal ;
865
           my($lp_interconnect_name)   = $k_name ->findnodes('../../../../../spirit:name/text()')->to_literal ;
866
 
867
 
868
           if ( $lp_pname eq '' ) { $lp_pname ="${lp_interconnect_name}_${lp_name}";}
869
           if ( $lp_left  eq '' ) { $lp_left ="none";}
870
           if ( $lp_right eq '' ) { $lp_right ="none";}
871
 
872
 
873
 
874
          if ( $lp_left  eq 'none' )
875
          {
876
           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}:::";
877
          }
878
          else
879
          {
880
           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}:::";
881
          }
882
           }
883
 
884
 
885
 
886
 
887
 
888
 
889
 
890
 
891
 
892
 
893
 
894
     #/**********************************************************************/
895
     #/*                                                                    */
896
     #/* Read all adHocConnections and load instance connect info into array*/
897
     #/*                                                                    */
898
     #/**********************************************************************/
899
 
900
 
901
     foreach  my   $i_xame ($spirit_design_file->findnodes('//spirit:adHocConnections/spirit:adHocConnection/spirit:internalPortReference/@spirit:componentRef'))
902
        {
903
        my($comp_name)    = $i_xame ->to_literal;
904
        my($int_value)    = $i_xame ->findnodes('../../spirit:name/text()')->to_literal ;
905
        my($int_name)     = $i_xame ->findnodes('../@spirit:portRef')->to_literal ;
906
        my($vec_left)     = $i_xame ->findnodes('../@spirit:left')->to_literal ;
907
        my($vec_right)    = $i_xame ->findnodes('../@spirit:right')->to_literal ;
908
 
909
        if($vec_left ne "")
910
          {
911
          my $vecs = "";
912
          if($vec_left ne $vec_right ){$vecs ="[${vec_left}:${vec_right}]";}
913
          else                        {$vecs ="[${vec_right}]";}
914
          push @inst_conns , ":::${comp_name}:::adhoc:::${int_name}:::${int_value}:::vector:::${vec_left}:::${vec_right}:::";
915
          }
916
        else
917
          {
918
          push @inst_conns , ":::${comp_name}:::adhoc:::${int_name}:::${int_value}:::scaler:::none:::none:::";
919
          }
920
        }
921
 
922
 
923
 
924
     #/**********************************************************************/
925
     #/*                                                                    */
926
     #/* Add all internal wires and regs with their sizes                   */
927
     #/*                                                                    */
928
     #/**********************************************************************/
929
 
930
     foreach  my   $i_name ($spirit_design_file->findnodes("//spirit:design/nodes/node/spirit:name"))
931
        {
932
        my($node_name)  = $i_name ->findnodes('./text()')->to_literal ;
933
        my($left)            = $i_name ->findnodes('../spirit:wire/spirit:vector/spirit:left/text()')->to_literal ;
934
        my($right)           = $i_name ->findnodes('../spirit:wire/spirit:vector/spirit:right/text()')->to_literal ;
935
        my($type)            = $i_name ->findnodes('../spirit:wireTypeDefs/spirit:wireTypeDef/spirit:typeName/text()')->to_literal ;
936
 
937
        if($left)      { push @wire_decs , ":::${node_name}:::${node_name}:::node:::${type}:::vector:::${left}:::${$right}:::none:::0:::${node_name}:::XXX:::${node_name}:::"; }
938
        else           { push @wire_decs , ":::${node_name}:::${node_name}:::node:::${type}:::scaler:::none:::none:::none:::0:::${node_name}:::XXX:::${node_name}:::";   }
939
 
940
        }
941
 
942
 
943
 
944
 
945
 
946
 
947
 
948
 
949
 
950
 
951
 
952
 
953
 
954
     #/**********************************************************************/
955
     #/*                                                                    */
956
     #/* extract bus instance connections from wire_decs                    */
957
     #/*                                                                    */
958
     #/**********************************************************************/
959
 
960
     print "+-+";
961
 
962
 
963
 
964
     my @inst_names  = ();
965
     my @inst_Inames  = ();
966
     my %inst_ports  = ();
967
     my %inst_sigs   = ();
968
     my %inst_vector = ();
969
     my %inst_left   = ();
970
     my %inst_right  = ();
971
 
972
 
973
     foreach $line (@wire_decs)
974
        {
975
        $_ = $line;
976
        if(/:::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::/)
977
          {
978
          my $t_index               = $1;
979
          my $t_node_name           = $2;
980
          my $t_direction           = $3;
981
          my $t_type                = $4;
982
          my $t_vector              = $5;
983
          my $t_left                = $6;
984
          my $t_right               = $7;
985
          my $t_instance            = $8;
986
          my $t_depth               = $9;
987
          my $t_phy_name            = $10;
988
          my $t_busref_name         = $11;
989
          my $t_abslog_name         = $12;
990
 
991
        if( 1)
992
          {
993
 
994
         push ( @inst_names, "${t_instance}_${t_busref_name}_${t_index}");
995
 
996
         $inst_Inames{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_instance}";
997
 
998
         if(  $inst_sigs{"${t_instance}_${t_busref_name}_${t_index}"})
999
            {
1000
            if(  $inst_sigs{"${t_instance}_${t_busref_name}_${t_index}"} eq ${t_index})
1001
              {
1002
              $inst_sigs{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_node_name}";
1003
              }
1004
            }
1005
         else
1006
            {
1007
            $inst_sigs{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_node_name}";
1008
            }
1009
 
1010
         if   ($t_depth >= 2 )      { $inst_ports{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_busref_name}_${t_abslog_name}" ;}
1011
         elsif($t_depth == 1 )      { $inst_ports{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_phy_name}";}
1012
 
1013
         if(  $inst_vector{"${t_instance}_${t_busref_name}_${t_index}"})
1014
            {
1015
            if(  $inst_vector{"${t_instance}_${t_busref_name}_${t_index}"} eq "scaler")
1016
              {$inst_vector{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_vector}";}
1017
            }
1018
         else
1019
            {$inst_vector{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_vector}";}
1020
 
1021
         unless(  $inst_left{"${t_instance}_${t_busref_name}_${t_index}"} eq '')
1022
            {
1023
            if(  $inst_left{"${t_instance}_${t_busref_name}_${t_index}"} eq "none")
1024
              {
1025
              $inst_left{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_left}";
1026
              }
1027
            elsif(  $inst_left{"${t_instance}_${t_busref_name}_${t_index}"} < ${t_left})
1028
              {
1029
              $inst_left{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_left}";
1030
              }
1031
            }
1032
          else
1033
            {
1034
            $inst_left{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_left}";
1035
            }
1036
 
1037
          unless(  $inst_right{"${t_instance}_${t_busref_name}_${t_index}"} eq '')
1038
            {
1039
            if(  $inst_right{"${t_instance}_${t_busref_name}_${t_index}"} eq "none")
1040
              {
1041
              $inst_right{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_right}";
1042
              }
1043
            elsif(  $inst_right{"${t_instance}_${t_busref_name}_${t_index}"} < ${t_right})
1044
              {
1045
              $inst_right{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_right}";
1046
              }
1047
            }
1048
          else {$inst_right{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_right}";}
1049
 
1050
        }
1051
      }
1052
     }
1053
 
1054
 
1055
     @inst_names = sys::lib::trim_sort(@inst_names);
1056
 
1057
     foreach $i_name (@inst_names)
1058
         {
1059
 
1060
 
1061
        unless($inst_Inames{$i_name} eq "none")
1062
         {
1063
         if($inst_vector{$i_name} eq "vector"  )
1064
           {
1065
 
1066
 
1067
 
1068
          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";
1069
          }
1070
        else
1071
          {
1072
          push @inst_conns ,":::$inst_Inames{$i_name}:::adhoc:::$inst_ports{$i_name}:::$inst_sigs{$i_name}:::scaler:::none:::none:::\n";
1073
 
1074
           }
1075
         }
1076
 
1077
         }
1078
 
1079
 
1080
 
1081
 
1082
 
1083
 
1084
 
1085
 
1086
 
1087
 
1088
 
1089
 
1090
 
1091
 
1092
 
1093
 
1094
 
1095
 
1096
 
1097
 
1098
 
1099
     #/**********************************************************************/
1100
     #/*                                                                    */
1101
     #/* Instantiate each component with parameters and port connections    */
1102
     #/*                                                                    */
1103
     #/* If the component doesn't have a instance name then this is skipped */
1104
     #/*                                                                    */
1105
     #/**********************************************************************/
1106
 
1107
     print "+-+";
1108
 
1109
     push @instantiations  , "////////////////////////////////////////////////////////////////\n";
1110
 
1111
     foreach  my   $i_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName"))
1112
        {
1113
        my($instance_name)       = $i_name ->findnodes('./text()')->to_literal ;
1114
        my($component_name)      = $i_name  ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
1115
        my($version_name)        = $i_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
1116
        my $variant_name   = "";
1117
        if($version_name)  {$variant_name = "${component_name}_${version_name}";}
1118
        else               {$variant_name = "${component_name}";}
1119
 
1120
        if($instance_name)
1121
          {
1122
          push @instantiations  , "$variant_name\n";
1123
 
1124
#     print "$instance_name \n";
1125
 
1126
          $first = 1;
1127
 
1128
          foreach  my   $i_parameter ($spirit_design_file->findnodes("//spirit:componentInstance[spirit:instanceName/text() = '$instance_name']/spirit:configurableElementValues/spirit:configurableElementValue/\@spirit:referenceId"))
1129
             {
1130
             my($foo_name)       = $i_parameter ->to_literal ;
1131
             my($foo_value)      = $i_parameter ->findnodes('../text()')->to_literal ;
1132
             if($first)
1133
               {
1134
               push @instantiations  , "#( .${foo_name} (${foo_value})";
1135
               $first = 0;
1136
               }
1137
             else  {push @instantiations  , ",\n   .${foo_name} (${foo_value})";}
1138
             }
1139
 
1140
             if($first == 0)  { push @instantiations  , ")\n";}
1141
             push @instantiations  , "$instance_name \n   (\n ";
1142
             $first = 1;
1143
              @per_inst = sys::lib::trim_sort(@inst_conns);
1144
 
1145
             foreach $line (@per_inst)
1146
                {
1147
                $_ = $line;
1148
 
1149
                if(/:::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::/)
1150
                  {
1151
                  my $z_instance_name           = $1;
1152
                  my $z_busRef_name   = $2;
1153
                  my $z_port_name           = $3;
1154
                  my $z_signal_name           = $4;
1155
                  my $z_vecscal           = $5;
1156
                  my $z_left           = $6;
1157
                  my $z_right           = $7;
1158
                  if($z_vecscal eq "vector")
1159
                    {
1160
                    if($z_left eq $z_right){$z_signal_name =  "${z_signal_name}[${z_left}]" ;}
1161
                    else    {$z_signal_name =  "${z_signal_name}[${z_left}:${z_right}]" ;}
1162
                    }
1163
                  if($instance_name eq  $z_instance_name )
1164
                    {
1165
                    if($first)
1166
                      {
1167
                      push @instantiations  ,          "  .${z_port_name}         (${z_signal_name})";
1168
                      $first =0;
1169
                      }
1170
                    else   {           push @instantiations  , ",\n   .${z_port_name}         (${z_signal_name})";}
1171
                    }
1172
                  }
1173
                }
1174
 
1175
     print ".";
1176
     push @instantiations  , ");\n\n";
1177
     }
1178
     }
1179
     }
1180
 
1181
 
1182
 
1183
 
1184
 
1185
 
1186
 
1187
#/*********************************************************************************************/
1188
#/                                                                                            */
1189
#/                                                                                            */
1190
#/                                                                                            */
1191
#/                                                                                            */
1192
#/                                                                                            */
1193
#/                                                                                            */
1194
#/*********************************************************************************************/
1195
 
1196
 
1197
 
1198
 
1199
sub parse_component_file
1200
   {
1201
   my @params     = @_;
1202
   my $spirit_component_file      = pop(@params);
1203
 
1204
 
1205
 
1206
 
1207
     #/**********************************************************************/
1208
     #/*                                                                    */
1209
     #/* Read each  busInterface and save master/slave direction            */
1210
     #/*                                                                    */
1211
     #/**********************************************************************/
1212
 
1213
     my @mas_slave;
1214
 
1215
     push @mas_slave  , "master";
1216
     push @mas_slave  , "slave";
1217
 
1218
     foreach $seek_type (@mas_slave)
1219
        {
1220
 
1221
         foreach my $bus_iface ($spirit_component_file->findnodes("//spirit:component/spirit:busInterfaces/spirit:busInterface/spirit:${seek_type}"))
1222
            {
1223
            my($mmm_cname)         = $bus_iface->findnodes('../spirit:name/text()')->to_literal ;
1224
            my($mmm_vendor)        = $bus_iface->findnodes('../spirit:abstractionType/@spirit:vendor')->to_literal ;
1225
            my($mmm_library)       = $bus_iface->findnodes('../spirit:abstractionType/@spirit:library')->to_literal ;
1226
            my($mmm_name)          = $bus_iface->findnodes('../spirit:abstractionType/@spirit:name')->to_literal ;
1227
            my($mmm_version)       = $bus_iface->findnodes('../spirit:abstractionType/@spirit:version')->to_literal ;
1228
 
1229
            foreach my $port_face ($spirit_component_file->findnodes('//spirit:component/spirit:busInterfaces/spirit:busInterface/spirit:portMaps/spirit:portMap/spirit:logicalPort'))
1230
               {
1231
               my($rrr_log_name)      = $port_face->findnodes('./spirit:name/text()')->to_literal ;
1232
               my($rrr_phy_name)      = $port_face->findnodes('../spirit:physicalPort/spirit:name/text()')->to_literal ;
1233
               my($rrr_type_name)     = $port_face->findnodes('../spirit:physicalPort/spirit:wireTypeDefs/spirit:wireTypeDef/spirit:typeName/text()')->to_literal ;
1234
               my($rrr_int_name)      = $port_face->findnodes('../../../spirit:name/text()')->to_literal ;
1235
               my($rrr_left_value)    = $port_face->findnodes('../spirit:physicalPort/spirit:wire/spirit:vector/spirit:left/text()')->to_literal ;
1236
               my($rrr_right_value)   = $port_face->findnodes('../spirit:physicalPort/spirit:wire/spirit:vector/spirit:right/text()')->to_literal ;
1237
 
1238
               unless ($rrr_type_name)  {$rrr_type_name = "wire";}
1239
 
1240
               if(   $mmm_cname  eq  $rrr_int_name )
1241
                 {
1242
 
1243
                 my $busdef_parser = XML::LibXML->new();
1244
                 my $spirit_abstractor_file    = $parser->parse_file(yp::lib::find_ipxact("spirit:abstractionDefinition",$mmm_vendor,$mmm_library,$mmm_name,$mmm_version));
1245
 
1246
                 foreach my $abstr_view ($spirit_abstractor_file->findnodes("//spirit:abstractionDefinition/spirit:ports/spirit:port/spirit:logicalName[text() = '$rrr_log_name']"))
1247
                    {
1248
                    my($sss_m_dir)         = $abstr_view->findnodes('../spirit:wire/spirit:onMaster/spirit:direction/text()')->to_literal ;
1249
                    my($sss_s_dir)         = $abstr_view->findnodes('../spirit:wire/spirit:onSlave/spirit:direction/text()')->to_literal ;
1250
 
1251
                    if    ($sss_m_dir eq "in")  { $sss_m_dir = "input";}
1252
                    elsif ($sss_m_dir eq "out") { $sss_m_dir = "output";}
1253
 
1254
                    if    ($sss_s_dir eq "in")  { $sss_s_dir = "input";}
1255
                    elsif ($sss_s_dir eq "out") { $sss_s_dir = "output";}
1256
 
1257
                    my $rrr_direction = "";
1258
 
1259
                    if( $seek_type eq "master") {        $rrr_direction = $sss_m_dir;}
1260
                    else                        {        $rrr_direction = $sss_s_dir;}
1261
 
1262
                    my $rrr_dir = "";
1263
                    if   ($rrr_direction  eq "in" )  {$rrr_dir = "input" ;}
1264
                    elsif($rrr_direction  eq "out" ) {$rrr_dir = "output" ;}
1265
                    else                             {$rrr_dir = $rrr_direction;     }
1266
 
1267
                    if($rrr_left_value)
1268
                        {
1269
                        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}:::";
1270
                        }
1271
                      else
1272
                        {
1273
                        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}:::";
1274
                        }
1275
                    }
1276
                 }
1277
               }
1278
        }
1279
     }
1280
 
1281
 
1282
 
1283
 
1284
     #/**********************************************************************/
1285
     #/*                                                                    */
1286
     #/* Read all ports and store into array                                */
1287
     #/*                                                                    */
1288
     #/**********************************************************************/
1289
 
1290
     foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:ports/spirit:port/spirit:name"))
1291
        {
1292
        my($port_name)       = $i_name ->findnodes('./text()')->to_literal ;
1293
        my($direction)       = $i_name ->findnodes('../spirit:wire/spirit:direction/text()')->to_literal ;
1294
        my($left)            = $i_name ->findnodes('../spirit:wire/spirit:vector/spirit:left/text()')->to_literal ;
1295
        my($right)           = $i_name ->findnodes('../spirit:wire/spirit:vector/spirit:right/text()')->to_literal ;
1296
        my($type)            = $i_name ->findnodes('../spirit:wireTypeDefs/spirit:wireTypeDef/spirit:typeName/text()')->to_literal ;
1297
 
1298
 
1299
        if    ($direction eq "in")  { $direction = "input";}
1300
        elsif ($direction eq "out") { $direction = "output";}
1301
 
1302
 
1303
        if($left)  { push @wire_decs , ":::${port_name}:::${port_name}:::${direction}:::${type}:::vector:::${left}:::${right}:::none:::0:::${port_name}:::XXX:::${port_name}:::";  }
1304
        else       { push @wire_decs , ":::${port_name}:::${port_name}:::${direction}:::${type}:::scaler:::none:::none:::none:::0:::${port_name}:::XXX:::${port_name}:::";          }
1305
        }
1306
 
1307
 
1308
 
1309
 
1310
}
1311
 
1312
 
1313
1
1314
 

powered by: WebSVN 2.1.0

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