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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [sys/] [workspace] - Blame information for rev 94

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

Line No. Rev Author Line
1 94 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
#/*  Traverse a socgen project and link it                             */
15
#/*                                                                    */
16
#/*                                                                    */
17
#/*  Author(s):                                                        */
18
#/*      - John Eaton, jt_eaton@opencores.org                          */
19
#/*                                                                    */
20
#/**********************************************************************/
21
#/*                                                                    */
22
#/*    Copyright (C) <2010>                     */
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
 
50
 
51
 
52
use Cwd;
53
use XML::LibXML;
54
 
55
 
56
 
57
 
58
#/*********************************************************************************************/
59
#/ We never generate files into a RCS database.                                               */
60
#/                                                                                            */
61
#/ A special work area is created that is the image of the database using symbolic links      */
62
#/                                                                                            */
63
#/*********************************************************************************************/
64
 
65
my $root = "projects";
66
$home = cwd();
67
my  $prefix = "/work/";
68
$lib_comp_sep = "/ip/";
69
$comp_xml_sep = "/rtl/xml/";
70
$tb_xml_sep = "/sim/xml/";
71
 
72
 
73
print "Building a work area for ${home}/${root} in ${home}${prefix}  \n" ;
74
 
75
&link_sub( $root,$root, "work" );
76
 
77
 
78
#/*********************************************************************************************/
79
#/                                                                                            */
80
#/ Each project is given access to the system tools by giving each of them a link to the      */
81
#/ Master Makefiles in tools/bin                                                              */
82
#/                                                                                            */
83
#/ Every component in a project is given access to the system testbench/models and CDE        */
84
#/ library files via symbolic links                                                           */
85
#/                                                                                            */
86
#/*********************************************************************************************/
87
 
88
 
89
@projects = qx(ls  ${home}${prefix}    );
90
 
91
 
92
foreach my $project (@projects)
93
   {
94
   chomp($project);
95
   symlink( "${home}/tools/bin/Makefile.root", "${home}/work/${project}/bin/Makefile.root");
96
   symlink( "${home}/tools/bin/Makefile",      "${home}/work/${project}/bin/Makefile");
97
 
98
   $cmd ="chmod 755    ${home}/projects/${project}/bin/* \n";
99
   if (system($cmd)) {}
100
 
101
   my @components = qx(ls  ${home}/work/${project}/ip    );
102
   foreach my $component (@components)
103
      {
104
      chomp($component);
105
 
106
      my $parser = XML::LibXML->new();
107
      my $doc    = $parser->parse_file("${home}${prefix}${project}${lib_comp_sep}${component}/soc/design.soc");
108
 
109
         {
110
 
111
         #/*********************************************************************************************/
112
         #/                                                                                            */
113
         #/                                                                                            */
114
         #/*********************************************************************************************/
115
 
116
 
117
 
118
         foreach  my   $i_name ($doc->findnodes("//components/component/name"))
119
            {
120
            my($comp_name)  = $i_name ->findnodes('./text()')->to_literal ;
121
            my($comp_version)  = $i_name ->findnodes('../version/text()')->to_literal ;
122
            my($variant)  = $i_name ->findnodes('../variant/text()')->to_literal ;
123
            $cmd ="./tools/sys/build_geda   $project  $component  /n";
124
            if (system($cmd)) {}
125
            }
126
 
127
 
128
 
129
 
130
 
131
 
132
 
133
         foreach  my   $i_name ($doc->findnodes("//components/component/name"))
134
            {
135
            my($comp_name)  = $i_name ->findnodes('./text()')->to_literal ;
136
            my($comp_version)  = $i_name ->findnodes('../version/text()')->to_literal ;
137
            my($variant)  = $i_name ->findnodes('../variant/text()')->to_literal ;
138
            $cmd ="./tools/sys/soc_link_child -project $project -lib_comp_sep $lib_comp_sep -component $component -comp_xml_sep $comp_xml_sep -variant $variant $comp_xml_sep /n";
139
            if (system($cmd)) {}
140
            }
141
 
142
 
143
         foreach  my   $i_name ($doc->findnodes("//testbenchs/testbench/name"))
144
            {
145
            my($tb_name)  = $i_name ->findnodes('./text()')->to_literal ;
146
            my($tb_version)  = $i_name ->findnodes('../version/text()')->to_literal ;
147
            my($tb_variant)  = $i_name ->findnodes('../variant/text()')->to_literal ;
148
            $cmd ="./tools/sys/soc_link_child -project $project -lib_comp_sep $lib_comp_sep -component $component -comp_xml_sep $comp_xml_sep -variant $tb_variant $tb_xml_sep /n";
149
            if (system($cmd)) {}
150
            }
151
 
152
 
153
         #/*********************************************************************************************/
154
         #/   link chip files for synthesys                                                            */
155
         #/                                                                                            */
156
         #/                                                                                            */
157
         #/                                                                                            */
158
         #/                                                                                            */
159
         #/                                                                                            */
160
         #/*********************************************************************************************/
161
 
162
         print "Linking targets for   $project  $component      \n";
163
         foreach  my   $i_name ($doc->findnodes("//chips/chip/name"))
164
            {
165
            my($chip)  = $i_name ->findnodes('./text()')->to_literal ;
166
            my($chip_target)  = $i_name ->findnodes('../target/text()')->to_literal ;
167
            my($configuration)  = $i_name ->findnodes('../configuration/text()')->to_literal ;
168
            my($variant)  = $i_name ->findnodes('../variant/text()')->to_literal ;
169
 
170
            $outfile ="${home}${prefix}${project}${lib_comp_sep}${component}/syn/${chip}/Makefile";
171
            open  MAKSYNFILE,">$outfile" or die "unable to open $outfile";
172
 
173
            print MAKSYNFILE  "include ../../../../bin/Makefile.root\n";
174
            print MAKSYNFILE  "include ./target/Makefile.brd\n";
175
            print MAKSYNFILE  "board=${chip_target}\n";
176
            print MAKSYNFILE  "Design=${chip_target}_${configuration}\n";
177
            my $path  = "${home}${prefix}${project}${lib_comp_sep}${component}/syn/${chip}/target";
178
            mkdir $path,0755          unless( -e $path );
179
 
180
            &link_dir( "${home}/projects/${project}/targets/${chip_target}", "${home}${prefix}${project}${lib_comp_sep}${component}/syn/${chip}/target"  );
181
            &link_dir( "${home}/projects/cde/ip",                            "${home}${prefix}${project}${lib_comp_sep}${component}/syn/${chip}/target/lib/ip"  );
182
            &link_dir( "${home}/tools/Jtag_programmers/debug",               "${home}${prefix}${project}${lib_comp_sep}${component}/syn/${chip}/debug"  );
183
            }
184
         }
185
      }
186
   }
187
 
188
 
189
 
190
#/*********************************************************************************************/
191
#/                                                                                            */
192
#/                                                                                            */
193
#/                                                                                            */
194
#/                                                                                            */
195
#/                                                                                            */
196
#/                                                                                            */
197
#/*********************************************************************************************/
198
 
199
 
200
# recursively map directory information
201
 
202
sub link_sub {
203
    my $root = shift;
204
    my $path = shift;
205
    my $dest = shift;
206
    return unless( -e $path );
207
 
208
 
209
    my $dest_path = $path;
210
      $dest_path =~ s/$root/$dest/;
211
 
212
 
213
    if( -d $path ) {
214
 
215
        mkdir $dest_path,0755;
216
 
217
        my @contents = (  );
218
        opendir( DIR, $path );
219
        while( my $item = readdir( DIR )) {
220
            next if( $item eq '.' or $item eq '..'   or $item eq '.svn'    );
221
            push( @contents, $item );
222
        }
223
        closedir( DIR );
224
 
225
        # recurse on items in the directory
226
        foreach my $item ( @contents )          { &link_sub($root, "$path/$item", $dest );}
227
 
228
 
229
    } else {
230
 
231
        symlink( "${home}/${path}", $dest_path);
232
    }
233
}
234
 
235
 
236
 
237
 
238
 
239
 
240
 
241
 
242
 
243
 
244
 
245
 
246
 
247
 
248
 
249
 
250
 
251
 
252
 
253
 
254
#/*********************************************************************************************/
255
#/                                                                                            */
256
#/                                                                                            */
257
#/                                                                                            */
258
#/                                                                                            */
259
#/                                                                                            */
260
#/                                                                                            */
261
#/*********************************************************************************************/
262
 
263
# recursively map directory information
264
 
265
sub link_dir {
266
    my $src  = shift;
267
    my $dest = shift;
268
    return unless( -e $src );
269
 
270
    if( -d $src )
271
        {
272
 
273
        mkdir $dest,0755;
274
        my @contents = (  );
275
        opendir( DIR, $src );
276
        while( my $item = readdir( DIR ))
277
            {
278
            next if( $item eq '.' or $item eq '..'   or $item eq '.svn'    );
279
            push( @contents, $item );
280
            }
281
        closedir( DIR );
282
 
283
        # recurse on items in the directory
284
        foreach my $item ( @contents )          { &link_dir("$src/$item", "$dest/$item" );}
285
 
286
 
287
       }
288
       else  {symlink( "${src}", "${dest}") unless( -e "${dest}" ); }
289
}
290
 
291
 
292
 
293
 
294
 
295
 
296
 
297
 
298
 
299
 
300
 

powered by: WebSVN 2.1.0

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