1 |
131 |
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) <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 Scalar::Util qw(looks_like_number);
|
55 |
|
|
use XML::LibXML;
|
56 |
|
|
use lib './tools';
|
57 |
|
|
use sys::lib;
|
58 |
|
|
use yp::lib;
|
59 |
134 |
jt_eaton |
use math::lib;
|
60 |
131 |
jt_eaton |
use BerkeleyDB;
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
############################################################################
|
67 |
|
|
### Process the options
|
68 |
|
|
############################################################################
|
69 |
|
|
Getopt::Long::config("require_order", "prefix=-");
|
70 |
|
|
GetOptions("h","help",
|
71 |
|
|
"envidentifier=s" => \$envidentifier,
|
72 |
|
|
"prefix=s" => \$prefix,
|
73 |
|
|
"vendor=s" => \$vendor,
|
74 |
|
|
"library=s" => \$library,
|
75 |
|
|
"component=s" => \$component,
|
76 |
|
|
"version=s" => \$version,
|
77 |
133 |
jt_eaton |
"configuration=s" => \$configuration,
|
78 |
|
|
"dest_dir=s" => \$dest_dir,
|
79 |
131 |
jt_eaton |
"env=s" => \$env,
|
80 |
|
|
"tool=s" => \$tool,
|
81 |
|
|
"unit=s" => \$unit,
|
82 |
|
|
"name=s" => \$name
|
83 |
|
|
|
84 |
|
|
) || die "(use '$program_name -h' for help)";
|
85 |
|
|
|
86 |
|
|
|
87 |
133 |
jt_eaton |
|
88 |
131 |
jt_eaton |
##############################################################################
|
89 |
|
|
## Help option
|
90 |
|
|
##############################################################################
|
91 |
|
|
if ( $opt_h or $opt_help )
|
92 |
|
|
{ print "\n elab_verilog -envidentifier {sim/syn} -prefix /work -vendor vendor_name -library library_name -component component_name -version version_name -env env -tool tool -unit unit -name name \n";
|
93 |
|
|
exit 1;
|
94 |
|
|
}
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
#############################################################################
|
99 |
|
|
##
|
100 |
|
|
##
|
101 |
|
|
#############################################################################
|
102 |
|
|
|
103 |
|
|
$home = cwd();
|
104 |
|
|
|
105 |
|
|
unless ($prefix)
|
106 |
|
|
{
|
107 |
|
|
$prefix = yp::lib::get_workspace();
|
108 |
|
|
$prefix = "/${prefix}";
|
109 |
|
|
}
|
110 |
|
|
|
111 |
|
|
|
112 |
134 |
jt_eaton |
my $comp_xml_sep = yp::lib::find_comp_xml_sep($vendor,$library,$component,$version);
|
113 |
|
|
my $lib_comp_sep = yp::lib::find_lib_comp_sep($vendor,$library,$component);
|
114 |
131 |
jt_eaton |
|
115 |
133 |
jt_eaton |
|
116 |
|
|
|
117 |
134 |
jt_eaton |
my $variant;
|
118 |
133 |
jt_eaton |
|
119 |
131 |
jt_eaton |
|
120 |
134 |
jt_eaton |
|
121 |
131 |
jt_eaton |
unless ($env ) {$env = "none";}
|
122 |
|
|
unless ($tool ){$tool = "none";}
|
123 |
|
|
unless ($unit ){$unit = "none";}
|
124 |
|
|
|
125 |
|
|
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
|
129 |
134 |
jt_eaton |
|
130 |
131 |
jt_eaton |
my $root = "root";
|
131 |
|
|
|
132 |
|
|
if($version) {$variant = "${component}_${version}";}
|
133 |
|
|
else {$variant = "${component}";}
|
134 |
|
|
|
135 |
134 |
jt_eaton |
#print "./tools/verilog/elab_verilog -envidentifier $envidentifier -prefix $prefix -vendor $vendor -library $library -component $component -version $version -configuration $configuration -dest_dir $dest_dir -env $env -tool $tool -unit $unit -name $name \n";
|
136 |
131 |
jt_eaton |
|
137 |
|
|
|
138 |
134 |
jt_eaton |
|
139 |
|
|
|
140 |
131 |
jt_eaton |
my $parser = XML::LibXML->new();
|
141 |
|
|
|
142 |
134 |
jt_eaton |
my $socgen_filename = yp::lib::find_componentConfiguration($vendor,$library,$component);
|
143 |
|
|
unless ($socgen_filename) { print "No socgen ip file $vendor,$library,$component \n";};
|
144 |
131 |
jt_eaton |
|
145 |
134 |
jt_eaton |
my $socgen_file = $parser->parse_file($socgen_filename);
|
146 |
131 |
jt_eaton |
|
147 |
|
|
|
148 |
|
|
|
149 |
|
|
|
150 |
133 |
jt_eaton |
my $path;
|
151 |
131 |
jt_eaton |
|
152 |
134 |
jt_eaton |
my $elab_db_filename;
|
153 |
131 |
jt_eaton |
|
154 |
|
|
|
155 |
134 |
jt_eaton |
if($name)
|
156 |
|
|
{
|
157 |
|
|
$elab_db_filename = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,$name);
|
158 |
|
|
}
|
159 |
|
|
else
|
160 |
|
|
{
|
161 |
|
|
$elab_db_filename = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,"default");
|
162 |
|
|
}
|
163 |
131 |
jt_eaton |
|
164 |
|
|
|
165 |
134 |
jt_eaton |
if(-e $elab_db_filename)
|
166 |
|
|
{
|
167 |
|
|
exit;
|
168 |
|
|
# "$data_db_file Exists\n";
|
169 |
|
|
}
|
170 |
131 |
jt_eaton |
|
171 |
134 |
jt_eaton |
print "ELAB_VERILOG ${vendor}_${library}_${component}_${version} $env $tool $unit || $name || $data_db_file \n";
|
172 |
131 |
jt_eaton |
|
173 |
|
|
|
174 |
134 |
jt_eaton |
my $elab_db = new BerkeleyDB::Hash( -Filename => "$elab_db_filename", -Flags => DB_CREATE ) or die "Cannot open $elab_db_filename: $!";
|
175 |
131 |
jt_eaton |
|
176 |
133 |
jt_eaton |
$elab_db->db_put( "component___root" ,"${vendor}:${library}:${component}:${version}" );
|
177 |
131 |
jt_eaton |
|
178 |
133 |
jt_eaton |
my $repo_data;
|
179 |
134 |
jt_eaton |
if(defined $name && length $name >0)
|
180 |
|
|
{
|
181 |
|
|
$elab_db->db_get("VLNV___${vendor}:${library}:${component}:${version}:${name}", $repo_data );
|
182 |
|
|
$elab_db->db_put("VLNV___${vendor}:${library}:${component}:${version}:${name}","${repo_data}${root}:::" );
|
183 |
|
|
}
|
184 |
|
|
else
|
185 |
|
|
{
|
186 |
133 |
jt_eaton |
$elab_db->db_get("VLNV___${vendor}:${library}:${component}:${version}", $repo_data );
|
187 |
|
|
$elab_db->db_put("VLNV___${vendor}:${library}:${component}:${version}","${repo_data}${root}:::" );
|
188 |
134 |
jt_eaton |
}
|
189 |
131 |
jt_eaton |
|
190 |
|
|
|
191 |
|
|
|
192 |
|
|
|
193 |
|
|
|
194 |
|
|
|
195 |
|
|
|
196 |
134 |
jt_eaton |
my @bro_filelist = yp::lib::parse_component_brothers($vendor,$library,$component,$version);
|
197 |
131 |
jt_eaton |
|
198 |
134 |
jt_eaton |
foreach $bro (@bro_filelist)
|
199 |
|
|
{
|
200 |
|
|
my $ven;
|
201 |
|
|
my $lib;
|
202 |
|
|
my $cmp;
|
203 |
|
|
my $ver;
|
204 |
|
|
my $xxx;
|
205 |
131 |
jt_eaton |
|
206 |
|
|
|
207 |
134 |
jt_eaton |
( ${xxx},${ven},${lib},${cmp},${ver}) = split( /::/ , $bro);
|
208 |
131 |
jt_eaton |
|
209 |
134 |
jt_eaton |
#print " $bro - ${ven} -${lib} -${cmp} -${ver} -${xxx} \n";
|
210 |
|
|
my $spirit_component_file = $parser->parse_file(yp::lib::find_ipxact_component($ven,$lib,$cmp,$ver));
|
211 |
|
|
|
212 |
|
|
|
213 |
|
|
my $loc_comp_xml_sep = yp::lib::find_comp_xml_sep($ven,$lib,$cmp,$ver);
|
214 |
|
|
my $loc_lib_comp_sep = yp::lib::find_lib_comp_sep($ven,$lib,$cmp);
|
215 |
|
|
|
216 |
|
|
foreach my $i_name ($spirit_component_file->findnodes("//spirit:fileSets/spirit:fileSet/spirit:file/spirit:name"))
|
217 |
|
|
{
|
218 |
|
|
my($file_name) = $i_name ->findnodes('./text()')->to_literal ;
|
219 |
|
|
my($file_logicalname) = $i_name ->findnodes('../spirit:logicalName/text()')->to_literal ;
|
220 |
|
|
my($file_type) = $i_name ->findnodes('../spirit:fileType/text()')->to_literal ;
|
221 |
|
|
my($file_usertype) = $i_name ->findnodes('../spirit:userFileType/text()')->to_literal ;
|
222 |
|
|
my($fileSet_name) = $i_name ->findnodes('../../spirit:name/text()')->to_literal ;
|
223 |
|
|
|
224 |
|
|
if(${file_usertype} eq "libraryDir" )
|
225 |
|
|
{
|
226 |
|
|
$elab_db->db_put( "FILE_${file_type}_${fileSet_name}_${file_usertype}__${file_name}","${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/${file_name}" );
|
227 |
|
|
|
228 |
|
|
}
|
229 |
|
|
else
|
230 |
|
|
|
231 |
|
|
{
|
232 |
|
|
$elab_db->db_put( "FILE_${file_type}_${fileSet_name}_${file_usertype}__${file_name}","${ven}__${lib}${loc_lib_comp_sep}${cmp}${loc_comp_xml_sep}/${file_name}" );
|
233 |
|
|
|
234 |
|
|
}
|
235 |
|
|
|
236 |
|
|
|
237 |
|
|
}
|
238 |
|
|
|
239 |
|
|
|
240 |
|
|
|
241 |
|
|
}
|
242 |
|
|
|
243 |
|
|
|
244 |
|
|
|
245 |
|
|
|
246 |
|
|
|
247 |
131 |
jt_eaton |
foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:${env}/socgen:${tool}/socgen:${unit}/socgen:parameters/socgen:parameter"))
|
248 |
|
|
{
|
249 |
|
|
my($ise_param) = $socgen_cfg ->findnodes('./socgen:value/text()')->to_literal ;
|
250 |
|
|
my($ise_param_name) = $socgen_cfg ->findnodes('./socgen:name/text()')->to_literal ;
|
251 |
133 |
jt_eaton |
my($ise_new_name ) = $socgen_cfg ->findnodes('../../socgen:name/text()')->to_literal ;
|
252 |
131 |
jt_eaton |
if($name eq "${ise_new_name}")
|
253 |
|
|
{
|
254 |
|
|
if($ise_param_name)
|
255 |
|
|
{
|
256 |
|
|
$elab_db->db_put( "parameter_${root}__${ise_param_name}","${ise_param}" );
|
257 |
|
|
}
|
258 |
|
|
}
|
259 |
133 |
jt_eaton |
|
260 |
|
|
if($version eq "${ise_new_name}")
|
261 |
|
|
{
|
262 |
|
|
if($ise_param_name)
|
263 |
|
|
{
|
264 |
|
|
$elab_db->db_put( "parameter_${root}__${ise_param_name}","${ise_param}" );
|
265 |
|
|
}
|
266 |
|
|
}
|
267 |
134 |
jt_eaton |
}
|
268 |
133 |
jt_eaton |
|
269 |
|
|
|
270 |
|
|
|
271 |
131 |
jt_eaton |
|
272 |
|
|
|
273 |
133 |
jt_eaton |
#/**********************************************************************/
|
274 |
|
|
#/* */
|
275 |
|
|
#/* if configuration set then read parameters from socgen:componentConfiguration file */
|
276 |
|
|
#/* */
|
277 |
|
|
#/**********************************************************************/
|
278 |
|
|
if(defined $configuration)
|
279 |
|
|
{
|
280 |
|
|
foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:configurations/socgen:configuration/socgen:parameters/socgen:parameter/socgen:name"))
|
281 |
|
|
{
|
282 |
|
|
my($param_name) = $socgen_cfg->findnodes('./text()')->to_literal ;
|
283 |
|
|
my($param_value) = $socgen_cfg->findnodes('../socgen:value/text()')->to_literal ;
|
284 |
|
|
my($config_name) = $socgen_cfg->findnodes('../../../socgen:name/text()')->to_literal ;
|
285 |
|
|
if($config_name eq $configuration )
|
286 |
|
|
{
|
287 |
|
|
my $repo_data;
|
288 |
|
|
$elab_db->db_get("parameter_${root}__${param_name}", $repo_data );
|
289 |
|
|
unless (defined $repo_data)
|
290 |
|
|
{
|
291 |
|
|
$elab_db->db_put( "parameter_${root}__${param_name}","${param_value}" );
|
292 |
|
|
}
|
293 |
|
|
}
|
294 |
|
|
}
|
295 |
|
|
}
|
296 |
|
|
|
297 |
|
|
|
298 |
|
|
|
299 |
|
|
|
300 |
134 |
jt_eaton |
|
301 |
|
|
|
302 |
|
|
|
303 |
|
|
foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:configurations/socgen:configuration/socgen:version[text() = '$version']/../socgen:parameters/socgen:parameter/socgen:name"))
|
304 |
|
|
{
|
305 |
|
|
my($param_name) = $socgen_cfg->findnodes('./text()')->to_literal ;
|
306 |
|
|
my($param_value) = $socgen_cfg->findnodes('../socgen:value/text()')->to_literal ;
|
307 |
|
|
|
308 |
|
|
my $repo_data;
|
309 |
|
|
$elab_db->db_get("parameter_${root}__${param_name}", $repo_data );
|
310 |
|
|
unless (defined $repo_data)
|
311 |
|
|
{
|
312 |
|
|
$elab_db->db_put( "parameter_${root}__${param_name}","${param_value}" );
|
313 |
|
|
}
|
314 |
|
|
}
|
315 |
|
|
|
316 |
|
|
|
317 |
131 |
jt_eaton |
foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:${env}/socgen:${tool}/socgen:${unit}/socgen:variant"))
|
318 |
|
|
{
|
319 |
|
|
my($variant_name) = $socgen_cfg->findnodes('./text()')->to_literal ;
|
320 |
133 |
jt_eaton |
my $configuration = $socgen_cfg->findnodes('../socgen:configuration/text()')->to_literal ;
|
321 |
131 |
jt_eaton |
#/**********************************************************************/
|
322 |
|
|
#/* */
|
323 |
|
|
#/* if configuration set then read parameters from socgen:componentConfiguration file */
|
324 |
|
|
#/* */
|
325 |
|
|
#/**********************************************************************/
|
326 |
|
|
if($variant_name eq $variant)
|
327 |
|
|
{
|
328 |
133 |
jt_eaton |
foreach my $socgen_cfg ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:configurations/socgen:configuration/socgen:parameters/socgen:parameter/socgen:name"))
|
329 |
131 |
jt_eaton |
{
|
330 |
|
|
my($param_name) = $socgen_cfg->findnodes('./text()')->to_literal ;
|
331 |
|
|
my($param_value) = $socgen_cfg->findnodes('../socgen:value/text()')->to_literal ;
|
332 |
|
|
my($config_name) = $socgen_cfg->findnodes('../../../socgen:name/text()')->to_literal ;
|
333 |
|
|
if($config_name eq $configuration )
|
334 |
|
|
{
|
335 |
|
|
my $repo_data;
|
336 |
|
|
$elab_db->db_get("parameter_${root}__${param_name}", $repo_data );
|
337 |
133 |
jt_eaton |
unless (defined $repo_data)
|
338 |
131 |
jt_eaton |
{
|
339 |
133 |
jt_eaton |
$elab_db->db_put( "parameter_${root}__${param_name}","${param_value}" );
|
340 |
131 |
jt_eaton |
}
|
341 |
|
|
}
|
342 |
|
|
}
|
343 |
133 |
jt_eaton |
}
|
344 |
|
|
}
|
345 |
131 |
jt_eaton |
|
346 |
|
|
|
347 |
|
|
|
348 |
|
|
|
349 |
|
|
|
350 |
|
|
|
351 |
134 |
jt_eaton |
|
352 |
|
|
|
353 |
|
|
|
354 |
131 |
jt_eaton |
elaborate( "${root}","${vendor}","${library}","${component}","${version}" );
|
355 |
|
|
|
356 |
|
|
my $root = "root";
|
357 |
|
|
|
358 |
|
|
my $key;
|
359 |
|
|
my $value;
|
360 |
|
|
|
361 |
|
|
|
362 |
|
|
my @elab_list;
|
363 |
|
|
|
364 |
|
|
|
365 |
|
|
|
366 |
|
|
|
367 |
|
|
|
368 |
|
|
|
369 |
|
|
|
370 |
|
|
|
371 |
|
|
|
372 |
|
|
|
373 |
|
|
|
374 |
|
|
|
375 |
|
|
|
376 |
|
|
|
377 |
|
|
|
378 |
|
|
|
379 |
|
|
$elab_db->db_close();
|
380 |
|
|
|
381 |
|
|
|
382 |
|
|
|
383 |
|
|
|
384 |
|
|
|
385 |
|
|
|
386 |
|
|
|
387 |
|
|
|
388 |
|
|
|
389 |
|
|
|
390 |
|
|
|
391 |
|
|
#/*********************************************************************************************/
|
392 |
|
|
#/ */
|
393 |
|
|
#/ Recursive entry point for all lower levels */
|
394 |
|
|
#/ */
|
395 |
|
|
#/ */
|
396 |
|
|
#/ */
|
397 |
|
|
#/ */
|
398 |
|
|
#/*********************************************************************************************/
|
399 |
|
|
|
400 |
|
|
sub elaborate
|
401 |
|
|
{
|
402 |
|
|
my @params = @_;
|
403 |
|
|
my $elab_version = pop(@params);
|
404 |
|
|
my $elab_component = pop(@params);
|
405 |
|
|
my $elab_library = pop(@params);
|
406 |
|
|
my $elab_vendor = pop(@params);
|
407 |
|
|
my $elab_root = pop(@params);
|
408 |
|
|
|
409 |
134 |
jt_eaton |
|
410 |
|
|
|
411 |
|
|
|
412 |
|
|
|
413 |
|
|
|
414 |
|
|
|
415 |
|
|
|
416 |
|
|
# print "ELABORATING $elab_root $elab_vendor $elab_library $elab_component $elab_version \n";
|
417 |
131 |
jt_eaton |
my $spirit_component_file = $parser->parse_file(yp::lib::find_ipxact_component($elab_vendor,$elab_library,$elab_component,$elab_version));
|
418 |
|
|
|
419 |
134 |
jt_eaton |
my $io_busses_filename = yp::lib::get_io_busses_db_filename($elab_vendor,$elab_library,$elab_component,$elab_version,"default");
|
420 |
|
|
my $comp_io_busses_db = new BerkeleyDB::Hash( -Filename => "$io_busses_filename", -Flags => DB_CREATE ) or die "Cannot open $io_busses_filename : $!";
|
421 |
|
|
my $cursor = $comp_io_busses_db ->db_cursor() ;
|
422 |
|
|
while ($cursor->c_get($key, $value, DB_NEXT) == 0)
|
423 |
|
|
{
|
424 |
|
|
my $name;
|
425 |
|
|
my $sense;
|
426 |
|
|
( ${key_type},${name},${sense}) = split( /\./ , $key);
|
427 |
|
|
if($key_type eq "AbsDef")
|
428 |
|
|
{
|
429 |
|
|
# print "BUS-- ${elab_root} ||| $name $sense === $value \n";
|
430 |
|
|
my $repo_data;
|
431 |
|
|
$elab_db->db_get("businterface_${elab_root}__${name}", $repo_data );
|
432 |
|
|
unless (defined $repo_data)
|
433 |
|
|
{
|
434 |
|
|
# print "BUS--::: \n";
|
435 |
|
|
$elab_db->db_put( "busInterface_${elab_root}__${name}","busInterface:${sense}:${value}" );
|
436 |
|
|
}
|
437 |
|
|
}
|
438 |
|
|
}
|
439 |
|
|
my $status = $cursor->c_close() ;
|
440 |
|
|
|
441 |
|
|
|
442 |
131 |
jt_eaton |
parse_component_file($spirit_component_file,$elab_root);
|
443 |
|
|
parse_design_files($spirit_component_file,$elab_root);
|
444 |
134 |
jt_eaton |
# print "Exit $elab_root \n";
|
445 |
131 |
jt_eaton |
return;
|
446 |
|
|
}
|
447 |
|
|
|
448 |
|
|
|
449 |
|
|
|
450 |
|
|
|
451 |
|
|
#/*********************************************************************************************/
|
452 |
|
|
#/ */
|
453 |
|
|
#/ */
|
454 |
|
|
#/ */
|
455 |
|
|
#/ */
|
456 |
|
|
#/ */
|
457 |
|
|
#/ */
|
458 |
|
|
#/*********************************************************************************************/
|
459 |
|
|
|
460 |
|
|
|
461 |
|
|
|
462 |
|
|
|
463 |
|
|
sub parse_component_file
|
464 |
|
|
{
|
465 |
|
|
my @params = @_;
|
466 |
|
|
my $elab_root = pop(@params);
|
467 |
|
|
my $spirit_component_file = pop(@params);
|
468 |
|
|
|
469 |
|
|
|
470 |
|
|
|
471 |
|
|
foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:vendor"))
|
472 |
|
|
{
|
473 |
|
|
my($new_vendor) = $new_comp->findnodes('./text()')->to_literal ;
|
474 |
|
|
my($new_library) = $new_comp->findnodes('../spirit:library/text()')->to_literal ;
|
475 |
|
|
my($new_name) = $new_comp->findnodes('../spirit:name/text()')->to_literal ;
|
476 |
|
|
my($new_version) = $new_comp->findnodes('../spirit:version/text()')->to_literal ;
|
477 |
134 |
jt_eaton |
# print "PARSE component file $elab_root $new_vendor $new_library $new_name $new_version \n";
|
478 |
131 |
jt_eaton |
|
479 |
|
|
|
480 |
|
|
|
481 |
134 |
jt_eaton |
my $parent_socgen_filename = yp::lib::find_componentConfiguration($new_vendor,$new_library,$new_name);
|
482 |
131 |
jt_eaton |
|
483 |
134 |
jt_eaton |
if ($parent_socgen_filename)
|
484 |
131 |
jt_eaton |
|
485 |
134 |
jt_eaton |
{
|
486 |
|
|
|
487 |
|
|
my $parent_socgen_file = $parser->parse_file($parent_socgen_filename);
|
488 |
|
|
foreach my $socgen_cfg ($parent_socgen_file->findnodes("//socgen:componentConfiguration/socgen:configurations/socgen:configuration/socgen:version[text() = '$new_version']/../socgen:parameters/socgen:parameter/socgen:name"))
|
489 |
|
|
{
|
490 |
|
|
my($param_name) = $socgen_cfg->findnodes('./text()')->to_literal ;
|
491 |
|
|
my($param_default) = $socgen_cfg->findnodes('../socgen:value/text()')->to_literal ;
|
492 |
|
|
# print "KKKKKKKK parameter_${elab_root}__${param_name} $param_default \n";
|
493 |
|
|
my $repo_data;
|
494 |
|
|
$elab_db->db_get("parameter_${elab_root}__${param_name}", $repo_data );
|
495 |
|
|
unless (defined $repo_data)
|
496 |
|
|
{
|
497 |
|
|
$elab_db->db_put( "parameter_${elab_root}__${param_name}","${param_default}" );
|
498 |
|
|
}
|
499 |
|
|
}
|
500 |
|
|
};
|
501 |
|
|
|
502 |
131 |
jt_eaton |
#/**********************************************************************/
|
503 |
|
|
#/* */
|
504 |
|
|
#/* parse parameters and values */
|
505 |
|
|
#/* */
|
506 |
|
|
#/**********************************************************************/
|
507 |
|
|
|
508 |
|
|
foreach my $i_name ($spirit_component_file->findnodes('//spirit:model/spirit:modelParameters/spirit:modelParameter/spirit:name'))
|
509 |
|
|
{
|
510 |
|
|
my($parameter_name) = $i_name ->to_literal;
|
511 |
|
|
my($parameter_default) = $i_name ->findnodes('../spirit:value/text()')->to_literal ;
|
512 |
|
|
my $repo_data;
|
513 |
|
|
$elab_db->db_get("parameter_${elab_root}__${parameter_name}", $repo_data );
|
514 |
133 |
jt_eaton |
|
515 |
|
|
|
516 |
|
|
unless (defined $repo_data)
|
517 |
131 |
jt_eaton |
{
|
518 |
|
|
$elab_db->db_put( "parameter_${elab_root}__${parameter_name}","${parameter_default}" );
|
519 |
134 |
jt_eaton |
}
|
520 |
131 |
jt_eaton |
}
|
521 |
|
|
}
|
522 |
|
|
|
523 |
|
|
|
524 |
|
|
|
525 |
|
|
|
526 |
|
|
|
527 |
|
|
|
528 |
|
|
|
529 |
|
|
|
530 |
|
|
|
531 |
|
|
|
532 |
|
|
foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
|
533 |
|
|
{
|
534 |
|
|
my($new_vendor) = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
|
535 |
|
|
my($new_library) = $new_comp->findnodes('./@spirit:library')->to_literal ;
|
536 |
|
|
my($new_name) = $new_comp->findnodes('./@spirit:name')->to_literal ;
|
537 |
|
|
my($new_version) = $new_comp->findnodes('./@spirit:version')->to_literal ;
|
538 |
|
|
if(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version))
|
539 |
|
|
{
|
540 |
|
|
parse_component_file($parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version)),$elab_root );
|
541 |
|
|
}
|
542 |
|
|
|
543 |
|
|
}
|
544 |
|
|
}
|
545 |
|
|
|
546 |
|
|
|
547 |
|
|
|
548 |
|
|
|
549 |
|
|
|
550 |
|
|
|
551 |
|
|
#/*********************************************************************************************/
|
552 |
|
|
#/ */
|
553 |
|
|
#/ */
|
554 |
|
|
#/ */
|
555 |
|
|
#/ */
|
556 |
|
|
#/ */
|
557 |
|
|
#/ */
|
558 |
|
|
#/*********************************************************************************************/
|
559 |
|
|
|
560 |
|
|
|
561 |
|
|
|
562 |
|
|
|
563 |
|
|
sub parse_design_files
|
564 |
|
|
{
|
565 |
|
|
my @params = @_;
|
566 |
|
|
my $elab_root = pop(@params);
|
567 |
|
|
my $spirit_component_file = pop(@params);
|
568 |
|
|
|
569 |
|
|
|
570 |
|
|
|
571 |
|
|
|
572 |
|
|
foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
|
573 |
|
|
{
|
574 |
|
|
my($new_vendor) = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
|
575 |
|
|
my($new_library) = $new_comp->findnodes('./@spirit:library')->to_literal ;
|
576 |
|
|
my($new_name) = $new_comp->findnodes('./@spirit:name')->to_literal ;
|
577 |
|
|
my($new_version) = $new_comp->findnodes('./@spirit:version')->to_literal ;
|
578 |
134 |
jt_eaton |
# print "PARSE design files $elab_root $new_vendor $new_library $new_name $new_version \n";
|
579 |
131 |
jt_eaton |
parse_design_files($parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version )),$elab_root );
|
580 |
|
|
}
|
581 |
|
|
|
582 |
|
|
|
583 |
|
|
|
584 |
|
|
|
585 |
|
|
foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:hierarchyRef"))
|
586 |
|
|
{
|
587 |
|
|
my($new_vendor) = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
|
588 |
|
|
my($new_library) = $new_comp->findnodes('./@spirit:library')->to_literal ;
|
589 |
|
|
my($new_name) = $new_comp->findnodes('./@spirit:name')->to_literal ;
|
590 |
|
|
my($new_version) = $new_comp->findnodes('./@spirit:version')->to_literal ;
|
591 |
|
|
if(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version ))
|
592 |
|
|
{
|
593 |
134 |
jt_eaton |
# print "PARSE DESIGN file $elab_root $new_vendor $new_library $new_name $new_version \n";
|
594 |
131 |
jt_eaton |
parse_design_file($parser->parse_file(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version )),$elab_root );
|
595 |
|
|
}
|
596 |
|
|
}
|
597 |
|
|
|
598 |
|
|
}
|
599 |
|
|
|
600 |
|
|
|
601 |
|
|
|
602 |
|
|
|
603 |
|
|
|
604 |
|
|
|
605 |
|
|
|
606 |
|
|
|
607 |
|
|
|
608 |
|
|
|
609 |
|
|
|
610 |
|
|
|
611 |
|
|
|
612 |
|
|
|
613 |
|
|
|
614 |
|
|
|
615 |
|
|
|
616 |
|
|
|
617 |
|
|
|
618 |
|
|
|
619 |
|
|
|
620 |
|
|
|
621 |
|
|
|
622 |
|
|
|
623 |
|
|
|
624 |
|
|
|
625 |
|
|
|
626 |
|
|
|
627 |
|
|
|
628 |
|
|
|
629 |
|
|
|
630 |
|
|
|
631 |
|
|
|
632 |
|
|
|
633 |
|
|
|
634 |
|
|
#/*********************************************************************************************/
|
635 |
|
|
#/ */
|
636 |
|
|
#/ */
|
637 |
|
|
#/ */
|
638 |
|
|
#/ */
|
639 |
|
|
#/ */
|
640 |
|
|
#/ */
|
641 |
|
|
#/*********************************************************************************************/
|
642 |
|
|
|
643 |
|
|
|
644 |
|
|
|
645 |
|
|
|
646 |
|
|
sub parse_design_file
|
647 |
|
|
{
|
648 |
|
|
my @params = @_;
|
649 |
|
|
my $elab_root = pop(@params);
|
650 |
|
|
my $spirit_design_file = pop(@params);
|
651 |
|
|
|
652 |
|
|
foreach my $new_comp ($spirit_design_file->findnodes("//spirit:design/spirit:vendor"))
|
653 |
|
|
{
|
654 |
|
|
my($new_vendor) = $new_comp->findnodes('./text()')->to_literal ;
|
655 |
|
|
my($new_library) = $new_comp->findnodes('../spirit:library/text()')->to_literal ;
|
656 |
|
|
my($new_name) = $new_comp->findnodes('../spirit:name/text()')->to_literal ;
|
657 |
|
|
my($new_version) = $new_comp->findnodes('../spirit:version/text()')->to_literal ;
|
658 |
134 |
jt_eaton |
# print "WARNING $new_vendor $new_library $new_name $new_version DESIGN \n";
|
659 |
131 |
jt_eaton |
|
660 |
|
|
foreach my $x_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName"))
|
661 |
|
|
{
|
662 |
|
|
#/**********************************************************************/
|
663 |
|
|
#/* */
|
664 |
|
|
#/* Lookup VLNV for each instantiated component */
|
665 |
|
|
#/* */
|
666 |
|
|
#/**********************************************************************/
|
667 |
|
|
my($instance_name) = $x_name ->findnodes('./text()')->to_literal ;
|
668 |
|
|
my($vendor_name) = $x_name ->findnodes('../spirit:componentRef/@spirit:vendor')->to_literal ;
|
669 |
|
|
my($library_name) = $x_name ->findnodes('../spirit:componentRef/@spirit:library')->to_literal ;
|
670 |
|
|
my($component_name) = $x_name ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
|
671 |
|
|
my($version_name) = $x_name ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
|
672 |
134 |
jt_eaton |
# print "INSTANCED $instance_name $vendor_name $library_name $component_name $version_name \n";
|
673 |
131 |
jt_eaton |
$elab_db->db_put( "component___${elab_root}.${instance_name}","${vendor_name}:${library_name}:${component_name}:${version_name}" );
|
674 |
|
|
|
675 |
133 |
jt_eaton |
my $repo_data;
|
676 |
134 |
jt_eaton |
if(defined $name && length $name >0)
|
677 |
|
|
{
|
678 |
|
|
$elab_db->db_get("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}:${name}", $repo_data );
|
679 |
|
|
$elab_db->db_put("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}:${name}","${repo_data}${elab_root}.${instance_name}:::");
|
680 |
|
|
}
|
681 |
|
|
else
|
682 |
|
|
{
|
683 |
133 |
jt_eaton |
$elab_db->db_get("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}", $repo_data );
|
684 |
|
|
$elab_db->db_put("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}","${repo_data}${elab_root}.${instance_name}:::");
|
685 |
134 |
jt_eaton |
}
|
686 |
|
|
my $cmd ="./tools/verilog/elab_verilog -vendor ${vendor_name} -library ${library_name} -component ${component_name} -version ${version_name}\n";
|
687 |
133 |
jt_eaton |
|
688 |
134 |
jt_eaton |
if(system($cmd)){}
|
689 |
|
|
|
690 |
|
|
|
691 |
|
|
|
692 |
131 |
jt_eaton |
if ($instance_name)
|
693 |
|
|
{
|
694 |
|
|
foreach my $i_parameter ($spirit_design_file->findnodes("//spirit:componentInstance[spirit:instanceName/text() = '$instance_name']/spirit:configurableElementValues/spirit:configurableElementValue/\@spirit:referenceId"))
|
695 |
|
|
{
|
696 |
|
|
my($foo_name) = $i_parameter ->to_literal ;
|
697 |
|
|
my($foo_value) = $i_parameter ->findnodes('../text()')->to_literal ;
|
698 |
133 |
jt_eaton |
|
699 |
134 |
jt_eaton |
my $fee_value = $foo_value;
|
700 |
|
|
my $p_key;
|
701 |
|
|
my $p_value;
|
702 |
|
|
my $p_cursor = $elab_db ->db_cursor() ;
|
703 |
|
|
while ($p_cursor->c_get($p_key, $p_value, DB_NEXT) == 0)
|
704 |
|
|
{
|
705 |
|
|
$_ = $p_key;
|
706 |
|
|
# print "---> $p_key $p_value \n";
|
707 |
|
|
if(/parameter_${elab_root}__(\S+)/)
|
708 |
|
|
{
|
709 |
|
|
if($1 eq $p_value)
|
710 |
|
|
{
|
711 |
|
|
print "DDDDDDDDDDDDDDDDDDDDDDDDDD $p_key $p_value \n";
|
712 |
|
|
}
|
713 |
|
|
else
|
714 |
|
|
{
|
715 |
|
|
$fee_value = math::lib::parse($fee_value,$1,$p_value);
|
716 |
|
|
}
|
717 |
|
|
}
|
718 |
|
|
}
|
719 |
|
|
my $status = $p_cursor->c_close() ;
|
720 |
|
|
|
721 |
|
|
|
722 |
|
|
|
723 |
|
|
|
724 |
|
|
|
725 |
|
|
# replace this!!!
|
726 |
|
|
# scan for all names in db_get("parameter_${elab_root}__${name}", $repo_data
|
727 |
|
|
# and substitute $repo_data anywhere in $foo_value
|
728 |
|
|
# then run $foo_value thru sys/math
|
729 |
|
|
|
730 |
|
|
|
731 |
133 |
jt_eaton |
$_ = $foo_value;
|
732 |
|
|
my $t_name;
|
733 |
|
|
my $t_op;
|
734 |
131 |
jt_eaton |
my $repo_data;
|
735 |
133 |
jt_eaton |
|
736 |
|
|
if(/(\S+)[+](\S+)/)
|
737 |
|
|
{
|
738 |
|
|
$t_name = $1;
|
739 |
|
|
$t_op = $2;
|
740 |
|
|
$elab_db->db_get("parameter_${elab_root}__${t_name}", $repo_data );
|
741 |
|
|
unless (defined $repo_data)
|
742 |
|
|
{
|
743 |
|
|
$repo_data = $foo_value ;
|
744 |
|
|
}
|
745 |
|
|
else
|
746 |
|
|
{
|
747 |
|
|
$repo_data = $repo_data + $t_op ;
|
748 |
|
|
}
|
749 |
|
|
}
|
750 |
|
|
else
|
751 |
134 |
jt_eaton |
|
752 |
|
|
# end replace
|
753 |
|
|
|
754 |
133 |
jt_eaton |
{
|
755 |
|
|
$elab_db->db_get("parameter_${elab_root}__${foo_value}", $repo_data );
|
756 |
|
|
unless (defined $repo_data)
|
757 |
|
|
{
|
758 |
|
|
$repo_data = $foo_value ;
|
759 |
|
|
}
|
760 |
|
|
}
|
761 |
|
|
|
762 |
134 |
jt_eaton |
$elab_db->db_put( "parameter_${elab_root}.${instance_name}__${foo_name}","${repo_data}" );
|
763 |
|
|
$elab_db->db_put( "Parameter_${elab_root}.${instance_name}__${foo_name}","${foo_value}" );
|
764 |
|
|
$elab_db->db_put( "Xarameter_${elab_root}.${instance_name}__${foo_name}","${fee_value}" );
|
765 |
|
|
# print "PARAMETERE ${elab_root}.${instance_name} $foo_name p_ $repo_data P_ $foo_value X_ $fee_value \n";
|
766 |
131 |
jt_eaton |
}
|
767 |
|
|
|
768 |
|
|
elaborate( "${elab_root}.${instance_name}","${vendor_name}","${library_name}","${component_name}","${version_name}" );
|
769 |
|
|
}
|
770 |
|
|
}
|
771 |
|
|
}
|
772 |
|
|
}
|
773 |
|
|
|
774 |
|
|
|
775 |
|
|
|
776 |
|
|
|
777 |
|
|
1
|