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

Subversion Repositories socgen

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

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

Rev 133 Rev 134
Line 73... Line 73...
           "library=s" => \$library,
           "library=s" => \$library,
           "component=s" => \$component,
           "component=s" => \$component,
           "version=s" => \$version,
           "version=s" => \$version,
           "configuration=s" => \$configuration,
           "configuration=s" => \$configuration,
           "dest_dir=s" => \$dest_dir,
           "dest_dir=s" => \$dest_dir,
           "env=s" => \$env,
 
           "tool=s" => \$tool,
 
           "unit=s" => \$unit,
 
           "name=s" => \$name
           "name=s" => \$name
 
 
) || 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_root -envidentifier {sim/syn}  -prefix /work -vendor vendor_name -library library_name  -component component_name  -version version_name -env env -tool tool -unit unit -name name     \n";
  { print "\n gen_root -envidentifier {sim/syn}  -prefix /work -vendor vendor_name -library library_name  -component component_name  -version version_name   -name name     \n";
    exit 1;
    exit 1;
  }
  }
 
 
 
 
 
 
Line 105... Line 102...
 {
 {
 $prefix   = yp::lib::get_workspace();
 $prefix   = yp::lib::get_workspace();
 $prefix   =  "/${prefix}";
 $prefix   =  "/${prefix}";
 }
 }
 
 
 
 
my   $variant;
my   $variant;
 
 
 
 
 
 
 
 
 
 
my $destination       = yp::lib::get_module_name($vendor,$library,$component,$version);
my $destination       = yp::lib::get_module_name($vendor,$library,$component,$version);
 
 
unless ($env ) {$env = "none";}
 
unless ($tool ){$tool = "none";}
 
unless ($unit ){$unit = "none";}
 
 
 
if($name)
if($name)
  {
  {
  $destination   = "${destination}_${name}";
  $destination   = "${destination}";
  }
  }
else
else
  {
  {
#  $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 "GEN_ROOT -prefix $prefix -vendor $vendor -library $library -component $component -version $version   -env $env -tool $tool -unit $unit -name $name     \n";
print "GEN_ROOT  -vendor $vendor -library $library -component $component -version $version  -name $name     \n";
 
 
 
 
my $parser = XML::LibXML->new();
my $parser = XML::LibXML->new();
 
 
 
 
Line 150... Line 133...
 
 
 
 
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);
 
 
 
my $elab_db_file;
 
 
$dest_dir = yp::lib::get_io_ports();
if(defined $name)
 
{
 
$elab_db_file = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,$name);
 
}
 
else
 
{
 
$elab_db_file = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,"default");
 
}
 
 
my $path  = "${home}/${dest_dir}";
my $elab_db  = new BerkeleyDB::Hash( -Filename => "$elab_db_file", -Flags => DB_CREATE ) or die "Cannot open $elab_db_file: $!";
 
 
 
$design_db_file  = yp::lib::get_design_db_file;
 
my $design_db  = new BerkeleyDB::Hash( -Filename => "$design_db_file", -Flags => DB_CREATE ) or die "Cannot open $design_db_file: $!";
 
 
 
 
 
unless (defined $configuration && length $configuration > 0)
 
{
 
my $h_ven;
 
my $h_lib;
 
my $h_cmp;
 
my $h_ver;
 
my $h_config;
 
 
 
    my $config_key;
 
    my $config_index;
 
 
 
    if(defined $name)
 
    {
 
    $config_key ="instance_${vendor}_${library}_${component}_${version}_${name}_root";
 
     }
 
    else
 
    {
 
    $config_key ="instance_${vendor}_${library}_${component}_${version}_root";
 
     }
 
    $design_db->db_get($config_key, $config_index );
 
   ( ${h_ven},${h_lib},${h_cmp},${h_ver},${h_config}) = split( /\:/ , $config_index);
 
 
 
$configuration = $h_config;
 
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
$dest_dir = yp::lib::get_io_ports();
 
my $path  = "${home}/${dest_dir}";
 
 
 
 
mkdir $path,0755      unless( -e $path );
mkdir $path,0755      unless( -e $path );
 
 
$path ="${path}/${vendor}__${library}";
$path ="${path}/${vendor}__${library}";
Line 169... Line 202...
 
 
 
 
 
 
  unless( -e "${path}/${destination}" )
  unless( -e "${path}/${destination}" )
      {
      {
#      print "$path/${destination} does not exist... creating \n";
 
      my $cmd = "mkdir $path/${destination}  \n";
      my $cmd = "mkdir $path/${destination}  \n";
      if(system($cmd)){};
      if(system($cmd)){};
      }
      }
 
 
 
 
 
$destination ="${destination}/${configuration}";
 
 
if(defined $name)
 
 
  unless( -e "${path}/${destination}" )
{
{
$data_db_file  = "${home}/dbs/${vendor}_${library}_${component}_${version}_${name}.db";
      my $cmd = "mkdir $path/${destination}  \n";
 
      if(system($cmd)){};
}
}
else
 
 
 
 
  if( -e "${path}/${destination}/root" )
{
{
$data_db_file  = "${home}/dbs/${vendor}_${library}_${component}_${version}.db";
      exit;
 
      #print "${path}/${destination}/root exists \n";
 
 
}
}
 
 
#print "ELAB_XXXX gen_root $data_db_file  \n";
 
my $elab_db  = new BerkeleyDB::Hash( -Filename => "$data_db_file", -Flags => DB_CREATE ) or die "Cannot open $data_db_file: $!";
 
 
 
 
 
my $root                =      "root";
my $root                =      "root";
 
 
my $key;
my $key;
Line 212... Line 249...
      }
      }
   }
   }
my $status = $cursor->c_close() ;
my $status = $cursor->c_close() ;
 
 
 
 
 
my @file_names = ();
 
my $file_name = "${path}/${destination}/${root}/Index.db";
 
push @file_names, $file_name;
 
 
 
 
 
 
 
 
 
$cursor = $elab_db ->db_cursor() ;
 
while ($cursor->c_get($key, $value, DB_NEXT) == 0)
 
   {
 
   $_ = $key;
 
   if($key eq "component___root")
 
    {
 
 
 
    my $file_name = "${path}/${destination}/${root}/Index.db";
 
    my $param_db  = new BerkeleyDB::Hash( -Filename => "$file_name", -Flags => DB_CREATE ) or die "Cannot open ${file_name}: $!";
 
       $param_db->db_put( "PATH","root");
 
       $param_db->db_put( "VLNV","${value}");
 
       $param_db->db_close();
 
    }
 
   elsif (/component___root\.(\S+)/)
 
    {
 
 
 
    my $xpath = $1;
 
    my $ypath = $1;
 
    $xpath =~ s/\./\//g;
 
 
 
 
 
    my $file_name = "${path}/${destination}/root/${xpath}/Index.db";
 
    push @file_names, $file_name;
 
 
 
 
 
    my $param_db  = new BerkeleyDB::Hash( -Filename => "$file_name", -Flags => DB_CREATE ) or die "Cannot open ${file_name}: $!";
 
       $param_db->db_put( "PATH","root.${ypath}");
 
       $param_db->db_put( "VLNV","${value}");
 
       $param_db->db_close();
 
    }
 
   }
 
$status = $cursor->c_close() ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
$cursor = $elab_db ->db_cursor() ;
$cursor = $elab_db ->db_cursor() ;
while ($cursor->c_get($key, $value, DB_NEXT) == 0)
while ($cursor->c_get($key, $value, DB_NEXT) == 0)
   {
   {
Line 228... Line 313...
       $param_db->db_close();
       $param_db->db_close();
    }
    }
   elsif (/parameter_${root}(\S+)__(\S+)/)
   elsif (/parameter_${root}(\S+)__(\S+)/)
    {
    {
    my $xpath = $1;
    my $xpath = $1;
 
    my $ypath = $1;
    $xpath =~ s/\./\//g;
    $xpath =~ s/\./\//g;
    my $file_name = "${path}/${destination}/${root}/${xpath}/Index.db";
    my $file_name = "${path}/${destination}/${root}${xpath}/Index.db";
 
    push @file_names, $file_name;
    my $param_db  = new BerkeleyDB::Hash( -Filename => "$file_name", -Flags => DB_CREATE ) or die "Cannot open ${file_name}: $!";
    my $param_db  = new BerkeleyDB::Hash( -Filename => "$file_name", -Flags => DB_CREATE ) or die "Cannot open ${file_name}: $!";
       $param_db->db_put( "$key","${value}");
       $param_db->db_put( "$key","${value}");
       $param_db->db_close();
       $param_db->db_close();
    }
    }
   }
   }
$status = $cursor->c_close() ;
$status = $cursor->c_close() ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
$cursor = $elab_db ->db_cursor() ;
$cursor = $elab_db ->db_cursor() ;
while ($cursor->c_get($key, $value, DB_NEXT) == 0)
while ($cursor->c_get($key, $value, DB_NEXT) == 0)
   {
   {
   $_ = $key;
   $_ = $key;
   if(/busInterface_${root}__(\S+)/)
   if(/busInterface_${root}__(\S+)/)
    {
    {
    my $file_name = "${path}/${destination}/${root}/Index.db";
    my $file_name = "${path}/${destination}/${root}/Index.db";
    my $param_db  = new BerkeleyDB::Hash( -Filename => "$file_name", -Flags => DB_CREATE ) or die "Cannot open ${file_name}: $!";
    my $param_db  = new BerkeleyDB::Hash( -Filename => "$file_name", -Flags => DB_CREATE ) or die "Cannot open ${file_name}: $!";
       $param_db->db_put( "$key","${value}");
       $param_db->db_put( "$key","${value}");
 
 
       $param_db->db_close();
       $param_db->db_close();
    }
    }
   elsif(/busInterface_${root}(\S+)__(\S+)/)
   elsif(/busInterface_${root}(\S+)__(\S+)/)
    {
    {
    my $xpath = $1;
    my $xpath = $1;
 
    my $ypath = $1;
    my $parname = $2;
    my $parname = $2;
    $xpath =~ s/\./\//g;
    $xpath =~ s/\./\//g;
    my $file_name = "${path}/${destination}/${root}/${xpath}/Index.db";
    my $file_name = "${path}/${destination}/${root}${xpath}/Index.db";
    my $param_db  = new BerkeleyDB::Hash( -Filename => "$file_name", -Flags => DB_CREATE ) or die "Cannot open ${file_name}: $!";
    my $param_db  = new BerkeleyDB::Hash( -Filename => "$file_name", -Flags => DB_CREATE ) or die "Cannot open ${file_name}: $!";
       $param_db->db_put( "$key","${value}");
       $param_db->db_put( "$key","${value}");
       $param_db->db_close();
       $param_db->db_close();
    }
    }
 
   }
 
$status = $cursor->c_close() ;
 
 
 
 
 
 
 
 # here we read the vlnv from param_db
 
 # open it's BUSSES.dbm
 
 # copy all contents
 
 # modify vector left:right by parsing parameters
 
 
 
# print "IIIIIIIIX  $VLNV_copy  \n";
 
 
 
 foreach my $param_c (@param_copy)
 
 {
 
 #print "IIIIIIIII  $param_c  \n";
   }
   }
$status = $cursor->c_close() ;
 
 
 
 
 
 
 
$elab_db->db_close();
$elab_db->db_close();
 
 
 
 
 
@file_names      = sys::lib::trim_sort(@file_names);
 
 foreach my $file_name (@file_names)
 
  {
 
  my $cmd ="./tools/verilog/tag_Index.db $file_name \n";
 
  if(system($cmd)){}
 
 
 
  }
 
 
 
 
 
 
 
 
 
 
Line 295... Line 409...
   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";
 
   $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";
 
     }
     }
 
 
   unless (-e "${path}/${top}")
   unless (-e "${path}/${top}")
     {
     {
     $cmd ="mkdir ${path}/${top} \n";
     $cmd ="mkdir ${path}/${top} \n";
Line 320... Line 430...
     {
     {
     build_hierarchy ("$vlnv","${path}","${top}",@params);
     build_hierarchy ("$vlnv","${path}","${top}",@params);
     }
     }
   else
   else
     {
     {
#     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";
 
 
     $new_elab_db->db_close();
     }
     }
 
 
   return(0);
   return(0);
 
 
   }
   }

powered by: WebSVN 2.1.0

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