Line 51... |
Line 51... |
use Getopt::Long;
|
use Getopt::Long;
|
use English;
|
use English;
|
use File::Basename;
|
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.
|
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
|
|
|
|
|
Line 68... |
Line 71... |
GetOptions("h","help",
|
GetOptions("h","help",
|
"vendor=s" => \$vendor,
|
"vendor=s" => \$vendor,
|
"project=s" => \$project,
|
"project=s" => \$project,
|
"lib_comp_sep=s" => \$lib_comp_sep,
|
"lib_comp_sep=s" => \$lib_comp_sep,
|
"component=s" => \$component,
|
"component=s" => \$component,
|
"comp_xml_sep=s" => \$comp_xml_sep,
|
"version=s" => \$version
|
"variant=s" => \$variant
|
|
) || 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 type soc_link_child -vendor vendor_name -project project_name -lib_comp_sep /ip/ -component component_name -comp_xml_sep /rtl/xml/ -variant variant_name new_seperator";
|
print "\n type soc_link_child -vendor vendor_name -project project_name -lib_comp_sep /ip/ -component component_name -comp_xml_sep /rtl/xml/ ";
|
print "\n";
|
print "\n";
|
exit 1;
|
exit 1;
|
}
|
}
|
|
|
|
|
##############################################################################
|
##############################################################################
|
##
|
##
|
##############################################################################
|
##############################################################################
|
|
|
$home = cwd();
|
$home = cwd();
|
my $new_sep = $ARGV[0];
|
|
|
|
|
my $parser = XML::LibXML->new();
|
|
|
|
|
|
|
|
|
|
|
#/*********************************************************************************************/
|
#/*********************************************************************************************/
|
Line 110... |
Line 115... |
my @filelist_hier = ( );
|
my @filelist_hier = ( );
|
my @filelist = ( );
|
my @filelist = ( );
|
|
|
@filelist_hier = ( );
|
@filelist_hier = ( );
|
@filelist = ( );
|
@filelist = ( );
|
@filelist = parse_hier("$vendor","$project","$component",$new_sep,"$variant");
|
@filelist = parse_hier("$vendor","$project","$component","$version");
|
@filelist = trim_sort(@filelist);
|
@filelist = sys::lib::trim_sort(@filelist);
|
|
|
|
|
|
|
foreach $line (@filelist)
|
foreach $line (@filelist)
|
{
|
{
|
$_ = $line;
|
$_ = $line;
|
if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
|
if(/::(\S+)::(\S+)::/)
|
{
|
{
|
$new_proj = $1;
|
$new_proj = $1;
|
$new_comp = $2;
|
$new_comp = $2;
|
$xxx_sep = $3;
|
|
$new_variant = $4;
|
|
if($new_proj ne $project ) { &link_child( $project,$new_comp, $new_proj ); }
|
if($new_proj ne $project ) { &link_child( $project,$new_comp, $new_proj ); }
|
}
|
}
|
}
|
}
|
|
|
|
|
Line 166... |
Line 169... |
$root = "${home}/projects/${vendor}/${child_family}/sw";
|
$root = "${home}/projects/${vendor}/${child_family}/sw";
|
$dest = "${home}/work/${project}/children/${child_family}/sw";
|
$dest = "${home}/work/${project}/children/${child_family}/sw";
|
&link_dir( "$root", "$dest" );
|
&link_dir( "$root", "$dest" );
|
my $path = "work/${project}/children/${child_family}/ip";
|
my $path = "work/${project}/children/${child_family}/ip";
|
mkdir $path,0755 unless( -e $path );
|
mkdir $path,0755 unless( -e $path );
|
my $path = "work/${project}/children/${child_family}${lib_comp_sep}${child_parent}";
|
my $path = "work/${project}/children/${child_family}${lib_comp_sep}/${child_parent}";
|
mkdir $path,0755 unless( -e $path );
|
mkdir $path,0755 unless( -e $path );
|
|
|
my $path = "work/${project}/children/${child_family}${lib_comp_sep}${child_parent}/rtl";
|
my $path = "work/${project}/children/${child_family}${lib_comp_sep}/${child_parent}/rtl";
|
mkdir $path,0755 unless( -e $path );
|
mkdir $path,0755 unless( -e $path );
|
$root = "${home}/projects/${vendor}/${child_family}${lib_comp_sep}${child_parent}/rtl";
|
$root = "${home}/projects/${vendor}/${child_family}${lib_comp_sep}/${child_parent}/rtl";
|
$dest = "${home}/work/${project}/children/${child_family}${lib_comp_sep}${child_parent}/rtl";
|
$dest = "${home}/work/${project}/children/${child_family}${lib_comp_sep}/${child_parent}/rtl";
|
&link_dir( "$root", "$dest" );
|
&link_dir( "$root", "$dest" );
|
|
|
|
|
my $path = "work/${project}/children/${child_family}${lib_comp_sep}${child_parent}/ip-xact";
|
my $path = "work/${project}/children/${child_family}${lib_comp_sep}/${child_parent}/ip-xact";
|
mkdir $path,0755 unless( -e $path );
|
mkdir $path,0755 unless( -e $path );
|
$root = "${home}/projects/${vendor}/${child_family}${lib_comp_sep}${child_parent}/ip-xact";
|
$root = "${home}/projects/${vendor}/${child_family}${lib_comp_sep}/${child_parent}/ip-xact";
|
$dest = "${home}/work/${project}/children/${child_family}${lib_comp_sep}${child_parent}/ip-xact";
|
$dest = "${home}/work/${project}/children/${child_family}${lib_comp_sep}/${child_parent}/ip-xact";
|
&link_dir( "$root", "$dest" );
|
&link_dir( "$root", "$dest" );
|
|
|
|
|
|
|
my $path = "work/${project}/children/${child_family}${lib_comp_sep}${child_parent}/doc";
|
my $path = "work/${project}/children/${child_family}${lib_comp_sep}/${child_parent}/doc";
|
mkdir $path,0755 unless( -e $path );
|
mkdir $path,0755 unless( -e $path );
|
|
|
symlink( "${home}/projects/${vendor}/${child_family}${lib_comp_sep}${child_parent}/doc/copyright.v", "${home}/work/${project}/children/${child_family}${lib_comp_sep}${child_parent}/doc/copyright.v");
|
symlink( "${home}/projects/${vendor}/${child_family}${lib_comp_sep}/${child_parent}/doc/copyright.v", "${home}/work/${project}/children/${child_family}${lib_comp_sep}/${child_parent}/doc/copyright.v");
|
|
|
}
|
}
|
|
|
|
|
#/*********************************************************************************************/
|
#/*********************************************************************************************/
|
Line 232... |
Line 235... |
}
|
}
|
|
|
|
|
|
|
|
|
#/*********************************************************************************************/
|
|
#/ */
|
|
#/ */
|
|
#/ */
|
|
#/ */
|
|
#/ */
|
|
#/ */
|
|
#/*********************************************************************************************/
|
|
|
|
sub trim_sort {
|
|
my @output_files = @_;
|
|
my %trim = ();
|
|
foreach $descriptor (@output_files) { $trim{$descriptor} = 1; }
|
|
my @k = keys %trim;
|
|
@output_files = sort(sort @k);
|
|
return(@output_files);
|
|
}
|
|
|
|
|
|
|
|
#/*********************************************************************************************/
|
#/*********************************************************************************************/
|
#/ */
|
#/ */
|
Line 264... |
Line 250... |
#/*********************************************************************************************/
|
#/*********************************************************************************************/
|
|
|
sub parse_hier
|
sub parse_hier
|
{
|
{
|
my @params = @_;
|
my @params = @_;
|
my $variant = pop(@params);
|
my $version = pop(@params);
|
my $comp_xml = pop(@params);
|
|
my $component = pop(@params);
|
my $component = pop(@params);
|
my $project = pop(@params);
|
my $project = pop(@params);
|
my $vendor = pop(@params);
|
my $vendor = pop(@params);
|
|
|
$home = cwd();
|
$home = cwd();
|
|
|
|
my $spirit_component_file = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$vendor,$project,$component,$version));
|
|
push(@filelist_hier,"::${project}::${component}::");
|
|
|
|
|
my $parser = XML::LibXML->new();
|
|
|
|
my $spirit_component_file = $parser->parse_file("${home}/projects/${vendor}/${project}${lib_comp_sep}${component}${comp_xml}${variant}.xml");
|
|
push(@filelist_hier,"::${project}::${component}::${comp_xml}::${variant}::");
|
|
|
|
|
|
|
|
|
|
foreach my $comp_view ($spirit_component_file->findnodes('//spirit:component/spirit:model/spirit:views/spirit:view'))
|
foreach my $comp_view ($spirit_component_file->findnodes('//spirit:component/spirit:model/spirit:views/spirit:view'))
|
{
|
{
|
Line 292... |
Line 274... |
my($hier_ref_vendor) = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:vendor')->to_literal ;
|
my($hier_ref_vendor) = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:vendor')->to_literal ;
|
my($hier_ref_library) = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:library')->to_literal ;
|
my($hier_ref_library) = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:library')->to_literal ;
|
my($hier_ref_component) = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:name')->to_literal ;
|
my($hier_ref_component) = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:name')->to_literal ;
|
my($hier_ref_version) = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:version')->to_literal ;
|
my($hier_ref_version) = $comp_view->findnodes('./spirit:hierarchyRef/@spirit:version')->to_literal ;
|
my $spirit_designCfg_file
|
my $spirit_designCfg_file
|
= $parser->parse_file("${home}/projects/${hier_ref_vendor}/${hier_ref_library}${lib_comp_sep}${hier_ref_component}/ip-xact/${hier_ref_component}_${hier_ref_version}.xml");
|
= $parser->parse_file(yp::lib::find_ipxact("spirit:designConfiguration",$hier_ref_vendor,$hier_ref_library,$hier_ref_component,$hier_ref_version ));
|
|
|
|
|
foreach my $design_ref_view ($spirit_designCfg_file->findnodes('//spirit:designConfiguration'))
|
foreach my $design_ref_view ($spirit_designCfg_file->findnodes('//spirit:designConfiguration'))
|
{
|
{
|
my($hier_xref_vendor) = $design_ref_view->findnodes('./spirit:designRef/@spirit:vendor')->to_literal ;
|
my($hier_xref_vendor) = $design_ref_view->findnodes('./spirit:designRef/@spirit:vendor')->to_literal ;
|
my($hier_xref_library) = $design_ref_view->findnodes('./spirit:designRef/@spirit:library')->to_literal ;
|
my($hier_xref_library) = $design_ref_view->findnodes('./spirit:designRef/@spirit:library')->to_literal ;
|
my($hier_xref_component) = $design_ref_view->findnodes('./spirit:designRef/@spirit:name')->to_literal ;
|
my($hier_xref_component) = $design_ref_view->findnodes('./spirit:designRef/@spirit:name')->to_literal ;
|
my($hier_xref_version) = $design_ref_view->findnodes('./spirit:designRef/@spirit:version')->to_literal ;
|
my($hier_xref_version) = $design_ref_view->findnodes('./spirit:designRef/@spirit:version')->to_literal ;
|
$spirit_design_file = $parser->parse_file("${home}/projects/${hier_xref_vendor}/${hier_xref_library}${lib_comp_sep}${hier_xref_component}${comp_xml}${hier_xref_component}_${hier_xref_version}.xml");
|
my $spirit_design_file
|
|
= $parser->parse_file(yp::lib::find_ipxact("spirit:design",$hier_xref_vendor,$hier_xref_library,$hier_xref_component,$hier_xref_version ));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#/*********************************************************************************************/
|
#/*********************************************************************************************/
|
#/ */
|
#/ */
|
#/ Create filelists for simulation, code coverage, linting and synthesis */
|
#/ Create filelists for simulation, code coverage, linting and synthesis */
|
#/ */
|
#/ */
|
Line 332... |
Line 300... |
my($vendor_name) = $i_name ->to_literal ;
|
my($vendor_name) = $i_name ->to_literal ;
|
my($library_name) = $i_name ->findnodes('../@spirit:library')->to_literal ;
|
my($library_name) = $i_name ->findnodes('../@spirit:library')->to_literal ;
|
my($component_name) = $i_name ->findnodes('../@spirit:name')->to_literal ;
|
my($component_name) = $i_name ->findnodes('../@spirit:name')->to_literal ;
|
my($version_name) = $i_name ->findnodes('../@spirit:version')->to_literal ;
|
my($version_name) = $i_name ->findnodes('../@spirit:version')->to_literal ;
|
|
|
my $variant_name = "";
|
|
if($version_name) {$variant_name = "${component_name}_${version_name}";}
|
|
else {$variant_name = "${component_name}";}
|
|
|
|
my @filelist_sub = parse_hier("$vendor_name","$library_name","$component_name","$comp_xml_sep","$variant_name");
|
my @filelist_sub = parse_hier("$vendor_name","$library_name","$component_name","$version_name");
|
foreach $line (@filelist_sub) { push(@filelist_hier,"$line"); }
|
foreach $line (@filelist_sub) { push(@filelist_hier,"$line"); }
|
|
|
}
|
}
|
|
|
|
|
Line 349... |
Line 314... |
}
|
}
|
}
|
}
|
|
|
|
|
|
|
@filelist_hier = trim_sort(@filelist_hier);
|
@filelist_hier = sys::lib::trim_sort(@filelist_hier);
|
return(@filelist_hier);
|
return(@filelist_hier);
|
}
|
}
|
|
|
|
|
|
|