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

Subversion Repositories socgen

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

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
 
58 117 jt_eaton
 
59 119 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 119 jt_eaton
my $home    = cwd();
68
my $root    = $ARGV[0];
69
my $prefix  = $ARGV[1];
70 100 jt_eaton
 
71 119 jt_eaton
chomp($root);
72
chomp($prefix);
73 100 jt_eaton
 
74
 
75 119 jt_eaton
$_ = $root;
76 100 jt_eaton
 
77 119 jt_eaton
if(/\/(\S+)\/(\S+)\/(\S+)/)
78
     {
79
     $projects_dir   = $1;
80
     $vendor         = $2;
81
     $project        = $3;
82
     }
83 100 jt_eaton
 
84 119 jt_eaton
$root = "${projects_dir}/${vendor}/${project}/";
85 94 jt_eaton
 
86
 
87 119 jt_eaton
unless ( -e $root )
88
     {
89
     print "ERROR: Project   $root  does not exist \n";
90
     exit(0);
91
     }
92 117 jt_eaton
 
93 118 jt_eaton
 
94 119 jt_eaton
unless (  $prefix )
95
     {
96
     $prefix   = "/work";
97
     }
98 118 jt_eaton
 
99 119 jt_eaton
 
100
my $path = "${home}${prefix}";
101
 
102 100 jt_eaton
mkdir $path,0755          unless( -e $path );
103
 
104
 
105 119 jt_eaton
$path    = "${home}${prefix}/${vendor}__${project}";
106 100 jt_eaton
mkdir $path,0755          unless( -e $path );
107
 
108
 
109 119 jt_eaton
print "Building Workspace ${prefix}/${vendor}__${project} from   ./${projects_dir}/${vendor}/${project}/   \n";
110 94 jt_eaton
 
111
 
112 119 jt_eaton
&link_sub( $root,$root, ".${prefix}/${vendor}__${project}" );
113 94 jt_eaton
 
114 119 jt_eaton
 
115 94 jt_eaton
#/*********************************************************************************************/
116
#/                                                                                            */
117
#/ Each project is given access to the system tools by giving each of them a link to the      */
118
#/ Master Makefiles in tools/bin                                                              */
119
#/                                                                                            */
120
#/                                                                                            */
121
#/*********************************************************************************************/
122
 
123
 
124
 
125 119 jt_eaton
if (system("chmod 755    ${home}/${projects_dir}/${vendor}/${project}/bin/* \n"   )) {}
126 94 jt_eaton
 
127 100 jt_eaton
 
128 119 jt_eaton
symlink( "${home}/tools/bin/Makefile.root", "${home}${prefix}/${vendor}__${project}/bin/Makefile.root");
129
symlink( "${home}/tools/bin/Makefile",      "${home}${prefix}/${vendor}__${project}/bin/Makefile");
130 94 jt_eaton
 
131
 
132 96 jt_eaton
 
133 119 jt_eaton
my $path  = "${home}${prefix}/${vendor}__${project}/children";
134
mkdir $path,0755          unless( -e $path );
135 96 jt_eaton
 
136 117 jt_eaton
 
137 95 jt_eaton
 
138 119 jt_eaton
my @components =       yp::lib::find_components("socgen:ip",$vendor,$project);
139
foreach my $component (@components)
140
   {
141
   my $parser = XML::LibXML->new();
142 94 jt_eaton
 
143 119 jt_eaton
   my $socgen_ip_file     = $parser->parse_file(yp::lib::find_socgen("socgen:ip",$vendor,$project,$component));
144
   my @versions =       yp::lib::find_versions("spirit:component",$vendor,$project,$component);
145 117 jt_eaton
 
146 119 jt_eaton
   foreach $comp_version (@versions)
147
     {
148
     $cmd ="./tools/sys/soc_link_child -prefix $prefix -vendor $vendor -project $project  -component $component -version $comp_version $projects_dir  \n";
149
     if (system($cmd)) {}
150
     }
151 99 jt_eaton
 
152 119 jt_eaton
   print "Linking simulations for  $vendor  $project  $component      \n";
153 94 jt_eaton
 
154 119 jt_eaton
   foreach  my   $i_name ($socgen_ip_file->findnodes("//socgen:testbenches/socgen:testbench/socgen:version"))
155
      {
156 94 jt_eaton
 
157 119 jt_eaton
      my($tb_version)  = $i_name ->findnodes('./text()')->to_literal ;
158 94 jt_eaton
 
159 119 jt_eaton
      $cmd ="./tools/sys/soc_link_child -prefix $prefix -vendor ${vendor}  -project $project  -component $component       -version $tb_version  $projects_dir  \n";
160
      if (system($cmd)) {}
161
      }
162 117 jt_eaton
 
163 119 jt_eaton
   #/*********************************************************************************************/
164
   #/   link chip files for synthesys                                                            */
165
   #/                                                                                            */
166
   #/                                                                                            */
167
   #/                                                                                            */
168
   #/                                                                                            */
169
   #/                                                                                            */
170
   #/*********************************************************************************************/
171
 
172
   print "Linking synthesys targets for  $vendor  $project  $component      \n";
173
   my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$project);
174 117 jt_eaton
 
175 119 jt_eaton
 
176
   foreach  my   $i_name ($socgen_ip_file->findnodes("//socgen:chips/socgen:chip/socgen:name"))
177
      {
178
      my($chip_name)  = $i_name ->findnodes('./text()')->to_literal ;
179
      my($chip_target)  = $i_name ->findnodes('../socgen:target/socgen:library/text()')->to_literal ;
180
      my($chip_part)  = $i_name ->findnodes('../socgen:target/socgen:part/text()')->to_literal ;
181
      $outfile ="${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}/syn/ise/${chip_name}/Makefile";
182
      open  MAKSYNFILE,">$outfile" or die "unable to open $outfile";
183
      print MAKSYNFILE  "include ../../../../../bin/Makefile.root\n";
184
      print MAKSYNFILE  "Part=${chip_part}\n";
185
      print MAKSYNFILE  "board=${chip_target}\n";
186
      print MAKSYNFILE  "Design=${chip_name}\n";
187
      my $path  = "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}/syn/ise/${chip_name}/target";
188
      mkdir $path,0755          unless( -e $path );
189
      &sys::lib::link_dir( "${home}/tools/synthesys/targets/ip/${chip_target}", "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}/syn/ise/${chip_name}/target"  );
190
      &sys::lib::link_dir( "${home}/tools/Jtag_programmers/debug", "${home}${prefix}/${vendor}__${project}${lib_comp_sep}/${component}/syn/ise/${chip_name}/debug"  );
191
      }
192
   }
193
 
194 94 jt_eaton
 
195
 
196 118 jt_eaton
 
197
 
198 94 jt_eaton
#/*********************************************************************************************/
199 117 jt_eaton
#/   recursively map directory information                                                    */
200 94 jt_eaton
#/                                                                                            */
201
#/                                                                                            */
202
#/                                                                                            */
203
#/                                                                                            */
204
#/                                                                                            */
205
#/*********************************************************************************************/
206
 
207
 
208
sub link_sub {
209
    my $root = shift;
210
    my $path = shift;
211
    my $dest = shift;
212
    return unless( -e $path );
213
 
214
    my $dest_path = $path;
215
      $dest_path =~ s/$root/$dest/;
216
 
217 119 jt_eaton
    if( -d $path )
218
      {
219
      mkdir $dest_path,0755;
220 94 jt_eaton
 
221 119 jt_eaton
      my @contents = (  );
222
      opendir( DIR, $path );
223
      while( my $item = readdir( DIR ))
224
           {
225
           next if( $item eq '.' or $item eq '..'   or $item eq '.svn'    );
226
           push( @contents, $item );
227
           }
228
      closedir( DIR );
229 94 jt_eaton
 
230 119 jt_eaton
      # recurse on items in the directory
231
      foreach my $item ( @contents )          { &link_sub($root, "$path/$item", $dest );}
232 94 jt_eaton
 
233
 
234 119 jt_eaton
      }
235
    else
236
      {
237
       symlink( "${home}/${path}", $dest_path);
238
      }
239 94 jt_eaton
}
240
 
241
 

powered by: WebSVN 2.1.0

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