各位大大好:: s- B: K; Z( W- y r8 h
小弟執行nanosim時,卻無法跑出視窗來,有個錯誤可是我不清楚該如何解決?問題如下6 g" N/ n2 i2 O0 [! Q
[: 113: 64: unexpected operator2 M c6 I M0 w4 `5 }* Y& ?$ ]1 B" X
/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim: 1: Syntax error: Unterminated quoted string 5 I/ W0 e! O7 o7 {( q4 @有大大遇過這方面的問題或是指導我方向去解決, 謝謝. , G/ P4 b/ |" T V( [我在猜可能是這個檔案內的文字需要修改 但不知道該如何修改? $ O3 D, I0 z# A, a8 m! `% S以下為/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim 的檔案內容:$ S7 C( W! R' t
#!/bin/sh. a* A& \' \* ]( P. q8 g t8 Y6 ~) W
# , e% z5 D t9 R4 P# t- P' |# Copyright (C) 2001 Synopsys INC % y$ A# ^% A. t/ J9 j! d, q* [# EPIC Dynamic Simulation Wrapper (DSW). y# q: Y/ `3 w9 P1 F {2 X9 v
## j9 g% l( T2 b
eval ${DBG_EPIC_WRAPPER:+"set -x"} : s, X% J$ y+ y6 v) T! F( D ! I$ m1 R. l, Aif [ "$EPIC_WRAPPER_DVLP" = "" ]; then* G: q/ x' L! \
TEMP_ARCH="$SES_ARCH" : d, m: f3 P5 Telse: ~5 X6 @/ M' @6 H( I# \' K- N9 J
TEMP_ARCH="$EPIC_ARCH"- v& J! K$ C2 ^5 \
fi + s- a& |: o: ]: ^, E! q o# f F1 N3 p4 g" |: }- z* c3 N& g
scan_for_hva_args() ' ?9 w# B% G, r# y3 h4 G, c& C{ # |) p; x- m4 A; [4 r2 f# S /bin/rm -f hva.init 1>&2 + Y: B7 S. E# D; y while [ $# -gt 0 ]; do- _) `, r, h: Y M6 y
case "$1" in 2 Q0 D% [! Y. ^" V -vaf)0 B5 G$ L1 n: X/ r1 S. O
have_vaf_flag=1' c+ {# r+ }6 U8 n: U1 C- O& _+ G
have_va_flag=0 ! p# [! [3 Z0 {: ~) {0 c shift; , G5 }6 q5 _# K: | continue; ( K' D9 P$ g+ S% S8 S- S3 ^ ;; 6 k: O4 a- Q9 A1 I -va) $ S8 O0 |) D0 \; M& v: O) W6 D have_va_flag=1% o, ~4 [3 V" r1 Z' E/ D6 j
have_vaf_flag=0 W, P" D: @3 I" g* a* \ shift; ( b8 l% ]" ^$ j- p/ u" w# O. b continue; * F% x- p2 F- {; \+ i& N( ` ;; - U# \: K W9 ] `. |4 M& Y4 f5 w -*) * L2 S7 o+ _. w- G: e ARGV="$ARGV $1"% z0 T N4 o; E& `* B% F) V
have_va_flag=06 t) D4 d+ \: i4 ?# e7 b
have_vaf_flag=0( Q T G* G$ B) a0 F, a1 y* O
shift; 7 U/ X( \% F% p+ Q5 S continue; i' @* J+ ^1 R# q5 O) A* o ;; ; [3 `8 D& K/ \ *) , B, I4 P- P+ z E if [ x"$have_va_flag" = x"1" ] ; then ' G- j+ ]) C$ e% `5 i( d VA_FILE="$VA_FILE $1" , b3 K6 l* Z) A; B, P! \ elif [ x"$have_vaf_flag" = x"1" ] ; then 7 G9 P0 g7 @# a& Y( C& P
X="`cat $1 | sed -e '/\;/d;`" % a7 c. p! ^% E6 L: D for token in ${X}; do8 z; N7 D9 @' Q1 k9 V0 o- I
VA_FILE="$VA_FILE $token" : w' f" `0 q( l- T L3 `$ _/ G$ k done 9 r$ u! L' {5 V4 S5 a else 0 g3 s( v& i# ?4 j ARGV="$ARGV $1" ' \# U7 f4 d0 \7 L fi9 S! ]! n/ C* Q9 G* Q& F7 b
shift; , O( t" p7 ^/ u( C% |7 W3 C ;; 2 @' g/ D8 m% F. I1 _1 G6 h5 F+ A esac 5 M# ^3 }! r1 O/ a done& \# Z# x( S! H
. z! ?' b! K% }; u( ]4 ? if [ x"$VA_FILE" != x"" ] ; then & I5 C, H/ ^3 K9 \* b; w( B
## /bin/echo " xxx ARGV $ARGV"1 G9 ^* U: J! `. j
/bin/echo "choose nanosim $ARGV ;" > hva.init * L% K! O+ _: h0 P7 ] echo vcs +ad=hva.init $VA_FILE -o simv 2 N0 u$ \# A9 o( O- }1 w( e5 u' c" G vcs +ad=hva.init $VA_FILE -o simv 7 l1 G! C: B" r4 g# u Y exe_status=$? ) Z+ B* d2 w* L! ]; M% ] if [ $exe_status != 100 ]; then ; S% y: `6 B& \: r6 _. L0 S1 B' { /bin/echo "" 9 [ ~6 c* M" b2 ^+ U( T /bin/echo "ERROR: Execution of vcs exited with code $exe_status"4 Q% G& c8 }+ S- O$ M$ D
/bin/echo "" ) N6 Q% |8 L1 \: w' h1 e exit $exe_status$ w. ^# E7 X. h- X5 }/ F# Y
fi 8 f$ P3 T, e( @& W7 F( j& f hva_files="-n simv.daidir/amsVD.ntl simv.daidir/amsWRAP.spi" 3 q! \+ o2 B) W2 `/ y: @ ARGV="$ARGV $hva_files" 8 n, [! P2 p% U* Q" t. k fi" Z9 o8 r+ U6 {- x
} v7 b! ?/ `9 a6 n#-------------------------------------------------------------------------3 M2 E2 I% }. x5 i) G. U) h8 t1 X
1 ]3 e$ d6 p4 O: ^5 B6 _7 c
cleanup()2 |/ g5 e0 A, ? t! w
{ , ]% z0 H3 n0 P0 D1 h if [ -d "$rundir" ]; then 4 I0 D+ T- H1 [" M # On AIX, a .nfsXXX file is created if libModel.o is removed0 x+ J1 Y0 E& T! W6 \: z8 ~, `
# so .epicrun is not removed because directory is not empty.1 T& O/ p+ }% ]8 L# W. Y1 m
# Solution is to remove it again if the first rm failed! q, G, @+ q' f, L2 K1 c
# (rm -rf $rundir || rm -rf $rundir) 1> /dev/null 2>&1 1 w1 [. F2 o+ ^( V if [ "$EXTRA_CAPACITY" = "YES" ]; then & U U `/ Q* P+ E' w chmod u+x $rundir/rpcidfile ( `* q9 {; `# \/ z' W $rundir/rpcidfile' U7 a7 A! @. P/ F6 C! y
rm $rundir/rpcidfile * h1 l' s1 P3 L1 I fi / h+ _1 _5 Z4 q7 J# a) a7 j7 Y4 Q rm -rf $rundir $ t- r9 c: X% D q) Z, T6 Y$ k8 P; Y# l; ]4 t& Q+ P$ F
#Due to NFS problem, we have to copy files needed to) v- A9 [. o! {. J$ a
#/tmp/<temporary directory>, then symlink's files8 M8 ^4 Z3 y. c# `+ @
#to the local temporary 'rundir'. This avoids the problem2 Q: [% a2 I9 r8 U( T2 [
#to remove 'rundir' % w7 ?. k W, g$ r* }9 E if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then4 j$ o" M' ` J4 i
if [ -d "$tdir" ]; then ) c& c, n2 v5 q2 k rm -rf $tdir) B) ~' G) E) S4 S8 G1 X
fi1 ~0 T$ g7 l! ]6 q: M0 o
fi7 t' ^+ L/ E% M$ y( V3 a9 W
fi. y$ i: w% {" R; A0 u
if [ ${exitstatus:-0} -eq $ld_err_code ]; then6 \) l4 d8 _4 b4 ]( I) d7 E
[ "$has_model" = "YES" ] && rm -f $cwd/libModel$suffix " M- B) `4 u5 k* u: d [ "$has_custom" = "YES" ] && rm -f $cwd/libCustom$suffix 7 H+ g3 A4 v* w0 {* B- ^' U" Y. f fi! q% m _ k8 [( T
[ -f "$EPIC_SCRIPT_MESSAGES_FILE" ] && rm -f $EPIC_SCRIPT_MESSAGES_FILE 1>&29 `2 m4 t3 Y: ^; e C% w
exit ${exitstatus:-0} " Z' v; A( \ {) Z5 n/ c' x} . J. J* _% U \+ Y# T! c$ r. }( @# m6 r6 E* ?0 R( T5 t
Exit() 8 T) _$ ?3 _* z2 q3 ]{ ) V9 V& T' \ F: b$ e/ G. H exitstatus=$1 , |" x( S D/ S- T) {: p2 a1 J; E3 y exit $exitstatus) `/ ^) a* L6 Y" F
} * L3 p) E3 G# }7 E8 U 6 A4 n S M$ D1 z5 F# get_epicrc filename keyword 1 U0 }0 P2 O4 o$ j6 f9 ^+ mget_epicrc()/ l8 y. d0 }1 U9 O# G- Q
{: M' S- m' w! k
[ -f $1 ] || exit 0* k! Z' V$ Z- j1 C
key="/^$cmd2:/{print \$3}"- R* I; }; b5 ]& d
awk -F":" "$key" $1 7 S3 T7 l; l! H }1 W2 i}) [( z" u: s# ~
4 L" D' Q* U. n/ W+ H
# : W9 w3 I( x# `, W" A- j8 K. \4 n# set datasize limit to hardlimit 7 u' b+ u |5 y5 M5 P; f% o3 y#2 Q% H7 H8 T$ X' b4 J5 ^
set_data_limit()/ ]" E# u4 N% [+ d; c
{ . F2 f9 k* \: ?, p1 E dbglimit=0 " X5 y( `; o y. X8 s) h* X hardlimit=`ulimit -Hd`: R |0 P/ e4 w( C
softlimit=`ulimit -d`" }5 M5 }( p" `- l# Y. Q- b& Z
desiredlimit=3500000 / X/ c6 O/ a# I hardisunlimited=0 ! _9 G$ {: b/ m4 N! E3 Y) {# I softisunlimited=0 9 D' T8 [6 h1 a" k0 k is64=0+ S7 W* e* \9 s5 _
/ s$ f6 V3 @& y: O- Y& W case "$EPIC_ARCH" in * E/ @# a( B+ |, _! @2 y$ c$ ]* D *SUN*64)8 Q8 j/ V6 d A7 h7 y: P b( N
is64=1/ J r t2 v s' j+ O
;; 5 X- f2 d6 h% ~" Z6 @ amd64)4 L8 U8 Y* ]( y9 W/ |
is64=1 5 U7 u5 w" L( K ;; 8 u6 `; B, q+ v. A8 }1 y x86sol64)8 _. r8 u( H! c( \; e& m) b U0 P
is64=1# l5 d5 |! c) i4 `4 X4 j
;;1 y' z A; i/ D5 e1 p; T6 P
aix64)8 b1 R2 l! ~; d% c7 L( D
is64=1 & p0 t: n! g8 E, @) c q ;;. R& o" Q E7 Z7 u. ^
suse64)8 b c+ T7 ]6 ]/ ?
is64=1 # i) t* h: p3 r4 L* N! x5 u( k ;;! X+ z% \8 e- F! x( B
esac. P$ V1 o( G" F2 j% T& S$ g l2 w
& ~* M9 ]0 b% v
if [ $dbglimit -eq 1 ]; then ! ^, x3 B5 i0 @6 p2 y2 [0 I. U( T echo hard $hardlimit soft $softlimit " A# ~" }( n7 O/ l fi 8 S+ v! U5 ~+ }1 k: i: o7 X- |/ n & x8 ~7 i& V/ G if [ x$softlimit = "xunlimited" ]; then . l( U/ |$ ~5 ^5 P softisunlimited=19 C6 C1 Q+ N; O) Z B1 J7 D R, A) D
fi' m: v/ m% `4 y7 p' j* p# u
. n; I" x7 B, u4 A% o, G if [ x$hardlimit = "xunlimited" ]; then0 K* C% C. I( c4 o1 s
hardisunlimited=1 3 {6 ]6 v8 b- {. \ fi5 O5 f3 {: R9 o' \! T1 \; h7 |
1 U9 Y c# v4 ?
# 64 bit machine should have bigger than 4G: j" G1 R5 Y# s6 Y' c$ H
if [ $is64 -eq 1 ]; then; W9 \+ F5 |/ L2 m) {0 K; F W
desiredlimit=5000000# Z( U X" n! M9 }* I
fi + C$ o! g9 L& n0 I% V0 S7 N) b$ k# @6 E- P$ X1 J) q
if [ $hardisunlimited -eq 0 ]; then- d$ g0 I$ Q1 U. t( _. E
if [ $hardlimit -lt $desiredlimit ]; then ) J8 P1 `& R# R& B7 W$ k2 P echo "WARNING: datasize hard limit $hardlimit K is too small."/ } R% P1 n5 h3 w
fi7 A& J9 ]4 K4 y; V& P
fi7 i; h' n. m& `8 U% m* _
. e( P. K ^* b0 \# J/ J8 G. K if [ $hardlimit != $softlimit ]; then9 O0 \0 { o2 r7 V7 @4 @9 D
ulimit -Sd $hardlimit " X, l# @4 Y# Z1 g# echo "WARNING: datasize limit is set to `ulimit -Sd`"3 @3 P$ j2 |3 d
fi : y* b3 I2 ~. G+ X$ D$ r2 Y. J+ C# _. @
if [ $dbglimit -eq 1 ]; then4 x" h( G/ `. g4 S
echo datasize hard limit: `ulimit -Hd`0 Y, E& |2 g- C
echo datasize soft limit: `ulimit -d`9 u1 K7 _6 q. y) o
fi, ]: t/ ~* d8 V2 g3 d2 R) T7 X8 o! g
}. H* g7 x% K% e% q( g
7 N, l3 j1 R% Z) [$ {
#3 t+ N4 f6 |& m2 k5 B) Q5 Q' D
# set stacksize limit to desired limit # J# V! W. L6 [9 }6 [: q#- v( f0 B7 j2 e- E5 a+ C0 u
set_stack_limit()7 M7 a$ o9 f/ j
{ / i. I9 w& Y0 U1 W, `& v dbglimit=0+ X; @" i% ^9 t1 g) E b
hardlimit=`ulimit -Hs` - t9 G$ y1 T- O8 D softlimit=`ulimit -s`/ A7 e3 h: R8 L9 T0 Q5 W! a+ ^- c
desiredlimit=600005 U( {% g* J( ^1 a$ r1 \4 H
hardisunlimited=04 x& h( R' u# t6 A5 V$ c0 \: e
softisunlimited=0 ; a: ]( \. Z3 }, L% B( E% b is64=0) v5 I# N$ d# ~6 p- r& ^9 `% g
2 w8 h& L$ u( S' h. H3 q case "$EPIC_ARCH" in1 }* I& R) s) f7 [$ K8 o: ~* j" a! j
*SUN*64) " t0 v$ r0 K1 A6 C% x is64=1 ; I2 {) l& u$ I% O, h8 \ ;; 6 [! {) A) g# U& h4 o8 r amd64) 6 F- E1 t* M0 `+ o9 l! p" q is64=1 % \8 @9 G) @4 O! z# E ;;$ x8 `) G& m: @
x86sol64)' m) q- S u$ b* w
is64=14 m+ y( ~* u- S- K. J
;; 9 B3 v7 j4 P: M aix64)! n9 | j) I% w
is64=1 , \& k- N' B2 q7 U0 d ;; 4 g7 Y% d/ i3 f. P% |. p8 W+ P suse64) 4 G+ \* h! ~1 Q6 d$ o7 E3 R6 r is64=1. u. F3 N3 Z# |5 z. z' r
;;4 T) @0 d' X1 s. v; o" q: M: t8 E
esac9 H( f6 `/ q6 _* e
# J3 E: D+ V5 T6 @5 iif [ "$EPIC_WRAPPER_DVLP" = "" ]; then ) O* E3 \0 t% o% k# t if [ $is64 -eq 1 ]; then # x( a3 K1 M4 H desiredlimit=2000002 k9 }9 b# H8 i! p, Y4 j( f
fi ) T( y) h( U2 x; q0 Gelse0 ?; @- ^* |& P6 P& t- p
case "$EPIC_ARCH" in5 W* F" Y i. S# i8 [: s1 R6 k+ A
*SUN*64)# |# Z1 ~2 v5 i' }' r% f
desiredlimit=200000+ v. d m; j$ m7 H2 N
;;2 F1 h/ D1 U9 v0 q7 z
esac 9 z9 E% i9 g# V( k( f( n& E5 \% {fi* F+ ~& D$ t9 D# T; b9 e
5 @8 m4 }; H( |8 U# w if [ $dbglimit -eq 1 ]; then 6 `4 [1 G2 F' T+ J0 x6 i echo hard $hardlimit soft $softlimit1 q3 }" A) Q0 _/ p2 _3 g
fi + g0 n: ~- j+ f+ e/ e7 h4 X8 M/ p8 o! d/ f B
#stacksize can not be unlimited, pick smaller number 6 S/ |; Z* e) @' I) ?% O- t- [7 F1 d# G6 Y
stacklimit=$desiredlimit5 S/ f5 |0 ^5 K8 c! c7 K. Y) |4 a
* @; B8 z+ {- ^) ^ e" ?; r, T
if [ x$hardlimit = "xunlimited" ]; then4 ^( _$ R. N5 T. k
hardisunlimited=14 m2 I+ H, \ ?8 M' s
fi$ R' }2 J% y& ^% n$ v
( i! k3 ?% X% Y3 p, R* L$ F; Y' s if [ x$softlimit = "xunlimited" ]; then: N" _* H6 k6 A! N" T4 p+ @
softisunlimited=1 : F# t- _$ F5 v& q Y9 g fi* E1 Y. F0 W* t0 i6 q$ L
) W! C# m5 e8 O+ z
if [ $hardisunlimited -eq 0 ]; then 8 ~9 y' m. M7 W! s" r% ] u if [ $hardlimit -lt $desiredlimit ]; then5 J0 T5 d+ M, u/ c" y, M
echo "WARNING: stacksize hard limit $hardlimit K is too small." 3 q! \7 B& | q) g$ v) x5 w$ R desiredlimit=$hardlimit2 ?0 P1 y% X- L8 E5 z2 i
stacklimit=$desiredlimit " ?" i5 R% W) |* T fi & q( a+ K _+ n5 m6 s fi 0 A$ p1 [+ o* c7 }4 u 7 D; I5 B0 @3 Z; c # desiredlimit is set to proper value (< hardlimit) + [2 M9 j( v: A! K4 @1 H: D# p# n i4 ~; T. Q. r; w9 A$ }
if [ $softisunlimited -eq 0 ]; then% Y; Y( C3 k4 L, ?( T d$ c2 o/ W
if [ $softlimit -gt $desiredlimit ]; then0 m N% a/ r- s- h" e) U2 o
stacklimit=$softlimit. `1 j. n& I" Z4 F3 Q' e
fi , y1 t% U# [3 Q fi8 q; r' K% u5 b% R
! v( m0 {' U- J
if [ $softlimit != $stacklimit ]; then 5 S! {% ]% P# ]' k2 ?1 M0 q% v ulimit -Ss $stacklimit) P4 K8 o4 q; p* r8 F$ b
# echo "WARNING: stacksize limit is set to `ulimit -Ss`" 5 s* ^8 Q8 T1 d4 t fi _; G8 P/ N! P9 r* f$ k, W7 ~5 i6 J , E P( \' q7 K( h( y if [ $dbglimit -eq 1 ]; then. i8 X% G# j D7 _
echo stacksize hard limit: `ulimit -Hs` - l5 J; u" |$ e! t [% U echo stackize soft limit: `ulimit -s` 7 ` W7 E4 j+ L+ k7 u2 c fi 7 w, Y* e6 T* `. ?. r( z, I6 g} 3 }2 v/ o& k$ @% X3 \% `& \& f f2 @, s
open_epicscriptmessages() " `6 A3 ~( |# p& u5 M7 y8 h{ - T! t8 ^& O. ?3 D; I' |" Q# _. ? A#generate temp ".epicscriptmessages" file based on pid , J" j7 j$ u5 X- S7 G+ r$ `; V' ?, {- eEPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$ : _9 E* z- y" V3 D# ~% Kif [ -f $EPIC_SCRIPT_MESSAGES_FILE ] 6 i, V2 C4 ]+ i+ {then 0 P, G9 l1 c: K& ~% R
until [ ! -f $EPIC_SCRIPT_MESSAGES_FILE ]6 N- V, N* N, i! ~
do8 M# m4 P% J a: s
EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$ ! @! q: ^6 O3 u done* w4 d- s/ P- v0 ] _1 R( S, N( M( X
fi 4 Q' v+ w9 k0 g* Q8 \& D7 u0 G9 e! }, F, k" n1 C. l) a
export EPIC_SCRIPT_MESSAGES_FILE. }/ o' g" [! ?$ [; e& u5 x
}! [/ f3 @3 O" d5 {! a, c
) c0 l2 b' I. q Q5 |
5 f6 |3 D+ k7 tscan_for_hva_args $@ + x0 Q# F# ~4 }; w5 O1 o) W * p, j5 y2 t2 ^! J; Xscan_for_har_args()# v! U! E Z: I, ] @% z; }! S
{$ ~+ f- v- t$ }3 R2 Q8 _; m0 b
while [ $# -gt 0 ]; do. m4 G' \$ M$ k1 A% m8 Y" e& T$ B
case "$1" in0 T+ c7 w' e! T; ~
-har) ! y* M. b+ A0 h% D; U+ F$ Y* o have_har_flag=1 9 G0 @" {- y& J* G [ $# -gt 0 ] && shift 3 n0 s6 D/ U* d8 u if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then 3 Y) \& x/ O: ?/ I( o+ D+ V* C har_hilo_file=$1 * Y$ c$ I( p* i# |5 L) s shift7 S2 a }5 `( d* }
fi 2 P. x3 A7 L9 U# O- o if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then 4 M c0 M0 k! y" b9 q3 w4 n echo "Too many arguments to -har flag. Only one hilo file allowed.": H1 L1 |9 L: b' u2 A4 G3 `
exit 1 # ?! F% i4 t: Q: l fi ; n# j& r; g! ~7 Q1 e# a break) q0 \) H: ~6 i7 R1 W
;; # z K7 I+ k3 u3 [. @& K, \/ u. W; s -har_setup) 0 ]- m/ m9 X+ o9 d' Q4 w2 c0 v have_har_setup_flag=1; m' j ?' R2 `, Z$ c& T" Z1 r
break ) k9 o$ w8 v8 u2 { ;; + `1 S' ^$ @/ e' c *) ; e1 f, g, b0 V: o. C' F' S/ e shift 8 } D0 ^: h6 T! @ ;;. m/ j: `' f, ~; Q! ?+ H* k
esac: G5 I7 o6 U9 f3 a0 ]
done) f1 e( ^$ q7 b1 T0 g1 V4 W4 T* q) y
}5 U1 f& j0 y: \: Q
5 X! |# _# N; }scan_for_har_args $@ : ^; m; a8 G- V) |/ Y) A! T ; u# U* \5 Y' Z. o; Hfor argv in $@ ( {( j j: I; T' ?' Kdo : r- R: d5 g) t) T5 \& z- M ORIGINAL_COMMAND_LINE="$ORIGINAL_COMMAND_LINE $argv" J: O: B( H+ `4 q# [" t1 ~ if [ $argv = "-gadb" ]; then r- B% q" R: ]8 @ databaseOn="y"( |8 v, F X! D% W
workDir_next=1 ) w) o; \% \% i3 M Y elif [ $workDir_next -eq 1 ]; then% f6 C) F: s* X$ }7 i+ J1 V% p
workDir=$argv8 X6 K5 q4 l9 D) U, m8 y* G
workDir_next=0 & `: _" M! T1 l) F4 t& n, E elif [ $argv = "-ga" ]; then; ]6 _: G: a7 d& _2 O' ~4 k
gui="y" 2 X, R# t( M; D% [1 @ elif [ $argv = "-f" ]; then + K2 K! k2 i9 l" [, G f_next=1 8 e' U/ m$ F8 T( b5 C elif [ $f_next -eq 1 ]; then. Z( ]4 X6 n3 y& g7 c
f_option=$argv4 l' i/ f" B+ U
f_next=0 O6 R' u! F. m. ?' d$ k
elif [ $argv = "-o" ]; then3 z+ T- F5 D; s" u- @5 A
o_next=1 # \4 d) P' ^8 D$ m elif [ $o_next -eq 1 ]; then + F7 }) M: E. m% O5 I5 ^ o_option=$argv4 a# a7 t) m# l" d h( m
o_next=0 1 _; Y* A% w2 H+ Q& J1 ~ fi 8 r% r( f6 G( K7 Q( ]5 l6 v' odone ' G) M) o/ }& Q5 e; R* K7 cecho "Command line options: $ORIGINAL_COMMAND_LINE" > $EPIC_SCRIPT_MESSAGES_FILE 9 J& _$ y- S _! ?1 v6 D
# V# }6 X6 W A5 K9 k0 f, z/ k+ q# P
if [ $databaseOn = "y" -o $gui = "y" ]; then 3 e3 R) w5 ?5 u/ d if [ $cmdname = "pathmill" ]; then& J" _( i0 i! ^8 n/ C) `
if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" -o "$EPIC_ARCH" = "SUN4_SUNOS_5_64" ]; then, t( O! V9 P! t! J
ostore="y"4 [' F" D3 u% n* ]' r2 q
postgres="n" 5 D* I$ o; m; d7 G else 9 o! g- P9 V h, }" p. r- u: U echo "athmill GUI is supported on Solaris platforms only" 1>&2 1 s$ w# B# I6 _0 S! a0 Z) y exit * y# }# m: f7 u4 B" a4 h6 o( M" c fi $ K, h' h; {# N$ r" J else! \( d4 z9 O+ l% P( w c
postgres="y" 6 U" B. o" t$ B ostore="n" + Y- _# x5 ^- g ?, {- G fi ) X1 L3 x' w: y Cfi d4 z9 j' {! U) D: }/ ] s7 V& t/ b6 A0 @
if [ $gui = "y" ]; then& l; X. T- c! M$ B" ?4 A
if [ $cmdname = "powrmill" ]; then4 M/ }* P5 ], w
pwga $@4 _$ E2 v" w8 J8 ~3 f- ^% h
exit5 e7 |+ A0 y; z8 t! R3 `
fi ; N4 P. ?& z, Q2 w. i2 C 5 O; k4 D2 \* v) {0 ` if [ $cmdname = "pathmill" ]; then3 I2 T; q8 h. p" ]+ h* R( e) W8 G
if [ $ostore = "y" ]; then" b. \/ P) k' |) B5 @
./pathfinder $@ 2 a4 A* b- j' b- e' K2 f5 {$ b exit, n6 ^( C: K' F' k% B7 W+ v5 F; E; X
elif [ $postgres = "y" ]; then9 n4 ^* h) p K8 b9 v* q* P% j
pmga $@ , L0 G$ I' [) x- C! ?' i7 a exit+ c. O0 ~. f: W3 _) y7 C4 |$ l
fi m' l2 y% }5 L* G! ]. Q0 G1 I# N, U6 o fi8 W8 u) g5 f" |8 v
fi $ \2 ?9 d- J7 ]8 q ( j; o' z* Z9 k9 j; {: ]0 Pif [ $databaseOn = "y" ]; then 8 u! t, p* L4 X1 }& f9 U if [ $ostore = "y" ]; then2 s6 |2 N4 G) i! h+ J& h
if [ -z "$workDir" ]; then 6 }4 {$ |. ~' v0 N echo "Error: Missing argument for -gadb option" 2 n0 w4 V& v; I4 b Exit 1 9 p1 ~6 g6 n! C/ u; P fi3 J; }, U. i& n5 J _& i
fi 2 `# }8 y# ~& u- j8 q if [ $postgres = "y" ]; then7 w( D8 f4 K" o' m0 {8 ^, A
if [ -z "$workDir" ]; then9 O* h- R7 }- ~2 F& G
echo "Error: Missing argument for -gadb option" ; d: {, v$ f0 @0 a% a( Z. p Exit 1 " m( j9 R" c6 E3 i& c0 `) e; U fi g/ H0 z& y. i& t& i- W8 ^: x fi6 B% u1 g; \9 S7 g" S
fi; Q& L7 S5 s& ^% s6 H% d* V
/ g; x1 I! C$ \5 O5 Iif [ $postgres = "y" ]; then / a6 G( @4 x+ i% z7 ?0 ]4 r; [& y8 q
if [ -r $EPIC_BIN/scripts/gui-init ]; then + u0 }1 I4 e% T. n. q, S' M . $EPIC_BIN/scripts/gui-init ; t/ T7 f1 D" r( q) v+ b elif [ -r $SES_ROOT/bin/scripts/gui-init ]; then$ {/ T: C9 z- R, w1 A! Z: z2 D
. $SES_ROOT/bin/scripts/gui-init" x1 b* ] G- N: t( v
else 2 F. [# C* g: E/ M. _% V- a echo " ** Installation in \"$EPIC_HOME\" has been corrupted!" 1>&2! [; R; r% m* G( \
echo " file bin/scripts/gui-init is missing." 1>&2, i0 r* {4 X/ Y2 y$ Y7 G
fi 8 b1 i9 y I8 N8 q# @" {% U, J+ O% Q
workfile -tool $cmdname $@9 Y7 w: v% ]. B! J5 g
fi1 H4 X [8 b# U7 b& D) L: t
D* j& y, a. A& o- Fif [ ! -z "$o_option" ]; then 8 |/ N, h! _5 M: H' r$ B$ `5 v errFile=${o_option}.err |7 L- x# a/ l X( p7 ?elif [ ! -z "$f_option" ]; then 3 I& r2 u: x# v, O! f( K0 r if [ -d $f_option ]; then 1 N: ^/ P! h8 J: f* w* }6 { errFile=${f_option}/powrmill.err- z+ ]4 V/ l+ q, ]) b7 J
else errFile=${f_option}.err - g/ [' `3 `; g$ O. S: \) F fi' U1 ]# r7 ^* U) P. M% a( g9 v
fi 3 S4 m/ Z8 G! }4 q + Z5 ~; O& w1 \9 R* A5 V% y & c, r$ w8 n' Y+ A& ^% ~# @if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then2 I- w: ~3 G2 m+ C
rundir=.epicrun 7 _/ e, Q/ I% j. Relse# }% E& b- p, D. ]2 @
rundir=.epicrun$$ 9 @! |8 W) ~ u2 E6 `7 F/ @fi" ^( ~8 g' R0 t4 ~
$ r. @% F3 Z( x2 S0 e0 Y2 Rlibpath="$rundir${EPIC_DLIM}$EPIC_DIR" 9 c2 V1 a7 g+ O8 D3 O' {; k+ F% Z# c: z& W0 G. ^, v+ z
cwd=`pwd -P` " q, \$ E' I/ Wif [ $cmdname = "acehdl_w" ]; then % Q- Q. C6 w: O. X) d' l4 f cmd=`basename $0 .sun` 3 S2 |- x& {' B cmd=`basename $cmd _w`5 E$ r" X6 R X
else ( q3 G% K7 r% P* n3 A cmd=`basename $0 .sun` 5 R, k& b: }* a4 F& vfi! a4 |2 ]" f& ]
5 @! @( n3 b9 G
command="$EPIC_EXEC/$cmd$EPIC_EXEX" , ?* v7 u7 o# \, F; Z9 a4 s[ ! -x "$command" ] && echo "$cmd: not installed!" 1>&2 && exit 1 6 C$ M. f- M4 f8 q8 I" d" {% R8 n% d/ C+ ^8 Q0 v+ U7 W6 j$ o' e* G
# buildmod extracts -u/-fm options and calls genepiclib- Z7 w' W+ n3 L
# It also set the remaining options to variable CMDLINE+ X! u% j; r. u# V9 S
# look up in .epicrc for -fm & -FM parameters , \& @$ U$ R; G) c% f- k; l8 B) P' Q E2 R
fmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`"6 `1 `8 u% L) e- M( ~/ T
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`", C" ]; f. M$ t N7 G8 w
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`" X) @! m V+ s7 {! }" c* w' V$ O7 M
0 e' O* S, D7 fFMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`": H% D/ T" E6 D4 F! j U) h' t! B. D
[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`" : o! D! L$ m+ W* u% p. W l[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`" / e9 B7 o4 k' _# r2 I1 j2 I& w4 t& u3 g- k( Z9 V6 d3 ?# a( `( I
if [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then $ a. ^5 N% G& P # note that the buildmod script will set the CMDLINE variable + w5 ?+ O" c1 Z1 M8 j& C o . $EPIC_BIN/scripts/buildmod / I* F m3 ?" c' E+ |6 Q: |4 r# n& [( p. }
#echo "This is the value of cmdline=$CMDLINE"3 I% E+ V% S' M3 d H' w, Z. M9 D
#exit 07 s4 n+ T/ P. F1 j8 V" m4 D
5 O" ?% h+ [( ?0 l% n) P { # if a new timemill/powrmill/pathmill built, run the new one 2 ^4 Z, S7 g4 u3 o; u [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX" ! R: E4 W0 L: y9 h& }5 wfi ; n" a7 z9 z p& P, f- w& B 7 g" R( p7 K4 x+ p0 G/ _3 Dif [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then; e/ s4 H6 p+ b# t% w4 z
if [ $have_har_flag -eq 1 ]; then s& g1 h7 p e) f
is_special_har_run=1 ) i- t* ]- `& @8 y3 W0 ]) N if [ "$o_option" = "" ]; then4 K* @0 R% Q% W9 n1 ?
case $cmd in & _" x, V- o) f! P) o1 X timemill)5 d1 W$ }: G. B) U! |: {# K* O2 i
har_ofile_prefix=timemill; J. E" g# o- f3 ?7 q
;;4 m3 F7 y ~9 t" Z" R# e
powrmill) ; t' p3 X; k; w2 y9 `' K har_ofile_prefix=powrmill / o$ d1 v1 G! {7 k" E9 ? ;; - T9 F. o; K( k* G2 v nanosim). Y7 _4 l, f, Q; _
har_ofile_prefix=nanosim: k/ g5 X& G1 k+ k
;;: u9 E' Y+ Q% ], Z
esac - ~& m& N1 j% }* `5 W" C else ) ?: S/ `, {+ d+ l$ p/ a2 _0 y4 i har_ofile_prefix=$o_option . l* {/ d; r3 N$ z w fi / ^$ j# m: j, r1 b- _ fi1 x5 o, _: s7 w1 _6 Z d
fi( i1 J; d( }, j& o: R
8 |$ Z; t8 O- ]( V/ R% @7 Y8 Y
# Call Double precision version of the product if -D % U# R2 _! w' g6 i& R5 B5 W% ^# or simulation time > 1,000,000 ns. 1 z4 K5 m' C0 f$ Z! e' b) yif [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then S+ R5 ^5 B. r+ r3 J1 k
c" r7 A1 p( D, f6 }4 m
# Now the binary always has the ACE feature Q2 W. X' N+ [" B( _ USE_ACE=YES, }- x0 J# I- ]* t
: Z, r0 k. c- N0 H4 r) R HAVE_DP=NO 9 d" @4 r3 o, A EXTRA_CAPACITY=NO ) H$ w+ f3 {) {2 O DB_REAL=${FORCE_DB_REAL:-"0"} : n2 V4 v+ \) q/ O+ K ) n" F# m- f+ |- P7 B' B # Enhance for ACE ease of use 5 h+ z: N& T# `% C( g* e! f # If no command line option or only a -T option, do:1 K1 W4 S) m9 q
# 1. set -A option $ P. O8 Z- j* V; o2 ? # 2. assume input file to be hspice # ^4 u- b( K$ z9 m/ ]5 ]0 h9 G3 y # 3. set -o to input file prefix# u, W% o: q: G
# 4. set -z to input file prefix . ~$ n0 R6 a/ M% K6 u6 U+ t # 5. set -c to default config file2 U$ \; z8 [2 ^) w& [) m- S
netlist=""+ A2 X9 P+ r# x# ]1 J1 W1 K2 I
minusT=NO0 `$ }! Z3 X7 A/ ~* i
useStdCmdOpt=0" y# c' j: ?, a: G
prefix="" 3 m+ [6 l+ |3 K! d6 b3 Y5 T circuitType=""3 r" ~# c& o& `8 T
for opt in $CMDLINE 4 e! ~% c8 _( Y do. N, F+ h7 ?% Q3 o" c1 k
case "$opt" in 9 t, C, B7 Z! [' D5 P
-T)& v5 Y" i5 v. N7 h4 E8 \6 L, p
minusT=YES 3 O1 m! P$ T: }' S( ^, t: I ;;" N- y4 B& b+ i$ r; _! n+ o
-*); u7 r/ M8 c6 Z3 T8 Q) l) \
# using standard powrmill command line" y" P( |# `. n3 z+ z
useStdCmdOpt=1+ I- K$ n6 {# O4 \0 z' ?
break0 {( V0 N9 A- x
;; + W n" h/ v& l6 s% F- X/ u* r *)# o; n0 J1 G7 s. `) x, n4 o; A% O
if [ "$minusT" = "YES" ]; then4 R4 e( C* R, u0 [. Z
circuitType=$opt( }5 q/ l2 o3 G* L+ H, Q
minusT=NO # reset flag" y3 S, Y. ]' V9 ~" `: u) k" u
else & N, y6 a: s2 _- J: l. t% G7 V' c
if [ "$netlist" = "" ]; then ; P7 ~; H, x) ]4 ^ T9 K prefix=`basename $opt`- c5 @ ^" g# h# V1 m
prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix` % A1 S o6 {9 h. {" }- C/ C. H" s fi% `4 i* \% u# G2 T$ T' D$ a- b. E
netlist="$netlist $opt" 3 P# o1 |+ Q. T; M9 F/ ~$ U9 C1 ] fi0 S% w% Y7 t; }7 E
;;) f& r9 k' A* m U& L& y
esac 2 p1 k w8 u4 T: P( u* e; z7 X. G done 3 Y" Y) u' p* k1 W2 i( T; Z, h- C6 E0 b7 i' | A# [* w; k# ?7 w" [
5 s8 N8 g" ?8 C; K$ x+ h
if [ $useStdCmdOpt -eq 1 ]; then , m, B K6 a2 Y2 c1 J # use standard powrmill/timemill command option " K1 d9 q! H1 l6 D for opt in $CMDLINE0 a7 j6 a& e# L# @7 V
do7 ~" i }$ u3 Q5 f% B
case "$opt" in + [0 Y4 L* K* `( f7 v5 Q& S8 u7 g& D
-A): F8 j/ i6 w) ^. D+ e: @6 u
DB_REAL=1 ( ], W( @! P9 I' J ;; : }* a) G5 W$ J) u" w3 F5 H8 Q esac ( u3 m5 b1 I# }3 X: t* {* ?( M done9 s: s* U5 {( ?! O2 F
if [ "$netlist" != "" ]; then% l# }/ c+ j. o' L+ {0 n% o
CMDLINE="-nspice $CMDLINE" , P0 A P, X2 I+ P4 V fi 3 P% c H) d4 d else6 d1 Y2 t. m) _+ _' [! e y
if [ "$netlist" != "" ]; then* j6 i: I/ _, X# w
EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"} % D; q8 w6 Q" R; \8 z! p # construct new command option$ y% X3 g7 K8 \4 h/ e X1 u Z' i
if [ -f $cmd.ini -a "$circuitType" = "" ]; then+ Q( ]3 K7 p: t
CMDLINE="-nspice $cmd.ini $netlist" $ L. V. X8 |4 W5 V else# }5 j7 r; J1 R d4 V
if [ "$circuitType" = "" ]; then 3 g& j* k& h/ w circuitType="msana" 1 Y Y0 v* c7 o, j+ G/ w7 { fi6 K. h0 g9 X; }1 p( O/ r
CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg" 0 s2 r' w2 j2 A1 ` k fi( K; c1 Z: m5 Q7 c% L: u
CMDLINE="$CMDLINE -A -o $prefix" ) B1 [- M& \! Y4 m" e- b7 ` DB_REAL=1: C2 K* D) q7 \: }
echo $cmd $CMDLINE! g t0 |5 H- O
fi ' u5 L) n4 I0 Z# `2 Z; i2 V4 g fi9 ?% Y) w) y! t' V7 |9 M% m& N
fi # cmd is timemill or powrmill or nanosim or railmill or pwarc $ R5 e3 X0 @; f: w5 P6 m) j4 s8 [+ n4 q" F) ?* m! B) H3 z
[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a" 4 n5 x# g9 }& _2 _8 o. ~. ~+ d% {3 g/ m[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a"! l9 I$ u/ c' M8 k
[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v", p3 K' b4 I; o1 m! D
5 w( P1 q4 h/ z b- N9 r9 R5 }if [ "$__engine_wrapper_called__" != "Indeed" ]; then & Z- ~$ ?0 E/ O, n. n. I/ H8 g8 w __engine_wrapper_called__=Indeed9 Y6 p2 m/ N6 C$ F2 A# y: ~0 Y5 b
if [ "$cmd" != "amps" ]; then 1 g' d/ J% K' K9 F; S. J export __engine_wrapper_called__6 h" }5 J6 Z5 B: n& }- ~# y8 t
fi , a; a0 K0 M+ e* U' _: [& m) `" ]. | r4 r4 W
trap "cleanup" 0 4 T. t5 U0 }& h6 X trap "" 2 9 t, \ i+ A5 B H8 t f/ R 7 H8 j. G: v) e/ P [ -d "$rundir" ] && rm -fr $rundir $ N* v. y F$ C( k2 ? [ -d "$rundir" ] || mkdir $rundir- }3 m7 y1 F9 D
' G+ O9 D O4 H! S( f case "$EPIC_ARCH" in : ?! f9 f" n& X- R# K( }9 d: P% C" } *SUN*64) / v' m9 ~: [' V0 _ LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"! m. r1 C/ C6 n* K: ?1 F j5 q
export LD_LIBRARY_PATH x2 f$ }0 C: c& n suffix=.so 6 O) \( j7 l1 k% v- l- F8 B ld_err_code=127, Q+ _7 A# j% g f( g! V# t
;;$ e% h/ f: V8 _8 c* p
*SUN*4) 7 A* T1 x' ^" v
LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"( C' i& m# V/ N
export LD_LIBRARY_PATH' H/ g Z6 ^( M
suffix=.so.1.0 ! x5 P W) S* Y. |( U8 A ld_err_code=127 ) |% L! \! x! h |$ F ;;7 {/ \6 ~0 H: Y' B I8 N
*SUN*5) ( d/ d6 Q8 R7 N1 b n* A
LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"/ ]0 |# n+ q6 I' }
export LD_LIBRARY_PATH 2 ~8 e% U' \# S) D) X suffix=.so |# [! g: [+ l7 g: U
ld_err_code=127, ^/ G0 |& t% X4 }
;;: _( P5 {1 V% Q" v6 }
x86sol*) ) A+ ~ m% M* G" Y7 i LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH" 1 C& N! E m/ F/ C y" l+ W; I export LD_LIBRARY_PATH 6 i: g. H1 k& J& g' O+ b. b" F suffix=.so ! r# n* a2 t3 k; r2 t ld_err_code=127" {7 s) V1 O/ H3 s) N
;;9 c3 B* e' Q4 @* t
*AIX* | aix64) ( d0 k$ u9 a1 s& J, B. V
# When genepiclib creates shared objects, it creates a import file and 6 O' y% _4 c2 @5 h# @# d9 k4 ? # uses timemill as program. So at exec time,program timemill is needed : N0 b" S2 w) |3 C% W3 ? # in LIBPATH $ A E( ] l$ Y+ C! B $ln_default $command $rundir/foomill# V: z2 @# s! C$ R( j& T
LIBPATH="$libpathLIBPATH:/lib:/usr/lib" # Y9 u' A1 W% h- M; k9 y8 C export LIBPATH A+ K- O6 d3 S. t, y
suffix=.o : o9 B I* z- ^8 }5 I6 A0 O ld_err_code=8( ]! ]3 I. i4 J' F2 e0 r! E& Z
if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then+ K% X3 E/ Z8 w0 f+ o Z2 [2 p; U
tdir=`echo "/tmp/d"$$` 9 W! e a: R- ^/ p# L [ -d "$tdir" ] || mkdir $tdir , v3 A2 e$ ]2 u0 L if [ -f $EPIC_DIR/libCustom.o ]; then ?$ B% r C# f) Y; H5 m cp $EPIC_DIR/libCustom.o $tdir/& a$ \6 a5 D' E; |# c# j n2 N
$ln_default $tdir/libCustom.o $rundir/" [, f/ _3 v1 P, q7 w
fi( z E0 |6 X# o9 a: m: C% ~+ @: U
if [ -f $EPIC_DIR/libModel.o ]; then 4 Y. z9 @0 X9 Y1 }' C% H cp $EPIC_DIR/libModel.o $tdir/ ) G2 p" e" f$ @; y4 q4 `/ e $ln_default $tdir/libModel.o $rundir/ $ t' |) a: W! F8 ~( m& i fi/ ?3 `3 V3 ~' k9 H3 a& y
if [ -f $EPIC_DIR/libFuncModel.o ]; then * K: @ [" _6 o; y* u cp $EPIC_DIR/libFuncModel.o $tdir/ 9 ]# g4 i2 y. B6 i $ln_default $tdir/libFuncModel.o $rundir/ : {. [$ b2 ]$ {" T+ i, e* @ fi & }7 o1 `) F1 @( \3 {2 Q' V# v. ^$ c if [ -f $EPIC_DIR/libFuncModel.34.o ]; then& W8 L- V% K/ i7 g
cp $EPIC_DIR/libFuncModel.34.o $tdir/9 t5 y+ U3 n/ b1 K0 T
$ln_default $tdir/libFuncModel.34.o $rundir/ 6 S. U7 T) e- [ fi / _3 T5 C+ B j9 x" k1 c K fi , ~0 s3 s! k7 a1 d5 W* w #Set the IBM flag to enable more shared segids: m( V* }/ u; M8 F9 Q- T7 b* s. h
EXTSHM="ON"* _, A( ]8 y- Y
export EXTSHM3 g+ E( D, {% S- A m; ?2 W/ X
;; : C# b6 h D7 {2 F5 ` *LINUX*) % H- Q5 [3 F5 ^' K1 A
suffix=.so Y* `* Q' s) T, g* R4 w
ld_err_code=1! l. u C, w) h4 A5 |* \8 O( a# G
;; / I! N5 c4 h1 }6 ]9 ^) U3 n4 B" p *amd64*) ) h6 [! U* g* I, e% w8 M suffix=.so 3 Y3 i! \3 C. V/ E, @# o) M: Z1 w ld_err_code=11 |3 L; d9 D% y: R6 q8 H; ~' }
;;: I/ q; S4 _7 W) }1 V
*suse64*)* l/ i6 w4 Z. \) V
suffix=.so 5 I4 I+ t, U# `# @6 @) { ld_err_code=17 s. `* {8 E; c! k, }+ T
;; # h$ T* n8 k6 @3 B3 Q* `) k7 I+ ] *suse32*) + ]2 p! p" h) w; I/ K5 b) Z suffix=.so 8 r' n: H! ~2 t% K' Z2 c* R, t: S ld_err_code=17 C% j0 }* j( _) T# N, T
;; ( d! m% @" x1 o3 V+ }' n* L esac( ?! s& Z' O3 K0 a! w9 P# k; w
; t7 ?9 k' [! G4 H
[ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix"1 Y- @: @- b. C" P( C) O$ V$ d6 S M
[ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \ : f$ l2 A4 ]* s9 |3 ^ && [ "$cmdname" != "nanosim" ] \ * _9 r! b1 k6 s/ x/ ^0 v$ V && [ "$has_model" = "YES" ] && ulib="$ulib $cwd/libModel$suffix" ! a1 h9 W8 H' |- K8 R C0 [ [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix"# Y) C0 s! Z7 P
9 k' G( S* X( ?: t' Z$ Q/ M& ]+ o
#Look for command line option for libFuncModel.so5 v, F/ F+ j$ H. j9 S$ c' P
# user_library_next=0 ' p+ C: {! G5 ~) _ has_fmlib="" : q+ ]6 W+ S& g* R, N for opt in $CMDLINE $ t5 k% e" D4 a' s/ D do $ |* K5 [ U. F# Y8 {, l case "$opt" in % ?7 ]# I; n% A& r
-fm)9 U( @- k b' K, I0 d. j
CMDLINE="$CMDLINE $cwd/libModel$suffix"- n$ N2 F0 i% r, U) k2 G
;;, S% V2 H, e- ^$ u7 x
-fm_user_lib)1 l: _6 n/ z0 s8 q( G, q
has_fmlib="YES"8 o$ r% _% D! j/ h) g
# user_library_next=1 9 y5 v" b8 v1 c ;; ) f+ {& T( C+ T2 T0 U -xc) - E t/ k5 R1 D if [ "$EXTRA_CAPACITY" = "NO" ]; then5 H" \9 m: ^' i7 V- e% d4 X) |; g4 r
EXTRA_CAPACITY=YES p0 \! B; S; h2 z+ h8 g, m/ X, |' o/ [ fi/ i2 |% Q$ L8 A3 V1 J
;; " W, ~& U2 w! X6 D2 d# *) 0 j0 R6 ~' T, f: T% ~' z# if [ $user_library_next -eq 1 ]; then& e! x( O& U# J9 Z |
# if [ -f "$opt" ]; then / ~1 }+ U; g5 u! y- H- B% L4 v& [# libfmodel=$opt% f9 T; @; r. ~# G% @3 W: K3 \* l
# else" S* V. t/ f4 S+ S
# echo "-fm_user_lib: Specified file not found"1 I3 h3 \$ m# _' z; C$ M7 E; y2 c2 J9 [ R
# echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages . d+ a- F) ]. q, _# fi j2 v+ o- _9 _6 H1 x/ u% v$ [# user_library_next=0 4 {) t/ L, G, S K8 H. _! c# d( i# fi& w" G6 N: Q4 F, ~( k `
# ;; 2 n# v$ o* ]7 p; L& m9 M esac u- }, u3 V4 K- W- m' `
done * k f! W2 ^ @5 C& c3 s# L, G0 C* N; V# \/ a) d- B" d
if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then$ c F! O8 I4 O. R; U* d5 N3 U; E
flib=""0 C4 z7 Z( p* s3 c
if [ "$has_fmlib" = "" ]; then1 Z, c3 B; A* c0 Y# b4 x/ |
flib="$flib `get_epicrc ./.epicrc user_libraries`" 0 F; w2 u9 f# M+ A! v5 A6 G' } flib="$flib `get_epicrc $HOME/.epicrc user_libraries`" 2 o- H+ g" W I4 G flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`" 6 k9 o' i' O0 V" ?4 r( [5 T# P2 H4 n fi, `+ n/ L& {! W" M! Q" C
fi* J1 M. k6 S9 Y( l
7 I$ x+ E0 z4 ?& u1 y
for i in $ulib5 U2 D# W6 k; g* X) x
do 0 A3 D- D5 }. C [ ! -f "$i" ] && continue( J5 o! S7 M; G7 Z3 T
dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd0 ]+ ]& P, j; `: ~1 d
i="$dir/`basename $i`"' Q; J( c6 Y1 K
case "$i" in 4 e! j9 d' c+ v/ A *libCustom$suffix*) [ "$libcustom" = "" ] && libcustom=$i;; + y0 M6 K% m: W5 t" I @! i *libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;;2 y, }: E: F$ T, b b
*libModel$suffix*) [ "$libmodel" = "" ] && libmodel=$i;; , v7 q0 I5 v4 M* F *libva$suffix) [ "$libva" = "" ] && libva=$i;;0 |7 x {( ]! m
esac! _+ U# Z! `$ i) ~
[ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \# p0 \1 c8 W$ r0 w
&& break+ w9 y) O. z0 r* F" A) }2 W7 z
done / A4 d8 T: ~6 x: P7 M: w* ~+ u% O: I% d6 x" o( V8 n! l1 w# {
# symbolic link shared libraries to .epicrun$$ 7 C5 I6 y* s% O* C; ~/ m cd $EPIC_DIR; epicdir=`pwd`; cd $cwd ! x' T# N2 m5 P& H if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then9 r6 g0 p! f; u' ]
if [ "$libfmodel" != "" ]; then " r& T3 Y: Z( n+ M. i$ T) e [ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \ $ b5 @7 I2 F6 }& t/ Q echo "Using $libfmodel ..." && \ 2 Z4 i4 ]9 }+ w. V, l9 t echo "Using $libfmodel ..." >> $EPIC_SCRIPT_MESSAGES_FILE * N! `6 F0 U9 ~ _ if [ -f $rundir/libFuncModel$suffix ]; then + H. y" D. Z( q* E& ^/ X. r0 w rm $rundir/libFuncModel$suffix1 C3 r' w& d. R
fi ; W, t `) G* d w $ln_default $libfmodel $rundir 0 U6 N l6 [# H! M5 N fi ( k) D4 N+ j2 `& N4 T0 O( Z; N( ^ if [ "$libmodel" != "" ]; then8 ?; ~0 d9 R' Y8 C
[ "$libmodel" != "$epicdir/libModel$suffix" ] && \$ x, A1 c' @# x
echo "Using $libmodel ..." && \+ M& A$ A' [2 d" y
echo "Using $libmodel ..." >> $EPIC_SCRIPT_MESSAGES_FILE0 B4 Q' x+ z4 {
if [ -f $rundir/libModel$suffix ]; then; e/ I D+ t) C- e+ Y
rm $rundir/libModel$suffix ) Q3 S( ]7 P$ x% n' m fi" F6 }6 J) I4 d, L5 x
$ln_default $libmodel $rundir * }2 L8 m1 W- u/ O# ` fi ; B. P$ l! V% b" G+ Y: |; j$ ? fi9 v7 a& h6 S K- E1 d9 {0 N7 f
if [ "$libcustom" != "" ]; then . n2 s$ D6 q& P' E2 J [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \ @8 l, F$ _& J9 u" J echo "Using $libcustom ..."3 Q9 ~9 d9 V U9 ?
if [ -f $rundir/libCustom$suffix ]; then. A6 ^% q9 V- K. X. b
rm $rundir/libCustom$suffix 7 f1 k+ D A/ W- T fi : L% Z! [% C4 `. A0 I8 z $ln_default $libcustom $rundir $ Z# ]! U2 ?, }4 i. q5 e* ~
fi: I- z8 K. j" R8 C& H$ c- S
. b/ P& e2 w5 e' _' | if [ "$flib" != "" -a "$flib" != " " ]; then, D1 x3 M/ g1 g% h }, v
CMDLINE="$CMDLINE -fm_user_lib $flib"4 K8 `8 z5 m/ {& m2 F
fi # ^4 H# B1 G: K3 y2 ~# A# T N! F
if [ "$libva" != "" ]; then# S0 `/ \+ o# E/ T& E# @
if [ -f $rundir/libva$suffix ]; then& _5 G3 A: P# r/ ~: s7 K
rm $rundir/libva$suffix l# J4 O7 M K& l# a) X4 o fi3 \4 b3 Q) F& d* P6 t! c1 K
$ln_default $libva $rundir - e' d7 x% m4 F, T- K$ t9 D( M; X" z fi& M! g" J, s! e3 _
1 T& \: R9 H! W. I7 D ]2 B
$ t3 I/ C! h R6 h; ]! P+ d # VCORE design library ' z$ j! q1 C* Z! V- f; v if [ "$vlog_design" != "" ]; then8 ^8 ^ h2 n1 W6 u& e2 M
$ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`3 L3 {! S5 R4 r
fi6 D1 n% {6 A: C: v5 K
' f) Z0 q1 {6 w \" c9 k# w" b
if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then1 @3 Y" A# f! n) x0 O9 I7 H3 o3 r
EXTRA_CAPACITY=YES2 l( ?! C% i/ g' a& \ J
fi+ N, L. `( s2 r' i) ^: S
3 F1 k7 f1 i- }+ B0 _2 X [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc"/ f: J# c( W- \1 R
[ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc") K; b& c4 o4 d6 X3 d
#Create temp file if dual process is on + I( v; W! v& k) K* Q if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then$ G* [5 {0 c5 X! p \
if [ "$EXTRA_CAPACITY" = "YES" ]; then/ f( l* _" x* [; n h3 G1 ~- Z+ {/ Q- P( S
touch $rundir/rpcidfile i1 e' T+ L+ Z4 ^7 l# \6 T t3 X fi . R9 ^6 Z: z( ]* m fi 2 G; E7 v" S( V o5 I8 l/ l. bfi5 a* c! g0 R! b7 ~
7 r" N8 g4 w) p
run_cmd() / A4 n% d2 [$ n) w& K8 }{ ) F; \; ]! n0 M7 ]3 V1 m( b command=$1' C X" B* I: L4 ^" q
shift ( r% ^. S& ^8 h( k' w; N6 ^. ~% \9 y* o1 z6 J; ]. e' @ Q% D
if [ x"$VA_FILE" != x"" ] ; then3 Z. ~+ ^: d: f0 _: F
cmdline=$ARGV ' a5 e8 P! y! q4 ] else% G$ a: w, `( ?* g; m8 G
cmdline=$@# o( K4 E6 x; s1 j7 E9 f% u5 U: [3 q
fi l1 Z" |. {! K, T( Z/ { 2 N. I2 G0 P B z. a" i4 Y debug=${DEBUGGER:+"$DEBUGGER $command"};/ x! F1 Q3 m) O1 w
6 h) L7 s, K* u/ e& P M/ o
# To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a 4 K2 v0 U, M: c$ Y& E # so save-restore may work.: _- G, t" r1 ~+ j: ]6 S! W7 e
setarchStr=, ?. B) t& P0 q
cmd2run=`basename $command`8 U$ `. J5 r$ u0 C" [8 u
if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then 4 ~9 p+ L/ |9 l9 { if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then, x* i/ H* k3 V
setarchStr="setarch i386 -R " @; p& R! m8 D- o
fi 8 Q6 K) j$ t* @: l4 ~ if [ "$EPIC_ARCH" = "linux" ]; then 1 q) H0 R$ E d" l$ p; F setarchStr="setarch i386 -R "% B/ t! V9 y; Z: k4 f& L! E
fi; ^" E2 l; {- ^+ p/ x
if [ "$EPIC_ARCH" = "amd64" ]; then ) O" N; A$ S' t5 m m setarchStr="setarch i686 -R ", ]2 E0 W: L+ K4 h
fi" ]! ?, _' p) \9 z$ U
if [ "$EPIC_ARCH" = "suse32" ]; then % `+ ~. e" Z" q- ^$ B setarchStr="setarch_suse i386 -R " P2 T6 i! H2 ]; v% b/ X2 A fi% O( }& h) F) ~2 H
if [ "$EPIC_ARCH" = "suse64" ]; then, C7 K- S; m5 W: `
setarchStr="setarch_suse i686 -R " " z5 t0 C& h: L- s! L fi 7 Z6 `. Y/ p& I1 |+ h- p C fi) l) w& i! f5 M6 u- @6 K3 i
% m# l' t# z$ g/ _' W4 }
ret_stat=0 2 I7 B: ^3 \4 W [& z* N if [ -x "$command" ]; then. n4 F8 L$ I: N5 U/ P4 U2 g
if [ "$debug" ]; then 1 Q+ ]- b5 j: y _debug_args_=$cmdline; T- b7 g( [8 b' Y$ h7 p7 w
. .epic-debug 3 P7 a9 _ d8 T" [ else 7 M( l( k* J& q6 v& m E+ X6 W DEBUGGER=; export DEBUGGER7 N: W0 W9 V4 }3 b( L2 G
$setarchStr $command $cmdline * F- x5 ]# Q6 M/ f# A+ c& }/ [ fi' h/ K0 k: Z' K+ P' E: Y! I6 ~
ret_stat=$?5 _% S' q) ?, u+ n8 T
else " g( D' f# U7 z echo "Corrupt installation, executable \"$1\" not found!" 2 H% [, t3 P9 R ret_stat=1 5 x( P0 ]2 o; F fi+ x# Z2 i |' d4 r3 W
}$ ?0 B0 j: U9 Q! R. B) ~! I$ H3 {
: `4 p& Q- U7 d0 a& x4 r2 o; r# keep runing cmd if ctrl file exist: z) }' t' @! E% f! x" {
6 a/ d+ J- Z1 {+ s# p8 e4 R) W
run_loop(); ?- h1 r" C0 O
{* a$ A/ D- x" U6 O# r
command=$1 t+ w2 R1 {& e: @7 Q
shift) c/ z0 e% O* v6 P
& P* J$ p! U' x& u
if [ x"$VA_FILE" != x"" ] ; then' ~- b( ?- T8 q4 h E P8 P. G
cmdline=$ARGV 1 n* |3 {; Q6 [, d! H1 C) z; R else 4 w% J2 \8 Z) i cmdline=$@ - v! k/ F7 T, c) J& M3 K/ h5 { fi " C0 |' H. }, B* ^3 d; H6 s3 n" g( k; U; Y: g
while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do$ L5 S5 o% r: R* f5 p
. $LOOP_CTRL_FILE$$ 8 _0 h+ ^% |+ J; w1 s7 E: s1 q+ `0 K! R! d run_cmd $command $cmdline -banner 25 t0 m" s( k8 r
done;: M% M% p, `" Q$ \, T; M) T0 r
* N' \" y4 F9 x2 C/ r. \) ~# w if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then5 W9 e1 J. A8 t c
rm -f $LOOP_CTRL_FILE$$ , d5 C4 ~1 E7 i/ d fi 9 e6 r+ X, S3 A+ f9 Y G% i} * U6 t% R( k% \' K" N: O( R2 C n$ v/ S/ V/ K
har_check_ret_stat() ) ^0 q1 N n: i; a9 V{) ^& U/ _- P3 ]! r" H
if [ $ret_stat -ne 0 ]; then & V+ A6 D4 T/ M6 o& m echo "Simulator returned with non-zero exit status. Stopping." 7 I/ D$ N' F3 X. `. @! f- e4 i, \ exit 1( K' }. g/ Z) Q6 K8 T
fi8 Z9 V% ], f% y% E
} ; t+ c2 j' u7 z9 G9 Y& B6 }: r( d6 { * @/ _, Z J1 E#( U$ N! L4 w3 }7 F7 L
# set stacksize and datasize limit0 F* x" W" \( V# p8 R% O
# % s* O) x! p w) r% M3 ]- Q5 c7 \# G( a- H7 b& e$ a- l
set_data_limit& O k- Z) f3 Q
set_stack_limit % E/ _. b$ ]$ z 2 e; `4 r$ L6 i; j#rm -f $LOOP_CTRL_FILE % p Z8 T, [) N5 F% T % X* A9 j& B n4 G* Lrun_main()( w; ]7 n: h) F n- w/ [5 x( L
{ ! G8 q! Y+ J0 C( N! m* ^: Zif [ $is_special_har_run -eq 1 ]; then & X7 J8 p, N$ g/ v& h. ~8 t. { if [ "$har_ofile_prefix" = "" ]; then+ F7 ]- y" U: h# J
echo "Wrapper bug. Notify Synopsys technical support.") ?# `4 }0 _! {( o- x8 q
exit 1 2 @! [+ S4 k; z1 P7 @# ^6 b fi! G4 s3 k( Z4 ^) k0 K) Q5 q
if [ "$har_hilo_file" = "" ]; then: Q# k1 [) S( w9 l: W
# no user specified hi lo file - do both runs# H; g% f( Y# @' }9 {
run_cmd $command $CMDLINE -har_one -har_setup- P3 k6 e1 m: s; O5 O; R( r6 e
if [ $ret_stat -ne 126 ]; then 5 ]; A+ H0 Z( @0 o har_check_ret_stat & m. r! Z) {6 i0 A; d$ h if [ -r $LOOP_CTRL_FILE$$ ]; then C# a- l$ s& R* p7 f% i
run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl: S; K) L' i) N, z3 H! H& d
rm -f ${har_ofile_prefix}.hl . y2 _; p) h' c6 i0 G& N" q else : p! c; w! x% @6 i% J8 \ run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl " y1 |: g% }! w) c& h fi 3 s8 j/ z/ L. t- R0 \# C, p& u" | else # y+ Y6 v- S+ b% L/ x" {4 S ret_stat=0 + k. Z- \% C0 P% A5 M fi ! b" O# I. B% Y! J5 W+ [ else # Q9 T$ H# l6 r( A # user gave a hi lo file name& v( T1 m& V; l7 C, Y( d4 n
if [ -f $har_hilo_file -a -s $har_hilo_file ]; then 2 f" j# W9 r9 j # file exists - use it - only do sim run$ S, R e2 Q- |- T/ Y; u
run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}) F$ S) s& k6 G X) |
run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}* q+ T" I( ], g" N& U) W
else9 |2 D( ~/ U: S9 ]- u
# no such file - generate it - do both runs / a' V7 b# d0 ], w$ d run_cmd $command $CMDLINE -har_one -har_fnf -har_setup0 [8 _" d- c8 O$ E4 [$ w4 v- A
if [ $ret_stat -ne 126 ]; then: O; k5 u% D0 _( L. M/ y( c
har_check_ret_stat 7 m5 m9 n/ v" `- [4 S& y5 k if [ ! -f ${har_ofile_prefix}.hl ]; then * c" Q0 K C& {+ G" z, a echo "No hi lo file generated after setup phase. "/ }/ }1 e& N p: U( q( c# u
echo "Contact Synopsys technical support." 9 F" H: o7 B" N1 ~2 I5 o, Z' A exit 17 K6 R4 @% T+ c! m; j
else1 h! F" e) O. L. g4 t1 l
if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then1 ~% L9 w; B, n; s0 R- N# G+ a7 Y
mv ${har_ofile_prefix}.hl $har_hilo_file+ W6 @0 [ T' L' [/ I3 n
fi $ Y5 \ W; t. L! u fi' @0 J, l; ?3 c4 Z1 Z2 W
if [ -r $LOOP_CTRL_FILE$$ ]; then3 r/ X, q+ F3 V7 u. B7 y+ F! ]% }- r
run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file ) x8 J; J" d' `! R G else7 B4 E3 h: X" M0 H- @' W
run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file* p% Q" h: y. ]7 ?! F6 H7 g
fi % [5 U# e! A: r: ^ else & ?! M, I N2 w9 w
ret_stat=0 ( e( ]/ Z% p- N5 s. O3 L$ ~ fi " r& H0 c* X$ H3 y9 m fi . ~' E4 h3 j' \5 b r fi 4 Y" s/ c, v% Q4 H6 a4 Gelse % N8 B0 t y, R' [, \# don't loop if -har_setup8 ~' a9 E/ L! `
if [ $have_har_setup_flag -eq 1 ]; then. Y6 I: c; r) |
run_cmd $command $CMDLINE' I) I% A, k+ r" B0 z
if [ -r $LOOP_CTRL_FILE$$ ]; then 8 W9 ?3 A+ n& O4 |! f6 I rm -f $LOOP_CTRL_FILE$$- I6 Y! L* A( U7 L3 H. d+ h K
fi; v% J8 V1 Q) a' E _, N0 Z5 U6 t
else ( }/ L# G9 \% D3 q run_cmd $command $CMDLINE * i% l" ?+ M- |; c/ ` run_loop $command $CMDLINE5 N( \+ u8 p% C: }
fi & B+ r) _' w/ ?& a( D+ _7 X1 Sfi 9 W5 l! p, y# I- V. g" ?8 i, d! I! d
if [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then ^6 {5 \* @& J; P5 t pwCreateErrDB -w $workDir -e $errFile / V7 l/ {* R+ Z) H ret_stat=$?. K2 {8 ^5 j c, S* n; U
fi( s: D! E# N2 Z% F' X- N
}9 ~7 {. h' j6 b/ @5 V3 v- H
\/ D5 c3 C# y- ? [' P0 m) m5 Pcleanup_alter() 6 g+ \- j2 b$ ?) l! j1 |{ ; M1 A% c V, y' m /bin/rm -f $ALTER_COUNT_FILE 1>&2; X n( j. U8 k
/bin/rm -f $ALTER_HK_FILE 1>&2 " ?8 m3 g* Q" g0 @" V0 _} $ r; {4 A- ~4 D& Z+ K) y% I5 w2 D$ M) K
#generate alter temp files based on pid % K9 x5 t# k4 |& e4 L1 \ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$+ Y. k9 M/ h% |4 W4 t
if [ -f $ALTER_COUNT_FILE ] $ U6 v( L$ w6 t& ^+ ?# `then " j1 [8 H6 C+ }8 D until [ ! -f $ALTER_COUNT_FILE ] 6 n0 r! P, q3 C# \6 G& @$ f do3 f$ c5 ^, L0 r1 i# b8 Q
ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$% X2 U l, J0 y5 C! v
done 9 v# ?6 x# Q* w8 i2 I5 m8 K4 u C" pfi 7 q( t$ h1 l5 z$ N) P* x6 Z' t9 Bexport ALTER_COUNT_FILE ' a8 q4 Z( |$ ]4 E0 T9 k& W* G, r/ [. c+ q7 G- e9 V
ALTER_HK_FILE="$ALTER_HK_FILE"$$ $ O. M2 K y" e+ ^if [ -f $ALTER_HK_FILE ] 6 f* G) J. X% d4 p* H5 C/ hthen % V, V& G4 g& ^+ F5 M& j; K until [ ! -f $ALTER_HK_FILE ]* H) F- }) j2 A) \! C
do 9 B5 |& f2 _! M# n ALTER_HK_FILE="$ALTER_HK_FILE"$$/ ~9 Z+ U# x. s4 b
done , p5 o3 P. u2 l, @fi5 j* e- W- P. D: I4 D8 r
export ALTER_HK_FILE1 f! q$ y( ]$ e4 Y [
) P. c5 T2 J: Y( _8 A" Q T$ D/ Z
#generate monte carlo related temp files based on pid, e3 f3 f- l$ b/ W7 `
cleanup_monte() ! f1 ~7 ]* r7 g* W5 A' R{ : d# o$ \+ [7 G& p /bin/rm -f $MONTE_IMG_FILE 1>&2 , O6 M: s8 I P6 c: O2 v0 B /bin/rm -f $MONTE_IMG_FILE.gz 1>&2 ( C' E: S+ p7 r /bin/rm -f $MONTE_COUNT_FILE 1>&2 2 R, ]% R& a5 p; N; \4 J% X& @! K$ k /bin/rm -f $MONTE_CFG_FILE 1>&2# u' I8 f0 t4 P' I/ e9 f: G+ }4 \
} # L6 @# A7 A8 a$ u# M8 u ; A; ^9 V+ G5 k E1 D0 SMONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$ ' {$ h; A8 h/ X, X1 U% N8 rif [ -f $MONTE_COUNT_FILE ]: e# r _' F ]' F5 C4 {
then # m, l7 F. P! M6 S) T5 v: d. g until [ ! -f $MONTE_COUNT_FILE ]7 q& ~) E# D/ |& [, a5 ^3 s
do# Q. ]! Y) B) \/ x
MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$ 0 F% @* o7 u- r/ `4 K; \0 x done 7 }# q, @" _7 d) c. j1 i7 M2 S4 Q1 ]fi ' E: F5 R: p7 j+ i, W; dexport MONTE_COUNT_FILE1 l9 `% k+ _7 o9 O
5 @7 Y1 F9 I6 f0 H$ m. `MONTE_IMG_FILE="$MONTE_IMG_FILE"$$8 m8 ]+ _5 `. S4 I2 q, U9 V( b
if [ -f $MONTE_IMG_FILE ]- H5 g2 w$ j4 ]
then 0 I+ K4 J' ]: l( g" |' J7 v0 ? until [ ! -f $MONTE_IMG_FILE ] 5 \% P0 \9 O0 J" k do$ Z( z+ L3 _( d/ |9 b& F; D
MONTE_IMG_FILE="$MONTE_IMG_FILE"$$ ; J2 }9 j1 X# W; s; W8 N5 b. P done) }* M4 A: I- o3 {0 f" W2 q
fi % a$ }3 \6 \8 m7 |5 {, z5 Sexport MONTE_IMG_FILE4 r; k; |: A9 \! a$ g$ W+ a! C& g
, w& {! K9 m9 i; n6 CMONTE_CFG_FILE="$MONTE_CFG_FILE"$$$ j9 y1 q1 K$ n4 R% S2 [
if [ -f $MONTE_CFG_FILE ]9 r, e9 g1 M5 C4 Q+ d0 i
then 1 i3 V5 b" }' x- C! b4 y) F: [ until [ ! -f $MONTE_CFG_FILE ]8 g+ S4 \7 ]* q" e+ k
do 8 U, C# S1 z3 ~! W MONTE_CFG_FILE="$MONTE_CFG_FILE"$$ . t$ I. o3 i8 g" } done( e! g f9 c7 `0 i6 p x! q( ^
fi) o. k" T7 F0 H ?$ c1 z! T6 ~* R5 `
' h# s4 @8 J( ~& k) f; f3 z# }2 U# main iteration4 h8 F9 R1 P( h% V- ^2 S
run_main0 ~- O4 t# o, g8 [% {
! O- `' k; [* ]1 a# c& V L
if [ $ret_stat -ne 0 ] , [+ `+ S V8 D& B( h
then # N3 v# a( o* K* r% f cleanup_alter: y2 U) ?0 W: q% f+ [& ~3 |
cleanup_monte6 ?0 A$ [. z5 U$ k* |
Exit $ret_stat4 R! l$ E; W& k
fi , I9 ]6 g( ^, ^7 t1 r9 e4 r) U2 R7 M4 s, l9 r! k# B. e
#Alter related iterations ( v& d# {* D* f. P5 d# {, `* I
iterations=0 # d% ~% B, c' m6 t4 ^5 vcount=0 H# M7 r z& Wif test -s "$ALTER_COUNT_FILE" ' @6 d% e) O: x+ Uthen; b' t! a3 B |7 ]" r" i4 [! c5 f
if [ -r $ALTER_COUNT_FILE ]; then% g. {; M, L0 R( h- Z4 |
exec 7< $ALTER_COUNT_FILE ) U$ v5 \7 s1 P* Z8 @3 s, U* S0 [# C5 | read iterations <&7/ w$ v# \9 c- G! L" v1 e) H" }
fi* ]: g9 D9 E5 V# S
fi \' i4 T4 I' e0 J" L* h+ i
+ E k) a1 i4 I
trap 'echo Program Interrupt; cleanup_alter; exit 1' 2 8 v! D2 `2 ?1 q6 v3 a3 uwhile [ $count -lt $iterations ]$ Z' \2 N" Z' ^& o8 G+ o
do& c; W/ ]1 p8 e4 u
count=`expr $count + 1` - Q( g* n9 c1 f' F$ ]* ^ f ALTER_COUNT=$count 2 Z' j, a( ~" ~$ G2 _/ I/ V export ALTER_COUNT / B' H- P8 W( [3 Y! [- b- c9 b * g9 B; a% {/ V3 e( ] run_main * {8 w; k+ ~" _1 A& Y# X' X& c" T( @2 Q- Z
done 3 j7 `5 H; e R3 c) I0 x 5 l: M- C$ g9 H) o& s. R) c( P#Monte carlo related iterations 1 @6 T- m- J9 N: d" Z) p7 V8 r" p$ N% N& A0 B9 u# E9 Y! v2 M5 N4 m) C
monte_runtime_summary() * J" p# s5 @2 }6 {. t) d{ ! C3 ^ l% K: w1 ]% m keyword_1=real " t2 K0 m0 T7 P5 b keyword_2=user/ ~$ p t! Q A: X) Z9 X) _
keyword_3=sys$ n; S a ?& X m" X
ofile_prefix=nanosim) t5 f8 L7 h2 v
; a5 A# M) I* l" C6 D
if [ ! -z "$o_option" ]; then' P; w% |' e+ c2 r" M
logfile=${o_option}.log : X, @6 G7 L3 f+ L! E: n else+ w) h+ q; C9 R& I, X( o4 }
logfile=${ofile_prefix}.log1 ^( G+ k1 e6 c* W
fi2 A5 L6 ?' \7 o; v
% Y3 S' t8 d, G1 i6 T0 O6 \ if [ -f $logfile ]; then: K* J: m4 j3 Q1 f8 t
echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile 6 A( r; _6 q$ r cat $logfile | grep ${keyword_1} | grep ${keyword_2} | grep ${keyword_3} | awk 'BEGIN{ t_real=0; t_user=0; t_sys=0; } NF==6 { t_real=t_real+$1; t_user=t_user+$3; t_sys=t_sys+$5 } END{ print "\t", t_real, $2, t_user, $4, t_sys, $6 }' >> $logfile 1 H( e6 i3 k2 [/ x: [ fi: }; W: e/ q% J7 R1 r8 A
} : y& z3 Y2 f6 O . E9 x/ b7 U3 P# I4 P% g! j/ f4 Ynext_monte=0 ( X& m, ?5 h9 u" U6 j; ncur_monte=0: B5 \! Y& I% ?4 o
2 i2 i/ b$ i+ v# j' Z# q
if test -s "$MONTE_COUNT_FILE"* U3 `+ _8 _# W$ m+ V+ |& N7 B+ W
then ) M5 ?' _2 v4 g& m& n3 z if [ -r $MONTE_COUNT_FILE ]; then. Z+ W5 h- K1 l0 C5 ?% d: }4 |8 Z
exec 8< $MONTE_COUNT_FILE) i+ N9 u9 W( c! D/ N0 K
read next_monte <&8 $ K/ c( u7 @- V! B fi ) @- J1 S' t$ w3 Y. }2 xfi; u4 E7 C& ^/ \4 F+ n- u
( j, h, r! H, c8 x0 n
trap 'echo Program Interrupt; cleanup_monte; exit 1' 26 ^. Z6 Q% ?" @: d
while [ $next_monte -gt 0 -a $next_monte != $cur_monte ]9 g! G- U0 v. m- ^2 k* h& ?: J
do( G" h( M" X4 b
NS_CURRENT_MONTE_COUNT=$next_monte8 H3 f/ s2 Q/ Q4 Y3 U
export NS_CURRENT_MONTE_COUNT( ~0 r4 O9 u1 G, O
3 ^. c0 z1 `7 G7 O echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE' y; ?9 | f; M' l9 c% a
CMDLINE="$CMDLINE -c $MONTE_CFG_FILE"9 T8 O+ w( h4 J
run_main9 z! u8 K' w$ F2 [( `) f
" r6 ?# R5 k# K7 v, ` cur_monte=$next_monte " N3 Y c3 |9 P! F2 l% G+ l, s exec 8< $MONTE_COUNT_FILE" U- L& ?5 b! U/ X3 ?* Q
read next_monte <&8 # i* q* |* h- p6 V+ g. A0 _ Idone$ p/ n$ }6 N7 X* N6 M. h
$ h& D, V8 u W4 |$ v z
if [ -f $MONTE_COUNT_FILE ]" T" s- Z; U0 S5 d* U" v) w: p
then: @( |# d7 d+ Z) @* _9 o; |$ H
monte_runtime_summary, B: o e2 v& H; H2 ^0 F1 n
fi ! t( {1 K- n: B- c , [3 a# M* D) P$ ?5 dcleanup_alter* {% R( A& y9 h/ H
cleanup_monte ) j7 ]0 }5 i; O4 q0 j9 ? @! w$ l+ G) h$ T' J0 @! o
Exit $ret_stat