Line 71... |
Line 71... |
"version=s" => \$version,
|
"version=s" => \$version,
|
"component=s" => \$component,
|
"component=s" => \$component,
|
"dest_dir=s" => \$dest_dir,
|
"dest_dir=s" => \$dest_dir,
|
"destination=s" => \$destination,
|
"destination=s" => \$destination,
|
"configuration=s" => \$configuration,
|
"configuration=s" => \$configuration,
|
"fragment","no_port","local_parameters"
|
"fragment","no_port","local_parameters","tb"
|
) || die "(use '$program_name -h' for help)";
|
) || die "(use '$program_name -h' for help)";
|
|
|
|
|
|
|
##############################################################################
|
##############################################################################
|
Line 102... |
Line 102... |
if($version) {$variant = "${component}_${version}";}
|
if($version) {$variant = "${component}_${version}";}
|
else {$variant = "${component}";}
|
else {$variant = "${component}";}
|
|
|
|
|
|
|
# print "XXXXXW $vendor $project $component $version GEN_VERILOG $view \n";
|
#if( ($prefix eq "/work") ){$opt_tb = 1;}
|
|
|
|
|
|
if($opt_tb )
|
|
{
|
|
print "Creating testbench for $vendor $project $component $version \n";
|
|
|
|
|
|
my $path ="${home}/projects/${vendor}/${project}/ip/${component}/sim";
|
|
mkdir $path,0755 unless( -e $path );
|
|
|
|
$path ="${home}/projects/${vendor}/${project}/ip/${component}/sim/xml";
|
|
mkdir $path,0755 unless( -e $path );
|
|
|
|
|
|
$outfile ="${home}/projects/${vendor}/${project}/ip/${component}/sim/xml/${variant}_dut.params.xml";
|
|
open TB_COMP_FILE,">$outfile" or die "unable to open $outfile";
|
|
|
|
$outfile ="${home}/projects/${vendor}/${project}/ip/${component}/sim/xml/${variant}_dutg.design.xml";
|
|
open TB_DESIGN_FILE,">$outfile" or die "unable to open $outfile";
|
|
|
|
print TB_COMP_FILE "\n";
|
|
print TB_COMP_FILE "
|
|
print TB_COMP_FILE "xmlns:spirit=\"http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009\"\n";
|
|
print TB_COMP_FILE "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
|
|
print TB_COMP_FILE "xsi:schemaLocation=\"http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009\n";
|
|
print TB_COMP_FILE "http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009/index.xsd\">\n";
|
|
print TB_COMP_FILE "${vendor}\n";
|
|
print TB_COMP_FILE "${project}\n";
|
|
print TB_COMP_FILE "${component}\n";
|
|
print TB_COMP_FILE "${version}_dut.params\n";
|
|
|
|
|
|
print TB_DESIGN_FILE "\n";
|
|
print TB_DESIGN_FILE "
|
|
print TB_DESIGN_FILE "xmlns:spirit=\"http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009\"\n";
|
|
print TB_DESIGN_FILE "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
|
|
print TB_DESIGN_FILE "xsi:schemaLocation=\"http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009\n";
|
|
print TB_DESIGN_FILE "http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009/index.xsd\">\n";
|
|
print TB_DESIGN_FILE "${vendor}\n";
|
|
print TB_DESIGN_FILE "${project}\n";
|
|
print TB_DESIGN_FILE "${component}\n";
|
|
print TB_DESIGN_FILE "${version}_dutg.design\n";
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
my $lib_comp_sep = yp::lib::find_lib_comp_sep($vendor,$project);
|
my $lib_comp_sep = yp::lib::find_lib_comp_sep($vendor,$project);
|
my $comp_xml_sep = yp::lib::find_ipxact_component_path("spirit:component",$vendor,$project,$component,$version);
|
my $comp_xml_sep = yp::lib::find_ipxact_component_path("spirit:component",$vendor,$project,$component,$version);
|
|
|
my $parser = XML::LibXML->new();
|
my $parser = XML::LibXML->new();
|
Line 126... |
Line 175... |
print " Building verilog for ${project} ${component} ${variant} \n ";
|
print " Building verilog for ${project} ${component} ${variant} \n ";
|
my $socgen_ip_file = $parser->parse_file(yp::lib::find_socgen("socgen:ip",$vendor,$project,$component));
|
my $socgen_ip_file = $parser->parse_file(yp::lib::find_socgen("socgen:ip",$vendor,$project,$component));
|
my $spirit_component_file = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$vendor,$project,$component,$version));
|
my $spirit_component_file = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$vendor,$project,$component,$version));
|
|
|
|
|
|
|
|
|
|
#/**********************************************************************/
|
|
#/* */
|
|
#/* if configuration set then read parameters from socgen:ip file */
|
|
#/* */
|
|
#/**********************************************************************/
|
|
|
|
if($configuration)
|
|
{
|
|
# print "XXX Reading configuration $configuration \n";
|
|
unless ($socgen_ip_file) { print "No socgen ip file \n";};
|
|
|
|
foreach my $socgen_cfg ($socgen_ip_file->findnodes("//socgen:ip/socgen:configurations/socgen:configuration/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($config_name) = $socgen_cfg->findnodes('../../../socgen:name/text()')->to_literal ;
|
|
if($config_name eq $configuration )
|
|
{
|
|
unless(defined $parameter_values{$param_name}) {push ( @parameters, "$param_name");};
|
|
$parameter_values{$param_name} = ${param_value};
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
#/**********************************************************************/
|
#/**********************************************************************/
|
#/* */
|
#/* */
|
#/* Every hier cell is constructed from the ipxact file with seperate */
|
#/* Every hier cell is constructed from the ipxact file with seperate */
|
#/* version for each view */
|
#/* version for each view */
|
#/* */
|
#/* */
|
Line 262... |
Line 341... |
#/* */
|
#/* */
|
#/* Print out module header , parameters and ports */
|
#/* Print out module header , parameters and ports */
|
#/* */
|
#/* */
|
#/**********************************************************************/
|
#/**********************************************************************/
|
|
|
#/**********************************************************************/
|
|
#/* */
|
|
#/* parse parameters and values */
|
|
#/* */
|
|
#/**********************************************************************/
|
|
|
|
foreach my $i_name ($spirit_component_file->findnodes('//spirit:model/spirit:modelParameters/spirit:modelParameter/spirit:name'))
|
|
{
|
|
my($parameter_name) = $i_name ->to_literal;
|
|
my($parameter_default) = $i_name ->findnodes('../spirit:value/text()')->to_literal ;
|
|
|
|
unless($parameter_values{$parameter_name}) {push ( @parameters, "$parameter_name");};
|
|
$parameter_values{$parameter_name} = ${parameter_default};
|
|
}
|
|
|
|
#/**********************************************************************/
|
|
#/* */
|
|
#/* if configuration set then read parameters from socgen:ip file */
|
|
#/* */
|
|
#/**********************************************************************/
|
|
|
|
if($configuration)
|
|
{
|
|
# print "XXX Reading configuration $configuration \n";
|
|
unless ($socgen_ip_file) { print "No socgen ip file \n";};
|
|
|
|
foreach my $socgen_cfg ($socgen_ip_file->findnodes("//socgen:ip/socgen:configurations/socgen:configuration/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($config_name) = $socgen_cfg->findnodes('../../../socgen:name/text()')->to_literal ;
|
|
if($config_name eq $configuration )
|
|
{
|
|
|
|
unless($parameter_values{$param_name}) {push ( @parameters, "$param_name");};
|
|
$parameter_values{$param_name} = ${param_value};
|
|
}
|
|
}
|
|
|
|
}
|
|
else {print "No configuration \n";};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Line 385... |
Line 422... |
|
|
if ($first == 0) { print DEST_FILE ");\n\n\n\n"; }
|
if ($first == 0) { print DEST_FILE ");\n\n\n\n"; }
|
elsif ($opt_no_port) { print DEST_FILE "\n\n\n\n"; }
|
elsif ($opt_no_port) { print DEST_FILE "\n\n\n\n"; }
|
else { print DEST_FILE "();\n\n\n\n";}
|
else { print DEST_FILE "();\n\n\n\n";}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#/**********************************************************************/
|
|
#/* */
|
|
#/* print wire decs for testbench */
|
|
#/* */
|
|
#/**********************************************************************/
|
|
|
|
my @tb_node_list = ();
|
|
|
|
|
|
foreach $x_name (@decl_names)
|
|
{
|
|
|
|
if( $decl_dirs{$x_name} ne "node" )
|
|
{
|
|
if ( $decl_vector{$x_name} eq "vector" )
|
|
{
|
|
push (@tb_node_list, "\n${decl_pnames{$x_name}}<\/spirit:name>\nwire<\/spirit:typeName><\/spirit:wireTypeDef><\/spirit:wireTypeDefs>\n${decl_lefts{$x_name}}<\/spirit:left>${decl_rights{$x_name}}<\/spirit:right><\/spirit:vector><\/spirit:wire>\n<\/node>\n" );
|
|
}
|
|
else
|
|
{
|
|
push (@tb_node_list, "\n${decl_pnames{$x_name}}<\/spirit:name>\nwire<\/spirit:typeName><\/spirit:wireTypeDef><\/spirit:wireTypeDefs>\n<\/node>\n" );
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@tb_node_list = sys::lib::trim_sort(@tb_node_list);
|
|
print TB_DESIGN_FILE "\n\n";
|
|
|
|
foreach $node_line (@tb_node_list)
|
|
{
|
|
|
|
print TB_DESIGN_FILE "${node_line}\n";
|
|
|
|
|
|
}
|
|
|
|
print TB_DESIGN_FILE "\n\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#/**********************************************************************/
|
|
#/* */
|
|
#/* print wire decs for testbench */
|
|
#/* */
|
|
#/**********************************************************************/
|
|
|
|
my @tb_node_list = ();
|
|
|
|
|
|
foreach $x_name (@decl_names)
|
|
{
|
|
|
|
if( $decl_dirs{$x_name} ne "node" )
|
|
{
|
|
if ( $decl_vector{$x_name} eq "vector" )
|
|
{
|
|
push (@tb_adhoc_list, "\n${decl_pnames{$x_name}}[${decl_lefts{$x_name}}:${decl_rights{$x_name}}]<\/spirit:name>\n\n<\/spirit:adHocConnection>\n" );
|
|
}
|
|
else
|
|
{
|
|
|
|
push (@tb_adhoc_list, "\n${decl_pnames{$x_name}}<\/spirit:name>\n\n<\/spirit:adHocConnection>\n" );
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@tb_adhoc_list = sys::lib::trim_sort(@tb_adhoc_list);
|
|
print TB_DESIGN_FILE "\n\n";
|
|
|
|
foreach $adhoc_line (@tb_adhoc_list)
|
|
{
|
|
|
|
print TB_DESIGN_FILE "${adhoc_line}\n";
|
|
|
|
|
|
}
|
|
|
|
print TB_DESIGN_FILE "\n\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#/**********************************************************************/
|
|
#/* */
|
|
#/* Add parameters to dut */
|
|
#/* */
|
|
#/**********************************************************************/
|
|
print TB_DESIGN_FILE "\n\n";
|
|
|
|
|
|
|
|
|
|
print TB_DESIGN_FILE "\n";
|
|
print TB_DESIGN_FILE "dut\n";
|
|
print TB_DESIGN_FILE "\n";
|
|
print TB_DESIGN_FILE "\n";
|
|
|
|
|
|
foreach my $parameter_name (@parameters)
|
|
{
|
|
print TB_DESIGN_FILE " ${parameter_name}<\/spirit:configurableElementValue>\n";
|
|
}
|
|
|
|
print TB_DESIGN_FILE "\n";
|
|
print TB_DESIGN_FILE "\n";
|
|
print TB_DESIGN_FILE "\n";
|
|
print TB_DESIGN_FILE "\n";
|
|
|
|
|
|
|
|
|
|
#/**********************************************************************/
|
|
#/* */
|
|
#/* Add parameters to comp */
|
|
#/* */
|
|
#/**********************************************************************/
|
|
print TB_COMP_FILE "\n\n";
|
|
|
|
#print TB_COMP_FILE " \n";
|
|
#print TB_COMP_FILE " \n";
|
|
#print TB_COMP_FILE " \n";
|
|
#print TB_COMP_FILE " Dut \n";
|
|
#print TB_COMP_FILE " \n";
|
|
#print TB_COMP_FILE "
|
|
#print TB_COMP_FILE " spirit:library=\"${project}\" \n";
|
|
#print TB_COMP_FILE " spirit:name=\"${component}\" \n";
|
|
#print TB_COMP_FILE " spirit:version=\"${version}_dutg.design\"/> \n";
|
|
#print TB_COMP_FILE " \n";
|
|
#print TB_COMP_FILE " \n";
|
|
|
|
|
|
|
|
print TB_COMP_FILE "\n";
|
|
|
|
|
|
|
|
|
|
|
|
foreach my $parameter_name (@parameters)
|
|
{
|
|
my $parameter_value = $parameter_values{$parameter_name};
|
|
print TB_COMP_FILE " ${parameter_name}${parameter_value}\n";
|
|
}
|
|
|
|
print TB_COMP_FILE "\n";
|
|
print TB_COMP_FILE "\n";
|
|
|
|
|
|
|
|
|
|
print TB_COMP_FILE "\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#/**********************************************************************/
|
#/**********************************************************************/
|
#/* */
|
#/* */
|
#/* Add any and all local parameters with their default values */
|
#/* Add any and all local parameters with their default values */
|
#/* */
|
#/* */
|
#/**********************************************************************/
|
#/**********************************************************************/
|
Line 406... |
Line 620... |
#/* */
|
#/* */
|
#/* Add all internal wires and regs with their sizes */
|
#/* Add all internal wires and regs with their sizes */
|
#/* */
|
#/* */
|
#/**********************************************************************/
|
#/**********************************************************************/
|
|
|
|
my @wire_nodes = ();
|
|
|
|
|
foreach $x_name (@decl_names)
|
foreach $x_name (@decl_names)
|
{
|
{
|
my $q_width = " ";
|
my $q_width = " ";
|
if( $decl_vector{$x_name} eq "vector" ){ $q_width = "[ $decl_lefts{$x_name} : $decl_rights{$x_name}]"}
|
if( $decl_vector{$x_name} eq "vector" ){ $q_width = "[ $decl_lefts{$x_name} : $decl_rights{$x_name}]"}
|
if( $decl_dirs{$x_name} eq "node" ) { print DEST_FILE "$decl_types{$x_name} $q_width $decl_pnames{$x_name};\n";}
|
if( $decl_dirs{$x_name} eq "node" ) { push @wire_nodes, "$decl_types{$x_name} $q_width $decl_pnames{$x_name};";}
|
|
}
|
|
|
|
@wire_nodes = sys::lib::trim_sort(@wire_nodes);
|
|
|
|
foreach my $wire_node (@wire_nodes)
|
|
{
|
|
print DEST_FILE "${wire_node}\n";
|
}
|
}
|
|
|
print DEST_FILE "\n\n\n";
|
print DEST_FILE "\n\n\n";
|
|
|
|
|
Line 1352... |
Line 1576... |
}
|
}
|
|
|
|
|
|
|
|
|
|
#/**********************************************************************/
|
|
#/* */
|
|
#/* parse parameters and values */
|
|
#/* */
|
|
#/**********************************************************************/
|
|
|
|
foreach my $i_name ($spirit_component_file->findnodes('//spirit:model/spirit:modelParameters/spirit:modelParameter/spirit:name'))
|
|
{
|
|
my($parameter_name) = $i_name ->to_literal;
|
|
my($parameter_default) = $i_name ->findnodes('../spirit:value/text()')->to_literal ;
|
|
|
|
unless(defined $parameter_values{$parameter_name})
|
|
{
|
|
push ( @parameters, "$parameter_name");
|
|
$parameter_values{$parameter_name} = ${parameter_default};
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:hierarchyRef"))
|
foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:hierarchyRef"))
|
{
|
{
|
my($new_vendor) = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
|
my($new_vendor) = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
|
my($new_library) = $new_comp->findnodes('./@spirit:library')->to_literal ;
|
my($new_library) = $new_comp->findnodes('./@spirit:library')->to_literal ;
|
my($new_name) = $new_comp->findnodes('./@spirit:name')->to_literal ;
|
my($new_name) = $new_comp->findnodes('./@spirit:name')->to_literal ;
|
my($new_version) = $new_comp->findnodes('./@spirit:version')->to_literal ;
|
my($new_version) = $new_comp->findnodes('./@spirit:version')->to_literal ;
|
|
|
|
|
my $foo = yp::lib::find_file_type($new_vendor,$new_library,$new_name,$new_version) ;
|
my $foo = yp::lib::find_file_type($new_vendor,$new_library,$new_name,$new_version) ;
|
|
|
# print "XXXXXZ $new_vendor $new_library $new_name $new_version $foo\n";
|
|
|
|
if($foo eq "spirit:component")
|
if($foo eq "spirit:component")
|
{
|
{
|
my $spirit_sub_component_file = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$new_vendor,$new_library,$new_name,$new_version));
|
my $spirit_sub_component_file = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$new_vendor,$new_library,$new_name,$new_version));
|
parse_component_file($spirit_sub_component_file);
|
parse_component_file($spirit_sub_component_file);
|
}
|
}
|