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

Subversion Repositories socgen

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

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

powered by: WebSVN 2.1.0

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