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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [verilog/] [elab_verilog] - Diff between revs 133 and 134

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

Rev 133 Rev 134
Line 54... Line 54...
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 math::lib;
use BerkeleyDB;
use BerkeleyDB;
 
 
 
 
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
 
 
Line 106... Line 107...
 $prefix   = yp::lib::get_workspace();
 $prefix   = yp::lib::get_workspace();
 $prefix   =  "/${prefix}";
 $prefix   =  "/${prefix}";
 }
 }
 
 
 
 
my   $variant;
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   $variant;
 
 
 
 
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)
 
  {
 
  $destination   = "${destination}_${name}";
 
  }
 
else
 
  {
 
  $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 "ELAB_VERILOG -prefix $prefix -vendor $vendor -library $library -component $component -version $version   -env $env -tool $tool -unit $unit -name $name     \n";
#print "./tools/verilog/elab_verilog -envidentifier $envidentifier -prefix $prefix -vendor $vendor -library $library -component $component -version $version -configuration $configuration -dest_dir   $dest_dir -env $env -tool $tool -unit $unit -name  $name  \n";
 
 
 
 
 
 
 
 
my $parser = XML::LibXML->new();
my $parser = XML::LibXML->new();
 
 
 
my $socgen_filename          = yp::lib::find_componentConfiguration($vendor,$library,$component);
 
unless ($socgen_filename)      { print "No socgen ip file $vendor,$library,$component   \n";};
 
 
my $socgen_file              = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
my $socgen_file              = $parser->parse_file($socgen_filename);
 
 
unless ($socgen_file)      { print "No socgen ip file   \n";};
 
 
 
 
 
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 $path;
my $path;
 
 
 
my $elab_db_filename;
 
 
 
 
 
if($name)
 
  {
 
  $elab_db_filename = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,$name);
 
  }
 
else
 
  {
 
  $elab_db_filename = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,"default");
 
  }
 
 
 
 
$data_db_file  = "${home}/dbs/${vendor}_${library}_${destination}.db";
if(-e $elab_db_filename)
 
  {
 
  exit;
 
  # "$data_db_file Exists\n";
 
  }
 
 
 
print "ELAB_VERILOG ${vendor}_${library}_${component}_${version}  $env  $tool  $unit || $name || $data_db_file   \n";
 
 
#print "ELAB_XXXXX ${vendor}_${library}_${component}_${version}  $env  $tool  $unit || $name || $data_db_file   \n";
 
 
 
 
my $elab_db  = new BerkeleyDB::Hash( -Filename => "$elab_db_filename", -Flags => DB_CREATE ) or die "Cannot open $elab_db_filename: $!";
 
 
my $elab_db  = new BerkeleyDB::Hash( -Filename => "$data_db_file", -Flags => DB_CREATE ) or die "Cannot open $data_db_file: $!";
 
$elab_db->db_put( "component_${root}","${vendor}:${library}:${component}:${version}"  );
 
$elab_db->db_put( "component___root" ,"${vendor}:${library}:${component}:${version}"  );
$elab_db->db_put( "component___root" ,"${vendor}:${library}:${component}:${version}"  );
 
 
my $repo_data;
my $repo_data;
 
if(defined $name && length $name >0)
 
{
 
$elab_db->db_get("VLNV___${vendor}:${library}:${component}:${version}:${name}", $repo_data );
 
$elab_db->db_put("VLNV___${vendor}:${library}:${component}:${version}:${name}","${repo_data}${root}:::"     );
 
}
 
else
 
{
$elab_db->db_get("VLNV___${vendor}:${library}:${component}:${version}", $repo_data );
$elab_db->db_get("VLNV___${vendor}:${library}:${component}:${version}", $repo_data );
$elab_db->db_put("VLNV___${vendor}:${library}:${component}:${version}","${repo_data}${root}:::"     );
$elab_db->db_put("VLNV___${vendor}:${library}:${component}:${version}","${repo_data}${root}:::"     );
 
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
my @bro_filelist = yp::lib::parse_component_brothers($vendor,$library,$component,$version);
 
 
 
foreach $bro (@bro_filelist)
 
  {
 
  my $ven;
 
  my $lib;
 
  my $cmp;
 
  my $ver;
 
  my $xxx;
 
 
 
 
 
  ( ${xxx},${ven},${lib},${cmp},${ver}) = split( /::/ , $bro);
 
 
 
#print " $bro  - ${ven} -${lib} -${cmp} -${ver} -${xxx} \n";
 
  my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($ven,$lib,$cmp,$ver));
 
 
 
 
 
my $loc_comp_xml_sep    = yp::lib::find_comp_xml_sep($ven,$lib,$cmp,$ver);
 
my $loc_lib_comp_sep    = yp::lib::find_lib_comp_sep($ven,$lib,$cmp);
 
 
 
  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_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($fileSet_name)       = $i_name ->findnodes('../../spirit:name/text()')->to_literal ;
 
 
 
       if(${file_usertype} eq "libraryDir" )
 
       {
 
       $elab_db->db_put( "FILE_${file_type}_${fileSet_name}_${file_usertype}__${file_name}","${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/${file_name}"  );
 
 
 
       }
 
       else
 
 
 
       {
 
       $elab_db->db_put( "FILE_${file_type}_${fileSet_name}_${file_usertype}__${file_name}","${ven}__${lib}${loc_lib_comp_sep}${cmp}${loc_comp_xml_sep}/${file_name}"  );
 
 
 
       }
 
 
 
 
 
       }
 
 
 
 
 
 
 
}
 
 
 
 
 
 
 
 
 
 
Line 198... Line 262...
             if($ise_param_name)
             if($ise_param_name)
               {
               {
               $elab_db->db_put( "parameter_${root}__${ise_param_name}","${ise_param}"  );
               $elab_db->db_put( "parameter_${root}__${ise_param_name}","${ise_param}"  );
               }
               }
             }
             }
 
 
 
 
 
 
          }
          }
 
 
 
 
 
 
 
 
 
 
     #/**********************************************************************/
     #/**********************************************************************/
     #/*                                                                    */
     #/*                                                                    */
     #/* if configuration set then read parameters from socgen:componentConfiguration file      */
     #/* if configuration set then read parameters from socgen:componentConfiguration file      */
     #/*                                                                    */
     #/*                                                                    */
     #/**********************************************************************/
     #/**********************************************************************/
Line 234... Line 296...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
        foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:configurations/socgen:configuration/socgen:version[text() = '$version']/../socgen:parameters/socgen:parameter/socgen:name"))
 
          {
 
          my($param_name)         = $socgen_cfg->findnodes('./text()')->to_literal ;
 
          my($param_value)        = $socgen_cfg->findnodes('../socgen:value/text()')->to_literal ;
 
 
 
            my $repo_data;
 
            $elab_db->db_get("parameter_${root}__${param_name}", $repo_data );
 
            unless (defined $repo_data)
 
              {
 
              $elab_db->db_put( "parameter_${root}__${param_name}","${param_value}"  );
 
              }
 
          }
 
 
 
 
foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:${env}/socgen:${tool}/socgen:${unit}/socgen:variant"))
foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:${env}/socgen:${tool}/socgen:${unit}/socgen:variant"))
     {
     {
     my($variant_name)     = $socgen_cfg->findnodes('./text()')->to_literal ;
     my($variant_name)     = $socgen_cfg->findnodes('./text()')->to_literal ;
     my $configuration        = $socgen_cfg->findnodes('../socgen:configuration/text()')->to_literal ;
     my $configuration        = $socgen_cfg->findnodes('../socgen:configuration/text()')->to_literal ;
     #/**********************************************************************/
     #/**********************************************************************/
Line 268... Line 346...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
elaborate( "${root}","${vendor}","${library}","${component}","${version}"  );
elaborate( "${root}","${vendor}","${library}","${component}","${version}"  );
 
 
my $root                =      "root";
my $root                =      "root";
 
 
my $key;
my $key;
Line 323... Line 404...
   my $elab_component      = pop(@params);
   my $elab_component      = pop(@params);
   my $elab_library        = pop(@params);
   my $elab_library        = pop(@params);
   my $elab_vendor         = pop(@params);
   my $elab_vendor         = pop(@params);
   my $elab_root           = pop(@params);
   my $elab_root           = pop(@params);
 
 
   my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($elab_vendor,$elab_library,$elab_component,$elab_version));
 
 
 
 
 
 
 
 
 
 
 
 
 
#   print "ELABORATING $elab_root  $elab_vendor $elab_library $elab_component $elab_version \n";
#   print "ELABORATING $elab_root  $elab_vendor $elab_library $elab_component $elab_version \n";
 
   my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($elab_vendor,$elab_library,$elab_component,$elab_version));
 
 
 
    my $io_busses_filename = yp::lib::get_io_busses_db_filename($elab_vendor,$elab_library,$elab_component,$elab_version,"default");
 
    my $comp_io_busses_db  = new BerkeleyDB::Hash( -Filename => "$io_busses_filename", -Flags => DB_CREATE ) or die "Cannot open $io_busses_filename    : $!";
 
    my $cursor = $comp_io_busses_db ->db_cursor() ;
 
    while ($cursor->c_get($key, $value, DB_NEXT) == 0)
 
      {
 
      my $name;
 
      my $sense;
 
      ( ${key_type},${name},${sense}) = split( /\./ , $key);
 
      if($key_type eq "AbsDef")
 
        {
 
#        print "BUS-- ${elab_root}  |||  $name $sense  ===   $value  \n";
 
        my $repo_data;
 
        $elab_db->db_get("businterface_${elab_root}__${name}", $repo_data );
 
        unless (defined $repo_data)
 
            {
 
#            print "BUS--:::  \n";
 
            $elab_db->db_put( "busInterface_${elab_root}__${name}","busInterface:${sense}:${value}"  );
 
            }
 
        }
 
      }
 
    my $status = $cursor->c_close() ;
 
 
 
 
   parse_component_file($spirit_component_file,$elab_root);
   parse_component_file($spirit_component_file,$elab_root);
   parse_design_files($spirit_component_file,$elab_root);
   parse_design_files($spirit_component_file,$elab_root);
   #print "Exit $elab_root   \n";
   #print "Exit $elab_root   \n";
   return;
   return;
}
}
Line 365... Line 476...
   my($new_version)         = $new_comp->findnodes('../spirit:version/text()')->to_literal ;
   my($new_version)         = $new_comp->findnodes('../spirit:version/text()')->to_literal ;
 #  print "PARSE component file $elab_root $new_vendor $new_library $new_name    $new_version         \n";
 #  print "PARSE component file $elab_root $new_vendor $new_library $new_name    $new_version         \n";
 
 
 
 
 
 
 
  my $parent_socgen_filename              = yp::lib::find_componentConfiguration($new_vendor,$new_library,$new_name);
 
 
 
  if ($parent_socgen_filename)
 
 
     #/**********************************************************************/
    {
     #/*                                                                    */
 
     #/* parse parameters and values                                        */
 
     #/*                                                                    */
 
     #/**********************************************************************/
 
 
 
     foreach  my   $i_name ($spirit_component_file->findnodes('//spirit:model/spirit:modelParameters/spirit:modelParameter/spirit:name'))
     my $parent_socgen_file    = $parser->parse_file($parent_socgen_filename);
 
        foreach my $socgen_cfg ($parent_socgen_file->findnodes("//socgen:componentConfiguration/socgen:configurations/socgen:configuration/socgen:version[text() = '$new_version']/../socgen:parameters/socgen:parameter/socgen:name"))
        {
        {
        my($parameter_name)     = $i_name ->to_literal;
          my($param_name)         = $socgen_cfg->findnodes('./text()')->to_literal ;
        my($parameter_default)  = $i_name ->findnodes('../spirit:value/text()')->to_literal ;
          my($param_default)      = $socgen_cfg->findnodes('../socgen:value/text()')->to_literal ;
 
#         print "KKKKKKKK  parameter_${elab_root}__${param_name}   $param_default \n";
        my $repo_data;
        my $repo_data;
        $elab_db->db_get("parameter_${elab_root}__${parameter_name}", $repo_data );
          $elab_db->db_get("parameter_${elab_root}__${param_name}", $repo_data );
 
 
 
 
        unless (defined $repo_data)
        unless (defined $repo_data)
            {
            {
 
            $elab_db->db_put( "parameter_${elab_root}__${param_name}","${param_default}"  );
            $elab_db->db_put( "parameter_${elab_root}__${parameter_name}","${parameter_default}"  );
 
 
 
 
 
            }
            }
        }
        }
 
     };
 
 
 
 
     #/**********************************************************************/
     #/**********************************************************************/
     #/*                                                                    */
     #/*                                                                    */
     #/* parse businterfaces                                                */
     #/* parse parameters and values                                        */
     #/*                                                                    */
     #/*                                                                    */
     #/**********************************************************************/
     #/**********************************************************************/
 
 
 
     foreach  my   $i_name ($spirit_component_file->findnodes('//spirit:model/spirit:modelParameters/spirit:modelParameter/spirit:name'))
    my $main_module_name = yp::lib::get_module_name($new_vendor,$new_library,$new_name,$new_version);
 
 
 
    if($main_module_name)
 
    {
 
    my $io_busses_filename = yp::lib::get_io_busses_db_filename($new_vendor,$new_library,$new_name,$new_version);
 
    $comp_io_busses_db  = new BerkeleyDB::Hash( -Filename => "$io_busses_filename", -Flags => DB_CREATE ) or die "Cannot open $io_busses_filename    : $!";
 
    my $cursor = $comp_io_busses_db ->db_cursor() ;
 
    while ($cursor->c_get($key, $value, DB_NEXT) == 0)
 
      {
 
      ( ${key_type},${name},${sense}) = split( /\./ , $key);
 
      if($key_type eq "AbsDef")
 
        {
        {
#        print "BUS-- ${elab_root}  |||  $name $sense  ===   $value  \n";
        my($parameter_name)     = $i_name ->to_literal;
 
        my($parameter_default)  = $i_name ->findnodes('../spirit:value/text()')->to_literal ;
        my $repo_data;
        my $repo_data;
        $elab_db->db_get("businterface_${elab_root}__${name}", $repo_data );
        $elab_db->db_get("parameter_${elab_root}__${parameter_name}", $repo_data );
 
 
 
 
        unless (defined $repo_data)
        unless (defined $repo_data)
            {
            {
#            print "BUS--:::  \n";
            $elab_db->db_put( "parameter_${elab_root}__${parameter_name}","${parameter_default}"  );
            $elab_db->db_put( "busInterface_${elab_root}__${name}","busInterface:${sense}:${value}"  );
 
            }
 
        }
        }
      }
      }
    my $status = $cursor->c_close() ;
 
    }
    }
 
 
 
 
 
 
 
 
 
 
        }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Line 581... Line 671...
            my($version_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
            my($version_name)        = $x_name  ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
            #print "INSTANCED $instance_name  $vendor_name $library_name $component_name $version_name   \n";
            #print "INSTANCED $instance_name  $vendor_name $library_name $component_name $version_name   \n";
            $elab_db->db_put( "component___${elab_root}.${instance_name}","${vendor_name}:${library_name}:${component_name}:${version_name}"  );
            $elab_db->db_put( "component___${elab_root}.${instance_name}","${vendor_name}:${library_name}:${component_name}:${version_name}"  );
 
 
            my $repo_data;
            my $repo_data;
 
            if(defined $name && length $name >0)
 
            {
 
            $elab_db->db_get("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}:${name}", $repo_data );
 
            $elab_db->db_put("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}:${name}","${repo_data}${elab_root}.${instance_name}:::");
 
            }
 
            else
 
            {
            $elab_db->db_get("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}", $repo_data );
            $elab_db->db_get("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}", $repo_data );
            $elab_db->db_put("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}","${repo_data}${elab_root}.${instance_name}:::");
            $elab_db->db_put("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}","${repo_data}${elab_root}.${instance_name}:::");
 
            }
 
            my $cmd ="./tools/verilog/elab_verilog -vendor ${vendor_name} -library ${library_name} -component ${component_name} -version ${version_name}\n";
 
 
            if  ($instance_name)
            if(system($cmd)){}
              {
 
 
 
 
 
 
 
 
            if  ($instance_name)
 
              {
            foreach  my   $i_parameter ($spirit_design_file->findnodes("//spirit:componentInstance[spirit:instanceName/text() = '$instance_name']/spirit:configurableElementValues/spirit:configurableElementValue/\@spirit:referenceId"))
            foreach  my   $i_parameter ($spirit_design_file->findnodes("//spirit:componentInstance[spirit:instanceName/text() = '$instance_name']/spirit:configurableElementValues/spirit:configurableElementValue/\@spirit:referenceId"))
             {
             {
             my($foo_name)       = $i_parameter ->to_literal ;
             my($foo_name)       = $i_parameter ->to_literal ;
             my($foo_value)      = $i_parameter ->findnodes('../text()')->to_literal ;
             my($foo_value)      = $i_parameter ->findnodes('../text()')->to_literal ;
 
 
 
             my $fee_value       = $foo_value;
 
             my $p_key;
 
             my $p_value;
 
             my $p_cursor = $elab_db ->db_cursor() ;
 
             while ($p_cursor->c_get($p_key, $p_value, DB_NEXT) == 0)
 
                 {
 
                 $_ = $p_key;
 
                 #   print  "--->  $p_key   $p_value   \n";
 
                 if(/parameter_${elab_root}__(\S+)/)
 
                   {
 
                   if($1 eq $p_value)
 
                     {
 
                     print "DDDDDDDDDDDDDDDDDDDDDDDDDD  $p_key $p_value \n";
 
                     }
 
                   else
 
                    {
 
                   $fee_value   = math::lib::parse($fee_value,$1,$p_value);
 
                    }
 
                   }
 
                 }
 
              my $status = $p_cursor->c_close() ;
 
 
 
 
 
 
 
 
 
 
 
# replace this!!!
 
#  scan for all names in db_get("parameter_${elab_root}__${name}", $repo_data
 
# and substitute $repo_data anywhere in $foo_value
 
# then run $foo_value thru sys/math
 
 
 
 
             $_ = $foo_value;
             $_ = $foo_value;
             my $t_name;
             my $t_name;
             my $t_op;
             my $t_op;
             my $repo_data;
             my $repo_data;
 
 
Line 612... Line 744...
               }
               }
              else
              else
               {
               {
               $repo_data = $repo_data + $t_op ;
               $repo_data = $repo_data + $t_op ;
               }
               }
 
 
#              print "GGGGGGGHHHH  $foo_value $t_name $t_op     $repo_data    \n";
 
              }
              }
             else
             else
 
 
 
# end replace
 
 
              {
              {
              $elab_db->db_get("parameter_${elab_root}__${foo_value}", $repo_data );
              $elab_db->db_get("parameter_${elab_root}__${foo_value}", $repo_data );
              unless  (defined $repo_data)
              unless  (defined $repo_data)
               {
               {
               $repo_data = $foo_value ;
               $repo_data = $foo_value ;
               }
               }
              }
              }
 
 
             $elab_db->db_put( "parameter_${elab_root}.${instance_name}__${foo_name}","${repo_data}"  );
             $elab_db->db_put( "parameter_${elab_root}.${instance_name}__${foo_name}","${repo_data}"  );
             $elab_db->db_put( "Parameter_${elab_root}.${instance_name}__${foo_name}","${foo_value}"  );
             $elab_db->db_put( "Parameter_${elab_root}.${instance_name}__${foo_name}","${foo_value}"  );
 
              $elab_db->db_put( "Xarameter_${elab_root}.${instance_name}__${foo_name}","${fee_value}"  );
#             print "PARAMETERE  ${elab_root}.${instance_name}   $foo_name    $repo_data   <- $foo_value  \n";
#             print "PARAMETERE  ${elab_root}.${instance_name}   $foo_name  p_  $repo_data   P_ $foo_value  X_  $fee_value \n";
 
 
             }
             }
 
 
             elaborate( "${elab_root}.${instance_name}","${vendor_name}","${library_name}","${component_name}","${version_name}"  );
             elaborate( "${elab_root}.${instance_name}","${vendor_name}","${library_name}","${component_name}","${version_name}"  );
             }
             }
            }
            }
Line 640... Line 772...
   }
   }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.