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

Subversion Repositories socgen

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

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 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 128 jt_eaton
 
32
 
33
 
34
############################################################################
35
# General PERL config
36
############################################################################
37
use Getopt::Long;
38
use English;
39
use File::Basename;
40
use Cwd;
41
use XML::LibXML;
42
use lib './tools';
43
use sys::lib;
44
use yp::lib;
45
 
46
 
47
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
48
 
49
 
50
############################################################################
51
### Process the options
52
############################################################################
53
 
54
Getopt::Long::config("require_order", "prefix=-");
55
GetOptions("h","help",
56
) || die "(use '$program_name -h' for help)";
57
 
58
 
59
##############################################################################
60
## Help option
61
##############################################################################
62
if (  $opt_h or $opt_help  )
63
  { print "\n create_lib_doc  vendor_name library_name [component_name]";
64
    print "\n";
65
    exit 1;
66
  }
67
 
68
 
69
##############################################################################
70
##
71
##############################################################################
72
 
73
 
74
 
75
my $parser = XML::LibXML->new();
76
 
77
$home = cwd();
78
 
79 131 jt_eaton
 
80 128 jt_eaton
#############################################################################
81
##
82
##
83
#############################################################################
84
 
85 131 jt_eaton
my $vendor         = $ARGV[0];
86
my $library        = $ARGV[1];
87
my $work_dir       = $ARGV[2];
88
my $repo           = yp::lib::find_library_repo($vendor,$library);
89 128 jt_eaton
 
90
 
91 131 jt_eaton
my $doc_dir        = yp::lib::get_doc_dir();
92
 
93
 
94 128 jt_eaton
if(defined $work_dir)
95 130 jt_eaton
  {chomp($work_dir);}
96 128 jt_eaton
else
97 131 jt_eaton
  {$work_dir ="/${doc_dir}";}
98 128 jt_eaton
 
99 131 jt_eaton
 
100
 
101 128 jt_eaton
my $path  = "${home}${work_dir}";
102
mkdir $path,0755             unless( -e $path );
103
my $path  = "${home}${work_dir}/${vendor}__${library}";
104
mkdir $path,0755             unless( -e $path );
105
 
106
 
107
 
108 131 jt_eaton
$root = "${home}${repo}/${vendor}/${library}";
109 128 jt_eaton
$dest = "${home}${work_dir}/${vendor}__${library}";
110
&sys::lib::link_dir( "$root", "$dest"  );
111
 
112 130 jt_eaton
my @components   = yp::lib::find_components($vendor,$library);
113 128 jt_eaton
 
114
foreach my  $component (@components)
115 131 jt_eaton
{
116
unless (yp::lib::find_componentConfiguration($vendor,$library,$component)) {print "Missing ComponentCfg  $vendor, $library, $component \n";  }
117 128 jt_eaton
 
118 131 jt_eaton
my $socgen_filename      = yp::lib::find_componentConfiguration($vendor,$library,$component);
119
 
120
if($socgen_filename)
121
 
122 128 jt_eaton
{
123 131 jt_eaton
 
124
 
125
 
126
 
127
 my $socgen_file      = $parser->parse_file($socgen_filename);
128
 
129
 
130
 
131 130 jt_eaton
 my $doc_library_path = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:doc/socgen:library_path/text()")->to_literal;
132
 my $lib_comp_sep     = yp::lib::find_lib_comp_sep($vendor,$library,$component);
133 128 jt_eaton
 
134 131 jt_eaton
 my $path  = "${home}${repo}/${vendor}/${library}${doc_library_path}";
135 130 jt_eaton
 mkdir $path,0755             unless( -e $path );
136 128 jt_eaton
 
137 130 jt_eaton
 $doc_library_path = "${doc_library_path}/Geda";
138 128 jt_eaton
 
139 131 jt_eaton
 my $path  = "${home}${repo}/${vendor}/${library}${doc_library_path}";
140 130 jt_eaton
 mkdir $path,0755             unless( -e $path );
141 128 jt_eaton
 
142 131 jt_eaton
 my $path  = "${home}${repo}/${vendor}/${library}${doc_library_path}/sym";
143 130 jt_eaton
 mkdir $path,0755             unless( -e $path );
144 128 jt_eaton
 
145 131 jt_eaton
 my $path  = "${home}${repo}/${vendor}/${library}${doc_library_path}/sch";
146 130 jt_eaton
 mkdir $path,0755             unless( -e $path );
147 128 jt_eaton
 
148 131 jt_eaton
 my $path  = "${home}${repo}/${vendor}/${library}${doc_library_path}/png";
149 130 jt_eaton
 mkdir $path,0755             unless( -e $path );
150 128 jt_eaton
 
151 131 jt_eaton
 my $path  = "${home}${repo}/${vendor}/${library}${doc_library_path}/src";
152 130 jt_eaton
 mkdir $path,0755             unless( -e $path );
153 128 jt_eaton
 
154 130 jt_eaton
 my @versions =       yp::lib::find_component_versions($vendor,$library,$component);
155 128 jt_eaton
 
156
foreach my  $version   (@versions)
157
   {
158
   my $variant;
159
   if($version) {$variant = "${component}_${version}"}
160
   else         {$variant = "${component}"}
161 130 jt_eaton
   my $module_name =       yp::lib::get_module_name($vendor,$library,$component, $version);
162 128 jt_eaton
   print "gEDA directories  for   $vendor  $library - $component  $version $variant ==  $module_name  \n";
163
 
164
 
165
#/*********************************************************************************************/
166
#/                                                                                            */
167
#/  Create filelists for simulation, synthesis and linting                                    */
168
#/                                                                                            */
169
#/                                                                                            */
170
#/*********************************************************************************************/
171
 
172
my  @filelist =       yp::lib::parse_component_brothers("$vendor","$library","$component","$version");
173
 
174
foreach $line (@filelist)
175
   {
176
   $_ = $line;
177
   if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
178
     {
179 131 jt_eaton
     $new_library        = $2;
180 128 jt_eaton
     $new_component      = $3;
181
     $new_vendor         = $1;
182
     $new_version        = $4;
183 131 jt_eaton
     print "Seeking  $new_vendor $new_library $new_component $new_version \n";
184
     my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_component,$new_version));
185 128 jt_eaton
 
186 135 jt_eaton
     foreach  my   $i_name ($spirit_component_file->findnodes("//ipxact:componentGenerator/ipxact:name"))
187 128 jt_eaton
       {
188 135 jt_eaton
       my($gen_name)            = $i_name ->findnodes('../ipxact:name/text()')->to_literal ;
189
       my($gen_generatorExe)    = $i_name ->findnodes('../ipxact:generatorExe/text()')->to_literal ;
190
       foreach  my   $i_name ($spirit_component_file->findnodes("//ipxact:componentGenerator[ipxact:name/text() = '$gen_name']/ipxact:vendorExtensions/socgen:envIdentifier"))
191 128 jt_eaton
          {
192
          my($gen_envidentifier)  = $i_name ->findnodes('./text()')->to_literal ;
193
 
194
          if($gen_envidentifier eq ":*Documentation:*"   )
195
             {
196 131 jt_eaton
             my $cmd = "./tools/sys/build_generate -prefix /doc_dir -vendor    $vendor -library  $library -component  $component -version  $version  \n";
197 130 jt_eaton
             if (system($cmd)) {}
198
             my $filename = find_filename("fs-sim",   ${vendor},  ${library} , ${component} ,  ${version}  );
199 131 jt_eaton
             my $cmd = "cp     ${home}${work_dir}/${filename}.v    ${home}${repo}/${vendor}/${library}${doc_library_path}/src/${module_name}.v     \n";
200 130 jt_eaton
             if (system($cmd)) {}
201 128 jt_eaton
             my $filename = find_filename("fs-doc",   ${vendor},  ${library} , ${component} ,  ${version}  );
202 131 jt_eaton
             my $outfile ="${home}${repo}/${vendor}/${library}${doc_library_path}/sym/";
203 128 jt_eaton
             my $cmd = "./tools/documentation/ver2gedasym     ${home}${work_dir}/${filename}    $outfile   \n";
204
             if (system($cmd)) {}
205 131 jt_eaton
             my $outfile ="${home}${repo}/${vendor}/${library}${doc_library_path}/sch/";
206 128 jt_eaton
             my $cmd = "./tools/documentation/ver2gedasch     ${home}${work_dir}/${filename}    $outfile   \n";
207
             if (system($cmd)) {}
208 131 jt_eaton
             my $symfile ="${home}${repo}/${vendor}/${library}${doc_library_path}/sym/${module_name}.sym";
209
             my $pngfile ="${home}${repo}/${vendor}/${library}${doc_library_path}/png/${module_name}_sym.png";
210 128 jt_eaton
             my $cmd ="gaf export -c -s auto -m 5px  --dpi  600  --no-color -o  $pngfile $symfile \n";
211
             if (system($cmd)) {}
212 131 jt_eaton
             my $schfile ="${home}${repo}/${vendor}/${library}${doc_library_path}/sch/${module_name}.sch";
213
             my $pngfile ="${home}${repo}/${vendor}/${library}${doc_library_path}/png/${module_name}_sch.png";
214 128 jt_eaton
             my $cmd ="gaf export -c -s auto -m 5px  --dpi  600  --no-color -o  $pngfile $schfile \n";
215
             if (system($cmd)) {}
216
             }
217
 
218
 
219
          }
220
       }
221
     }
222
   }
223
 
224
   }
225
 
226
}
227
 
228 131 jt_eaton
}
229 128 jt_eaton
 
230
 
231
 
232 131 jt_eaton
 
233 128 jt_eaton
#/*********************************************************************************************/
234
#/  find filename                                                                             */
235
#/                                                                                            */
236
#/  returns gloabal  name of the file                                                         */
237
#/                                                                                            */
238
#/                                                                                            */
239
#/*********************************************************************************************/
240
 
241
sub find_filename
242
   {
243
   my @params             = @_;
244
   my $version            = pop(@params);
245
   my $component          = pop(@params);
246 131 jt_eaton
   my $library            = pop(@params);
247 128 jt_eaton
   my $vendor             = pop(@params);
248
   my $filesetref_name    = pop(@params);
249
 
250
 
251 130 jt_eaton
   my $variant;
252
   if($version)       {$variant   = "${component}_${version}";}
253
   else               {$variant   = "${component}";}
254 128 jt_eaton
 
255 131 jt_eaton
   my  @filelist       = yp::lib::parse_component_brothers("$vendor","$library","$component","$version");
256
   my $comp_xml_sep    = yp::lib::find_comp_xml_sep($vendor,$library,$component,$version);
257
   my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$library,$component);
258 130 jt_eaton
   my $library_path    = "${lib_comp_sep}${component}${comp_xml_sep}";
259 128 jt_eaton
 
260
 
261 130 jt_eaton
   foreach $line (@filelist)
262
     {
263
     $_ = $line;
264
     if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
265
       {
266
       $new_vendor         = $1;
267 131 jt_eaton
       $new_library        = $2;
268 130 jt_eaton
       $new_component      = $3;
269
       $new_version        = $4;
270 131 jt_eaton
       my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_component,$new_version));
271 128 jt_eaton
 
272 135 jt_eaton
       foreach  my   $i_name ($spirit_component_file->findnodes("//ipxact:fileSets/ipxact:fileSet/ipxact:file/ipxact:name"))
273 128 jt_eaton
              {
274
              my($file_name)      = $i_name ->findnodes('./text()')->to_literal ;
275 135 jt_eaton
              my($file_type)      = $i_name ->findnodes('../ipxact:userFileType/text()')->to_literal ;
276
              my($logical_name)   = $i_name ->findnodes('../ipxact:logicalName/text()')->to_literal ;
277
              my($view_file)      = $i_name ->findnodes('../../ipxact:name/text()')->to_literal ;
278 128 jt_eaton
              if(($file_type eq "libraryDir") &&  ($logical_name eq "dest_dir")  )
279
                 {
280 131 jt_eaton
                 if( $view_file eq  $filesetref_name )  { return ("${vendor}__${library}${library_path}/${file_name}${variant}"); };
281 128 jt_eaton
                 }
282
              }
283 130 jt_eaton
      }
284
     }
285
   }
286 128 jt_eaton
 

powered by: WebSVN 2.1.0

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