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

Subversion Repositories socgen

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

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 130 jt_eaton
my @components =       yp::lib::find_components($vendor,$project);
137 119 jt_eaton
foreach my $component (@components)
138
   {
139
   my $parser = XML::LibXML->new();
140 130 jt_eaton
   print " $vendor,$project,$component  \n";
141
   my $socgen_file     = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$project,$component));
142
   my @versions =       yp::lib::find_component_versions($vendor,$project,$component);
143 94 jt_eaton
 
144 119 jt_eaton
   foreach $comp_version (@versions)
145
     {
146
     $cmd ="./tools/sys/soc_link_child -prefix $prefix -vendor $vendor -project $project  -component $component -version $comp_version $projects_dir  \n";
147
     if (system($cmd)) {}
148
     }
149 99 jt_eaton
 
150 119 jt_eaton
   print "Linking simulations for  $vendor  $project  $component      \n";
151 94 jt_eaton
 
152 130 jt_eaton
   foreach  my   $i_name ($socgen_file->findnodes("//socgen:sim/socgen:testbenches/socgen:testbench/socgen:version"))
153 119 jt_eaton
      {
154 94 jt_eaton
 
155 119 jt_eaton
      my($tb_version)  = $i_name ->findnodes('./text()')->to_literal ;
156 94 jt_eaton
 
157 119 jt_eaton
      $cmd ="./tools/sys/soc_link_child -prefix $prefix -vendor ${vendor}  -project $project  -component $component       -version $tb_version  $projects_dir  \n";
158
      if (system($cmd)) {}
159
      }
160 117 jt_eaton
 
161 119 jt_eaton
   #/*********************************************************************************************/
162
   #/   link chip files for synthesys                                                            */
163
   #/                                                                                            */
164
   #/                                                                                            */
165
   #/                                                                                            */
166
   #/                                                                                            */
167
   #/                                                                                            */
168
   #/*********************************************************************************************/
169
 
170
   print "Linking synthesys targets for  $vendor  $project  $component      \n";
171 127 jt_eaton
   my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$project,$component);
172 117 jt_eaton
 
173 119 jt_eaton
 
174 130 jt_eaton
   foreach  my   $i_name ($socgen_file->findnodes("//socgen:syn/socgen:ise/socgen:variant"))
175 119 jt_eaton
      {
176
      my($chip_name)  = $i_name ->findnodes('./text()')->to_literal ;
177
      my($chip_target)  = $i_name ->findnodes('../socgen:target/socgen:library/text()')->to_literal ;
178
      my($chip_part)  = $i_name ->findnodes('../socgen:target/socgen:part/text()')->to_literal ;
179 130 jt_eaton
      $outfile ="${home}${prefix}/${vendor}__${project}${lib_comp_sep}${component}/syn/ise/${chip_name}/Makefile";
180 119 jt_eaton
      open  MAKSYNFILE,">$outfile" or die "unable to open $outfile";
181 128 jt_eaton
      print MAKSYNFILE  "include ${home}/tools/bin/Makefile.root\n";
182 119 jt_eaton
      print MAKSYNFILE  "Part=${chip_part}\n";
183
      print MAKSYNFILE  "board=${chip_target}\n";
184
      print MAKSYNFILE  "Design=${chip_name}\n";
185 130 jt_eaton
      my $path  = "${home}${prefix}/${vendor}__${project}${lib_comp_sep}${component}/syn/ise/${chip_name}/target";
186 119 jt_eaton
      mkdir $path,0755          unless( -e $path );
187 130 jt_eaton
      &sys::lib::link_dir( "${home}/tools/synthesys/targets/ip/${chip_target}", "${home}${prefix}/${vendor}__${project}${lib_comp_sep}${component}/syn/ise/${chip_name}/target"  );
188 119 jt_eaton
      }
189
   }
190
 
191 94 jt_eaton
 
192
 
193 118 jt_eaton
 
194
 
195 94 jt_eaton
#/*********************************************************************************************/
196 117 jt_eaton
#/   recursively map directory information                                                    */
197 94 jt_eaton
#/                                                                                            */
198
#/                                                                                            */
199
#/                                                                                            */
200
#/                                                                                            */
201
#/                                                                                            */
202
#/*********************************************************************************************/
203
 
204
 
205
sub link_sub {
206
    my $root = shift;
207
    my $path = shift;
208
    my $dest = shift;
209
    return unless( -e $path );
210
 
211
    my $dest_path = $path;
212
      $dest_path =~ s/$root/$dest/;
213
 
214 119 jt_eaton
    if( -d $path )
215
      {
216
      mkdir $dest_path,0755;
217 94 jt_eaton
 
218 119 jt_eaton
      my @contents = (  );
219
      opendir( DIR, $path );
220
      while( my $item = readdir( DIR ))
221
           {
222
           next if( $item eq '.' or $item eq '..'   or $item eq '.svn'    );
223
           push( @contents, $item );
224
           }
225
      closedir( DIR );
226 94 jt_eaton
 
227 119 jt_eaton
      # recurse on items in the directory
228
      foreach my $item ( @contents )          { &link_sub($root, "$path/$item", $dest );}
229 94 jt_eaton
 
230
 
231 119 jt_eaton
      }
232
    else
233
      {
234
       symlink( "${home}/${path}", $dest_path);
235
      }
236 94 jt_eaton
}
237
 
238
 

powered by: WebSVN 2.1.0

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