| 1 |
130 |
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 |
130 |
jt_eaton |
|
| 32 |
|
|
|
| 33 |
|
|
use Getopt::Long;
|
| 34 |
|
|
use English;
|
| 35 |
|
|
use File::Basename;
|
| 36 |
|
|
use Cwd;
|
| 37 |
|
|
use XML::LibXML;
|
| 38 |
|
|
use lib './tools';
|
| 39 |
|
|
use sys::lib;
|
| 40 |
|
|
use yp::lib;
|
| 41 |
|
|
|
| 42 |
|
|
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
|
| 43 |
|
|
|
| 44 |
|
|
my $parser = XML::LibXML->new();
|
| 45 |
|
|
|
| 46 |
|
|
|
| 47 |
|
|
#/*********************************************************************************************/
|
| 48 |
|
|
#/ */
|
| 49 |
|
|
#/ */
|
| 50 |
|
|
#/ */
|
| 51 |
|
|
#/ */
|
| 52 |
|
|
#/*********************************************************************************************/
|
| 53 |
|
|
|
| 54 |
|
|
my $home = cwd();
|
| 55 |
|
|
|
| 56 |
131 |
jt_eaton |
|
| 57 |
130 |
jt_eaton |
my $vendor_check = $ARGV[0];
|
| 58 |
|
|
|
| 59 |
|
|
|
| 60 |
|
|
chomp($vendor_check);
|
| 61 |
|
|
|
| 62 |
|
|
|
| 63 |
|
|
|
| 64 |
|
|
|
| 65 |
|
|
my @vendors = yp::lib::find_vendors();
|
| 66 |
|
|
|
| 67 |
|
|
|
| 68 |
|
|
print "Checking busDefinitions \n";
|
| 69 |
|
|
|
| 70 |
|
|
|
| 71 |
|
|
foreach my $vendor (@vendors)
|
| 72 |
|
|
{
|
| 73 |
|
|
if ( ($vendor_check eq "") or ($vendor eq $vendor_check) )
|
| 74 |
|
|
{
|
| 75 |
|
|
|
| 76 |
|
|
|
| 77 |
|
|
my @libraries = yp::lib::find_libraries($vendor);
|
| 78 |
|
|
foreach my $library (@libraries)
|
| 79 |
|
|
{
|
| 80 |
131 |
jt_eaton |
my $repo = yp::lib::find_library_repo($vendor,$library);
|
| 81 |
130 |
jt_eaton |
|
| 82 |
131 |
jt_eaton |
|
| 83 |
|
|
|
| 84 |
130 |
jt_eaton |
my @components = yp::lib::find_components($vendor,$library);
|
| 85 |
|
|
foreach my $component (@components)
|
| 86 |
|
|
{
|
| 87 |
|
|
print "V $vendor $library $component \n";
|
| 88 |
|
|
|
| 89 |
|
|
|
| 90 |
|
|
my $socgen_file = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
|
| 91 |
|
|
my $doc_library_path = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:doc/socgen:library_path/text()")->to_literal;
|
| 92 |
|
|
my $lib_comp_sep = yp::lib::find_lib_comp_sep($vendor,$library,$component);
|
| 93 |
|
|
|
| 94 |
131 |
jt_eaton |
my $path = "${home}${repo}/${vendor}/${library}${doc_library_path}";
|
| 95 |
130 |
jt_eaton |
mkdir $path,0755 unless( -e $path );
|
| 96 |
|
|
|
| 97 |
|
|
|
| 98 |
|
|
$doc_library_path = "${doc_library_path}/Heda";
|
| 99 |
|
|
|
| 100 |
131 |
jt_eaton |
my $path = "${home}${repo}/${vendor}/${library}${doc_library_path}";
|
| 101 |
130 |
jt_eaton |
mkdir $path,0755 unless( -e $path );
|
| 102 |
|
|
|
| 103 |
|
|
|
| 104 |
131 |
jt_eaton |
my $path = "${home}${repo}/${vendor}/${library}${doc_library_path}/busDef";
|
| 105 |
130 |
jt_eaton |
mkdir $path,0755 unless( -e $path );
|
| 106 |
|
|
|
| 107 |
|
|
|
| 108 |
|
|
|
| 109 |
|
|
|
| 110 |
|
|
|
| 111 |
|
|
|
| 112 |
|
|
|
| 113 |
|
|
my @versions = yp::lib::find_busDefinition_versions($vendor,$library,$component);
|
| 114 |
|
|
|
| 115 |
|
|
|
| 116 |
|
|
|
| 117 |
|
|
|
| 118 |
|
|
foreach my $version (@versions)
|
| 119 |
|
|
{
|
| 120 |
131 |
jt_eaton |
my $path = "${home}${repo}/${vendor}/${library}${doc_library_path}/busDef/${component}_${version}";
|
| 121 |
130 |
jt_eaton |
open(FILE,">${path}.txt") or die "No busDef directory";
|
| 122 |
|
|
|
| 123 |
|
|
|
| 124 |
|
|
print FILE "${vendor}:${library}:${component}:${version}\n";
|
| 125 |
|
|
print FILE "\t--------------------------------------------------------------------------------------------------------\n";
|
| 126 |
|
|
|
| 127 |
|
|
my $spirit_file = yp::lib::find_ipxact_busDefinition($vendor,$library,$component,$version);
|
| 128 |
|
|
|
| 129 |
|
|
print FILE "\tFilename: ${spirit_file}\n";
|
| 130 |
|
|
unless ($spirit_file) {print "Error busDefinition file does not exist";}
|
| 131 |
|
|
|
| 132 |
|
|
my $spirit_busDef_file = $parser->parse_file($spirit_file);
|
| 133 |
135 |
jt_eaton |
foreach my $busDef ($spirit_busDef_file->findnodes("//ipxact:busDefinition/ipxact:vendor"))
|
| 134 |
130 |
jt_eaton |
{
|
| 135 |
|
|
my($bt_vendor) = $busDef->findnodes('./text()')->to_literal ;
|
| 136 |
135 |
jt_eaton |
my($bt_library) = $busDef->findnodes('../ipxact:library/text()')->to_literal ;
|
| 137 |
|
|
my($bt_name) = $busDef->findnodes('../ipxact:name/text()')->to_literal ;
|
| 138 |
|
|
my($bt_version) = $busDef->findnodes('../ipxact:version/text()')->to_literal ;
|
| 139 |
130 |
jt_eaton |
print FILE "\tVLNV-bt ${bt_vendor}_${bt_library}_${bt_name}_${bt_version}\n";
|
| 140 |
|
|
}
|
| 141 |
|
|
|
| 142 |
|
|
my %systemGroupNames = ();
|
| 143 |
|
|
|
| 144 |
135 |
jt_eaton |
foreach my $i_name ($spirit_busDef_file->findnodes("//ipxact:busDefinition/ipxact:systemGroupNames/ipxact:systemGroupName"))
|
| 145 |
130 |
jt_eaton |
{
|
| 146 |
|
|
my($sysgroup_name) = $i_name ->findnodes('./text()')->to_literal;
|
| 147 |
|
|
print FILE "\t SystemGroup Name $sysgroup_name \n";
|
| 148 |
|
|
$systemGroupNames{$sysgroup_name} = 1;
|
| 149 |
|
|
}
|
| 150 |
|
|
print FILE "\n";
|
| 151 |
|
|
}
|
| 152 |
|
|
|
| 153 |
|
|
|
| 154 |
|
|
}
|
| 155 |
|
|
}
|
| 156 |
|
|
|
| 157 |
|
|
if ($vendor eq $vendor_check) {last;};
|
| 158 |
|
|
}
|
| 159 |
|
|
print "\n";
|
| 160 |
|
|
}
|
| 161 |
|
|
|
| 162 |
|
|
|
| 163 |
|
|
|
| 164 |
|
|
|
| 165 |
|
|
|
| 166 |
|
|
|
| 167 |
|
|
my @vendors = yp::lib::find_vendors();
|
| 168 |
|
|
|
| 169 |
|
|
print "Checking rtl abstractors \n";
|
| 170 |
|
|
|
| 171 |
|
|
|
| 172 |
|
|
|
| 173 |
|
|
|
| 174 |
|
|
|
| 175 |
|
|
|
| 176 |
|
|
|
| 177 |
|
|
|
| 178 |
|
|
foreach my $vendor (@vendors)
|
| 179 |
|
|
{
|
| 180 |
|
|
if ( ($vendor_check eq "") or ($vendor eq $vendor_check) )
|
| 181 |
|
|
{
|
| 182 |
|
|
my @libraries = yp::lib::find_libraries($vendor);
|
| 183 |
|
|
foreach my $library (@libraries)
|
| 184 |
|
|
{
|
| 185 |
|
|
|
| 186 |
|
|
my @components = yp::lib::find_components($vendor,$library);
|
| 187 |
|
|
foreach my $component (@components)
|
| 188 |
|
|
{
|
| 189 |
|
|
my $socgen_file = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
|
| 190 |
|
|
my $doc_library_path = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:doc/socgen:library_path/text()")->to_literal;
|
| 191 |
|
|
my $lib_comp_sep = yp::lib::find_lib_comp_sep($vendor,$library,$component);
|
| 192 |
|
|
|
| 193 |
131 |
jt_eaton |
my $path = "${home}${repo}/${vendor}/${library}${doc_library_path}";
|
| 194 |
130 |
jt_eaton |
mkdir $path,0755 unless( -e $path );
|
| 195 |
|
|
|
| 196 |
|
|
|
| 197 |
|
|
$doc_library_path = "${doc_library_path}/Heda";
|
| 198 |
|
|
|
| 199 |
131 |
jt_eaton |
my $path = "${home}${repo}/${vendor}/${library}${doc_library_path}";
|
| 200 |
130 |
jt_eaton |
mkdir $path,0755 unless( -e $path );
|
| 201 |
|
|
|
| 202 |
|
|
|
| 203 |
131 |
jt_eaton |
my $path = "${home}${repo}/${vendor}/${library}${doc_library_path}/absDef";
|
| 204 |
130 |
jt_eaton |
mkdir $path,0755 unless( -e $path );
|
| 205 |
|
|
|
| 206 |
|
|
|
| 207 |
|
|
my @versions = yp::lib::find_abstractionDefinition_versions($vendor,$library,$component);
|
| 208 |
|
|
|
| 209 |
|
|
foreach my $version (@versions)
|
| 210 |
|
|
{
|
| 211 |
|
|
|
| 212 |
131 |
jt_eaton |
my $path = "${home}${repo}/${vendor}/${library}${doc_library_path}/absDef/${component}_${version}";
|
| 213 |
130 |
jt_eaton |
open(FILE,">${path}.txt") or die "No sch directory";
|
| 214 |
|
|
|
| 215 |
|
|
|
| 216 |
|
|
print FILE "${vendor}:${library}:${component}:${version}\n";
|
| 217 |
|
|
print FILE "\t--------------------------------------------------------------------------------------------------------\n";
|
| 218 |
|
|
|
| 219 |
|
|
my $spirit_file = yp::lib::find_ipxact_abstractionDefinition($vendor,$library,$component,$version);
|
| 220 |
|
|
|
| 221 |
|
|
print FILE "\tFilename: ${spirit_file}\n";
|
| 222 |
|
|
unless ($spirit_file) {print "Error absDef file does not exist";}
|
| 223 |
|
|
|
| 224 |
|
|
my $spirit_absDef_file = $parser->parse_file($spirit_file);
|
| 225 |
135 |
jt_eaton |
foreach my $absDef ($spirit_absDef_file->findnodes("//ipxact:abstractionDefinition/ipxact:vendor"))
|
| 226 |
130 |
jt_eaton |
{
|
| 227 |
|
|
my($bd_vendor) = $absDef->findnodes('./text()')->to_literal ;
|
| 228 |
135 |
jt_eaton |
my($bd_library) = $absDef->findnodes('../ipxact:library/text()')->to_literal ;
|
| 229 |
|
|
my($bd_name) = $absDef->findnodes('../ipxact:name/text()')->to_literal ;
|
| 230 |
|
|
my($bd_version) = $absDef->findnodes('../ipxact:version/text()')->to_literal ;
|
| 231 |
130 |
jt_eaton |
print FILE "\tVLNV-ad ${bd_vendor}_${bd_library}_${bd_name}_${bd_version}\n";
|
| 232 |
|
|
|
| 233 |
|
|
my %systemGroupNames = ();
|
| 234 |
|
|
|
| 235 |
|
|
|
| 236 |
135 |
jt_eaton |
foreach my $bus_type ($spirit_absDef_file->findnodes("//ipxact:abstractionDefinition/ipxact:busType"))
|
| 237 |
130 |
jt_eaton |
{
|
| 238 |
135 |
jt_eaton |
my($bt_vendor) = $bus_type->findnodes('./@ipxact:vendor')->to_literal ;
|
| 239 |
|
|
my($bt_library) = $bus_type->findnodes('./@ipxact:library')->to_literal ;
|
| 240 |
|
|
my($bt_name) = $bus_type->findnodes('./@ipxact:name')->to_literal ;
|
| 241 |
|
|
my($bt_version) = $bus_type->findnodes('./@ipxact:version')->to_literal ;
|
| 242 |
130 |
jt_eaton |
print FILE "\tVLNV-bt ${bt_vendor}_${bt_library}_${bt_name}_${bt_version}\n";
|
| 243 |
|
|
|
| 244 |
|
|
my $spirit_file = yp::lib::find_ipxact_busDefinition($bt_vendor,$bt_library,$bt_name,$bt_version);
|
| 245 |
|
|
|
| 246 |
|
|
unless ($spirit_file) {print "ERROR: No bus definition\n";}
|
| 247 |
|
|
else
|
| 248 |
|
|
{
|
| 249 |
|
|
my $spirit_busDef_file = $parser->parse_file($spirit_file);
|
| 250 |
135 |
jt_eaton |
foreach my $i_name ($spirit_busDef_file->findnodes("//ipxact:busDefinition/ipxact:systemGroupNames/ipxact:systemGroupName"))
|
| 251 |
130 |
jt_eaton |
{
|
| 252 |
|
|
my($sysgroup_name) = $i_name ->findnodes('./text()')->to_literal;
|
| 253 |
|
|
print FILE "\t SystemGroup Name $sysgroup_name \n";
|
| 254 |
|
|
$systemGroupNames{$sysgroup_name} = 1;
|
| 255 |
|
|
}
|
| 256 |
|
|
}
|
| 257 |
|
|
}
|
| 258 |
|
|
|
| 259 |
135 |
jt_eaton |
foreach my $absDef ($spirit_absDef_file->findnodes("//ipxact:abstractionDefinition/ipxact:ports/ipxact:port/ipxact:logicalName"))
|
| 260 |
130 |
jt_eaton |
{
|
| 261 |
|
|
my($logical_name) = $absDef->findnodes('./text()')->to_literal ;
|
| 262 |
135 |
jt_eaton |
my($is_clock) = $absDef->findnodes('../ipxact:wire/ipxact:qualifier/ipxact:isClock/text()')->to_literal ;
|
| 263 |
|
|
my($is_reset) = $absDef->findnodes('../ipxact:wire/ipxact:qualifier/ipxact:isReset/text()')->to_literal ;
|
| 264 |
|
|
my($requires_driver) = $absDef->findnodes('../ipxact:wire/ipxact:requiresDriver/text()')->to_literal ;
|
| 265 |
|
|
my($driver_type) = $absDef->findnodes('../ipxact:wire/ipxact:requiresDriver/@ipxact:driverType')->to_literal ;
|
| 266 |
|
|
my($default_value) = $absDef->findnodes('../ipxact:wire/ipxact:defaultValue/text()')->to_literal ;
|
| 267 |
130 |
jt_eaton |
|
| 268 |
|
|
print FILE "\nPort: ${logical_name} ";
|
| 269 |
|
|
|
| 270 |
|
|
if($is_clock)
|
| 271 |
|
|
{
|
| 272 |
|
|
if($is_reset) { print FILE " BOTH CLOCK and RESET ";}
|
| 273 |
|
|
else { print FILE " CLOCK ";}
|
| 274 |
|
|
}
|
| 275 |
|
|
elsif($is_reset) { print FILE " RESET ";}
|
| 276 |
|
|
else { print FILE " ";}
|
| 277 |
|
|
|
| 278 |
|
|
if($requires_driver) {print FILE " Requires Driver $driver_type ";}
|
| 279 |
|
|
else {print FILE " ";}
|
| 280 |
|
|
|
| 281 |
|
|
if($default_value) {print FILE " Default Value $default_value \n";}
|
| 282 |
|
|
else {print FILE " \n";}
|
| 283 |
|
|
|
| 284 |
|
|
my $master_presence;
|
| 285 |
|
|
my $master_width;
|
| 286 |
|
|
my $master_direction;
|
| 287 |
|
|
|
| 288 |
135 |
jt_eaton |
foreach my $onMaster ($spirit_absDef_file->findnodes("//ipxact:abstractionDefinition/ipxact:ports/ipxact:port/ipxact:logicalName[text() = '$logical_name']/../ipxact:wire/ipxact:onMaster/ipxact:presence"))
|
| 289 |
130 |
jt_eaton |
{
|
| 290 |
|
|
$master_presence = $onMaster->findnodes('./text()')->to_literal ;
|
| 291 |
135 |
jt_eaton |
$master_width = $onMaster->findnodes('../ipxact:width/text()')->to_literal ;
|
| 292 |
|
|
$master_direction = $onMaster->findnodes('../ipxact:direction/text()')->to_literal ;
|
| 293 |
130 |
jt_eaton |
print FILE " onMaster presence $master_presence \n";
|
| 294 |
|
|
unless($master_width) {$master_width = 1;}
|
| 295 |
|
|
print FILE " onMaster width $master_width \n";
|
| 296 |
|
|
if($master_direction) {print FILE " onMaster direction $master_direction \n";}
|
| 297 |
|
|
print FILE "\n";
|
| 298 |
|
|
}
|
| 299 |
|
|
|
| 300 |
|
|
my $slave_presence;
|
| 301 |
|
|
my $slave_width;
|
| 302 |
|
|
my $slave_direction;
|
| 303 |
|
|
|
| 304 |
135 |
jt_eaton |
foreach my $onSlave ($spirit_absDef_file->findnodes("//ipxact:abstractionDefinition/ipxact:ports/ipxact:port/ipxact:logicalName[text() = '$logical_name']/../ipxact:wire/ipxact:onSlave/ipxact:presence"))
|
| 305 |
130 |
jt_eaton |
{
|
| 306 |
|
|
$slave_presence = $onSlave->findnodes('./text()')->to_literal ;
|
| 307 |
135 |
jt_eaton |
$slave_width = $onSlave->findnodes('../ipxact:width/text()')->to_literal ;
|
| 308 |
|
|
$slave_direction = $onSlave->findnodes('../ipxact:direction/text()')->to_literal ;
|
| 309 |
130 |
jt_eaton |
print FILE " onSlave presence $slave_presence \n";
|
| 310 |
|
|
unless($slave_width) {$slave_width = 1;}
|
| 311 |
|
|
print FILE " onSlave width $slave_width \n";
|
| 312 |
|
|
if($slave_direction) {print FILE " onSlave direction $slave_direction \n";}
|
| 313 |
|
|
print FILE "\n";
|
| 314 |
|
|
}
|
| 315 |
|
|
|
| 316 |
|
|
|
| 317 |
|
|
my %systemGroupPresence= ();
|
| 318 |
|
|
my %systemGroupWidth= ();
|
| 319 |
|
|
my %systemGroupDirection= ();
|
| 320 |
|
|
|
| 321 |
|
|
|
| 322 |
|
|
|
| 323 |
135 |
jt_eaton |
foreach my $onSystem ($spirit_absDef_file->findnodes("//ipxact:abstractionDefinition/ipxact:ports/ipxact:port/ipxact:logicalName[text() = '$logical_name']/../ipxact:wire/ipxact:onSystem/ipxact:group"))
|
| 324 |
130 |
jt_eaton |
{
|
| 325 |
|
|
my($system_group) = $onSystem->findnodes('./text()')->to_literal ;
|
| 326 |
135 |
jt_eaton |
my($presence) = $onSystem->findnodes('../ipxact:presence/text()')->to_literal ;
|
| 327 |
|
|
my($width) = $onSystem->findnodes('../ipxact:width/text()')->to_literal ;
|
| 328 |
|
|
my($direction) = $onSystem->findnodes('../ipxact:direction/text()')->to_literal ;
|
| 329 |
130 |
jt_eaton |
print FILE " onSystem Group $system_group \n";
|
| 330 |
|
|
print FILE " onSystem presence $presence \n";
|
| 331 |
|
|
unless($width) {$width = 1;}
|
| 332 |
|
|
if($width){print FILE " onSystem width $width \n";}
|
| 333 |
|
|
if($direction){print FILE " onSystem direction $direction \n";}
|
| 334 |
|
|
print FILE "\n";
|
| 335 |
|
|
$systemGroupPresence{$system_group} =$presence ;
|
| 336 |
|
|
$systemGroupWidth{$system_group} =$width ;
|
| 337 |
|
|
$systemGroupDirection{$system_group} =$direction ;
|
| 338 |
|
|
unless( $systemGroupNames{$system_group}) {print FILE "Group $system_group not defined in busDefinition \n"; }
|
| 339 |
|
|
}
|
| 340 |
|
|
# insert DRC checks here
|
| 341 |
|
|
|
| 342 |
|
|
|
| 343 |
|
|
}
|
| 344 |
|
|
}
|
| 345 |
|
|
|
| 346 |
|
|
|
| 347 |
|
|
print FILE "\n";
|
| 348 |
|
|
close(FILE);
|
| 349 |
|
|
}
|
| 350 |
|
|
|
| 351 |
|
|
}
|
| 352 |
|
|
|
| 353 |
|
|
|
| 354 |
|
|
}
|
| 355 |
|
|
|
| 356 |
|
|
if ($vendor eq $vendor_check) {last;};
|
| 357 |
|
|
}
|
| 358 |
|
|
print "\n";
|
| 359 |
|
|
}
|
| 360 |
|
|
|
| 361 |
|
|
|
| 362 |
|
|
|
| 363 |
|
|
|
| 364 |
|
|
|
| 365 |
|
|
|
| 366 |
|
|
|
| 367 |
|
|
|
| 368 |
|
|
|
| 369 |
|
|
|
| 370 |
|
|
|
| 371 |
|
|
|
| 372 |
|
|
|