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

Subversion Repositories socgen

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

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 117 jt_eaton
$lib_comp_sep = "/ip";
81 94 jt_eaton
 
82
 
83 117 jt_eaton
 
84 100 jt_eaton
my $path  = "${home}${prefix}";
85
mkdir $path,0755          unless( -e $path );
86
 
87
 
88
 
89
$path    = "${home}${prefix}${project}";
90
mkdir $path,0755          unless( -e $path );
91
 
92
 
93 94 jt_eaton
print "Building a work area for ${home}/${root} in ${home}${prefix}  \n" ;
94
 
95 100 jt_eaton
&link_sub( $root,$root, "work/${project}" );
96 94 jt_eaton
 
97
 
98
#/*********************************************************************************************/
99
#/                                                                                            */
100
#/ Each project is given access to the system tools by giving each of them a link to the      */
101
#/ Master Makefiles in tools/bin                                                              */
102
#/                                                                                            */
103
#/ Every component in a project is given access to the system testbench/models and CDE        */
104
#/ library files via symbolic links                                                           */
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
        $cmd ="./tools/sys/soc_link_child -vendor $vendor -project $project -lib_comp_sep $lib_comp_sep -component $component -version $comp_version   /n";
146
        if (system($cmd)) {}
147
        }
148 94 jt_eaton
 
149 117 jt_eaton
 
150
 
151
      foreach  my   $i_name ($socgen_ip_file->findnodes("//testbenchs/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 117 jt_eaton
         $cmd ="./tools/sys/soc_link_child -vendor ${vendor}  -project $project -lib_comp_sep $lib_comp_sep -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
         my($chip)  = $i_name ->findnodes('./text()')->to_literal ;
173
         my($chip_target)  = $i_name ->findnodes('../target/text()')->to_literal ;
174 117 jt_eaton
         my($configuration)  = $i_name ->findnodes('../configuration/text()')->to_literal;
175 99 jt_eaton
         my($variant)  = $i_name ->findnodes('../variant/text()')->to_literal ;
176
 
177 117 jt_eaton
         $outfile ="${home}${prefix}${project}${lib_comp_sep}/${component}/syn/ise/${chip}/Makefile";
178 99 jt_eaton
         open  MAKSYNFILE,">$outfile" or die "unable to open $outfile";
179
 
180
         print MAKSYNFILE  "include ../../../../../bin/Makefile.root\n";
181
         print MAKSYNFILE  "include ./target/Makefile.brd\n";
182
         print MAKSYNFILE  "board=${chip_target}\n";
183
         print MAKSYNFILE  "Design=${chip_target}_${configuration}\n";
184 117 jt_eaton
         my $path  = "${home}${prefix}${project}${lib_comp_sep}/${component}/syn/ise/${chip}/target";
185 99 jt_eaton
         mkdir $path,0755          unless( -e $path );
186
 
187 117 jt_eaton
         &link_dir( "${home}/projects/${vendor}/targets/ip/${chip_target}", "${home}${prefix}${project}${lib_comp_sep}/${component}/syn/ise/${chip}/target"  );
188
         &link_dir( "${home}/projects/${vendor}/cde/ip",                            "${home}${prefix}${project}${lib_comp_sep}/${component}/syn/ise/${chip}/target/lib/ip"  );
189
         &link_dir( "${home}/tools/Jtag_programmers/debug",               "${home}${prefix}${project}${lib_comp_sep}/${component}/syn/ise/${chip}/debug"  );
190 94 jt_eaton
         }
191
      }
192
   }
193
 
194
#/*********************************************************************************************/
195 117 jt_eaton
#/   recursively map directory information                                                    */
196 94 jt_eaton
#/                                                                                            */
197
#/                                                                                            */
198
#/                                                                                            */
199
#/                                                                                            */
200
#/                                                                                            */
201
#/*********************************************************************************************/
202
 
203
 
204
sub link_sub {
205
    my $root = shift;
206
    my $path = shift;
207
    my $dest = shift;
208
    return unless( -e $path );
209
 
210
    my $dest_path = $path;
211
      $dest_path =~ s/$root/$dest/;
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
# recursively map directory information
246
 
247
sub link_dir {
248
    my $src  = shift;
249
    my $dest = shift;
250
    return unless( -e $src );
251
 
252
    if( -d $src )
253
        {
254
 
255
        mkdir $dest,0755;
256
        my @contents = (  );
257
        opendir( DIR, $src );
258
        while( my $item = readdir( DIR ))
259
            {
260
            next if( $item eq '.' or $item eq '..'   or $item eq '.svn'    );
261
            push( @contents, $item );
262
            }
263
        closedir( DIR );
264
 
265
        # recurse on items in the directory
266
        foreach my $item ( @contents )          { &link_dir("$src/$item", "$dest/$item" );}
267
 
268
       }
269
       else  {symlink( "${src}", "${dest}") unless( -e "${dest}" ); }
270
}
271
 

powered by: WebSVN 2.1.0

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