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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [sys/] [build_hw_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
 
59
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
60
 
61
 
62
############################################################################
63
### Process the options
64
############################################################################
65
Getopt::Long::config("require_order", "prefix=-");
66
GetOptions("h","help",
67
) || die "(use '$program_name -h' for help)";
68
 
69
 
70
 
71
 
72
##############################################################################
73
## Help option
74
##############################################################################
75
if ( $opt_h or $opt_help  )
76
  { print "\n build_master";
77
    print "\n";
78
    exit 1;
79
  }
80
 
81
 
82
my $parser = XML::LibXML->new();
83
 
84
 
85
my      @kids          = (  );
86
my      @filelist      = (  );
87
 
88
 
89
 
90
#/**********************************************************************/
91
#/*  Process each library by finding any ip-xact file in any component */
92
#/*                                                                    */
93
#/*  Each ip-xact file is parsed and it's filename and the names of any*/
94
#/*  modules that it uses are saved.                                   */
95
#/*                                                                    */
96
#/*                                                                    */
97
#/**********************************************************************/
98
 
99
my $home = cwd();
100
 
101
my $prefix   = yp::lib::get_workspace();
102
   $prefix   = "/${prefix}";
103
 
104
my @vendors = yp::lib::find_vendors();
105
 
106
foreach my $vendor (@vendors)
107
 {
108
 my $vendor_status    =  yp::lib::get_vendor_status($vendor);
109
 if($vendor_status eq "active")
110
   {
111
   my @libraries = yp::lib::find_libraries($vendor);
112
   foreach my $library (@libraries)
113
     {
114
     my $library_status   =  yp::lib::get_library_status($vendor,$library);
115
     if($library_status eq "active")
116
         {
117
         run_vendor_library ( $vendor ,  $library)
118
         }
119
     }
120
   }
121
 }
122
 
123
 
124
 
125
 
126
sub run_vendor_library
127
   {
128
   my @params     = @_;
129
   my $library    = pop(@params);
130
   my $vendor     = pop(@params);
131 133 jt_eaton
 
132
 
133
 
134
 
135
 
136
 
137
my $prefix   = yp::lib::get_workspace();
138
   $prefix   = "/${prefix}";
139
 
140
 
141
 
142
my      @kids          = (  );
143
my      @filelist      = (  );
144
my      @cmd_list      = (  );
145
 
146
my @components   = yp::lib::find_components($vendor,$library);
147
 
148
foreach my $component (@components)
149
   {
150
 
151
   my $socgen_filename     = yp::lib::find_componentConfiguration($vendor,$library,$component);
152
   if($socgen_filename)
153
   {
154
   my $socgen_file     = $parser->parse_file($socgen_filename);
155
 
156
   #/*********************************************************************************************/
157
   #/   files for simulation                                                                     */
158
   #/                                                                                            */
159
   #/*********************************************************************************************/
160
 
161
   foreach  my   $i_name ($socgen_file->findnodes("//socgen:sim/socgen:testbenches/socgen:testbench/socgen:version"))
162
      {
163
      my $tb_version   = $i_name ->findnodes('./text()')->to_literal ;
164
      my $tb_variant   = "${component}_${tb_version}";
165
 
166
      foreach  my   $i_name ($socgen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$tb_variant']/socgen:tools/socgen:tool"))
167
      {
168
 
169
      my $tb_tool   = $i_name ->findnodes('./text()')->to_literal ;
170
 
171
      if( ($tb_tool eq "icarus") ||  ($tb_tool eq "verilator") ||  ($tb_tool eq "rtl_check"))
172
 
173
       {
174
        @filelist      = (  );
175
        @filelist      = yp::lib::parse_component_file("$vendor","$library","$component","$tb_version");
176
 
177
        foreach $line (@filelist)
178
          {
179
          $_ = $line;
180
          if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
181
            {
182
            $new_vendor    = $1;
183
            $new_proj      = $2;
184
            $new_comp      = $3;
185
            $new_version   = $4;
186
            }
187
         if( ($vendor eq  $new_vendor)   &&  ( $library eq  $new_proj)   && ( $component eq  $new_comp )   &&   ( $tb_version eq  $new_version )        )
188
           {
189
           push @kids , "::${prefix}::${library}::${component}::${vendor}::${tb_version}::";
190
           }
191
         else
192
           {
193
           push @kids , "::${prefix}/${vendor}__${library}/children::${new_proj}::${new_comp}::${new_vendor}::${new_version}::";
194
           }
195
          }
196
       }
197
 
198
 
199
      if($tb_tool eq "coverage")
200
        {
201
        print "  SIM COVERAGE testbench  $vendor    $library  $component   $tb_variant  \n";
202
        $cmd ="./tools/simulation/build_coverage -work_site $prefix -vendor $vendor -library  $library  -component  $component  -version $tb_version \n";
203
        if (system($cmd)) {}
204
        }
205
      elsif($tb_tool eq "icarus")
206
        {
207
        print "  SIM ICARUS testbench  $vendor    $library  $component   $tb_variant  \n";
208
        $cmd ="./tools/simulation/build_icarus_filelists  -work_site $prefix -vendor $vendor -library $library -component $component -version $tb_version \n";
209
        if (system($cmd)) {}
210
        }
211
      elsif($tb_tool eq "verilator")
212
        {
213
        print "  SIM VERILATOR testbench  $vendor    $library  $component   $tb_variant  \n";
214
        $cmd ="./tools/simulation/build_verilator_filelists -work_site $prefix -vendor $vendor -library $library -component $component -version $tb_version \n";
215
        if (system($cmd)) {}
216
        }
217
      elsif($tb_tool eq "rtl_check")
218
        {
219
        print "  SIM RTL_CHECK testbench  $vendor    $library  $component   $tb_variant  \n";
220
        $cmd ="./tools/simulation/build_lint_filelists  -work_site $prefix -vendor $vendor -library $library  -component $component -version $tb_version \n";
221
        if (system($cmd)) {}
222
        }
223
      }
224
 
225
      }
226
 
227
 
228
   #/*********************************************************************************************/
229
   #/   files for synthesys                                                                      */
230
   #/                                                                                            */
231
   #/*********************************************************************************************/
232
 
233
   foreach  my   $i_name ($socgen_file->findnodes("//socgen:syn/socgen:ise/socgen:chip/socgen:name"))
234
      {
235
        my $ise_name   = $i_name ->findnodes('./text()')->to_literal ;
236
        print "  SYN ISE   $vendor    $library  $component   $ise_name  \n";
237
 
238
        @filelist      = (  );
239
        @filelist      = yp::lib::parse_component_file("$vendor","$library","$component","$ise_name");
240
 
241
        foreach $line (@filelist)
242
          {
243
          $_ = $line;
244
          if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
245
            {
246
            $new_vendor    = $1;
247
            $new_proj      = $2;
248
            $new_comp      = $3;
249
            $new_version   = $4;
250
            }
251
 
252
         if( ($vendor eq  $new_vendor)   &&  ( $library eq  $new_proj)   && ( $component eq  $new_comp )   &&   ( $ise_name eq  $new_version )        )
253
           {
254
           push @kids , "::${prefix}::${library}::${component}::${vendor}::${ise_name}::";
255
           }
256
         else
257
           {
258
           push @kids , "::${prefix}/${vendor}__${library}/children::${new_proj}::${new_comp}::${new_vendor}::${new_version}::";
259
           }
260
          }
261
      }
262
 
263
   }
264
}
265
 
266
 
267
 
268
 
269
#/**********************************************************************/
270
#/*                                                                    */
271
#/* Sort out the duplicate names and then build the rtl for every      */
272
#/* component needed for simulations or synthesys                      */
273
#/*                                                                    */
274
#/**********************************************************************/
275
 
276
 
277
@kids =  sys::lib::trim_sort(@kids);
278
foreach my $kid (@kids)
279
   {
280
   $_ = $kid;
281
 
282
   if(/::(\S+)::(\S+)::(\S+)::(\S+)::(\S+)::/)
283
     {
284
     my $kid_prefix           = $1;
285
     my $kid_library          = $2;
286
     my $kid_component        = $3;
287
     my $kid_vendor           = $4;
288
     my $kid_version          = $5;
289
 
290
 
291
 
292
 
293
 
294
 
295
 
296
 
297
#############################################################################
298
##
299
##
300
#############################################################################
301
 
302
 
303
 
304
 
305
my $lib_comp_sep    = yp::lib::find_lib_comp_sep($kid_vendor,$kid_library,$kid_component);
306
 
307
 
308
 
309
 
310
 
311
 
312
 
313
 
314
 
315
#/*********************************************************************************************/
316
#/                                                                                            */
317
#/  Create filelists for simulation, synthesis and linting                                    */
318
#/                                                                                            */
319
#/                                                                                            */
320
#/*********************************************************************************************/
321
 
322
my  @filelist =       yp::lib::parse_component_brothers("$kid_vendor","$kid_library","$kid_component","$kid_version");
323
 
324
foreach $line (@filelist)
325
   {
326
   $_ = $line;
327
   if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
328
     {
329
     $new_library        = $2;
330
     $new_component      = $3;
331
     $new_vendor         = $1;
332
     $new_version        = $4;
333
 
334
 
335
     my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_component,$new_version));
336
 
337
     foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:componentGenerator/spirit:name"))
338
       {
339
       my($gen_name)            = $i_name ->findnodes('../spirit:name/text()')->to_literal ;
340
       my($gen_generatorExe)    = $i_name ->findnodes('../spirit:generatorExe/text()')->to_literal ;
341
       my($gen_phase)           = $i_name ->findnodes('../spirit:phase/text()')->to_literal ;
342
 
343
 
344
       my $cmd;
345
       $cmd = "   -prefix $kid_prefix -vendor $kid_vendor     -library $kid_library  -component $kid_component -version $kid_version  ";
346
 
347
       foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:componentGenerator[spirit:name/text() = '$gen_name']/spirit:parameters/spirit:parameter"))
348
          {
349
          my($gen_param)             = $i_name ->findnodes('./spirit:value/text()')->to_literal ;
350
          my($gen_param_name)        = $i_name ->findnodes('./spirit:name/text()')->to_literal ;
351
 
352
          if   ($gen_param_name eq "in_pipe")     {$cmd =  "$cmd <${home}${kid_prefix}/${kid_vendor}__${kid_library}${lib_comp_sep}${kid_component}/${gen_param}";}
353
          elsif($gen_param_name eq "out_pipe")    {$cmd =  "$cmd >${home}${kid_prefixn}/${kid_vendor}__${kid_library}${lib_comp_sep}${kid_component}/${gen_param}";}
354
          elsif($gen_param_name)                  {$cmd =  "$cmd -${gen_param_name} $gen_param ";}
355
          else                                    {$cmd =  "$cmd $gen_param";}
356
          }
357
 
358
       foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:componentGenerator[spirit:name/text() = '$gen_name']/spirit:vendorExtensions/socgen:envIdentifier"))
359
          {
360
          my($gen_envidentifier)  = $i_name ->findnodes('./text()')->to_literal ;
361
 
362
          my $New_cmd =  "  ${gen_generatorExe}  -envidentifier $gen_envidentifier      ${cmd}\n";
363
          if(${gen_generatorExe} )
364
              {
365
              push  @cmd_list, "${gen_phase}::$New_cmd";
366
              }
367
          }
368
       }
369
     }
370
   }
371
 
372
 
373
 
374
 
375
 
376
 
377
 
378
 
379
     }
380
 
381
   }
382
 
383
 
384
 
385
 
386
@cmd_list      = sys::lib::trim_sort(@cmd_list);
387
my $cmd;
388
my $phase;
389
 
390
foreach my $Cmd_line (@cmd_list)
391
{
392
 
393
( $phase,$cmd) = split( /\::/ , $Cmd_line);
394
if (system($cmd)) {}
395
}
396
 
397
 
398
 
399 131 jt_eaton
   return(0);
400 133 jt_eaton
}
401
 
402
 
403
 
404
 
405
 
406
 
407
 
408
 
409
 
410
 
411
 
412
 
413
 
414
 
415
 

powered by: WebSVN 2.1.0

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