1 |
124 |
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 |
|
|
|
49 |
|
|
############################################################################
|
50 |
|
|
# General PERL config
|
51 |
|
|
############################################################################
|
52 |
|
|
use Getopt::Long;
|
53 |
|
|
use English;
|
54 |
|
|
use File::Basename;
|
55 |
|
|
use Cwd;
|
56 |
|
|
use XML::LibXML;
|
57 |
|
|
use lib './tools';
|
58 |
|
|
use sys::lib;
|
59 |
|
|
use yp::lib;
|
60 |
|
|
|
61 |
|
|
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
############################################################################
|
65 |
|
|
### Process the options
|
66 |
|
|
############################################################################
|
67 |
|
|
Getopt::Long::config("require_order", "prefix=-");
|
68 |
|
|
GetOptions("h","help",
|
69 |
|
|
"work_site=s" => \$work_site,
|
70 |
|
|
"vendor=s" => \$vendor,
|
71 |
131 |
jt_eaton |
"library=s" => \$library,
|
72 |
124 |
jt_eaton |
"component=s" => \$component,
|
73 |
|
|
"version=s" => \$version
|
74 |
|
|
) || die "(use '$program_name -h' for help)";
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
##############################################################################
|
79 |
|
|
## Help option
|
80 |
|
|
##############################################################################
|
81 |
|
|
if ( $opt_h or $opt_help)
|
82 |
131 |
jt_eaton |
{ print "\n build_lint_filelists -work_site /work -vendor vendor_name -library library_name -component component_name ";
|
83 |
124 |
jt_eaton |
print "\n";
|
84 |
|
|
exit 1;
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
##############################################################################
|
89 |
|
|
##
|
90 |
|
|
##############################################################################
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
|
94 |
|
|
$home = cwd();
|
95 |
|
|
|
96 |
|
|
my $variant = "";
|
97 |
|
|
if($version) {$variant = "${component}_${version}"}
|
98 |
|
|
else {$variant = "${component}"}
|
99 |
|
|
|
100 |
|
|
#############################################################################
|
101 |
|
|
##
|
102 |
|
|
##
|
103 |
|
|
#############################################################################
|
104 |
|
|
|
105 |
|
|
my $parser = XML::LibXML->new();
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
#/*********************************************************************************************/
|
110 |
|
|
#/ */
|
111 |
|
|
#/ Create filelists for simulation and linting */
|
112 |
|
|
#/ */
|
113 |
|
|
#/ */
|
114 |
|
|
#/*********************************************************************************************/
|
115 |
|
|
|
116 |
|
|
@filelist_sim = ( );
|
117 |
|
|
|
118 |
131 |
jt_eaton |
my @filelist = yp::lib::parse_component_file("$vendor","$library","$component","$version");
|
119 |
124 |
jt_eaton |
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
foreach $line (@filelist)
|
124 |
|
|
{
|
125 |
|
|
$_ = $line;
|
126 |
|
|
if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
|
127 |
|
|
{
|
128 |
|
|
$new_proj = $2;
|
129 |
|
|
$new_comp = $3;
|
130 |
|
|
$new_vendor = $1;
|
131 |
|
|
$new_version = $4;
|
132 |
|
|
}
|
133 |
|
|
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
#############################################################################
|
137 |
|
|
## Read destination from source xml file
|
138 |
|
|
##
|
139 |
|
|
#############################################################################
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
|
143 |
130 |
jt_eaton |
my $spirit_component_file = $parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_proj,$new_comp,$new_version));
|
144 |
124 |
jt_eaton |
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
if($new_version){$new_variant = "${new_comp}_${new_version}"}
|
149 |
|
|
else {$new_variant = $new_comp}
|
150 |
|
|
|
151 |
|
|
|
152 |
|
|
|
153 |
131 |
jt_eaton |
if(($new_vendor eq $vendor ) && ($new_proj eq $library ) && ($new_comp eq $component ) && ($new_version eq $version ) )
|
154 |
127 |
jt_eaton |
|
155 |
124 |
jt_eaton |
{
|
156 |
|
|
|
157 |
|
|
foreach my $i_name ($spirit_component_file->findnodes("//spirit:fileSets/spirit:fileSet/spirit:file/spirit:name"))
|
158 |
|
|
{
|
159 |
|
|
my($file_name) = $i_name ->findnodes('./text()')->to_literal ;
|
160 |
|
|
my($file_type) = $i_name ->findnodes('../spirit:userFileType/text()')->to_literal ;
|
161 |
|
|
my($logical_name) = $i_name ->findnodes('../spirit:logicalName/text()')->to_literal ;
|
162 |
|
|
my($view_file) = $i_name ->findnodes('../../spirit:name/text()')->to_literal ;
|
163 |
130 |
jt_eaton |
my $comp_xml_sep = yp::lib::find_comp_xml_sep($new_vendor,$new_proj,$new_comp,$new_version);
|
164 |
124 |
jt_eaton |
|
165 |
|
|
if( ($file_type eq "libraryDir") && ($view_file eq "fs-lint") && ($logical_name eq "dest_dir") )
|
166 |
|
|
{
|
167 |
130 |
jt_eaton |
push(@filelist_sim,"../../../../${new_comp}${comp_xml_sep}/${file_name}${new_variant}.v\n");
|
168 |
124 |
jt_eaton |
};
|
169 |
|
|
|
170 |
|
|
}
|
171 |
|
|
}
|
172 |
|
|
else
|
173 |
|
|
{
|
174 |
|
|
|
175 |
|
|
foreach my $i_name ($spirit_component_file->findnodes("//spirit:fileSets/spirit:fileSet/spirit:file/spirit:name"))
|
176 |
|
|
{
|
177 |
|
|
my($file_name) = $i_name ->findnodes('./text()')->to_literal ;
|
178 |
|
|
my($file_type) = $i_name ->findnodes('../spirit:userFileType/text()')->to_literal ;
|
179 |
|
|
my($logical_name) = $i_name ->findnodes('../spirit:logicalName/text()')->to_literal ;
|
180 |
|
|
my($view_file) = $i_name ->findnodes('../../spirit:name/text()')->to_literal ;
|
181 |
|
|
|
182 |
130 |
jt_eaton |
my $comp_xml_sep = yp::lib::find_comp_xml_sep($new_vendor,$new_proj,$new_comp,$new_version);
|
183 |
|
|
my $lib_comp_sep = yp::lib::find_lib_comp_sep($new_vendor,$new_proj,$new_comp);
|
184 |
|
|
my $library_path = "${lib_comp_sep}${component}${comp_xml_sep}";
|
185 |
124 |
jt_eaton |
|
186 |
|
|
if(($file_type eq "libraryDir")&& (($view_file eq "fs-lint") ) && ($logical_name eq "dest_dir") )
|
187 |
|
|
{
|
188 |
|
|
push(@filelist_sim,"../../../../../children/${new_vendor}__${new_proj}${library_path}/${file_name}${new_variant}.v\n");
|
189 |
|
|
};
|
190 |
|
|
}
|
191 |
|
|
|
192 |
|
|
}
|
193 |
|
|
|
194 |
|
|
}
|
195 |
|
|
|
196 |
|
|
|
197 |
|
|
|
198 |
|
|
|
199 |
|
|
|
200 |
|
|
|
201 |
|
|
#############################################################################
|
202 |
|
|
##
|
203 |
|
|
##
|
204 |
|
|
#############################################################################
|
205 |
|
|
|
206 |
131 |
jt_eaton |
print "Building rtl_check filelists for $work_site $vendor $library $component $version $variant \n" ;
|
207 |
124 |
jt_eaton |
|
208 |
131 |
jt_eaton |
my $spirit_component_file = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$library,$component,$version));
|
209 |
|
|
my $socgen_file = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
|
210 |
124 |
jt_eaton |
|
211 |
|
|
|
212 |
|
|
|
213 |
|
|
|
214 |
|
|
|
215 |
|
|
#/*********************************************************************************************/
|
216 |
|
|
#/ */
|
217 |
|
|
#/ */
|
218 |
|
|
#/ Read each variants parameters and defaults into an array and their order into an array */
|
219 |
|
|
#/ order must be preservered so that parameters can use the values of other parameters */
|
220 |
|
|
#/ */
|
221 |
|
|
#/*********************************************************************************************/
|
222 |
|
|
|
223 |
|
|
my %default_parameters = ();
|
224 |
|
|
my @parameter_order = ();
|
225 |
|
|
|
226 |
|
|
|
227 |
130 |
jt_eaton |
foreach my $i_name ($socgen_file->findnodes("//socgen:testbenches/socgen:testbench[socgen:variant/text() = '$variant']/socgen:parameters/socgen:parameter"))
|
228 |
124 |
jt_eaton |
{
|
229 |
|
|
my($parameter_name) = $i_name ->findnodes('socgen:name/text()')->to_literal ;
|
230 |
|
|
my($parameter_default) = $i_name ->findnodes('socgen:value/text()')->to_literal ;
|
231 |
|
|
$default_parameters{$parameter_name} = $parameter_default;
|
232 |
|
|
push @parameter_order ,$parameter_name ;
|
233 |
|
|
# print "XXXXY $parameter_name $parameter_default \n";
|
234 |
|
|
}
|
235 |
|
|
|
236 |
|
|
|
237 |
|
|
|
238 |
|
|
|
239 |
|
|
|
240 |
|
|
|
241 |
|
|
|
242 |
|
|
|
243 |
|
|
foreach my $comp ($spirit_component_file->findnodes('//spirit:component'))
|
244 |
|
|
{
|
245 |
|
|
my($vendor) = $comp->findnodes('./spirit:vendor/text()')->to_literal ;
|
246 |
|
|
my($library) = $comp->findnodes('./spirit:library/text()')->to_literal ;
|
247 |
|
|
my($name) = $comp->findnodes('./spirit:name/text()')->to_literal ;
|
248 |
|
|
my($version) = $comp->findnodes('./spirit:version/text()')->to_literal ;
|
249 |
|
|
my $variant = "";
|
250 |
|
|
if($version) {$variant = "${name}_${version}"}
|
251 |
|
|
else {$variant = "${name}"}
|
252 |
131 |
jt_eaton |
print "rtl/gen directories for $library - $component VLNV $vendor - $library - $name - $variant \n";
|
253 |
124 |
jt_eaton |
}
|
254 |
|
|
|
255 |
|
|
|
256 |
|
|
|
257 |
|
|
|
258 |
|
|
|
259 |
|
|
|
260 |
|
|
|
261 |
|
|
|
262 |
|
|
|
263 |
|
|
|
264 |
|
|
|
265 |
|
|
push(@filelist_sim," ./TestBench\n");
|
266 |
|
|
|
267 |
131 |
jt_eaton |
print "CREATING componentRef filelists for $library $component $name $variant \n";
|
268 |
124 |
jt_eaton |
|
269 |
128 |
jt_eaton |
@filelist_sim = sys::lib::trim_sort(@filelist_sim);
|
270 |
124 |
jt_eaton |
|
271 |
|
|
|
272 |
|
|
|
273 |
|
|
|
274 |
|
|
|
275 |
|
|
|
276 |
|
|
|
277 |
|
|
|
278 |
|
|
|
279 |
|
|
|
280 |
|
|
|
281 |
|
|
|
282 |
|
|
|
283 |
|
|
#/*********************************************************************************************/
|
284 |
|
|
#/ */
|
285 |
|
|
#/ Make simulation file set */
|
286 |
|
|
#/ */
|
287 |
|
|
#/ */
|
288 |
|
|
#/ */
|
289 |
|
|
#/ */
|
290 |
|
|
#/*********************************************************************************************/
|
291 |
|
|
|
292 |
131 |
jt_eaton |
print "CREATING sim files for $library $component $chip $name $variant \n";
|
293 |
124 |
jt_eaton |
|
294 |
|
|
|
295 |
|
|
|
296 |
|
|
|
297 |
131 |
jt_eaton |
my $socgen_file = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
|
298 |
124 |
jt_eaton |
|
299 |
130 |
jt_eaton |
foreach my $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:rtl_check/socgen:lint[socgen:variant/text() = '$variant']"))
|
300 |
124 |
jt_eaton |
{
|
301 |
|
|
my($simulation) = $i_name ->findnodes('socgen:name/text()')->to_literal ;
|
302 |
|
|
my($configuration) = $i_name ->findnodes('socgen:configuration/text()')->to_literal ;
|
303 |
|
|
|
304 |
131 |
jt_eaton |
print " lint files for $library $component $variant $simulation $configuration \n";
|
305 |
124 |
jt_eaton |
|
306 |
130 |
jt_eaton |
my $sim_library_path ;
|
307 |
131 |
jt_eaton |
my $lib_comp_sep = yp::lib::find_lib_comp_sep($vendor,$library,$component);
|
308 |
130 |
jt_eaton |
my $sim_comp_path = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:comp_path/text()")->to_literal;
|
309 |
|
|
|
310 |
|
|
if ($sim_comp_path)
|
311 |
|
|
{
|
312 |
|
|
$sim_library_path ="${lib_comp_sep}${sim_comp_path}";
|
313 |
|
|
}
|
314 |
|
|
else
|
315 |
|
|
{
|
316 |
|
|
$sim_library_path = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:library_path/text()")->to_literal;
|
317 |
|
|
}
|
318 |
|
|
|
319 |
|
|
|
320 |
131 |
jt_eaton |
my $path = "${home}${work_site}/${vendor}__${library}${sim_library_path}/rtl_check";
|
321 |
124 |
jt_eaton |
|
322 |
125 |
jt_eaton |
mkdir $path,0755 unless (-e $path) ;
|
323 |
124 |
jt_eaton |
|
324 |
131 |
jt_eaton |
$path = "${home}${work_site}/${vendor}__${library}${sim_library_path}/rtl_check/${simulation}";
|
325 |
125 |
jt_eaton |
mkdir $path,0755 unless (-e $path);
|
326 |
124 |
jt_eaton |
|
327 |
131 |
jt_eaton |
my $outfile ="${home}${work_site}/${vendor}__${library}${sim_library_path}/rtl_check/${simulation}/Makefile";
|
328 |
125 |
jt_eaton |
open MAKSIMFILE,">$outfile" or die "unable to open $outfile";
|
329 |
124 |
jt_eaton |
|
330 |
|
|
|
331 |
|
|
|
332 |
131 |
jt_eaton |
$outfile ="${home}${work_site}/${vendor}__${library}${sim_library_path}/rtl_check/${simulation}/TestBench";
|
333 |
125 |
jt_eaton |
open SIM_PARM_FILE,">$outfile" or die "unable to open $outfile";
|
334 |
124 |
jt_eaton |
|
335 |
|
|
|
336 |
128 |
jt_eaton |
print MAKSIMFILE "include ${home}/tools/bin/Makefile.root\n";
|
337 |
124 |
jt_eaton |
print MAKSIMFILE "comp=${variant}\n";
|
338 |
|
|
print MAKSIMFILE "test=${simulation}\n";
|
339 |
|
|
|
340 |
|
|
|
341 |
|
|
|
342 |
|
|
my %local_parameters = %default_parameters;
|
343 |
|
|
my @local_order = @parameter_order;
|
344 |
|
|
|
345 |
130 |
jt_eaton |
foreach my $i_name ($socgen_file->findnodes("//socgen:configurations/socgen:configuration[socgen:name/text() = '$configuration']/./socgen:parameters/socgen:parameter/socgen:name"))
|
346 |
124 |
jt_eaton |
{
|
347 |
|
|
my($par_name) = $i_name ->findnodes('./text()')->to_literal ;
|
348 |
|
|
my($par_value) = $i_name ->findnodes('../socgen:value/text()')->to_literal ;
|
349 |
|
|
if($local_parameters{$par_name} eq '' ) { push @local_order , $par_name; }
|
350 |
|
|
$local_parameters{$par_name} = $par_value;
|
351 |
|
|
}
|
352 |
|
|
|
353 |
130 |
jt_eaton |
foreach my $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:rtl_check/socgen:lint[socgen:name/text() = '$simulation']/./socgen:parameters/socgen:parameter/socgen:name"))
|
354 |
124 |
jt_eaton |
{
|
355 |
|
|
my($par_name) = $i_name ->findnodes('./text()')->to_literal ;
|
356 |
|
|
my($par_value) = $i_name ->findnodes('../socgen:value/text()')->to_literal ;
|
357 |
|
|
if ( $local_parameters{$par_name} eq '' ) { push @local_order , $par_name; }
|
358 |
|
|
$local_parameters{$par_name} = $par_value;
|
359 |
|
|
}
|
360 |
|
|
|
361 |
125 |
jt_eaton |
|
362 |
|
|
|
363 |
131 |
jt_eaton |
my $module_name = yp::lib::get_module_name($vendor,$library,$component,$version);
|
364 |
125 |
jt_eaton |
|
365 |
131 |
jt_eaton |
print SIM_PARM_FILE "// Testbench for $library $component $variant $configuration $simulation\n";
|
366 |
124 |
jt_eaton |
print SIM_PARM_FILE " \n";
|
367 |
125 |
jt_eaton |
print SIM_PARM_FILE "module TB(input clk,input reset); \n";
|
368 |
|
|
print SIM_PARM_FILE " \n\n";
|
369 |
|
|
print SIM_PARM_FILE " $module_name \n";
|
370 |
124 |
jt_eaton |
|
371 |
|
|
my $first =1;
|
372 |
|
|
|
373 |
|
|
foreach my $parameter_name (@local_order)
|
374 |
|
|
{
|
375 |
128 |
jt_eaton |
|
376 |
124 |
jt_eaton |
my($parameter_default) = $local_parameters{$parameter_name};
|
377 |
128 |
jt_eaton |
|
378 |
|
|
# if a parameter is used to define a paramter then use its value instead. Only works for lookup- no alterations
|
379 |
|
|
if($local_parameters{$parameter_default}) { $parameter_default = $local_parameters{$parameter_default} }
|
380 |
|
|
|
381 |
124 |
jt_eaton |
if($first)
|
382 |
|
|
{
|
383 |
|
|
print SIM_PARM_FILE " #( .${parameter_name}(${parameter_default})";
|
384 |
|
|
$first = 0;
|
385 |
|
|
}
|
386 |
|
|
else
|
387 |
|
|
{
|
388 |
|
|
print SIM_PARM_FILE ",\n .${parameter_name}(${parameter_default})";
|
389 |
|
|
}
|
390 |
|
|
}
|
391 |
|
|
|
392 |
|
|
if($first) { print SIM_PARM_FILE " ";}
|
393 |
|
|
else { print SIM_PARM_FILE ") ";}
|
394 |
|
|
|
395 |
125 |
jt_eaton |
print SIM_PARM_FILE " test \n (.clk(clk),.reset(reset)); \n\n\n\n endmodule \n ";
|
396 |
124 |
jt_eaton |
|
397 |
|
|
|
398 |
|
|
|
399 |
|
|
}
|
400 |
|
|
|
401 |
|
|
|
402 |
|
|
|
403 |
|
|
|
404 |
|
|
|