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 |
|
|
|
59 |
|
|
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
############################################################################
|
63 |
|
|
### Process the options
|
64 |
|
|
############################################################################
|
65 |
|
|
Getopt::Long::config("require_order", "prefix=-");
|
66 |
|
|
GetOptions("h","help",
|
67 |
|
|
) || die "(use '$program_name -h' for help)";
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
##############################################################################
|
73 |
|
|
## Help option
|
74 |
|
|
##############################################################################
|
75 |
|
|
if ( $opt_h or $opt_help )
|
76 |
|
|
{ print "\n run_sims project_name project_vendor";
|
77 |
|
|
print "\n";
|
78 |
|
|
exit 1;
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
|
82 |
|
|
#/**********************************************************************/
|
83 |
|
|
#/* Process each project by finding any ip-xact file in any component */
|
84 |
|
|
#/* */
|
85 |
|
|
#/* Each ip-xact file is parsed and it's filename and the names of any*/
|
86 |
|
|
#/* modules that it uses are saved. */
|
87 |
|
|
#/* */
|
88 |
|
|
#/* */
|
89 |
|
|
#/**********************************************************************/
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
my $home = cwd();
|
93 |
|
|
my $vendor ;
|
94 |
|
|
my $project ;
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
$_ = $ARGV[0];
|
100 |
|
|
my $work_site = $ARGV[1];
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
if(/(\S+)__(\S+)/)
|
104 |
|
|
{
|
105 |
|
|
$vendor = $1;
|
106 |
|
|
$project = $2;
|
107 |
|
|
}
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
my $parser = XML::LibXML->new();
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
|
123 |
124 |
jt_eaton |
my @components = yp::lib::find_components("socgen:componentConfiguration",$vendor,$project);
|
124 |
119 |
jt_eaton |
|
125 |
|
|
foreach my $component (@components)
|
126 |
|
|
{
|
127 |
124 |
jt_eaton |
my $sogen_file = $parser->parse_file(yp::lib::find_socgen("socgen:componentConfiguration",$vendor,$project,$component));
|
128 |
128 |
jt_eaton |
my $sim_library_path = $sogen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:library_path/text()")->to_literal;
|
129 |
119 |
jt_eaton |
|
130 |
128 |
jt_eaton |
|
131 |
|
|
|
132 |
119 |
jt_eaton |
#/*********************************************************************************************/
|
133 |
|
|
#/ files for simulation */
|
134 |
|
|
#/ */
|
135 |
|
|
#/*********************************************************************************************/
|
136 |
|
|
|
137 |
124 |
jt_eaton |
foreach my $i_name ($sogen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:icarus/socgen:test/socgen:name"))
|
138 |
119 |
jt_eaton |
{
|
139 |
|
|
my($sim_name) = $i_name ->findnodes('./text()')->to_literal ;
|
140 |
|
|
my($sim_configuration) = $i_name ->findnodes('../socgen:configuration/text()')->to_literal ;
|
141 |
|
|
my($sim_variant) = $i_name ->findnodes('../socgen:variant/text()')->to_literal ;
|
142 |
|
|
|
143 |
|
|
print " SIMs $sim_name $sim_configuration $sim_variant ";
|
144 |
128 |
jt_eaton |
chdir ".${work_site}/${vendor}__${project}${sim_library_path}/icarus/${sim_name}";
|
145 |
119 |
jt_eaton |
|
146 |
128 |
jt_eaton |
$cmd ="iverilog -f ../../testbenches/filelists/${sim_variant}.sim -D VCD 2> ./${sim_name}_elab.log | tee >> ./${$sim_name}_elab.log \n";
|
147 |
119 |
jt_eaton |
if (system($cmd)) {}
|
148 |
|
|
$cmd ="./a.out 2> ./${sim_name}_sim.log | tee >> ./${sim_name}_sim.log \n";
|
149 |
|
|
if (system($cmd)) {}
|
150 |
|
|
$cmd ="grep PASSED ./${sim_name}_sim.log \n";
|
151 |
|
|
if (system($cmd)) {}
|
152 |
|
|
$cmd ="rm a.out \n";
|
153 |
|
|
if (system($cmd)) {}
|
154 |
|
|
|
155 |
|
|
chdir $home;
|
156 |
126 |
jt_eaton |
}
|
157 |
119 |
jt_eaton |
|
158 |
|
|
|
159 |
126 |
jt_eaton |
|
160 |
|
|
foreach my $i_name ($sogen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:verilator/socgen:test/socgen:name"))
|
161 |
|
|
{
|
162 |
|
|
my($sim_name) = $i_name ->findnodes('./text()')->to_literal ;
|
163 |
|
|
my($sim_configuration) = $i_name ->findnodes('../socgen:configuration/text()')->to_literal ;
|
164 |
|
|
my($sim_variant) = $i_name ->findnodes('../socgen:variant/text()')->to_literal ;
|
165 |
|
|
print " VSIMs $sim_name $sim_configuration $sim_variant ";
|
166 |
128 |
jt_eaton |
chdir ".${work_site}/${vendor}__${project}${sim_library_path}/verilator/${sim_name}";
|
167 |
126 |
jt_eaton |
$cmd ="make verilator\n";
|
168 |
|
|
if (system($cmd)) {}
|
169 |
|
|
chdir $home;
|
170 |
119 |
jt_eaton |
}
|
171 |
|
|
|
172 |
|
|
}
|
173 |
|
|
|
174 |
|
|
|
175 |
|
|
|