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

Subversion Repositories socgen

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

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

powered by: WebSVN 2.1.0

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