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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [yp/] [lib.pm] - Diff between revs 124 and 125

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 124 Rev 125
Line 91... Line 91...
 
 
 
 
 
 
 
 
 
 
#/*****************************************************************************************************/
 
#/  find_ipxact_design_files                                                                          */
 
#/                                                                                                    */
 
#/  returns parser tokens  to ip-xact design files referred to by component file vlnv                 */
 
#/                                                                                                    */
 
#/  my @spirit_design_files = yp::lib::find_ipxact_design_file($vendor,$library,$component,$version);  */
 
#/                                                                                                    */
 
#/*****************************************************************************************************/
 
 
 
sub find_ipxact_design_files
 
   {
 
   my @params     = @_;
 
   my $version    = pop(@params);
 
   my $component  = pop(@params);
 
   my $project    = pop(@params);
 
   my $vendor     = pop(@params);
 
 
 
 
 
   my $card_type;
 
   my $card_file_name;
 
   my $card_dir_name;
 
   my $card_vendor;
 
   my $card_library;
 
   my $card_component;
 
   my $card_version;
 
 
 
   my @design_files = ();
 
 
 
   my $parser           = XML::LibXML->new();
 
   my $yp_index_file    = $parser->parse_file("./tools/yp/hier_index.xml");
 
 
 
   unless (yp::lib::find_ipxact("spirit:component",$vendor,$project,$component,$version)){print "Missing Component  $vendor, $project, $component, $version \n";  }
 
 
 
   my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$vendor,$project,$component,$version));
 
 
 
   foreach my $comp_view ($spirit_component_file->findnodes('//spirit:component/spirit:model/spirit:views/spirit:view'))
 
      {
 
      my($hier_ref_vendor)         = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:vendor')->to_literal ;
 
      my($hier_ref_library)        = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:library')->to_literal ;
 
      my($hier_ref_component)      = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:name')->to_literal ;
 
      my($hier_ref_version)        = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:version')->to_literal ;
 
 
 
 
 
 
 
      if(yp::lib::find_ipxact("spirit:designConfiguration",$hier_ref_vendor,$hier_ref_library,$hier_ref_component,$hier_ref_version ))
 
      {
 
 
 
      my $spirit_designCfg_file
 
       = $parser->parse_file(yp::lib::find_ipxact("spirit:designConfiguration",$hier_ref_vendor,$hier_ref_library,$hier_ref_component,$hier_ref_version ));
 
 
 
      foreach my $design_ref_view ($spirit_designCfg_file->findnodes('//spirit:designConfiguration'))
 
         {
 
         ($hier_ref_vendor)         = $design_ref_view->findnodes('./spirit:designRef/@spirit:vendor')->to_literal ;
 
         ($hier_ref_library)        = $design_ref_view->findnodes('./spirit:designRef/@spirit:library')->to_literal ;
 
         ($hier_ref_component)      = $design_ref_view->findnodes('./spirit:designRef/@spirit:name')->to_literal ;
 
         ($hier_ref_version)        = $design_ref_view->findnodes('./spirit:designRef/@spirit:version')->to_literal ;
 
 
 
 
 
         }
 
 
 
 
 
      }
 
 
 
 
 
 
 
 
 
         foreach  my   $index_card ($yp_index_file->findnodes("//socgen:file_types/socgen:file_type[socgen:name/text() = 'spirit:design']/socgen:vendors/socgen:vendor[socgen:name/text() = '$hier_ref_vendor']/socgen:libraries/socgen:library[socgen:name/text() = '$hier_ref_library']/socgen:components/socgen:component[socgen:name/text() = '$hier_ref_component']/socgen:versions/socgen:version[socgen:name/text() = '$hier_ref_version']"))
 
           {
 
           push(@design_files,$parser->parse_file(yp::lib::find_ipxact("spirit:design",$hier_ref_vendor,$hier_ref_library,$hier_ref_component,$hier_ref_version )));
 
           };
 
 
 
 
 
      }
 
     return(@design_files);
 
   }
 
 
 
 
 
 
 
#/*********************************************************************************************/
#/*********************************************************************************************/
#/  find_ipxact_file                                                                          */
#/  find_ipxact_file                                                                          */
#/                                                                                            */
#/                                                                                            */
#/  returns local name of the ip-xact file                                                    */
#/  returns local name of the ip-xact file                                                    */
#/                                                                                            */
#/                                                                                            */
Line 996... Line 918...
sub get_module_name
sub get_module_name
   {
   {
   my @params     = @_;
   my @params     = @_;
   my $version    = pop(@params);
   my $version    = pop(@params);
   my $component  = pop(@params);
   my $component  = pop(@params);
   my $project    = pop(@params);
   my $library    = pop(@params);
   my $vendor     = pop(@params);
   my $vendor     = pop(@params);
 
 
 
   my $name_depth =2;
 
 
 
 
 
 
 
   my $parser     = XML::LibXML->new();
 
 
 
   my $socgen_component_file  = $parser->parse_file(yp::lib::find_socgen("socgen:componentConfiguration",$vendor,$library,$component));
 
 
 
   foreach my $new_comp ($socgen_component_file->findnodes("//socgen:componentConfiguration"))
 
     {
 
 
 
     $name_depth        = $new_comp->findnodes('./socgen:ip_name_depth/text()')->to_literal ;
 
 
   return("${component}_${version}");
     }
 
  if($name_depth eq "1"){   return("${component}");}
 
  if($name_depth eq "2"){   return("${component}_${version}");}
 
  if($name_depth eq "3"){   return("${library}_${component}_${version}");}
 
  if($name_depth eq "4"){   return("${vendor}_${library}_${component}_${version}");}
 
 
   }
   }
 
 
 
 
 
 
Line 1016... Line 954...
   my @k = keys %trim;
   my @k = keys %trim;
   @output_files =  sort(sort @k);
   @output_files =  sort(sort @k);
   return(@output_files);
   return(@output_files);
   }
   }
 
 
 
#/*********************************************************************************************/
 
#/  parse_component_file                                                                      */
 
#/                                                                                            */
 
#/  returns design names for component                                                        */
 
#/                                                                                            */
 
#/   my @filelist = yp::lib::parse_component_file($vendor,$library,$component,$version);      */
 
#/                                                                                            */
 
#/*********************************************************************************************/
 
 
 
 
 
 
 
sub parse_component_file
 
   {
 
   my @params     = @_;
 
   my $version    = pop(@params);
 
   my $component  = pop(@params);
 
   my $library    = pop(@params);
 
   my $vendor     = pop(@params);
 
 
 
   my $parser     = XML::LibXML->new();
 
 
 
 
 
   my $spirit_cmp_filename =yp::lib::find_ipxact("spirit:component",$vendor,$library,$component,$version );
 
 
 
   unless($spirit_cmp_filename)
 
      {
 
      print("spirit:component   $vendor,$library,$component,$version \n");
 
      }
 
 
 
   my $spirit_component_file  = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$vendor,$library,$component,$version ));
 
 
 
 
 
   my $line;
 
 
 
   my      @filelist_acc = (  );
 
   push(@filelist_acc,"::${vendor}::${library}::${component}::${version}::");
 
 
 
   foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
 
     {
 
     my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
 
     my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
 
     my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
 
     my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
 
     my $hier_ref_type      = yp::lib::find_file_type($new_vendor,$new_library,$new_name,$new_version) ;
 
     my @filelist_sub       = parse_component_file($new_vendor,$new_library,$new_name,$new_version);
 
                              foreach $line (@filelist_sub) { push(@filelist_acc,"$line"); }
 
     }
 
 
 
   foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:hierarchyRef"))
 
     {
 
     my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
 
     my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
 
     my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
 
     my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
 
     my $hier_ref_type      = yp::lib::find_file_type($new_vendor,$new_library,$new_name,$new_version) ;
 
 
 
     if($hier_ref_type eq "spirit:designConfiguration")
 
        {
 
        my $spirit_designCfg_file
 
        = $parser->parse_file(yp::lib::find_ipxact("spirit:designConfiguration",$new_vendor,$new_library,$new_name,$new_version ));
 
 
 
        foreach my $design_ref_view ($spirit_designCfg_file->findnodes('//spirit:designConfiguration'))
 
            {
 
            $new_vendor         = $design_ref_view->findnodes('./spirit:designRef/@spirit:vendor')->to_literal ;
 
            $new_library        = $design_ref_view->findnodes('./spirit:designRef/@spirit:library')->to_literal ;
 
            $new_name           = $design_ref_view->findnodes('./spirit:designRef/@spirit:name')->to_literal ;
 
            $new_version        = $design_ref_view->findnodes('./spirit:designRef/@spirit:version')->to_literal ;
 
            $hier_ref_type                ="spirit:design";
 
            }
 
        }
 
 
 
        if($hier_ref_type eq "spirit:design")
 
           {
 
           my $spirit_design_file = $parser->parse_file(yp::lib::find_ipxact("spirit:design",$new_vendor,$new_library,$new_name,$new_version ));
 
           if($spirit_design_file)
 
             {
 
             foreach  my   $i_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:componentRef/\@spirit:vendor"))
 
                {
 
                my($vendor_name)         = $i_name  ->to_literal ;
 
                my($library_name)        = $i_name  ->findnodes('../@spirit:library')->to_literal ;
 
                my($component_name)      = $i_name  ->findnodes('../@spirit:name')->to_literal ;
 
                my($version_name)        = $i_name  ->findnodes('../@spirit:version')->to_literal ;
 
 
 
                push(@filelist_acc,"::${vendor_name}::${library_name}::${component_name}::${version_name}::");
 
                my  @filelist_sub = parse_component_file($vendor_name,$library_name,$component_name,$version_name);
 
                  foreach $line (@filelist_sub) { push(@filelist_acc,"$line"); }
 
                }
 
           }
 
        }
 
     }
 
 
 
   @filelist_acc     =       sys::lib::trim_sort(@filelist_acc);
 
   return(@filelist_acc);
 
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
#/*****************************************************************************************************/
 
#/  find_ipxact_design_files                                                                          */
 
#/                                                                                                    */
 
#/  returns parser tokens  to ip-xact design files referred to by component file vlnv                 */
 
#/                                                                                                    */
 
#/  my @spirit_design_files = yp::lib::find_ipxact_design_file($vendor,$library,$component,$version);  */
 
#/                                                                                                    */
 
#/*****************************************************************************************************/
 
 
 
sub find_ipxact_design_files
 
   {
 
   my @params     = @_;
 
   my $version    = pop(@params);
 
   my $component  = pop(@params);
 
   my $project    = pop(@params);
 
   my $vendor     = pop(@params);
 
 
 
 
 
   my $card_type;
 
   my $card_file_name;
 
   my $card_dir_name;
 
   my $card_vendor;
 
   my $card_library;
 
   my $card_component;
 
   my $card_version;
 
 
 
   my @design_files = ();
 
 
 
   my $parser           = XML::LibXML->new();
 
   my $yp_index_file    = $parser->parse_file("./tools/yp/hier_index.xml");
 
 
 
   unless (yp::lib::find_ipxact("spirit:component",$vendor,$project,$component,$version)){print "Missing Component  $vendor, $project, $component, $version \n";  }
 
 
 
   my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$vendor,$project,$component,$version));
 
 
 
 
 
   foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
 
     {
 
     my($new_vendor)        = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
 
     my($new_library)       = $new_comp->findnodes('./@spirit:library')->to_literal ;
 
     my($new_name)          = $new_comp->findnodes('./@spirit:name')->to_literal ;
 
     my($new_version)       = $new_comp->findnodes('./@spirit:version')->to_literal ;
 
     my @filelist_sub       = yp::lib::find_ipxact_design_files($new_vendor,$new_library,$new_name,$new_version);
 
                              foreach my $line (@filelist_sub) { push(@design_files,"$line"); }
 
     }
 
 
 
 
 
 
 
 
 
   foreach my $comp_view ($spirit_component_file->findnodes('//spirit:component/spirit:model/spirit:views/spirit:view'))
 
      {
 
      my($hier_ref_vendor)         = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:vendor')->to_literal ;
 
      my($hier_ref_library)        = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:library')->to_literal ;
 
      my($hier_ref_component)      = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:name')->to_literal ;
 
      my($hier_ref_version)        = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:version')->to_literal ;
 
 
 
 
 
 
 
      if(yp::lib::find_ipxact("spirit:designConfiguration",$hier_ref_vendor,$hier_ref_library,$hier_ref_component,$hier_ref_version ))
 
      {
 
 
 
      my $spirit_designCfg_file
 
       = $parser->parse_file(yp::lib::find_ipxact("spirit:designConfiguration",$hier_ref_vendor,$hier_ref_library,$hier_ref_component,$hier_ref_version ));
 
 
 
      foreach my $design_ref_view ($spirit_designCfg_file->findnodes('//spirit:designConfiguration'))
 
         {
 
         ($hier_ref_vendor)         = $design_ref_view->findnodes('./spirit:designRef/@spirit:vendor')->to_literal ;
 
         ($hier_ref_library)        = $design_ref_view->findnodes('./spirit:designRef/@spirit:library')->to_literal ;
 
         ($hier_ref_component)      = $design_ref_view->findnodes('./spirit:designRef/@spirit:name')->to_literal ;
 
         ($hier_ref_version)        = $design_ref_view->findnodes('./spirit:designRef/@spirit:version')->to_literal ;
 
         }
 
      }
 
 
 
 
 
 
 
 
 
         foreach  my   $index_card ($yp_index_file->findnodes("//socgen:file_types/socgen:file_type[socgen:name/text() = 'spirit:design']/socgen:vendors/socgen:vendor[socgen:name/text() = '$hier_ref_vendor']/socgen:libraries/socgen:library[socgen:name/text() = '$hier_ref_library']/socgen:components/socgen:component[socgen:name/text() = '$hier_ref_component']/socgen:versions/socgen:version[socgen:name/text() = '$hier_ref_version']"))
 
           {
 
           push(@design_files,":::${hier_ref_vendor}:::${hier_ref_library}:::${hier_ref_component}:::${hier_ref_version}:::");
 
           };
 
 
 
 
 
      }
 
     return(@design_files);
 
   }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1;
1;
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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