| 1 |
124 |
jt_eaton |
eval 'exec `which perl` -S $0 ${1+"$@"}'
|
| 2 |
|
|
if 0;
|
| 3 |
|
|
|
| 4 |
|
|
#/**********************************************************************/
|
| 5 |
|
|
#/* */
|
| 6 |
|
|
#/* ------- */
|
| 7 |
|
|
#/* / SOC \ */
|
| 8 |
|
|
#/* / GEN \ */
|
| 9 |
|
|
#/* / TOOL \ */
|
| 10 |
|
|
#/* ============== */
|
| 11 |
|
|
#/* | | */
|
| 12 |
|
|
#/* |____________| */
|
| 13 |
|
|
#/* */
|
| 14 |
|
|
#/* */
|
| 15 |
|
|
#/* */
|
| 16 |
|
|
#/* Author(s): */
|
| 17 |
|
|
#/* - John Eaton, jt_eaton@opencores.org */
|
| 18 |
|
|
#/* */
|
| 19 |
|
|
#/**********************************************************************/
|
| 20 |
|
|
#/* */
|
| 21 |
|
|
#/* Copyright (C) <2010-2011> */
|
| 22 |
|
|
#/* */
|
| 23 |
|
|
#/* This source file may be used and distributed without */
|
| 24 |
|
|
#/* restriction provided that this copyright statement is not */
|
| 25 |
|
|
#/* removed from the file and that any derivative work contains */
|
| 26 |
|
|
#/* the original copyright notice and the associated disclaimer. */
|
| 27 |
|
|
#/* */
|
| 28 |
|
|
#/* This source file is free software; you can redistribute it */
|
| 29 |
|
|
#/* and/or modify it under the terms of the GNU Lesser General */
|
| 30 |
|
|
#/* Public License as published by the Free Software Foundation; */
|
| 31 |
|
|
#/* either version 2.1 of the License, or (at your option) any */
|
| 32 |
|
|
#/* later version. */
|
| 33 |
|
|
#/* */
|
| 34 |
|
|
#/* This source is distributed in the hope that it will be */
|
| 35 |
|
|
#/* useful, but WITHOUT ANY WARRANTY; without even the implied */
|
| 36 |
|
|
#/* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR */
|
| 37 |
|
|
#/* PURPOSE. See the GNU Lesser General Public License for more */
|
| 38 |
|
|
#/* details. */
|
| 39 |
|
|
#/* */
|
| 40 |
|
|
#/* You should have received a copy of the GNU Lesser General */
|
| 41 |
|
|
#/* Public License along with this source; if not, download it */
|
| 42 |
|
|
#/* from http://www.opencores.org/lgpl.shtml */
|
| 43 |
|
|
#/* */
|
| 44 |
|
|
#/**********************************************************************/
|
| 45 |
|
|
|
| 46 |
|
|
|
| 47 |
|
|
|
| 48 |
|
|
|
| 49 |
|
|
############################################################################
|
| 50 |
|
|
# General PERL config
|
| 51 |
|
|
############################################################################
|
| 52 |
|
|
use Getopt::Long;
|
| 53 |
|
|
use English;
|
| 54 |
|
|
use File::Basename;
|
| 55 |
|
|
use Cwd;
|
| 56 |
|
|
use XML::LibXML;
|
| 57 |
|
|
use lib './tools';
|
| 58 |
|
|
use sys::lib;
|
| 59 |
|
|
use yp::lib;
|
| 60 |
|
|
|
| 61 |
|
|
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
|
| 62 |
|
|
|
| 63 |
|
|
|
| 64 |
|
|
############################################################################
|
| 65 |
|
|
### Process the options
|
| 66 |
|
|
############################################################################
|
| 67 |
|
|
Getopt::Long::config("require_order", "prefix=-");
|
| 68 |
|
|
GetOptions("h","help",
|
| 69 |
|
|
"work_site=s" => \$work_site,
|
| 70 |
|
|
"vendor=s" => \$vendor,
|
| 71 |
|
|
"project=s" => \$project,
|
| 72 |
|
|
"component=s" => \$component,
|
| 73 |
|
|
"version=s" => \$version
|
| 74 |
|
|
) || die "(use '$program_name -h' for help)";
|
| 75 |
|
|
|
| 76 |
|
|
|
| 77 |
|
|
|
| 78 |
|
|
##############################################################################
|
| 79 |
|
|
## Help option
|
| 80 |
|
|
##############################################################################
|
| 81 |
|
|
if ( $opt_h or $opt_help)
|
| 82 |
|
|
{ print "\n build_lint_filelists -work_site /work -vendor vendor_name -project project_name -component component_name ";
|
| 83 |
|
|
print "\n";
|
| 84 |
|
|
exit 1;
|
| 85 |
|
|
}
|
| 86 |
|
|
|
| 87 |
|
|
|
| 88 |
|
|
##############################################################################
|
| 89 |
|
|
##
|
| 90 |
|
|
##############################################################################
|
| 91 |
|
|
|
| 92 |
|
|
|
| 93 |
|
|
|
| 94 |
|
|
$home = cwd();
|
| 95 |
|
|
|
| 96 |
|
|
my $variant = "";
|
| 97 |
|
|
if($version) {$variant = "${component}_${version}"}
|
| 98 |
|
|
else {$variant = "${component}"}
|
| 99 |
|
|
|
| 100 |
|
|
#############################################################################
|
| 101 |
|
|
##
|
| 102 |
|
|
##
|
| 103 |
|
|
#############################################################################
|
| 104 |
|
|
|
| 105 |
|
|
my $parser = XML::LibXML->new();
|
| 106 |
|
|
|
| 107 |
|
|
|
| 108 |
|
|
|
| 109 |
|
|
#/*********************************************************************************************/
|
| 110 |
|
|
#/ */
|
| 111 |
|
|
#/ Create filelists for simulation and linting */
|
| 112 |
|
|
#/ */
|
| 113 |
|
|
#/ */
|
| 114 |
|
|
#/*********************************************************************************************/
|
| 115 |
|
|
|
| 116 |
|
|
@filelist_sim = ( );
|
| 117 |
|
|
@filelist_ver = ( );
|
| 118 |
|
|
|
| 119 |
125 |
jt_eaton |
my @filelist = yp::lib::parse_component_file("$vendor","$project","$component","$version");
|
| 120 |
124 |
jt_eaton |
|
| 121 |
|
|
|
| 122 |
|
|
|
| 123 |
|
|
|
| 124 |
|
|
foreach $line (@filelist)
|
| 125 |
|
|
{
|
| 126 |
|
|
$_ = $line;
|
| 127 |
|
|
if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
|
| 128 |
|
|
{
|
| 129 |
|
|
$new_proj = $2;
|
| 130 |
|
|
$new_comp = $3;
|
| 131 |
|
|
$new_vendor = $1;
|
| 132 |
|
|
$new_version = $4;
|
| 133 |
|
|
}
|
| 134 |
|
|
|
| 135 |
|
|
|
| 136 |
|
|
|
| 137 |
|
|
#############################################################################
|
| 138 |
|
|
## Read destination from source xml file
|
| 139 |
|
|
##
|
| 140 |
|
|
#############################################################################
|
| 141 |
|
|
|
| 142 |
|
|
|
| 143 |
|
|
|
| 144 |
|
|
my $spirit_component_file = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$new_vendor,$new_proj,$new_comp,$new_version));
|
| 145 |
|
|
|
| 146 |
|
|
|
| 147 |
|
|
|
| 148 |
|
|
|
| 149 |
|
|
if($new_version){$new_variant = "${new_comp}_${new_version}"}
|
| 150 |
|
|
else {$new_variant = $new_comp}
|
| 151 |
|
|
|
| 152 |
|
|
|
| 153 |
|
|
|
| 154 |
|
|
|
| 155 |
|
|
if($new_proj eq $project )
|
| 156 |
|
|
{
|
| 157 |
|
|
|
| 158 |
|
|
foreach my $i_name ($spirit_component_file->findnodes("//spirit:fileSets/spirit:fileSet/spirit:file/spirit:name"))
|
| 159 |
|
|
{
|
| 160 |
|
|
my($file_name) = $i_name ->findnodes('./text()')->to_literal ;
|
| 161 |
|
|
my($file_type) = $i_name ->findnodes('../spirit:userFileType/text()')->to_literal ;
|
| 162 |
|
|
my($logical_name) = $i_name ->findnodes('../spirit:logicalName/text()')->to_literal ;
|
| 163 |
|
|
my($view_file) = $i_name ->findnodes('../../spirit:name/text()')->to_literal ;
|
| 164 |
|
|
my $component_path = yp::lib::find_ipxact_component_path("spirit:component",$new_vendor,$new_proj,$new_comp,$new_version);
|
| 165 |
|
|
|
| 166 |
|
|
if( ($file_type eq "libraryDir") && ($view_file eq "fs-lint") && ($logical_name eq "dest_dir") )
|
| 167 |
|
|
{
|
| 168 |
|
|
push(@filelist_sim,"../../../../${new_comp}${component_path}/${file_name}${new_variant}.v\n");
|
| 169 |
|
|
push(@filelist_ver," ../../../../${new_comp}${component_path}/${file_name}${new_variant}.v\n");
|
| 170 |
|
|
};
|
| 171 |
|
|
|
| 172 |
|
|
}
|
| 173 |
|
|
}
|
| 174 |
|
|
else
|
| 175 |
|
|
{
|
| 176 |
|
|
|
| 177 |
|
|
foreach my $i_name ($spirit_component_file->findnodes("//spirit:fileSets/spirit:fileSet/spirit:file/spirit:name"))
|
| 178 |
|
|
{
|
| 179 |
|
|
my($file_name) = $i_name ->findnodes('./text()')->to_literal ;
|
| 180 |
|
|
my($file_type) = $i_name ->findnodes('../spirit:userFileType/text()')->to_literal ;
|
| 181 |
|
|
my($logical_name) = $i_name ->findnodes('../spirit:logicalName/text()')->to_literal ;
|
| 182 |
|
|
my($view_file) = $i_name ->findnodes('../../spirit:name/text()')->to_literal ;
|
| 183 |
|
|
my $library_path = yp::lib::find_ipxact_library_path("spirit:component",$new_vendor,$new_proj,$new_comp,$new_version);
|
| 184 |
|
|
|
| 185 |
|
|
|
| 186 |
|
|
|
| 187 |
|
|
if(($file_type eq "libraryDir")&& (($view_file eq "fs-lint") ) && ($logical_name eq "dest_dir") )
|
| 188 |
|
|
{
|
| 189 |
|
|
push(@filelist_sim,"../../../../../children/${new_vendor}__${new_proj}${library_path}/${file_name}${new_variant}.v\n");
|
| 190 |
|
|
push(@filelist_ver," ../../../../../children/${new_vendor}__${new_proj}${library_path}/${file_name}${new_variant}.v\n");
|
| 191 |
|
|
};
|
| 192 |
|
|
}
|
| 193 |
|
|
|
| 194 |
|
|
}
|
| 195 |
|
|
|
| 196 |
|
|
}
|
| 197 |
|
|
|
| 198 |
|
|
|
| 199 |
|
|
|
| 200 |
|
|
|
| 201 |
|
|
|
| 202 |
|
|
|
| 203 |
|
|
#############################################################################
|
| 204 |
|
|
##
|
| 205 |
|
|
##
|
| 206 |
|
|
#############################################################################
|
| 207 |
|
|
|
| 208 |
|
|
print "Building rtl_check filelists for $work_site $vendor $project $component $version $variant \n" ;
|
| 209 |
|
|
|
| 210 |
|
|
my $spirit_component_file = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$vendor,$project,$component,$version));
|
| 211 |
|
|
my $sogen_file = $parser->parse_file(yp::lib::find_socgen("socgen:componentConfiguration",$vendor,$project,$component));
|
| 212 |
|
|
|
| 213 |
|
|
|
| 214 |
|
|
|
| 215 |
|
|
|
| 216 |
|
|
|
| 217 |
|
|
#/*********************************************************************************************/
|
| 218 |
|
|
#/ */
|
| 219 |
|
|
#/ */
|
| 220 |
|
|
#/ Read each variants parameters and defaults into an array and their order into an array */
|
| 221 |
|
|
#/ order must be preservered so that parameters can use the values of other parameters */
|
| 222 |
|
|
#/ */
|
| 223 |
|
|
#/*********************************************************************************************/
|
| 224 |
|
|
|
| 225 |
|
|
my %default_parameters = ();
|
| 226 |
|
|
my @parameter_order = ();
|
| 227 |
|
|
|
| 228 |
|
|
|
| 229 |
|
|
foreach my $i_name ($sogen_file->findnodes("//socgen:configurations/socgen:configuration[socgen:name/text() = '$variant']/socgen:parameters/socgen:parameter"))
|
| 230 |
|
|
{
|
| 231 |
|
|
my($parameter_name) = $i_name ->findnodes('socgen:name/text()')->to_literal ;
|
| 232 |
|
|
my($parameter_default) = $i_name ->findnodes('socgen:value/text()')->to_literal ;
|
| 233 |
|
|
$default_parameters{$parameter_name} = $parameter_default;
|
| 234 |
|
|
push @parameter_order ,$parameter_name ;
|
| 235 |
|
|
# print "XXXXY $parameter_name $parameter_default \n";
|
| 236 |
|
|
}
|
| 237 |
|
|
|
| 238 |
|
|
|
| 239 |
|
|
|
| 240 |
|
|
|
| 241 |
|
|
|
| 242 |
|
|
|
| 243 |
|
|
|
| 244 |
|
|
|
| 245 |
|
|
|
| 246 |
|
|
foreach my $comp ($spirit_component_file->findnodes('//spirit:component'))
|
| 247 |
|
|
{
|
| 248 |
|
|
my($vendor) = $comp->findnodes('./spirit:vendor/text()')->to_literal ;
|
| 249 |
|
|
my($library) = $comp->findnodes('./spirit:library/text()')->to_literal ;
|
| 250 |
|
|
my($name) = $comp->findnodes('./spirit:name/text()')->to_literal ;
|
| 251 |
|
|
my($version) = $comp->findnodes('./spirit:version/text()')->to_literal ;
|
| 252 |
|
|
my $variant = "";
|
| 253 |
|
|
if($version) {$variant = "${name}_${version}"}
|
| 254 |
|
|
else {$variant = "${name}"}
|
| 255 |
|
|
print "rtl/gen directories for $project - $component VLNV $vendor - $library - $name - $variant \n";
|
| 256 |
|
|
}
|
| 257 |
|
|
|
| 258 |
|
|
|
| 259 |
|
|
|
| 260 |
|
|
|
| 261 |
|
|
|
| 262 |
|
|
|
| 263 |
|
|
|
| 264 |
|
|
|
| 265 |
|
|
|
| 266 |
|
|
|
| 267 |
|
|
|
| 268 |
|
|
push(@filelist_sim," ./TestBench\n");
|
| 269 |
|
|
|
| 270 |
|
|
print "CREATING componentRef filelists for $project $component $name $variant \n";
|
| 271 |
|
|
|
| 272 |
|
|
|
| 273 |
|
|
|
| 274 |
|
|
|
| 275 |
|
|
@filelist_ver = sys::lib::trim_sort(@filelist_ver);
|
| 276 |
|
|
@filelist_sim = sys::lib::trim_sort(@filelist_sim);
|
| 277 |
|
|
|
| 278 |
|
|
|
| 279 |
|
|
|
| 280 |
|
|
|
| 281 |
|
|
|
| 282 |
|
|
|
| 283 |
|
|
|
| 284 |
|
|
|
| 285 |
|
|
|
| 286 |
|
|
|
| 287 |
|
|
|
| 288 |
|
|
|
| 289 |
|
|
|
| 290 |
|
|
#/*********************************************************************************************/
|
| 291 |
|
|
#/ */
|
| 292 |
|
|
#/ Make simulation file set */
|
| 293 |
|
|
#/ */
|
| 294 |
|
|
#/ */
|
| 295 |
|
|
#/ */
|
| 296 |
|
|
#/ */
|
| 297 |
|
|
#/*********************************************************************************************/
|
| 298 |
|
|
|
| 299 |
|
|
print "CREATING sim files for $project $component $chip $name $variant \n";
|
| 300 |
|
|
|
| 301 |
|
|
|
| 302 |
|
|
|
| 303 |
|
|
|
| 304 |
|
|
my $sogen_file = $parser->parse_file(yp::lib::find_socgen("socgen:componentConfiguration",$vendor,$project,$component));
|
| 305 |
|
|
|
| 306 |
|
|
foreach my $i_name ($sogen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:rtl_check/socgen:lint[socgen:variant/text() = '$variant']"))
|
| 307 |
|
|
{
|
| 308 |
|
|
my($simulation) = $i_name ->findnodes('socgen:name/text()')->to_literal ;
|
| 309 |
|
|
my($configuration) = $i_name ->findnodes('socgen:configuration/text()')->to_literal ;
|
| 310 |
|
|
|
| 311 |
|
|
print " lint files for $project $component $variant $simulation $configuration \n";
|
| 312 |
125 |
jt_eaton |
my $library_path = $sogen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:library_path/text()")->to_literal;
|
| 313 |
124 |
jt_eaton |
|
| 314 |
125 |
jt_eaton |
my $path = "${home}${work_site}/${vendor}__${project}${library_path}/rtl_check";
|
| 315 |
124 |
jt_eaton |
|
| 316 |
125 |
jt_eaton |
mkdir $path,0755 unless (-e $path) ;
|
| 317 |
124 |
jt_eaton |
|
| 318 |
125 |
jt_eaton |
$path = "${home}${work_site}/${vendor}__${project}${library_path}/rtl_check/${simulation}";
|
| 319 |
|
|
mkdir $path,0755 unless (-e $path);
|
| 320 |
124 |
jt_eaton |
|
| 321 |
125 |
jt_eaton |
my $outfile ="${home}${work_site}/${vendor}__${project}${library_path}/rtl_check/${simulation}/Makefile";
|
| 322 |
|
|
open MAKSIMFILE,">$outfile" or die "unable to open $outfile";
|
| 323 |
124 |
jt_eaton |
|
| 324 |
125 |
jt_eaton |
$outfile ="${home}${work_site}/${vendor}__${project}${library_path}/rtl_check/${simulation}/filelist.ver";
|
| 325 |
|
|
open SIMFILE,">$outfile" or die "unable to open $outfile";
|
| 326 |
124 |
jt_eaton |
|
| 327 |
|
|
|
| 328 |
125 |
jt_eaton |
$outfile ="${home}${work_site}/${vendor}__${project}${library_path}/rtl_check/${simulation}/TestBench";
|
| 329 |
|
|
open SIM_PARM_FILE,">$outfile" or die "unable to open $outfile";
|
| 330 |
124 |
jt_eaton |
|
| 331 |
|
|
|
| 332 |
|
|
print MAKSIMFILE "include ../../../../../bin/Makefile.root\n";
|
| 333 |
|
|
print MAKSIMFILE "comp=${variant}\n";
|
| 334 |
|
|
print MAKSIMFILE "test=${simulation}\n";
|
| 335 |
|
|
|
| 336 |
|
|
|
| 337 |
125 |
jt_eaton |
|
| 338 |
124 |
jt_eaton |
foreach my $i_line (@filelist_sim){ print SIMFILE "$i_line";}
|
| 339 |
|
|
|
| 340 |
|
|
my %local_parameters = %default_parameters;
|
| 341 |
|
|
my @local_order = @parameter_order;
|
| 342 |
|
|
|
| 343 |
|
|
foreach my $i_name ($sogen_file->findnodes("//socgen:configurations/socgen:configuration[socgen:name/text() = '$configuration']/./socgen:parameters/socgen:parameter/socgen:name"))
|
| 344 |
|
|
{
|
| 345 |
|
|
my($par_name) = $i_name ->findnodes('./text()')->to_literal ;
|
| 346 |
|
|
my($par_value) = $i_name ->findnodes('../socgen:value/text()')->to_literal ;
|
| 347 |
|
|
if($local_parameters{$par_name} eq '' ) { push @local_order , $par_name; }
|
| 348 |
|
|
$local_parameters{$par_name} = $par_value;
|
| 349 |
|
|
}
|
| 350 |
|
|
|
| 351 |
|
|
foreach my $i_name ($sogen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:rtl_check/socgen:lint[socgen:name/text() = '$simulation']/./socgen:parameters/socgen:parameter/socgen:name"))
|
| 352 |
|
|
{
|
| 353 |
|
|
my($par_name) = $i_name ->findnodes('./text()')->to_literal ;
|
| 354 |
|
|
my($par_value) = $i_name ->findnodes('../socgen:value/text()')->to_literal ;
|
| 355 |
|
|
if ( $local_parameters{$par_name} eq '' ) { push @local_order , $par_name; }
|
| 356 |
|
|
$local_parameters{$par_name} = $par_value;
|
| 357 |
|
|
}
|
| 358 |
|
|
|
| 359 |
125 |
jt_eaton |
|
| 360 |
|
|
|
| 361 |
|
|
my $module_name = yp::lib::get_module_name($vendor,$project,$component,$version);
|
| 362 |
|
|
|
| 363 |
124 |
jt_eaton |
print SIM_PARM_FILE "// Testbench for $project $component $variant $configuration $simulation\n";
|
| 364 |
|
|
print SIM_PARM_FILE " \n";
|
| 365 |
125 |
jt_eaton |
print SIM_PARM_FILE "module TB(input clk,input reset); \n";
|
| 366 |
|
|
print SIM_PARM_FILE " \n\n";
|
| 367 |
|
|
print SIM_PARM_FILE " $module_name \n";
|
| 368 |
124 |
jt_eaton |
|
| 369 |
|
|
my $first =1;
|
| 370 |
|
|
|
| 371 |
|
|
foreach my $parameter_name (@local_order)
|
| 372 |
|
|
{
|
| 373 |
|
|
my($parameter_default) = $local_parameters{$parameter_name};
|
| 374 |
|
|
if($first)
|
| 375 |
|
|
{
|
| 376 |
|
|
print SIM_PARM_FILE " #( .${parameter_name}(${parameter_default})";
|
| 377 |
|
|
$first = 0;
|
| 378 |
|
|
}
|
| 379 |
|
|
else
|
| 380 |
|
|
{
|
| 381 |
|
|
print SIM_PARM_FILE ",\n .${parameter_name}(${parameter_default})";
|
| 382 |
|
|
}
|
| 383 |
|
|
}
|
| 384 |
|
|
|
| 385 |
|
|
if($first) { print SIM_PARM_FILE " ";}
|
| 386 |
|
|
else { print SIM_PARM_FILE ") ";}
|
| 387 |
|
|
|
| 388 |
125 |
jt_eaton |
print SIM_PARM_FILE " test \n (.clk(clk),.reset(reset)); \n\n\n\n endmodule \n ";
|
| 389 |
124 |
jt_eaton |
|
| 390 |
|
|
|
| 391 |
|
|
|
| 392 |
|
|
}
|
| 393 |
|
|
|
| 394 |
|
|
|
| 395 |
|
|
|
| 396 |
|
|
|
| 397 |
|
|
|