1 |
135 |
jt_eaton |
eval 'exec `which perl` -S $0 ${1+"$@"}'
|
2 |
|
|
if 0;
|
3 |
|
|
#/**********************************************************************/
|
4 |
|
|
#/* */
|
5 |
|
|
#/* ------- */
|
6 |
|
|
#/* / SOC \ */
|
7 |
|
|
#/* / GEN \ */
|
8 |
|
|
#/* / TOOL \ */
|
9 |
|
|
#/* ============== */
|
10 |
|
|
#/* | | */
|
11 |
|
|
#/* |____________| */
|
12 |
|
|
#/* */
|
13 |
|
|
#/* */
|
14 |
|
|
#/* */
|
15 |
|
|
#/* */
|
16 |
|
|
#/* Author(s): */
|
17 |
|
|
#/* - John Eaton, jt_eaton@opencores.org */
|
18 |
|
|
#/* */
|
19 |
|
|
#/**********************************************************************/
|
20 |
|
|
#/* */
|
21 |
|
|
#/* Copyright (C) <2016> */
|
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 Scalar::Util qw(looks_like_number);
|
55 |
|
|
use XML::LibXML;
|
56 |
|
|
use lib './tools';
|
57 |
|
|
use sys::lib;
|
58 |
|
|
use yp::lib;
|
59 |
|
|
use BerkeleyDB;
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
############################################################################
|
66 |
|
|
### Process the options
|
67 |
|
|
############################################################################
|
68 |
|
|
Getopt::Long::config("require_order", "prefix=-");
|
69 |
|
|
GetOptions("h","help",
|
70 |
|
|
"vendor=s" => \$vendor,
|
71 |
|
|
"library=s" => \$library,
|
72 |
|
|
"component=s" => \$component,
|
73 |
|
|
"version=s" => \$version,
|
74 |
|
|
"workspace",
|
75 |
|
|
"elaborate",
|
76 |
|
|
"gen_ports",
|
77 |
|
|
"gen_sigs",
|
78 |
|
|
"parse_comp",
|
79 |
|
|
"parse_design"
|
80 |
|
|
|
81 |
|
|
) || die "(use '$program_name -h' for help)";
|
82 |
|
|
|
83 |
|
|
my $program_name = "socgen";
|
84 |
|
|
|
85 |
|
|
##############################################################################
|
86 |
|
|
## Help option
|
87 |
|
|
##############################################################################
|
88 |
|
|
if ( $opt_h or $opt_help )
|
89 |
|
|
{ print "\n $program_name -h Print this message";
|
90 |
|
|
print "\n $program_name Print vendor list";
|
91 |
|
|
print "\n $program_name -vendor vendor_name Print vendor libraries";
|
92 |
|
|
print "\n $program_name -vendor vendor_name -library library_name Print component list";
|
93 |
|
|
print "\n $program_name -vendor vendor_name -library library_name -workspace Make workspace";
|
94 |
|
|
print "\n $program_name -vendor vendor_name -library library_name -component component_name Print System list";
|
95 |
|
|
print "\n $program_name -vendor vendor_name -library library_name -component component_name -version version_name -elaborate Elaborate System";
|
96 |
|
|
print "\n $program_name -vendor vendor_name -library library_name -component component_name -version version_name -gen_ports Create System Port list";
|
97 |
|
|
print "\n $program_name -vendor vendor_name -library library_name -component component_name -version version_name -gen_sigs Create Signal list";
|
98 |
|
|
print "\n $program_name -vendor vendor_name -library library_name -component component_name -version version_name -parse_comp Parse component;";
|
99 |
|
|
|
100 |
|
|
print "\n";
|
101 |
|
|
exit 1;
|
102 |
|
|
}
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
#############################################################################
|
107 |
|
|
##
|
108 |
|
|
##
|
109 |
|
|
#############################################################################
|
110 |
|
|
|
111 |
|
|
$home = cwd();
|
112 |
|
|
my $parser = XML::LibXML->new();
|
113 |
|
|
|
114 |
|
|
my $workspace = yp::lib::get_workspace;
|
115 |
|
|
|
116 |
|
|
unless (defined $vendor)
|
117 |
|
|
{
|
118 |
|
|
print "Socgen vendors \n \n";
|
119 |
|
|
my @vendors = yp::lib::find_vendors;
|
120 |
|
|
foreach $ven (@vendors)
|
121 |
|
|
{
|
122 |
|
|
my $vendor_status = yp::lib::get_vendor_status($ven);
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
print "$ven $vendor_status \n";
|
126 |
|
|
}
|
127 |
|
|
exit 0;
|
128 |
|
|
}
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
unless (defined $library)
|
132 |
|
|
{
|
133 |
|
|
print "$vendor libraries \n \n";
|
134 |
|
|
my @libraries = yp::lib::find_libraries($vendor);
|
135 |
|
|
foreach $lib (@libraries)
|
136 |
|
|
{
|
137 |
|
|
|
138 |
|
|
my $library_status = yp::lib::get_library_status($vendor,$lib);
|
139 |
|
|
|
140 |
|
|
print "$lib $library_status \n";
|
141 |
|
|
}
|
142 |
|
|
exit 0;
|
143 |
|
|
}
|
144 |
|
|
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
unless (defined $component)
|
148 |
|
|
{
|
149 |
|
|
if($opt_workspace)
|
150 |
|
|
{
|
151 |
|
|
my $cmd ="./tools/sys/workspace -vendor ${vendor} -library ${library} \n";
|
152 |
|
|
print "$cmd ";
|
153 |
|
|
exit 0
|
154 |
|
|
}
|
155 |
|
|
|
156 |
|
|
print "$vendor $library components \n \n";
|
157 |
|
|
my @components = yp::lib::find_components($vendor,$library);
|
158 |
|
|
foreach $comp (@components)
|
159 |
|
|
{
|
160 |
|
|
my $file = "";
|
161 |
|
|
$file = yp::lib::find_componentConfiguration($vendor,$library,$comp);
|
162 |
|
|
if( $file ne "") { print "$comp \n";}
|
163 |
|
|
}
|
164 |
|
|
exit 0;
|
165 |
|
|
}
|
166 |
|
|
|
167 |
|
|
|
168 |
|
|
unless (defined $version)
|
169 |
|
|
{
|
170 |
|
|
print "$vendor $library $components version \n \n";
|
171 |
|
|
my $socgen_filename = yp::lib::find_componentConfiguration($vendor,$library,$component);
|
172 |
|
|
if($socgen_filename)
|
173 |
|
|
{
|
174 |
|
|
my $socgen_file = $parser->parse_file($socgen_filename);
|
175 |
|
|
#/*********************************************************************************************/
|
176 |
|
|
#/ elaborate each testbench */
|
177 |
|
|
#/ */
|
178 |
|
|
#/*********************************************************************************************/
|
179 |
|
|
foreach my $j_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:testbenches/socgen:testbench/socgen:variant"))
|
180 |
|
|
{
|
181 |
|
|
my $testbench_variant = $j_name ->findnodes('./text()')->to_literal ;
|
182 |
|
|
my $testbench_version = $j_name ->findnodes('../socgen:version/text()')->to_literal ;
|
183 |
|
|
my $testbench_config = $j_name ->findnodes('../socgen:configuration/text()')->to_literal ;
|
184 |
|
|
my $testbench_instance = $j_name ->findnodes('../socgen:bus/socgen:instance/text()')->to_literal ;
|
185 |
|
|
my $testbench_bus_name = $j_name ->findnodes('../socgen:bus/socgen:bus_name/text()')->to_literal ;
|
186 |
|
|
print "$testbench_version $testbench_variant \n";
|
187 |
|
|
}
|
188 |
|
|
}
|
189 |
|
|
exit 0;
|
190 |
|
|
}
|
191 |
|
|
|
192 |
|
|
|
193 |
|
|
|
194 |
|
|
if($opt_elaborate)
|
195 |
|
|
{
|
196 |
|
|
my $socgen_filename = yp::lib::find_componentConfiguration($vendor,$library,$component);
|
197 |
|
|
if($socgen_filename)
|
198 |
|
|
{
|
199 |
|
|
my $socgen_file = $parser->parse_file($socgen_filename);
|
200 |
|
|
#/*********************************************************************************************/
|
201 |
|
|
#/ elaborate each testbench */
|
202 |
|
|
#/ */
|
203 |
|
|
#/*********************************************************************************************/
|
204 |
|
|
|
205 |
|
|
my $variant = "${component}_${version}";
|
206 |
|
|
|
207 |
|
|
|
208 |
|
|
|
209 |
|
|
foreach my $j_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:testbenches/socgen:testbench/socgen:variant[./text() = '$variant']"))
|
210 |
|
|
{
|
211 |
|
|
my $testbench_variant = $j_name ->findnodes('./text()')->to_literal ;
|
212 |
|
|
my $testbench_version = $j_name ->findnodes('../socgen:version/text()')->to_literal ;
|
213 |
|
|
my $testbench_config = $j_name ->findnodes('../socgen:configuration/text()')->to_literal ;
|
214 |
|
|
my $testbench_instance = $j_name ->findnodes('../socgen:bus/socgen:instance/text()')->to_literal ;
|
215 |
|
|
my $testbench_bus_name = $j_name ->findnodes('../socgen:bus/socgen:bus_name/text()')->to_literal ;
|
216 |
|
|
if(defined $testbench_config && length $testbench_config > 0)
|
217 |
|
|
{
|
218 |
|
|
$cmd ="./tools/verilog/elab_verilog -vendor ${vendor} -library ${library} -component ${component} -version ${testbench_version} -configuration ${testbench_config} \n";
|
219 |
|
|
}
|
220 |
|
|
else
|
221 |
|
|
{
|
222 |
|
|
$cmd ="./tools/verilog/elab_verilog -vendor ${vendor} -library ${library} -component ${component} -version ${testbench_version} \n";
|
223 |
|
|
}
|
224 |
|
|
print "$cmd";
|
225 |
|
|
}
|
226 |
|
|
|
227 |
|
|
}
|
228 |
|
|
|
229 |
|
|
|
230 |
|
|
|
231 |
|
|
}
|
232 |
|
|
|
233 |
|
|
|
234 |
|
|
|
235 |
|
|
|
236 |
|
|
|
237 |
|
|
|
238 |
|
|
if($opt_gen_ports)
|
239 |
|
|
{
|
240 |
|
|
my $socgen_filename = yp::lib::find_componentConfiguration($vendor,$library,$component);
|
241 |
|
|
if($socgen_filename)
|
242 |
|
|
{
|
243 |
|
|
my $socgen_file = $parser->parse_file($socgen_filename);
|
244 |
|
|
#/*********************************************************************************************/
|
245 |
|
|
#/ elaborate each testbench */
|
246 |
|
|
#/ */
|
247 |
|
|
#/*********************************************************************************************/
|
248 |
|
|
my $variant = "${component}_${version}";
|
249 |
|
|
foreach my $j_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:testbenches/socgen:testbench/socgen:variant[./text() = '$variant']"))
|
250 |
|
|
{
|
251 |
|
|
my $testbench_variant = $j_name ->findnodes('./text()')->to_literal ;
|
252 |
|
|
my $testbench_version = $j_name ->findnodes('../socgen:version/text()')->to_literal ;
|
253 |
|
|
my $testbench_config = $j_name ->findnodes('../socgen:configuration/text()')->to_literal ;
|
254 |
|
|
my $testbench_instance = $j_name ->findnodes('../socgen:bus/socgen:instance/text()')->to_literal ;
|
255 |
|
|
my $testbench_bus_name = $j_name ->findnodes('../socgen:bus/socgen:bus_name/text()')->to_literal ;
|
256 |
|
|
|
257 |
|
|
$cmd ="./tools/verilog/gen_ports -vendor ${vendor} -library ${library} -component ${component} -version ${testbench_version} \n";
|
258 |
|
|
|
259 |
|
|
print "$cmd";
|
260 |
|
|
}
|
261 |
|
|
|
262 |
|
|
}
|
263 |
|
|
}
|
264 |
|
|
|
265 |
|
|
|
266 |
|
|
|
267 |
|
|
if($opt_gen_sigs)
|
268 |
|
|
{
|
269 |
|
|
my $socgen_filename = yp::lib::find_componentConfiguration($vendor,$library,$component);
|
270 |
|
|
if($socgen_filename)
|
271 |
|
|
{
|
272 |
|
|
my $socgen_file = $parser->parse_file($socgen_filename);
|
273 |
|
|
#/*********************************************************************************************/
|
274 |
|
|
#/ elaborate each testbench */
|
275 |
|
|
#/ */
|
276 |
|
|
#/*********************************************************************************************/
|
277 |
|
|
my $variant = "${component}_${version}";
|
278 |
|
|
foreach my $j_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:testbenches/socgen:testbench/socgen:variant[./text() = '$variant']"))
|
279 |
|
|
{
|
280 |
|
|
my $testbench_variant = $j_name ->findnodes('./text()')->to_literal ;
|
281 |
|
|
my $testbench_version = $j_name ->findnodes('../socgen:version/text()')->to_literal ;
|
282 |
|
|
my $testbench_config = $j_name ->findnodes('../socgen:configuration/text()')->to_literal ;
|
283 |
|
|
my $testbench_instance = $j_name ->findnodes('../socgen:bus/socgen:instance/text()')->to_literal ;
|
284 |
|
|
my $testbench_bus_name = $j_name ->findnodes('../socgen:bus/socgen:bus_name/text()')->to_literal ;
|
285 |
|
|
|
286 |
|
|
my @signals = yp::lib::get_signals($vendor,$library,$component,$testbench_version);
|
287 |
|
|
|
288 |
|
|
foreach my $sig (@signals)
|
289 |
|
|
{
|
290 |
|
|
print "$sig\n";
|
291 |
|
|
}
|
292 |
|
|
|
293 |
|
|
}
|
294 |
|
|
|
295 |
|
|
}
|
296 |
|
|
}
|
297 |
|
|
|
298 |
|
|
|
299 |
|
|
|
300 |
|
|
|
301 |
|
|
|
302 |
|
|
|
303 |
|
|
if($opt_parse_comp)
|
304 |
|
|
{
|
305 |
|
|
my $socgen_filename = yp::lib::find_componentConfiguration($vendor,$library,$component);
|
306 |
|
|
if($socgen_filename)
|
307 |
|
|
{
|
308 |
|
|
my $socgen_file = $parser->parse_file($socgen_filename);
|
309 |
|
|
#/*********************************************************************************************/
|
310 |
|
|
#/ elaborate each testbench */
|
311 |
|
|
#/ */
|
312 |
|
|
#/*********************************************************************************************/
|
313 |
|
|
my $variant = "${component}_${version}";
|
314 |
|
|
foreach my $j_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:testbenches/socgen:testbench/socgen:variant[./text() = '$variant']"))
|
315 |
|
|
{
|
316 |
|
|
my $testbench_variant = $j_name ->findnodes('./text()')->to_literal ;
|
317 |
|
|
my $testbench_version = $j_name ->findnodes('../socgen:version/text()')->to_literal ;
|
318 |
|
|
my $testbench_config = $j_name ->findnodes('../socgen:configuration/text()')->to_literal ;
|
319 |
|
|
my $testbench_instance = $j_name ->findnodes('../socgen:bus/socgen:instance/text()')->to_literal ;
|
320 |
|
|
my $testbench_bus_name = $j_name ->findnodes('../socgen:bus/socgen:bus_name/text()')->to_literal ;
|
321 |
|
|
|
322 |
|
|
|
323 |
|
|
my @filelist = yp::lib::parse_component_file($vendor,$library,$component,$testbench_version);
|
324 |
|
|
|
325 |
|
|
|
326 |
|
|
foreach my $file (@filelist)
|
327 |
|
|
{
|
328 |
|
|
print "$file\n";
|
329 |
|
|
}
|
330 |
|
|
|
331 |
|
|
}
|
332 |
|
|
|
333 |
|
|
}
|
334 |
|
|
}
|
335 |
|
|
|
336 |
|
|
|
337 |
|
|
|
338 |
|
|
|
339 |
|
|
|
340 |
|
|
|
341 |
|
|
|
342 |
|
|
if($opt_parse_design)
|
343 |
|
|
{
|
344 |
|
|
my $socgen_filename = yp::lib::find_componentConfiguration($vendor,$library,$component);
|
345 |
|
|
if($socgen_filename)
|
346 |
|
|
{
|
347 |
|
|
my $socgen_file = $parser->parse_file($socgen_filename);
|
348 |
|
|
#/*********************************************************************************************/
|
349 |
|
|
#/ elaborate each testbench */
|
350 |
|
|
#/ */
|
351 |
|
|
#/*********************************************************************************************/
|
352 |
|
|
my $variant = "${component}_${version}";
|
353 |
|
|
foreach my $j_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:testbenches/socgen:testbench/socgen:variant[./text() = '$variant']"))
|
354 |
|
|
{
|
355 |
|
|
my $testbench_variant = $j_name ->findnodes('./text()')->to_literal ;
|
356 |
|
|
my $testbench_version = $j_name ->findnodes('../socgen:version/text()')->to_literal ;
|
357 |
|
|
my $testbench_config = $j_name ->findnodes('../socgen:configuration/text()')->to_literal ;
|
358 |
|
|
my $testbench_instance = $j_name ->findnodes('../socgen:bus/socgen:instance/text()')->to_literal ;
|
359 |
|
|
my $testbench_bus_name = $j_name ->findnodes('../socgen:bus/socgen:bus_name/text()')->to_literal ;
|
360 |
|
|
|
361 |
|
|
my @filelist = yp::lib::find_ipxact_design_files($vendor,$library,$component,$testbench_version);
|
362 |
|
|
|
363 |
|
|
|
364 |
|
|
|
365 |
|
|
foreach my $file (@filelist)
|
366 |
|
|
{
|
367 |
|
|
print "$file\n";
|
368 |
|
|
}
|
369 |
|
|
|
370 |
|
|
}
|
371 |
|
|
|
372 |
|
|
}
|
373 |
|
|
}
|
374 |
|
|
|
375 |
|
|
|
376 |
|
|
|
377 |
|
|
|
378 |
|
|
|
379 |
|
|
|
380 |
|
|
|
381 |
|
|
1
|
382 |
|
|
|