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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [yp/] [create_yp] - Diff between revs 131 and 135

Show entire file | Details | Blame | View Log

Rev 131 Rev 135
Line 1... Line 1...
eval 'exec `which perl` -S $0 ${1+"$@"}'
eval 'exec `which perl` -S $0 ${1+"$@"}'
   if 0;
   if 0;
 
 
#/**********************************************************************/
#/****************************************************************************/
#/*                                                                    */
#/*                                                                    */
#/*             -------                                                */
#/*   SOCGEN Design for Reuse toolset                                        */
#/*            /   SOC  \                                              */
 
#/*           /    GEN   \                                             */
 
#/*          /    TOOL    \                                            */
 
#/*          ==============                                            */
 
#/*          |            |                                            */
 
#/*          |____________|                                            */
 
#/*                                                                    */
 
#/*  Traverse a socgen project and link it                             */
 
#/*                                                                    */
#/*                                                                    */
 
#/*   Version 1.0.0                                                          */
#/*                                                                    */
#/*                                                                    */
#/*  Author(s):                                                        */
#/*  Author(s):                                                        */
#/*      - John Eaton, jt_eaton@opencores.org                          */
#/*      - John Eaton, z3qmtr45@gmail.com                                    */
#/*                                                                    */
#/*                                                                    */
#/**********************************************************************/
#/****************************************************************************/
#/*                                                                    */
#/*                                                                    */
#/*    Copyright (C) <2010-2011>                */
 
#/*                                                                    */
#/*                                                                    */
#/*  This source file may be used and distributed without              */
#/*             Copyright 2016 John T Eaton                                  */
#/*  restriction provided that this copyright statement is not         */
 
#/*  removed from the file and that any derivative work contains       */
 
#/*  the original copyright notice and the associated disclaimer.      */
 
#/*                                                                    */
 
#/*  This source file is free software; you can redistribute it        */
 
#/*  and/or modify it under the terms of the GNU Lesser General        */
 
#/*  Public License as published by the Free Software Foundation;      */
 
#/*  either version 2.1 of the License, or (at your option) any        */
 
#/*  later version.                                                    */
 
#/*                                                                    */
 
#/*  This source is distributed in the hope that it will be            */
 
#/*  useful, but WITHOUT ANY WARRANTY; without even the implied        */
 
#/*  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR           */
 
#/*  PURPOSE.  See the GNU Lesser General Public License for more      */
 
#/*  details.                                                          */
 
#/*                                                                    */
 
#/*  You should have received a copy of the GNU Lesser General         */
 
#/*  Public License along with this source; if not, download it        */
 
#/*  from http://www.opencores.org/lgpl.shtml                          */
 
#/*                                                                    */
#/*                                                                    */
#/**********************************************************************/
#/* Licensed under the Apache License, Version 2.0 (the "License");          */
 
#/* you may not use this file except in compliance with the License.         */
 
#/* You may obtain a copy of the License at                                  */
 
#/*                                                                          */
 
#/*    http://www.apache.org/licenses/LICENSE-2.0                            */
 
#/*                                                                          */
 
#/* Unless required by applicable law or agreed to in writing, software      */
 
#/* distributed under the License is distributed on an "AS IS" BASIS,        */
 
#/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
 
#/* See the License for the specific language governing permissions and      */
 
#/* limitations under the License.                                           */
 
#/*                                                                          */
 
#/*                                                                          */
 
#/****************************************************************************/
 
 
############################################################################
############################################################################
# General PERL config
# General PERL config
############################################################################
############################################################################
use Getopt::Long;
use Getopt::Long;
Line 93... Line 78...
 
 
 
 
$repo_db                    = new BerkeleyDB::Hash( -Filename => "${path}/repo.dbm",                   -Flags => DB_CREATE ) or die "Cannot open file: $!";
$repo_db                    = new BerkeleyDB::Hash( -Filename => "${path}/repo.dbm",                   -Flags => DB_CREATE ) or die "Cannot open file: $!";
$component_db               = new BerkeleyDB::Hash( -Filename => "${path}/component.dbm",              -Flags => DB_CREATE ) or die "Cannot open file: $!";
$component_db               = new BerkeleyDB::Hash( -Filename => "${path}/component.dbm",              -Flags => DB_CREATE ) or die "Cannot open file: $!";
$design_db                  = new BerkeleyDB::Hash( -Filename => "${path}/design.dbm",                 -Flags => DB_CREATE ) or die "Cannot open file: $!";
$design_db                  = new BerkeleyDB::Hash( -Filename => "${path}/design.dbm",                 -Flags => DB_CREATE ) or die "Cannot open file: $!";
 
$designConfiguration_db     = new BerkeleyDB::Hash( -Filename => "${path}/designConfiguration.dbm",    -Flags => DB_CREATE ) or die "Cannot open file: $!";
$busDefinition_db           = new BerkeleyDB::Hash( -Filename => "${path}/busDefinition.dbm",          -Flags => DB_CREATE ) or die "Cannot open file: $!";
$busDefinition_db           = new BerkeleyDB::Hash( -Filename => "${path}/busDefinition.dbm",          -Flags => DB_CREATE ) or die "Cannot open file: $!";
$abstractionDefinition_db   = new BerkeleyDB::Hash( -Filename => "${path}/abstractionDefinition.dbm",  -Flags => DB_CREATE ) or die "Cannot open file: $!";
$abstractionDefinition_db   = new BerkeleyDB::Hash( -Filename => "${path}/abstractionDefinition.dbm",  -Flags => DB_CREATE ) or die "Cannot open file: $!";
$libraryConfiguration_db    = new BerkeleyDB::Hash( -Filename => "${path}/libraryConfiguration.dbm",   -Flags => DB_CREATE ) or die "Cannot open file: $!";
$libraryConfiguration_db    = new BerkeleyDB::Hash( -Filename => "${path}/libraryConfiguration.dbm",   -Flags => DB_CREATE ) or die "Cannot open file: $!";
$componentConfiguration_db  = new BerkeleyDB::Hash( -Filename => "${path}/componentConfiguration.dbm", -Flags => DB_CREATE ) or die "Cannot open file: $!";
$componentConfiguration_db  = new BerkeleyDB::Hash( -Filename => "${path}/componentConfiguration.dbm", -Flags => DB_CREATE ) or die "Cannot open file: $!";
 
 
Line 130... Line 116...
                   print "Removing $repo_name  \n";
                   print "Removing $repo_name  \n";
                   my $cmd = "rm -r $repo_name  \n";
                   my $cmd = "rm -r $repo_name  \n";
                   if(system($cmd)){};
                   if(system($cmd)){};
                   }
                   }
 
 
                  my $cmd = "mkdir $repo_name ;lndir  $repo_path  $repo_name;";
                  my $cmd = "mkdir $repo_name ;lndir -silent  $repo_path  $repo_name;";
                  if(system($cmd)){};
                  if(system($cmd)){};
 
 
 
 
 
 
                  }
                  }
Line 210... Line 196...
          if(/(\S+)\.xml/)
          if(/(\S+)\.xml/)
             {
             {
             my $t_name                = $1;
             my $t_name                = $1;
             $_ = $src;
             $_ = $src;
             if(/${home}(\S+)/) { $t_local = $1; }
             if(/${home}(\S+)/) { $t_local = $1; }
 
      #       print "creat_yp: Parsing ${home}${t_local}/${t_name}.xml \n";
 
 
             my    $xml_file    = $parser->parse_file("${home}${t_local}/${t_name}.xml");
             my    $xml_file    = $parser->parse_file("${home}${t_local}/${t_name}.xml");
 
 
 
#             print "creat_yp: Parsed \n";
 
 
            if(${t_name} eq "libraryCfg"  )
            if(${t_name} eq "libraryCfg"  )
               {
               {
               foreach my $design ($xml_file->findnodes('//socgen:libraryConfiguration'))
               foreach my $design ($xml_file->findnodes('//socgen:libraryConfiguration'))
                  {
                  {
 
#                 print "creat_yp: Parsed socgen \n";
                  $vendor   = $design->findnodes('./socgen:vendor/text()')->to_literal ;
                  $vendor   = $design->findnodes('./socgen:vendor/text()')->to_literal ;
                  $library  = $design->findnodes('./socgen:name/text()')->to_literal ;
                  $library  = $design->findnodes('./socgen:name/text()')->to_literal ;
                  $name     = "";
                  $name     = "";
                  $version  = "";
                  $version  = "";
                  $type     = "socgen:libraryConfiguration";
                  $type     = "socgen:libraryConfiguration";
Line 228... Line 218...
                }
                }
             elsif(${t_name} eq "componentCfg"  )
             elsif(${t_name} eq "componentCfg"  )
              {
              {
              foreach my $design ($xml_file->findnodes('//socgen:componentConfiguration'))
              foreach my $design ($xml_file->findnodes('//socgen:componentConfiguration'))
                  {
                  {
 
#                                 print "creat_yp: Parsed socgen \n";
                  $vendor   = $design->findnodes('./socgen:vendor/text()')->to_literal ;
                  $vendor   = $design->findnodes('./socgen:vendor/text()')->to_literal ;
                  $library  = $design->findnodes('./socgen:library/text()')->to_literal ;
                  $library  = $design->findnodes('./socgen:library/text()')->to_literal ;
                  $name     = $design->findnodes('./socgen:component/text()')->to_literal ;
                  $name     = $design->findnodes('./socgen:component/text()')->to_literal ;
                  $version  = "";
                  $version  = "";
                  $type     = "socgen:componentConfiguration";
                  $type     = "socgen:componentConfiguration";
                  }
                  }
              }
              }
 
 
             else
             else
             {
             {
 
#                                 print "creat_yp: Parsing spirit \n";
               foreach my $comp ($xml_file->findnodes('//spirit:component'))
               foreach my $comp ($xml_file->findnodes('//ipxact:component'))
                  {
                  {
                  $vendor   = $comp->findnodes('./spirit:vendor/text()')->to_literal ;
#                                                 print "creat_yp: Parsed spirit \n";
                  $library  = $comp->findnodes('./spirit:library/text()')->to_literal ;
                  $vendor   = $comp->findnodes('./ipxact:vendor/text()')->to_literal ;
                  $type     = "spirit:component";
                  $library  = $comp->findnodes('./ipxact:library/text()')->to_literal ;
                  $name     = $comp->findnodes('./spirit:name/text()')->to_literal ;
                  $type     = "ipxact:component";
                  $version  = $comp->findnodes('./spirit:version/text()')->to_literal ;
                  $name     = $comp->findnodes('./ipxact:name/text()')->to_literal ;
 
                  $version  = $comp->findnodes('./ipxact:version/text()')->to_literal ;
                  }
                  }
 
 
 
 
               foreach my $design ($xml_file->findnodes('//spirit:design'))
               foreach my $design ($xml_file->findnodes('//ipxact:design'))
                  {
                  {
                  $vendor   = $design->findnodes('./spirit:vendor/text()')->to_literal ;
                  $vendor   = $design->findnodes('./ipxact:vendor/text()')->to_literal ;
                  $library  = $design->findnodes('./spirit:library/text()')->to_literal ;
                  $library  = $design->findnodes('./ipxact:library/text()')->to_literal ;
                  $name     = $design->findnodes('./spirit:name/text()')->to_literal ;
                  $name     = $design->findnodes('./ipxact:name/text()')->to_literal ;
                  $version  = $design->findnodes('./spirit:version/text()')->to_literal ;
                  $version  = $design->findnodes('./ipxact:version/text()')->to_literal ;
                  $type     = "spirit:design";
                  $type     = "ipxact:design";
 
                  }
 
 
 
 
 
               foreach my $design ($xml_file->findnodes('//ipxact:designConfiguration'))
 
                  {
 
                  $vendor   = $design->findnodes('./ipxact:vendor/text()')->to_literal ;
 
                  $library  = $design->findnodes('./ipxact:library/text()')->to_literal ;
 
                  $name     = $design->findnodes('./ipxact:name/text()')->to_literal ;
 
                  $version  = $design->findnodes('./ipxact:version/text()')->to_literal ;
 
                  $type     = "ipxact:designConfiguration";
                  }
                  }
 
 
 
 
 
 
               foreach my $design ($xml_file->findnodes('//spirit:abstractionDefinition'))
               foreach my $design ($xml_file->findnodes('//ipxact:abstractionDefinition'))
                  {
                  {
                  $vendor   = $design->findnodes('./spirit:vendor/text()')->to_literal ;
                  $vendor   = $design->findnodes('./ipxact:vendor/text()')->to_literal ;
                  $library  = $design->findnodes('./spirit:library/text()')->to_literal ;
                  $library  = $design->findnodes('./ipxact:library/text()')->to_literal ;
                  $name     = $design->findnodes('./spirit:name/text()')->to_literal ;
                  $name     = $design->findnodes('./ipxact:name/text()')->to_literal ;
                  $version  = $design->findnodes('./spirit:version/text()')->to_literal ;
                  $version  = $design->findnodes('./ipxact:version/text()')->to_literal ;
                  $type     = "spirit:abstractionDefinition";
                  $type     = "ipxact:abstractionDefinition";
                  }
                  }
 
 
 
 
               foreach my $design ($xml_file->findnodes('//spirit:busDefinition'))
               foreach my $design ($xml_file->findnodes('//ipxact:busDefinition'))
                  {
                  {
                  $vendor   = $design->findnodes('./spirit:vendor/text()')->to_literal ;
                  $vendor   = $design->findnodes('./ipxact:vendor/text()')->to_literal ;
                  $library  = $design->findnodes('./spirit:library/text()')->to_literal ;
                  $library  = $design->findnodes('./ipxact:library/text()')->to_literal ;
                  $name     = $design->findnodes('./spirit:name/text()')->to_literal ;
                  $name     = $design->findnodes('./ipxact:name/text()')->to_literal ;
                  $version  = $design->findnodes('./spirit:version/text()')->to_literal ;
                  $version  = $design->findnodes('./ipxact:version/text()')->to_literal ;
                  $type     = "spirit:busDefinition";
                  $type     = "ipxact:busDefinition";
                  }
                  }
 
 
 
 
 
 
 
 
Line 309... Line 310...
             else                                              { $component_path   = "/"; }
             else                                              { $component_path   = "/"; }
 
 
 
 
 
 
 
 
#               print "${vendor}__${library}_${name}_${version}     $t_local  $library_match  $lib_comp_sep  $name_match    \n";
#               print "${vendor}__${library}_${name}_${version}   $type  ---  $t_local  $library_match  $lib_comp_sep  $name_match    \n";
               $V_L_N_V  = "${vendor}__${library}_${name}_${version}"    ;
               $V_L_N_V  = "${vendor}__${library}_${name}_${version}"    ;
 
 
 
 
 
 
             if($type eq "spirit:component")
             if($type eq "ipxact:component")
               {
               {
 
 
               my $V = "${vendor}"    ;
               my $V = "${vendor}"    ;
               my @repo_info  = ("vendor","$vendor","idle","$repos_dir" );
               my @repo_info  = ("vendor","$vendor","idle","$repos_dir" );
               $repo_db->db_put( $V, join(':', @repo_info) );
               $repo_db->db_put( $V, join(':', @repo_info) );
Line 348... Line 349...
 
 
               $V_L_N_V  = "${vendor}__${library}_${name}_${version}"    ;
               $V_L_N_V  = "${vendor}__${library}_${name}_${version}"    ;
 
 
 
 
 
 
             if($type eq "spirit:design")
             if($type eq "ipxact:design")
               {
               {
               @info  = (".${t_local}/${t_name}.xml","${component_path}","${version}" );
               @info  = (".${t_local}/${t_name}.xml","${component_path}","${version}" );
               $design_db->db_put( $V_L_N_V, join(':', @info) );
               $design_db->db_put( $V_L_N_V, join(':', @info) );
               }
               }
 
 
 
             elsif($type eq "ipxact:designConfiguration")
 
               {
 
               @info  = (".${t_local}/${t_name}.xml","${component_path}","${version}","${name}","${library}","${vendor}"         );
 
               $designConfiguration_db->db_put( $V_L_N_V, join(':', @info) );
 
               }
 
 
 
 
             elsif($type eq "spirit:abstractionDefinition")
             elsif($type eq "ipxact:abstractionDefinition")
               {
               {
#               print "ABSDEF  $V_L_N_V    \n";
 
               @info  = (".${t_local}/${t_name}.xml","${component_path}","${version}","${name}","${library}","${vendor}"         );
               @info  = (".${t_local}/${t_name}.xml","${component_path}","${version}","${name}","${library}","${vendor}"         );
               $abstractionDefinition_db->db_put( $V_L_N_V, join(':', @info) );
               $abstractionDefinition_db->db_put( $V_L_N_V, join(':', @info) );
               }
               }
 
 
 
 
             elsif($type eq "spirit:busDefinition")
             elsif($type eq "ipxact:busDefinition")
               {
               {
               @info  = (".${t_local}/${t_name}.xml","${component_path}","${version}" );
               @info  = (".${t_local}/${t_name}.xml","${component_path}","${version}" );
               $busDefinition_db->db_put( $V_L_N_V, join(':', @info) );
               $busDefinition_db->db_put( $V_L_N_V, join(':', @info) );
               }
               }
 
 

powered by: WebSVN 2.1.0

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