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