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