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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [verilog/] [read_elab] - Diff between revs 131 and 133

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 131 Rev 133
eval 'exec `which perl` -S $0 ${1+"$@"}'
eval 'exec `which perl` -S $0 ${1+"$@"}'
   if 0;
   if 0;
#/**********************************************************************/
#/**********************************************************************/
#/*                                                                    */
#/*                                                                    */
#/*             -------                                                */
#/*             -------                                                */
#/*            /   SOC  \                                              */
#/*            /   SOC  \                                              */
#/*           /    GEN   \                                             */
#/*           /    GEN   \                                             */
#/*          /    TOOL    \                                            */
#/*          /    TOOL    \                                            */
#/*          ==============                                            */
#/*          ==============                                            */
#/*          |            |                                            */
#/*          |            |                                            */
#/*          |____________|                                            */
#/*          |____________|                                            */
#/*                                                                    */
#/*                                                                    */
#/*                                                                    */
#/*                                                                    */
#/*                                                                    */
#/*                                                                    */
#/*                                                                    */
#/*                                                                    */
#/*  Author(s):                                                        */
#/*  Author(s):                                                        */
#/*      - John Eaton, jt_eaton@opencores.org                          */
#/*      - John Eaton, jt_eaton@opencores.org                          */
#/*                                                                    */
#/*                                                                    */
#/**********************************************************************/
#/**********************************************************************/
#/*                                                                    */
#/*                                                                    */
#/*    Copyright (C) <2010-2011>                */
#/*    Copyright (C) <2010-2011>                */
#/*                                                                    */
#/*                                                                    */
#/*  This source file may be used and distributed without              */
#/*  This source file may be used and distributed without              */
#/*  restriction provided that this copyright statement is not         */
#/*  restriction provided that this copyright statement is not         */
#/*  removed from the file and that any derivative work contains       */
#/*  removed from the file and that any derivative work contains       */
#/*  the original copyright notice and the associated disclaimer.      */
#/*  the original copyright notice and the associated disclaimer.      */
#/*                                                                    */
#/*                                                                    */
#/*  This source file is free software; you can redistribute it        */
#/*  This source file is free software; you can redistribute it        */
#/*  and/or modify it under the terms of the GNU Lesser General        */
#/*  and/or modify it under the terms of the GNU Lesser General        */
#/*  Public License as published by the Free Software Foundation;      */
#/*  Public License as published by the Free Software Foundation;      */
#/*  either version 2.1 of the License, or (at your option) any        */
#/*  either version 2.1 of the License, or (at your option) any        */
#/*  later version.                                                    */
#/*  later version.                                                    */
#/*                                                                    */
#/*                                                                    */
#/*  This source is distributed in the hope that it will be            */
#/*  This source is distributed in the hope that it will be            */
#/*  useful, but WITHOUT ANY WARRANTY; without even the implied        */
#/*  useful, but WITHOUT ANY WARRANTY; without even the implied        */
#/*  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR           */
#/*  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR           */
#/*  PURPOSE.  See the GNU Lesser General Public License for more      */
#/*  PURPOSE.  See the GNU Lesser General Public License for more      */
#/*  details.                                                          */
#/*  details.                                                          */
#/*                                                                    */
#/*                                                                    */
#/*  You should have received a copy of the GNU Lesser General         */
#/*  You should have received a copy of the GNU Lesser General         */
#/*  Public License along with this source; if not, download it        */
#/*  Public License along with this source; if not, download it        */
#/*  from http://www.opencores.org/lgpl.shtml                          */
#/*  from http://www.opencores.org/lgpl.shtml                          */
#/*                                                                    */
#/*                                                                    */
#/**********************************************************************/
#/**********************************************************************/
############################################################################
############################################################################
# General PERL config
# General PERL config
############################################################################
############################################################################
use Getopt::Long;
use Getopt::Long;
use English;
use English;
use File::Basename;
use File::Basename;
use Cwd;
use Cwd;
use Scalar::Util qw(looks_like_number);
use Scalar::Util qw(looks_like_number);
use XML::LibXML;
use XML::LibXML;
use lib './tools';
use lib './tools';
use sys::lib;
use sys::lib;
use yp::lib;
use yp::lib;
use BerkeleyDB;
use BerkeleyDB;
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
############################################################################
############################################################################
### Process the options
### Process the options
############################################################################
############################################################################
Getopt::Long::config("require_order", "prefix=-");
Getopt::Long::config("require_order", "prefix=-");
GetOptions("h","help",
GetOptions("h","help",
           "prefix=s" => \$prefix,
           "prefix=s" => \$prefix,
           "vendor=s" => \$vendor,
           "vendor=s" => \$vendor,
           "library=s" => \$library,
           "library=s" => \$library,
           "version=s" => \$version,
           "version=s" => \$version,
           "component=s" => \$component,
           "component=s" => \$component,
           "verbose"
           "verbose"
) || die "(use '$program_name -h' for help)";
) || die "(use '$program_name -h' for help)";
##############################################################################
##############################################################################
## Help option
## Help option
##############################################################################
##############################################################################
if ( $opt_h  or $opt_help  )
if ( $opt_h  or $opt_help  )
  { print "\n read_elab -prefix prefix   -vendor vendor -library library  -component component  -version version \n";
  { print "\n read_elab -prefix prefix   -vendor vendor -library library  -component component  -version version \n";
    exit 1;
    exit 1;
  }
  }
#############################################################################
#############################################################################
##
##
##
##
#############################################################################
#############################################################################
$home = cwd();
$home = cwd();
unless ($prefix)
unless ($prefix)
  {
  {
  $prefix   = yp::lib::get_workspace();
  $prefix   = yp::lib::get_workspace();
  $prefix   = "/${prefix}";
  $prefix   = "/${prefix}";
  }
  }
my   $variant;
my   $variant;
my   $configuration;
my   $configuration;
my $dest_dir            = "elab";
my $dest_dir            = "elab";
my $destination         = "${component}_${version}";
my $destination         = "${component}_${version}";
unless ($env ) {$env = "none";}
unless ($env ) {$env = "none";}
unless ($tool ){$tool = "none";}
unless ($tool ){$tool = "none";}
unless ($unit ){$unit = "none";}
unless ($unit ){$unit = "none";}
if($name)
if($name)
  {
  {
  $destination   = "${destination}_${name}";
  $destination   = "${destination}_${name}";
  }
  }
else
else
  {
  {
  $name          = $version;
  $name          = $version;
  $destination   = "${destination}";
  $destination   = "${destination}";
  }
  }
my $root                =      "root";
my $root                =      "root";
if($version)       {$variant   = "${component}_${version}";}
if($version)       {$variant   = "${component}_${version}";}
else               {$variant   = "${component}";}
else               {$variant   = "${component}";}
print "read_elab     -prefix prefix -vendor $vendor -library $library -component $component -version $version -env $env -tool $tool -unit $unit -name $name     \n";
print "read_elab     -prefix prefix -vendor $vendor -library $library -component $component -version $version -env $env -tool $tool -unit $unit -name $name     \n";
my $parser = XML::LibXML->new();
my $parser = XML::LibXML->new();
my $socgen_file              = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
my $socgen_file              = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
unless ($socgen_file)      { print "No socgen ip file   \n";};
unless ($socgen_file)      { print "No socgen ip file   \n";};
my $comp_xml_sep    = yp::lib::find_comp_xml_sep($vendor,$library,$component,$version);
my $comp_xml_sep    = yp::lib::find_comp_xml_sep($vendor,$library,$component,$version);
my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$library,$component);
my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$library,$component);
#print "lib_comp_sep   $lib_comp_sep \n";
#print "lib_comp_sep   $lib_comp_sep \n";
#print "comp_xml_sep   $comp_xml_sep \n";
#print "comp_xml_sep   $comp_xml_sep \n";
my $path  = "${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/../${dest_dir}/${destination}";
my $path  = "${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/../${dest_dir}/${destination}";
unless( -e $path )
unless( -e $path )
        {
        {
        print "$path does not exist \n";
        print "$path does not exist \n";
        return(1);
        return(1);
        }
        }
$data_db_file  = "${path}/${root}.db";
$data_db_file  = "${path}/${root}.db";
if(-e  $data_db_file  )
if(-e  $data_db_file  )
        {
        {
        print "$data_db_file  does exist  \n";
        print "$data_db_file  does exist  \n";
        }
        }
my $elab_db  = new BerkeleyDB::Hash( -Filename => "$data_db_file", -Flags => DB_CREATE ) or die "Cannot open ${data_db_file}: $!";
my $elab_db  = new BerkeleyDB::Hash( -Filename => "$data_db_file", -Flags => DB_CREATE ) or die "Cannot open ${data_db_file}: $!";
   my $key;
   my $key;
   my $value;
   my $value;
   my @elab_list;
   my @elab_list;
   my $cursor = $elab_db ->db_cursor() ;
   my $cursor = $elab_db ->db_cursor() ;
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
   {
   {
#   print "ELAB  $key,   $value  \n";
#   print "ELAB  $key,   $value  \n";
                 ( ${key_type},@elab_list) = split( /\./ , $key);
                 ( ${key_type},@elab_list) = split( /\./ , $key);
#                 ( ${log_name},${direction},${type},${vector},${left},${right},${phy_name}) = split ':', $value;
#                 ( ${log_name},${direction},${type},${vector},${left},${right},${phy_name}) = split ':', $value;
                 if(($key_type eq "component___${root}"))
                 if(($key_type eq "component___${root}"))
                    {
                    {
                    print "Component  $key -- $value @elab_list  \n";
                    print "Component  $key -- $value @elab_list  \n";
                    build_hierarchy ($value,$path,$root,@elab_list);
                    build_hierarchy ($value,$path,$root,@elab_list);
                    }
                    }
                 else
                 else
                    {
                    {
                    }
                    }
   }
   }
   my $status = $cursor->c_close() ;
   my $status = $cursor->c_close() ;
   $elab_db   -> db_close();
   $elab_db   -> db_close();
#   @bus_list      = sys::lib::trim_sort(@bus_list);
#   @bus_list      = sys::lib::trim_sort(@bus_list);
#    foreach $list (@bus_list)   { print   "${list}\n";}
#    foreach $list (@bus_list)   { print   "${list}\n";}
#
#
#my @busses  = yp::lib::get_busses($vendor,$library,$component,$version);
#my @busses  = yp::lib::get_busses($vendor,$library,$component,$version);
#    foreach $list (@busses) {  print   "${list}\n";  }
#    foreach $list (@busses) {  print   "${list}\n";  }
#/*********************************************************************************************/
#/*********************************************************************************************/
#/                                                                                            */
#/                                                                                            */
#/                                                                                            */
#/                                                                                            */
#/                                                                                            */
#/                                                                                            */
#/                                                                                            */
#/                                                                                            */
#/                                                                                            */
#/                                                                                            */
#/                                                                                            */
#/                                                                                            */
#/*********************************************************************************************/
#/*********************************************************************************************/
sub build_hierarchy
sub build_hierarchy
   {
   {
   my @params     = @_;
   my @params     = @_;
   my $vlnv       = shift(@params);
   my $vlnv       = shift(@params);
   my $path       = shift(@params);
   my $path       = shift(@params);
   my $root       = shift(@params);
   my $root       = shift(@params);
   my $top        = shift(@params);
   my $top        = shift(@params);
   my $new_elab_db ;
   my $new_elab_db ;
   my $new_elab_db_file_name ;
   my $new_elab_db_file_name ;
 
 
   print "Hier  $path \nHier- $root       $top    --- @params  \n";
#   print "Hier  $path \nHier- $root       $top    --- @params  \n";
   $path ="${path}/${root}";
   $path ="${path}/${root}";
   unless(-e $path)
   unless(-e $path)
     {
     {
     $cmd ="mkdir ${path} \n";
     $cmd ="mkdir ${path} \n";
     if(system($cmd)){}
     if(system($cmd)){}
     print "Create Dir  ${path} \n";
     print "Create Dir  ${path} \n";
     }
     }
   unless (-e "${path}/${top}")
   unless (-e "${path}/${top}")
     {
     {
     $cmd ="mkdir ${path}/${top} \n";
     $cmd ="mkdir ${path}/${top} \n";
     if(system($cmd)){}
     if(system($cmd)){}
     }
     }
   $new_elab_db_file_name  = "${path}/${top}/Index.db";
   $new_elab_db_file_name  = "${path}/${top}/Index.db";
   if(@params)
   if(@params)
     {
     {
     build_hierarchy ("$vlnv","${path}","${top}",@params);
     build_hierarchy ("$vlnv","${path}","${top}",@params);
     }
     }
   else
   else
     {
     {
     print "CREATE $new_elab_db_file_name  \n";
     print "CREATE $new_elab_db_file_name  \n";
     $new_elab_db  = new BerkeleyDB::Hash( -Filename => "$new_elab_db_file_name", -Flags => DB_CREATE ) or die "Cannot open $new_elab_db_file_name    : $!";
     $new_elab_db  = new BerkeleyDB::Hash( -Filename => "$new_elab_db_file_name", -Flags => DB_CREATE ) or die "Cannot open $new_elab_db_file_name    : $!";
     $new_elab_db->db_put( "VLNV","${vlnv}"  );
     $new_elab_db->db_put( "VLNV","${vlnv}"  );
     print "VLNV  $vlnv \nVLNV -> $new_elab_db_file_name  \n";
     print "VLNV  $vlnv \nVLNV -> $new_elab_db_file_name  \n";
     }
     }
   return(0);
   return(0);
   }
   }
 
 

powered by: WebSVN 2.1.0

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