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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [documentation/] [create_lib_doc] - Blame information for rev 128

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

Line No. Rev Author Line
1 128 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
#/*                                                                    */
17
#/*  Author(s):                                                        */
18
#/*      - John Eaton, jt_eaton@opencores.org                          */
19
#/*                                                                    */
20
#/**********************************************************************/
21
#/*                                                                    */
22
#/*    Copyright (C) <2010-2011>                */
23
#/*                                                                    */
24
#/*  This source file may be used and distributed without              */
25
#/*  restriction provided that this copyright statement is not         */
26
#/*  removed from the file and that any derivative work contains       */
27
#/*  the original copyright notice and the associated disclaimer.      */
28
#/*                                                                    */
29
#/*  This source file is free software; you can redistribute it        */
30
#/*  and/or modify it under the terms of the GNU Lesser General        */
31
#/*  Public License as published by the Free Software Foundation;      */
32
#/*  either version 2.1 of the License, or (at your option) any        */
33
#/*  later version.                                                    */
34
#/*                                                                    */
35
#/*  This source is distributed in the hope that it will be            */
36
#/*  useful, but WITHOUT ANY WARRANTY; without even the implied        */
37
#/*  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR           */
38
#/*  PURPOSE.  See the GNU Lesser General Public License for more      */
39
#/*  details.                                                          */
40
#/*                                                                    */
41
#/*  You should have received a copy of the GNU Lesser General         */
42
#/*  Public License along with this source; if not, download it        */
43
#/*  from http://www.opencores.org/lgpl.shtml                          */
44
#/*                                                                    */
45
#/**********************************************************************/
46
 
47
 
48
############################################################################
49
# General PERL config
50
############################################################################
51
use Getopt::Long;
52
use English;
53
use File::Basename;
54
use Cwd;
55
use XML::LibXML;
56
use lib './tools';
57
use sys::lib;
58
use yp::lib;
59
 
60
 
61
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
62
 
63
 
64
############################################################################
65
### Process the options
66
############################################################################
67
 
68
Getopt::Long::config("require_order", "prefix=-");
69
GetOptions("h","help",
70
) || die "(use '$program_name -h' for help)";
71
 
72
 
73
##############################################################################
74
## Help option
75
##############################################################################
76
if (  $opt_h or $opt_help  )
77
  { print "\n create_lib_doc  vendor_name library_name [component_name]";
78
    print "\n";
79
    exit 1;
80
  }
81
 
82
 
83
##############################################################################
84
##
85
##############################################################################
86
 
87
 
88
 
89
my $parser = XML::LibXML->new();
90
 
91
$home = cwd();
92
 
93
 
94
#############################################################################
95
##
96
##
97
#############################################################################
98
 
99
  my $vendor         = $ARGV[0];
100
  my $library        = $ARGV[1];
101
  my $work_dir       = $ARGV[2];
102
 
103
 
104
if(defined $work_dir)
105
 
106
{
107
chomp($work_dir);
108
}
109
else
110
 
111
{
112
$work_dir ="/doc_dir";
113
}
114
 
115
 
116
 
117
 
118
my $path  = "${home}${work_dir}";
119
mkdir $path,0755             unless( -e $path );
120
my $path  = "${home}${work_dir}/${vendor}__${library}";
121
mkdir $path,0755             unless( -e $path );
122
 
123
 
124
 
125
$root = "${home}/projects/${vendor}/${library}";
126
$dest = "${home}${work_dir}/${vendor}__${library}";
127
&sys::lib::link_dir( "$root", "$dest"  );
128
 
129
 
130
my @components   = yp::lib::find_components("socgen:componentConfiguration",$vendor,$library);
131
 
132
 
133
 
134
 
135
foreach my  $component (@components)
136
 
137
{
138
 
139
 
140
my $sogen_file               = $parser->parse_file(yp::lib::find_socgen("socgen:componentConfiguration",$vendor,$library,$component));
141
my $doc_library_path         = $sogen_file->findnodes("//socgen:componentConfiguration/socgen:doc/socgen:library_path/text()")->to_literal;
142
my $lib_comp_sep             = yp::lib::find_lib_comp_sep($vendor,$library,$component);
143
 
144
 
145
 
146
 
147
   my $path  = "${home}/projects/${vendor}/${library}${doc_library_path}";
148
   mkdir $path,0755             unless( -e $path );
149
 
150
 
151
   $doc_library_path = "${doc_library_path}/Geda";
152
 
153
   my $path  = "${home}/projects/${vendor}/${library}${doc_library_path}";
154
   mkdir $path,0755             unless( -e $path );
155
 
156
 
157
   my $path  = "${home}/projects/${vendor}/${library}${doc_library_path}/sym";
158
   mkdir $path,0755             unless( -e $path );
159
 
160
 
161
   my $path  = "${home}/projects/${vendor}/${library}${doc_library_path}/sch";
162
   mkdir $path,0755             unless( -e $path );
163
 
164
 
165
   my $path  = "${home}/projects/${vendor}/${library}${doc_library_path}/png";
166
   mkdir $path,0755             unless( -e $path );
167
 
168
 
169
   my $path  = "${home}/projects/${vendor}/${library}${doc_library_path}/src";
170
   mkdir $path,0755             unless( -e $path );
171
 
172
 
173
 
174
 
175
 
176
my @versions =       yp::lib::find_versions("spirit:component",$vendor,$library,$component);
177
 
178
 
179
 
180
 
181
 
182
 
183
 
184
 
185
 
186
foreach my  $version   (@versions)
187
   {
188
 
189
 
190
   my $variant;
191
   if($version) {$variant = "${component}_${version}"}
192
   else         {$variant = "${component}"}
193
 
194
 
195
 
196
  my $module_name =       yp::lib::get_module_name($vendor,$library,$component, $version);
197
 
198
   print "gEDA directories  for   $vendor  $library - $component  $version $variant ==  $module_name  \n";
199
 
200
   #/*********************************************************************************************/
201
   #/                                                                                            */
202
   #/                                                                                            */
203
   #/                                                                                            */
204
   #/                                                                                            */
205
   #/                                                                                            */
206
   #/                                                                                            */
207
   #/*********************************************************************************************/
208
 
209
 
210
 
211
 
212
 
213
 
214
 
215
 
216
#/*********************************************************************************************/
217
#/                                                                                            */
218
#/  Create filelists for simulation, synthesis and linting                                    */
219
#/                                                                                            */
220
#/                                                                                            */
221
#/*********************************************************************************************/
222
 
223
my  @filelist =       yp::lib::parse_component_brothers("$vendor","$library","$component","$version");
224
 
225
foreach $line (@filelist)
226
   {
227
   $_ = $line;
228
   if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
229
     {
230
     $new_project        = $2;
231
     $new_component      = $3;
232
     $new_vendor         = $1;
233
     $new_version        = $4;
234
 
235
 
236
 
237
    print "Seeking  $new_vendor $new_project $new_component $new_version \n";
238
 
239
     my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$new_vendor,$new_project,$new_component,$new_version));
240
 
241
 
242
 
243
 
244
 
245
     foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:componentGenerator/spirit:name"))
246
       {
247
       my($gen_name)            = $i_name ->findnodes('../spirit:name/text()')->to_literal ;
248
       my($gen_generatorExe)    = $i_name ->findnodes('../spirit:generatorExe/text()')->to_literal ;
249
 
250
 
251
 
252
       foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:componentGenerator[spirit:name/text() = '$gen_name']/spirit:vendorExtensions/socgen:envIdentifier"))
253
          {
254
          my($gen_envidentifier)  = $i_name ->findnodes('./text()')->to_literal ;
255
 
256
          if($gen_envidentifier eq ":*Documentation:*"   )
257
             {
258
            my $cmd = "./tools/sys/build_generate -prefix /doc_dir -vendor    $vendor -project  $library -component  $component -version  $version  \n";
259
 
260
            if (system($cmd)) {}
261
 
262
            my $filename = find_filename("fs-sim",   ${vendor},  ${library} , ${component} ,  ${version}  );
263
 
264
            my $cmd = "cp     ${home}${work_dir}/${filename}.v    ${home}/projects/${vendor}/${library}${doc_library_path}/src/${module_name}.v     \n";
265
 
266
            if (system($cmd)) {}
267
 
268
 
269
             my $filename = find_filename("fs-doc",   ${vendor},  ${library} , ${component} ,  ${version}  );
270
 
271
 
272
 
273
             my $outfile ="${home}/projects/${vendor}/${library}${doc_library_path}/sym/";
274
             my $cmd = "./tools/documentation/ver2gedasym     ${home}${work_dir}/${filename}    $outfile   \n";
275
             if (system($cmd)) {}
276
 
277
 
278
             my $outfile ="${home}/projects/${vendor}/${library}${doc_library_path}/sch/";
279
             my $cmd = "./tools/documentation/ver2gedasch     ${home}${work_dir}/${filename}    $outfile   \n";
280
             if (system($cmd)) {}
281
 
282
             my $symfile ="${home}/projects/${vendor}/${library}${doc_library_path}/sym/${module_name}.sym";
283
             my $pngfile ="${home}/projects/${vendor}/${library}${doc_library_path}/png/${module_name}_sym.png";
284
             my $cmd ="gaf export -c -s auto -m 5px  --dpi  600  --no-color -o  $pngfile $symfile \n";
285
             if (system($cmd)) {}
286
 
287
             my $schfile ="${home}/projects/${vendor}/${library}${doc_library_path}/sch/${module_name}.sch";
288
             my $pngfile ="${home}/projects/${vendor}/${library}${doc_library_path}/png/${module_name}_sch.png";
289
             my $cmd ="gaf export -c -s auto -m 5px  --dpi  600  --no-color -o  $pngfile $schfile \n";
290
             if (system($cmd)) {}
291
 
292
 
293
 
294
             }
295
 
296
 
297
          }
298
       }
299
     }
300
   }
301
 
302
 
303
 
304
 
305
 
306
 
307
 
308
 
309
 
310
 
311
 
312
 
313
 
314
 
315
 
316
 
317
 
318
 
319
 
320
 
321
   }
322
 
323
}
324
 
325
 
326
 
327
 
328
 
329
 
330
 
331
#/*********************************************************************************************/
332
#/  find filename                                                                             */
333
#/                                                                                            */
334
#/  returns gloabal  name of the file                                                         */
335
#/                                                                                            */
336
#/                                                                                            */
337
#/*********************************************************************************************/
338
 
339
sub find_filename
340
   {
341
   my @params             = @_;
342
   my $version            = pop(@params);
343
   my $component          = pop(@params);
344
   my $project            = pop(@params);
345
   my $vendor             = pop(@params);
346
   my $filesetref_name    = pop(@params);
347
 
348
 
349
     my $variant;
350
     if($version)       {$variant   = "${component}_${version}";}
351
     else               {$variant   = "${component}";}
352
 
353
 
354
 
355
 
356
 
357
 
358
 
359
my  @filelist =       yp::lib::parse_component_brothers("$vendor","$project","$component","$version");
360
my $library_path    = yp::lib::find_ipxact_library_path("spirit:component",$vendor,$project,$component,$version);
361
 
362
 
363
foreach $line (@filelist)
364
   {
365
   $_ = $line;
366
   if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
367
     {
368
     $new_project        = $2;
369
     $new_component      = $3;
370
     $new_vendor         = $1;
371
     $new_version        = $4;
372
 
373
     my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact("spirit:component",$new_vendor,$new_project,$new_component,$new_version));
374
 
375
 
376
           foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:fileSets/spirit:fileSet/spirit:file/spirit:name"))
377
              {
378
              my($file_name)      = $i_name ->findnodes('./text()')->to_literal ;
379
              my($file_type)      = $i_name ->findnodes('../spirit:userFileType/text()')->to_literal ;
380
              my($logical_name)   = $i_name ->findnodes('../spirit:logicalName/text()')->to_literal ;
381
              my($view_file)      = $i_name ->findnodes('../../spirit:name/text()')->to_literal ;
382
 
383
 
384
 
385
              if(($file_type eq "libraryDir") &&  ($logical_name eq "dest_dir")  )
386
                 {
387
                 if( $view_file eq  $filesetref_name )
388
                   {
389
                   return ("${vendor}__${project}${library_path}/${file_name}${variant}");
390
                   };
391
 
392
                 }
393
 
394
              }
395
 
396
    }
397
 
398
}
399
}
400
 

powered by: WebSVN 2.1.0

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