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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [sys/] [gen_elab_child_filelist] - Blame information for rev 134

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

Line No. Rev Author Line
1 134 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
 
47
 
48
 
49
############################################################################
50
# General PERL config
51
############################################################################
52
use Getopt::Long;
53
use English;
54
use File::Basename;
55
use Cwd;
56
use XML::LibXML;
57
use lib './tools';
58
use sys::lib;
59
use yp::lib;
60
use BerkeleyDB;
61
 
62
 
63
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
64
 
65
 
66
############################################################################
67
### Process the options
68
############################################################################
69
Getopt::Long::config("require_order", "prefix=-");
70
GetOptions("h","help",
71
           "envidentifier=s" => \$envidentifier,
72
           "prefix=s" => \$prefix,
73
           "vendor=s" => \$vendor,
74
           "library=s" => \$library,
75
           "component=s" => \$component,
76
           "version=s" => \$version,
77
           "top_file=s" => \$top_file,
78
           "suffix=s" => \$suffix,
79
           "leader=s" => \$leader,
80
           "top","top_lib"
81
) || die "(use '$program_name -h' for help)";
82
 
83
 
84
 
85
##############################################################################
86
## Help option
87
##############################################################################
88
if ( $opt_h  or $opt_help)
89
  { print "\n gen_elab_child_filelist -prefix /work -envidentifier *simulation*  -vendor vendor_name  -library library_name  -component component_name -version version_name   ";
90
    print "\n";
91
    exit 1;
92
  }
93
 
94
 
95
##############################################################################
96
##
97
##############################################################################
98
 
99
$home = cwd();
100
my $variant;
101
my $view;
102
my $filesetref_name;
103
 
104
 
105
 
106
 
107
if($version)       {$variant   = "${component}_${version}";}
108
else               {$variant   = "${component}";}
109
 
110
my $parser = XML::LibXML->new();
111
my $spirit_component_file  = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$library,$component,$version));
112
my $comp_xml_sep           = yp::lib::find_comp_xml_sep($vendor,$library,$component,$version);
113
my $lib_comp_sep           = yp::lib::find_lib_comp_sep($vendor,$library,$component);
114
 
115
 
116
 
117
 
118
 print "\n---GEN_elab_child_filelist -prefix $prefix -envidentifier $envidentifier  -vendor $vendor  -library $library  -component $component -version $version  \n";
119
 
120
foreach my $X_view ($spirit_component_file->findnodes('//spirit:component/spirit:model/spirit:views/spirit:view'))
121
         {
122
         my($Xview_name)            = $X_view->findnodes('./spirit:name/text()')->to_literal ;
123
         my($Xview_envidentifier)   = $X_view->findnodes('./spirit:envIdentifier/text()')->to_literal ;
124
         my($Xview_filesetref_name)  = $X_view->findnodes('./spirit:fileSetRef/spirit:localName/text()')->to_literal ;
125
 
126
#print  "XXXXX   $Xview_name || $Xview_envidentifier || $Xview_filesetref_name  \n";
127
 
128
         if($envidentifier eq $Xview_envidentifier )
129
              {
130
              $view = $Xview_name;
131
              $filesetref_name = $Xview_filesetref_name;
132
              }
133
         }
134
 
135
#print  "XXXXZ   $view || $filesetref_name  \n";
136
 
137
 
138
if((defined $view  ) && defined $filesetref_name  )
139
 
140
{
141
 
142
unless($suffix) { $suffix = $view };
143
 
144
 
145
my $path ="${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/../filelists";
146
mkdir $path,0755          unless( -e $path );
147
 
148
 
149
 
150
 
151
 
152
my @configs  = yp::lib::get_component_configs($vendor,$library,$component,$version);
153
 
154
 
155
 
156
foreach my $config (@configs)
157
 
158
{
159
#print "Config  $config \n";
160
 
161
my @simfilelist = ();
162
 
163
 
164
my $outfile ="${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/../filelists/${variant}_${config}.${suffix}\n";
165
#print "OUTFILE  $outfile";
166
open SIMFILE,">$outfile" or die "unable to open $outfile";
167
if($top_file)
168
 
169
{
170
#print SIMFILE  "$top_file  \n";
171
push @simfilelist,"$top_file  \n" ;
172
}
173
 
174
 
175
 
176
my $top_filename = find_filename( $filesetref_name, $vendor, $library,$component,$version);
177
#print SIMFILE "${home}${prefix}/${top_filename}_${config}.v \n";
178
push @simfilelist,"${home}${prefix}/${top_filename}_${config}.v \n";
179
 
180
 
181
 my $elab_db_filename = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,$config);
182
 
183
 my $elab_db  = new BerkeleyDB::Hash( -Filename => "$elab_db_filename", -Flags => DB_CREATE ) or die "Cannot open $elab_db_filename: $!";
184
 
185
 my $key;
186
 my $value;
187
 
188
 $cursor = $elab_db ->db_cursor() ;
189
 while ($cursor->c_get($key, $value, DB_NEXT) == 0)
190
   {
191
 
192
   my $VLNV;
193
   my $vlnv;
194
   ( ${VLNV},${vlnv}) = split( /___root./ , $key);
195
   if($VLNV eq "component")
196
     {
197
 
198
     if($vlnv)
199
       {
200
#       print "$key $vlnv   $value\n";
201
#       print SIMFILE "OUT  $value  \n";
202
       my $ven;
203
       my $lib;
204
       my $cmp;
205
       my $ver;
206
       my $cfg;
207
 
208
       ( ${ven},${lib},${cmp},${ver},${cfg}) = split( /:/ , $value);
209
 
210
#       print "FIND  ${ven} ${lib} ${cmp} ${ver} ${cfg} $view \n";
211
       my $filename = find_filename( $filesetref_name, $ven, $lib,$cmp,$ver);
212
#       print SIMFILE "${home}${prefix}/children/${filename}_${cfg}.v \n";
213
       push @simfilelist,"${home}${prefix}/children/${filename}_${cfg}.v \n";
214
 
215
       }
216
     }
217
    }
218
 
219
@simfilelist      = sys::lib::trim_sort(@simfilelist);
220
 
221
foreach my $simfile (@simfilelist)
222
{
223
       print SIMFILE "${simfile}";
224
}
225
 
226
 
227
 
228
 
229
my $status = $cursor->c_close() ;
230
$elab_db->db_close();
231
 
232
}
233
 
234
}
235
 
236
 
237
 
238
 
239
 
240
 
241
 
242
 
243
 
244
 
245
 
246
 
247
 
248
 
249
 
250
 
251
 
252
 
253
 
254
 
255
 
256
 
257
 
258
 
259
 
260
 
261
 
262
 
263
 
264
 
265
 
266
 
267
 
268
 
269
 
270
 
271
 
272
 
273
 
274
 
275
 
276
#/*********************************************************************************************/
277
#/                                                                                            */
278
#/  Create filelists for simulation, synthesis and linting                                    */
279
#/                                                                                            */
280
#/                                                                                            */
281
#/*********************************************************************************************/
282
 
283
 
284
 
285
 
286
 
287
 
288
 
289
 
290
 
291
 
292
#/*********************************************************************************************/
293
#/  find filename                                                                             */
294
#/                                                                                            */
295
#/  returns gloabal  name of the file                                                         */
296
#/                                                                                            */
297
#/                                                                                            */
298
#/*********************************************************************************************/
299
 
300
sub find_filename
301
   {
302
   my @params             = @_;
303
   my $version            = pop(@params);
304
   my $component          = pop(@params);
305
   my $library            = pop(@params);
306
   my $vendor             = pop(@params);
307
   my $filesetref_name    = pop(@params);
308
 
309
   my $variant;
310
   if($version)       {$variant   = "${component}_${version}";}
311
   else               {$variant   = "${component}";}
312
 
313
   my  @filelist =       yp::lib::parse_component_brothers("$vendor","$library","$component","$version");
314
   my $comp_xml_sep    = yp::lib::find_comp_xml_sep($vendor,$library,$component,$version);
315
   my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$library,$component);
316
   my $library_path    = "${lib_comp_sep}${component}${comp_xml_sep}";
317
 
318
 
319
 
320
foreach $line (@filelist)
321
   {
322
   $_ = $line;
323
   if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
324
     {
325
     $new_library        = $2;
326
     $new_component      = $3;
327
     $new_vendor         = $1;
328
     $new_version        = $4;
329
 
330
     my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_component,$new_version));
331
 
332
 
333
           foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:fileSets/spirit:fileSet/spirit:file/spirit:name"))
334
              {
335
              my($file_name)      = $i_name ->findnodes('./text()')->to_literal ;
336
              my($file_type)      = $i_name ->findnodes('../spirit:userFileType/text()')->to_literal ;
337
              my($logical_name)   = $i_name ->findnodes('../spirit:logicalName/text()')->to_literal ;
338
              my($view_file)      = $i_name ->findnodes('../../spirit:name/text()')->to_literal ;
339
              if(($file_type eq "libraryDir") &&  ($logical_name eq "dest_dir")  )
340
                 {
341
 
342
                 if( $view_file eq  $filesetref_name )
343
                   {
344
                   return ("${vendor}__${library}${library_path}/${file_name}${variant}");
345
                   };
346
                 }
347
              }
348
    }
349
}
350
}
351
 
352
 
353
1
354
 

powered by: WebSVN 2.1.0

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