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

Subversion Repositories socgen

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

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 130 jt_eaton
my $projects         = "/projects";
93 128 jt_eaton
 
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 130 jt_eaton
  {chomp($work_dir);}
106 128 jt_eaton
else
107 130 jt_eaton
  {$work_dir ="/doc_dir";}
108 128 jt_eaton
 
109
my $path  = "${home}${work_dir}";
110
mkdir $path,0755             unless( -e $path );
111
my $path  = "${home}${work_dir}/${vendor}__${library}";
112
mkdir $path,0755             unless( -e $path );
113
 
114
 
115
 
116 130 jt_eaton
$root = "${home}${projects}/${vendor}/${library}";
117 128 jt_eaton
$dest = "${home}${work_dir}/${vendor}__${library}";
118
&sys::lib::link_dir( "$root", "$dest"  );
119
 
120 130 jt_eaton
my @components   = yp::lib::find_components($vendor,$library);
121 128 jt_eaton
 
122
foreach my  $component (@components)
123
 
124
{
125 130 jt_eaton
unless (yp::lib::find_componentConfiguration($vendor,$library,$component)) {print "Missing ComponentCfg  $vendor, $library, $component \n";  }
126
 my $socgen_file      = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
127
 my $doc_library_path = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:doc/socgen:library_path/text()")->to_literal;
128
 my $lib_comp_sep     = yp::lib::find_lib_comp_sep($vendor,$library,$component);
129 128 jt_eaton
 
130 130 jt_eaton
 my $path  = "${home}${projects}/${vendor}/${library}${doc_library_path}";
131
 mkdir $path,0755             unless( -e $path );
132 128 jt_eaton
 
133 130 jt_eaton
 $doc_library_path = "${doc_library_path}/Geda";
134 128 jt_eaton
 
135 130 jt_eaton
 my $path  = "${home}${projects}/${vendor}/${library}${doc_library_path}";
136
 mkdir $path,0755             unless( -e $path );
137 128 jt_eaton
 
138 130 jt_eaton
 my $path  = "${home}${projects}/${vendor}/${library}${doc_library_path}/sym";
139
 mkdir $path,0755             unless( -e $path );
140 128 jt_eaton
 
141 130 jt_eaton
 my $path  = "${home}${projects}/${vendor}/${library}${doc_library_path}/sch";
142
 mkdir $path,0755             unless( -e $path );
143 128 jt_eaton
 
144 130 jt_eaton
 my $path  = "${home}${projects}/${vendor}/${library}${doc_library_path}/png";
145
 mkdir $path,0755             unless( -e $path );
146 128 jt_eaton
 
147 130 jt_eaton
 my $path  = "${home}${projects}/${vendor}/${library}${doc_library_path}/src";
148
 mkdir $path,0755             unless( -e $path );
149 128 jt_eaton
 
150 130 jt_eaton
 my @versions =       yp::lib::find_component_versions($vendor,$library,$component);
151 128 jt_eaton
 
152
foreach my  $version   (@versions)
153
   {
154
   my $variant;
155
   if($version) {$variant = "${component}_${version}"}
156
   else         {$variant = "${component}"}
157 130 jt_eaton
   my $module_name =       yp::lib::get_module_name($vendor,$library,$component, $version);
158 128 jt_eaton
   print "gEDA directories  for   $vendor  $library - $component  $version $variant ==  $module_name  \n";
159
 
160
 
161
#/*********************************************************************************************/
162
#/                                                                                            */
163
#/  Create filelists for simulation, synthesis and linting                                    */
164
#/                                                                                            */
165
#/                                                                                            */
166
#/*********************************************************************************************/
167
 
168
my  @filelist =       yp::lib::parse_component_brothers("$vendor","$library","$component","$version");
169
 
170
foreach $line (@filelist)
171
   {
172
   $_ = $line;
173
   if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
174
     {
175
     $new_project        = $2;
176
     $new_component      = $3;
177
     $new_vendor         = $1;
178
     $new_version        = $4;
179 130 jt_eaton
     print "Seeking  $new_vendor $new_project $new_component $new_version \n";
180
     my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_project,$new_component,$new_version));
181 128 jt_eaton
 
182
     foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:componentGenerator/spirit:name"))
183
       {
184
       my($gen_name)            = $i_name ->findnodes('../spirit:name/text()')->to_literal ;
185
       my($gen_generatorExe)    = $i_name ->findnodes('../spirit:generatorExe/text()')->to_literal ;
186
       foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:componentGenerator[spirit:name/text() = '$gen_name']/spirit:vendorExtensions/socgen:envIdentifier"))
187
          {
188
          my($gen_envidentifier)  = $i_name ->findnodes('./text()')->to_literal ;
189
 
190
          if($gen_envidentifier eq ":*Documentation:*"   )
191
             {
192 130 jt_eaton
             my $cmd = "./tools/sys/build_generate -prefix /doc_dir -vendor    $vendor -project  $library -component  $component -version  $version  \n";
193
             if (system($cmd)) {}
194
             my $filename = find_filename("fs-sim",   ${vendor},  ${library} , ${component} ,  ${version}  );
195
             my $cmd = "cp     ${home}${work_dir}/${filename}.v    ${home}${projects}/${vendor}/${library}${doc_library_path}/src/${module_name}.v     \n";
196
             if (system($cmd)) {}
197 128 jt_eaton
             my $filename = find_filename("fs-doc",   ${vendor},  ${library} , ${component} ,  ${version}  );
198 130 jt_eaton
             my $outfile ="${home}${projects}/${vendor}/${library}${doc_library_path}/sym/";
199 128 jt_eaton
             my $cmd = "./tools/documentation/ver2gedasym     ${home}${work_dir}/${filename}    $outfile   \n";
200
             if (system($cmd)) {}
201 130 jt_eaton
             my $outfile ="${home}${projects}/${vendor}/${library}${doc_library_path}/sch/";
202 128 jt_eaton
             my $cmd = "./tools/documentation/ver2gedasch     ${home}${work_dir}/${filename}    $outfile   \n";
203
             if (system($cmd)) {}
204 130 jt_eaton
             my $symfile ="${home}${projects}/${vendor}/${library}${doc_library_path}/sym/${module_name}.sym";
205
             my $pngfile ="${home}${projects}/${vendor}/${library}${doc_library_path}/png/${module_name}_sym.png";
206 128 jt_eaton
             my $cmd ="gaf export -c -s auto -m 5px  --dpi  600  --no-color -o  $pngfile $symfile \n";
207
             if (system($cmd)) {}
208 130 jt_eaton
             my $schfile ="${home}${projects}/${vendor}/${library}${doc_library_path}/sch/${module_name}.sch";
209
             my $pngfile ="${home}${projects}/${vendor}/${library}${doc_library_path}/png/${module_name}_sch.png";
210 128 jt_eaton
             my $cmd ="gaf export -c -s auto -m 5px  --dpi  600  --no-color -o  $pngfile $schfile \n";
211
             if (system($cmd)) {}
212
             }
213
 
214
 
215
          }
216
       }
217
     }
218
   }
219
 
220
   }
221
 
222
}
223
 
224
 
225
 
226
 
227
#/*********************************************************************************************/
228
#/  find filename                                                                             */
229
#/                                                                                            */
230
#/  returns gloabal  name of the file                                                         */
231
#/                                                                                            */
232
#/                                                                                            */
233
#/*********************************************************************************************/
234
 
235
sub find_filename
236
   {
237
   my @params             = @_;
238
   my $version            = pop(@params);
239
   my $component          = pop(@params);
240
   my $project            = pop(@params);
241
   my $vendor             = pop(@params);
242
   my $filesetref_name    = pop(@params);
243
 
244
 
245 130 jt_eaton
   my $variant;
246
   if($version)       {$variant   = "${component}_${version}";}
247
   else               {$variant   = "${component}";}
248 128 jt_eaton
 
249 130 jt_eaton
   my  @filelist       = yp::lib::parse_component_brothers("$vendor","$project","$component","$version");
250
   my $comp_xml_sep    = yp::lib::find_comp_xml_sep($vendor,$project,$component,$version);
251
   my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$project,$component);
252
   my $library_path    = "${lib_comp_sep}${component}${comp_xml_sep}";
253 128 jt_eaton
 
254
 
255 130 jt_eaton
   foreach $line (@filelist)
256
     {
257
     $_ = $line;
258
     if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
259
       {
260
       $new_vendor         = $1;
261
       $new_project        = $2;
262
       $new_component      = $3;
263
       $new_version        = $4;
264
       my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_project,$new_component,$new_version));
265 128 jt_eaton
 
266 130 jt_eaton
       foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:fileSets/spirit:fileSet/spirit:file/spirit:name"))
267 128 jt_eaton
              {
268
              my($file_name)      = $i_name ->findnodes('./text()')->to_literal ;
269
              my($file_type)      = $i_name ->findnodes('../spirit:userFileType/text()')->to_literal ;
270
              my($logical_name)   = $i_name ->findnodes('../spirit:logicalName/text()')->to_literal ;
271
              my($view_file)      = $i_name ->findnodes('../../spirit:name/text()')->to_literal ;
272
              if(($file_type eq "libraryDir") &&  ($logical_name eq "dest_dir")  )
273
                 {
274 130 jt_eaton
                 if( $view_file eq  $filesetref_name )  { return ("${vendor}__${project}${library_path}/${file_name}${variant}"); };
275 128 jt_eaton
                 }
276
              }
277 130 jt_eaton
      }
278
     }
279
   }
280 128 jt_eaton
 

powered by: WebSVN 2.1.0

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