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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [bin/] [socgen] - Rev 135

Compare with Previous | Blame | View Log

eval 'exec `which perl` -S $0 ${1+"$@"}'
   if 0;
#/**********************************************************************/
#/*                                                                    */
#/*             -------                                                */
#/*            /   SOC  \                                              */
#/*           /    GEN   \                                             */
#/*          /    TOOL    \                                            */
#/*          ==============                                            */
#/*          |            |                                            */
#/*          |____________|                                            */
#/*                                                                    */
#/*                                                                    */
#/*                                                                    */
#/*                                                                    */
#/*  Author(s):                                                        */
#/*      - John Eaton, jt_eaton@opencores.org                          */
#/*                                                                    */
#/**********************************************************************/
#/*                                                                    */
#/*    Copyright (C) <2016>  <Ouabache Design Works>                   */
#/*                                                                    */
#/*  This source file may be used and distributed without              */
#/*  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                          */
#/*                                                                    */
#/**********************************************************************/


############################################################################
# General PERL config
############################################################################
use Getopt::Long;
use English;
use File::Basename;
use Cwd;
use Scalar::Util qw(looks_like_number);
use XML::LibXML;
use lib './tools';
use sys::lib;
use yp::lib;
use BerkeleyDB;


$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.


############################################################################
### Process the options
############################################################################
Getopt::Long::config("require_order", "prefix=-");
GetOptions("h","help",
           "vendor=s" => \$vendor,
           "library=s" => \$library,
           "component=s" => \$component,
           "version=s" => \$version,
           "workspace",
           "elaborate",
           "gen_ports",
           "gen_sigs",
           "parse_comp",
                      "parse_design"

) || die "(use '$program_name -h' for help)";

my $program_name = "socgen";

##############################################################################
## Help option
##############################################################################
if ( $opt_h  or $opt_help  ) 
  { print "\n $program_name -h    Print this message";
    print "\n $program_name       Print vendor list";
    print "\n $program_name -vendor vendor_name Print vendor libraries";
    print "\n $program_name -vendor vendor_name -library library_name  Print component list";
    print "\n $program_name -vendor vendor_name -library library_name  -workspace Make workspace";
    print "\n $program_name -vendor vendor_name -library library_name  -component component_name  Print System list";
    print "\n $program_name -vendor vendor_name -library library_name  -component component_name   -version version_name -elaborate Elaborate System";
    print "\n $program_name -vendor vendor_name -library library_name  -component component_name   -version version_name -gen_ports Create System Port list";
    print "\n $program_name -vendor vendor_name -library library_name  -component component_name   -version version_name -gen_sigs  Create Signal list";
    print "\n $program_name -vendor vendor_name -library library_name  -component component_name   -version version_name -parse_comp  Parse component;";

print "\n";
    exit 1;
  }



#############################################################################
## 
## 
#############################################################################

$home = cwd();
my $parser = XML::LibXML->new();

my $workspace  = yp::lib::get_workspace;

unless (defined $vendor)
       {
       print "Socgen  vendors \n \n";
       my @vendors =  yp::lib::find_vendors;
       foreach $ven (@vendors)
         {
         my $vendor_status    =  yp::lib::get_vendor_status($ven);


         print "$ven  $vendor_status  \n";
         }
       exit 0;
       }


unless (defined $library)
       {
       print "$vendor libraries  \n \n";
       my @libraries =  yp::lib::find_libraries($vendor);
       foreach $lib (@libraries)
         {

         my $library_status   =  yp::lib::get_library_status($vendor,$lib);

         print "$lib  $library_status \n";
         }
       exit 0;
       }



unless (defined $component)
       {
       if($opt_workspace)
       {
       my $cmd ="./tools/sys/workspace  -vendor ${vendor} -library ${library}    \n";
       print "$cmd ";
       exit 0
       }

       print "$vendor $library components  \n \n";
       my @components =  yp::lib::find_components($vendor,$library);
       foreach $comp (@components)
         {
         my $file = "";
            $file = yp::lib::find_componentConfiguration($vendor,$library,$comp);
         if( $file ne "") {         print "$comp   \n";}
         }
       exit 0;
       }


unless (defined $version)
       {
       print "$vendor $library $components version  \n \n";
       my $socgen_filename     = yp::lib::find_componentConfiguration($vendor,$library,$component);
       if($socgen_filename)
         {
         my $socgen_file     = $parser->parse_file($socgen_filename);
         #/*********************************************************************************************/
         #/   elaborate  each testbench                                                                */
         #/                                                                                            */
         #/*********************************************************************************************/
         foreach  my   $j_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:testbenches/socgen:testbench/socgen:variant"))
           {
           my $testbench_variant            = $j_name ->findnodes('./text()')->to_literal ;
           my $testbench_version            = $j_name ->findnodes('../socgen:version/text()')->to_literal ;
           my $testbench_config             = $j_name ->findnodes('../socgen:configuration/text()')->to_literal ;
           my $testbench_instance           = $j_name ->findnodes('../socgen:bus/socgen:instance/text()')->to_literal ;
           my $testbench_bus_name           = $j_name ->findnodes('../socgen:bus/socgen:bus_name/text()')->to_literal ;
           print "$testbench_version $testbench_variant  \n";
           }
         }
       exit 0;
       }



if($opt_elaborate)
{
   my $socgen_filename     = yp::lib::find_componentConfiguration($vendor,$library,$component);
   if($socgen_filename)
   {
   my $socgen_file     = $parser->parse_file($socgen_filename);
   #/*********************************************************************************************/
   #/   elaborate  each testbench                                                                */
   #/                                                                                            */
   #/*********************************************************************************************/

my $variant = "${component}_${version}";



foreach  my   $j_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:testbenches/socgen:testbench/socgen:variant[./text() = '$variant']"))
      {
      my $testbench_variant            = $j_name ->findnodes('./text()')->to_literal ;
      my $testbench_version            = $j_name ->findnodes('../socgen:version/text()')->to_literal ;
      my $testbench_config             = $j_name ->findnodes('../socgen:configuration/text()')->to_literal ;
      my $testbench_instance           = $j_name ->findnodes('../socgen:bus/socgen:instance/text()')->to_literal ;
      my $testbench_bus_name           = $j_name ->findnodes('../socgen:bus/socgen:bus_name/text()')->to_literal ;
      if(defined $testbench_config   && length $testbench_config > 0)
        {
        $cmd ="./tools/verilog/elab_verilog  -vendor ${vendor} -library ${library} -component   ${component}  -version ${testbench_version} -configuration ${testbench_config}  \n";
        }
      else
        {
        $cmd ="./tools/verilog/elab_verilog  -vendor ${vendor} -library ${library} -component   ${component}  -version ${testbench_version}   \n";
        }
      print "$cmd";
      }

   }



}






if($opt_gen_ports)
{
   my $socgen_filename     = yp::lib::find_componentConfiguration($vendor,$library,$component);
   if($socgen_filename)
   {
   my $socgen_file     = $parser->parse_file($socgen_filename);
   #/*********************************************************************************************/
   #/   elaborate  each testbench                                                                */
   #/                                                                                            */
   #/*********************************************************************************************/
my $variant = "${component}_${version}";
 foreach  my   $j_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:testbenches/socgen:testbench/socgen:variant[./text() = '$variant']"))
      {
      my $testbench_variant            = $j_name ->findnodes('./text()')->to_literal ;
      my $testbench_version            = $j_name ->findnodes('../socgen:version/text()')->to_literal ;
      my $testbench_config             = $j_name ->findnodes('../socgen:configuration/text()')->to_literal ;
      my $testbench_instance           = $j_name ->findnodes('../socgen:bus/socgen:instance/text()')->to_literal ;
      my $testbench_bus_name           = $j_name ->findnodes('../socgen:bus/socgen:bus_name/text()')->to_literal ;

        $cmd ="./tools/verilog/gen_ports  -vendor ${vendor} -library ${library} -component   ${component}  -version ${testbench_version}   \n";

      print "$cmd";
      }

   }
}



if($opt_gen_sigs)
{
   my $socgen_filename     = yp::lib::find_componentConfiguration($vendor,$library,$component);
   if($socgen_filename)
   {
   my $socgen_file     = $parser->parse_file($socgen_filename);
   #/*********************************************************************************************/
   #/   elaborate  each testbench                                                                */
   #/                                                                                            */
   #/*********************************************************************************************/
my $variant = "${component}_${version}";
 foreach  my   $j_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:testbenches/socgen:testbench/socgen:variant[./text() = '$variant']"))
      {
      my $testbench_variant            = $j_name ->findnodes('./text()')->to_literal ;
      my $testbench_version            = $j_name ->findnodes('../socgen:version/text()')->to_literal ;
      my $testbench_config             = $j_name ->findnodes('../socgen:configuration/text()')->to_literal ;
      my $testbench_instance           = $j_name ->findnodes('../socgen:bus/socgen:instance/text()')->to_literal ;
      my $testbench_bus_name           = $j_name ->findnodes('../socgen:bus/socgen:bus_name/text()')->to_literal ;

 my @signals  = yp::lib::get_signals($vendor,$library,$component,$testbench_version);

     foreach my $sig (@signals)
     {
      print "$sig\n";
     }

}

   }
}






if($opt_parse_comp)
{
   my $socgen_filename     = yp::lib::find_componentConfiguration($vendor,$library,$component);
   if($socgen_filename)
   {
   my $socgen_file     = $parser->parse_file($socgen_filename);
   #/*********************************************************************************************/
   #/   elaborate  each testbench                                                                */
   #/                                                                                            */
   #/*********************************************************************************************/
my $variant = "${component}_${version}";
 foreach  my   $j_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:testbenches/socgen:testbench/socgen:variant[./text() = '$variant']"))
      {
      my $testbench_variant            = $j_name ->findnodes('./text()')->to_literal ;
      my $testbench_version            = $j_name ->findnodes('../socgen:version/text()')->to_literal ;
      my $testbench_config             = $j_name ->findnodes('../socgen:configuration/text()')->to_literal ;
      my $testbench_instance           = $j_name ->findnodes('../socgen:bus/socgen:instance/text()')->to_literal ;
      my $testbench_bus_name           = $j_name ->findnodes('../socgen:bus/socgen:bus_name/text()')->to_literal ;


     my @filelist = yp::lib::parse_component_file($vendor,$library,$component,$testbench_version); 


     foreach my $file (@filelist)
     {
      print "$file\n";
     }

}

   }
}







if($opt_parse_design)
{
   my $socgen_filename     = yp::lib::find_componentConfiguration($vendor,$library,$component);
   if($socgen_filename)
   {
   my $socgen_file     = $parser->parse_file($socgen_filename);
   #/*********************************************************************************************/
   #/   elaborate  each testbench                                                                */
   #/                                                                                            */
   #/*********************************************************************************************/
my $variant = "${component}_${version}";
 foreach  my   $j_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:testbenches/socgen:testbench/socgen:variant[./text() = '$variant']"))
      {
      my $testbench_variant            = $j_name ->findnodes('./text()')->to_literal ;
      my $testbench_version            = $j_name ->findnodes('../socgen:version/text()')->to_literal ;
      my $testbench_config             = $j_name ->findnodes('../socgen:configuration/text()')->to_literal ;
      my $testbench_instance           = $j_name ->findnodes('../socgen:bus/socgen:instance/text()')->to_literal ;
      my $testbench_bus_name           = $j_name ->findnodes('../socgen:bus/socgen:bus_name/text()')->to_literal ;

     my @filelist = yp::lib::find_ipxact_design_files($vendor,$library,$component,$testbench_version);



     foreach my $file (@filelist)
     {
      print "$file\n";
     }

}

   }
}







1

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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