| 1 |
119 |
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 |
|
|
# 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 |
131 |
jt_eaton |
use Parallel::ForkManager;
|
| 59 |
119 |
jt_eaton |
|
| 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 |
131 |
jt_eaton |
{ print "\n run_sims vendor library";
|
| 78 |
119 |
jt_eaton |
print "\n";
|
| 79 |
|
|
exit 1;
|
| 80 |
|
|
}
|
| 81 |
|
|
|
| 82 |
|
|
|
| 83 |
|
|
#/**********************************************************************/
|
| 84 |
131 |
jt_eaton |
#/* Process each library by finding any ip-xact file in any component */
|
| 85 |
119 |
jt_eaton |
#/* */
|
| 86 |
|
|
#/* Each ip-xact file is parsed and it's filename and the names of any*/
|
| 87 |
|
|
#/* modules that it uses are saved. */
|
| 88 |
|
|
#/* */
|
| 89 |
|
|
#/* */
|
| 90 |
|
|
#/**********************************************************************/
|
| 91 |
|
|
|
| 92 |
|
|
|
| 93 |
|
|
my $home = cwd();
|
| 94 |
|
|
my $vendor ;
|
| 95 |
131 |
jt_eaton |
my $library ;
|
| 96 |
119 |
jt_eaton |
|
| 97 |
|
|
|
| 98 |
131 |
jt_eaton |
my $prefix = yp::lib::get_workspace();
|
| 99 |
119 |
jt_eaton |
|
| 100 |
|
|
$_ = $ARGV[0];
|
| 101 |
|
|
|
| 102 |
|
|
|
| 103 |
131 |
jt_eaton |
|
| 104 |
119 |
jt_eaton |
if(/(\S+)__(\S+)/)
|
| 105 |
|
|
{
|
| 106 |
|
|
$vendor = $1;
|
| 107 |
131 |
jt_eaton |
$library = $2;
|
| 108 |
119 |
jt_eaton |
}
|
| 109 |
|
|
|
| 110 |
|
|
my $parser = XML::LibXML->new();
|
| 111 |
|
|
|
| 112 |
|
|
|
| 113 |
|
|
|
| 114 |
131 |
jt_eaton |
my @components = yp::lib::find_components($vendor,$library);
|
| 115 |
119 |
jt_eaton |
|
| 116 |
|
|
foreach my $component (@components)
|
| 117 |
|
|
{
|
| 118 |
131 |
jt_eaton |
my $socgen_filename = yp::lib::find_componentConfiguration($vendor,$library,$component);
|
| 119 |
|
|
|
| 120 |
|
|
if($socgen_filename)
|
| 121 |
|
|
{
|
| 122 |
|
|
my $socgen_file = $parser->parse_file($socgen_filename);
|
| 123 |
130 |
jt_eaton |
my $sim_library_path ;
|
| 124 |
131 |
jt_eaton |
my $lib_comp_sep = yp::lib::find_lib_comp_sep($vendor,$library,$component);
|
| 125 |
130 |
jt_eaton |
my $sim_comp_path = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:comp_path/text()")->to_literal;
|
| 126 |
119 |
jt_eaton |
|
| 127 |
130 |
jt_eaton |
if ($sim_comp_path)
|
| 128 |
|
|
{
|
| 129 |
|
|
$sim_library_path ="${lib_comp_sep}${sim_comp_path}";
|
| 130 |
|
|
}
|
| 131 |
|
|
else
|
| 132 |
|
|
{
|
| 133 |
|
|
$sim_library_path = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:library_path/text()")->to_literal;
|
| 134 |
|
|
}
|
| 135 |
128 |
jt_eaton |
|
| 136 |
|
|
|
| 137 |
130 |
jt_eaton |
|
| 138 |
|
|
|
| 139 |
119 |
jt_eaton |
#/*********************************************************************************************/
|
| 140 |
|
|
#/ files for simulation */
|
| 141 |
|
|
#/ */
|
| 142 |
|
|
#/*********************************************************************************************/
|
| 143 |
131 |
jt_eaton |
my $cmd;
|
| 144 |
|
|
my @cmds = ();
|
| 145 |
|
|
my $manager = new Parallel::ForkManager( 6 );
|
| 146 |
119 |
jt_eaton |
|
| 147 |
131 |
jt_eaton |
|
| 148 |
130 |
jt_eaton |
foreach my $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:icarus/socgen:test/socgen:name"))
|
| 149 |
119 |
jt_eaton |
{
|
| 150 |
|
|
my($sim_name) = $i_name ->findnodes('./text()')->to_literal ;
|
| 151 |
|
|
my($sim_configuration) = $i_name ->findnodes('../socgen:configuration/text()')->to_literal ;
|
| 152 |
|
|
my($sim_variant) = $i_name ->findnodes('../socgen:variant/text()')->to_literal ;
|
| 153 |
131 |
jt_eaton |
$cmd ="./tools/simulation/run_icarus $vendor $library $sim_library_path $sim_name $sim_variant \n";
|
| 154 |
|
|
push @cmds,$cmd;
|
| 155 |
|
|
}
|
| 156 |
119 |
jt_eaton |
|
| 157 |
|
|
|
| 158 |
|
|
|
| 159 |
131 |
jt_eaton |
foreach my $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:verilator/socgen:test/socgen:name"))
|
| 160 |
126 |
jt_eaton |
{
|
| 161 |
|
|
my($sim_name) = $i_name ->findnodes('./text()')->to_literal ;
|
| 162 |
|
|
my($sim_configuration) = $i_name ->findnodes('../socgen:configuration/text()')->to_literal ;
|
| 163 |
|
|
my($sim_variant) = $i_name ->findnodes('../socgen:variant/text()')->to_literal ;
|
| 164 |
131 |
jt_eaton |
$cmd ="./tools/simulation/run_verilator $vendor $library $sim_library_path $sim_name $sim_variant \n";
|
| 165 |
|
|
if(system($cmd)){};
|
| 166 |
119 |
jt_eaton |
}
|
| 167 |
|
|
|
| 168 |
131 |
jt_eaton |
|
| 169 |
|
|
foreach $cmd (@cmds)
|
| 170 |
|
|
{
|
| 171 |
|
|
$manager->start and next;
|
| 172 |
|
|
system($cmd);
|
| 173 |
|
|
$manager->finish;
|
| 174 |
|
|
}
|
| 175 |
|
|
|
| 176 |
|
|
$manager->wait_all_children;
|
| 177 |
|
|
print "run_sims COMPLETE \n";
|
| 178 |
|
|
|
| 179 |
119 |
jt_eaton |
}
|
| 180 |
|
|
|
| 181 |
131 |
jt_eaton |
}
|
| 182 |
119 |
jt_eaton |
|