-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvco
372 lines (355 loc) · 9.82 KB
/
vco
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
#!/bin/sh
#
#Copyright 1991-2016 Mentor Graphics Corporation
#
#All Rights Reserved.
#
#THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS THE PROPERTY OF
#MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS SUBJECT TO LICENSE TERMS.
#
# PATH of file : &PATH/modelsim_ase/vco
# copy and modify from https://github.com/kevinsala/multicore-architecture/wiki/Running-ModelSim-on-Linux
#
# ModelSim can be run from
# `altera_install_path/altera_version/modelsim_ase/bin/vsim`
#
# <!-- ***************************************************************** -->
#
# If you get the error:
# >Error: cannot find "bin/../linux_rh60/vsim"
#
# Edit `altera_install_path/altera_version/modelsim_ase/vco` file
# following the steps at:
#
# <https://wiki.archlinux.org/index.php/Altera_Design_Software#With_the_kernel_4.x_and_Upwards>
#
# <!-- ***************************************************************** -->
#
# If you get the error:
# > Fatal: Read failure in vlm process (0,0)
#
# Download and compile `freetype` with version lower than 2.5.
# Follow "Problem number two" steps at:
#
# <http://mattaw.blogspot.com/2014/05/making-modelsim-altera-starter-edition.html>
# It's hard to visit.So you
# Compile freetype first
# Copy freetype-2.4/freetype-2.4.0/objs/.libs/libfreetype.so\* to dir
# And change vco like :
# <https://wiki.archlinux.org/index.php/Altera_Design_Software#With_freetype2_2.5.0.1-1>
#
# <!-- ***************************************************************** -->
#
# If you get the error:
# > ./../linux/vish: error while loading shared libraries: libXft.so.2: cannot open shared object file: No such file or directory
#
# Follow the steps at:
# <http://stackoverflow.com/questions/31908525/modelsim-altera-error>
# MTI_VCO_MODE environment variable may be set to "32" or "64"
# to force selection of 32-bit or 64-bit platform directory for executables.
mode=${MTI_VCO_MODE:-""}
PATH="/bin:$PATH"
arg0="$0"
cmd=`basename "$arg0"`
uname=`uname`
utype=`uname -r`
umach=`uname -m`
case $uname in
AIX)
islink=-L
;;
CYGWIN_NT*)
arg0=`dirname "$arg0"`
islink=-h
;;
Win*)
uname=CYGWIN_NT
islink=-h
;;
*)
islink=-h
;;
esac
while [ $islink "$arg0" ] ; do
x=`/bin/ls -ld "$arg0"`
x=`expr "$x" : '.* \(.*\)'`
case "$x" in
/*) arg0="$x" ;;
*) arg0="`dirname ""$arg0""`/$x" ;;
esac
done
dir=`dirname "$arg0"`
# new :
export LD_LIBRARY_PATH=${dir}/../old_library
vco=${uname}${utype}
case $vco in
SunOS4*)
echo "Error: $cmd is not supported on ${uname} ${utype}"
exit 1
;;
SunOS5.5*)
echo "Error: $cmd is not supported on ${uname} ${utype}"
exit 1
;;
SunOS5.6*)
echo "Error: $cmd is not supported on ${uname} ${utype}"
exit 1
;;
SunOS5.7*)
echo "Error: $cmd is not supported on ${uname} ${utype}"
exit 1
;;
SunOS5*)
# Use 64-bit platform only if 32-bit is not installed and OS and cpu
# support 64-bit. User may set PATH to platform-specific directory or set
# environment variable MTI_VCO_MODE to 32 or 64 to override default
# behavior.
#
if [ -x /bin/isainfo ] ; then
isa="`/bin/isainfo -n 2>&1`"
else
isa=""
fi
case $mode.$isa in
32.amd*) vco="sunos5x86" ;;
64.amd*) vco="sunos5x86_64" ;;
.amd32*) vco="sunos5x86" ;;
.amd*)
if [ -x /bin/getconf ] \
&& /bin/getconf _XBS5_LP64_OFF64 > /dev/null 2>&1 \
&& [ ! -x $dir/sunos5x86/vsim ] \
&& [ -x $dir/sunos5x86_64/vsim ] ; then
vco="sunos5x86_64"
else
vco="sunos5x86"
fi
;;
32.i386*) vco="sunos5x86" ;;
64.i386*) vco="sunos5x86_64" ;;
.i386*)
if [ -x /bin/getconf ] \
&& /bin/getconf _XBS5_LP64_OFF64 > /dev/null 2>&1 \
&& [ ! -x "$dir/sunos5x86/vsim" ] \
&& [ -x "$dir/sunos5x86_64/vsim" ] ; then
vco="sunos5x86_64"
else
vco="sunos5x86"
fi
;;
32.sparc*) vco="sunos5" ;;
64.sparc*) vco="sunos5v9" ;;
.sparcv9*)
if [ -x /bin/getconf ] \
&& /bin/getconf _XBS5_LP64_OFF64 > /dev/null 2>&1 \
&& [ ! -x "$dir/sunos5/vsim" ] \
&& [ -x "$dir/sunos5v9/vsim" ] ; then
vco="sunos5v9"
else
vco="sunos5"
fi
;;
*) vco="sunos5" ;;
esac
;;
HP-UX*)
# Use hpux_ia64 if IA-64 architecture.
#
# Use hppa64 platform only if hp700 is not installed
# and OS and cpu support 64-bit. User should set PATH to
# platform-specific directory to override default behavior.
#
# Use hp700_1020 platform only if hp700 is not installed
# and hppa64 is not installed or OS/CPU doesn't support it.
if [ "$mode" != "32" ] \
&& [ "$umach" = "ia64" ] \
&& ( [ "$mode" = "64" ] \
|| [ -x "$dir/hpux_$umach/vsim" ] \
|| [ ! -x "$dir/hp700/vsim" ] ) ; then
vco="hpux_ia64"
elif [ "$mode" != "32" ] \
&& [ "$umach" != "ia64" ] \
&& ( [ "$mode" = "64" ] \
|| ( [ ! -x "$dir/hp700/vsim" ] \
&& [ -x "$dir/hppa64/vsim" ] \
&& [ -x /bin/getconf ] \
&& [ "`/bin/getconf KERNEL_BITS 2>&1`" = "64" ] ) ) ; then
vco="hppa64"
elif [ ! -x "$dir/hp700/vsim" ] \
&& [ -x "$dir/hp700_1020/vsim" ] ; then
vco="hp700_1020"
else
vco="hp700"
fi
;;
AIX*)
# Use rs64 platform only if rs6000 is not installed
# and OS and cpu support 64-bit. User should set PATH to
# platform-specific directory to override default behavior.
if [ "$mode" != "32" ] \
&& ( [ "$mode" = "64" ] \
|| ( [ ! -x "$dir/rs6000/vsim" ] \
&& [ -x "$dir/rs64/vsim" ] \
&& [ -x /bin/getconf ] \
&& [ "`/bin/getconf _XBS5_LP64_OFF64 2>&1`" = "1" ] \
&& /bin/locale64 > /dev/null 2>&1 ) ) ; then
vco="rs64"
else
vco="rs6000"
fi
;;
Linux*)
# On Linux, default to 32 bit unless MTI_VCO_MODE is set
# except for Visualizer where we invoke 64-bit version by default
if [ "$mode" = "" ] ; then
if ( [ "$cmd" = "visualizer" ] || [ "$cmd" = "vis" ]) \
&& ( [ -x "$dir/linux_x86_64/visualizer" ] ) ; then
mode="64";
elif ( [ -x "$dir/linux_gcc3/vsim" ] \
|| [ -x "$dir/linux/vsim" ] \
|| [ -x "$dir/linuxle/vsim" ] \
|| [ -x "$dir/linuxpe/vsim" ] ) ; then
mode="32";
fi
fi
# If IA-64 or X86-64 architecture and machine-specific vsim is not
# installed but linux vsim is available, use linux platform.
# Otherwise use machine-specific platform.
#
if [ "$mode" != "32" ] \
&& ( [ "$umach" = "ia64" ] \
|| [ "$umach" = "x86_64" ] ) \
&& ( [ "$mode" = "64" ] \
|| [ -x "$dir/linux_$umach/vsim" ] \
|| [ ! -x "$dir/linux/vsim" ] ) ; then
if [ "$umach" = "ia64" ] && [ -x "$dir/linux_ia64_gcc3/vsim" ]; then
vco="linux_ia64_gcc3"
else
vco="linux_$umach"
fi
else
if [ -x "$dir/linux_gcc3/vsim" ] \
&& [ ! -x "$dir/linux/vsim" ]; then
vco="linux_gcc3"
else
case $utype in
2.4.[7-9]*) vco="linux" ;;
2.4.[1-9][0-9]*) vco="linux" ;;
2.[5-9]*) vco="linux" ;;
2.[1-9][0-9]*) vco="linux" ;;
3.[0-9]*) vco="linux" ;;
# old :
# *) vco="linux_rh60" ;;
*) vco="linux" ;;
esac
if [ ! -x "$dir/$vco/vsim" ]; then
if [ -x "$dir/linuxle/vsim" ]; then
vco="linuxle"
elif [ -x "$dir/linuxpe/vsim" ]; then
vco="linuxpe"
fi
fi
fi
fi
;;
CYGWIN_NT*)
if [ -x "$dir/win32/vsim" ]; then
vco="win32"
elif [ -x "$dir/win32pe/vsim" ]; then
vco="win32pe"
fi
if [ "$mode" = "" ] ||
[ "$mode" = "64" ] ; then
sysostype="`systeminfo 2>&1 | grep -i 'System Type' | cut -f1 -d- | sed s@x@X@ | cut -f2 -dX`"
if [ "$sysostype" == "64" ] ; then
vco="win64"
fi
fi
;;
*)
vco="unknown"
;;
esac
doatenv=0
case $cmd in
qhdir)
cmd=vdir
;;
qhmap)
cmd=vmap
;;
qvlcom)
cmd=vlog
;;
qhcvt)
cmd=../convert.tcl
;;
qhlib)
cmd=vlib
;;
qhsim)
cmd=vsim
;;
qhdel)
cmd=vdel
;;
qhmake)
cmd=vmake
;;
qvhcom)
cmd=vcom
;;
qhgencomp)
cmd=vgencomp
;;
vco)
echo $vco
exit
;;
hdloffice)
doatenv=1
;;
hdlstudio)
doatenv=1
;;
esac
# verify that we can find the command to execute.
if [ -x "$dir/$vco/$cmd" ] ; then
arg0="$dir/$vco/$cmd"
else
# if bin nolonger has symbolic links in it then
# we need to look up and over
f2="$dir/$vco/$cmd"
if [ -x "$f2" ] ; then
arg0="$f2"
elif [ -x "$dir/${vco}pe/$cmd" ] ; then
arg0="$dir/${vco}pe/$cmd"
elif [ -x "$dir/${vco}le/$cmd" ] ; then
arg0="$dir/${vco}le/$cmd"
else
# Last ditch effort. Use original arg0 and try it!
d2=`dirname "$0"`
f2="$d2/$vco/$cmd"
if [ -x $f2 ] ; then
arg0=$f2
else
echo "Error: cannot find \"$dir/$vco/$cmd\""
exit 1
fi
fi
fi
if [ $doatenv ]; then
if [ -x "$dir/$vco/athdlenv" ] ; then
#. $dir/$vco/athdlenv
if [ -z "$LD_LIBRARY_PATH" ]; then
export LD_LIBRARY_PATH="$dir/$vco"
else
export LD_LIBRARY_PATH="$dir/$vco:$LD_LIBRARY_PATH"
fi
#echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH
fi
fi
if [ -z "$*" ] ; then
exec "$arg0"
else
exec "$arg0" "$@"
fi