Line 94... |
Line 94... |
##
|
##
|
##
|
##
|
#############################################################################
|
#############################################################################
|
|
|
$home = cwd();
|
$home = cwd();
|
|
my @elab_config_cmds = ();
|
|
|
unless ($prefix)
|
unless ($prefix)
|
{
|
{
|
$prefix = yp::lib::get_workspace();
|
$prefix = yp::lib::get_workspace();
|
$prefix = "/${prefix}";
|
$prefix = "/${prefix}";
|
}
|
}
|
|
|
|
|
my $variant;
|
|
my $configuration;
|
my $configuration;
|
my $config_index;
|
my $config_index;
|
|
|
|
|
|
my $DEST_file;
|
|
|
my $main_module_name = yp::lib::get_module_name($vendor,$library,$component,$version) ;
|
my $main_module_name = yp::lib::get_module_name($vendor,$library,$component,$version) ;
|
my $destination = "${main_module_name}";
|
my $destination = "${main_module_name}";
|
|
|
if(defined $name)
|
if(defined $name)
|
{
|
{
|
Line 126... |
Line 124... |
|
|
|
|
|
|
my $root = "root";
|
my $root = "root";
|
|
|
if($version) {$variant = "${component}_${version}";}
|
|
else {$variant = "${component}";}
|
|
|
|
if($name) {$variant = "${variant}_${name}";}
|
|
|
|
|
|
|
print "gen_design -vendor $vendor -library $library -component $component -version $version -name $name \n";
|
#print "gen_design -prefix $prefix -vendor $vendor -library $library -component $component -version $version -name $name \n";
|
|
|
|
|
|
my $parser = XML::LibXML->new();
|
my $parser = XML::LibXML->new();
|
|
|
|
|
Line 157... |
Line 149... |
|
|
$path = "${home}/${dest_dir}";
|
$path = "${home}/${dest_dir}";
|
|
|
mkdir $path,0755 unless( -e $path );
|
mkdir $path,0755 unless( -e $path );
|
|
|
|
my $elab_db_file;
|
|
|
$data_db_file = "${home}/dbs/${vendor}_${library}_${variant}.db";
|
if($name)
|
|
|
|
|
|
|
if(-e $data_db_file )
|
|
{
|
{
|
# print "$data_db_file does exist \n";
|
$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");
|
}
|
}
|
|
|
|
|
|
|
#print "ELAB_XXXXX gen design $data_db_file \n";
|
#print "ELAB_XXXXX gen design $elab_db_file \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 => "$elab_db_file", -Flags => DB_CREATE ) or die "Cannot open $elab_db_file: $!";
|
|
|
my $repo_data;
|
my $repo_data;
|
$elab_db->db_get("VLNV___${vendor}:${library}:${component}:${version}", $repo_data );
|
$elab_db->db_get("VLNV___${vendor}:${library}:${component}:${version}", $repo_data );
|
|
|
#print "GEN_DESIGN $data_db_file $repo_data \n";
|
#print "GEN_DESIGN $elab_db_file $repo_data \n";
|
|
|
|
|
$design_db_file = "${home}/dbs/design.dbm";
|
$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: $!";
|
my $design_db = new BerkeleyDB::Hash( -Filename => "$design_db_file", -Flags => DB_CREATE ) or die "Cannot open $design_db_file: $!";
|
|
|
|
|
|
# Grab the pointer to the last config used, if none then start it
|
|
|
|
|
$design_db->db_get("INDEX", $config_index );
|
$design_db->db_get("INDEX", $config_index );
|
|
|
unless(defined $config_index)
|
unless(defined $config_index)
|
{
|
{
|
$config_index = 1;
|
$config_index = 1;
|
}
|
}
|
$design_db->db_put( "INDEX","$config_index" );
|
$design_db->db_put( "INDEX","$config_index" );
|
|
|
|
# Provide a default for components with no parameters
|
|
|
|
$design_db->db_put( "CONFIG___","config_0" );
|
|
|
my $key;
|
my $key;
|
my $value;
|
my $value;
|
|
|
|
|
Line 236... |
Line 231... |
|
|
if("${vendor}_${library}_${component}_${version}" eq "${ven}_${lib}_${cmp}_${ver}")
|
if("${vendor}_${library}_${component}_${version}" eq "${ven}_${lib}_${cmp}_${ver}")
|
{
|
{
|
if(defined $name)
|
if(defined $name)
|
{
|
{
|
$design_ver = "${path}/${ven}__${lib}/${cmp}/${main_module_name}_${name}";
|
$design_ver = "${path}/${ven}__${lib}/${cmp}/${main_module_name}";
|
}
|
}
|
else
|
else
|
{
|
{
|
$design_ver = "${path}/${ven}__${lib}/${cmp}/${main_module_name}";
|
$design_ver = "${path}/${ven}__${lib}/${cmp}/${main_module_name}";
|
}
|
}
|
Line 266... |
Line 261... |
( ${VLNV},${vlnv}) = split( /__/ , $key);
|
( ${VLNV},${vlnv}) = split( /__/ , $key);
|
if(${VLNV} eq "parameter_${inst}" )
|
if(${VLNV} eq "parameter_${inst}" )
|
{
|
{
|
push @params, "${vlnv}--${value}";
|
push @params, "${vlnv}--${value}";
|
}
|
}
|
|
|
}
|
}
|
|
my $status = $P_cursor->c_close() ;
|
my $design_name ="$${root_name}_${inst}";
|
|
$design_name =~s/_root//;
|
|
|
|
|
|
|
|
my $outfile = "${design_ver}/${root_name}_${inst}";
|
my $outfile = "${design_ver}/${root_name}_${inst}";
|
$outfile =~s/_root//;
|
$outfile =~s/_root//;
|
if(defined $name)
|
if(defined $name)
|
{
|
{
|
$outfile = "${outfile}_${name}";
|
$outfile = "${outfile}_${name}";
|
}
|
}
|
|
|
open DEST_FILE,">$outfile" or die "unable to open $outfile";
|
|
@params = sys::lib::trim_sort(@params);
|
|
|
|
|
|
|
|
|
$DEST_file = $outfile;
|
|
@params = sys::lib::trim_sort(@params);
|
|
|
my $param_str;
|
my $param_str;
|
|
|
foreach my $param (@params)
|
foreach my $param (@params)
|
{
|
{
|
print DEST_FILE "${param} \n";
|
|
$param_str = "${param}:::${param_str}";
|
$param_str = "${param}:::${param_str}";
|
}
|
}
|
close DEST_FILE;
|
|
|
|
my $status = $P_cursor->c_close() ;
|
|
|
|
|
my $config_data = "none";
|
|
|
|
$design_db->db_get("CONFIG___${param_str}", $config_data );
|
|
|
|
|
|
if( $config_data eq "none" )
|
|
{
|
|
$config_index = $config_index + 1;
|
|
$design_db->db_put( "CONFIG___${param_str}","config_${config_index}" );
|
|
$config_data ="config_${config_index}"
|
|
}
|
|
|
|
|
|
|
my $config_data = "none";
|
my $outfile = "${design_ver}/${config_data}";
|
|
mkdir $outfile,0755 unless( -e $outfile );
|
|
|
$design_db->db_get("CONFIG___${param_str}", $config_data );
|
$Busses_file = "${design_ver}/${config_data}/BUSSES.db";
|
|
|
|
|
|
$Busses_db = new BerkeleyDB::Hash( -Filename => "$Busses_file", -Flags => DB_CREATE ) or die "Cannot open ${Busses_file}: $!";
|
|
|
|
foreach my $param (@params)
|
|
{
|
|
my $name;
|
|
my $value;
|
|
|
|
( ${name},${value}) = split( /--/ , $param);
|
|
|
|
$Busses_db->db_put( "Param_${name}","${value}");
|
|
|
if( $config_data eq "none" )
|
|
{
|
|
$config_index = $config_index + 1;
|
|
$design_db->db_put( "CONFIG___${param_str}","config_${config_index}" );
|
|
$config_data ="config_${config_index}"
|
|
}
|
}
|
|
|
|
|
if(defined $name)
|
$Busses_db->db_close();
|
{
|
|
$design_db->db_put( "TOP_${ven}__${lib}_${cmp}_${main_module_name}_${name}","$param_str" );
|
|
$design_db->db_put( "TAP_${ven}__${lib}_${cmp}_${main_module_name}_${name}","$config_data" );
|
|
}
|
|
|
|
|
|
|
$DEST_file = "${DEST_file}_${config_data}";
|
|
|
|
open DEST_FILE,">$DEST_file" or die "unable to open $DEST_file";
|
|
print DEST_FILE " $param_str \n";
|
|
|
$Index_file = "${design_ver}/Config.db";
|
close DEST_FILE;
|
|
|
if(-e"${design_ver}/root/Index.db" )
|
my $cmd = "./tools/verilog/elab_config_verilog -vendor ${ven} -library ${lib} -component ${cmp} -version ${ver} -configuration $config_data \n";
|
{
|
|
# print "TOP LEVEL gen_design Config.db $Index_file \n";
|
|
}
|
|
|
|
|
push @elab_config_cmds, $cmd;
|
|
|
$Index_db = new BerkeleyDB::Hash( -Filename => "$Index_file", -Flags => DB_CREATE ) or die "Cannot open ${Index_file}: $!";
|
my $cmd = "./tools/verilog/gen_root -vendor ${ven} -library ${lib} -component ${cmp} -version ${ver} -configuration $config_data -name $config_data \n";
|
$Index_db->db_put( "CONFIG","${config_data}");
|
# if(system($cmd)){};
|
$Index_db->db_close();
|
|
|
|
|
|
|
|
|
$Index_file = "${design_ver}/Config.db";
|
|
|
my $outfile = "${design_ver}/${config_data}";
|
|
open DEST_FILE,">$outfile" or die "unable to open $outfile";
|
|
|
|
foreach my $param (@params)
|
|
{
|
|
print DEST_FILE "${param} \n";
|
|
}
|
|
|
|
close DEST_FILE;
|
$Index_db = new BerkeleyDB::Hash( -Filename => "$Index_file", -Flags => DB_CREATE ) or die "Cannot open ${Index_file}: $!";
|
|
$Index_db->db_put( "${config_data}","Config");
|
|
$Index_db->db_close();
|
|
|
|
|
|
|
|
|
|
|
if($param_str)
|
if(defined $param_str)
|
|
{
|
|
if(defined $name)
|
|
{
|
|
$design_db->db_put( "instance_${root_name}_${name}_${inst}","${ven}:${lib}:${cmp}:${ver}:${config_data}" );
|
|
$design_db->db_put( "Params__${ven}_${lib}_${cmp}_${ver}__${param_str}" ,"${root_name}_${name}_${inst}" );
|
|
}
|
|
else
|
{
|
{
|
$design_db->db_put( "instance_${root_name}_${inst}","${ven}:${lib}:${cmp}:${ver}:${config_data}" );
|
$design_db->db_put( "instance_${root_name}_${inst}","${ven}:${lib}:${cmp}:${ver}:${config_data}" );
|
$design_db->db_put( "params__${ven}_${lib}_${cmp}_${ver}__${param_str}" ,"${root_name}_${inst}" );
|
$design_db->db_put( "params__${ven}_${lib}_${cmp}_${ver}__${param_str}" ,"${root_name}_${inst}" );
|
}
|
}
|
|
|
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
|
|
my $status = $cursor->c_close() ;
|
my $status = $cursor->c_close() ;
|
$design_db->db_put( "INDEX","${config_index}" );
|
$design_db->db_put( "INDEX","${config_index}" );
|
$elab_db -> db_close();
|
$elab_db -> db_close();
|
$design_db -> db_close();
|
$design_db -> db_close();
|
|
|
|
@elab_config_cmds = sys::lib::trim_sort(@elab_config_cmds);
|
|
|
|
|
|
foreach my $cmd (@elab_config_cmds)
|
|
{
|
|
|
|
if(system($cmd)){};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1
|
1
|
|
|