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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [verilog/] [read_elab] - Blame information for rev 133

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
#/*            /   SOC  \                                              */
7
#/*           /    GEN   \                                             */
8
#/*          /    TOOL    \                                            */
9
#/*          ==============                                            */
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
 
47
############################################################################
48
# General PERL config
49
############################################################################
50
use Getopt::Long;
51
use English;
52
use File::Basename;
53
use Cwd;
54
use Scalar::Util qw(looks_like_number);
55
use XML::LibXML;
56
use lib './tools';
57
use sys::lib;
58
use yp::lib;
59
use BerkeleyDB;
60
 
61
 
62
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
63
 
64
 
65
############################################################################
66
### Process the options
67
############################################################################
68
Getopt::Long::config("require_order", "prefix=-");
69
GetOptions("h","help",
70
           "prefix=s" => \$prefix,
71
           "vendor=s" => \$vendor,
72
           "library=s" => \$library,
73
           "version=s" => \$version,
74
           "component=s" => \$component,
75
           "verbose"
76
) || die "(use '$program_name -h' for help)";
77
 
78
 
79
##############################################################################
80
## Help option
81
##############################################################################
82
if ( $opt_h  or $opt_help  )
83
  { print "\n read_elab -prefix prefix   -vendor vendor -library library  -component component  -version version \n";
84
    exit 1;
85
  }
86
 
87
 
88
 
89
 
90
 
91
 
92
#############################################################################
93
##
94
##
95
#############################################################################
96
 
97
$home = cwd();
98
 
99
unless ($prefix)
100
  {
101
  $prefix   = yp::lib::get_workspace();
102
  $prefix   = "/${prefix}";
103
  }
104
my   $variant;
105
my   $configuration;
106
 
107
my $dest_dir            = "elab";
108
my $destination         = "${component}_${version}";
109
 
110
unless ($env ) {$env = "none";}
111
unless ($tool ){$tool = "none";}
112
unless ($unit ){$unit = "none";}
113
 
114
if($name)
115
  {
116
  $destination   = "${destination}_${name}";
117
  }
118
else
119
  {
120
  $name          = $version;
121
  $destination   = "${destination}";
122
  }
123
 
124
 
125
my $root                =      "root";
126
 
127
if($version)       {$variant   = "${component}_${version}";}
128
else               {$variant   = "${component}";}
129
 
130
print "read_elab     -prefix prefix -vendor $vendor -library $library -component $component -version $version -env $env -tool $tool -unit $unit -name $name     \n";
131
 
132
 
133
my $parser = XML::LibXML->new();
134
 
135
 
136
my $socgen_file              = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
137
 
138
unless ($socgen_file)      { print "No socgen ip file   \n";};
139
 
140
 
141
my $comp_xml_sep    = yp::lib::find_comp_xml_sep($vendor,$library,$component,$version);
142
my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$library,$component);
143
 
144
 
145
#print "lib_comp_sep   $lib_comp_sep \n";
146
#print "comp_xml_sep   $comp_xml_sep \n";
147
 
148
 
149
 
150
 
151
my $path  = "${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/../${dest_dir}/${destination}";
152
 
153
unless( -e $path )
154
        {
155
        print "$path does not exist \n";
156
        return(1);
157
        }
158
 
159
 
160
 
161
 
162
$data_db_file  = "${path}/${root}.db";
163
 
164
if(-e  $data_db_file  )
165
        {
166
        print "$data_db_file  does exist  \n";
167
        }
168
 
169
 
170
my $elab_db  = new BerkeleyDB::Hash( -Filename => "$data_db_file", -Flags => DB_CREATE ) or die "Cannot open ${data_db_file}: $!";
171
 
172
 
173
 
174
 
175
 
176
   my $key;
177
   my $value;
178
 
179
 
180
 
181
   my @elab_list;
182
 
183
   my $cursor = $elab_db ->db_cursor() ;
184
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
185
   {
186
#   print "ELAB  $key,   $value  \n";
187
                 ( ${key_type},@elab_list) = split( /\./ , $key);
188
#                 ( ${log_name},${direction},${type},${vector},${left},${right},${phy_name}) = split ':', $value;
189
                 if(($key_type eq "component___${root}"))
190
                    {
191
                    print "Component  $key -- $value @elab_list  \n";
192
                    build_hierarchy ($value,$path,$root,@elab_list);
193
                    }
194
                 else
195
                    {
196
 
197
                    }
198
 
199
   }
200
 
201
   my $status = $cursor->c_close() ;
202
 
203
 
204
 
205
   $elab_db   -> db_close();
206
 
207
#   @bus_list      = sys::lib::trim_sort(@bus_list);
208
 
209
 
210
#    foreach $list (@bus_list)   { print   "${list}\n";}
211
#
212
 
213
 
214
#my @busses  = yp::lib::get_busses($vendor,$library,$component,$version);
215
 
216
#    foreach $list (@busses) {  print   "${list}\n";  }
217
 
218
 
219
 
220
 
221
#/*********************************************************************************************/
222
#/                                                                                            */
223
#/                                                                                            */
224
#/                                                                                            */
225
#/                                                                                            */
226
#/                                                                                            */
227
#/                                                                                            */
228
#/*********************************************************************************************/
229
 
230
sub build_hierarchy
231
   {
232
   my @params     = @_;
233
   my $vlnv       = shift(@params);
234
   my $path       = shift(@params);
235
   my $root       = shift(@params);
236
   my $top        = shift(@params);
237
   my $new_elab_db ;
238
   my $new_elab_db_file_name ;
239
 
240
 
241
 
242 133 jt_eaton
#   print "Hier  $path \nHier- $root       $top    --- @params  \n";
243 131 jt_eaton
   $path ="${path}/${root}";
244
   unless(-e $path)
245
     {
246
     $cmd ="mkdir ${path} \n";
247
     if(system($cmd)){}
248
     print "Create Dir  ${path} \n";
249
     }
250
 
251
   unless (-e "${path}/${top}")
252
     {
253
     $cmd ="mkdir ${path}/${top} \n";
254
     if(system($cmd)){}
255
     }
256
 
257
   $new_elab_db_file_name  = "${path}/${top}/Index.db";
258
 
259
   if(@params)
260
     {
261
     build_hierarchy ("$vlnv","${path}","${top}",@params);
262
     }
263
   else
264
     {
265
     print "CREATE $new_elab_db_file_name  \n";
266
     $new_elab_db  = new BerkeleyDB::Hash( -Filename => "$new_elab_db_file_name", -Flags => DB_CREATE ) or die "Cannot open $new_elab_db_file_name    : $!";
267
     $new_elab_db->db_put( "VLNV","${vlnv}"  );
268
     print "VLNV  $vlnv \nVLNV -> $new_elab_db_file_name  \n";
269
     }
270
 
271
   return(0);
272
 
273
   }
274
 
275
 
276
 
277
 
278
1

powered by: WebSVN 2.1.0

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