| 1 |
131 |
jt_eaton |
eval 'exec `which perl` -S $0 ${1+"$@"}'
|
| 2 |
|
|
if 0;
|
| 3 |
135 |
jt_eaton |
#/****************************************************************************/
|
| 4 |
|
|
#/* */
|
| 5 |
|
|
#/* SOCGEN Design for Reuse toolset */
|
| 6 |
|
|
#/* */
|
| 7 |
|
|
#/* Version 1.0.0 */
|
| 8 |
|
|
#/* */
|
| 9 |
|
|
#/* Author(s): */
|
| 10 |
|
|
#/* - John Eaton, z3qmtr45@gmail.com */
|
| 11 |
|
|
#/* */
|
| 12 |
|
|
#/****************************************************************************/
|
| 13 |
|
|
#/* */
|
| 14 |
|
|
#/* */
|
| 15 |
|
|
#/* Copyright 2016 John T Eaton */
|
| 16 |
|
|
#/* */
|
| 17 |
|
|
#/* Licensed under the Apache License, Version 2.0 (the "License"); */
|
| 18 |
|
|
#/* you may not use this file except in compliance with the License. */
|
| 19 |
|
|
#/* You may obtain a copy of the License at */
|
| 20 |
|
|
#/* */
|
| 21 |
|
|
#/* http://www.apache.org/licenses/LICENSE-2.0 */
|
| 22 |
|
|
#/* */
|
| 23 |
|
|
#/* Unless required by applicable law or agreed to in writing, software */
|
| 24 |
|
|
#/* distributed under the License is distributed on an "AS IS" BASIS, */
|
| 25 |
|
|
#/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
|
| 26 |
|
|
#/* See the License for the specific language governing permissions and */
|
| 27 |
|
|
#/* limitations under the License. */
|
| 28 |
|
|
#/* */
|
| 29 |
|
|
#/* */
|
| 30 |
|
|
#/****************************************************************************/
|
| 31 |
131 |
jt_eaton |
|
| 32 |
|
|
|
| 33 |
|
|
############################################################################
|
| 34 |
|
|
# General PERL config
|
| 35 |
|
|
############################################################################
|
| 36 |
|
|
use Getopt::Long;
|
| 37 |
|
|
use English;
|
| 38 |
|
|
use File::Basename;
|
| 39 |
|
|
use Cwd;
|
| 40 |
|
|
use XML::LibXML;
|
| 41 |
|
|
use lib './tools';
|
| 42 |
|
|
use sys::lib;
|
| 43 |
|
|
use yp::lib;
|
| 44 |
|
|
|
| 45 |
|
|
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
|
| 46 |
|
|
|
| 47 |
|
|
|
| 48 |
|
|
############################################################################
|
| 49 |
|
|
### Process the options
|
| 50 |
|
|
############################################################################
|
| 51 |
|
|
Getopt::Long::config("require_order", "prefix=-");
|
| 52 |
|
|
GetOptions("h","help",
|
| 53 |
|
|
) || die "(use '$program_name -h' for help)";
|
| 54 |
|
|
|
| 55 |
|
|
|
| 56 |
|
|
|
| 57 |
|
|
|
| 58 |
|
|
##############################################################################
|
| 59 |
|
|
## Help option
|
| 60 |
|
|
##############################################################################
|
| 61 |
|
|
if ( $opt_h or $opt_help )
|
| 62 |
|
|
{ print "\n build_master";
|
| 63 |
|
|
print "\n";
|
| 64 |
|
|
exit 1;
|
| 65 |
|
|
}
|
| 66 |
|
|
|
| 67 |
|
|
|
| 68 |
135 |
jt_eaton |
my $child_dir = yp::lib::get_child_dir;
|
| 69 |
|
|
|
| 70 |
131 |
jt_eaton |
my $parser = XML::LibXML->new();
|
| 71 |
|
|
|
| 72 |
|
|
|
| 73 |
|
|
my @kids = ( );
|
| 74 |
|
|
my @filelist = ( );
|
| 75 |
|
|
|
| 76 |
|
|
|
| 77 |
|
|
|
| 78 |
|
|
#/**********************************************************************/
|
| 79 |
|
|
#/* Process each library by finding any ip-xact file in any component */
|
| 80 |
|
|
#/* */
|
| 81 |
|
|
#/* Each ip-xact file is parsed and it's filename and the names of any*/
|
| 82 |
|
|
#/* modules that it uses are saved. */
|
| 83 |
|
|
#/* */
|
| 84 |
|
|
#/* */
|
| 85 |
|
|
#/**********************************************************************/
|
| 86 |
|
|
|
| 87 |
|
|
my $home = cwd();
|
| 88 |
|
|
|
| 89 |
|
|
my $prefix = yp::lib::get_workspace();
|
| 90 |
|
|
$prefix = "/${prefix}";
|
| 91 |
|
|
|
| 92 |
|
|
my @vendors = yp::lib::find_vendors();
|
| 93 |
|
|
|
| 94 |
|
|
foreach my $vendor (@vendors)
|
| 95 |
|
|
{
|
| 96 |
|
|
my $vendor_status = yp::lib::get_vendor_status($vendor);
|
| 97 |
|
|
if($vendor_status eq "active")
|
| 98 |
|
|
{
|
| 99 |
|
|
my @libraries = yp::lib::find_libraries($vendor);
|
| 100 |
|
|
foreach my $library (@libraries)
|
| 101 |
|
|
{
|
| 102 |
|
|
my $library_status = yp::lib::get_library_status($vendor,$library);
|
| 103 |
|
|
if($library_status eq "active")
|
| 104 |
|
|
{
|
| 105 |
|
|
run_vendor_library ( $vendor , $library)
|
| 106 |
|
|
}
|
| 107 |
|
|
}
|
| 108 |
|
|
}
|
| 109 |
|
|
}
|
| 110 |
|
|
|
| 111 |
|
|
|
| 112 |
|
|
|
| 113 |
|
|
|
| 114 |
|
|
sub run_vendor_library
|
| 115 |
|
|
{
|
| 116 |
|
|
my @params = @_;
|
| 117 |
|
|
my $library = pop(@params);
|
| 118 |
|
|
my $vendor = pop(@params);
|
| 119 |
133 |
jt_eaton |
|
| 120 |
|
|
|
| 121 |
|
|
|
| 122 |
|
|
|
| 123 |
|
|
|
| 124 |
|
|
|
| 125 |
|
|
my $prefix = yp::lib::get_workspace();
|
| 126 |
|
|
$prefix = "/${prefix}";
|
| 127 |
|
|
|
| 128 |
|
|
|
| 129 |
|
|
|
| 130 |
|
|
my @kids = ( );
|
| 131 |
|
|
my @filelist = ( );
|
| 132 |
|
|
my @cmd_list = ( );
|
| 133 |
|
|
|
| 134 |
|
|
my @components = yp::lib::find_components($vendor,$library);
|
| 135 |
|
|
|
| 136 |
|
|
foreach my $component (@components)
|
| 137 |
|
|
{
|
| 138 |
|
|
|
| 139 |
|
|
my $socgen_filename = yp::lib::find_componentConfiguration($vendor,$library,$component);
|
| 140 |
|
|
if($socgen_filename)
|
| 141 |
|
|
{
|
| 142 |
|
|
my $socgen_file = $parser->parse_file($socgen_filename);
|
| 143 |
|
|
|
| 144 |
|
|
#/*********************************************************************************************/
|
| 145 |
|
|
#/ files for simulation */
|
| 146 |
|
|
#/ */
|
| 147 |
|
|
#/*********************************************************************************************/
|
| 148 |
|
|
|
| 149 |
|
|
foreach my $i_name ($socgen_file->findnodes("//socgen:sim/socgen:testbenches/socgen:testbench/socgen:version"))
|
| 150 |
|
|
{
|
| 151 |
|
|
my $tb_version = $i_name ->findnodes('./text()')->to_literal ;
|
| 152 |
|
|
my $tb_variant = "${component}_${tb_version}";
|
| 153 |
|
|
|
| 154 |
|
|
foreach my $i_name ($socgen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$tb_variant']/socgen:tools/socgen:tool"))
|
| 155 |
|
|
{
|
| 156 |
|
|
|
| 157 |
|
|
my $tb_tool = $i_name ->findnodes('./text()')->to_literal ;
|
| 158 |
|
|
|
| 159 |
|
|
if( ($tb_tool eq "icarus") || ($tb_tool eq "verilator") || ($tb_tool eq "rtl_check"))
|
| 160 |
|
|
|
| 161 |
|
|
{
|
| 162 |
|
|
@filelist = ( );
|
| 163 |
|
|
@filelist = yp::lib::parse_component_file("$vendor","$library","$component","$tb_version");
|
| 164 |
|
|
|
| 165 |
|
|
foreach $line (@filelist)
|
| 166 |
|
|
{
|
| 167 |
|
|
$_ = $line;
|
| 168 |
|
|
if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
|
| 169 |
|
|
{
|
| 170 |
|
|
$new_vendor = $1;
|
| 171 |
|
|
$new_proj = $2;
|
| 172 |
|
|
$new_comp = $3;
|
| 173 |
|
|
$new_version = $4;
|
| 174 |
|
|
}
|
| 175 |
|
|
if( ($vendor eq $new_vendor) && ( $library eq $new_proj) && ( $component eq $new_comp ) && ( $tb_version eq $new_version ) )
|
| 176 |
|
|
{
|
| 177 |
|
|
push @kids , "::${prefix}::${library}::${component}::${vendor}::${tb_version}::";
|
| 178 |
|
|
}
|
| 179 |
|
|
else
|
| 180 |
|
|
{
|
| 181 |
135 |
jt_eaton |
push @kids , "::/${child_dir}::${new_proj}::${new_comp}::${new_vendor}::${new_version}::";
|
| 182 |
133 |
jt_eaton |
}
|
| 183 |
|
|
}
|
| 184 |
|
|
}
|
| 185 |
|
|
|
| 186 |
|
|
|
| 187 |
|
|
if($tb_tool eq "coverage")
|
| 188 |
|
|
{
|
| 189 |
|
|
print " SIM COVERAGE testbench $vendor $library $component $tb_variant \n";
|
| 190 |
|
|
$cmd ="./tools/simulation/build_coverage -work_site $prefix -vendor $vendor -library $library -component $component -version $tb_version \n";
|
| 191 |
|
|
if (system($cmd)) {}
|
| 192 |
|
|
}
|
| 193 |
|
|
elsif($tb_tool eq "icarus")
|
| 194 |
|
|
{
|
| 195 |
|
|
print " SIM ICARUS testbench $vendor $library $component $tb_variant \n";
|
| 196 |
|
|
$cmd ="./tools/simulation/build_icarus_filelists -work_site $prefix -vendor $vendor -library $library -component $component -version $tb_version \n";
|
| 197 |
|
|
if (system($cmd)) {}
|
| 198 |
|
|
}
|
| 199 |
|
|
elsif($tb_tool eq "verilator")
|
| 200 |
|
|
{
|
| 201 |
|
|
print " SIM VERILATOR testbench $vendor $library $component $tb_variant \n";
|
| 202 |
|
|
$cmd ="./tools/simulation/build_verilator_filelists -work_site $prefix -vendor $vendor -library $library -component $component -version $tb_version \n";
|
| 203 |
|
|
if (system($cmd)) {}
|
| 204 |
|
|
}
|
| 205 |
|
|
elsif($tb_tool eq "rtl_check")
|
| 206 |
|
|
{
|
| 207 |
|
|
print " SIM RTL_CHECK testbench $vendor $library $component $tb_variant \n";
|
| 208 |
|
|
$cmd ="./tools/simulation/build_lint_filelists -work_site $prefix -vendor $vendor -library $library -component $component -version $tb_version \n";
|
| 209 |
|
|
if (system($cmd)) {}
|
| 210 |
|
|
}
|
| 211 |
|
|
}
|
| 212 |
|
|
|
| 213 |
|
|
}
|
| 214 |
|
|
|
| 215 |
|
|
|
| 216 |
|
|
#/*********************************************************************************************/
|
| 217 |
|
|
#/ files for synthesys */
|
| 218 |
|
|
#/ */
|
| 219 |
|
|
#/*********************************************************************************************/
|
| 220 |
|
|
|
| 221 |
135 |
jt_eaton |
foreach my $i_name ($socgen_file->findnodes("//socgen:syn/socgen:fpgas/socgen:fpga/socgen:version"))
|
| 222 |
133 |
jt_eaton |
{
|
| 223 |
135 |
jt_eaton |
my $ise_version = $i_name ->findnodes('./text()')->to_literal ;
|
| 224 |
|
|
print " SYN ISE $vendor $library $component $ise_version \n";
|
| 225 |
133 |
jt_eaton |
|
| 226 |
|
|
@filelist = ( );
|
| 227 |
135 |
jt_eaton |
@filelist = yp::lib::parse_component_file("$vendor","$library","$component","$ise_version");
|
| 228 |
133 |
jt_eaton |
|
| 229 |
|
|
foreach $line (@filelist)
|
| 230 |
|
|
{
|
| 231 |
|
|
$_ = $line;
|
| 232 |
|
|
if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
|
| 233 |
|
|
{
|
| 234 |
|
|
$new_vendor = $1;
|
| 235 |
|
|
$new_proj = $2;
|
| 236 |
|
|
$new_comp = $3;
|
| 237 |
|
|
$new_version = $4;
|
| 238 |
|
|
}
|
| 239 |
|
|
|
| 240 |
135 |
jt_eaton |
if( ($vendor eq $new_vendor) && ( $library eq $new_proj) && ( $component eq $new_comp ) && ( $ise_version eq $new_version ) )
|
| 241 |
133 |
jt_eaton |
{
|
| 242 |
135 |
jt_eaton |
push @kids , "::${prefix}::${library}::${component}::${vendor}::${ise_version}::";
|
| 243 |
133 |
jt_eaton |
}
|
| 244 |
|
|
else
|
| 245 |
|
|
{
|
| 246 |
135 |
jt_eaton |
push @kids , "::/${child_dir}::${new_proj}::${new_comp}::${new_vendor}::${new_version}::";
|
| 247 |
133 |
jt_eaton |
}
|
| 248 |
|
|
}
|
| 249 |
|
|
}
|
| 250 |
|
|
|
| 251 |
|
|
}
|
| 252 |
|
|
}
|
| 253 |
|
|
|
| 254 |
|
|
|
| 255 |
|
|
|
| 256 |
|
|
|
| 257 |
|
|
#/**********************************************************************/
|
| 258 |
|
|
#/* */
|
| 259 |
|
|
#/* Sort out the duplicate names and then build the rtl for every */
|
| 260 |
|
|
#/* component needed for simulations or synthesys */
|
| 261 |
|
|
#/* */
|
| 262 |
|
|
#/**********************************************************************/
|
| 263 |
|
|
|
| 264 |
|
|
|
| 265 |
|
|
@kids = sys::lib::trim_sort(@kids);
|
| 266 |
|
|
foreach my $kid (@kids)
|
| 267 |
|
|
{
|
| 268 |
|
|
$_ = $kid;
|
| 269 |
|
|
|
| 270 |
|
|
if(/::(\S+)::(\S+)::(\S+)::(\S+)::(\S+)::/)
|
| 271 |
|
|
{
|
| 272 |
|
|
my $kid_prefix = $1;
|
| 273 |
|
|
my $kid_library = $2;
|
| 274 |
|
|
my $kid_component = $3;
|
| 275 |
|
|
my $kid_vendor = $4;
|
| 276 |
|
|
my $kid_version = $5;
|
| 277 |
|
|
|
| 278 |
|
|
|
| 279 |
|
|
|
| 280 |
|
|
|
| 281 |
|
|
|
| 282 |
|
|
|
| 283 |
|
|
|
| 284 |
|
|
|
| 285 |
|
|
#############################################################################
|
| 286 |
|
|
##
|
| 287 |
|
|
##
|
| 288 |
|
|
#############################################################################
|
| 289 |
|
|
|
| 290 |
|
|
|
| 291 |
|
|
|
| 292 |
|
|
|
| 293 |
|
|
my $lib_comp_sep = yp::lib::find_lib_comp_sep($kid_vendor,$kid_library,$kid_component);
|
| 294 |
|
|
|
| 295 |
|
|
|
| 296 |
|
|
|
| 297 |
|
|
|
| 298 |
|
|
|
| 299 |
|
|
|
| 300 |
|
|
|
| 301 |
|
|
|
| 302 |
|
|
|
| 303 |
|
|
#/*********************************************************************************************/
|
| 304 |
|
|
#/ */
|
| 305 |
|
|
#/ Create filelists for simulation, synthesis and linting */
|
| 306 |
|
|
#/ */
|
| 307 |
|
|
#/ */
|
| 308 |
|
|
#/*********************************************************************************************/
|
| 309 |
|
|
|
| 310 |
|
|
my @filelist = yp::lib::parse_component_brothers("$kid_vendor","$kid_library","$kid_component","$kid_version");
|
| 311 |
|
|
|
| 312 |
|
|
foreach $line (@filelist)
|
| 313 |
|
|
{
|
| 314 |
|
|
$_ = $line;
|
| 315 |
|
|
if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
|
| 316 |
|
|
{
|
| 317 |
|
|
$new_library = $2;
|
| 318 |
|
|
$new_component = $3;
|
| 319 |
|
|
$new_vendor = $1;
|
| 320 |
|
|
$new_version = $4;
|
| 321 |
|
|
|
| 322 |
|
|
|
| 323 |
|
|
my $spirit_component_file = $parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_component,$new_version));
|
| 324 |
|
|
|
| 325 |
135 |
jt_eaton |
foreach my $i_name ($spirit_component_file->findnodes("//ipxact:componentGenerator/ipxact:name"))
|
| 326 |
133 |
jt_eaton |
{
|
| 327 |
135 |
jt_eaton |
my($gen_name) = $i_name ->findnodes('../ipxact:name/text()')->to_literal ;
|
| 328 |
|
|
my($gen_generatorExe) = $i_name ->findnodes('../ipxact:generatorExe/text()')->to_literal ;
|
| 329 |
|
|
my($gen_phase) = $i_name ->findnodes('../ipxact:phase/text()')->to_literal ;
|
| 330 |
133 |
jt_eaton |
|
| 331 |
|
|
|
| 332 |
|
|
my $cmd;
|
| 333 |
|
|
$cmd = " -prefix $kid_prefix -vendor $kid_vendor -library $kid_library -component $kid_component -version $kid_version ";
|
| 334 |
|
|
|
| 335 |
135 |
jt_eaton |
foreach my $i_name ($spirit_component_file->findnodes("//ipxact:componentGenerator[ipxact:name/text() = '$gen_name']/ipxact:parameters/ipxact:parameter"))
|
| 336 |
133 |
jt_eaton |
{
|
| 337 |
135 |
jt_eaton |
my($gen_param) = $i_name ->findnodes('./ipxact:value/text()')->to_literal ;
|
| 338 |
|
|
my($gen_param_name) = $i_name ->findnodes('./ipxact:name/text()')->to_literal ;
|
| 339 |
133 |
jt_eaton |
|
| 340 |
|
|
if ($gen_param_name eq "in_pipe") {$cmd = "$cmd <${home}${kid_prefix}/${kid_vendor}__${kid_library}${lib_comp_sep}${kid_component}/${gen_param}";}
|
| 341 |
|
|
elsif($gen_param_name eq "out_pipe") {$cmd = "$cmd >${home}${kid_prefixn}/${kid_vendor}__${kid_library}${lib_comp_sep}${kid_component}/${gen_param}";}
|
| 342 |
|
|
elsif($gen_param_name) {$cmd = "$cmd -${gen_param_name} $gen_param ";}
|
| 343 |
|
|
else {$cmd = "$cmd $gen_param";}
|
| 344 |
|
|
}
|
| 345 |
|
|
|
| 346 |
135 |
jt_eaton |
foreach my $i_name ($spirit_component_file->findnodes("//ipxact:componentGenerator[ipxact:name/text() = '$gen_name']/ipxact:vendorExtensions/socgen:envIdentifier"))
|
| 347 |
133 |
jt_eaton |
{
|
| 348 |
|
|
my($gen_envidentifier) = $i_name ->findnodes('./text()')->to_literal ;
|
| 349 |
|
|
|
| 350 |
|
|
my $New_cmd = " ${gen_generatorExe} -envidentifier $gen_envidentifier ${cmd}\n";
|
| 351 |
|
|
if(${gen_generatorExe} )
|
| 352 |
|
|
{
|
| 353 |
|
|
push @cmd_list, "${gen_phase}::$New_cmd";
|
| 354 |
|
|
}
|
| 355 |
|
|
}
|
| 356 |
|
|
}
|
| 357 |
|
|
}
|
| 358 |
|
|
}
|
| 359 |
|
|
|
| 360 |
|
|
|
| 361 |
|
|
|
| 362 |
|
|
|
| 363 |
|
|
|
| 364 |
|
|
|
| 365 |
|
|
|
| 366 |
|
|
|
| 367 |
|
|
}
|
| 368 |
|
|
|
| 369 |
|
|
}
|
| 370 |
|
|
|
| 371 |
|
|
|
| 372 |
|
|
|
| 373 |
|
|
|
| 374 |
|
|
@cmd_list = sys::lib::trim_sort(@cmd_list);
|
| 375 |
|
|
my $cmd;
|
| 376 |
|
|
my $phase;
|
| 377 |
|
|
|
| 378 |
|
|
foreach my $Cmd_line (@cmd_list)
|
| 379 |
|
|
{
|
| 380 |
|
|
|
| 381 |
|
|
( $phase,$cmd) = split( /\::/ , $Cmd_line);
|
| 382 |
|
|
if (system($cmd)) {}
|
| 383 |
|
|
}
|
| 384 |
|
|
|
| 385 |
|
|
|
| 386 |
|
|
|
| 387 |
131 |
jt_eaton |
return(0);
|
| 388 |
133 |
jt_eaton |
}
|
| 389 |
|
|
|
| 390 |
|
|
|
| 391 |
|
|
|
| 392 |
|
|
|
| 393 |
|
|
|
| 394 |
|
|
|
| 395 |
|
|
|
| 396 |
|
|
|
| 397 |
|
|
|
| 398 |
|
|
|
| 399 |
|
|
|
| 400 |
|
|
|
| 401 |
|
|
|
| 402 |
|
|
|
| 403 |
|
|
|