| 1 |
134 |
jt_eaton |
eval 'exec `which perl` -S $0 ${1+"$@"}'
|
| 2 |
|
|
if 0;
|
| 3 |
135 |
jt_eaton |
#/****************************************************************************/
|
| 4 |
|
|
#/* */
|
| 5 |
|
|
#/* SOCGEN Design for Reuse toolset */
|
| 6 |
|
|
#/* */
|
| 7 |
|
|
#/* Version 1.0.0 */
|
| 8 |
|
|
#/* */
|
| 9 |
|
|
#/* Author(s): */
|
| 10 |
|
|
#/* - John Eaton, z3qmtr45@gmail.com */
|
| 11 |
|
|
#/* */
|
| 12 |
|
|
#/****************************************************************************/
|
| 13 |
|
|
#/* */
|
| 14 |
|
|
#/* */
|
| 15 |
|
|
#/* Copyright 2016 John T Eaton */
|
| 16 |
|
|
#/* */
|
| 17 |
|
|
#/* Licensed under the Apache License, Version 2.0 (the "License"); */
|
| 18 |
|
|
#/* you may not use this file except in compliance with the License. */
|
| 19 |
|
|
#/* You may obtain a copy of the License at */
|
| 20 |
|
|
#/* */
|
| 21 |
|
|
#/* http://www.apache.org/licenses/LICENSE-2.0 */
|
| 22 |
|
|
#/* */
|
| 23 |
|
|
#/* Unless required by applicable law or agreed to in writing, software */
|
| 24 |
|
|
#/* distributed under the License is distributed on an "AS IS" BASIS, */
|
| 25 |
|
|
#/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
|
| 26 |
|
|
#/* See the License for the specific language governing permissions and */
|
| 27 |
|
|
#/* limitations under the License. */
|
| 28 |
|
|
#/* */
|
| 29 |
|
|
#/* */
|
| 30 |
|
|
#/****************************************************************************/
|
| 31 |
134 |
jt_eaton |
|
| 32 |
|
|
|
| 33 |
135 |
jt_eaton |
|
| 34 |
134 |
jt_eaton |
############################################################################
|
| 35 |
|
|
# General PERL config
|
| 36 |
|
|
############################################################################
|
| 37 |
|
|
use Getopt::Long;
|
| 38 |
|
|
use English;
|
| 39 |
|
|
use File::Basename;
|
| 40 |
|
|
use Cwd;
|
| 41 |
|
|
use Scalar::Util qw(looks_like_number);
|
| 42 |
|
|
use XML::LibXML;
|
| 43 |
|
|
use lib './tools';
|
| 44 |
|
|
use sys::lib;
|
| 45 |
|
|
use yp::lib;
|
| 46 |
|
|
use math::lib;
|
| 47 |
|
|
use BerkeleyDB;
|
| 48 |
|
|
|
| 49 |
|
|
|
| 50 |
|
|
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
|
| 51 |
|
|
|
| 52 |
|
|
|
| 53 |
|
|
############################################################################
|
| 54 |
|
|
### Process the options
|
| 55 |
|
|
############################################################################
|
| 56 |
|
|
Getopt::Long::config("require_order", "prefix=-");
|
| 57 |
|
|
GetOptions("h","help",
|
| 58 |
|
|
"envidentifier=s" => \$envidentifier,
|
| 59 |
|
|
"prefix=s" => \$prefix,
|
| 60 |
|
|
"vendor=s" => \$vendor,
|
| 61 |
|
|
"library=s" => \$library,
|
| 62 |
|
|
"component=s" => \$component,
|
| 63 |
|
|
"version=s" => \$version,
|
| 64 |
|
|
"configuration=s" => \$configuration,
|
| 65 |
|
|
"dest_dir=s" => \$dest_dir
|
| 66 |
|
|
|
| 67 |
|
|
) || die "(use '$program_name -h' for help)";
|
| 68 |
|
|
|
| 69 |
|
|
|
| 70 |
|
|
|
| 71 |
|
|
##############################################################################
|
| 72 |
|
|
## Help option
|
| 73 |
|
|
##############################################################################
|
| 74 |
|
|
if ( $opt_h or $opt_help )
|
| 75 |
|
|
{ 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";
|
| 76 |
|
|
exit 1;
|
| 77 |
|
|
}
|
| 78 |
|
|
|
| 79 |
|
|
|
| 80 |
|
|
|
| 81 |
|
|
#############################################################################
|
| 82 |
|
|
##
|
| 83 |
|
|
##
|
| 84 |
|
|
#############################################################################
|
| 85 |
|
|
|
| 86 |
|
|
$home = cwd();
|
| 87 |
|
|
|
| 88 |
|
|
|
| 89 |
|
|
|
| 90 |
|
|
|
| 91 |
|
|
|
| 92 |
|
|
|
| 93 |
|
|
|
| 94 |
|
|
my $root = "root";
|
| 95 |
|
|
|
| 96 |
|
|
|
| 97 |
|
|
|
| 98 |
|
|
print "elab_config_verilog ${vendor}_${library}_${component}_${version} $configuration \n";
|
| 99 |
|
|
|
| 100 |
|
|
|
| 101 |
|
|
my $parser = XML::LibXML->new();
|
| 102 |
|
|
|
| 103 |
|
|
|
| 104 |
|
|
|
| 105 |
|
|
my $path;
|
| 106 |
|
|
|
| 107 |
|
|
my $design_db_file = yp::lib::get_design_db_file;
|
| 108 |
|
|
my $design_db = new BerkeleyDB::Hash( -Filename => "$design_db_file", -Flags => DB_CREATE ) or die "Cannot open $design_db_file: $!";
|
| 109 |
|
|
|
| 110 |
|
|
|
| 111 |
|
|
|
| 112 |
|
|
|
| 113 |
|
|
|
| 114 |
|
|
my $elab_db_file = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,$configuration);
|
| 115 |
|
|
|
| 116 |
|
|
if(-e $elab_db_file)
|
| 117 |
|
|
{
|
| 118 |
|
|
exit ;
|
| 119 |
|
|
"$elab_db_file Exists\n";
|
| 120 |
|
|
}
|
| 121 |
|
|
|
| 122 |
|
|
print "ELAB_CONFIG_VERILOG ${vendor}_${library}_${component}_${version}_${configuration} || || $elab_db_file \n";
|
| 123 |
|
|
|
| 124 |
|
|
|
| 125 |
|
|
my $elab_db = new BerkeleyDB::Hash( -Filename => "$elab_db_file", -Flags => DB_CREATE ) or die "Cannot open $elab_db_file: $!";
|
| 126 |
|
|
$elab_db->db_put( "component___root" ,"${vendor}:${library}:${component}:${version}:${configuration}" );
|
| 127 |
|
|
|
| 128 |
|
|
my $repo_data;
|
| 129 |
|
|
|
| 130 |
|
|
$elab_db->db_get("VLNV___${vendor}:${library}:${component}:${version}:${configuration}", $repo_data );
|
| 131 |
|
|
$elab_db->db_put("VLNV___${vendor}:${library}:${component}:${version}:${configuration}","${repo_data}${root}:::" );
|
| 132 |
|
|
|
| 133 |
|
|
|
| 134 |
|
|
my $c_key;
|
| 135 |
|
|
my $c_value;
|
| 136 |
|
|
my $param_str;
|
| 137 |
|
|
my $config___;
|
| 138 |
|
|
|
| 139 |
|
|
my @params = ();
|
| 140 |
|
|
|
| 141 |
|
|
my $c_cursor = $design_db ->db_cursor() ;
|
| 142 |
|
|
while ($c_cursor->c_get($c_key, $c_value, DB_NEXT) == 0)
|
| 143 |
|
|
{
|
| 144 |
|
|
if($c_value eq $configuration)
|
| 145 |
|
|
{
|
| 146 |
|
|
|
| 147 |
|
|
( $config___ , $param_str) = split( /___/ , $c_key);
|
| 148 |
|
|
# print "XXXXX $param_str \n";
|
| 149 |
|
|
( @params) = split( /:::/ , $param_str);
|
| 150 |
|
|
}
|
| 151 |
|
|
|
| 152 |
|
|
|
| 153 |
|
|
|
| 154 |
|
|
|
| 155 |
|
|
}
|
| 156 |
|
|
|
| 157 |
|
|
my $status = $c_cursor->c_close() ;
|
| 158 |
|
|
|
| 159 |
|
|
|
| 160 |
|
|
foreach my $param (@params)
|
| 161 |
|
|
{
|
| 162 |
|
|
my $p_name;
|
| 163 |
|
|
my $p_value;
|
| 164 |
|
|
( $p_name , $p_value) = split( /--/ , $param);
|
| 165 |
|
|
#print "XXXXXX ${root} $p_name $p_value \n";
|
| 166 |
|
|
$elab_db->db_put( "parameter_${root}__${p_name}","${p_value}" );
|
| 167 |
|
|
}
|
| 168 |
|
|
|
| 169 |
|
|
|
| 170 |
|
|
|
| 171 |
|
|
elaborate( "${root}","${vendor}","${library}","${component}","${version}" );
|
| 172 |
|
|
|
| 173 |
|
|
|
| 174 |
|
|
|
| 175 |
|
|
|
| 176 |
|
|
|
| 177 |
|
|
# Now tag all component___root instances with config_n #
|
| 178 |
|
|
|
| 179 |
|
|
my $key;
|
| 180 |
|
|
my $value;
|
| 181 |
|
|
|
| 182 |
|
|
my @elab_puts;
|
| 183 |
|
|
|
| 184 |
|
|
|
| 185 |
|
|
my $v_cursor = $elab_db ->db_cursor() ;
|
| 186 |
|
|
while ($v_cursor->c_get($key, $value, DB_NEXT) == 0)
|
| 187 |
|
|
{
|
| 188 |
|
|
$_ = $key;
|
| 189 |
|
|
if(/component___root\.(\S+)/)
|
| 190 |
|
|
{
|
| 191 |
|
|
my $p_key;
|
| 192 |
|
|
my $p_value;
|
| 193 |
|
|
my $p_cursor = $elab_db ->db_cursor() ;
|
| 194 |
|
|
my $match = "parameter_root.$1__";
|
| 195 |
|
|
my $p_config = "CONFIG___";
|
| 196 |
|
|
my @param_store;
|
| 197 |
|
|
|
| 198 |
|
|
while ($p_cursor->c_get($p_key, $p_value, DB_NEXT) == 0)
|
| 199 |
|
|
{
|
| 200 |
|
|
$_ = $p_key;
|
| 201 |
|
|
if(/${match}(\S+)/)
|
| 202 |
|
|
{
|
| 203 |
|
|
push @param_store,"${1}--${p_value}";
|
| 204 |
|
|
}
|
| 205 |
|
|
}
|
| 206 |
|
|
my $status = $p_cursor->c_close() ;
|
| 207 |
|
|
@param_store = sys::lib::trim_sort(@param_store);
|
| 208 |
|
|
my $p_store;
|
| 209 |
|
|
foreach my $store (@param_store)
|
| 210 |
|
|
{
|
| 211 |
|
|
$p_store = "${store}:::${p_store}";
|
| 212 |
|
|
}
|
| 213 |
|
|
|
| 214 |
|
|
my $config_n;
|
| 215 |
|
|
$design_db->db_get("${p_config}${p_store}", $config_n );
|
| 216 |
|
|
# print "D $key $value ${config_n} \n";
|
| 217 |
|
|
push @elab_puts ,"$key|||$value:${config_n}";
|
| 218 |
|
|
}
|
| 219 |
|
|
}
|
| 220 |
|
|
|
| 221 |
|
|
my $status = $v_cursor->c_close() ;
|
| 222 |
|
|
|
| 223 |
|
|
foreach my $elab_put (@elab_puts)
|
| 224 |
|
|
{
|
| 225 |
|
|
( ${key},${value}) = split( /\|\|\|/ , $elab_put);
|
| 226 |
|
|
$elab_db->db_put( $key,$value);
|
| 227 |
|
|
}
|
| 228 |
|
|
|
| 229 |
|
|
|
| 230 |
|
|
$elab_db->db_close();
|
| 231 |
|
|
$design_db->db_close();
|
| 232 |
|
|
|
| 233 |
|
|
|
| 234 |
|
|
|
| 235 |
|
|
|
| 236 |
|
|
|
| 237 |
|
|
|
| 238 |
|
|
|
| 239 |
|
|
|
| 240 |
|
|
|
| 241 |
|
|
|
| 242 |
|
|
|
| 243 |
|
|
|
| 244 |
|
|
|
| 245 |
|
|
|
| 246 |
|
|
|
| 247 |
|
|
|
| 248 |
|
|
|
| 249 |
|
|
|
| 250 |
|
|
|
| 251 |
|
|
|
| 252 |
|
|
#/*********************************************************************************************/
|
| 253 |
|
|
#/ */
|
| 254 |
|
|
#/ Recursive entry point for all lower levels */
|
| 255 |
|
|
#/ */
|
| 256 |
|
|
#/ */
|
| 257 |
|
|
#/ */
|
| 258 |
|
|
#/ */
|
| 259 |
|
|
#/*********************************************************************************************/
|
| 260 |
|
|
|
| 261 |
|
|
sub elaborate
|
| 262 |
|
|
{
|
| 263 |
|
|
my @params = @_;
|
| 264 |
|
|
my $elab_version = pop(@params);
|
| 265 |
|
|
my $elab_component = pop(@params);
|
| 266 |
|
|
my $elab_library = pop(@params);
|
| 267 |
|
|
my $elab_vendor = pop(@params);
|
| 268 |
|
|
my $elab_root = pop(@params);
|
| 269 |
|
|
|
| 270 |
|
|
# print "ELABORATING $elab_root $elab_vendor $elab_library $elab_component $elab_version \n";
|
| 271 |
|
|
my $spirit_component_file = $parser->parse_file(yp::lib::find_ipxact_component($elab_vendor,$elab_library,$elab_component,$elab_version));
|
| 272 |
|
|
parse_component_file($spirit_component_file,$elab_root);
|
| 273 |
|
|
parse_design_files($spirit_component_file,$elab_root);
|
| 274 |
|
|
# print "Exit $elab_root \n";
|
| 275 |
|
|
return;
|
| 276 |
|
|
}
|
| 277 |
|
|
|
| 278 |
|
|
|
| 279 |
|
|
|
| 280 |
|
|
|
| 281 |
|
|
#/*********************************************************************************************/
|
| 282 |
|
|
#/ */
|
| 283 |
|
|
#/ */
|
| 284 |
|
|
#/ */
|
| 285 |
|
|
#/ */
|
| 286 |
|
|
#/ */
|
| 287 |
|
|
#/ */
|
| 288 |
|
|
#/*********************************************************************************************/
|
| 289 |
|
|
|
| 290 |
|
|
|
| 291 |
|
|
|
| 292 |
|
|
|
| 293 |
|
|
sub parse_component_file
|
| 294 |
|
|
{
|
| 295 |
|
|
my @params = @_;
|
| 296 |
|
|
my $elab_root = pop(@params);
|
| 297 |
|
|
my $spirit_component_file = pop(@params);
|
| 298 |
|
|
|
| 299 |
|
|
|
| 300 |
|
|
|
| 301 |
135 |
jt_eaton |
foreach my $new_comp ($spirit_component_file->findnodes("//ipxact:component/ipxact:vendor"))
|
| 302 |
134 |
jt_eaton |
{
|
| 303 |
|
|
my($new_vendor) = $new_comp->findnodes('./text()')->to_literal ;
|
| 304 |
135 |
jt_eaton |
my($new_library) = $new_comp->findnodes('../ipxact:library/text()')->to_literal ;
|
| 305 |
|
|
my($new_name) = $new_comp->findnodes('../ipxact:name/text()')->to_literal ;
|
| 306 |
|
|
my($new_version) = $new_comp->findnodes('../ipxact:version/text()')->to_literal ;
|
| 307 |
134 |
jt_eaton |
# print "PARSE component file $elab_root $new_vendor $new_library $new_name $new_version \n";
|
| 308 |
|
|
|
| 309 |
|
|
|
| 310 |
|
|
my $parent_socgen_filename = yp::lib::find_componentConfiguration($new_vendor,$new_library,$new_name);
|
| 311 |
|
|
|
| 312 |
|
|
if ($parent_socgen_filename)
|
| 313 |
|
|
|
| 314 |
|
|
{
|
| 315 |
|
|
|
| 316 |
|
|
my $parent_socgen_file = $parser->parse_file($parent_socgen_filename);
|
| 317 |
|
|
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"))
|
| 318 |
|
|
{
|
| 319 |
|
|
my($param_name) = $socgen_cfg->findnodes('./text()')->to_literal ;
|
| 320 |
|
|
my($param_default) = $socgen_cfg->findnodes('../socgen:value/text()')->to_literal ;
|
| 321 |
|
|
|
| 322 |
|
|
|
| 323 |
|
|
# print "KKKKKKKK parameter_${elab_root}__${param_name} $param_default \n";
|
| 324 |
|
|
|
| 325 |
|
|
my $repo_data;
|
| 326 |
|
|
$elab_db->db_get("parameter_${elab_root}__${param_name}", $repo_data );
|
| 327 |
|
|
|
| 328 |
|
|
|
| 329 |
|
|
unless (defined $repo_data)
|
| 330 |
|
|
{
|
| 331 |
|
|
$elab_db->db_put( "parameter_${elab_root}__${param_name}","${param_default}" );
|
| 332 |
|
|
|
| 333 |
|
|
|
| 334 |
|
|
}
|
| 335 |
|
|
|
| 336 |
|
|
|
| 337 |
|
|
|
| 338 |
|
|
}
|
| 339 |
|
|
|
| 340 |
|
|
};
|
| 341 |
|
|
|
| 342 |
|
|
#/**********************************************************************/
|
| 343 |
|
|
#/* */
|
| 344 |
|
|
#/* parse parameters and values */
|
| 345 |
|
|
#/* */
|
| 346 |
|
|
#/**********************************************************************/
|
| 347 |
|
|
|
| 348 |
135 |
jt_eaton |
foreach my $i_name ($spirit_component_file->findnodes('//ipxact:model/ipxact:modelParameters/ipxact:modelParameter/ipxact:name'))
|
| 349 |
134 |
jt_eaton |
{
|
| 350 |
|
|
my($parameter_name) = $i_name ->to_literal;
|
| 351 |
135 |
jt_eaton |
my($parameter_default) = $i_name ->findnodes('../ipxact:value/text()')->to_literal ;
|
| 352 |
134 |
jt_eaton |
my $repo_data;
|
| 353 |
|
|
$elab_db->db_get("parameter_${elab_root}__${parameter_name}", $repo_data );
|
| 354 |
|
|
|
| 355 |
|
|
|
| 356 |
|
|
unless (defined $repo_data)
|
| 357 |
|
|
{
|
| 358 |
|
|
$elab_db->db_put( "parameter_${elab_root}__${parameter_name}","${parameter_default}" );
|
| 359 |
|
|
}
|
| 360 |
|
|
}
|
| 361 |
|
|
}
|
| 362 |
|
|
|
| 363 |
135 |
jt_eaton |
foreach my $new_comp ($spirit_component_file->findnodes("//ipxact:component/ipxact:model/ipxact:views/ipxact:view/ipxact:vendorExtensions/ipxact:componentRef"))
|
| 364 |
134 |
jt_eaton |
{
|
| 365 |
135 |
jt_eaton |
my($new_vendor) = $new_comp->findnodes('./@ipxact:vendor')->to_literal ;
|
| 366 |
|
|
my($new_library) = $new_comp->findnodes('./@ipxact:library')->to_literal ;
|
| 367 |
|
|
my($new_name) = $new_comp->findnodes('./@ipxact:name')->to_literal ;
|
| 368 |
|
|
my($new_version) = $new_comp->findnodes('./@ipxact:version')->to_literal ;
|
| 369 |
134 |
jt_eaton |
if(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version))
|
| 370 |
|
|
{
|
| 371 |
|
|
parse_component_file($parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version)),$elab_root );
|
| 372 |
|
|
}
|
| 373 |
|
|
|
| 374 |
|
|
}
|
| 375 |
|
|
}
|
| 376 |
|
|
|
| 377 |
|
|
|
| 378 |
|
|
|
| 379 |
|
|
|
| 380 |
|
|
|
| 381 |
|
|
|
| 382 |
|
|
#/*********************************************************************************************/
|
| 383 |
|
|
#/ */
|
| 384 |
|
|
#/ */
|
| 385 |
|
|
#/ */
|
| 386 |
|
|
#/ */
|
| 387 |
|
|
#/ */
|
| 388 |
|
|
#/ */
|
| 389 |
|
|
#/*********************************************************************************************/
|
| 390 |
|
|
|
| 391 |
|
|
|
| 392 |
|
|
|
| 393 |
|
|
|
| 394 |
|
|
sub parse_design_files
|
| 395 |
|
|
{
|
| 396 |
|
|
my @params = @_;
|
| 397 |
|
|
my $elab_root = pop(@params);
|
| 398 |
|
|
my $spirit_component_file = pop(@params);
|
| 399 |
|
|
|
| 400 |
|
|
|
| 401 |
|
|
|
| 402 |
|
|
|
| 403 |
135 |
jt_eaton |
foreach my $new_comp ($spirit_component_file->findnodes("//ipxact:component/ipxact:model/ipxact:views/ipxact:view/ipxact:vendorExtensions/ipxact:componentRef"))
|
| 404 |
134 |
jt_eaton |
{
|
| 405 |
135 |
jt_eaton |
my($new_vendor) = $new_comp->findnodes('./@ipxact:vendor')->to_literal ;
|
| 406 |
|
|
my($new_library) = $new_comp->findnodes('./@ipxact:library')->to_literal ;
|
| 407 |
|
|
my($new_name) = $new_comp->findnodes('./@ipxact:name')->to_literal ;
|
| 408 |
|
|
my($new_version) = $new_comp->findnodes('./@ipxact:version')->to_literal ;
|
| 409 |
134 |
jt_eaton |
# print "PARSE design files $elab_root $new_vendor $new_library $new_name $new_version \n";
|
| 410 |
|
|
parse_design_files($parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version )),$elab_root );
|
| 411 |
|
|
}
|
| 412 |
|
|
|
| 413 |
|
|
|
| 414 |
|
|
|
| 415 |
|
|
|
| 416 |
135 |
jt_eaton |
foreach my $new_comp ($spirit_component_file->findnodes("//ipxact:component/ipxact:model/ipxact:views/ipxact:view/ipxact:hierarchyRef"))
|
| 417 |
134 |
jt_eaton |
{
|
| 418 |
135 |
jt_eaton |
my($new_vendor) = $new_comp->findnodes('./@ipxact:vendor')->to_literal ;
|
| 419 |
|
|
my($new_library) = $new_comp->findnodes('./@ipxact:library')->to_literal ;
|
| 420 |
|
|
my($new_name) = $new_comp->findnodes('./@ipxact:name')->to_literal ;
|
| 421 |
|
|
my($new_version) = $new_comp->findnodes('./@ipxact:version')->to_literal ;
|
| 422 |
134 |
jt_eaton |
if(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version ))
|
| 423 |
|
|
{
|
| 424 |
135 |
jt_eaton |
# print "FFFFFF $new_vendor $new_library $new_name $new_version hierarchyRef \n";
|
| 425 |
134 |
jt_eaton |
parse_design_file($parser->parse_file(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version )),$elab_root );
|
| 426 |
|
|
}
|
| 427 |
|
|
}
|
| 428 |
|
|
|
| 429 |
135 |
jt_eaton |
|
| 430 |
|
|
foreach my $new_comp ($spirit_component_file->findnodes("//ipxact:component/ipxact:model/ipxact:views/ipxact:view/ipxact:designInstantiationRef/text()"))
|
| 431 |
|
|
{
|
| 432 |
|
|
my($designInsref_value) = $new_comp ->to_literal ;
|
| 433 |
|
|
my($designInsref_name) = $new_comp ->findnodes('../../ipxact:name')->to_literal ;
|
| 434 |
|
|
foreach my $new_comp ($spirit_component_file->findnodes("//ipxact:component/ipxact:model/ipxact:instantiations/ipxact:designInstantiation"))
|
| 435 |
|
|
{
|
| 436 |
|
|
my($t_ref) = $new_comp->findnodes('./ipxact:name/text()')->to_literal ;
|
| 437 |
|
|
my($t_vendor) = $new_comp->findnodes('./ipxact:designRef/@vendor')->to_literal ;
|
| 438 |
|
|
my($t_library) = $new_comp->findnodes('./ipxact:designRef/@library')->to_literal ;
|
| 439 |
|
|
my($t_name) = $new_comp->findnodes('./ipxact:designRef/@name')->to_literal ;
|
| 440 |
|
|
my($t_version) = $new_comp->findnodes('./ipxact:designRef/@version')->to_literal ;
|
| 441 |
|
|
|
| 442 |
|
|
|
| 443 |
|
|
if($t_ref eq $designInsref_name )
|
| 444 |
|
|
{
|
| 445 |
|
|
|
| 446 |
|
|
if(yp::lib::find_ipxact_design($t_vendor,$t_library,$t_name,$t_version ))
|
| 447 |
|
|
{
|
| 448 |
|
|
# print "FFFFFF $t_vendor $t_library $t_name $t_version designInstantiationRef \n";
|
| 449 |
|
|
parse_design_file($parser->parse_file(yp::lib::find_ipxact_design($t_vendor,$t_library,$t_name,$t_version )),$elab_root );
|
| 450 |
|
|
}
|
| 451 |
|
|
|
| 452 |
|
|
|
| 453 |
|
|
|
| 454 |
|
|
}
|
| 455 |
|
|
}
|
| 456 |
|
|
}
|
| 457 |
|
|
|
| 458 |
|
|
|
| 459 |
|
|
|
| 460 |
|
|
|
| 461 |
134 |
jt_eaton |
}
|
| 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 |
|
|
|
| 491 |
|
|
|
| 492 |
|
|
|
| 493 |
|
|
|
| 494 |
|
|
|
| 495 |
|
|
|
| 496 |
|
|
|
| 497 |
|
|
#/*********************************************************************************************/
|
| 498 |
|
|
#/ */
|
| 499 |
|
|
#/ */
|
| 500 |
|
|
#/ */
|
| 501 |
|
|
#/ */
|
| 502 |
|
|
#/ */
|
| 503 |
|
|
#/ */
|
| 504 |
|
|
#/*********************************************************************************************/
|
| 505 |
|
|
|
| 506 |
|
|
|
| 507 |
|
|
|
| 508 |
|
|
|
| 509 |
|
|
sub parse_design_file
|
| 510 |
|
|
{
|
| 511 |
|
|
my @params = @_;
|
| 512 |
|
|
my $elab_root = pop(@params);
|
| 513 |
|
|
my $spirit_design_file = pop(@params);
|
| 514 |
|
|
|
| 515 |
135 |
jt_eaton |
foreach my $new_comp ($spirit_design_file->findnodes("//ipxact:design/ipxact:vendor"))
|
| 516 |
134 |
jt_eaton |
{
|
| 517 |
|
|
my($new_vendor) = $new_comp->findnodes('./text()')->to_literal ;
|
| 518 |
135 |
jt_eaton |
my($new_library) = $new_comp->findnodes('../ipxact:library/text()')->to_literal ;
|
| 519 |
|
|
my($new_name) = $new_comp->findnodes('../ipxact:name/text()')->to_literal ;
|
| 520 |
|
|
my($new_version) = $new_comp->findnodes('../ipxact:version/text()')->to_literal ;
|
| 521 |
134 |
jt_eaton |
# print "WARNING $new_vendor $new_library $new_name $new_version DESIGN \n";
|
| 522 |
|
|
|
| 523 |
135 |
jt_eaton |
foreach my $x_name ($spirit_design_file->findnodes("//ipxact:design/ipxact:componentInstances/ipxact:componentInstance/ipxact:instanceName"))
|
| 524 |
134 |
jt_eaton |
{
|
| 525 |
|
|
#/**********************************************************************/
|
| 526 |
|
|
#/* */
|
| 527 |
|
|
#/* Lookup VLNV for each instantiated component */
|
| 528 |
|
|
#/* */
|
| 529 |
|
|
#/**********************************************************************/
|
| 530 |
|
|
my($instance_name) = $x_name ->findnodes('./text()')->to_literal ;
|
| 531 |
135 |
jt_eaton |
my($vendor_name) = $x_name ->findnodes('../ipxact:componentRef/@vendor')->to_literal ;
|
| 532 |
|
|
my($library_name) = $x_name ->findnodes('../ipxact:componentRef/@library')->to_literal ;
|
| 533 |
|
|
my($component_name) = $x_name ->findnodes('../ipxact:componentRef/@name')->to_literal ;
|
| 534 |
|
|
my($version_name) = $x_name ->findnodes('../ipxact:componentRef/@version')->to_literal ;
|
| 535 |
134 |
jt_eaton |
# print "INSTANCED $instance_name $vendor_name $library_name $component_name $version_name \n";
|
| 536 |
|
|
$elab_db->db_put( "component___${elab_root}.${instance_name}","${vendor_name}:${library_name}:${component_name}:${version_name}" );
|
| 537 |
|
|
|
| 538 |
|
|
my $repo_data;
|
| 539 |
|
|
if(defined $name && length $name >0)
|
| 540 |
|
|
{
|
| 541 |
|
|
$elab_db->db_get("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}:${name}", $repo_data );
|
| 542 |
|
|
$elab_db->db_put("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}:${name}","${repo_data}${elab_root}.${instance_name}:::");
|
| 543 |
|
|
}
|
| 544 |
|
|
else
|
| 545 |
|
|
{
|
| 546 |
|
|
$elab_db->db_get("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}", $repo_data );
|
| 547 |
|
|
$elab_db->db_put("VLNV___${vendor_name}:${library_name}:${component_name}:${version_name}","${repo_data}${elab_root}.${instance_name}:::");
|
| 548 |
|
|
}
|
| 549 |
|
|
my $cmd ="./tools/verilog/elab_verilog -vendor ${vendor_name} -library ${library_name} -component ${component_name} -version ${version_name}\n";
|
| 550 |
|
|
|
| 551 |
|
|
#### if(system($cmd)){}
|
| 552 |
|
|
|
| 553 |
|
|
|
| 554 |
|
|
|
| 555 |
|
|
if ($instance_name)
|
| 556 |
|
|
{
|
| 557 |
135 |
jt_eaton |
foreach my $i_parameter ($spirit_design_file->findnodes("//ipxact:componentInstance[ipxact:instanceName/text() = '$instance_name']/ipxact:configurableElementValues/ipxact:configurableElementValue/\@ipxact:referenceId"))
|
| 558 |
134 |
jt_eaton |
{
|
| 559 |
|
|
my($foo_name) = $i_parameter ->to_literal ;
|
| 560 |
|
|
my($foo_value) = $i_parameter ->findnodes('../text()')->to_literal ;
|
| 561 |
|
|
|
| 562 |
|
|
my $fee_value = $foo_value;
|
| 563 |
|
|
my $p_key;
|
| 564 |
|
|
my $p_value;
|
| 565 |
|
|
my $p_cursor = $elab_db ->db_cursor() ;
|
| 566 |
|
|
while ($p_cursor->c_get($p_key, $p_value, DB_NEXT) == 0)
|
| 567 |
|
|
{
|
| 568 |
|
|
$_ = $p_key;
|
| 569 |
|
|
# print "---> $p_key $p_value \n";
|
| 570 |
|
|
if(/parameter_${elab_root}__(\S+)/)
|
| 571 |
|
|
{
|
| 572 |
|
|
$fee_value = math::lib::parse($fee_value,$1,$p_value);
|
| 573 |
|
|
}
|
| 574 |
|
|
}
|
| 575 |
|
|
my $status = $p_cursor->c_close() ;
|
| 576 |
|
|
|
| 577 |
|
|
|
| 578 |
|
|
|
| 579 |
|
|
|
| 580 |
|
|
|
| 581 |
|
|
# replace this!!!
|
| 582 |
|
|
# scan for all names in db_get("parameter_${elab_root}__${name}", $repo_data
|
| 583 |
|
|
# and substitute $repo_data anywhere in $foo_value
|
| 584 |
|
|
# then run $foo_value thru sys/math
|
| 585 |
|
|
|
| 586 |
|
|
|
| 587 |
|
|
$_ = $foo_value;
|
| 588 |
|
|
my $t_name;
|
| 589 |
|
|
my $t_op;
|
| 590 |
|
|
my $repo_data;
|
| 591 |
|
|
|
| 592 |
|
|
if(/(\S+)[+](\S+)/)
|
| 593 |
|
|
{
|
| 594 |
|
|
$t_name = $1;
|
| 595 |
|
|
$t_op = $2;
|
| 596 |
|
|
$elab_db->db_get("parameter_${elab_root}__${t_name}", $repo_data );
|
| 597 |
|
|
unless (defined $repo_data)
|
| 598 |
|
|
{
|
| 599 |
|
|
$repo_data = $foo_value ;
|
| 600 |
|
|
}
|
| 601 |
|
|
else
|
| 602 |
|
|
{
|
| 603 |
|
|
$repo_data = $repo_data + $t_op ;
|
| 604 |
|
|
}
|
| 605 |
|
|
}
|
| 606 |
|
|
else
|
| 607 |
|
|
|
| 608 |
|
|
# end replace
|
| 609 |
|
|
|
| 610 |
|
|
{
|
| 611 |
|
|
$elab_db->db_get("parameter_${elab_root}__${foo_value}", $repo_data );
|
| 612 |
|
|
unless (defined $repo_data)
|
| 613 |
|
|
{
|
| 614 |
|
|
$repo_data = $foo_value ;
|
| 615 |
|
|
}
|
| 616 |
|
|
}
|
| 617 |
|
|
|
| 618 |
|
|
$elab_db->db_put( "parameter_${elab_root}.${instance_name}__${foo_name}","${repo_data}" );
|
| 619 |
|
|
$elab_db->db_put( "Parameter_${elab_root}.${instance_name}__${foo_name}","${foo_value}" );
|
| 620 |
|
|
$elab_db->db_put( "Xarameter_${elab_root}.${instance_name}__${foo_name}","${fee_value}" );
|
| 621 |
|
|
# print "PARAMETERE ${elab_root}.${instance_name} $foo_name p_ $repo_data P_ $foo_value X_ $fee_value \n";
|
| 622 |
|
|
}
|
| 623 |
|
|
|
| 624 |
|
|
elaborate( "${elab_root}.${instance_name}","${vendor_name}","${library_name}","${component_name}","${version_name}" );
|
| 625 |
|
|
}
|
| 626 |
|
|
}
|
| 627 |
|
|
}
|
| 628 |
|
|
}
|
| 629 |
|
|
|
| 630 |
|
|
|
| 631 |
|
|
|
| 632 |
|
|
|
| 633 |
|
|
1
|