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 |
|
|
|
116 |
94 |
jt_eaton |
my @components = qx(ls ${home}/work/${project}/ip );
|
117 |
|
|
foreach my $component (@components)
|
118 |
|
|
{
|
119 |
|
|
chomp($component);
|
120 |
|
|
|
121 |
95 |
jt_eaton |
$cmd ="./tools/sys/build_geda $project $component /n";
|
122 |
|
|
if (system($cmd)) {}
|
123 |
|
|
|
124 |
94 |
jt_eaton |
my $parser = XML::LibXML->new();
|
125 |
99 |
jt_eaton |
my $doc = $parser->parse_file("${home}${prefix}${project}${lib_comp_sep}${component}/ip-xact/design.xml");
|
126 |
94 |
jt_eaton |
|
127 |
99 |
jt_eaton |
|
128 |
|
|
#/*********************************************************************************************/
|
129 |
|
|
#/ */
|
130 |
|
|
#/ */
|
131 |
|
|
#/*********************************************************************************************/
|
132 |
|
|
|
133 |
|
|
foreach my $i_name ($doc->findnodes("//components/component/name"))
|
134 |
94 |
jt_eaton |
{
|
135 |
99 |
jt_eaton |
my($comp_name) = $i_name ->findnodes('./text()')->to_literal ;
|
136 |
|
|
my($comp_version) = $i_name ->findnodes('../version/text()')->to_literal ;
|
137 |
94 |
jt_eaton |
|
138 |
99 |
jt_eaton |
my $comp_variant = "";
|
139 |
|
|
if($comp_version) {$comp_variant = "${comp_name}_${comp_version}"}
|
140 |
|
|
else {$comp_variant = "${comp_name}"}
|
141 |
94 |
jt_eaton |
|
142 |
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";
|
143 |
|
|
if (system($cmd)) {}
|
144 |
|
|
}
|
145 |
94 |
jt_eaton |
|
146 |
99 |
jt_eaton |
foreach my $i_name ($doc->findnodes("//testbenchs/testbench/name"))
|
147 |
|
|
{
|
148 |
|
|
my($tb_name) = $i_name ->findnodes('./text()')->to_literal ;
|
149 |
|
|
my($tb_version) = $i_name ->findnodes('../version/text()')->to_literal ;
|
150 |
94 |
jt_eaton |
|
151 |
99 |
jt_eaton |
my $tb_variant = "";
|
152 |
|
|
if($tb_version) {$tb_variant = "${tb_name}_${tb_version}"}
|
153 |
|
|
else {$tb_variant = "${tb_name}"}
|
154 |
94 |
jt_eaton |
|
155 |
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";
|
156 |
|
|
if (system($cmd)) {}
|
157 |
|
|
}
|
158 |
94 |
jt_eaton |
|
159 |
99 |
jt_eaton |
#/*********************************************************************************************/
|
160 |
|
|
#/ link chip files for synthesys */
|
161 |
|
|
#/ */
|
162 |
|
|
#/ */
|
163 |
|
|
#/ */
|
164 |
|
|
#/ */
|
165 |
|
|
#/ */
|
166 |
|
|
#/*********************************************************************************************/
|
167 |
|
|
|
168 |
|
|
print "Linking targets for $project $component \n";
|
169 |
|
|
foreach my $i_name ($doc->findnodes("//chips/chip/name"))
|
170 |
|
|
{
|
171 |
|
|
my($chip) = $i_name ->findnodes('./text()')->to_literal ;
|
172 |
|
|
my($chip_target) = $i_name ->findnodes('../target/text()')->to_literal ;
|
173 |
|
|
my($configuration) = $i_name ->findnodes('../configuration/text()')->to_literal ;
|
174 |
|
|
my($variant) = $i_name ->findnodes('../variant/text()')->to_literal ;
|
175 |
|
|
|
176 |
|
|
$outfile ="${home}${prefix}${project}${lib_comp_sep}${component}/syn/ise/${chip}/Makefile";
|
177 |
|
|
open MAKSYNFILE,">$outfile" or die "unable to open $outfile";
|
178 |
|
|
|
179 |
|
|
print MAKSYNFILE "include ../../../../../bin/Makefile.root\n";
|
180 |
|
|
print MAKSYNFILE "include ./target/Makefile.brd\n";
|
181 |
|
|
print MAKSYNFILE "board=${chip_target}\n";
|
182 |
|
|
print MAKSYNFILE "Design=${chip_target}_${configuration}\n";
|
183 |
|
|
my $path = "${home}${prefix}${project}${lib_comp_sep}${component}/syn/ise/${chip}/target";
|
184 |
|
|
mkdir $path,0755 unless( -e $path );
|
185 |
|
|
|
186 |
|
|
&link_dir( "${home}/projects/opencores.org/targets/ip/${chip_target}", "${home}${prefix}${project}${lib_comp_sep}${component}/syn/ise/${chip}/target" );
|
187 |
|
|
&link_dir( "${home}/projects/opencores.org/cde/ip", "${home}${prefix}${project}${lib_comp_sep}${component}/syn/ise/${chip}/target/lib/ip" );
|
188 |
|
|
&link_dir( "${home}/tools/Jtag_programmers/debug", "${home}${prefix}${project}${lib_comp_sep}${component}/syn/ise/${chip}/debug" );
|
189 |
94 |
jt_eaton |
}
|
190 |
|
|
}
|
191 |
|
|
}
|
192 |
|
|
|
193 |
|
|
#/*********************************************************************************************/
|
194 |
|
|
#/ */
|
195 |
|
|
#/ */
|
196 |
|
|
#/ */
|
197 |
|
|
#/ */
|
198 |
|
|
#/ */
|
199 |
|
|
#/ */
|
200 |
|
|
#/*********************************************************************************************/
|
201 |
|
|
|
202 |
|
|
# recursively map directory information
|
203 |
|
|
|
204 |
|
|
sub link_sub {
|
205 |
|
|
my $root = shift;
|
206 |
|
|
my $path = shift;
|
207 |
|
|
my $dest = shift;
|
208 |
|
|
return unless( -e $path );
|
209 |
|
|
|
210 |
|
|
my $dest_path = $path;
|
211 |
|
|
$dest_path =~ s/$root/$dest/;
|
212 |
|
|
|
213 |
|
|
if( -d $path ) {
|
214 |
|
|
|
215 |
|
|
mkdir $dest_path,0755;
|
216 |
|
|
|
217 |
|
|
my @contents = ( );
|
218 |
|
|
opendir( DIR, $path );
|
219 |
|
|
while( my $item = readdir( DIR )) {
|
220 |
|
|
next if( $item eq '.' or $item eq '..' or $item eq '.svn' );
|
221 |
|
|
push( @contents, $item );
|
222 |
|
|
}
|
223 |
|
|
closedir( DIR );
|
224 |
|
|
|
225 |
|
|
# recurse on items in the directory
|
226 |
|
|
foreach my $item ( @contents ) { &link_sub($root, "$path/$item", $dest );}
|
227 |
|
|
|
228 |
|
|
|
229 |
|
|
} else {
|
230 |
|
|
|
231 |
|
|
symlink( "${home}/${path}", $dest_path);
|
232 |
|
|
}
|
233 |
|
|
}
|
234 |
|
|
|
235 |
|
|
|
236 |
|
|
#/*********************************************************************************************/
|
237 |
|
|
#/ */
|
238 |
|
|
#/ */
|
239 |
|
|
#/ */
|
240 |
|
|
#/ */
|
241 |
|
|
#/ */
|
242 |
|
|
#/ */
|
243 |
|
|
#/*********************************************************************************************/
|
244 |
|
|
|
245 |
|
|
# recursively map directory information
|
246 |
|
|
|
247 |
|
|
sub link_dir {
|
248 |
|
|
my $src = shift;
|
249 |
|
|
my $dest = shift;
|
250 |
|
|
return unless( -e $src );
|
251 |
|
|
|
252 |
|
|
if( -d $src )
|
253 |
|
|
{
|
254 |
|
|
|
255 |
|
|
mkdir $dest,0755;
|
256 |
|
|
my @contents = ( );
|
257 |
|
|
opendir( DIR, $src );
|
258 |
|
|
while( my $item = readdir( DIR ))
|
259 |
|
|
{
|
260 |
|
|
next if( $item eq '.' or $item eq '..' or $item eq '.svn' );
|
261 |
|
|
push( @contents, $item );
|
262 |
|
|
}
|
263 |
|
|
closedir( DIR );
|
264 |
|
|
|
265 |
|
|
# recurse on items in the directory
|
266 |
|
|
foreach my $item ( @contents ) { &link_dir("$src/$item", "$dest/$item" );}
|
267 |
|
|
|
268 |
|
|
}
|
269 |
|
|
else {symlink( "${src}", "${dest}") unless( -e "${dest}" ); }
|
270 |
|
|
}
|
271 |
|
|
|