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

Subversion Repositories socgen

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

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
 
47
 
48
use Cwd;
49
use XML::LibXML;
50
 
51
 
52
 
53
#/*********************************************************************************************/
54
#/ We never generate files into a RCS database.                                               */
55
#/                                                                                            */
56
#/ A special work area is created that is the image of the database using symbolic links      */
57
#/                                                                                            */
58
#/*********************************************************************************************/
59
 
60 100 jt_eaton
 
61
my $project = $ARGV[0];
62
chomp($project);
63
 
64
 
65
unless ($project) {$project ="fpgas";}
66
 
67
 
68
 
69
my $root      = "projects/opencores.org/${project}";
70 99 jt_eaton
$home         = cwd();
71
my  $prefix   = "/work/";
72 94 jt_eaton
$lib_comp_sep = "/ip/";
73
$comp_xml_sep = "/rtl/xml/";
74 99 jt_eaton
$tb_xml_sep   = "/sim/xml/";
75 94 jt_eaton
 
76
 
77 100 jt_eaton
my $path  = "${home}${prefix}";
78
mkdir $path,0755          unless( -e $path );
79
 
80
 
81
 
82
$path    = "${home}${prefix}${project}";
83
mkdir $path,0755          unless( -e $path );
84
 
85
 
86 94 jt_eaton
print "Building a work area for ${home}/${root} in ${home}${prefix}  \n" ;
87
 
88 100 jt_eaton
&link_sub( $root,$root, "work/${project}" );
89 94 jt_eaton
 
90
 
91
#/*********************************************************************************************/
92
#/                                                                                            */
93
#/ Each project is given access to the system tools by giving each of them a link to the      */
94
#/ Master Makefiles in tools/bin                                                              */
95
#/                                                                                            */
96
#/ Every component in a project is given access to the system testbench/models and CDE        */
97
#/ library files via symbolic links                                                           */
98
#/                                                                                            */
99
#/*********************************************************************************************/
100
 
101
 
102
 
103
 
104 100 jt_eaton
 
105 94 jt_eaton
   {
106
   symlink( "${home}/tools/bin/Makefile.root", "${home}/work/${project}/bin/Makefile.root");
107
   symlink( "${home}/tools/bin/Makefile",      "${home}/work/${project}/bin/Makefile");
108
 
109 99 jt_eaton
   $cmd ="chmod 755    ${home}/projects/opencores.org/${project}/bin/* \n";
110 94 jt_eaton
   if (system($cmd)) {}
111
 
112 96 jt_eaton
   my $path  = "${home}${prefix}${project}/children";
113
   mkdir $path,0755          unless( -e $path );
114
 
115
   my $path  = "${home}${prefix}${project}/children/Busdefs";
116
   mkdir $path,0755          unless( -e $path );
117
 
118 99 jt_eaton
   &link_dir( "${home}/projects/opencores.org/Busdefs",     "${home}${prefix}${project}/children/Busdefs"  );
119 96 jt_eaton
 
120 94 jt_eaton
   my @components = qx(ls  ${home}/work/${project}/ip    );
121
   foreach my $component (@components)
122
      {
123
      chomp($component);
124
 
125 95 jt_eaton
      $cmd ="./tools/sys/build_geda   $project  $component  /n";
126
      if (system($cmd)) {}
127
 
128 94 jt_eaton
      my $parser = XML::LibXML->new();
129 99 jt_eaton
      my $doc    = $parser->parse_file("${home}${prefix}${project}${lib_comp_sep}${component}/ip-xact/design.xml");
130 94 jt_eaton
 
131 99 jt_eaton
 
132
      #/*********************************************************************************************/
133
      #/                                                                                            */
134
      #/                                                                                            */
135
      #/*********************************************************************************************/
136
 
137
      foreach  my   $i_name ($doc->findnodes("//components/component/name"))
138 94 jt_eaton
         {
139 99 jt_eaton
         my($comp_name)  = $i_name ->findnodes('./text()')->to_literal ;
140
         my($comp_version)  = $i_name ->findnodes('../version/text()')->to_literal ;
141 94 jt_eaton
 
142 99 jt_eaton
         my $comp_variant = "";
143
         if($comp_version) {$comp_variant = "${comp_name}_${comp_version}"}
144
         else         {$comp_variant = "${comp_name}"}
145 94 jt_eaton
 
146 99 jt_eaton
         $cmd ="./tools/sys/soc_link_child -vendor opencores.org -project $project -lib_comp_sep $lib_comp_sep -component $component -comp_xml_sep $comp_xml_sep -variant $comp_variant $comp_xml_sep /n";
147
         if (system($cmd)) {}
148
         }
149 94 jt_eaton
 
150 99 jt_eaton
      foreach  my   $i_name ($doc->findnodes("//testbenchs/testbench/name"))
151
         {
152
         my($tb_name)  = $i_name ->findnodes('./text()')->to_literal ;
153
         my($tb_version)  = $i_name ->findnodes('../version/text()')->to_literal ;
154 94 jt_eaton
 
155 99 jt_eaton
         my $tb_variant = "";
156
         if($tb_version) {$tb_variant = "${tb_name}_${tb_version}"}
157
         else         {$tb_variant = "${tb_name}"}
158 94 jt_eaton
 
159 99 jt_eaton
         $cmd ="./tools/sys/soc_link_child -vendor opencores.org  -project $project -lib_comp_sep $lib_comp_sep -component $component -comp_xml_sep $comp_xml_sep -variant $tb_variant $tb_xml_sep /n";
160
         if (system($cmd)) {}
161
         }
162 94 jt_eaton
 
163 99 jt_eaton
      #/*********************************************************************************************/
164
      #/   link chip files for synthesys                                                            */
165
      #/                                                                                            */
166
      #/                                                                                            */
167
      #/                                                                                            */
168
      #/                                                                                            */
169
      #/                                                                                            */
170
      #/*********************************************************************************************/
171
 
172
      print "Linking targets for   $project  $component      \n";
173
      foreach  my   $i_name ($doc->findnodes("//chips/chip/name"))
174
         {
175
         my($chip)  = $i_name ->findnodes('./text()')->to_literal ;
176
         my($chip_target)  = $i_name ->findnodes('../target/text()')->to_literal ;
177
         my($configuration)  = $i_name ->findnodes('../configuration/text()')->to_literal ;
178
         my($variant)  = $i_name ->findnodes('../variant/text()')->to_literal ;
179
 
180
         $outfile ="${home}${prefix}${project}${lib_comp_sep}${component}/syn/ise/${chip}/Makefile";
181
         open  MAKSYNFILE,">$outfile" or die "unable to open $outfile";
182
 
183
         print MAKSYNFILE  "include ../../../../../bin/Makefile.root\n";
184
         print MAKSYNFILE  "include ./target/Makefile.brd\n";
185
         print MAKSYNFILE  "board=${chip_target}\n";
186
         print MAKSYNFILE  "Design=${chip_target}_${configuration}\n";
187
         my $path  = "${home}${prefix}${project}${lib_comp_sep}${component}/syn/ise/${chip}/target";
188
         mkdir $path,0755          unless( -e $path );
189
 
190
         &link_dir( "${home}/projects/opencores.org/targets/ip/${chip_target}", "${home}${prefix}${project}${lib_comp_sep}${component}/syn/ise/${chip}/target"  );
191
         &link_dir( "${home}/projects/opencores.org/cde/ip",                            "${home}${prefix}${project}${lib_comp_sep}${component}/syn/ise/${chip}/target/lib/ip"  );
192
         &link_dir( "${home}/tools/Jtag_programmers/debug",               "${home}${prefix}${project}${lib_comp_sep}${component}/syn/ise/${chip}/debug"  );
193 94 jt_eaton
         }
194
      }
195
   }
196
 
197
#/*********************************************************************************************/
198
#/                                                                                            */
199
#/                                                                                            */
200
#/                                                                                            */
201
#/                                                                                            */
202
#/                                                                                            */
203
#/                                                                                            */
204
#/*********************************************************************************************/
205
 
206
# recursively map directory information
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
    if( -d $path ) {
218
 
219
        mkdir $dest_path,0755;
220
 
221
        my @contents = (  );
222
        opendir( DIR, $path );
223
        while( my $item = readdir( DIR )) {
224
            next if( $item eq '.' or $item eq '..'   or $item eq '.svn'    );
225
            push( @contents, $item );
226
        }
227
        closedir( DIR );
228
 
229
        # recurse on items in the directory
230
        foreach my $item ( @contents )          { &link_sub($root, "$path/$item", $dest );}
231
 
232
 
233
    } else {
234
 
235
        symlink( "${home}/${path}", $dest_path);
236
    }
237
}
238
 
239
 
240
#/*********************************************************************************************/
241
#/                                                                                            */
242
#/                                                                                            */
243
#/                                                                                            */
244
#/                                                                                            */
245
#/                                                                                            */
246
#/                                                                                            */
247
#/*********************************************************************************************/
248
 
249
# recursively map directory information
250
 
251
sub link_dir {
252
    my $src  = shift;
253
    my $dest = shift;
254
    return unless( -e $src );
255
 
256
    if( -d $src )
257
        {
258
 
259
        mkdir $dest,0755;
260
        my @contents = (  );
261
        opendir( DIR, $src );
262
        while( my $item = readdir( DIR ))
263
            {
264
            next if( $item eq '.' or $item eq '..'   or $item eq '.svn'    );
265
            push( @contents, $item );
266
            }
267
        closedir( DIR );
268
 
269
        # recurse on items in the directory
270
        foreach my $item ( @contents )          { &link_dir("$src/$item", "$dest/$item" );}
271
 
272
       }
273
       else  {symlink( "${src}", "${dest}") unless( -e "${dest}" ); }
274
}
275
 

powered by: WebSVN 2.1.0

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