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

Subversion Repositories socgen

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

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 95 jt_eaton
 
107
      $cmd ="./tools/sys/build_geda   $project  $component  /n";
108
      if (system($cmd)) {}
109
 
110 94 jt_eaton
      my $parser = XML::LibXML->new();
111
      my $doc    = $parser->parse_file("${home}${prefix}${project}${lib_comp_sep}${component}/soc/design.soc");
112
 
113
         {
114
 
115
         #/*********************************************************************************************/
116
         #/                                                                                            */
117
         #/                                                                                            */
118
         #/*********************************************************************************************/
119
 
120
 
121
 
122
 
123
 
124 95 jt_eaton
#         foreach  my   $i_name ($doc->findnodes("//components/component/name"))
125
#            {
126
#            my($comp_name)  = $i_name ->findnodes('./text()')->to_literal ;
127
#            my($comp_version)  = $i_name ->findnodes('../version/text()')->to_literal ;
128
#            my($variant)  = $i_name ->findnodes('../variant/text()')->to_literal ;
129
#            $cmd ="./tools/sys/build_geda   $project  $component  /n";
130
#            if (system($cmd)) {}
131
#            }
132 94 jt_eaton
 
133
 
134
 
135
 
136
 
137 95 jt_eaton
 
138
 
139 94 jt_eaton
         foreach  my   $i_name ($doc->findnodes("//components/component/name"))
140
            {
141
            my($comp_name)  = $i_name ->findnodes('./text()')->to_literal ;
142
            my($comp_version)  = $i_name ->findnodes('../version/text()')->to_literal ;
143
            my($variant)  = $i_name ->findnodes('../variant/text()')->to_literal ;
144
            $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";
145
            if (system($cmd)) {}
146
            }
147
 
148
 
149
         foreach  my   $i_name ($doc->findnodes("//testbenchs/testbench/name"))
150
            {
151
            my($tb_name)  = $i_name ->findnodes('./text()')->to_literal ;
152
            my($tb_version)  = $i_name ->findnodes('../version/text()')->to_literal ;
153
            my($tb_variant)  = $i_name ->findnodes('../variant/text()')->to_literal ;
154
            $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";
155
            if (system($cmd)) {}
156
            }
157
 
158
 
159
         #/*********************************************************************************************/
160
         #/   link chip files for synthesys                                                            */
161
         #/                                                                                            */
162
         #/                                                                                            */
163
         #/                                                                                            */
164
         #/                                                                                            */
165
         #/                                                                                            */
166
         #/*********************************************************************************************/
167
 
168
         print "Linking targets for   $project  $component      \n";
169
         foreach  my   $i_name ($doc->findnodes("//chips/chip/name"))
170
            {
171
            my($chip)  = $i_name ->findnodes('./text()')->to_literal ;
172
            my($chip_target)  = $i_name ->findnodes('../target/text()')->to_literal ;
173
            my($configuration)  = $i_name ->findnodes('../configuration/text()')->to_literal ;
174
            my($variant)  = $i_name ->findnodes('../variant/text()')->to_literal ;
175
 
176
            $outfile ="${home}${prefix}${project}${lib_comp_sep}${component}/syn/${chip}/Makefile";
177
            open  MAKSYNFILE,">$outfile" or die "unable to open $outfile";
178
 
179
            print MAKSYNFILE  "include ../../../../bin/Makefile.root\n";
180
            print MAKSYNFILE  "include ./target/Makefile.brd\n";
181
            print MAKSYNFILE  "board=${chip_target}\n";
182
            print MAKSYNFILE  "Design=${chip_target}_${configuration}\n";
183
            my $path  = "${home}${prefix}${project}${lib_comp_sep}${component}/syn/${chip}/target";
184
            mkdir $path,0755          unless( -e $path );
185
 
186 95 jt_eaton
            &link_dir( "${home}/projects/targets/ip/${chip_target}", "${home}${prefix}${project}${lib_comp_sep}${component}/syn/${chip}/target"  );
187 94 jt_eaton
            &link_dir( "${home}/projects/cde/ip",                            "${home}${prefix}${project}${lib_comp_sep}${component}/syn/${chip}/target/lib/ip"  );
188
            &link_dir( "${home}/tools/Jtag_programmers/debug",               "${home}${prefix}${project}${lib_comp_sep}${component}/syn/${chip}/debug"  );
189
            }
190
         }
191
      }
192
   }
193
 
194
 
195
 
196
#/*********************************************************************************************/
197
#/                                                                                            */
198
#/                                                                                            */
199
#/                                                                                            */
200
#/                                                                                            */
201
#/                                                                                            */
202
#/                                                                                            */
203
#/*********************************************************************************************/
204
 
205
 
206
# recursively map directory information
207
 
208
sub link_sub {
209
    my $root = shift;
210
    my $path = shift;
211
    my $dest = shift;
212
    return unless( -e $path );
213
 
214
 
215
    my $dest_path = $path;
216
      $dest_path =~ s/$root/$dest/;
217
 
218
 
219
    if( -d $path ) {
220
 
221
        mkdir $dest_path,0755;
222
 
223
        my @contents = (  );
224
        opendir( DIR, $path );
225
        while( my $item = readdir( DIR )) {
226
            next if( $item eq '.' or $item eq '..'   or $item eq '.svn'    );
227
            push( @contents, $item );
228
        }
229
        closedir( DIR );
230
 
231
        # recurse on items in the directory
232
        foreach my $item ( @contents )          { &link_sub($root, "$path/$item", $dest );}
233
 
234
 
235
    } else {
236
 
237
        symlink( "${home}/${path}", $dest_path);
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
#/                                                                                            */
264
#/                                                                                            */
265
#/                                                                                            */
266
#/                                                                                            */
267
#/*********************************************************************************************/
268
 
269
# recursively map directory information
270
 
271
sub link_dir {
272
    my $src  = shift;
273
    my $dest = shift;
274
    return unless( -e $src );
275
 
276
    if( -d $src )
277
        {
278
 
279
        mkdir $dest,0755;
280
        my @contents = (  );
281
        opendir( DIR, $src );
282
        while( my $item = readdir( DIR ))
283
            {
284
            next if( $item eq '.' or $item eq '..'   or $item eq '.svn'    );
285
            push( @contents, $item );
286
            }
287
        closedir( DIR );
288
 
289
        # recurse on items in the directory
290
        foreach my $item ( @contents )          { &link_dir("$src/$item", "$dest/$item" );}
291
 
292
 
293
       }
294
       else  {symlink( "${src}", "${dest}") unless( -e "${dest}" ); }
295
}
296
 
297
 
298
 
299
 
300
 
301
 
302
 
303
 
304
 
305
 
306
 

powered by: WebSVN 2.1.0

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