2 ~/ a: f9 X- n3 q# buildmod extracts -u/-fm options and calls genepiclib |/ q! M& h9 ?$ A# O" Q& q7 E
# It also set the remaining options to variable CMDLINE 8 ~0 G" e7 g- e# look up in .epicrc for -fm & -FM parameters2 e( k8 b( l+ H$ {: `6 ?+ e
3 n% U; S* q# _
fmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`"+ p4 I1 V' P1 p3 E% H) X
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`" - | o0 B4 z' p* q' Q3 b[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`"7 D W ]* w4 E7 X2 A- T
4 r: K; ?# ^4 [
FMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`" 9 N* G. ?5 H( l% B7 c$ S[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`" . _) A0 s$ d8 p Y$ b4 B m9 `$ n[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`"( ~% x% k2 R3 L- T7 K
. O9 u) E' j* t5 N% p8 Z( J* W. Iif [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then# E5 ]5 A" B6 {! g+ R# U
# note that the buildmod script will set the CMDLINE variable - }* q4 q1 T! h6 C% ~$ U . $EPIC_BIN/scripts/buildmod. z* ~$ c* K* G+ @% j" {
* A" o: s4 P, P. f2 h$ c4 V* n #echo "This is the value of cmdline=$CMDLINE" ! k( x/ s6 p% `) N: K/ @, T1 c #exit 04 q" H" \$ t1 J' ]' @
. ]. H0 |+ L0 J8 b# P
# if a new timemill/powrmill/pathmill built, run the new one 1 U6 E0 O9 u5 d* X0 O. x [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX" - v+ N% ?; \- d/ E/ nfi# X' n# m4 _% {) _
" t6 r9 v3 d* |( @: [if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then , M+ t$ k; a- w0 }' v H if [ $have_har_flag -eq 1 ]; then 0 k1 @ D. O$ N8 _7 d is_special_har_run=1% C$ A. ^4 d" u6 i
if [ "$o_option" = "" ]; then + p; N" S" f* d/ Y- R case $cmd in' k$ c/ P+ V: W2 O! [8 _0 D+ K
timemill) + F9 H1 `4 C5 e1 X4 \) Z har_ofile_prefix=timemill 5 |0 V5 W7 O) K' } ;;# W y+ P' g" P& A$ G+ g
powrmill) - B9 y [( Z2 {. C7 w har_ofile_prefix=powrmill5 v2 r# M% H8 |- ?6 ^
;; $ z+ y; C& j6 s7 _7 b' d nanosim): X n+ G+ T! u, ` ~
har_ofile_prefix=nanosim . l! y8 G" t" Q5 G( e8 l# h9 y ;; & O6 t7 @$ a) B0 b4 ~7 y esac 4 |8 B# y( S6 M: A" g+ {" Q6 b1 O else / t3 K# D( F. ~! y har_ofile_prefix=$o_option9 P3 N4 f5 ]6 u S7 u/ t
fi " j0 b' y! Y& Y5 N% c& Z2 j' X fi ' Y1 o9 r! q6 G5 m O6 v" qfi # L# `- p" S2 d8 d7 G) @. s- i! t3 G+ _# g! s% Q
# Call Double precision version of the product if -D * a+ d7 c5 {; x' t# or simulation time > 1,000,000 ns.( {$ H! Q, m3 ?3 |0 B
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then+ u# h. U7 A8 ]) @/ l6 ]- C
. z! M; f. A9 I5 R+ @
# Now the binary always has the ACE feature/ p3 r! `) q( L2 b( M; Q7 x5 b' T0 K
USE_ACE=YES P' [7 h+ Z {9 f [% y' c
0 `3 i2 I/ V/ M HAVE_DP=NO4 ~& f7 C H" R
EXTRA_CAPACITY=NO 6 y+ p5 g* Z# q) i DB_REAL=${FORCE_DB_REAL:-"0"}1 f& h; e& c$ m' ?4 l4 [" k9 x. E) o
' g* H0 ]8 ]3 m7 `
# Enhance for ACE ease of use4 [: x& a4 S6 M( [) j" I" t9 J) ^! V
# If no command line option or only a -T option, do: 8 t) U- M6 ^6 `/ L # 1. set -A option , F, r) Z% e% W- P # 2. assume input file to be hspice) E7 Z% o* E6 S
# 3. set -o to input file prefix" k, R& X$ ?5 E* x' B0 T
# 4. set -z to input file prefix / |3 R6 o+ K2 z% v5 G # 5. set -c to default config file ; o/ J- K R2 m6 e' p5 P& P5 d netlist="" 5 I7 e' j- n2 z) q& A9 p minusT=NO 4 l; X; L, w5 J: E. L useStdCmdOpt=0 1 s9 I2 O5 ?- Y5 j prefix="" 8 V1 T0 M U: E: e circuitType=""1 w. r' r0 ^" U5 ^4 |
for opt in $CMDLINE6 @; z7 G& }" @
do6 e0 R; Z( _8 {7 p' Z
case "$opt" in 5 h J8 m% A) q( \3 {% }! i$ |$ R -T) . t1 [& { v& o6 l$ |0 T minusT=YES 4 {' p S1 q2 L9 |+ d, o. P ;;: |3 J7 V1 W' F4 c. z
-*) 8 }, ~6 y3 O, L2 { g # using standard powrmill command line( S1 ] l+ G @
useStdCmdOpt=1 / K/ p( X$ S+ ] break+ a7 C; Y$ f. B% U S
;;1 R5 ] ?+ ]2 W' Q7 {& K! s( }
*). q! y# N. B2 o# T3 y3 k
if [ "$minusT" = "YES" ]; then. _! m3 K9 D8 C
circuitType=$opt, s( S; L8 d {
minusT=NO # reset flag & ~5 R4 I5 X+ C3 T else 2 r5 w$ L1 f; u; w( F6 |5 v; r( v if [ "$netlist" = "" ]; then ( s5 i* s4 b. d5 { prefix=`basename $opt`. n7 m( t7 ^# ^& I. g6 @
prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix`: r m7 s( S; y: J
fi5 X- H( H+ A. Z2 s0 q, \1 F
netlist="$netlist $opt" 6 G# @* @; m+ Y/ Z" D- a8 d) G fi k* R1 P3 D$ P/ g. j0 l
;; + S6 F ?. W6 ^# x1 q8 V7 v. J7 ?- C esac5 m1 R& T( ~" [ W
done) ]! H1 T: o( K& t# @. S+ k( D
% X& J' x1 d4 b& G* u$ V2 l
+ R$ e) `8 y. R, o5 w( P, \ if [ $useStdCmdOpt -eq 1 ]; then5 w- p% a9 o7 d$ j5 [3 v
# use standard powrmill/timemill command option 7 O1 {& ]( [2 R for opt in $CMDLINE $ A$ w5 w5 d1 A, K8 V8 x5 q. s do M2 J: f3 K8 I9 H+ d
case "$opt" in ' y% n& Q G5 z+ U" q
-A)) |. o9 X. r" ~+ C
DB_REAL=1 5 N8 q' U0 Z: T4 ?. n' g1 [" X ;; ; B) I6 ?) X* v- {% g esac% |2 j& d" W5 ?. Q$ q0 H
done , H( R4 f; v- W1 M E' H if [ "$netlist" != "" ]; then 0 `; q& p& B. h CMDLINE="-nspice $CMDLINE" 4 j1 N6 ~8 s# {6 g0 u) ` fi . y: K1 X# a" P( \; ^. h else4 G6 u' B- i& B( X. w, x
if [ "$netlist" != "" ]; then5 c/ `6 z- S' d: q- ?
EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"} ' l; l" [# i( m# Z) b # construct new command option: m* A" \" |; r9 ^
if [ -f $cmd.ini -a "$circuitType" = "" ]; then& V# n7 o" [3 E! d
CMDLINE="-nspice $cmd.ini $netlist"9 }' V% k- k e1 P; x6 X9 A% n
else ; ?; ~9 I. ~7 U, S- _ if [ "$circuitType" = "" ]; then' y% d* D8 u+ G. m# [1 F1 ]) k: h/ G3 n
circuitType="msana"/ n7 Y4 u. K3 C4 `, V, U( Y
fi: M4 e( U( M9 n
CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg" 8 D/ O1 h; w' v$ f) G, I fi ( o4 g ^, S, M1 G) O+ e c; A CMDLINE="$CMDLINE -A -o $prefix" 1 _4 B) ]* ~+ u3 b6 H, F k7 e DB_REAL=1 ) i' V! f! z- P, c; L3 w echo $cmd $CMDLINE& o3 }! I( |4 |( q; [9 |& g
fi/ j: \. t, }7 \
fi % T. `3 a9 I. _. Y3 n% a4 ` {fi # cmd is timemill or powrmill or nanosim or railmill or pwarc: m' g& M- e u% a. k9 W
! {1 W& B: m" `# L
[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a"6 V+ u- W0 ]1 _
[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a" 2 w) L5 `) K& u. e4 x& F[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v"2 |( I8 K+ x& T4 B& b
% R7 F$ M s* P- I: {: u# V
if [ "$__engine_wrapper_called__" != "Indeed" ]; then" J8 X: t; }2 [) E
__engine_wrapper_called__=Indeed ( D1 p; H. u; b# {7 J if [ "$cmd" != "amps" ]; then Q& }1 X& `! O( t7 z! ~% n& M export __engine_wrapper_called__ 9 o. B" m" F: S4 K! `3 S+ S fi# w5 d7 P# R6 c2 S: s. }4 @0 b) r
* m* U" C7 P' u+ F' p trap "cleanup" 0" b8 j9 W) C/ X n, M P3 C* e
trap "" 2 6 P h4 h% |* B! t6 O0 N- K9 _0 {2 f# j! X; T9 {! P
[ -d "$rundir" ] && rm -fr $rundir9 `. ]6 l2 W' U5 |, E( }/ v
[ -d "$rundir" ] || mkdir $rundir ' `% A- r! B- p7 Z# R; Y! |2 }. C( c4 w+ l/ c. J- `4 i
case "$EPIC_ARCH" in9 [) t. `. }* Q; }3 r) N
*SUN*64) . s* u# d5 u0 r: N4 B" Y/ a' O* H LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH" 1 d5 s- P, q* X* l- k7 s export LD_LIBRARY_PATH" C l, l; Z ~' V8 e! G' x, w
suffix=.so8 ?3 h7 Q2 C1 Z5 ~$ r/ _7 S+ k
ld_err_code=127" U- E% n$ o. L1 I" p
;;1 x3 r% H4 o( T; J6 T
*SUN*4) ) _( T* o! c; ~
LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH" $ p+ U" r& ]' M$ u! O2 `. Y export LD_LIBRARY_PATH ' f' Q. b6 ~: T3 N3 {" R suffix=.so.1.00 v8 k: D2 f0 N0 I
ld_err_code=127# t3 L- k+ D2 B
;; $ B( F/ q; ?* X# o' @" g( M *SUN*5) ! O3 G( o. A R2 E LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"% H4 T- V; {1 C; R5 I
export LD_LIBRARY_PATH7 e4 N: n' D2 @0 c5 ^
suffix=.so4 K8 I1 S. Z& n5 r7 S9 R$ q
ld_err_code=127: s* z1 b6 @1 \ Q0 I2 a# p* p
;;$ G# {1 g0 P& L3 ~6 H$ \, X; a
x86sol*) ' u8 G) O6 R% W- y+ [ LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH" # h$ a6 \2 O: x export LD_LIBRARY_PATH2 d: j5 X! E( _% {1 l* Z+ w
suffix=.so" I# `7 y" X' z
ld_err_code=127* V' Y) L2 ~+ k: p9 i! ~
;; + Z2 Q4 H# M" ~4 u1 o *AIX* | aix64) 9 N( u# p5 b \/ M# Q # When genepiclib creates shared objects, it creates a import file and 0 {; b: }. A& Z1 r4 u( R- A
# uses timemill as program. So at exec time,program timemill is needed ( d$ Q0 U) K5 G% m! p# _( V' ^+ z
# in LIBPATH V7 z- ^0 j4 p
$ln_default $command $rundir/foomill ! V% P' t, e; e) j5 A8 o LIBPATH="$libpathLIBPATH:/lib:/usr/lib"# W) b/ j2 Q8 O' n( r: P
export LIBPATH; V: T5 j) m+ x! [
suffix=.o 8 X1 j$ |2 `% E: p* B! @, Q ld_err_code=8 - I. N# e; H3 I" K6 |3 o; r4 K if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then 7 m y0 b$ `& N9 B. g- y tdir=`echo "/tmp/d"$$`. g/ S' w! r$ P7 J1 x0 J" b
[ -d "$tdir" ] || mkdir $tdir# S8 Z4 Y2 E# O7 [' Q: ?
if [ -f $EPIC_DIR/libCustom.o ]; then% ?* p- ^6 a, y0 y
cp $EPIC_DIR/libCustom.o $tdir/ - Z" o6 e% [3 k* Y6 S5 B $ln_default $tdir/libCustom.o $rundir/7 o& I. h" L- Y" j! g" a, z2 l' f( O
fi- L" ]- l& k/ |; V2 Y- v( C" q
if [ -f $EPIC_DIR/libModel.o ]; then4 u1 J) H A1 j+ T5 j% w# z U7 k( d
cp $EPIC_DIR/libModel.o $tdir/ ( z2 M' Y* Z$ N C6 V $ln_default $tdir/libModel.o $rundir/ 0 X* c$ }# E: k4 a9 z3 d- G. b fi# {$ e" X: X8 f1 s5 B" i9 j& U
if [ -f $EPIC_DIR/libFuncModel.o ]; then $ R( A# ^6 @' b2 u2 P cp $EPIC_DIR/libFuncModel.o $tdir/ / [7 }3 z; ]% h9 f $ln_default $tdir/libFuncModel.o $rundir/ " ?- a$ s4 z1 k. v+ t8 l5 Q fi- `2 ~$ c5 L, {! Z: ~/ F7 \
if [ -f $EPIC_DIR/libFuncModel.34.o ]; then/ E& i* p0 z7 A; Y
cp $EPIC_DIR/libFuncModel.34.o $tdir/- Z/ z3 U7 x9 t) Z3 Y% T. B
$ln_default $tdir/libFuncModel.34.o $rundir/ ) V5 I0 ^! g0 k+ d8 K$ ~ fi, C B% r9 h$ z4 I
fi 7 h0 }. ?9 a+ R! ?9 h7 e5 { #Set the IBM flag to enable more shared segids2 A$ P/ @7 ^7 C/ F, U
EXTSHM="ON"; R5 l, b, v4 H( ~
export EXTSHM - Z+ ?2 ^" D/ A# e ;; 5 k) z. {$ l9 Y7 v0 ]* l1 I *LINUX*) % g' R( n* }) J3 y% y suffix=.so 6 u" W4 c) t* `$ o- B( a ld_err_code=1 $ n% \ b3 E) r0 s4 R ;;3 l) O) V8 a3 N% @) @# ~- |: Y/ Q
*amd64*)' [+ w9 m2 w. D) v) ]3 c
suffix=.so 6 W8 e; T% [/ ?" |: g& I$ N! \ ld_err_code=1 + v# a. I8 W& }9 b ;;* b) T6 F1 ^7 e0 }# e( c
*suse64*) ; f' ~9 C. s# w6 K7 V) f' E suffix=.so 6 m+ X! o* x2 x. i; @ ld_err_code=18 n0 I0 Y9 ?5 e2 l
;;& u, @; A, Z; h/ B/ g$ \
*suse32*) / H6 R; U5 ^% @7 t) e7 U suffix=.so - ]% S# ?9 E9 v# C" y ld_err_code=1& |0 m _% F, v* f* A
;;3 f- D% S0 o+ L, [' k& t) z
esac ; \0 ] T" N- C3 n; U6 @7 E5 s: k7 v# e1 M/ A A( C! }8 C
[ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix"+ Q: p p& ]: m, }5 ~, B/ f
[ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \ / P) L6 }, y% l+ Y && [ "$cmdname" != "nanosim" ] \ 2 c9 u; Y4 z/ B! b9 |- X3 j1 X && [ "$has_model" = "YES" ] && ulib="$ulib $cwd/libModel$suffix" + \8 {' i1 B& {+ u" I* V8 ] [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix" " Q u7 d, e! Y: } P$ q# B6 I0 t( b/ i# t* u
#Look for command line option for libFuncModel.so 0 M9 {0 B: [# A5 }& w: r# user_library_next=0# q. K& \& ?) [% U- O
has_fmlib=""5 O8 K2 _! W9 `" v/ b) Z+ f8 T
for opt in $CMDLINE- G8 A( B9 n. [9 A7 ]! R( d
do & s& L. U% k4 c! \6 [ case "$opt" in ) X+ t* ~1 m, I& }& t" ^ -fm)- T! e$ M h% Y& r8 W; p. ~
CMDLINE="$CMDLINE $cwd/libModel$suffix" 3 G$ e' o$ {- K' V8 U; N ;; % d: L( v, ]# n, [8 L -fm_user_lib)# t& U% i+ t1 {% r9 ?
has_fmlib="YES" 1 v* y, I" F: c H+ `# user_library_next=12 x! n; z0 ^7 ?4 t1 N( o: ]' _; k; g
;; 3 ?( a; U. p$ ~* F+ h6 ~% R -xc) ^9 E5 R' V6 e6 Q if [ "$EXTRA_CAPACITY" = "NO" ]; then ( d% U7 c; c+ F) { EXTRA_CAPACITY=YES M* z) I/ q, p
fi ) q, p3 H6 p" q @$ R) L ;; 1 i o/ k9 { s/ r4 D# *) 5 R. g1 F( x. U6 g/ Z; P# if [ $user_library_next -eq 1 ]; then& h/ X( u& u) Q4 h
# if [ -f "$opt" ]; then 4 [. ?9 t* ^% P" ]0 z" h# libfmodel=$opt ; A0 o }* h* n$ C; f% k# else 4 B% r6 d" N: j6 e% k, g9 _# echo "-fm_user_lib: Specified file not found" 2 }0 z+ V' e3 H; |+ A% `# echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages 5 Z# Y+ J6 d/ F, k# \& }: s# fi8 E8 F. ]" E- U
# user_library_next=0 - k2 t) O( `0 T! J; \# fi 3 H% T* H* x/ `* k$ j. o# ;; 0 q1 @9 F" `& f J1 ?6 t esac0 T# E, t7 u3 n! d* ^# M
done + A$ m: U" ?/ Z! y5 i+ W& n: Y5 i" o6 J0 |2 n
if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then; ^4 `' c( `/ m/ Y
flib=""5 o9 w U% u& H' m' f
if [ "$has_fmlib" = "" ]; then ! h, L& h: Q8 r8 N flib="$flib `get_epicrc ./.epicrc user_libraries`"' t) n: r+ X# Z6 l$ v# E! W
flib="$flib `get_epicrc $HOME/.epicrc user_libraries`"7 d- d' W3 n* G, c5 c Y
flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`" / h& [3 ~" K, i5 H* w2 ]) e9 t fi . T6 v8 d4 t4 _6 e fi; ^& c9 q7 j5 K3 {, V0 ^$ T
& {; y" t W( g( H0 T# k" t. @ for i in $ulib+ }6 i# h9 e) {& K( o" B2 o8 k
do% O8 X5 a$ j2 b/ Q' @- {9 T
[ ! -f "$i" ] && continue/ Q) b. z/ g, v3 @
dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd * } P/ o x0 a i="$dir/`basename $i`" % e3 B! s# L+ o" h* p& U( l6 i+ ^1 W case "$i" in 6 G6 j. p7 A# G1 |. h& o *libCustom$suffix*) [ "$libcustom" = "" ] && libcustom=$i;;3 M3 [; B/ W% V1 |! t! `: j
*libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;; ! f" ?/ ^ h1 U0 } *libModel$suffix*) [ "$libmodel" = "" ] && libmodel=$i;; 8 J! a; x) H2 O {9 U" y' l0 Y; ^ *libva$suffix) [ "$libva" = "" ] && libva=$i;;) {2 p+ r! N' C3 N$ t
esac( n d; L7 W1 O2 C- L0 a4 s6 F& |
[ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \# [" X5 ?4 w' m I: `! }
&& break/ C3 M U+ t& g6 r8 t6 l5 K- t9 l
done , r0 O* g5 e8 V3 b b X# ~ 3 Z- U$ M+ a7 D2 P # symbolic link shared libraries to .epicrun$$$ V9 A6 y! P1 D. A) i. F2 R
cd $EPIC_DIR; epicdir=`pwd`; cd $cwd. p# d. E( |$ j! H) Y
if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then + N3 _- `" p# s4 u! Y) [3 J! y if [ "$libfmodel" != "" ]; then3 y( N8 @6 [* u/ I/ ~, t
[ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \ 9 z# @, D0 u9 I, ] echo "Using $libfmodel ..." && \ - I/ q/ s; ?5 l+ J. d echo "Using $libfmodel ..." >> $EPIC_SCRIPT_MESSAGES_FILE 3 j7 h0 y4 {/ O0 I6 {- Y0 P$ W if [ -f $rundir/libFuncModel$suffix ]; then 3 @1 E$ y d/ k$ t3 ~2 k rm $rundir/libFuncModel$suffix# {! p& U( [+ u9 c2 H- F6 \
fi% B# F+ `3 o2 V) P
$ln_default $libfmodel $rundir 8 J a) a3 J! o
fi1 O. G- k- J+ r M% N f
if [ "$libmodel" != "" ]; then / s& R% t3 x5 j) J( O$ K [ "$libmodel" != "$epicdir/libModel$suffix" ] && \ & C% m( s8 m' m: S3 R echo "Using $libmodel ..." && \ * @% l: H: u5 m: E: W/ V echo "Using $libmodel ..." >> $EPIC_SCRIPT_MESSAGES_FILE, P, ]% F- T& |" s6 z
if [ -f $rundir/libModel$suffix ]; then3 z( ^; }" _" }) y; o+ M% \7 ?( u3 Z
rm $rundir/libModel$suffix ; i$ [7 Y7 \3 H" {" G fi z+ Q+ a! g. D0 j9 `+ s; @ $ln_default $libmodel $rundir 7 _( ` i {) l# j fi8 Z k' v' N( @" Y" k( E
fi" N8 b# t' r$ p) `' }! g
if [ "$libcustom" != "" ]; then / d5 U3 D, p6 R; @9 e, n+ { [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \% v! k/ L/ ~, N c/ Y$ M
echo "Using $libcustom ..." & t4 v% B6 W5 K; x# K5 V6 ^5 n9 f if [ -f $rundir/libCustom$suffix ]; then 2 S: `, f% R" n0 E' j& W rm $rundir/libCustom$suffix* r1 R; i+ f/ b, K E* Q
fi: ?: U4 j8 i S, P# c
$ln_default $libcustom $rundir 2 Y' W* t% L1 ]: d$ t
fi2 {+ [" X/ u. u& J# K
, @' y! c9 t% D
if [ "$flib" != "" -a "$flib" != " " ]; then5 L0 d9 a2 {7 R0 i( ]- j* O- A
CMDLINE="$CMDLINE -fm_user_lib $flib" 3 A' t; {: l0 N) {! S fi$ t) Y9 u! Q J/ L; i# w
- V2 A3 d7 S+ q0 Q if [ "$libva" != "" ]; then # F, H7 Y+ |' h0 G if [ -f $rundir/libva$suffix ]; then7 U u: W1 e& l) Y5 t9 D N
rm $rundir/libva$suffix6 `2 [" }5 G) h e3 x
fi : J# k" W: C. l! k $ln_default $libva $rundir / t( I0 W* v+ `0 Y: g3 I, p
fi : D6 }' L& X* T3 n6 C ( P' O6 n0 f6 E1 O# h0 { 1 g2 n( N+ |2 y v; a3 }7 a1 b # VCORE design library" A+ x7 d0 L9 Y$ S( }2 l( P
if [ "$vlog_design" != "" ]; then3 {4 R1 q1 z! ~
$ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`8 B$ W% u3 G0 l$ `% n
fi / L$ s, M' X3 i1 d) ]& M5 |7 V; Z& k5 m" q8 ^
if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then : C, U) Z' S6 J' J$ S. g EXTRA_CAPACITY=YES % A) z$ b y$ O: O+ u) r fi ) O# P! m* Z' _' t/ b8 s( V2 U: z2 Y9 ^+ R }" q" D L+ f
[ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc" / A+ k- a/ H% z) ] [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc" 0 @, [9 g1 g$ G w) U3 K #Create temp file if dual process is on & w; D2 E0 u5 H7 m if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then # e2 N5 h7 Z) f" d# V6 [. m9 |# _ if [ "$EXTRA_CAPACITY" = "YES" ]; then; |; [' Z% |: k5 n3 a% z/ j1 B3 X) m
touch $rundir/rpcidfile5 f7 A, L8 H" c) j
fi2 F5 M F H8 s6 r
fi2 P' o; ]1 {* j0 ?
fi ; W9 ^+ ^8 k' f' v y! N8 x5 C* U- W: y
run_cmd()2 I) E8 h- W; j& [. k6 R6 T( |
{3 e0 F4 u7 J d) s4 f; V" p$ a# m
command=$1 % U! T# q" F2 ~8 l# p+ { shift6 Y% a# }: L8 v( p! g
( t# J4 Q" U, K
if [ x"$VA_FILE" != x"" ] ; then 1 I" l, G2 J) n( Z9 }+ | cmdline=$ARGV. [/ m/ e6 ~3 g
else / { ?5 Z$ |& ?8 D t6 Q cmdline=$@ 5 l' a! L" D8 a fi* m; c! U2 y' A: g- R& F
! X$ k3 Q* g& P6 V# F8 T. n9 x debug=${DEBUGGER:+"$DEBUGGER $command"};8 H& J4 |' O) Y" e% H3 J7 e
- V# G& l. y' a3 C* Q. U6 b' {
# To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a( @1 T* o6 L9 Y8 E
# so save-restore may work.. |5 a3 q( i( x% E
setarchStr=% I& A" [0 K: k" H0 F7 I4 O2 Y
cmd2run=`basename $command` $ D: c" t4 k. _8 D0 t" t if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then ?: L! P+ W9 x( r6 g8 D
if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then ! K/ J& ?( N; Y, n/ p setarchStr="setarch i386 -R "3 A8 D5 t3 ^3 c ~
fi , \8 Y7 t6 n$ p0 B$ g if [ "$EPIC_ARCH" = "linux" ]; then 2 F4 G9 L M, V: G" k setarchStr="setarch i386 -R ") N8 C4 f2 }) f$ z" S- {
fi 8 b: X* y1 a8 u; ?# }6 i- ]- f if [ "$EPIC_ARCH" = "amd64" ]; then( L8 G9 s5 z! N" f8 q, @+ b3 ?8 H h% a
setarchStr="setarch i686 -R ". m5 e6 E" ? `( {
fi + d7 Z; L( @3 n, H8 _7 b+ `( m if [ "$EPIC_ARCH" = "suse32" ]; then. M5 {" U% ]* d+ ^
setarchStr="setarch_suse i386 -R " / W' ^" F+ ^1 u. G2 x, X; H. R fi ! u7 k- B8 G1 K' K if [ "$EPIC_ARCH" = "suse64" ]; then 8 d" _, C- T2 S7 z setarchStr="setarch_suse i686 -R "" g5 Y7 g9 B. K6 o' X
fi 3 {1 `- [! b) O% P4 J' h/ y+ V, A/ l' y fi- V1 G# k& [8 ?& \0 i) v; U
* l& w3 b0 @+ K( U" k ret_stat=0 9 ^( f N+ U6 H: B b: |8 S if [ -x "$command" ]; then 3 V# u+ m O3 Q if [ "$debug" ]; then G3 \5 ?% |' w _debug_args_=$cmdline ( b, c, R! l. }2 I9 s5 q . .epic-debug! b- L& j+ ]: K( }6 s4 m" g2 @+ i
else& J3 i+ F3 p' X) ?% ?/ f
DEBUGGER=; export DEBUGGER% w7 n& P: M2 a+ J# x! z
$setarchStr $command $cmdline 9 a" j) B5 B5 X6 | fi : O$ V4 }% N2 O( r1 q ret_stat=$? ; L+ ]" h+ X1 v) ? else 4 g) ~. F- }8 x8 A J echo "Corrupt installation, executable \"$1\" not found!" & k2 T [9 Z0 ]- O ret_stat=1 7 n3 l% @: g4 g2 a% b9 W1 { fi 8 b- k4 v$ R: v, K2 p} ; {6 H, E5 m3 X: [3 P1 b$ |; D$ z" c! q, B0 h
# keep runing cmd if ctrl file exist: H7 w( n7 J/ h: x4 |/ {/ |. L
9 _5 @2 t2 V& ^1 z) S E" N& Hrun_loop() ! z \0 S( a# u- a4 W{ 3 X3 Y" v6 L! } command=$1 ) S7 m1 X9 \" d: N, b; Z, U, b1 A- f shift 1 ^$ U( C! s/ {1 b6 a3 p- ~& l# K3 z k" ]& @) \. h
if [ x"$VA_FILE" != x"" ] ; then / v: K8 T5 T' x8 v# p) q cmdline=$ARGV: r, s& s4 W, R/ ~- O1 \" @
else7 e& k. F' j; }) l6 W$ t
cmdline=$@ 8 m7 d9 q6 w( M9 I- l fi4 }$ O& w8 s' a" y- M
8 A2 |" i. F2 v; q, q1 ]
while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do# x& L3 }. O) y- h2 f
. $LOOP_CTRL_FILE$$3 n. `# S/ \' m
run_cmd $command $cmdline -banner 2 9 M6 g0 L( Z: m done; 5 T) Y# L) |% S" ~2 A9 u! B. c+ [- I4 G1 G
if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then 1 Y _& q" u7 m i8 A' d' h rm -f $LOOP_CTRL_FILE$$ 9 `3 t0 A: v/ b3 v* R$ @( o fi ! q4 \; K9 N5 ~' U& N' P8 b" h} - u( b$ ?- q0 I0 P7 C+ g # p. {2 D, I; l7 M! Ehar_check_ret_stat()& M3 Y' B6 B; J( E" M! R. ], Q
{ / S D3 Z- h. \ if [ $ret_stat -ne 0 ]; then 6 F; t, n: ^6 Z% D7 N$ p
echo "Simulator returned with non-zero exit status. Stopping." * M* P6 S' [( w3 G" |8 W% f; H exit 1 7 J* c) Z: @) c5 V fi x# w, p! V5 H9 d3 j}$ Q. U6 H+ Q; d+ ^ a' v: ]% q; }" a0 w
* Y& M* u& ?( |( J2 y; V0 B
#% p# V* d% Y; `! _) F; m
# set stacksize and datasize limit 4 y! s6 l- Y S2 ~$ U# - }# W6 h' q7 J. C3 w* K |9 P4 Y) x/ E/ v6 \set_data_limit# q9 p8 \" `( ` e, [" ~! Y
set_stack_limit & Y, p) X3 X) U+ g v- K; b $ n, Y' I" E; S#rm -f $LOOP_CTRL_FILE + C( o1 h+ R0 D- U / k0 ~, ~8 o* S: e+ s( U }# v/ E/ g! k2 frun_main() " e% M# z0 O8 ^' k, Z+ H) E{ * }' @9 \4 G! J) P+ x% @if [ $is_special_har_run -eq 1 ]; then! b$ ?, F* p; _% D. ~, e
if [ "$har_ofile_prefix" = "" ]; then 3 b. n. _, Q5 u# H+ L: t2 p/ E" t echo "Wrapper bug. Notify Synopsys technical support."0 K4 m( C) G" W2 D K
exit 14 O0 P3 I- h' b2 b: Z
fi 0 ^( @+ V5 i7 R4 m% ~) c3 a9 A8 p if [ "$har_hilo_file" = "" ]; then . t" F: I/ z! r. E # no user specified hi lo file - do both runs# O1 b' ~' }& P/ X
run_cmd $command $CMDLINE -har_one -har_setup, n( z1 a: M: j* E
if [ $ret_stat -ne 126 ]; then/ L+ _/ H, a% x* q/ e$ X3 z
har_check_ret_stat * A4 A0 \6 M0 x3 F3 u6 s5 k if [ -r $LOOP_CTRL_FILE$$ ]; then ' b- z# n6 l; h run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl- B- G1 M, s1 |& O3 a9 ^3 i
rm -f ${har_ofile_prefix}.hl, _! d8 y4 g! H
else 2 F, f% w2 y; g3 D3 v7 D run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl# U b" W$ b9 e- H. h
fi. ?9 s; S, P4 Z1 G5 M
else: s( t* Q. A7 t) e+ G4 l8 }1 @# m
ret_stat=0# @5 }4 W0 b3 u: O1 r
fi8 L4 G+ G/ d5 G9 D% e
else ' N! p+ i- y: E8 Q; I # user gave a hi lo file name+ O+ w. s+ H4 [! Y5 F, t3 T
if [ -f $har_hilo_file -a -s $har_hilo_file ]; then1 [ a3 A2 V3 j! v3 M7 C8 l, M |
# file exists - use it - only do sim run6 o9 Y5 V( K) @) n. c
run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file} - w. S9 F9 e) u run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file} m" J( a6 |/ N) Y6 g# b
else Q( n9 ~9 d0 W4 |3 f, Z; c6 j# M
# no such file - generate it - do both runs' h. b! `+ M$ o7 k r x$ F
run_cmd $command $CMDLINE -har_one -har_fnf -har_setup " F* K6 ^' M; b$ t if [ $ret_stat -ne 126 ]; then & M, N$ n9 R* r; \% ^ har_check_ret_stat n. p( Z6 t9 [/ M
if [ ! -f ${har_ofile_prefix}.hl ]; then" G* k* H( _6 U6 x1 b r5 L5 X7 h# Z
echo "No hi lo file generated after setup phase. " $ {; _/ t9 M& f1 ?3 I) E echo "Contact Synopsys technical support." " Q" X- m3 L3 U0 Z9 Y. W5 {/ {1 c exit 1 - o$ |, a1 z5 l& n, D else 8 v# f/ }6 Y1 B* y if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then " G+ ?; I: F, g Q$ X) f' N mv ${har_ofile_prefix}.hl $har_hilo_file. {) X8 ?; ~. W0 a6 m# O
fi5 d* [7 I( \% K4 K
fi 1 T$ E) G5 v# f$ P4 f7 z if [ -r $LOOP_CTRL_FILE$$ ]; then$ \6 k8 m# t0 ?4 W1 M6 H5 w
run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file2 N1 _, D- ~4 H6 l
else Z4 R# G; H3 L
run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file) M3 N1 o: E+ F0 V" v# I( a
fi , A1 s- D6 L* v: O' o else 3 K0 U3 `& X1 f6 ]' X& K- G5 V
ret_stat=0 - T/ Y8 T% a! I2 g( ~) R' [ G fi6 x5 g& @5 n8 W: A3 y
fi 0 M# T: \# h+ @ fi % I8 u' \ P w' Oelse ' T- n2 v+ ~0 k& k; p: O& v& d- H# don't loop if -har_setup0 o5 {1 b& u* R2 V! s
if [ $have_har_setup_flag -eq 1 ]; then $ n0 f: x4 I' ]6 Q* a" B run_cmd $command $CMDLINE . C, F% V3 V8 L6 r% c) P* P3 ? if [ -r $LOOP_CTRL_FILE$$ ]; then 8 A+ y9 ?1 e2 K& `1 S rm -f $LOOP_CTRL_FILE$$ - [; O& M! ]6 c2 \$ _0 |6 c! X fi 2 |- }# s4 y( t else* O3 ~# w5 \' B. Y
run_cmd $command $CMDLINE + l' Y$ W% i. p5 V- k* j run_loop $command $CMDLINE 6 R( e: y7 \. P1 D1 D3 A fi2 m& r8 T( N1 {( E. W# r
fi8 Z2 G8 l) v. k0 |! |) \2 M1 K7 h( ^0 w
# @$ I, W. C- O2 x4 Qif [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then . a0 [- K1 a4 B, Z pwCreateErrDB -w $workDir -e $errFile 8 U ^; q8 r, C, G: s& m6 K& Y ret_stat=$? & b1 w' g5 {$ \2 V' {fi a. \' f7 J( y4 d+ m1 `6 f W% ?}2 x. c4 [. q/ U: L& k) O- j/ X
5 |' Y1 {( ]- I, E( k8 N1 j; g
cleanup_alter()' I" H' Y+ ^2 r m
{* y, C6 d3 v0 r4 q
/bin/rm -f $ALTER_COUNT_FILE 1>&22 W- V1 X+ T0 s0 J
/bin/rm -f $ALTER_HK_FILE 1>&2 0 L! }# W. `! D$ |3 P* Z. v! Q}( i W$ ~' P l9 u4 a. b/ k( i+ G7 }, ]
7 ?* o! x; U- |' k$ f u) q
#generate alter temp files based on pid1 M. I( {8 ~8 ^1 ?
ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$ . ?3 z2 l/ M, U& \, ~if [ -f $ALTER_COUNT_FILE ] ; H& C2 p( s( E# G! l [. Bthen : s' g. x* Y( E6 K until [ ! -f $ALTER_COUNT_FILE ] ) A& B2 |' @9 B g do+ I6 j, ?0 g/ u2 Q# ]& |
ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$5 J# L' q2 K" |; N5 j2 b3 D
done, Q6 {, t" ~; E, x
fi/ ?' ^! k: z6 ?8 O
export ALTER_COUNT_FILE # S, s# Y, ^! P, j 8 M, }& u+ T* o" g8 K) \* JALTER_HK_FILE="$ALTER_HK_FILE"$$ 1 a" x. L& i' V. \5 X3 V' a( xif [ -f $ALTER_HK_FILE ]- C0 K* ?4 }) c r0 g2 t- n M
then 8 E& u2 g; ^) F4 ?. | until [ ! -f $ALTER_HK_FILE ] 4 b O8 b. Y& q0 @. K8 S" Y do. F0 k- D; D0 C- R7 E9 Y, v& u
ALTER_HK_FILE="$ALTER_HK_FILE"$$* [0 S% Y4 L- F% t8 [
done0 P/ W- S$ c$ ~$ A8 K
fi ' K/ o6 |6 S6 P/ `+ x. `export ALTER_HK_FILE! u' h9 P7 i2 K! P/ _" {& G
/ W* Y. {) U1 Z& I2 d; v) W; _#generate monte carlo related temp files based on pid 8 p# O1 P7 u4 hcleanup_monte() / m% |/ ?# X: p8 I1 K0 Q8 G{ % Q& s5 D0 W' o, q: U1 M9 m /bin/rm -f $MONTE_IMG_FILE 1>&2% |; ~' |- G8 v3 p g+ g
/bin/rm -f $MONTE_IMG_FILE.gz 1>&2 " \' `- F, U/ l2 ]& A& v /bin/rm -f $MONTE_COUNT_FILE 1>&22 i+ q1 u& F! z0 t9 f
/bin/rm -f $MONTE_CFG_FILE 1>&2 ! J- K2 E. }! B} ( V" j; V: V& e( r9 h9 g' D$ [% h0 d4 W
MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$. G3 r- P; D4 Z* w& p
if [ -f $MONTE_COUNT_FILE ]9 A: i1 {& s# v4 N: h$ m, R
then3 X- \7 W/ g( e0 Z ]! F% }
until [ ! -f $MONTE_COUNT_FILE ]( E" M6 P7 H* b- i) _( J
do1 A- t! f7 D e5 U6 t& R! [4 }
MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$ 6 h* ?# R* q! R done ) w+ d3 Z6 z* t- _. Bfi S0 O( ^$ _: {: S1 @3 g) k1 Jexport MONTE_COUNT_FILE" Y6 V! _" ]4 l, n8 [
' R0 u, B9 f1 |
MONTE_IMG_FILE="$MONTE_IMG_FILE"$$1 L. p1 _* a1 d8 U! p
if [ -f $MONTE_IMG_FILE ]* u# B N" q* r+ P% k8 i
then1 N. J2 b- d9 W- [. g" ^
until [ ! -f $MONTE_IMG_FILE ] 2 K9 ^, ~5 Y4 x, ^ do $ J0 M8 z3 w( q. I3 f4 | MONTE_IMG_FILE="$MONTE_IMG_FILE"$$ 0 n( w6 X3 n$ i$ ?; l done 2 J8 d( T( J V9 H. H! Z3 ^fi ) _ c; o) n+ f, s0 P( z- Sexport MONTE_IMG_FILE 3 _+ m# S2 K$ b/ d& H+ x4 S+ |6 s% M. n1 y% F
MONTE_CFG_FILE="$MONTE_CFG_FILE"$$- G" _ T1 i) Q: s2 ~0 g+ [0 c
if [ -f $MONTE_CFG_FILE ] 4 S$ d! `. I- c+ _9 k% wthen 5 a& U. X7 L( {) \ until [ ! -f $MONTE_CFG_FILE ]+ n7 O5 W: e0 g
do5 d; R9 m/ G2 W
MONTE_CFG_FILE="$MONTE_CFG_FILE"$$ # b0 Y% L) A3 X% [7 B done n2 M& `# I2 x2 d; |fi 7 o; Y( _# {6 Q4 s 0 W+ \4 ?+ c& L+ G' j( W# main iteration ! B5 E+ R( e0 P; h) | c+ Grun_main 8 l \4 M0 D- [; I: i8 l+ K0 G' u
if [ $ret_stat -ne 0 ] * s9 @9 _" X; z& G4 X$ G+ F
then / @% b) \5 x! G( _
cleanup_alter . k8 j+ @) g1 O% ^8 \0 ^3 } cleanup_monte 8 Z/ \& X% K4 T/ V6 c Exit $ret_stat 3 h1 J* C7 D+ g1 v6 l% o E5 ufi+ }# q5 L- e* u
* O% ?! k4 @' a+ R% ]6 ^#Alter related iterations' F1 X+ q# S/ n, c, Z
0 I- Z7 [4 U6 }$ _4 }9 L8 y' ]iterations=0/ Z# b* D9 l" S8 J" i9 ]
count=0# Q+ g: P; Y# ]% t1 o& [# i
if test -s "$ALTER_COUNT_FILE" % O$ l* Z2 v1 `then# C3 u* Z: z! J y! i
if [ -r $ALTER_COUNT_FILE ]; then: U- A' E6 ]5 X3 J
exec 7< $ALTER_COUNT_FILE $ n7 w' `" S3 A2 q6 }6 Q read iterations <&7 , H' Q1 O8 i( W, z- i fi; ^# Z6 B/ c1 p5 p2 W
fi& d& r0 E! g2 o' p5 I* P5 R6 k
; h2 {0 D7 L9 L, A" M( S
trap 'echo Program Interrupt; cleanup_alter; exit 1' 26 ` X9 ?' C- |: G+ U k# k
while [ $count -lt $iterations ] * ~, W4 \$ k. Sdo' z. Y- R7 c9 \- F( [
count=`expr $count + 1` ! u( P% ]2 t+ ^6 l( u6 c% d6 O3 U ALTER_COUNT=$count 4 v) T; B/ g2 k6 i. r, b export ALTER_COUNT 0 X" Z3 H2 x8 g, N, b 3 s! J6 L$ Y$ K& i% Y) U3 h run_main2 ~. p; g; d0 q4 }6 V' u0 _
; Z, M3 P8 b, ^7 q6 \& F# Mdone / [6 `$ }4 W5 U/ | $ Y. m" h+ Y3 T$ t9 p# M' g, R& Z#Monte carlo related iterations ! k3 B% K& a6 [' V. }8 m* f8 ?# b6 X, Z) y. D9 X7 }1 H5 P; w
monte_runtime_summary() 5 g& r! Y7 W" x3 C' Y+ R7 }0 @{/ y% m( I% ?, I2 H4 x, [$ X. p; S v
keyword_1=real $ a; j- R7 O3 M: _ keyword_2=user- k# [/ x% Q6 G0 g
keyword_3=sys5 A$ O1 t6 l2 T& c! z H
ofile_prefix=nanosim" K, T9 B+ c0 z1 O
2 Q }8 s% @/ I8 h8 g
if [ ! -z "$o_option" ]; then3 ]# q4 ]' g6 J5 O7 ?0 V; z
logfile=${o_option}.log $ n, f. L- g7 f \) q( K" C else % j3 j1 t, l. H6 e4 P logfile=${ofile_prefix}.log4 [5 E$ a7 S P/ a
fi ' u) I+ d+ [+ k- D4 f. @7 B! r; X" Q( T9 v2 p& t
if [ -f $logfile ]; then* \. I# y& q6 ]1 M. M+ k' _
echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile % \- Q5 y# Q, E- d" g) L0 @8 n 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 }' >> $logfile0 T8 @2 o5 r' I2 L) R4 F
fi7 y% l2 K" i) Z# ^$ g/ Q5 f
} 9 b5 c* G- \' L* ? % {9 S" P p. N9 \) Rnext_monte=0 ( x! J b& h( z K; Y5 tcur_monte=00 Y5 C$ V9 g) m. Y( A! \8 N' d
/ c8 }; I8 C" Q3 p) f7 M; V* O0 r
if test -s "$MONTE_COUNT_FILE". L$ f$ z6 L8 u+ O) I
then 1 _ m/ i4 U: N if [ -r $MONTE_COUNT_FILE ]; then( Y$ {& Z$ c! ^4 q6 ?+ [
exec 8< $MONTE_COUNT_FILE7 Q: r/ \( F* {; \3 Z$ d/ l
read next_monte <&8 ' z! `- C# k! O, ]8 e$ Y3 | fi. L* x3 e. x% u7 V- o3 G
fi + d K7 ]6 B4 @+ z. c" }1 H% d" p' ]% j* X3 D) ~) X' I% }
trap 'echo Program Interrupt; cleanup_monte; exit 1' 25 n/ {9 }9 q6 l& \6 t% C
while [ $next_monte -gt 0 -a $next_monte != $cur_monte ]: e% ~' T, J$ `4 u2 k- C k
do 2 s0 [! Y- N. P NS_CURRENT_MONTE_COUNT=$next_monte; F1 v' W( {# g; N
export NS_CURRENT_MONTE_COUNT' R1 d7 H% y! V3 s& @" t
% m, I8 @/ K1 b; c
echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE' e+ K- ` i6 N; D
CMDLINE="$CMDLINE -c $MONTE_CFG_FILE" " N, c, ~- s; h( r) b1 q5 i1 n run_main % A* F) i. s. @% \! _7 J R$ h; `0 q# S! D8 m
cur_monte=$next_monte% J# Y# m \& |5 X# S
exec 8< $MONTE_COUNT_FILE 5 w* A% s3 Y0 i! S7 b( B; J read next_monte <&8 8 W; q: z. f" Ndone ) b6 Q4 C g1 y: f1 P, X $ o5 a" Q* D/ ? [& p. @if [ -f $MONTE_COUNT_FILE ]# v, D" V H8 H4 i* X( X
then + S2 ?2 [# o! u& e% O# R) l monte_runtime_summary9 }$ f1 L: B7 r0 D" c, N
fi ; g; l& V/ d# U6 F$ `. J2 H ) }' _6 \" e$ j0 Z o# ~1 ocleanup_alter6 E u y) l$ J7 ?) N4 k; C
cleanup_monte / q1 p N8 k& n: }2 P" p0 O3 P1 ^7 m2 }
Exit $ret_stat