1 |
134 |
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 |
|
|
use math::lib;
|
60 |
|
|
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 |
|
|
"configuration=s" => \$configuration,
|
78 |
|
|
"dest_dir=s" => \$dest_dir
|
79 |
|
|
|
80 |
|
|
) || die "(use '$program_name -h' for help)";
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
##############################################################################
|
85 |
|
|
## Help option
|
86 |
|
|
##############################################################################
|
87 |
|
|
if ( $opt_h or $opt_help )
|
88 |
|
|
{ print "\n elab_config_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";
|
89 |
|
|
exit 1;
|
90 |
|
|
}
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
|
94 |
|
|
#############################################################################
|
95 |
|
|
##
|
96 |
|
|
##
|
97 |
|
|
#############################################################################
|
98 |
|
|
|
99 |
|
|
$home = cwd();
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
my $root = "root";
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
print "elab_config_verilog ${vendor}_${library}_${component}_${version} $configuration \n";
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
my $parser = XML::LibXML->new();
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
my $path;
|
119 |
|
|
|
120 |
|
|
my $design_db_file = yp::lib::get_design_db_file;
|
121 |
|
|
my $design_db = new BerkeleyDB::Hash( -Filename => "$design_db_file", -Flags => DB_CREATE ) or die "Cannot open $design_db_file: $!";
|
122 |
|
|
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
|
126 |
|
|
|
127 |
|
|
my $elab_db_file = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,$configuration);
|
128 |
|
|
|
129 |
|
|
if(-e $elab_db_file)
|
130 |
|
|
{
|
131 |
|
|
exit ;
|
132 |
|
|
"$elab_db_file Exists\n";
|
133 |
|
|
}
|
134 |
|
|
|
135 |
|
|
print "ELAB_CONFIG_VERILOG ${vendor}_${library}_${component}_${version}_${configuration} || || $elab_db_file \n";
|
136 |
|
|
|
137 |
|
|
|
138 |
|
|
my $elab_db = new BerkeleyDB::Hash( -Filename => "$elab_db_file", -Flags => DB_CREATE ) or die "Cannot open $elab_db_file: $!";
|
139 |
|
|
$elab_db->db_put( "component___root" ,"${vendor}:${library}:${component}:${version}:${configuration}" );
|
140 |
|
|
|
141 |
|
|
my $repo_data;
|
142 |
|
|
|
143 |
|
|
$elab_db->db_get("VLNV___${vendor}:${library}:${component}:${version}:${configuration}", $repo_data );
|
144 |
|
|
$elab_db->db_put("VLNV___${vendor}:${library}:${component}:${version}:${configuration}","${repo_data}${root}:::" );
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
my $c_key;
|
148 |
|
|
my $c_value;
|
149 |
|
|
my $param_str;
|
150 |
|
|
my $config___;
|
151 |
|
|
|
152 |
|
|
my @params = ();
|
153 |
|
|
|
154 |
|
|
my $c_cursor = $design_db ->db_cursor() ;
|
155 |
|
|
while ($c_cursor->c_get($c_key, $c_value, DB_NEXT) == 0)
|
156 |
|
|
{
|
157 |
|
|
if($c_value eq $configuration)
|
158 |
|
|
{
|
159 |
|
|
|
160 |
|
|
( $config___ , $param_str) = split( /___/ , $c_key);
|
161 |
|
|
# print "XXXXX $param_str \n";
|
162 |
|
|
( @params) = split( /:::/ , $param_str);
|
163 |
|
|
}
|
164 |
|
|
|
165 |
|
|
|
166 |
|
|
|
167 |
|
|
|
168 |
|
|
}
|
169 |
|
|
|
170 |
|
|
my $status = $c_cursor->c_close() ;
|
171 |
|
|
|
172 |
|
|
|
173 |
|
|
foreach my $param (@params)
|
174 |
|
|
{
|
175 |
|
|
my $p_name;
|
176 |
|
|
my $p_value;
|
177 |
|
|
( $p_name , $p_value) = split( /--/ , $param);
|
178 |
|
|
#print "XXXXXX ${root} $p_name $p_value \n";
|
179 |
|
|
$elab_db->db_put( "parameter_${root}__${p_name}","${p_value}" );
|
180 |
|
|
}
|
181 |
|
|
|
182 |
|
|
|
183 |
|
|
|
184 |
|
|
elaborate( "${root}","${vendor}","${library}","${component}","${version}" );
|
185 |
|
|
|
186 |
|
|
|
187 |
|
|
|
188 |
|
|
|
189 |
|
|
|
190 |
|
|
# Now tag all component___root instances with config_n #
|
191 |
|
|
|
192 |
|
|
my $key;
|
193 |
|
|
my $value;
|
194 |
|
|
|
195 |
|
|
my @elab_puts;
|
196 |
|
|
|
197 |
|
|
|
198 |
|
|
my $v_cursor = $elab_db ->db_cursor() ;
|
199 |
|
|
while ($v_cursor->c_get($key, $value, DB_NEXT) == 0)
|
200 |
|
|
{
|
201 |
|
|
$_ = $key;
|
202 |
|
|
if(/component___root\.(\S+)/)
|
203 |
|
|
{
|
204 |
|
|
my $p_key;
|
205 |
|
|
my $p_value;
|
206 |
|
|
my $p_cursor = $elab_db ->db_cursor() ;
|
207 |
|
|
my $match = "parameter_root.$1__";
|
208 |
|
|
my $p_config = "CONFIG___";
|
209 |
|
|
my @param_store;
|
210 |
|
|
|
211 |
|
|
while ($p_cursor->c_get($p_key, $p_value, DB_NEXT) == 0)
|
212 |
|
|
{
|
213 |
|
|
$_ = $p_key;
|
214 |
|
|
if(/${match}(\S+)/)
|
215 |
|
|
{
|
216 |
|
|
push @param_store,"${1}--${p_value}";
|
217 |
|
|
}
|
218 |
|
|
}
|
219 |
|
|
my $status = $p_cursor->c_close() ;
|
220 |
|
|
@param_store = sys::lib::trim_sort(@param_store);
|
221 |
|
|
my $p_store;
|
222 |
|
|
foreach my $store (@param_store)
|
223 |
|
|
{
|
224 |
|
|
$p_store = "${store}:::${p_store}";
|
225 |
|
|
}
|
226 |
|
|
|
227 |
|
|
my $config_n;
|
228 |
|
|
$design_db->db_get("${p_config}${p_store}", $config_n );
|
229 |
|
|
# print "D $key $value ${config_n} \n";
|
230 |
|
|
push @elab_puts ,"$key|||$value:${config_n}";
|
231 |
|
|
}
|
232 |
|
|
}
|
233 |
|
|
|
234 |
|
|
my $status = $v_cursor->c_close() ;
|
235 |
|
|
|
236 |
|
|
foreach my $elab_put (@elab_puts)
|
237 |
|
|
{
|
238 |
|
|
( ${key},${value}) = split( /\|\|\|/ , $elab_put);
|
239 |
|
|
$elab_db->db_put( $key,$value);
|
240 |
|
|
}
|
241 |
|
|
|
242 |
|
|
|
243 |
|
|
$elab_db->db_close();
|
244 |
|
|
$design_db->db_close();
|
245 |
|
|
|
246 |
|
|
|
247 |
|
|
|
248 |
|
|
|
249 |
|
|
|
250 |
|
|
|
251 |
|
|
|
252 |
|
|
|
253 |
|
|
|
254 |
|
|
|
255 |
|
|
|
256 |
|
|
|
257 |
|
|
|
258 |
|
|
|
259 |
|
|
|
260 |
|
|
|
261 |
|
|
|
262 |
|
|
|
263 |
|
|
|
264 |
|
|
|
265 |
|
|
#/*********************************************************************************************/
|
266 |
|
|
#/ */
|
267 |
|
|
#/ Recursive entry point for all lower levels */
|
268 |
|
|
#/ */
|
269 |
|
|
#/ */
|
270 |
|
|
#/ */
|
271 |
|
|
#/ */
|
272 |
|
|
#/*********************************************************************************************/
|
273 |
|
|
|
274 |
|
|
sub elaborate
|
275 |
|
|
{
|
276 |
|
|
my @params = @_;
|
277 |
|
|
my $elab_version = pop(@params);
|
278 |
|
|
my $elab_component = pop(@params);
|
279 |
|
|
my $elab_library = pop(@params);
|
280 |
|
|
my $elab_vendor = pop(@params);
|
281 |
|
|
my $elab_root = pop(@params);
|
282 |
|
|
|
283 |
|
|
# print "ELABORATING $elab_root $elab_vendor $elab_library $elab_component $elab_version \n";
|
284 |
|
|
my $spirit_component_file = $parser->parse_file(yp::lib::find_ipxact_component($elab_vendor,$elab_library,$elab_component,$elab_version));
|
285 |
|
|
parse_component_file($spirit_component_file,$elab_root);
|
286 |
|
|
parse_design_files($spirit_component_file,$elab_root);
|
287 |
|
|
# print "Exit $elab_root \n";
|
288 |
|
|
return;
|
289 |
|
|
}
|
290 |
|
|
|
291 |
|
|
|
292 |
|
|
|
293 |
|
|
|
294 |
|
|
#/*********************************************************************************************/
|
295 |
|
|
#/ */
|
296 |
|
|
#/ */
|
297 |
|
|
#/ */
|
298 |
|
|
#/ */
|
299 |
|
|
#/ */
|
300 |
|
|
#/ */
|
301 |
|
|
#/*********************************************************************************************/
|
302 |
|
|
|
303 |
|
|
|
304 |
|
|
|
305 |
|
|
|
306 |
|
|
sub parse_component_file
|
307 |
|
|
{
|
308 |
|
|
my @params = @_;
|
309 |
|
|
my $elab_root = pop(@params);
|
310 |
|
|
my $spirit_component_file = pop(@params);
|
311 |
|
|
|
312 |
|
|
|
313 |
|
|
|
314 |
|
|
foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:vendor"))
|
315 |
|
|
{
|
316 |
|
|
my($new_vendor) = $new_comp->findnodes('./text()')->to_literal ;
|
317 |
|
|
my($new_library) = $new_comp->findnodes('../spirit:library/text()')->to_literal ;
|
318 |
|
|
my($new_name) = $new_comp->findnodes('../spirit:name/text()')->to_literal ;
|
319 |
|
|
my($new_version) = $new_comp->findnodes('../spirit:version/text()')->to_literal ;
|
320 |
|
|
# print "PARSE component file $elab_root $new_vendor $new_library $new_name $new_version \n";
|
321 |
|
|
|
322 |
|
|
|
323 |
|
|
my $parent_socgen_filename = yp::lib::find_componentConfiguration($new_vendor,$new_library,$new_name);
|
324 |
|
|
|
325 |
|
|
if ($parent_socgen_filename)
|
326 |
|
|
|
327 |
|
|
{
|
328 |
|
|
|
329 |
|
|
my $parent_socgen_file = $parser->parse_file($parent_socgen_filename);
|
330 |
|
|
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"))
|
331 |
|
|
{
|
332 |
|
|
my($param_name) = $socgen_cfg->findnodes('./text()')->to_literal ;
|
333 |
|
|
my($param_default) = $socgen_cfg->findnodes('../socgen:value/text()')->to_literal ;
|
334 |
|
|
|
335 |
|
|
|
336 |
|
|
# print "KKKKKKKK parameter_${elab_root}__${param_name} $param_default \n";
|
337 |
|
|
|
338 |
|
|
my $repo_data;
|
339 |
|
|
$elab_db->db_get("parameter_${elab_root}__${param_name}", $repo_data );
|
340 |
|
|
|
341 |
|
|
|
342 |
|
|
unless (defined $repo_data)
|
343 |
|
|
{
|
344 |
|
|
$elab_db->db_put( "parameter_${elab_root}__${param_name}","${param_default}" );
|
345 |
|
|
|
346 |
|
|
|
347 |
|
|
}
|
348 |
|
|
|
349 |
|
|
|
350 |
|
|
|
351 |
|
|
}
|
352 |
|
|
|
353 |
|
|
};
|
354 |
|
|
|
355 |
|
|
#/**********************************************************************/
|
356 |
|
|
#/* */
|
357 |
|
|
#/* parse parameters and values */
|
358 |
|
|
#/* */
|
359 |
|
|
#/**********************************************************************/
|
360 |
|
|
|
361 |
|
|
foreach my $i_name ($spirit_component_file->findnodes('//spirit:model/spirit:modelParameters/spirit:modelParameter/spirit:name'))
|
362 |
|
|
{
|
363 |
|
|
my($parameter_name) = $i_name ->to_literal;
|
364 |
|
|
my($parameter_default) = $i_name ->findnodes('../spirit:value/text()')->to_literal ;
|
365 |
|
|
my $repo_data;
|
366 |
|
|
$elab_db->db_get("parameter_${elab_root}__${parameter_name}", $repo_data );
|
367 |
|
|
|
368 |
|
|
|
369 |
|
|
unless (defined $repo_data)
|
370 |
|
|
{
|
371 |
|
|
$elab_db->db_put( "parameter_${elab_root}__${parameter_name}","${parameter_default}" );
|
372 |
|
|
}
|
373 |
|
|
}
|
374 |
|
|
}
|
375 |
|
|
|
376 |
|
|
foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
|
377 |
|
|
{
|
378 |
|
|
my($new_vendor) = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
|
379 |
|
|
my($new_library) = $new_comp->findnodes('./@spirit:library')->to_literal ;
|
380 |
|
|
my($new_name) = $new_comp->findnodes('./@spirit:name')->to_literal ;
|
381 |
|
|
my($new_version) = $new_comp->findnodes('./@spirit:version')->to_literal ;
|
382 |
|
|
if(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version))
|
383 |
|
|
{
|
384 |
|
|
parse_component_file($parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version)),$elab_root );
|
385 |
|
|
}
|
386 |
|
|
|
387 |
|
|
}
|
388 |
|
|
}
|
389 |
|
|
|
390 |
|
|
|
391 |
|
|
|
392 |
|
|
|
393 |
|
|
|
394 |
|
|
|
395 |
|
|
#/*********************************************************************************************/
|
396 |
|
|
#/ */
|
397 |
|
|
#/ */
|
398 |
|
|
#/ */
|
399 |
|
|
#/ */
|
400 |
|
|
#/ */
|
401 |
|
|
#/ */
|
402 |
|
|
#/*********************************************************************************************/
|
403 |
|
|
|
404 |
|
|
|
405 |
|
|
|
406 |
|
|
|
407 |
|
|
sub parse_design_files
|
408 |
|
|
{
|
409 |
|
|
my @params = @_;
|
410 |
|
|
my $elab_root = pop(@params);
|
411 |
|
|
my $spirit_component_file = pop(@params);
|
412 |
|
|
|
413 |
|
|
|
414 |
|
|
|
415 |
|
|
|
416 |
|
|
foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:vendorExtensions/spirit:componentRef"))
|
417 |
|
|
{
|
418 |
|
|
my($new_vendor) = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
|
419 |
|
|
my($new_library) = $new_comp->findnodes('./@spirit:library')->to_literal ;
|
420 |
|
|
my($new_name) = $new_comp->findnodes('./@spirit:name')->to_literal ;
|
421 |
|
|
my($new_version) = $new_comp->findnodes('./@spirit:version')->to_literal ;
|
422 |
|
|
# print "PARSE design files $elab_root $new_vendor $new_library $new_name $new_version \n";
|
423 |
|
|
parse_design_files($parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version )),$elab_root );
|
424 |
|
|
}
|
425 |
|
|
|
426 |
|
|
|
427 |
|
|
|
428 |
|
|
|
429 |
|
|
foreach my $new_comp ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:hierarchyRef"))
|
430 |
|
|
{
|
431 |
|
|
my($new_vendor) = $new_comp->findnodes('./@spirit:vendor')->to_literal ;
|
432 |
|
|
my($new_library) = $new_comp->findnodes('./@spirit:library')->to_literal ;
|
433 |
|
|
my($new_name) = $new_comp->findnodes('./@spirit:name')->to_literal ;
|
434 |
|
|
my($new_version) = $new_comp->findnodes('./@spirit:version')->to_literal ;
|
435 |
|
|
if(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version ))
|
436 |
|
|
{
|
437 |
|
|
# print "PARSE DESIGN file $elab_root $new_vendor $new_library $new_name $new_version \n";
|
438 |
|
|
parse_design_file($parser->parse_file(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version )),$elab_root );
|
439 |
|
|
}
|
440 |
|
|
}
|
441 |
|
|
|
442 |
|
|
}
|
443 |
|
|
|
444 |
|
|
|
445 |
|
|
|
446 |
|
|
|
447 |
|
|
|
448 |
|
|
|
449 |
|
|
|
450 |
|
|
|
451 |
|
|
|
452 |
|
|
|
453 |
|
|
|
454 |
|
|
|
455 |
|
|
|
456 |
|
|
|
457 |
|
|
|
458 |
|
|
|
459 |
|
|
|
460 |
|
|
|
461 |
|
|
|
462 |
|
|
|
463 |
|
|
|
464 |
|
|
|
465 |
|
|
|
466 |
|
|
|
467 |
|
|
|
468 |
|
|
|
469 |
|
|
|
470 |
|
|
|
471 |
|
|
|
472 |
|
|
|
473 |
|
|
|
474 |
|
|
|
475 |
|
|
|
476 |
|
|
|
477 |
|
|
|
478 |
|
|
#/*********************************************************************************************/
|
479 |
|
|
#/ */
|
480 |
|
|
#/ */
|
481 |
|
|
#/ */
|
482 |
|
|
#/ */
|
483 |
|
|
#/ */
|
484 |
|
|
#/ */
|
485 |
|
|
#/*********************************************************************************************/
|
486 |
|
|
|
487 |
|
|
|
488 |
|
|
|
489 |
|
|
|
490 |
|
|
sub parse_design_file
|
491 |
|
|
{
|
492 |
|
|
my @params = @_;
|
493 |
|
|
my $elab_root = pop(@params);
|
494 |
|
|
my $spirit_design_file = pop(@params);
|
495 |
|
|
|
496 |
|
|
foreach my $new_comp ($spirit_design_file->findnodes("//spirit:design/spirit:vendor"))
|
497 |
|
|
{
|
498 |
|
|
my($new_vendor) = $new_comp->findnodes('./text()')->to_literal ;
|
499 |
|
|
my($new_library) = $new_comp->findnodes('../spirit:library/text()')->to_literal ;
|
500 |
|
|
my($new_name) = $new_comp->findnodes('../spirit:name/text()')->to_literal ;
|
501 |
|
|
my($new_version) = $new_comp->findnodes('../spirit:version/text()')->to_literal ;
|
502 |
|
|
# print "WARNING $new_vendor $new_library $new_name $new_version DESIGN \n";
|
503 |
|
|
|
504 |
|
|
foreach my $x_name ($spirit_design_file->findnodes("//spirit:design/spirit:componentInstances/spirit:componentInstance/spirit:instanceName"))
|
505 |
|
|
{
|
506 |
|
|
#/**********************************************************************/
|
507 |
|
|
#/* */
|
508 |
|
|
#/* Lookup VLNV for each instantiated component */
|
509 |
|
|
#/* */
|
510 |
|
|
#/**********************************************************************/
|
511 |
|
|
my($instance_name) = $x_name ->findnodes('./text()')->to_literal ;
|
512 |
|
|
my($vendor_name) = $x_name ->findnodes('../spirit:componentRef/@spirit:vendor')->to_literal ;
|
513 |
|
|
my($library_name) = $x_name ->findnodes('../spirit:componentRef/@spirit:library')->to_literal ;
|
514 |
|
|
my($component_name) = $x_name ->findnodes('../spirit:componentRef/@spirit:name')->to_literal ;
|
515 |
|
|
my($version_name) = $x_name ->findnodes('../spirit:componentRef/@spirit:version')->to_literal ;
|
516 |
|
|
# print "INSTANCED $instance_name $vendor_name $library_name $component_name $version_name \n";
|
517 |
|
|
$elab_db->db_put( "component___${elab_root}.${instance_name}","${vendor_name}:${library_name}:${component_name}:${version_name}" );
|
518 |
|
|
|
519 |
|
|
my $repo_data;
|
520 |
|
|
if(defined $name && length $name >0)
|
521 |
|
|
{
|
522 |
|
|
$elab_db->db_get("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}:${name}", $repo_data );
|
523 |
|
|
$elab_db->db_put("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}:${name}","${repo_data}${elab_root}.${instance_name}:::");
|
524 |
|
|
}
|
525 |
|
|
else
|
526 |
|
|
{
|
527 |
|
|
$elab_db->db_get("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}", $repo_data );
|
528 |
|
|
$elab_db->db_put("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}","${repo_data}${elab_root}.${instance_name}:::");
|
529 |
|
|
}
|
530 |
|
|
my $cmd ="./tools/verilog/elab_verilog -vendor ${vendor_name} -library ${library_name} -component ${component_name} -version ${version_name}\n";
|
531 |
|
|
|
532 |
|
|
#### if(system($cmd)){}
|
533 |
|
|
|
534 |
|
|
|
535 |
|
|
|
536 |
|
|
if ($instance_name)
|
537 |
|
|
{
|
538 |
|
|
foreach my $i_parameter ($spirit_design_file->findnodes("//spirit:componentInstance[spirit:instanceName/text() = '$instance_name']/spirit:configurableElementValues/spirit:configurableElementValue/\@spirit:referenceId"))
|
539 |
|
|
{
|
540 |
|
|
my($foo_name) = $i_parameter ->to_literal ;
|
541 |
|
|
my($foo_value) = $i_parameter ->findnodes('../text()')->to_literal ;
|
542 |
|
|
|
543 |
|
|
my $fee_value = $foo_value;
|
544 |
|
|
my $p_key;
|
545 |
|
|
my $p_value;
|
546 |
|
|
my $p_cursor = $elab_db ->db_cursor() ;
|
547 |
|
|
while ($p_cursor->c_get($p_key, $p_value, DB_NEXT) == 0)
|
548 |
|
|
{
|
549 |
|
|
$_ = $p_key;
|
550 |
|
|
# print "---> $p_key $p_value \n";
|
551 |
|
|
if(/parameter_${elab_root}__(\S+)/)
|
552 |
|
|
{
|
553 |
|
|
$fee_value = math::lib::parse($fee_value,$1,$p_value);
|
554 |
|
|
}
|
555 |
|
|
}
|
556 |
|
|
my $status = $p_cursor->c_close() ;
|
557 |
|
|
|
558 |
|
|
|
559 |
|
|
|
560 |
|
|
|
561 |
|
|
|
562 |
|
|
# replace this!!!
|
563 |
|
|
# scan for all names in db_get("parameter_${elab_root}__${name}", $repo_data
|
564 |
|
|
# and substitute $repo_data anywhere in $foo_value
|
565 |
|
|
# then run $foo_value thru sys/math
|
566 |
|
|
|
567 |
|
|
|
568 |
|
|
$_ = $foo_value;
|
569 |
|
|
my $t_name;
|
570 |
|
|
my $t_op;
|
571 |
|
|
my $repo_data;
|
572 |
|
|
|
573 |
|
|
if(/(\S+)[+](\S+)/)
|
574 |
|
|
{
|
575 |
|
|
$t_name = $1;
|
576 |
|
|
$t_op = $2;
|
577 |
|
|
$elab_db->db_get("parameter_${elab_root}__${t_name}", $repo_data );
|
578 |
|
|
unless (defined $repo_data)
|
579 |
|
|
{
|
580 |
|
|
$repo_data = $foo_value ;
|
581 |
|
|
}
|
582 |
|
|
else
|
583 |
|
|
{
|
584 |
|
|
$repo_data = $repo_data + $t_op ;
|
585 |
|
|
}
|
586 |
|
|
}
|
587 |
|
|
else
|
588 |
|
|
|
589 |
|
|
# end replace
|
590 |
|
|
|
591 |
|
|
{
|
592 |
|
|
$elab_db->db_get("parameter_${elab_root}__${foo_value}", $repo_data );
|
593 |
|
|
unless (defined $repo_data)
|
594 |
|
|
{
|
595 |
|
|
$repo_data = $foo_value ;
|
596 |
|
|
}
|
597 |
|
|
}
|
598 |
|
|
|
599 |
|
|
$elab_db->db_put( "parameter_${elab_root}.${instance_name}__${foo_name}","${repo_data}" );
|
600 |
|
|
$elab_db->db_put( "Parameter_${elab_root}.${instance_name}__${foo_name}","${foo_value}" );
|
601 |
|
|
$elab_db->db_put( "Xarameter_${elab_root}.${instance_name}__${foo_name}","${fee_value}" );
|
602 |
|
|
# print "PARAMETERE ${elab_root}.${instance_name} $foo_name p_ $repo_data P_ $foo_value X_ $fee_value \n";
|
603 |
|
|
}
|
604 |
|
|
|
605 |
|
|
elaborate( "${elab_root}.${instance_name}","${vendor_name}","${library_name}","${component_name}","${version_name}" );
|
606 |
|
|
}
|
607 |
|
|
}
|
608 |
|
|
}
|
609 |
|
|
}
|
610 |
|
|
|
611 |
|
|
|
612 |
|
|
|
613 |
|
|
|
614 |
|
|
1
|