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

Subversion Repositories socgen

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

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 124 jt_eaton
my @components =       yp::lib::find_components("socgen:componentConfiguration",$vendor,$project);
139 119 jt_eaton
foreach my $component (@components)
140
   {
141
   my $parser = XML::LibXML->new();
142 94 jt_eaton
 
143 124 jt_eaton
   my $sogen_file     = $parser->parse_file(yp::lib::find_socgen("socgen:componentConfiguration",$vendor,$project,$component));
144 119 jt_eaton
   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 124 jt_eaton
   foreach  my   $i_name ($sogen_file->findnodes("//socgen:sim/socgen:testbenches/socgen:testbench/socgen:version"))
155 119 jt_eaton
      {
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 127 jt_eaton
   my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$project,$component);
174 117 jt_eaton
 
175 119 jt_eaton
 
176 127 jt_eaton
   foreach  my   $i_name ($sogen_file->findnodes("//socgen:syn/socgen:ise/socgen:variant"))
177 119 jt_eaton
      {
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 128 jt_eaton
      print MAKSYNFILE  "include ${home}/tools/bin/Makefile.root\n";
184 119 jt_eaton
      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
      }
191
   }
192
 
193 94 jt_eaton
 
194
 
195 118 jt_eaton
 
196
 
197 94 jt_eaton
#/*********************************************************************************************/
198 117 jt_eaton
#/   recursively map directory information                                                    */
199 94 jt_eaton
#/                                                                                            */
200
#/                                                                                            */
201
#/                                                                                            */
202
#/                                                                                            */
203
#/                                                                                            */
204
#/*********************************************************************************************/
205
 
206
 
207
sub link_sub {
208
    my $root = shift;
209
    my $path = shift;
210
    my $dest = shift;
211
    return unless( -e $path );
212
 
213
    my $dest_path = $path;
214
      $dest_path =~ s/$root/$dest/;
215
 
216 119 jt_eaton
    if( -d $path )
217
      {
218
      mkdir $dest_path,0755;
219 94 jt_eaton
 
220 119 jt_eaton
      my @contents = (  );
221
      opendir( DIR, $path );
222
      while( my $item = readdir( DIR ))
223
           {
224
           next if( $item eq '.' or $item eq '..'   or $item eq '.svn'    );
225
           push( @contents, $item );
226
           }
227
      closedir( DIR );
228 94 jt_eaton
 
229 119 jt_eaton
      # recurse on items in the directory
230
      foreach my $item ( @contents )          { &link_sub($root, "$path/$item", $dest );}
231 94 jt_eaton
 
232
 
233 119 jt_eaton
      }
234
    else
235
      {
236
       symlink( "${home}/${path}", $dest_path);
237
      }
238 94 jt_eaton
}
239
 
240
 

powered by: WebSVN 2.1.0

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