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

Subversion Repositories socgen

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

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

Line No. Rev Author Line
1 117 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
############################################################################
66
### Process the options
67
############################################################################
68
 
69
Getopt::Long::config("require_order", "prefix=-");
70
GetOptions("h","help",
71
           "prefix=s" => \$prefix,
72
           "vendor=s" => \$vendor,
73 131 jt_eaton
           "library=s" => \$library,
74 117 jt_eaton
           "component=s" => \$component,
75
           "version=s" => \$version
76
) || die "(use '$program_name -h' for help)";
77
 
78
 
79
##############################################################################
80
## Help option
81
##############################################################################
82 131 jt_eaton
if ( $opt_h or $opt_help )   { print "\n build_generate -prefix /work -vendor vendor_name -library library_name -component component_name -version version_name ";
83 117 jt_eaton
    print "\n";
84
    exit 1;
85
  }
86
 
87
 
88
##############################################################################
89
##
90
##############################################################################
91
 
92
 
93
my $home = cwd();
94
 
95 133 jt_eaton
my @cmd_list  = ();
96 119 jt_eaton
 
97 133 jt_eaton
 
98 117 jt_eaton
#############################################################################
99
##
100
##
101
#############################################################################
102
 
103
 
104
 
105
 
106
 
107
my $parser = XML::LibXML->new();
108
 
109 131 jt_eaton
my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$library,$component);
110 117 jt_eaton
 
111 128 jt_eaton
 
112
 
113
 
114
 
115
 
116
 
117
 
118
 
119
#/*********************************************************************************************/
120
#/                                                                                            */
121
#/  Create filelists for simulation, synthesis and linting                                    */
122
#/                                                                                            */
123
#/                                                                                            */
124
#/*********************************************************************************************/
125
 
126 131 jt_eaton
my  @filelist =       yp::lib::parse_component_brothers("$vendor","$library","$component","$version");
127 128 jt_eaton
 
128
foreach $line (@filelist)
129
   {
130
   $_ = $line;
131
   if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
132
     {
133 131 jt_eaton
     $new_library        = $2;
134 128 jt_eaton
     $new_component      = $3;
135
     $new_vendor         = $1;
136
     $new_version        = $4;
137
 
138 133 jt_eaton
 
139 131 jt_eaton
     my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_component,$new_version));
140 128 jt_eaton
 
141
     foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:componentGenerator/spirit:name"))
142 117 jt_eaton
       {
143 128 jt_eaton
       my($gen_name)            = $i_name ->findnodes('../spirit:name/text()')->to_literal ;
144
       my($gen_generatorExe)    = $i_name ->findnodes('../spirit:generatorExe/text()')->to_literal ;
145 133 jt_eaton
       my($gen_phase)           = $i_name ->findnodes('../spirit:phase/text()')->to_literal ;
146 117 jt_eaton
 
147 128 jt_eaton
       my $cmd;
148 131 jt_eaton
       $cmd = "   -prefix $prefix -vendor $vendor     -library $library  -component $component -version $version  ";
149 117 jt_eaton
 
150 128 jt_eaton
       foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:componentGenerator[spirit:name/text() = '$gen_name']/spirit:parameters/spirit:parameter"))
151 117 jt_eaton
          {
152 128 jt_eaton
          my($gen_param)             = $i_name ->findnodes('./spirit:value/text()')->to_literal ;
153
          my($gen_param_name)        = $i_name ->findnodes('./spirit:name/text()')->to_literal ;
154 117 jt_eaton
 
155 131 jt_eaton
          if   ($gen_param_name eq "in_pipe")     {$cmd =  "$cmd <${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}/${gen_param}";}
156
          elsif($gen_param_name eq "out_pipe")    {$cmd =  "$cmd >${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}/${gen_param}";}
157 128 jt_eaton
          elsif($gen_param_name)                  {$cmd =  "$cmd -${gen_param_name} $gen_param ";}
158
          else                                    {$cmd =  "$cmd $gen_param";}
159
          }
160 117 jt_eaton
 
161 128 jt_eaton
       foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:componentGenerator[spirit:name/text() = '$gen_name']/spirit:vendorExtensions/socgen:envIdentifier"))
162
          {
163
          my($gen_envidentifier)  = $i_name ->findnodes('./text()')->to_literal ;
164
 
165
          my $New_cmd =  "  ${gen_generatorExe}  -envidentifier $gen_envidentifier      ${cmd}\n";
166
          if(${gen_generatorExe} )
167 131 jt_eaton
              {
168 133 jt_eaton
              push  @cmd_list, "${gen_phase}::$New_cmd";
169
#              if (system($New_cmd)) {}
170 128 jt_eaton
              }
171 117 jt_eaton
          }
172
       }
173 128 jt_eaton
     }
174
   }
175 117 jt_eaton
 
176 133 jt_eaton
@cmd_list      = sys::lib::trim_sort(@cmd_list);
177
my $cmd;
178
my $phase;
179 117 jt_eaton
 
180 133 jt_eaton
foreach my $Cmd_line (@cmd_list)
181
{
182 117 jt_eaton
 
183 133 jt_eaton
( $phase,$cmd) = split( /\::/ , $Cmd_line);
184 117 jt_eaton
 
185 133 jt_eaton
if (system($cmd)) {}
186
}
187 117 jt_eaton
 
188 133 jt_eaton
 
189
 
190
 
191 117 jt_eaton
1
192
 
193
 
194
 
195
 
196
 
197
 
198
 
199
 
200
 
201
 
202
 
203
 
204
 
205
 
206
 

powered by: WebSVN 2.1.0

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