OpenCores
URL https://opencores.org/ocsvn/socgen/socgen/trunk

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [documentation/] [create_busdefs_doc] - Blame information for rev 130

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.