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

Subversion Repositories socgen

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

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

powered by: WebSVN 2.1.0

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