Line 41... |
Line 41... |
#/* Public License along with this source; if not, download it */
|
#/* Public License along with this source; if not, download it */
|
#/* from http://www.opencores.org/lgpl.shtml */
|
#/* from http://www.opencores.org/lgpl.shtml */
|
#/* */
|
#/* */
|
#/**********************************************************************/
|
#/**********************************************************************/
|
|
|
|
use Getopt::Long;
|
|
use English;
|
|
use File::Basename;
|
use Cwd;
|
use Cwd;
|
use XML::LibXML;
|
use XML::LibXML;
|
|
use lib './tools';
|
|
use sys::lib;
|
|
use yp::lib;
|
|
|
|
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
|
|
|
|
my $home = cwd();
|
|
|
|
|
#/*********************************************************************************************/
|
#/*********************************************************************************************/
|
#/ We never generate files into a RCS database. */
|
#/ We never generate files into a RCS database. */
|
#/ */
|
#/ */
|
Line 57... |
Line 64... |
#/ */
|
#/ */
|
#/*********************************************************************************************/
|
#/*********************************************************************************************/
|
|
|
|
|
my $project = $ARGV[0];
|
my $project = $ARGV[0];
|
|
my $vendor = $ARGV[1];
|
chomp($project);
|
chomp($project);
|
|
chomp($vendor);
|
|
|
unless ($project) {$project ="fpgas";}
|
unless ($project) {$project ="fpgas";}
|
|
unless ($vendor) {$vendor ="opencores.org";}
|
|
|
|
|
|
my $root = "projects/${vendor}/${project}";
|
|
|
my $root = "projects/opencores.org/${project}";
|
|
$home = cwd();
|
|
my $prefix = "/work/";
|
my $prefix = "/work/";
|
$lib_comp_sep = "/ip/";
|
$lib_comp_sep = "/ip";
|
$comp_xml_sep = "/rtl/xml/";
|
|
$tb_xml_sep = "/sim/xml/";
|
|
|
|
|
|
my $path = "${home}${prefix}";
|
my $path = "${home}${prefix}";
|
mkdir $path,0755 unless( -e $path );
|
mkdir $path,0755 unless( -e $path );
|
|
|
Line 104... |
Line 111... |
|
|
{
|
{
|
symlink( "${home}/tools/bin/Makefile.root", "${home}/work/${project}/bin/Makefile.root");
|
symlink( "${home}/tools/bin/Makefile.root", "${home}/work/${project}/bin/Makefile.root");
|
symlink( "${home}/tools/bin/Makefile", "${home}/work/${project}/bin/Makefile");
|
symlink( "${home}/tools/bin/Makefile", "${home}/work/${project}/bin/Makefile");
|
|
|
$cmd ="chmod 755 ${home}/projects/opencores.org/${project}/bin/* \n";
|
$cmd ="chmod 755 ${home}/projects/${vendor}/${project}/bin/* \n";
|
if (system($cmd)) {}
|
if (system($cmd)) {}
|
|
|
my $path = "${home}${prefix}${project}/children";
|
my $path = "${home}${prefix}${project}/children";
|
mkdir $path,0755 unless( -e $path );
|
mkdir $path,0755 unless( -e $path );
|
|
|
|
|
my @components = qx(ls ${home}/work/${project}/ip );
|
|
|
my @components = yp::lib::find_components("socgen:ip",$vendor,$project);
|
foreach my $component (@components)
|
foreach my $component (@components)
|
{
|
{
|
chomp($component);
|
$cmd ="./tools/sys/build_geda $project $component $vendor /n";
|
|
|
$cmd ="./tools/sys/build_geda $project $component /n";
|
|
if (system($cmd)) {}
|
if (system($cmd)) {}
|
|
|
my $parser = XML::LibXML->new();
|
my $parser = XML::LibXML->new();
|
my $doc = $parser->parse_file("${home}${prefix}${project}${lib_comp_sep}${component}/ip-xact/design.xml");
|
|
|
|
|
|
|
my $socgen_ip_file = $parser->parse_file(yp::lib::find_socgen("socgen:ip",$vendor,$project,$component));
|
|
|
#/*********************************************************************************************/
|
#/*********************************************************************************************/
|
#/ */
|
#/ */
|
#/ */
|
#/ */
|
#/*********************************************************************************************/
|
#/*********************************************************************************************/
|
|
|
foreach my $i_name ($doc->findnodes("//components/component/name"))
|
my @versions = yp::lib::find_versions("spirit:component",$vendor,$project,$component);
|
{
|
|
my($comp_name) = $i_name ->findnodes('./text()')->to_literal ;
|
|
my($comp_version) = $i_name ->findnodes('../version/text()')->to_literal ;
|
|
|
|
my $comp_variant = "";
|
|
if($comp_version) {$comp_variant = "${comp_name}_${comp_version}"}
|
|
else {$comp_variant = "${comp_name}"}
|
|
|
|
$cmd ="./tools/sys/soc_link_child -vendor opencores.org -project $project -lib_comp_sep $lib_comp_sep -component $component -comp_xml_sep $comp_xml_sep -variant $comp_variant $comp_xml_sep /n";
|
foreach $comp_version (@versions)
|
|
{
|
|
$cmd ="./tools/sys/soc_link_child -vendor $vendor -project $project -lib_comp_sep $lib_comp_sep -component $component -version $comp_version /n";
|
if (system($cmd)) {}
|
if (system($cmd)) {}
|
}
|
}
|
|
|
foreach my $i_name ($doc->findnodes("//testbenchs/testbench/name"))
|
|
|
|
|
foreach my $i_name ($socgen_ip_file->findnodes("//testbenchs/testbench/name"))
|
{
|
{
|
my($tb_name) = $i_name ->findnodes('./text()')->to_literal ;
|
my($tb_name) = $i_name ->findnodes('./text()')->to_literal ;
|
my($tb_version) = $i_name ->findnodes('../version/text()')->to_literal ;
|
my($tb_version) = $i_name ->findnodes('../version/text()')->to_literal ;
|
|
|
my $tb_variant = "";
|
$cmd ="./tools/sys/soc_link_child -vendor ${vendor} -project $project -lib_comp_sep $lib_comp_sep -component $component -version $tb_version /n";
|
if($tb_version) {$tb_variant = "${tb_name}_${tb_version}"}
|
|
else {$tb_variant = "${tb_name}"}
|
|
|
|
$cmd ="./tools/sys/soc_link_child -vendor opencores.org -project $project -lib_comp_sep $lib_comp_sep -component $component -comp_xml_sep $comp_xml_sep -variant $tb_variant $tb_xml_sep /n";
|
|
if (system($cmd)) {}
|
if (system($cmd)) {}
|
}
|
}
|
|
|
#/*********************************************************************************************/
|
#/*********************************************************************************************/
|
#/ link chip files for synthesys */
|
#/ link chip files for synthesys */
|
Line 164... |
Line 165... |
#/ */
|
#/ */
|
#/ */
|
#/ */
|
#/*********************************************************************************************/
|
#/*********************************************************************************************/
|
|
|
print "Linking targets for $project $component \n";
|
print "Linking targets for $project $component \n";
|
foreach my $i_name ($doc->findnodes("//chips/chip/name"))
|
foreach my $i_name ($socgen_ip_file->findnodes("//chips/chip/name"))
|
{
|
{
|
my($chip) = $i_name ->findnodes('./text()')->to_literal ;
|
my($chip) = $i_name ->findnodes('./text()')->to_literal ;
|
my($chip_target) = $i_name ->findnodes('../target/text()')->to_literal ;
|
my($chip_target) = $i_name ->findnodes('../target/text()')->to_literal ;
|
my($configuration) = $i_name ->findnodes('../configuration/text()')->to_literal ;
|
my($configuration) = $i_name ->findnodes('../configuration/text()')->to_literal ;
|
my($variant) = $i_name ->findnodes('../variant/text()')->to_literal ;
|
my($variant) = $i_name ->findnodes('../variant/text()')->to_literal ;
|
|
|
$outfile ="${home}${prefix}${project}${lib_comp_sep}${component}/syn/ise/${chip}/Makefile";
|
$outfile ="${home}${prefix}${project}${lib_comp_sep}/${component}/syn/ise/${chip}/Makefile";
|
open MAKSYNFILE,">$outfile" or die "unable to open $outfile";
|
open MAKSYNFILE,">$outfile" or die "unable to open $outfile";
|
|
|
print MAKSYNFILE "include ../../../../../bin/Makefile.root\n";
|
print MAKSYNFILE "include ../../../../../bin/Makefile.root\n";
|
print MAKSYNFILE "include ./target/Makefile.brd\n";
|
print MAKSYNFILE "include ./target/Makefile.brd\n";
|
print MAKSYNFILE "board=${chip_target}\n";
|
print MAKSYNFILE "board=${chip_target}\n";
|
print MAKSYNFILE "Design=${chip_target}_${configuration}\n";
|
print MAKSYNFILE "Design=${chip_target}_${configuration}\n";
|
my $path = "${home}${prefix}${project}${lib_comp_sep}${component}/syn/ise/${chip}/target";
|
my $path = "${home}${prefix}${project}${lib_comp_sep}/${component}/syn/ise/${chip}/target";
|
mkdir $path,0755 unless( -e $path );
|
mkdir $path,0755 unless( -e $path );
|
|
|
&link_dir( "${home}/projects/opencores.org/targets/ip/${chip_target}", "${home}${prefix}${project}${lib_comp_sep}${component}/syn/ise/${chip}/target" );
|
&link_dir( "${home}/projects/${vendor}/targets/ip/${chip_target}", "${home}${prefix}${project}${lib_comp_sep}/${component}/syn/ise/${chip}/target" );
|
&link_dir( "${home}/projects/opencores.org/cde/ip", "${home}${prefix}${project}${lib_comp_sep}${component}/syn/ise/${chip}/target/lib/ip" );
|
&link_dir( "${home}/projects/${vendor}/cde/ip", "${home}${prefix}${project}${lib_comp_sep}/${component}/syn/ise/${chip}/target/lib/ip" );
|
&link_dir( "${home}/tools/Jtag_programmers/debug", "${home}${prefix}${project}${lib_comp_sep}${component}/syn/ise/${chip}/debug" );
|
&link_dir( "${home}/tools/Jtag_programmers/debug", "${home}${prefix}${project}${lib_comp_sep}/${component}/syn/ise/${chip}/debug" );
|
}
|
}
|
}
|
}
|
}
|
}
|
|
|
#/*********************************************************************************************/
|
#/*********************************************************************************************/
|
#/ */
|
#/ recursively map directory information */
|
#/ */
|
#/ */
|
#/ */
|
#/ */
|
#/ */
|
#/ */
|
#/ */
|
#/ */
|
#/ */
|
#/ */
|
#/*********************************************************************************************/
|
#/*********************************************************************************************/
|
|
|
# recursively map directory information
|
|
|
|
sub link_sub {
|
sub link_sub {
|
my $root = shift;
|
my $root = shift;
|
my $path = shift;
|
my $path = shift;
|
my $dest = shift;
|
my $dest = shift;
|