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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [verilog/] [gen_verilogLib] - Diff between revs 127 and 128

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

Rev 127 Rev 128
Line 64... Line 64...
### Process the options
### Process the options
############################################################################
############################################################################
 
 
Getopt::Long::config("require_order", "prefix=-");
Getopt::Long::config("require_order", "prefix=-");
GetOptions("h","help",
GetOptions("h","help",
           "view=s" => \$view,
           "envidentifier=s" => \$envidentifier,
           "prefix=s" => \$prefix,
           "prefix=s" => \$prefix,
           "vendor=s" => \$vendor,
           "vendor=s" => \$vendor,
           "project=s" => \$project,
           "project=s" => \$project,
           "component=s" => \$component,
           "component=s" => \$component,
           "version=s" => \$version,
           "version=s" => \$version,
           "dest_dir=s" => \$dest_dir
           "dest_dir=s" => \$dest_dir,
 
           "view=s" => \$view
) || 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 gen_verilogLib -view {sim|syn} -prefix /work  -vendor vendor_name -project  project_name  -component component_name -version version_name -dest_dir dest_dir";
   print "\n gen_verilogLib -envidentifier *simulation* -prefix /work  -vendor vendor_name -project  project_name  -component component_name -version version_name -dest_dir dest_dir";
   print "\n";
   print "\n";
   exit 1;
   exit 1;
   }
   }
 
 
 
 
##############################################################################
##############################################################################
##
##
##############################################################################
##############################################################################
 
 
 
my $parser = XML::LibXML->new();
 
 
 
my $sogen_file               = $parser->parse_file(yp::lib::find_socgen("socgen:componentConfiguration",$vendor,$project,$component));
 
my $ip_name_base_macro       = $sogen_file->findnodes("//socgen:componentConfiguration/socgen:ip_name_base_macro/text()")->to_literal;
 
 
 
 
 
 
 
 
$home = cwd();
$home = cwd();
 
my @search_paths = ();
my $variant;
my $variant;
 
 
 
 
 if($version)       {$variant   = "${component}_${version}";}
 if($version)       {$variant   = "${component}_${version}";}
 else               {$variant   = "${component}";}
 else               {$variant   = "${component}";}
 
 
my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$project,$component);
my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$project,$component);
my $comp_xml_sep    = yp::lib::find_ipxact_component_path("spirit:component",$vendor,$project,$component,$version);
my $comp_xml_sep    = yp::lib::find_ipxact_component_path("spirit:component",$vendor,$project,$component,$version);
 
my $module_name     = yp::lib::get_module_name($vendor,$project,$component,$version);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
my $parser = XML::LibXML->new();
 
my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$vendor,$project,$component,$version));
 
 
 
 
 
 
#############################################################################
 
##
 
##
 
#############################################################################
 
 
 
print "\n  Building $view  Verilog Lib RTL for  $prefix $project  $component $verison  $variant  $dest_dir  \n" ;
print "\n  Building $view  Verilog Lib RTL for  $prefix $project  $component $verison  $variant  $dest_dir  \n" ;
 
 
my $path  = "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}";
my $path  = "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}";
mkdir $path,0755             unless( -e $path );
mkdir $path,0755             unless( -e $path );
 
 
my $path  = "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}/${view}";
 
 
my $path  = "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}/../defines";
mkdir $path,0755             unless( -e $path );
mkdir $path,0755             unless( -e $path );
 
 
my $parser = XML::LibXML->new();
my $path  = "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}/../filelists";
my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$vendor,$project,$component,$version));
mkdir $path,0755             unless( -e $path );
 
 
 
 
 
my $path  = "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}/${view}";
 
mkdir $path,0755             unless( -e $path );
 
 
 
 
foreach my $comp_view ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:name[./text() = '$view']"))
 
    {
 
    my($view_fileset)  = $comp_view->findnodes('../spirit:fileSetRef/spirit:localName/text()')->to_literal ;
 
 
 
    #/**********************************************************************/
    #/**********************************************************************/
    #/*                                                                    */
    #/*                                                                    */
    #/* build a `define file for module names                              */
    #/* build a `define file for module names                              */
    #/*                                                                    */
    #/*                                                                    */
    #/*                                                                    */
    #/*                                                                    */
    #/*                                                                    */
    #/*                                                                    */
    #/*                                                                    */
    #/*                                                                    */
    #/**********************************************************************/
    #/**********************************************************************/
 
 
    my $outfile ="${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}/deflist";
    my $outfile ="${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}/../defines/${variant}.v";
    open DEFLIST,">$outfile" or die "unable to open $outfile";
    open DEFLIST,">$outfile" or die "unable to open $outfile";
    print  DEFLIST " \n";
    print  DEFLIST "   \`define $ip_name_base_macro     ${module_name}  \n";
    foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:fileSets/spirit:fileSet/spirit:file/spirit:logicalName"))
 
 
    my $outfile ="${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}/../filelists/${variant}.MOD";
 
    open FILELIST,">$outfile" or die "unable to open $outfile";
 
 
 
    my $outfile ="${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}/../filelists/${variant}.INC";
 
    open INCLIST,">$outfile" or die "unable to open $outfile";
 
 
 
    print INCLIST  "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}/../defines/${variant}.v\n";
 
 
 
 
 
 
 
 
 
 
 
#print " FFFFFFFFFFFFFFFF  $envidentifier  $view  \n" ;
 
 
 
 
 
my  @filelist =       yp::lib::parse_component_brothers("$vendor","$project","$component","$version");
 
 
 
foreach $line (@filelist)
       {
       {
       my($def_logic)     = $i_name ->findnodes('./text()')->to_literal ;
   $_ = $line;
       if($def_logic )    {print  DEFLIST   sprintf( "\`define %s   _%s\n",   uc($def_logic) ,  $def_logic    );}
   if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
       }
     {
 
     $new_project        = $2;
 
     $new_component      = $3;
 
     $new_vendor         = $1;
 
     $new_version        = $4;
 
 
 
#     print " FFFFFFFFFFFFFFFF  Brother      $new_vendor  $new_project  $new_component $new_version \n" ;
 
 
 
    my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$new_vendor,$new_project,$new_component,$new_version));
 
 
 
    foreach my $comp_view ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:envIdentifier[./text() = '$envidentifier']"))
 
      {
 
      my($view_name)     = $comp_view->findnodes('../spirit:name/text()')->to_literal ;
 
      my($view_fileset)  = $comp_view->findnodes('../spirit:fileSetRef/spirit:localName/text()')->to_literal ;
 
 #     print " FFFFFFFFFFFFFFFF  Found  $view_name  $view_fileset    \n" ;
 
 
 
 
 
 
 
 
 
 
    #/**********************************************************************/
    #/**********************************************************************/
    #/*                                                                    */
    #/*                                                                    */
    #/* build a fileset in the following order                             */
    #/* build a fileset in the following order                             */
Line 151... Line 206...
    #/* all module files                                                   */
    #/* all module files                                                   */
    #/*                                                                    */
    #/*                                                                    */
    #/*                                                                    */
    #/*                                                                    */
    #/**********************************************************************/
    #/**********************************************************************/
 
 
    my $outfile ="${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}/filelist";
 
    open FILELIST,">$outfile" or die "unable to open $outfile";
 
 
 
    print FILELIST "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}/deflist\n";
 
 
 
    foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:fileSets/spirit:fileSet/spirit:file/spirit:name"))
    foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:fileSets/spirit:fileSet/spirit:file/spirit:name"))
       {
       {
       my($file_name)      = $i_name ->findnodes('./text()')->to_literal ;
       my($file_name)      = $i_name ->findnodes('./text()')->to_literal ;
       my($file_type)      = $i_name ->findnodes('../spirit:userFileType/text()')->to_literal ;
       my($file_logicalname)   = $i_name ->findnodes('../spirit:logicalName/text()')->to_literal ;
 
       my($file_type)          = $i_name ->findnodes('../spirit:fileType/text()')->to_literal ;
 
       my($file_usertype)      = $i_name ->findnodes('../spirit:userFileType/text()')->to_literal ;
       my($view_file)      = $i_name ->findnodes('../../spirit:name/text()')->to_literal ;
       my($view_file)      = $i_name ->findnodes('../../spirit:name/text()')->to_literal ;
       if(($file_type eq "include")&& (($view_file eq $view_fileset)))
 
         { print FILELIST  "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${file_name}\n"};
 
       }
 
 
 
    foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:fileSets/spirit:fileSet/spirit:file/spirit:name"))
#      print " FFFFFFFFFFFFFFFX     $file_name  $file_logicalname $file_type  $file_usertype  $view_file  \n" ;
 
 
 
 
 
       if(($file_usertype eq "include")&& ($view_file eq $view_fileset)  &&   ($file_type eq "verilogSource")        )
       {
       {
       my($file_name)      = $i_name ->findnodes('./text()')->to_literal ;
         print INCLIST  "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${file_name}\n";
       my($file_type)      = $i_name ->findnodes('../spirit:userFileType/text()')->to_literal ;
         };
       my($view_file)      = $i_name ->findnodes('../../spirit:name/text()')->to_literal ;
 
       if(($file_type eq "module")&& (($view_file eq $view_fileset)))
 
         { print FILELIST  "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${file_name}\n"};
       if(($file_usertype eq "libraryDir")&& ($view_file eq $view_fileset)  &&   ($file_type eq "verilogSource")        )
 
         {
 
         push @search_paths,  "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${file_name}";
 
         };
 
 
 
 
 
       if(($file_usertype eq "module") && ($view_file eq $view_fileset) &&   ($file_type eq "verilogSource")                     )
 
         {
 
         print FILELIST  "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${file_name}\n";
 
         if($file_logicalname )
 
            {
 
            print  DEFLIST   sprintf( "\`define %s   _%s\n",   uc($file_logicalname) ,  $file_logicalname );
 
            }
 
         };
 
 
 
 
       }
       }
 
 
 
 
 
 
 
 
 
 
 
      }
 
     }
 
   }
 
 
 
 
      #/**********************************************************************/
      #/**********************************************************************/
      #/*                                                                    */
      #/*                                                                    */
      #/* Every leaf cell is processed through a the verilog preprocessor    */
      #/* Every leaf cell is processed through a the verilog preprocessor    */
      #/* to customize the module names,remove all verilog tic(`) statements */
      #/* to customize the module names,remove all verilog tic(`) statements */
      #/* and to create seperate versions for simulation and synthesys       */
      #/* and to create seperate versions for simulation and synthesys       */
Line 194... Line 270...
        {
        {
        $cmd ="rm  $file_out \n";
        $cmd ="rm  $file_out \n";
        if (system($cmd)) {}
        if (system($cmd)) {}
        };
        };
 
 
        $cmd ="vppreproc --noline --noblank  -DVARIANT=${variant}  -I${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/../verilog  -f  ${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}/filelist    >>  $file_out \n";
        my $cmd_path;
 
 
 
        foreach $search_path (@search_paths)
 
              {
 
               $cmd_path = " $cmd_path -I${search_path} " ;
 
              }
 
 
 
 
 
 
 
        $cmd ="vppreproc --noline --noblank  $cmd_path  -f  ${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}/../filelists/${variant}.INC  -f  ${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}${comp_xml_sep}/${dest_dir}/../filelists/${variant}.MOD    >>  $file_out \n";
 
 
        if (system($cmd)) {}
        if (system($cmd)) {}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  }
 
 
 
 
 
1
1
 
 
 
 

powered by: WebSVN 2.1.0

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