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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [sys/] [build_sw_master] - Blame information for rev 133

Go to most recent revision | 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
 
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-2013>                */
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
# General PERL config
49
############################################################################
50
use Getopt::Long;
51
use English;
52
use File::Basename;
53
use Cwd;
54
use XML::LibXML;
55
use lib './tools';
56
use sys::lib;
57
use yp::lib;
58 133 jt_eaton
use Parallel::ForkManager;
59 131 jt_eaton
 
60 133 jt_eaton
 
61 131 jt_eaton
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
62
 
63
 
64
############################################################################
65
### Process the options
66
############################################################################
67
Getopt::Long::config("require_order", "prefix=-");
68
GetOptions("h","help",
69
) || die "(use '$program_name -h' for help)";
70
 
71
 
72
 
73
 
74
##############################################################################
75
## Help option
76
##############################################################################
77
if ( $opt_h or $opt_help  )
78
  { print "\n build_master";
79
    print "\n";
80
    exit 1;
81
  }
82
 
83
 
84
my $parser = XML::LibXML->new();
85
 
86
 
87
 
88
 
89
#/**********************************************************************/
90
#/*  Process each library by finding any ip-xact file in any component */
91
#/*                                                                    */
92
#/*  Each ip-xact file is parsed and it's filename and the names of any*/
93
#/*  modules that it uses are saved.                                   */
94
#/*                                                                    */
95
#/*                                                                    */
96
#/**********************************************************************/
97
 
98
my $home = cwd();
99
 
100
my $prefix   = yp::lib::get_workspace();
101
   $prefix   = "/${prefix}";
102
 
103 133 jt_eaton
my $number_of_cpus   = yp::lib::get_number_of_cpus();
104
 
105 131 jt_eaton
my @vendors = yp::lib::find_vendors();
106
 
107
foreach my $vendor (@vendors)
108
 {
109
         print "$vendor   \n ";
110
 my $vendor_status    =  yp::lib::get_vendor_status($vendor);
111
 if($vendor_status eq "active")
112
   {
113
   my @libraries = yp::lib::find_libraries($vendor);
114
   foreach my $library (@libraries)
115
     {
116
         print "$vendor $library   \n ";
117
     my $library_status   =  yp::lib::get_library_status($vendor,$library);
118
     if($library_status eq "active")
119
         {
120
         print "$vendor $library   \n ";
121
         run_vendor_library ( $vendor ,  $library)
122
         }
123
     }
124
   }
125
 }
126
 
127
 
128
 
129
 
130
sub run_vendor_library
131
   {
132
   my @params     = @_;
133
   my $library    = pop(@params);
134
   my $vendor     = pop(@params);
135
 
136
 
137
my @components   = yp::lib::find_components($vendor,$library);
138
 
139
foreach my $component (@components)
140
   {
141
   my $socgen_filename     = yp::lib::find_componentConfiguration($vendor,$library,$component);
142
   if($socgen_filename)
143
   {
144
   my $socgen_file     = $parser->parse_file($socgen_filename);
145
 
146
   #/*********************************************************************************************/
147
   #/   files for simulation                                                                     */
148
   #/                                                                                            */
149
   #/*********************************************************************************************/
150
 
151
   foreach  my   $i_name ($socgen_file->findnodes("//socgen:codeSets/socgen:codeSet/socgen:name"))
152
      {
153
      my $codeSet_name        = $i_name ->findnodes('./text()')->to_literal ;
154
      my $codeSet_vendor      = $i_name ->findnodes('../socgen:vendor/text()')->to_literal ;
155
      my $codeSet_library     = $i_name ->findnodes('../socgen:library/text()')->to_literal ;
156
      my $codeSet_component   = $i_name ->findnodes('../socgen:component/text()')->to_literal ;
157
      my $codeSet_version     = $i_name ->findnodes('../socgen:version/text()')->to_literal ;
158 133 jt_eaton
      my $codeSet_prefix      = "${prefix}/${vendor}__${library}/children";
159 131 jt_eaton
 
160
 
161 133 jt_eaton
      print "$codeSet_name    $codeSet_prefix           $codeSet_vendor $codeSet_library $codeSet_component  $codeSet_version  \n ";
162 131 jt_eaton
 
163 133 jt_eaton
 
164
 
165
 
166
 
167
 
168
 
169
 
170
 
171
##############################################################################
172
##
173
##############################################################################
174
 
175
 
176
 
177
my @cmd_list  = ();
178
 
179
 
180
 
181
 
182
my $lib_comp_sep    = yp::lib::find_lib_comp_sep($codeSet_vendor,$codeSet_library,$codeSet_component);
183
 
184
 
185
 
186
 
187
#/*********************************************************************************************/
188
#/                                                                                            */
189
#/  Create filelists for simulation, synthesis and linting                                    */
190
#/                                                                                            */
191
#/                                                                                            */
192
#/*********************************************************************************************/
193
 
194
my  @filelist =       yp::lib::parse_component_brothers("$codeSet_vendor","$codeSet_library","$codeSet_component","$codeSet_version");
195
 
196
foreach $line (@filelist)
197
   {
198
   $_ = $line;
199
   if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
200
     {
201
     $new_library        = $2;
202
     $new_component      = $3;
203
     $new_vendor         = $1;
204
     $new_version        = $4;
205
 
206
 
207
     my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_component,$new_version));
208
 
209
     foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:componentGenerator/spirit:name"))
210
       {
211
       my($gen_name)            = $i_name ->findnodes('../spirit:name/text()')->to_literal ;
212
       my($gen_generatorExe)    = $i_name ->findnodes('../spirit:generatorExe/text()')->to_literal ;
213
       my($gen_phase)           = $i_name ->findnodes('../spirit:phase/text()')->to_literal ;
214
 
215
       my $cmd;
216
       $cmd = "   -prefix $codeSet_prefix -vendor $codeSet_vendor     -library $codeSet_library  -component $codeSet_component -version $codeSet_version  ";
217
 
218
       foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:componentGenerator[spirit:name/text() = '$gen_name']/spirit:parameters/spirit:parameter"))
219
          {
220
          my($gen_param)             = $i_name ->findnodes('./spirit:value/text()')->to_literal ;
221
          my($gen_param_name)        = $i_name ->findnodes('./spirit:name/text()')->to_literal ;
222
 
223
          if   ($gen_param_name eq "in_pipe")     {$cmd =  "$cmd <${home}${codeSet_prefix}/${codeSet_vendor}__${codeSet_library}${lib_comp_sep}${codeSet_component}/${gen_param}";}
224
          elsif($gen_param_name eq "out_pipe")    {$cmd =  "$cmd >${home}${codeSet_prefix}/${codeSet_vendor}__${codeSet_library}${lib_comp_sep}${codeSet_component}/${gen_param}";}
225
          elsif($gen_param_name)                  {$cmd =  "$cmd -${gen_param_name} $gen_param ";}
226
          else                                    {$cmd =  "$cmd $gen_param";}
227
          }
228
 
229
       foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:componentGenerator[spirit:name/text() = '$gen_name']/spirit:vendorExtensions/socgen:envIdentifier"))
230
          {
231
          my($gen_envidentifier)  = $i_name ->findnodes('./text()')->to_literal ;
232
 
233
          my $New_cmd =  "  ${gen_generatorExe}  -envidentifier $gen_envidentifier      ${cmd}\n";
234
          if(${gen_generatorExe} )
235
              {
236
              push  @cmd_list, "${gen_phase}::$New_cmd";
237
              }
238
          }
239
       }
240
     }
241
   }
242
 
243
 
244
 
245
               my $manager = new Parallel::ForkManager( $number_of_cpus );
246
               @cmd_list      = sys::lib::trim_sort(@cmd_list);
247
               my $cmd;
248
               my $phase;
249
 
250
               foreach my $Cmd_line (@cmd_list)
251
                   {
252
                   ( $phase,$cmd) = split( /\::/ , $Cmd_line);
253
                   $manager->start and next;
254
                   if (system($cmd)) {}
255
                   $manager->finish;
256
                   }
257
 
258
               $manager->wait_all_children;
259
               print "Software COMPLETE \n";
260
               }
261
 
262 131 jt_eaton
}
263
 
264
}
265
 
266
 
267
 
268
   return(0);
269 133 jt_eaton
}
270 131 jt_eaton
 
271 133 jt_eaton
 
272
 
273
 
274
 
275
 
276
 
277
 
278
 
279
 
280
 
281
 
282
 
283
 
284
 
285
 
286
 
287
 
288
 
289
 
290
 
291
 

powered by: WebSVN 2.1.0

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