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

Subversion Repositories socgen

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

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 131 jt_eaton
use Scalar::Util qw(looks_like_number);
55 119 jt_eaton
use XML::LibXML;
56
use lib './tools';
57
use sys::lib;
58
use yp::lib;
59 131 jt_eaton
use BerkeleyDB;
60 119 jt_eaton
 
61 131 jt_eaton
 
62 119 jt_eaton
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
63
 
64
 
65
############################################################################
66
### Process the options
67
############################################################################
68
Getopt::Long::config("require_order", "prefix=-");
69
GetOptions("h","help",
70 128 jt_eaton
           "envidentifier=s" => \$envidentifier,
71 119 jt_eaton
           "prefix=s" => \$prefix,
72
           "vendor=s" => \$vendor,
73 131 jt_eaton
           "library=s" => \$library,
74 119 jt_eaton
           "version=s" => \$version,
75
           "component=s" => \$component,
76
           "dest_dir=s" => \$dest_dir,
77
           "destination=s" => \$destination,
78
           "configuration=s" => \$configuration,
79 128 jt_eaton
           "autodoc=s"   => \$autodoc,
80 131 jt_eaton
           "fragment","no_port","local_parameters","tb","debug","verbose","interface_only","top"
81 119 jt_eaton
) || die "(use '$program_name -h' for help)";
82
 
83
 
84
##############################################################################
85
## Help option
86
##############################################################################
87
if ( $opt_h  or $opt_help  )
88 131 jt_eaton
  { print "\n gen_verilog -envidentifier {sim/syn}  -prefix /work -vendor vendor_name -library library_name  -component component_name  -version version_name -fragment -no_port -local_parameters -destination destination -configuration configuration -dest_dir  ../verilog  \n";
89 119 jt_eaton
    exit 1;
90
  }
91
 
92 131 jt_eaton
my $main_module_name = yp::lib::get_module_name($vendor,$library,$component,$version) ;
93 119 jt_eaton
 
94
#############################################################################
95
##
96
##
97
#############################################################################
98
 
99
$home = cwd();
100 130 jt_eaton
 
101 131 jt_eaton
 
102 119 jt_eaton
my $variant;
103 128 jt_eaton
my $view;
104
 
105
 
106
my $interface_in_count   =0;
107
my $interface_out_count  =0;
108
my $interface_in_size    =0;
109
my $interface_out_size   =0;
110
 
111 131 jt_eaton
if($version)       {$variant   = "${component}_${version}";}
112
else               {$variant   = "${component}";}
113 128 jt_eaton
 
114
unless($destination) { $destination = $variant;}
115
unless($autodoc)     { $autodoc     = "/Geda";}
116 119 jt_eaton
 
117 131 jt_eaton
print "\n GEN_verilog    -envidentifier $envidentifier -prefix  $prefix -vendor $vendor -library $library -component $component -version $version -configuration $configuration -dest_dir     $dest_dir -destination  $destination   \n";
118 120 jt_eaton
 
119 131 jt_eaton
my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$library,$component);
120
my $comp_xml_sep    = yp::lib::find_comp_xml_sep($vendor,$library,$component,$version);
121 120 jt_eaton
 
122 125 jt_eaton
my $parser = XML::LibXML->new();
123
 
124 131 jt_eaton
my $socgen_file              = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
125
my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$library,$component,$version));
126 128 jt_eaton
my $doc_library_path         = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:doc/socgen:library_path/text()")->to_literal;
127 125 jt_eaton
 
128 128 jt_eaton
 
129 130 jt_eaton
my $sim_library_path ;
130 128 jt_eaton
 
131 130 jt_eaton
my $sim_comp_path            = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:comp_path/text()")->to_literal;
132
 
133 131 jt_eaton
if ($sim_comp_path)  {$sim_library_path  ="${lib_comp_sep}${sim_comp_path}";}
134
else                 {$sim_library_path  = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:library_path/text()")->to_literal;}
135 130 jt_eaton
 
136 128 jt_eaton
foreach my $X_view ($spirit_component_file->findnodes('//spirit:component/spirit:model/spirit:views/spirit:view'))
137
         {
138
         my($Xview_name)   = $X_view->findnodes('./spirit:name/text()')->to_literal ;
139
         my($Xview_envidentifier)   = $X_view->findnodes('./spirit:envIdentifier/text()')->to_literal ;
140
 
141
 
142
         if($envidentifier eq $Xview_envidentifier )
143
              {
144
              $view = $Xview_name;
145
              }
146
         }
147
 
148
 
149 131 jt_eaton
my $path  = "${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/${dest_dir}";
150 125 jt_eaton
mkdir $path,0755             unless( -e $path );
151
 
152 131 jt_eaton
my $path  = "${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/${dest_dir}/${view}";
153 125 jt_eaton
mkdir $path,0755             unless( -e $path );
154
 
155
my   @filelist_hier     =       ();
156
my   @instantiations    =       ();
157
my   @parameters        =       ();
158
my   %parameter_values  =       ();
159 128 jt_eaton
my   %parameter_descriptions  = ();
160 125 jt_eaton
 
161 126 jt_eaton
 
162
 
163 131 jt_eaton
      unless ($socgen_file)      { print "No socgen ip file   \n";};
164 126 jt_eaton
 
165 131 jt_eaton
     #/******************************************************************************************/
166
     #/*                                                                                        */
167
     #/* if local parameters check for uplifts                                                  */
168
     #/*                                                                                        */
169
     #/******************************************************************************************/
170 121 jt_eaton
 
171 131 jt_eaton
    if($opt_local_parameters)
172
      {
173
#       print "XXX Reading local parameters \n";
174
       foreach  my   $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:syn/socgen:ise/socgen:chip/socgen:parameters/socgen:parameter"))
175
          {
176
          my($ise_param_value)       = $socgen_cfg ->findnodes('./socgen:value/text()')->to_literal ;
177
          my($ise_param_name)        = $socgen_cfg ->findnodes('./socgen:name/text()')->to_literal ;
178
          my($ise_new_version   )    = $socgen_cfg ->findnodes('../../socgen:version/text()')->to_literal ;
179
          if($variant eq "${component}_${ise_new_version}")
180
              {
181
#               print "XXXXXXX $ise_param_name  $ise_param_value           $ise_new_version     \n";
182
               unless(defined $parameter_values{$ise_param_name}) {push ( @parameters,  "$ise_param_name");};
183
               $parameter_values{$ise_param_name} = $ise_param_value;
184
              }
185
          }
186 121 jt_eaton
 
187
 
188 131 jt_eaton
 
189
     }
190 121 jt_eaton
 
191
 
192 124 jt_eaton
 
193 121 jt_eaton
 
194
 
195
 
196 131 jt_eaton
     #/******************************************************************************************/
197
     #/*                                                                                        */
198 124 jt_eaton
     #/* if configuration set then read parameters from socgen:componentConfiguration file      */
199 131 jt_eaton
     #/*                                                                                        */
200
     #/******************************************************************************************/
201 121 jt_eaton
 
202
    if($configuration)
203
      {
204
      # print "XXX Reading configuration   $configuration \n";
205
 
206 131 jt_eaton
 
207 128 jt_eaton
      foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:configurations/socgen:configuration/socgen:parameters/socgen:parameter/socgen:name"))
208 121 jt_eaton
                {
209
                my($param_name)         = $socgen_cfg->findnodes('./text()')->to_literal ;
210
                my($param_value)        = $socgen_cfg->findnodes('../socgen:value/text()')->to_literal ;
211
                my($config_name)        = $socgen_cfg->findnodes('../../../socgen:name/text()')->to_literal ;
212
                if($config_name eq $configuration  )
213
                  {
214 131 jt_eaton
                  unless(defined $parameter_values{$param_name})
215
                     {
216
                     push ( @parameters,  "$param_name");
217
                     $parameter_values{$param_name} = ${param_value};
218
                     }
219
 
220 121 jt_eaton
                  }
221
                }
222 131 jt_eaton
     }
223 121 jt_eaton
 
224
 
225 131 jt_eaton
    my @signals = yp::lib::get_signals($vendor,$library,$component,$version);
226
 
227 121 jt_eaton
 
228
 
229
 
230 131 jt_eaton
 
231
 
232
 
233
 
234
 
235
 
236 119 jt_eaton
#/**********************************************************************/
237
#/*                                                                    */
238
#/* Every hier cell is constructed from the ipxact file with seperate  */
239
#/* version  for each view                                             */
240
#/*                                                                    */
241
#/* Start by opening the output file                                   */
242
#/* get fileset name                                                   */
243
#/* check that requested view exists                                   */
244
#/*                                                                    */
245
#/**********************************************************************/
246
 
247 120 jt_eaton
foreach my $comp_view ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:name[text() = '$view']"             ))
248 119 jt_eaton
   {
249 120 jt_eaton
   my($view_fileset_name)  = $comp_view->findnodes('../spirit:fileSetRef/spirit:localName/text()')->to_literal ;
250 131 jt_eaton
   $outfile ="${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/${dest_dir}/${view}/${destination}";
251 120 jt_eaton
   open DEST_FILE,">$outfile" or die "unable to open $outfile";
252 131 jt_eaton
 
253 122 jt_eaton
   unless ($opt_fragment){     print DEST_FILE  "\n module \n\n  $main_module_name \n ";}
254 119 jt_eaton
 
255 120 jt_eaton
   #/*****************************************************************************/
256
   #/*  wire_decs array holds all port and signal declarations                   */
257
   #/*  :::name:::node_input_output:::wire_reg:::scaler_vector:::left:::right::: */
258
   #/*****************************************************************************/
259 119 jt_eaton
 
260 120 jt_eaton
   @wire_decs = (  );
261 119 jt_eaton
 
262
 
263 120 jt_eaton
   #/**********************************************************************/
264
   #/*  inst_conns holds all instance connections                         */
265
   #/**********************************************************************/
266 119 jt_eaton
 
267 120 jt_eaton
   @inst_conns = (  );
268 119 jt_eaton
 
269
 
270 131 jt_eaton
 
271 120 jt_eaton
   #  component file
272 126 jt_eaton
 
273 120 jt_eaton
   parse_component_file($spirit_component_file);
274 131 jt_eaton
   if($opt_verbose){print "parse design files \n"; }
275
   parse_design_files($spirit_component_file);
276
   if($opt_verbose){print "process design files \n"; }
277 120 jt_eaton
   process_design_files($spirit_component_file);
278 131 jt_eaton
   if($opt_verbose){print "process wire_decs \n"; }
279 119 jt_eaton
 
280 131 jt_eaton
 
281 120 jt_eaton
   #/**********************************************************************/
282
   #/*                                                                    */
283 131 jt_eaton
   #/* Add any and all global parameters with their default values        */
284 120 jt_eaton
   #/*                                                                    */
285
   #/**********************************************************************/
286 128 jt_eaton
 
287 131 jt_eaton
   unless ($opt_local_parameters)
288 119 jt_eaton
     {
289
     my $first = 1;
290
     foreach my $parameter_name (@parameters)
291
        {
292
        my $parameter_value = $parameter_values{$parameter_name};
293
        if($first)
294
          {
295
          print DEST_FILE  "   #( parameter \n      ${parameter_name}=${parameter_value}";
296
          $first=0;
297
          }
298
        else  { print DEST_FILE  ",\n      ${parameter_name}=${parameter_value}";}
299
        }
300
 
301
     if    ($first == 0)   { print DEST_FILE  ")\n"; }
302
       }
303
 
304
 
305 131 jt_eaton
   #/**********************************************************************/
306
   #/*                                                                    */
307
   #/* sort all  ports  with their type, size and direction               */
308
   #/*                                                                    */
309
   #/**********************************************************************/
310 119 jt_eaton
 
311 131 jt_eaton
   my @port_list  = ();
312
   my @wire_nodes = ();
313
   my $key;
314
   my $value;
315 119 jt_eaton
 
316 131 jt_eaton
   foreach my $signal (@signals)
317
         {
318
         ( ${port_name},${direction},${type},${vector},${left},${right}) = split ':', $signal;
319 119 jt_eaton
 
320 131 jt_eaton
            if(  $direction ne "node"   )
321
              {
322
              my $q_width  = "     ";
323
              if( ${vector} eq "vector" )  { $q_width = "[ ${left} :  ${right}]";             }
324
              push (@port_list,  "${direction}   ${type}    $q_width        ${port_name}");
325
              }
326
            else
327
              {
328
              my $q_width  = "     ";
329
              if( ${vector} eq "vector" )   { $q_width = "[ $left :  $right]";}
330
              if( $direction eq "node" )    { push @wire_nodes,     "$type     $q_width              ${port_name};";}
331
              }
332
         }
333 119 jt_eaton
 
334 131 jt_eaton
   @port_list      = sys::lib::trim_sort(@port_list);
335 119 jt_eaton
 
336 131 jt_eaton
   #/**********************************************************************/
337
   #/*                                                                    */
338
   #/* Now add all ports  with their type, size and direction             */
339
   #/*                                                                    */
340
   #/**********************************************************************/
341 119 jt_eaton
 
342 131 jt_eaton
   print DEST_FILE  "\n    ";
343
   $first = 1;
344 119 jt_eaton
 
345 131 jt_eaton
   foreach $port_line (@port_list)
346 119 jt_eaton
        {
347
          if($first)
348
            {
349
            print DEST_FILE  " (\n ${port_line}";
350
            $first=0;
351
            }
352
          else
353
            {
354
            print DEST_FILE  ",\n ${port_line}";
355
            }
356
 
357
        }
358
 
359 131 jt_eaton
   if    ($first == 0)   { print DEST_FILE  ");\n\n\n\n"; }
360
   elsif ($opt_no_port)  { print DEST_FILE  "\n\n\n\n";  }
361
   else                  { print DEST_FILE  "();\n\n\n\n";}
362 119 jt_eaton
 
363 121 jt_eaton
 
364 131 jt_eaton
   #/**********************************************************************/
365
   #/*                                                                    */
366
   #/* Add any and all local parameters with their default values         */
367
   #/*                                                                    */
368
   #/**********************************************************************/
369 121 jt_eaton
 
370 131 jt_eaton
   if ($opt_local_parameters)
371
     {
372 121 jt_eaton
     foreach my $parameter_name (@parameters)
373
        {
374 131 jt_eaton
        my $parameter_value = $parameter_values{${parameter_name}};
375
        print DEST_FILE  "parameter ${parameter_name} = ${parameter_value};\n";
376 121 jt_eaton
        }
377 131 jt_eaton
     }
378 121 jt_eaton
 
379 131 jt_eaton
   @wire_nodes      = sys::lib::trim_sort(@wire_nodes);
380 121 jt_eaton
 
381 131 jt_eaton
   unless ($opt_interface_only)
382 128 jt_eaton
     {
383 131 jt_eaton
     foreach my $wire_node (@wire_nodes)
384
       {
385
       print DEST_FILE  "${wire_node}\n";
386
       }
387 128 jt_eaton
 
388
 
389 121 jt_eaton
     #/**********************************************************************/
390
     #/*                                                                    */
391 131 jt_eaton
     #/* Dump everything from the ip-xact files into component              */
392 119 jt_eaton
     #/*                                                                    */
393
     #/**********************************************************************/
394
 
395
     print DEST_FILE  "\n\n\n";
396 120 jt_eaton
     while(   my $line_out      = shift(@instantiations))             {  print DEST_FILE  "$line_out";}
397 119 jt_eaton
 
398 128 jt_eaton
 
399 119 jt_eaton
     #/**********************************************************************/
400
     #/*                                                                    */
401
     #/* After all the data from the ip-xact file has been entered we now   */
402
     #/* insert any and all verilog fragments at the end before closing     */
403
     #/* the module                                                         */
404
     #/*                                                                    */
405
     #/**********************************************************************/
406
 
407
 
408
     foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:fileSets/spirit:fileSet/spirit:file/spirit:name"))
409
        {
410
        my($rtl_file)       = $i_name ->findnodes('./text()')->to_literal;
411 120 jt_eaton
        my($file_type)      = $i_name ->findnodes('../spirit:userFileType/text()')->to_literal;
412 119 jt_eaton
        my($view_file)      = $i_name ->findnodes('../../spirit:name/text()')->to_literal ;
413
 
414 120 jt_eaton
        if(($file_type eq "fragment")&& (($view_file eq $view_fileset_name)))
415 119 jt_eaton
          {
416 131 jt_eaton
          $SRCFILE ="${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/${rtl_file}";
417 119 jt_eaton
          open(SRCFILE) or die("Could not open src file.  $SRCFILE ");
418
          foreach $line ()
419
             {
420
             chomp($line);
421
             print DEST_FILE  "${line}\n";
422
             }
423
          }
424
        }
425 131 jt_eaton
     }
426 119 jt_eaton
     unless ($opt_fragment ) {print DEST_FILE  "\n\n\n  endmodule\n\n";}
427 120 jt_eaton
 
428 119 jt_eaton
   }
429
 
430
 
431
 
432
 
433
 
434
#/*********************************************************************************************/
435
#/                                                                                            */
436
#/                                                                                            */
437
#/                                                                                            */
438
#/                                                                                            */
439
#/*********************************************************************************************/
440
 
441
 
442
 
443
 
444
sub parse_busInterface
445
   {
446
   my @params     = @_;
447
   my $depth      = pop(@params);
448
   my $busref     = pop(@params);
449
   my $version    = pop(@params);
450
   my $component  = pop(@params);
451 131 jt_eaton
   my $library    = pop(@params);
452 119 jt_eaton
   my $vendor     = pop(@params);
453
 
454
   my $home = cwd();
455
 
456
   my @out_stack  = ();
457
 
458 131 jt_eaton
  if($opt_verbose){print "parse_busInterface $vendor $library $component $version \n"; }
459 119 jt_eaton
 
460
 
461 120 jt_eaton
 
462 119 jt_eaton
   my $busInterfaceTest = 0;
463
 
464 128 jt_eaton
 
465
 
466
 
467 131 jt_eaton
my  @filelist =       yp::lib::parse_component_brothers("$vendor","$library","$component","$version");
468 128 jt_eaton
 
469
foreach $line (@filelist)
470
   {
471
   $_ = $line;
472
   if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
473
     {
474 131 jt_eaton
     $new_library        = $2;
475 128 jt_eaton
     $new_component      = $3;
476
     $new_vendor         = $1;
477
     $new_version        = $4;
478
 
479 131 jt_eaton
#     print " FFFFFFFFFFFFFFFF  Brother      $new_vendor  $new_library  $new_component $new_version \n" ;
480 128 jt_eaton
 
481 131 jt_eaton
    my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_component,$new_version));
482 128 jt_eaton
 
483
 
484 119 jt_eaton
   my @mas_slave;
485
     push @mas_slave  , "master";
486
     push @mas_slave  , "slave";
487
 
488
     foreach my $seek_type (@mas_slave)
489
        {
490
 
491 131 jt_eaton
#print  "XXXXCX   Component $new_vendor $new_library $new_component $new_version  $seek_type \n";
492 119 jt_eaton
 
493
     foreach my $bus_iface ($spirit_component_file->findnodes("//spirit:component/spirit:busInterfaces/spirit:busInterface/spirit:${seek_type}"))
494
        {
495
        my($fff_cname)         = $bus_iface->findnodes('../spirit:name/text()')->to_literal ;
496
        my($fff_vendor)        = $bus_iface->findnodes('../spirit:abstractionType/@spirit:vendor')->to_literal ;
497
        my($fff_library)       = $bus_iface->findnodes('../spirit:abstractionType/@spirit:library')->to_literal ;
498
        my($fff_name)          = $bus_iface->findnodes('../spirit:abstractionType/@spirit:name')->to_literal ;
499
        my($fff_version)       = $bus_iface->findnodes('../spirit:abstractionType/@spirit:version')->to_literal ;
500
 
501
 
502 131 jt_eaton
       if( $busref eq   $fff_cname )
503
         {
504
        my $absDef_filename = yp::lib::get_absDef_db_filename($fff_vendor,$fff_library,$fff_name,$fff_version);
505
        $absDef_db   = new BerkeleyDB::Hash( -Filename => $absDef_filename, -Flags => DB_CREATE ) or die "Cannot open ${absDef_filename}: $!";
506
 
507
 
508 119 jt_eaton
        foreach my $port_face ($spirit_component_file->findnodes('//spirit:component/spirit:busInterfaces/spirit:busInterface/spirit:portMaps/spirit:portMap/spirit:logicalPort'))
509
           {
510
           my($fff_log_name)      = $port_face->findnodes('./spirit:name/text()')->to_literal ;
511 131 jt_eaton
           my($fff_int_name)      = $port_face->findnodes('../../../spirit:name/text()')->to_literal ;
512 119 jt_eaton
           my($fff_phy_name)      = $port_face->findnodes('../spirit:physicalPort/spirit:name/text()')->to_literal ;
513
           my($fff_type_name)     = $port_face->findnodes('../spirit:physicalPort/spirit:wireTypeDefs/spirit:wireTypeDef/spirit:typeName/text()')->to_literal ;
514
           my($fff_left_value)    = $port_face->findnodes('../spirit:physicalPort/spirit:wire/spirit:vector/spirit:left/text()')->to_literal ;
515
           my($fff_right_value)   = $port_face->findnodes('../spirit:physicalPort/spirit:wire/spirit:vector/spirit:right/text()')->to_literal ;
516
 
517
           unless ($fff_type_name)  {$fff_type_name = "wire";};
518
 
519 131 jt_eaton
 
520
 
521
           my $abs_data;
522
           $absDef_db->db_get("${seek_type}__${fff_log_name}", $abs_data );
523
 
524
           ( $berk_name, $berk_presence,$berk_width,$fff_direction ) = split ':', $abs_data;
525
 
526
           if(  ( $fff_int_name  eq  $busref)     )
527 119 jt_eaton
             {
528
             $busInterfaceTest = 1;
529 131 jt_eaton
#             print "XXXCXX $fff_log_name $seek_type  $fff_direction  \n";
530 125 jt_eaton
 
531 131 jt_eaton
                  if($fff_left_value ne "")
532
                    { push @out_stack, ":::${depth}:::${fff_log_name}:::${fff_phy_name}:::${fff_direction}:::${fff_type_name}:::vector:::${fff_left_value}:::${$fff_right_value}:::"; }
533
                  else
534
                    { push @out_stack, ":::${depth}:::${fff_log_name}:::${fff_phy_name}:::${fff_direction}:::${fff_type_name}:::scaler:::none:::none:::";    }
535
 
536 125 jt_eaton
 
537 131 jt_eaton
             }
538 125 jt_eaton
 
539 131 jt_eaton
           }
540 125 jt_eaton
 
541 131 jt_eaton
#       print "XXXCXX CLOSE  ${fff_vendor}_${fff_library}_${fff_name}_${fff_version}  \n";
542 125 jt_eaton
 
543
 
544 119 jt_eaton
 
545
 
546
 
547
 
548 131 jt_eaton
       $absDef_db->db_close();
549 119 jt_eaton
 
550 131 jt_eaton
      }
551 119 jt_eaton
 
552
 
553
 
554
 
555
 
556 131 jt_eaton
 
557
       }
558
 
559 119 jt_eaton
}
560
 
561
 
562 128 jt_eaton
}
563 119 jt_eaton
 
564 128 jt_eaton
}
565 119 jt_eaton
 
566
 
567
       if ( $busInterfaceTest){
568
                              @out_stack      = sys::lib::trim_sort(@out_stack);
569
                              return(@out_stack);
570
                              }
571
 
572
 
573 131 jt_eaton
     my @spirit_design_files       = yp::lib::find_ipxact_design_files($vendor,$library,$component,$version);
574 120 jt_eaton
 
575
     foreach  my   $sd_file (@spirit_design_files)
576 119 jt_eaton
     {
577
 
578 125 jt_eaton
     $_ = $sd_file;
579
        if(/:::(\S+):::(\S+):::(\S+):::(\S+):::/)
580
          {
581
          $q_vendor            = $1;
582
          $q_library           = $2;
583
          $q_design            = $3;
584
          $q_version           = $4;
585 130 jt_eaton
          $sd_file             = $parser->parse_file(yp::lib::find_ipxact_design($q_vendor,$q_library,$q_design,$q_version));
586 125 jt_eaton
          }
587 120 jt_eaton
 
588
     foreach  my   $x_name ($sd_file->findnodes('//spirit:hierConnections/spirit:hierConnection/@spirit:interfaceRef'))
589 119 jt_eaton
        {
590
        my($hierConn_name)                   = $x_name ->to_literal ;
591
        my($hierConn_comref_name)            = $x_name ->findnodes('../spirit:interface/@spirit:componentRef')->to_literal ;
592
        my($hierConn_busref_name)            = $x_name ->findnodes('../spirit:interface/@spirit:busRef')->to_literal ;
593
        if($busref eq  $hierConn_name)
594
          {
595 120 jt_eaton
          foreach  my   $x_name ($sd_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName[text() = '$hierConn_comref_name']"))
596 119 jt_eaton
            {
597
            #/**********************************************************************/
598
            #/*                                                                    */
599
            #/* Lookup VLNV for each instantiated component                        */
600
            #/*                                                                    */
601
            #/**********************************************************************/
602
 
603
            my($vendor_name)         = $x_name  ->findnodes('../spirit:componentRef/@spirit:vendor')->to_literal ;
604
            my($library_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:library')->to_literal ;
605
            my($component_name)      = $x_name  ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
606
            my($version_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
607
            $depth = $depth +1;
608 131 jt_eaton
            if($depth eq "3") {$depth = 2;}
609 119 jt_eaton
            @out_stack = parse_busInterface ($vendor_name, $library_name,$component_name,$version_name,$hierConn_busref_name,$depth );
610
            }
611
          }
612
        }
613 120 jt_eaton
 
614
     }
615
 
616 119 jt_eaton
        @out_stack      = sys::lib::trim_sort(@out_stack);
617
        return(@out_stack);
618 120 jt_eaton
 
619 119 jt_eaton
 
620
   }
621
 
622
 
623
 
624
 
625 120 jt_eaton
 
626
 
627
 
628
 
629
 
630
 
631
 
632
 
633
 
634
 
635 119 jt_eaton
#/*********************************************************************************************/
636
#/                                                                                            */
637
#/                                                                                            */
638
#/                                                                                            */
639
#/                                                                                            */
640
#/                                                                                            */
641
#/                                                                                            */
642
#/*********************************************************************************************/
643
 
644
 
645
 
646
 
647 120 jt_eaton
sub parse_design_files
648
   {
649
   my @params     = @_;
650
   my $spirit_component_file      = pop(@params);
651
 
652 125 jt_eaton
 
653
 
654
 
655
  foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
656 120 jt_eaton
    {
657 125 jt_eaton
            my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
658
            my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
659
            my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
660
            my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
661 130 jt_eaton
            parse_design_files($parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version )) );
662 125 jt_eaton
   }
663 120 jt_eaton
 
664
 
665 125 jt_eaton
 
666
 
667 120 jt_eaton
  foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:hierarchyRef"))
668
    {
669
            my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
670
            my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
671
            my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
672
            my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
673 130 jt_eaton
            if(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version ))
674
              {
675
              parse_design_file($parser->parse_file(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version )) );
676
              }
677 120 jt_eaton
  }
678
 
679
}
680
 
681
 
682
 
683
 
684
 
685
 
686
 
687
#/*********************************************************************************************/
688
#/                                                                                            */
689
#/                                                                                            */
690
#/                                                                                            */
691
#/                                                                                            */
692
#/                                                                                            */
693
#/                                                                                            */
694
#/*********************************************************************************************/
695
 
696
 
697
 
698
 
699
sub process_design_files
700
   {
701
   my @params     = @_;
702
   my $spirit_component_file      = pop(@params);
703
 
704 126 jt_eaton
   #print "\n";
705 125 jt_eaton
 
706
 
707
 
708
 
709
 
710
 
711
 
712
  foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
713 120 jt_eaton
    {
714 125 jt_eaton
            my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
715
            my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
716
            my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
717
            my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
718 130 jt_eaton
            process_design_files($parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version )) );
719 120 jt_eaton
    }
720
 
721
 
722 125 jt_eaton
 
723
 
724
 
725
 
726 120 jt_eaton
  foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:hierarchyRef"))
727
    {
728
            my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
729
            my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
730
            my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
731
            my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
732 130 jt_eaton
            if( yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version )  )
733
              {
734
              if($opt_verbose){print "process_design_file  $new_vendor $new_library $new_name $new_version  \n"; }
735
              process_design_file($parser->parse_file(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version )) );
736
              }
737
    }
738 120 jt_eaton
 
739
}
740
 
741
 
742
 
743
 
744
 
745
 
746
 
747
 
748
 
749
 
750
#/*********************************************************************************************/
751
#/                                                                                            */
752
#/                                                                                            */
753
#/                                                                                            */
754
#/                                                                                            */
755
#/                                                                                            */
756
#/                                                                                            */
757
#/*********************************************************************************************/
758
 
759
 
760
 
761
 
762 119 jt_eaton
sub parse_design_file
763
   {
764
   my @params     = @_;
765
   my $spirit_design_file      = pop(@params);
766
 
767
 
768
 
769
 
770 120 jt_eaton
 
771 126 jt_eaton
#print "\n";
772 120 jt_eaton
foreach my $new_comp ($spirit_design_file->findnodes("//spirit:design/spirit:vendor"))
773
   {
774
   my($new_vendor)          = $new_comp->findnodes('./text()')->to_literal ;
775
   my($new_library)         = $new_comp->findnodes('../spirit:library/text()')->to_literal ;
776
   my($new_name)            = $new_comp->findnodes('../spirit:name/text()')->to_literal ;
777
   my($new_version)         = $new_comp->findnodes('../spirit:version/text()')->to_literal ;
778 126 jt_eaton
   #print "WARNING  $new_vendor $new_library $new_name $new_version  DESIGN \n";
779 120 jt_eaton
   }
780
 
781
 
782
 
783
 
784 126 jt_eaton
     #/**********************************************************************/
785
     #/*                                                                    */
786
     #/* Add all internal wires and regs with their sizes                   */
787
     #/*                                                                    */
788
     #/**********************************************************************/
789
 
790 120 jt_eaton
 
791
 
792 126 jt_eaton
 
793
 
794
 
795
 
796
 
797
 
798
 
799 119 jt_eaton
     #/**********************************************************************/
800
     #/*                                                                    */
801
     #/* Read each hierConnection and enter signals into wire_decs          */
802
     #/*                                                                    */
803
     #/**********************************************************************/
804
     foreach  my   $x_name ($spirit_design_file->findnodes('//spirit:hierConnections/spirit:hierConnection/@spirit:interfaceRef'))
805
        {
806
        my($hierConn_name)                   = $x_name ->to_literal ;
807
        my($hierConn_comref_name)            = $x_name ->findnodes('../spirit:interface/@spirit:componentRef')->to_literal ;
808
        my($hierConn_busref_name)            = $x_name ->findnodes('../spirit:interface/@spirit:busRef')->to_literal ;
809
 
810
        foreach  my   $x_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName"))
811
           {
812
           #/**********************************************************************/
813
           #/*                                                                    */
814
           #/* Lookup VLNV for each instantiated component                        */
815
           #/*                                                                    */
816
           #/**********************************************************************/
817
 
818
           my($instance_name)       = $x_name ->findnodes('./text()')->to_literal ;
819 131 jt_eaton
           my($vendor_name)         = $x_name  ->findnodes('../spirit:componentRef/@spirit:vendor')->to_literal ;
820
           my($library_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:library')->to_literal ;
821
           my($component_name)      = $x_name  ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
822
           my($version_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
823 119 jt_eaton
 
824
           if( "$instance_name" eq  "$hierConn_comref_name"     )
825
             {
826
 
827 131 jt_eaton
 
828
           my @busses = yp::lib::get_busses($vendor_name,$library_name,$component_name,$version_name);
829
 
830
           foreach $line (@busses)
831
            {
832
 
833
             my $x_name;
834
             my $depth;
835
             my $busref;
836
             my $conn;
837
             my $phy_name;
838
             my $log_name;
839
             my $direction;
840
             my $type;
841
             my $vector;
842
             my $left;
843
             my $right;
844
 
845
 
846
          ( ${busref},${conn},${phy_name},${log_name},${direction},${type},${vector},${left},${right}) = split ':::', $line;
847
 
848
           if(${busref} eq ${hierConn_busref_name}    )
849
             {
850
 
851
            if("${hierConn_name}_${log_name}" eq  ${phy_name})
852
 
853
              {
854
              $depth = 2;
855
              $x_name = $conn;
856
              }
857
            else
858
 
859
              {
860
              $depth = 1;
861
              $x_name = $phy_name;
862
              }
863
 
864
 
865
#          print "QQQQQQQQD:::${phy_name}:::${phy_name}:::${direction}:::${type}:::${vector}:::${left}:::${right}:::${hierConn_comref_name}:::3:::${log_name}:::${busref}:::${conn}:::   \n";
866
 
867
#          print "QQQQQQQQF:::${hierConn_name}_${log_name}:::${hierConn_name}_${log_name}:::${direction}:::wire:::${vector}:::${left}:::${right}:::${hierConn_comref_name}:::${depth}:::${x_name}:::${hierConn_busref_name}:::${log_name}:::   \n";
868
 
869
 
870
                  push  @wire_decs,":::${hierConn_name}_${log_name}:::${hierConn_name}_${log_name}:::${direction}:::wire:::${vector}:::${left}:::${right}:::${hierConn_comref_name}:::${depth}:::${x_name}:::${hierConn_busref_name}:::${log_name}:::";
871
 
872 119 jt_eaton
             }
873 131 jt_eaton
            }
874
 
875
 
876
 
877
 
878
 
879
             }
880 119 jt_eaton
           }
881
        }
882
 
883
 
884
 
885
 
886
 
887
     #/**************************************************************************/
888
     #/*                                                                        */
889
     #/* Read each  interconnection and enter sub signals into wire_decs        */
890
     #/*                                                                        */
891
     #/**************************************************************************/
892
 
893
 
894
 
895
 
896
     foreach  my   $x_name ($spirit_design_file->findnodes('//spirit:interconnections/spirit:interconnection/spirit:activeInterface/@spirit:componentRef'))
897
        {
898
        my($hierConn_comref_name)            = $x_name ->to_literal;
899
        my($hierConn_busref_name)            = $x_name ->findnodes('../@spirit:busRef')->to_literal ;
900
        my($hierConn_name)                   = $x_name ->findnodes('../../spirit:name/text()')->to_literal ;
901
 
902
        foreach  my   $x_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName"))
903
           {
904
           #/**********************************************************************/
905
           #/*                                                                    */
906
           #/* Lookup VLNV for each instantiated component                        */
907
           #/*                                                                    */
908
           #/**********************************************************************/
909
 
910
           my($instance_name)       = $x_name ->findnodes('./text()')->to_literal ;
911
           my($vendor_name)         = $x_name  ->findnodes('../spirit:componentRef/@spirit:vendor')->to_literal ;
912
           my($library_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:library')->to_literal ;
913
           my($component_name)      = $x_name  ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
914
           my($version_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
915
 
916
           if( "$instance_name" eq  "$hierConn_comref_name"     )
917
             {
918 131 jt_eaton
             my @busses = yp::lib::get_busses($vendor_name,$library_name,$component_name,$version_name);
919 119 jt_eaton
 
920 131 jt_eaton
              foreach $line (@busses)
921
               {
922
#            print "YTYTYT  $line \n";
923
               my $x_name;
924
               my $depth;
925
               my $busref;
926
               my $conn;
927
               my $phy_name;
928
               my $log_name;
929
               my $direction;
930
               my $type;
931
               my $vector;
932
               my $left;
933
               my $right;
934 119 jt_eaton
 
935
 
936 131 jt_eaton
               ( ${busref},${conn},${phy_name},${log_name},${direction},${type},${vector},${left},${right}) = split ':::', $line;
937 119 jt_eaton
 
938 131 jt_eaton
               if(${busref} eq ${hierConn_busref_name}    )
939
                 {
940 119 jt_eaton
 
941 131 jt_eaton
                 if("${hierConn_name}_${log_name}" eq  ${phy_name})
942 119 jt_eaton
 
943 131 jt_eaton
                   {
944
                   $depth = 2;
945
                   $x_name = $conn;
946
                   }
947
                 else
948
                   {
949
                   $depth = 1;
950
                   $x_name = $phy_name;
951
                   }
952
                 push  @wire_decs,":::${hierConn_name}_${log_name}:::${hierConn_name}_${log_name}:::node:::wire:::${vector}:::${left}:::${right}:::${hierConn_comref_name}:::${depth}:::${x_name}:::${hierConn_busref_name}:::${log_name}:::";
953 119 jt_eaton
 
954 131 jt_eaton
                 }
955
             }
956
 
957 119 jt_eaton
             }
958
           }
959
        }
960
 
961
 
962
 
963
     #/*******************************************************************************/
964
     #/*                                                                             */
965
     #/* Read each  interconnection and enter modified signals into wire_decs        */
966
     #/*                                                                             */
967
     #/*******************************************************************************/
968
 
969
 
970
 
971
 
972
 
973
        foreach  my  $k_name ($spirit_design_file->findnodes('//spirit:interconnections/spirit:interconnection/spirit:activeInterface/spirit:portMaps/spirit:portMap/spirit:logicalPort/spirit:name'))
974
           {
975
           my($lp_name)                = $k_name ->to_literal;
976
           my($lp_pname)               = $k_name ->findnodes('../../spirit:physicalPort/spirit:name/text()')->to_literal ;
977
           my($lp_left)                = $k_name ->findnodes('../../spirit:physicalPort/spirit:wire/spirit:vector/spirit:left/text()')->to_literal ;
978
           my($lp_right)               = $k_name ->findnodes('../../spirit:physicalPort/spirit:wire/spirit:vector/spirit:right/text()')->to_literal ;
979
           my($lp_componentref_name)   = $k_name ->findnodes('../../../../@spirit:componentRef')->to_literal ;
980
           my($lp_busref_name)         = $k_name ->findnodes('../../../../@spirit:busRef')->to_literal ;
981
           my($lp_interconnect_name)   = $k_name ->findnodes('../../../../../spirit:name/text()')->to_literal ;
982
 
983
 
984
           if ( $lp_pname eq '' ) { $lp_pname ="${lp_interconnect_name}_${lp_name}";}
985
           if ( $lp_left  eq '' ) { $lp_left ="none";}
986
           if ( $lp_right eq '' ) { $lp_right ="none";}
987
 
988
 
989
 
990
          if ( $lp_left  eq 'none' )
991
          {
992
           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}:::";
993
          }
994
          else
995
          {
996
           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}:::";
997
          }
998
           }
999
 
1000
 
1001
 
1002
 
1003
 
1004
 
1005
 
1006
 
1007
     #/**********************************************************************/
1008
     #/*                                                                    */
1009
     #/* Read all adHocConnections and load instance connect info into array*/
1010
     #/*                                                                    */
1011
     #/**********************************************************************/
1012
 
1013
 
1014
     foreach  my   $i_xame ($spirit_design_file->findnodes('//spirit:adHocConnections/spirit:adHocConnection/spirit:internalPortReference/@spirit:componentRef'))
1015
        {
1016
        my($comp_name)    = $i_xame ->to_literal;
1017
        my($int_value)    = $i_xame ->findnodes('../../spirit:name/text()')->to_literal ;
1018 126 jt_eaton
        my($tied_value)   = $i_xame ->findnodes('../../@spirit:tiedValue')->to_literal ;
1019 119 jt_eaton
        my($int_name)     = $i_xame ->findnodes('../@spirit:portRef')->to_literal ;
1020 126 jt_eaton
        my($vec_name)     = $i_xame ->findnodes('../../spirit:externalPortReference/@spirit:portRef')->to_literal ;
1021
        my($vec_left)     = $i_xame ->findnodes('../../spirit:externalPortReference/@spirit:left')->to_literal ;
1022
        my($vec_right)    = $i_xame ->findnodes('../../spirit:externalPortReference/@spirit:right')->to_literal ;
1023 124 jt_eaton
 
1024
 
1025 126 jt_eaton
# print "XXXXXX  $comp_name  $int_name  ( $int_value  $tied_value  )   $vec_name $vec_left $vec_right  \n";
1026 124 jt_eaton
 
1027 126 jt_eaton
 
1028
        unless ($int_value)
1029
         {$int_value = "_DUMMY_";
1030
         }
1031
 
1032
 
1033
        if($tied_value )
1034
          {
1035
          push @inst_conns , ":::${comp_name}:::adhoc:::${int_name}:::${tied_value}:::scaler:::none:::none:::";
1036
          }
1037
        elsif($vec_left ne "")
1038 119 jt_eaton
          {
1039
          push @inst_conns , ":::${comp_name}:::adhoc:::${int_name}:::${int_value}:::vector:::${vec_left}:::${vec_right}:::";
1040 131 jt_eaton
 
1041 119 jt_eaton
          }
1042
        else
1043
          {
1044
          push @inst_conns , ":::${comp_name}:::adhoc:::${int_name}:::${int_value}:::scaler:::none:::none:::";
1045
          }
1046 126 jt_eaton
 
1047
 
1048 119 jt_eaton
        }
1049
 
1050
 
1051
 
1052
 
1053
 
1054
 
1055
 
1056
 
1057
 
1058
 
1059 126 jt_eaton
 
1060
 
1061 119 jt_eaton
 
1062
 
1063
 
1064
 
1065
 
1066
 
1067
 
1068
     #/**********************************************************************/
1069
     #/*                                                                    */
1070
     #/* extract bus instance connections from wire_decs                    */
1071
     #/*                                                                    */
1072
     #/**********************************************************************/
1073
 
1074 126 jt_eaton
     #print "+-+";
1075 119 jt_eaton
 
1076
 
1077
 
1078
     my @inst_names  = ();
1079
     my @inst_Inames  = ();
1080
     my %inst_ports  = ();
1081
     my %inst_sigs   = ();
1082
     my %inst_vector = ();
1083
     my %inst_left   = ();
1084
     my %inst_right  = ();
1085
 
1086
 
1087
     foreach $line (@wire_decs)
1088
        {
1089
        $_ = $line;
1090 128 jt_eaton
 
1091 131 jt_eaton
#       print  "WD   $line  \n";
1092 128 jt_eaton
 
1093 131 jt_eaton
 
1094 119 jt_eaton
        if(/:::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::/)
1095
          {
1096
          my $t_index               = $1;
1097
          my $t_node_name           = $2;
1098
          my $t_direction           = $3;
1099
          my $t_type                = $4;
1100
          my $t_vector              = $5;
1101
          my $t_left                = $6;
1102
          my $t_right               = $7;
1103
          my $t_instance            = $8;
1104
          my $t_depth               = $9;
1105
          my $t_phy_name            = $10;
1106
          my $t_busref_name         = $11;
1107
          my $t_abslog_name         = $12;
1108
 
1109
         push ( @inst_names, "${t_instance}_${t_busref_name}_${t_index}");
1110
 
1111
         $inst_Inames{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_instance}";
1112
 
1113
         if(  $inst_sigs{"${t_instance}_${t_busref_name}_${t_index}"})
1114
            {
1115
            if(  $inst_sigs{"${t_instance}_${t_busref_name}_${t_index}"} eq ${t_index})
1116
              {
1117
              $inst_sigs{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_node_name}";
1118
              }
1119
            }
1120
         else
1121
            {
1122
            $inst_sigs{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_node_name}";
1123
            }
1124
 
1125
         if   ($t_depth >= 2 )      { $inst_ports{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_busref_name}_${t_abslog_name}" ;}
1126
         elsif($t_depth == 1 )      { $inst_ports{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_phy_name}";}
1127
 
1128
         if(  $inst_vector{"${t_instance}_${t_busref_name}_${t_index}"})
1129
            {
1130
            if(  $inst_vector{"${t_instance}_${t_busref_name}_${t_index}"} eq "scaler")
1131
              {$inst_vector{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_vector}";}
1132
            }
1133
         else
1134
            {$inst_vector{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_vector}";}
1135
 
1136 131 jt_eaton
 
1137
 
1138
 
1139 119 jt_eaton
         unless(  $inst_left{"${t_instance}_${t_busref_name}_${t_index}"} eq '')
1140
            {
1141 131 jt_eaton
 
1142
 
1143
 
1144 119 jt_eaton
            if(  $inst_left{"${t_instance}_${t_busref_name}_${t_index}"} eq "none")
1145
              {
1146
              $inst_left{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_left}";
1147
              }
1148
            elsif(  $inst_left{"${t_instance}_${t_busref_name}_${t_index}"} < ${t_left})
1149
              {
1150
              $inst_left{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_left}";
1151
              }
1152
            }
1153
          else
1154
            {
1155
            $inst_left{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_left}";
1156
            }
1157
 
1158 131 jt_eaton
 
1159
 
1160
 
1161
 
1162 119 jt_eaton
          unless(  $inst_right{"${t_instance}_${t_busref_name}_${t_index}"} eq '')
1163
            {
1164
            if(  $inst_right{"${t_instance}_${t_busref_name}_${t_index}"} eq "none")
1165
              {
1166
              $inst_right{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_right}";
1167
              }
1168
            elsif(  $inst_right{"${t_instance}_${t_busref_name}_${t_index}"} < ${t_right})
1169
              {
1170
              $inst_right{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_right}";
1171
              }
1172
            }
1173
          else {$inst_right{"${t_instance}_${t_busref_name}_${t_index}"}  = "${t_right}";}
1174
 
1175 131 jt_eaton
 
1176 119 jt_eaton
      }
1177
     }
1178
     @inst_names = sys::lib::trim_sort(@inst_names);
1179
     foreach $i_name (@inst_names)
1180
         {
1181
        unless($inst_Inames{$i_name} eq "none")
1182
         {
1183
         if($inst_vector{$i_name} eq "vector"  )
1184
           {
1185 126 jt_eaton
          push @inst_conns ,":::$inst_Inames{$i_name}:::adhoc:::$inst_ports{$i_name}:::$inst_sigs{$i_name}:::vector:::$inst_left{$i_name}:::$inst_right{$i_name}:::";
1186 119 jt_eaton
          }
1187
        else
1188
          {
1189 126 jt_eaton
          push @inst_conns ,":::$inst_Inames{$i_name}:::adhoc:::$inst_ports{$i_name}:::$inst_sigs{$i_name}:::scaler:::none:::none:::";
1190 119 jt_eaton
 
1191
           }
1192
         }
1193
         }
1194 120 jt_eaton
     }
1195 119 jt_eaton
 
1196
 
1197
 
1198
 
1199
 
1200
 
1201
 
1202
 
1203
 
1204 120 jt_eaton
#/*********************************************************************************************/
1205
#/                                                                                            */
1206
#/                                                                                            */
1207
#/                                                                                            */
1208
#/                                                                                            */
1209
#/                                                                                            */
1210
#/                                                                                            */
1211
#/*********************************************************************************************/
1212 119 jt_eaton
 
1213
 
1214
 
1215
 
1216 120 jt_eaton
sub process_design_file
1217
   {
1218
   my @params     = @_;
1219
   my $spirit_design_file      = pop(@params);
1220 119 jt_eaton
 
1221
 
1222
 
1223
 
1224
 
1225 126 jt_eaton
#print "\n";
1226 120 jt_eaton
foreach my $new_comp ($spirit_design_file->findnodes("//spirit:design/spirit:vendor"))
1227
   {
1228
   my($new_vendor)          = $new_comp->findnodes('./text()')->to_literal ;
1229
   my($new_library)         = $new_comp->findnodes('../spirit:library/text()')->to_literal ;
1230
   my($new_name)            = $new_comp->findnodes('../spirit:name/text()')->to_literal ;
1231
   my($new_version)         = $new_comp->findnodes('../spirit:version/text()')->to_literal ;
1232
#   print "XXXXXX-  $new_vendor $new_library $new_name $new_version  DESIGN \n";
1233
   }
1234 119 jt_eaton
 
1235
 
1236
 
1237 126 jt_eaton
 
1238
 
1239 119 jt_eaton
     #/**********************************************************************/
1240
     #/*                                                                    */
1241
     #/* Instantiate each component with parameters and port connections    */
1242
     #/*                                                                    */
1243
     #/* If the component doesn't have a instance name then this is skipped */
1244
     #/*                                                                    */
1245
     #/**********************************************************************/
1246
 
1247 126 jt_eaton
     #print "+-+";
1248 119 jt_eaton
 
1249
     push @instantiations  , "////////////////////////////////////////////////////////////////\n";
1250
 
1251 126 jt_eaton
 
1252
     @inst_conns = sys::lib::trim_sort(@inst_conns);
1253
 
1254 131 jt_eaton
foreach $Iconn( @inst_conns)
1255
      {
1256
#       print  "IC   $Iconn  \n";
1257 126 jt_eaton
 
1258 131 jt_eaton
       }
1259 126 jt_eaton
 
1260
 
1261
 
1262 119 jt_eaton
     foreach  my   $i_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName"))
1263
        {
1264
        my($instance_name)       = $i_name ->findnodes('./text()')->to_literal ;
1265 122 jt_eaton
        my($vendor_name)         = $i_name  ->findnodes('../spirit:componentRef/@spirit:vendor')->to_literal ;
1266
        my($library_name)        = $i_name  ->findnodes('../spirit:componentRef/@spirit:library')->to_literal ;
1267 119 jt_eaton
        my($component_name)      = $i_name  ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
1268
        my($version_name)        = $i_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
1269
 
1270 122 jt_eaton
        my $module_name = yp::lib::get_module_name($vendor_name,$library_name,$component_name,$version_name) ;
1271
 
1272
 
1273 126 jt_eaton
 
1274
 
1275
 
1276
 
1277
 
1278 119 jt_eaton
        if($instance_name)
1279
          {
1280 122 jt_eaton
          push @instantiations  , "$module_name\n";
1281 119 jt_eaton
          $first = 1;
1282
 
1283
          foreach  my   $i_parameter ($spirit_design_file->findnodes("//spirit:componentInstance[spirit:instanceName/text() = '$instance_name']/spirit:configurableElementValues/spirit:configurableElementValue/\@spirit:referenceId"))
1284
             {
1285
             my($foo_name)       = $i_parameter ->to_literal ;
1286
             my($foo_value)      = $i_parameter ->findnodes('../text()')->to_literal ;
1287 124 jt_eaton
 
1288
 
1289
 
1290
 
1291 119 jt_eaton
             if($first)
1292
               {
1293
               push @instantiations  , "#( .${foo_name} (${foo_value})";
1294
               $first = 0;
1295
               }
1296
             else  {push @instantiations  , ",\n   .${foo_name} (${foo_value})";}
1297
             }
1298
 
1299
             if($first == 0)  { push @instantiations  , ")\n";}
1300
             push @instantiations  , "$instance_name \n   (\n ";
1301
             $first = 1;
1302
 
1303 126 jt_eaton
 
1304
 
1305
 
1306
             foreach $line (@inst_conns)
1307 119 jt_eaton
                {
1308
                $_ = $line;
1309
 
1310
                if(/:::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::(\S+):::/)
1311
                  {
1312
                  my $z_instance_name           = $1;
1313
                  my $z_busRef_name   = $2;
1314
                  my $z_port_name           = $3;
1315
                  my $z_signal_name           = $4;
1316
                  my $z_vecscal           = $5;
1317
                  my $z_left           = $6;
1318
                  my $z_right           = $7;
1319 126 jt_eaton
 
1320
                  if($opt_debug ){print  "YYYYYY--    $line  \n";}
1321
 
1322 119 jt_eaton
                  if($z_vecscal eq "vector")
1323
                    {
1324
                    if($z_left eq $z_right){$z_signal_name =  "${z_signal_name}[${z_left}]" ;}
1325
                    else    {$z_signal_name =  "${z_signal_name}[${z_left}:${z_right}]" ;}
1326
                    }
1327 124 jt_eaton
 
1328 131 jt_eaton
                  unless ($z_signal_name eq "_DUMMY_")
1329 124 jt_eaton
 
1330 131 jt_eaton
 
1331
                   {
1332
 
1333
 
1334
 
1335
 
1336
 
1337 119 jt_eaton
                  if($instance_name eq  $z_instance_name )
1338
                    {
1339
                    if($first)
1340
                      {
1341
                      push @instantiations  ,          "  .${z_port_name}         (${z_signal_name})";
1342
                      $first =0;
1343
                      }
1344
                    else   {           push @instantiations  , ",\n   .${z_port_name}         (${z_signal_name})";}
1345
                    }
1346 131 jt_eaton
 
1347
                    }
1348
 
1349
 
1350
 
1351 119 jt_eaton
                  }
1352
                }
1353
 
1354 126 jt_eaton
     #print ".";
1355 119 jt_eaton
     push @instantiations  , ");\n\n";
1356
     }
1357
     }
1358
     }
1359
 
1360
 
1361
 
1362
 
1363
 
1364
 
1365
 
1366 120 jt_eaton
 
1367
 
1368 119 jt_eaton
#/*********************************************************************************************/
1369
#/                                                                                            */
1370
#/                                                                                            */
1371
#/                                                                                            */
1372
#/                                                                                            */
1373
#/                                                                                            */
1374
#/                                                                                            */
1375
#/*********************************************************************************************/
1376
 
1377
 
1378
 
1379
 
1380
sub parse_component_file
1381
   {
1382
   my @params     = @_;
1383
   my $spirit_component_file      = pop(@params);
1384
 
1385
 
1386 126 jt_eaton
#print "\n";
1387 120 jt_eaton
foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:vendor"))
1388
   {
1389
   my($new_vendor)          = $new_comp->findnodes('./text()')->to_literal ;
1390
   my($new_library)         = $new_comp->findnodes('../spirit:library/text()')->to_literal ;
1391
   my($new_name)            = $new_comp->findnodes('../spirit:name/text()')->to_literal ;
1392
   my($new_version)         = $new_comp->findnodes('../spirit:version/text()')->to_literal ;
1393 126 jt_eaton
   if($opt_verbose){print "parse_component_file   $new_vendor $new_library $new_name $new_version  COMPONENT \n";}
1394 120 jt_eaton
   }
1395
 
1396
 
1397
 
1398
 
1399 121 jt_eaton
     #/**********************************************************************/
1400
     #/*                                                                    */
1401
     #/* parse parameters and values                                        */
1402
     #/*                                                                    */
1403
     #/**********************************************************************/
1404
 
1405
     foreach  my   $i_name ($spirit_component_file->findnodes('//spirit:model/spirit:modelParameters/spirit:modelParameter/spirit:name'))
1406
        {
1407
        my($parameter_name)     = $i_name ->to_literal;
1408
        my($parameter_default)  = $i_name ->findnodes('../spirit:value/text()')->to_literal ;
1409
 
1410
        unless(defined $parameter_values{$parameter_name})
1411
         {
1412
         push ( @parameters,  "$parameter_name");
1413 125 jt_eaton
         $parameter_values{$parameter_name} = ${parameter_default};
1414 128 jt_eaton
#         $parameter_descriptions{$parameter_name} = "Duhkkk";
1415
 
1416
 
1417
         foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:doc/socgen:parameters/socgen:parameter/socgen:name[text() = '$parameter_name']"))
1418
             {
1419
             my($param_description)        = $socgen_cfg->findnodes('../socgen:description/text()')->to_literal ;
1420
             $parameter_descriptions{$parameter_name} = $param_description ;
1421
             }
1422
 
1423
 
1424
 
1425 125 jt_eaton
         };
1426 121 jt_eaton
 
1427
        }
1428
 
1429
 
1430
 
1431
 
1432
 
1433
 
1434
 
1435 125 jt_eaton
foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
1436 120 jt_eaton
   {
1437 125 jt_eaton
    my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
1438
    my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
1439
    my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
1440
    my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
1441 130 jt_eaton
    if(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version))
1442 120 jt_eaton
     {
1443 130 jt_eaton
     parse_component_file($parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version))    );
1444 120 jt_eaton
     }
1445
 
1446 125 jt_eaton
   }
1447 120 jt_eaton
 
1448
 
1449
 
1450
 
1451
 
1452 119 jt_eaton
 
1453
 
1454
 
1455
 
1456
 
1457
 
1458
 
1459
}
1460
 
1461
 
1462
1
1463
 

powered by: WebSVN 2.1.0

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