| 1 |
131 |
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-2013> */
|
| 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 |
|
|
# General PERL config
|
| 49 |
|
|
############################################################################
|
| 50 |
|
|
use Getopt::Long;
|
| 51 |
|
|
use English;
|
| 52 |
|
|
use File::Basename;
|
| 53 |
|
|
use Cwd;
|
| 54 |
|
|
use XML::LibXML;
|
| 55 |
|
|
use lib './tools';
|
| 56 |
|
|
use sys::lib;
|
| 57 |
|
|
use yp::lib;
|
| 58 |
|
|
use Parallel::ForkManager;
|
| 59 |
|
|
|
| 60 |
|
|
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
|
| 61 |
|
|
|
| 62 |
|
|
|
| 63 |
|
|
############################################################################
|
| 64 |
|
|
### Process the options
|
| 65 |
|
|
############################################################################
|
| 66 |
|
|
Getopt::Long::config("require_order", "prefix=-");
|
| 67 |
|
|
GetOptions("h","help",
|
| 68 |
|
|
) || die "(use '$program_name -h' for help)";
|
| 69 |
|
|
|
| 70 |
|
|
|
| 71 |
|
|
|
| 72 |
|
|
|
| 73 |
|
|
##############################################################################
|
| 74 |
|
|
## Help option
|
| 75 |
|
|
##############################################################################
|
| 76 |
|
|
if ( $opt_h or $opt_help )
|
| 77 |
|
|
{ print "\n build_sim_master";
|
| 78 |
|
|
print "\n";
|
| 79 |
|
|
exit 1;
|
| 80 |
|
|
}
|
| 81 |
|
|
|
| 82 |
|
|
|
| 83 |
|
|
my $parser = XML::LibXML->new();
|
| 84 |
|
|
|
| 85 |
|
|
|
| 86 |
|
|
my $cmd;
|
| 87 |
|
|
my @cmds = ();
|
| 88 |
|
|
my @cov_cmds = ();
|
| 89 |
|
|
my @rep_cmds = ();
|
| 90 |
|
|
|
| 91 |
|
|
|
| 92 |
|
|
|
| 93 |
|
|
#/**********************************************************************/
|
| 94 |
|
|
#/* Process each library by finding any ip-xact file in any component */
|
| 95 |
|
|
#/* */
|
| 96 |
|
|
#/* Each ip-xact file is parsed and it's filename and the names of any*/
|
| 97 |
|
|
#/* modules that it uses are saved. */
|
| 98 |
|
|
#/* */
|
| 99 |
|
|
#/* */
|
| 100 |
|
|
#/**********************************************************************/
|
| 101 |
|
|
|
| 102 |
|
|
my $home = cwd();
|
| 103 |
|
|
|
| 104 |
|
|
my $prefix = yp::lib::get_workspace();
|
| 105 |
|
|
$prefix = "/${prefix}";
|
| 106 |
|
|
|
| 107 |
|
|
my @vendors = yp::lib::find_vendors();
|
| 108 |
|
|
|
| 109 |
|
|
foreach my $vendor (@vendors)
|
| 110 |
|
|
{
|
| 111 |
|
|
my $vendor_status = yp::lib::get_vendor_status($vendor);
|
| 112 |
|
|
if($vendor_status eq "active")
|
| 113 |
|
|
{
|
| 114 |
|
|
my @libraries = yp::lib::find_libraries($vendor);
|
| 115 |
|
|
foreach my $library (@libraries)
|
| 116 |
|
|
{
|
| 117 |
|
|
my $library_status = yp::lib::get_library_status($vendor,$library);
|
| 118 |
|
|
if($library_status eq "active")
|
| 119 |
|
|
{
|
| 120 |
|
|
print " $vendor $library \n";
|
| 121 |
|
|
my @components = yp::lib::find_components($vendor,$library);
|
| 122 |
|
|
|
| 123 |
|
|
foreach my $component (@components)
|
| 124 |
|
|
{
|
| 125 |
|
|
my $socgen_filename = yp::lib::find_componentConfiguration($vendor,$library,$component);
|
| 126 |
|
|
|
| 127 |
|
|
if($socgen_filename)
|
| 128 |
|
|
{
|
| 129 |
|
|
my $socgen_file = $parser->parse_file($socgen_filename);
|
| 130 |
|
|
my $sim_library_path ;
|
| 131 |
|
|
my $lib_comp_sep = yp::lib::find_lib_comp_sep($vendor,$library,$component);
|
| 132 |
|
|
my $sim_comp_path = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:comp_path/text()")->to_literal;
|
| 133 |
|
|
|
| 134 |
|
|
if ($sim_comp_path)
|
| 135 |
|
|
{
|
| 136 |
|
|
$sim_library_path ="${lib_comp_sep}${sim_comp_path}";
|
| 137 |
|
|
}
|
| 138 |
|
|
else
|
| 139 |
|
|
{
|
| 140 |
|
|
$sim_library_path = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:library_path/text()")->to_literal;
|
| 141 |
|
|
}
|
| 142 |
|
|
|
| 143 |
|
|
|
| 144 |
|
|
foreach my $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:icarus/socgen:test/socgen:name"))
|
| 145 |
|
|
{
|
| 146 |
|
|
my($sim_name) = $i_name ->findnodes('./text()')->to_literal ;
|
| 147 |
|
|
my($sim_configuration) = $i_name ->findnodes('../socgen:configuration/text()')->to_literal ;
|
| 148 |
|
|
my($sim_variant) = $i_name ->findnodes('../socgen:variant/text()')->to_literal ;
|
| 149 |
|
|
$cmd ="./tools/simulation/run_icarus $vendor $library $sim_library_path $sim_name $sim_variant \n";
|
| 150 |
|
|
push @cmds,$cmd;
|
| 151 |
|
|
}
|
| 152 |
|
|
|
| 153 |
|
|
foreach my $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:verilator/socgen:test/socgen:name"))
|
| 154 |
|
|
{
|
| 155 |
|
|
my($sim_name) = $i_name ->findnodes('./text()')->to_literal ;
|
| 156 |
|
|
my($sim_configuration) = $i_name ->findnodes('../socgen:configuration/text()')->to_literal ;
|
| 157 |
|
|
my($sim_variant) = $i_name ->findnodes('../socgen:variant/text()')->to_literal ;
|
| 158 |
|
|
$cmd ="./tools/simulation/run_verilator $vendor $library $sim_library_path $sim_name $sim_variant \n";
|
| 159 |
|
|
push @cmds,$cmd;
|
| 160 |
|
|
}
|
| 161 |
|
|
|
| 162 |
|
|
|
| 163 |
|
|
|
| 164 |
|
|
foreach my $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:rtl_check/socgen:lint/socgen:name"))
|
| 165 |
|
|
{
|
| 166 |
|
|
my($sim_name) = $i_name ->findnodes('./text()')->to_literal ;
|
| 167 |
|
|
my($sim_configuration) = $i_name ->findnodes('../socgen:configuration/text()')->to_literal ;
|
| 168 |
|
|
my($sim_variant) = $i_name ->findnodes('../socgen:variant/text()')->to_literal ;
|
| 169 |
|
|
print " lint $sim_name $sim_configuration $sim_variant ";
|
| 170 |
|
|
$cmd ="cd .${prefix}/${vendor}__${library}${sim_library_path}/rtl_check/${sim_name};make lint";
|
| 171 |
|
|
push @cmds,$cmd;
|
| 172 |
|
|
}
|
| 173 |
|
|
|
| 174 |
|
|
|
| 175 |
|
|
|
| 176 |
|
|
|
| 177 |
|
|
|
| 178 |
|
|
#/*********************************************************************************************/
|
| 179 |
|
|
#/ create coverage database .cdd file */
|
| 180 |
|
|
#/ */
|
| 181 |
|
|
#/*********************************************************************************************/
|
| 182 |
|
|
|
| 183 |
|
|
foreach my $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:testbenches/socgen:testbench/socgen:tools/socgen:tool"))
|
| 184 |
|
|
{
|
| 185 |
|
|
my($tb_tool) = $i_name ->findnodes('./text()')->to_literal ;
|
| 186 |
|
|
my($tb_variant) = $i_name ->findnodes('../../socgen:variant/text()')->to_literal ;
|
| 187 |
|
|
my($tb_version) = $i_name ->findnodes('../../socgen:version/text()')->to_literal ;
|
| 188 |
|
|
if($tb_tool eq "coverage")
|
| 189 |
|
|
{
|
| 190 |
|
|
print " COVERAGEs $tb_tool $tb_variant $tb_version \n";
|
| 191 |
|
|
$cmd= "cd ./${prefix}/${vendor}__${library}${sim_library_path}/cov/${tb_variant};make build_cdd \n";
|
| 192 |
|
|
push @cmds,$cmd;
|
| 193 |
|
|
|
| 194 |
|
|
foreach my $i_name ($socgen_file->findnodes("//socgen:test/socgen:variant"))
|
| 195 |
|
|
{
|
| 196 |
|
|
my($test_variant) = $i_name ->findnodes('./text()')->to_literal ;
|
| 197 |
|
|
my($test_name) = $i_name ->findnodes('../socgen:name/text()')->to_literal ;
|
| 198 |
|
|
|
| 199 |
|
|
if($tb_variant eq $test_variant )
|
| 200 |
|
|
{
|
| 201 |
|
|
print " $tb_variant $test_variant $test_name \n";
|
| 202 |
|
|
$cmd= "cd ./${prefix}/${vendor}__${library}${sim_library_path}/cov/${tb_variant};make score_cov TEST=${test_name} \n";
|
| 203 |
|
|
push @cov_cmds,$cmd;
|
| 204 |
|
|
}
|
| 205 |
|
|
}
|
| 206 |
|
|
$cmd= "cd ./${prefix}/${vendor}__${library}${sim_library_path}/cov/${tb_variant};make report_cov \n";
|
| 207 |
|
|
push @rep_cmds,$cmd;
|
| 208 |
|
|
}
|
| 209 |
|
|
}
|
| 210 |
|
|
|
| 211 |
|
|
|
| 212 |
|
|
|
| 213 |
|
|
|
| 214 |
|
|
}
|
| 215 |
|
|
|
| 216 |
|
|
}
|
| 217 |
|
|
}
|
| 218 |
|
|
}
|
| 219 |
|
|
}
|
| 220 |
|
|
}
|
| 221 |
|
|
|
| 222 |
|
|
|
| 223 |
|
|
my $manager = new Parallel::ForkManager( 6 );
|
| 224 |
|
|
|
| 225 |
|
|
foreach $cmd (@cmds)
|
| 226 |
|
|
{
|
| 227 |
|
|
$manager->start and next;
|
| 228 |
|
|
system($cmd);
|
| 229 |
|
|
$manager->finish;
|
| 230 |
|
|
}
|
| 231 |
|
|
|
| 232 |
|
|
$manager->wait_all_children;
|
| 233 |
|
|
print "run_sims COMPLETE \n";
|
| 234 |
|
|
|
| 235 |
|
|
|
| 236 |
|
|
|
| 237 |
|
|
|
| 238 |
|
|
|
| 239 |
|
|
foreach $cmd (@cov_cmds)
|
| 240 |
|
|
{
|
| 241 |
|
|
$manager->start and next;
|
| 242 |
|
|
system($cmd);
|
| 243 |
|
|
$manager->finish;
|
| 244 |
|
|
}
|
| 245 |
|
|
|
| 246 |
|
|
$manager->wait_all_children;
|
| 247 |
|
|
print "coverage COMPLETE \n";
|
| 248 |
|
|
|
| 249 |
|
|
|
| 250 |
|
|
|
| 251 |
|
|
|
| 252 |
|
|
foreach $cmd (@rep_cmds)
|
| 253 |
|
|
{
|
| 254 |
|
|
$manager->start and next;
|
| 255 |
|
|
system($cmd);
|
| 256 |
|
|
$manager->finish;
|
| 257 |
|
|
}
|
| 258 |
|
|
|
| 259 |
|
|
$manager->wait_all_children;
|
| 260 |
|
|
print "coverage reports COMPLETE \n";
|
| 261 |
|
|
|
| 262 |
|
|
|
| 263 |
|
|
|
| 264 |
|
|
|
| 265 |
|
|
|
| 266 |
|
|
|