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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [busdefs/] [check_busDefs] - Blame information for rev 131

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

Line No. Rev Author Line
1 131 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
use BerkeleyDB;
55
 
56
 
57
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
58
 
59
my $parser = XML::LibXML->new();
60
my $home    = cwd();
61
 
62
 
63
#/*********************************************************************************************/
64
#/                                                                                            */
65
#/                                                                                            */
66
#/                                                                                            */
67
#/                                                                                            */
68
#/*********************************************************************************************/
69
 
70
 
71
my @abstractionDefinitions = yp::lib::find_abstractionDefinitions();
72
 
73
my $version;
74
my $component;
75
my $library;
76
my $vendor;
77
 
78
 
79
foreach my $abstractionDefinition (@abstractionDefinitions)
80
{
81
 ( $vendor,$library, $component ,$version) = split ':', $abstractionDefinition;
82
 
83
          print "${vendor}:${library}:${component}:${version}\n";
84
          print "\t--------------------------------------------------------------------------------------------------------\n";
85
 
86
          $filename ="tools/busdefs/Berkeley/${vendor}_${library}_${component}_${version}.dbm";
87
 
88
          $absDef_db   = new BerkeleyDB::Hash( -Filename => $filename, -Flags => DB_CREATE ) or die "Cannot open file: $!";
89
 
90
 
91
 
92
 
93
          my $spirit_file       = yp::lib::find_ipxact_abstractionDefinition($vendor,$library,$component,$version);
94
 
95
          print "\tFilename:  ${spirit_file}\n";
96
          unless ($spirit_file) {print "Error absDef file does not exist";}
97
 
98
          my $spirit_absDef_file   = $parser->parse_file($spirit_file);
99
          foreach my $absDef ($spirit_absDef_file->findnodes("//spirit:abstractionDefinition/spirit:vendor"))
100
                {
101
                my($bd_vendor)         = $absDef->findnodes('./text()')->to_literal ;
102
                my($bd_library)        = $absDef->findnodes('../spirit:library/text()')->to_literal ;
103
                my($bd_name)           = $absDef->findnodes('../spirit:name/text()')->to_literal ;
104
                my($bd_version)        = $absDef->findnodes('../spirit:version/text()')->to_literal ;
105
                print "\tVLNV-ad     ${bd_vendor}_${bd_library}_${bd_name}_${bd_version}\n";
106
 
107
                my %systemGroupNames = ();
108
 
109
 
110
                foreach my $bus_type ($spirit_absDef_file->findnodes("//spirit:abstractionDefinition/spirit:busType"))
111
                   {
112
                   my($bt_vendor)        = $bus_type->findnodes('./@spirit:vendor')->to_literal ;
113
                   my($bt_library)       = $bus_type->findnodes('./@spirit:library')->to_literal ;
114
                   my($bt_name)          = $bus_type->findnodes('./@spirit:name')->to_literal ;
115
                   my($bt_version)       = $bus_type->findnodes('./@spirit:version')->to_literal ;
116
                   print "\tVLNV-bt     ${bt_vendor}_${bt_library}_${bt_name}_${bt_version}\n";
117
 
118
                   my $spirit_file       = yp::lib::find_ipxact_busDefinition($bt_vendor,$bt_library,$bt_name,$bt_version);
119
 
120
                   unless ($spirit_file) {print "ERROR: No bus definition\n";}
121
                   else
122
                     {
123
                     my $spirit_busDef_file   = $parser->parse_file($spirit_file);
124
                     foreach  my   $i_name ($spirit_busDef_file->findnodes("//spirit:busDefinition/spirit:systemGroupNames/spirit:systemGroupName"))
125
                       {
126
                       my($sysgroup_name)       = $i_name ->findnodes('./text()')->to_literal;
127
                       print "\t     SystemGroup Name $sysgroup_name \n";
128
                       $systemGroupNames{$sysgroup_name} = 1;
129
                       }
130
                     }
131
                   }
132
 
133
                foreach my $absDef ($spirit_absDef_file->findnodes("//spirit:abstractionDefinition/spirit:ports/spirit:port/spirit:logicalName"))
134
                   {
135
                   my($logical_name)         = $absDef->findnodes('./text()')->to_literal ;
136
                   my($is_clock)             = $absDef->findnodes('../spirit:wire/spirit:qualifier/spirit:isClock/text()')->to_literal ;
137
                   my($is_reset)             = $absDef->findnodes('../spirit:wire/spirit:qualifier/spirit:isReset/text()')->to_literal ;
138
                   my($is_address)           = $absDef->findnodes('../spirit:wire/spirit:qualifier/spirit:isAddress/text()')->to_literal ;
139
                   my($is_data)              = $absDef->findnodes('../spirit:wire/spirit:qualifier/spirit:isData/text()')->to_literal ;
140
                   my($requires_driver)      = $absDef->findnodes('../spirit:wire/spirit:requiresDriver/text()')->to_literal ;
141
                   my($driver_type)          = $absDef->findnodes('../spirit:wire/spirit:requiresDriver/@spirit:driverType')->to_literal ;
142
                   my($default_value)        = $absDef->findnodes('../spirit:wire/spirit:defaultValue/text()')->to_literal ;
143
 
144
                   print "\nPort:  ${logical_name} ";
145
 
146
 
147
               my $Key = "port__${logical_name}"    ;
148
               my @info  = ("$logical_name","$is_clock","$is_reset","$is_address","$is_data","$requires_driver","$driver_type","$default_value"         );
149
               $absDef_db->db_put( $Key, join(':', @info) );
150
 
151
 
152
 
153
 
154
 
155
                   if($is_clock)
156
                     {
157
                     if($is_reset)  { print "  BOTH CLOCK and RESET  ";}
158
                     else           { print "  CLOCK ";}
159
                     }
160
                   elsif($is_reset) { print "  RESET ";}
161
                   else             { print "  ";}
162
 
163
                   if($is_address) { print "  ADDRESS ";}
164
                   if($is_data) { print "  DATA ";}
165
 
166
 
167
                   if($requires_driver) {print " Requires Driver  $driver_type   ";}
168
                   else                 {print "   ";}
169
 
170
                   if($default_value)   {print " Default Value   $default_value  \n";}
171
                   else                 {print " \n";}
172
 
173
                   my $master_presence;
174
                   my $master_width;
175
                   my $master_direction;
176
 
177
                   foreach my $onMaster ($spirit_absDef_file->findnodes("//spirit:abstractionDefinition/spirit:ports/spirit:port/spirit:logicalName[text() = '$logical_name']/../spirit:wire/spirit:onMaster/spirit:presence"))
178
                    {
179
                    $master_presence    = $onMaster->findnodes('./text()')->to_literal ;
180
                    $master_width       = $onMaster->findnodes('../spirit:width/text()')->to_literal ;
181
                    $master_direction   = $onMaster->findnodes('../spirit:direction/text()')->to_literal ;
182
                    print "  onMaster presence    $master_presence \n";
183
                    #unless($master_width)     {$master_width = 1;}
184
                    if($master_width)  {print "  onMaster width       $master_width \n";}
185
                    if($master_direction) {print "  onMaster direction   $master_direction \n";}
186
                    print "\n";
187
 
188
                    my $Key = "master__${logical_name}"    ;
189
                    my @info  = ("$logical_name","$master_presence","$master_width","$master_direction"     );
190
                    $absDef_db->db_put( $Key, join(':', @info) );
191
 
192
                    }
193
 
194
                   my $slave_presence;
195
                   my $slave_width;
196
                   my $slave_direction;
197
 
198
                   foreach my $onSlave ($spirit_absDef_file->findnodes("//spirit:abstractionDefinition/spirit:ports/spirit:port/spirit:logicalName[text() = '$logical_name']/../spirit:wire/spirit:onSlave/spirit:presence"))
199
                    {
200
                    $slave_presence   = $onSlave->findnodes('./text()')->to_literal ;
201
                    $slave_width      = $onSlave->findnodes('../spirit:width/text()')->to_literal ;
202
                    $slave_direction  = $onSlave->findnodes('../spirit:direction/text()')->to_literal ;
203
                    print "  onSlave  presence    $slave_presence \n";
204
                    #unless($slave_width)     {$slave_width = 1;}
205
                    if($slave_width) {print "  onSlave  width       $slave_width \n";}
206
                    if($slave_direction) {print "  onSlave  direction   $slave_direction \n";}
207
                    print "\n";
208
 
209
                    my $Key = "slave__${logical_name}"    ;
210
                    my @info  = ("$logical_name","$slave_presence","$slave_width","$slave_direction"     );
211
                    $absDef_db->db_put( $Key, join(':', @info) );
212
 
213
 
214
                    }
215
 
216
 
217
                   my %systemGroupPresence= ();
218
                   my %systemGroupWidth= ();
219
                   my %systemGroupDirection= ();
220
 
221
 
222
 
223
                   foreach my $onSystem  ($spirit_absDef_file->findnodes("//spirit:abstractionDefinition/spirit:ports/spirit:port/spirit:logicalName[text() = '$logical_name']/../spirit:wire/spirit:onSystem/spirit:group"))
224
                    {
225
                    my($system_group)        = $onSystem->findnodes('./text()')->to_literal ;
226
                    my($presence)            = $onSystem->findnodes('../spirit:presence/text()')->to_literal ;
227
                    my($width)               = $onSystem->findnodes('../spirit:width/text()')->to_literal ;
228
                    my($direction)           = $onSystem->findnodes('../spirit:direction/text()')->to_literal ;
229
                    print "  onSystem Group       $system_group \n";
230
                    print "  onSystem presence    $presence \n";
231
                    #unless($width)     {$width = 1;}
232
                    if($width){print "  onSystem width       $width \n";}
233
                    if($direction){print "  onSystem direction   $direction \n";}
234
                    print "\n";
235
 
236
                    my $Key = "syste,__${logical_name}"    ;
237
                    my @info  = ("$logical_name","$system_group","$presence","$width","$direction"     );
238
                    $absDef_db->db_put( $Key, join(':', @info) );
239
 
240
 
241
                    $systemGroupPresence{$system_group} =$presence  ;
242
                    $systemGroupWidth{$system_group} =$width  ;
243
                    $systemGroupDirection{$system_group} =$direction  ;
244
                    unless(   $systemGroupNames{$system_group}) {print "Group $system_group not defined in busDefinition \n"; }
245
                    }
246
# insert DRC checks here
247
 
248
                   }
249
                }
250
 
251
$absDef_db->db_close();
252
          print "\n";
253
          }
254
 
255
 
256
 
257
 
258
 

powered by: WebSVN 2.1.0

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