; x# ?3 K% f1 O0 s, Iscan_for_har_args() 7 m5 D* F1 x: u3 {; x4 z{ & r: J' S2 J1 j, t& n while [ $# -gt 0 ]; do % i+ T4 z4 z7 f2 w case "$1" in# |: k7 {- [" |+ S+ t4 c9 ~
-har) ; q; t1 @4 Z e" l l5 i have_har_flag=1 ! \# f9 I8 [0 a. n2 `2 f6 R [ $# -gt 0 ] && shift! r, U L2 k3 a* M% V" d
if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then + ]: v1 ], l; X4 i4 g+ ~ har_hilo_file=$15 W. O8 K7 A. `
shift$ {9 u7 T* a# U# _6 j4 p, m. u/ d r4 }
fi . Z0 h* n, E; Z+ P& V. E7 P if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then0 a; \+ n# q s6 ~ m& }5 I6 r
echo "Too many arguments to -har flag. Only one hilo file allowed."3 b+ o% C" T F! e2 c+ W, X9 k7 J
exit 1 4 u( G, M# U% c( d" y8 i4 @9 F8 _ fi + `8 g$ M5 O' K. u break. m0 O4 Q Y Z; f; K$ }8 \
;; ( F0 v8 M+ ~/ c' K -har_setup)6 f$ b/ j# W) F$ d
have_har_setup_flag=1 & T. ~6 t! K3 o break6 s3 w& {7 ?/ g; }9 N ]
;; 6 C# T2 b$ D: a/ L' U *) 1 e' D3 u4 P5 K$ ~" F shift- _0 @" _) k% ^. `4 {
;;5 z# w+ K2 k! C- C8 U& u
esac( S. v) _# J. h& P
done 0 a7 P/ R7 i6 @+ ]0 R} 9 Z1 r) n4 T1 y+ P6 o7 G: k # ^3 K ^- r: f+ |& e3 Cscan_for_har_args $@ ; P1 m' _) z/ z+ A; I , l) X1 s* n9 Pfor argv in $@3 S3 M/ a1 j. N- Q: Y) y/ H0 Q
do0 y, B0 E, \ F# l# n: t1 `6 }
ORIGINAL_COMMAND_LINE="$ORIGINAL_COMMAND_LINE $argv" " s/ o: |, Q3 y3 K if [ $argv = "-gadb" ]; then* ]3 W* }/ R* _ Z/ c( u
databaseOn="y" + l) B9 T1 V2 G' c) e2 \1 M% p' r workDir_next=1 $ t3 v( T% q# `# O elif [ $workDir_next -eq 1 ]; then + `2 d8 |. [& Z- z8 [3 L workDir=$argv 3 l3 N& _8 s2 O7 O/ F/ j workDir_next=01 e5 Z. D9 F# S$ I
elif [ $argv = "-ga" ]; then% A, C6 C2 H5 _
gui="y": ?8 }# w8 S8 D- q$ q
elif [ $argv = "-f" ]; then 5 W0 \+ j( M6 r f_next=11 H, `! }/ Y" p
elif [ $f_next -eq 1 ]; then ' h, Q: r5 ?7 y2 r+ F f_option=$argv ( a2 C8 u' R$ J: v% Q1 i( c/ Y f_next=0$ @0 y7 V' ~( r. f+ f
elif [ $argv = "-o" ]; then 1 J5 t% n& [; V( e: k- ^0 y) N o_next=1 * X7 Q! q+ e0 m5 B0 E$ _- f elif [ $o_next -eq 1 ]; then& o o( y& y# D& h1 `( S5 }1 ~
o_option=$argv . W& h" @- t7 S% c1 d o_next=0 4 Y% G% U3 ?6 e$ |+ i! w fi" \1 x) X# N7 c, @% L
done % O/ }/ F9 M! Z. I% v' S# qecho "Command line options: $ORIGINAL_COMMAND_LINE" > $EPIC_SCRIPT_MESSAGES_FILE * l! f" A2 ?$ ~. {5 \* u8 f6 |! h
if [ $databaseOn = "y" -o $gui = "y" ]; then ( m% n- Q0 b$ r" i$ o- i- f* g if [ $cmdname = "pathmill" ]; then $ S# ^: a! y" J/ K) P if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" -o "$EPIC_ARCH" = "SUN4_SUNOS_5_64" ]; then 4 }+ t3 Q7 F/ q/ A* @ ostore="y" 6 z/ b0 |( Y/ }8 h4 I postgres="n" " ?7 N6 h# w/ t+ \" T0 Y" |% k else0 L3 ~! ?; c, ^% U! M( q4 Y: Y
echo "athmill GUI is supported on Solaris platforms only" 1>&2 6 K/ y- [* y, L" F
exit 6 U z3 F9 G" Z& g: A) V fi 2 b: N7 X; t6 Z! a9 ]9 t else4 D& V6 z' s/ {- {
postgres="y"0 t5 [" F; a4 Y: \: N4 |6 S
ostore="n" ! ~+ j* l' O2 Q6 }) ^9 S) h% g fi * k6 |- ?. x( C5 v) A& Wfi3 S* {- D4 t" X# X( S# ^) I- [$ D
! `* [+ r! F4 c2 @
if [ $gui = "y" ]; then + n a. @9 X4 z m if [ $cmdname = "powrmill" ]; then + O) [0 D, f9 ^0 |" p pwga $@ % j( S3 P) K4 @ exit 4 @3 m% ~# M* I4 ?7 U5 f" q fi 0 P4 `9 R6 w: ~* \3 h [7 J) c' q ; J" B" i( p2 z7 I& o- }3 O5 h
if [ $cmdname = "pathmill" ]; then 2 A3 u. J- w$ [' P6 J if [ $ostore = "y" ]; then & T7 s( T7 C5 Z3 W ./pathfinder $@; }0 I2 T/ Y8 @ `
exit 5 Q7 @% v1 `! w! i3 i elif [ $postgres = "y" ]; then 0 b0 R/ W; h# x: W' v8 Z, o M pmga $@ ! `6 h# |5 y0 h; m exit9 h+ m6 @; K/ [) M4 \: z2 E
fi 1 P. U$ e# }' b$ [3 K+ D5 K: j fi # M7 q2 N7 l! _9 B+ Kfi% k5 i4 S' G$ B/ R; R
7 z2 @% \8 [5 ]& W+ S& P/ |if [ $databaseOn = "y" ]; then' c5 ~' c, r4 N* j1 m
if [ $ostore = "y" ]; then9 j! C* C# G- r7 @8 [
if [ -z "$workDir" ]; then , o, A/ X' ^- \4 g+ \! I, K echo "Error: Missing argument for -gadb option"" k* L$ s" L z! p9 o
Exit 16 n; p6 j; S/ R
fi , N; d! {7 J( f9 T1 g fi$ G3 V5 A+ c5 X. \
if [ $postgres = "y" ]; then / _- V/ _ U7 s: p0 p if [ -z "$workDir" ]; then M2 ^/ L1 l9 f% E
echo "Error: Missing argument for -gadb option"9 y+ v* J! b" K" d1 x" t
Exit 1 , O) `" X6 J7 ^) B# a. y fi" t) Q. O6 p% U& a
fi/ R2 Q. J, i# y1 V: q( [
fi1 n# @1 W6 C+ C( p( U& u
1 ? y. L# Y( c. a# w' i- Pif [ $postgres = "y" ]; then: c% W$ [2 t- Y% Q. K3 |
6 Z7 ^1 f- C8 b l7 X! ?* j
if [ -r $EPIC_BIN/scripts/gui-init ]; then ; F+ S2 n& ^2 m" I) g# u3 Q% t! v . $EPIC_BIN/scripts/gui-init3 B) ~. c& f8 c! p# D
elif [ -r $SES_ROOT/bin/scripts/gui-init ]; then 9 i5 |- r$ E: f4 f* k . $SES_ROOT/bin/scripts/gui-init8 S1 y. V. m7 U( b+ r
else' f/ t! N, ?6 Z( }
echo " ** Installation in \"$EPIC_HOME\" has been corrupted!" 1>&2# w2 U$ v) \- ^5 e
echo " file bin/scripts/gui-init is missing." 1>&2 4 W1 O9 X. ~; S0 [4 X% @% q fi. r/ a- B; @! G- B; ^
1 C7 @3 K1 \2 P9 ]% P; D/ _ workfile -tool $cmdname $@ & v% c" x2 ~; `) g+ Tfi% @2 c; B& a8 Z6 g$ ~' K. J+ y
1 R" B0 ?7 h$ S6 f4 e/ ?' z7 F! L
if [ ! -z "$o_option" ]; then 5 n4 J. O" H; ]3 T" b: Y errFile=${o_option}.err7 |% d$ b6 Z- w+ l' n- V& x
elif [ ! -z "$f_option" ]; then / Z1 P& a" ^. T* j' H if [ -d $f_option ]; then6 ]5 I6 \& m( |* B! G" }
errFile=${f_option}/powrmill.err+ i" K8 f0 s" L0 U9 \
else errFile=${f_option}.err 9 D* U, ]+ s# n$ [/ R fi+ I; p- D4 J8 o$ L$ A+ u: ~
fi! j6 {7 x7 M) b7 V* T6 `. w
" |8 ^/ ~0 ~4 a8 y6 U
' r3 m! s: h' g, f$ Z% q! V# j
if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then 8 S; B, {) c; I# C5 Q" u' ~' f+ S) a rundir=.epicrun 7 w0 S# X' U! @* C5 h( \else) X* M# m( o% c9 O4 C+ x& Y
rundir=.epicrun$$4 u1 P- i7 Y: y5 B4 o" M$ V
fi # ? y/ Y4 o3 b- }+ M$ W0 m. A- l& p# a6 ?$ N7 I9 |4 [' |
libpath="$rundir${EPIC_DLIM}$EPIC_DIR"; @; u8 K. V) K1 s# A/ ?
8 T/ O7 r* V) O. v; b/ N
cwd=`pwd -P`% G- b6 |. _; g
if [ $cmdname = "acehdl_w" ]; then' P% T4 D8 U7 L' t3 R
cmd=`basename $0 .sun` 1 Y( r4 w$ t4 E1 W2 J. n! h cmd=`basename $cmd _w` 5 b# h `- n' @+ X+ x6 {: d+ k% k/ nelse/ c% q5 z) ]; l% P! W& W
cmd=`basename $0 .sun`: R. u" ~- y& X8 g, S) [6 j: ]
fi1 j' [7 ]" }4 f$ F
2 Z3 H( D9 J O1 G5 y
command="$EPIC_EXEC/$cmd$EPIC_EXEX" 4 T- F, z0 Z( P" B* P, d) k[ ! -x "$command" ] && echo "$cmd: not installed!" 1>&2 && exit 1 6 o6 u7 ^9 N2 l- Y* C' f, {" ~7 ?# O5 T8 [3 e2 d4 P0 p
# buildmod extracts -u/-fm options and calls genepiclib % t/ r3 h% F$ m7 `% q* L) D* I# It also set the remaining options to variable CMDLINE8 O: A- o1 m0 u5 [5 G9 V
# look up in .epicrc for -fm & -FM parameters 6 Z, Q* }+ R5 n9 Z E2 k* a: M: P" o4 y
fmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`" ( }& q# Q* ~: ?[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`", o1 F! P8 d2 E; [: B H' E
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`" $ e5 m) j5 G& {2 ~ + A$ } f) L1 _ \# SFMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`" 0 K! B- k0 J* b5 i/ p[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`" F; p- f7 H8 W( W/ g; j& H[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`"* W# i; k( n% }0 m3 j# \8 j* V
" U3 w) {( e8 y7 r3 a/ k6 l7 a
if [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then + l$ b# J% p/ M' h # note that the buildmod script will set the CMDLINE variable g: q. W+ O9 w) j3 w& i6 b . $EPIC_BIN/scripts/buildmod 9 l; O5 U/ h: c5 P% P$ I h 3 J& w b4 F: o$ Y0 g/ Z, { #echo "This is the value of cmdline=$CMDLINE"4 E3 w9 S" O7 N8 X; h6 j
#exit 02 }9 ]- w) V0 A' F$ S* A
5 Y/ l" w) v& m: ~* S3 B/ \ # if a new timemill/powrmill/pathmill built, run the new one $ r8 X: f0 v( I- d) y$ \3 l [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX"% }! \$ O1 Z! \0 _
fi* {- p& A! D2 u+ _3 n
0 D& ]6 u8 p$ ~) T* Z
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then - e/ Y7 ^9 {0 s8 Y if [ $have_har_flag -eq 1 ]; then \& B+ i; R) a: K* J+ U6 c' o. ?
is_special_har_run=1* D, p& O' R Q
if [ "$o_option" = "" ]; then" A. H' _6 Q" i z6 S* N: Z
case $cmd in . J" o9 o% i3 w# a timemill)' w/ x# x* C6 }! a* ^6 M; B; Z
har_ofile_prefix=timemill / o# i; ]/ ]( {1 N0 U ;; 1 _. C- H9 k$ l" M) |- p3 c# [ powrmill)6 ]7 R' j4 R0 p% E( |
har_ofile_prefix=powrmill % J/ A9 o9 w, i3 q1 s" s7 F ;; - u& u* n2 p# k6 ?8 j nanosim) , I) P9 Z: X6 g9 r# w har_ofile_prefix=nanosim $ ~& A& X+ A/ z4 o# r7 ]# f ;; ^3 ^; J, K, M
esac 9 B4 v$ {0 f; n: q/ Y else 6 N7 \% q/ b, t0 q har_ofile_prefix=$o_option 9 J8 T+ l8 o5 ]1 r- ^ fi/ S! O5 \) {& K. p: `
fi 2 |/ m0 Q7 M: W/ W) I8 gfi0 f5 Q5 Y/ D) i
* u/ _/ p- i; x: b
# Call Double precision version of the product if -D . n9 L% T) V( l' O" G4 J# P# or simulation time > 1,000,000 ns. ) H0 ?8 F9 x7 j, b8 y Uif [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then" _6 X0 h8 s% o0 `
" J9 x2 D' ^$ {$ l2 q3 R
# Now the binary always has the ACE feature 4 b( ?0 T0 S; P- I' z USE_ACE=YES 1 l: U2 \, z! M1 z: u0 X; F 9 [! B3 n9 C, F# ~5 W HAVE_DP=NO / |2 b1 j( I; C- Q% q EXTRA_CAPACITY=NO# W# X4 y- W6 k, G L! g5 y
DB_REAL=${FORCE_DB_REAL:-"0"}) o* }8 ~ C8 i6 _0 l3 ]
! a$ N$ P' i( ?# e
# Enhance for ACE ease of use/ _$ K: X" Q4 M5 `
# If no command line option or only a -T option, do: c. @ u: P2 u! a7 y) \) m1 I5 ? # 1. set -A option$ X) v/ [3 a0 P9 j
# 2. assume input file to be hspice 9 i1 {9 @7 C# O. f n, w, G # 3. set -o to input file prefix " E/ ?( n& |8 j9 Z # 4. set -z to input file prefix 0 R" T) w5 M! ]8 l* }' j9 X/ i # 5. set -c to default config file* [) ?# J8 Q0 v$ |1 {- L% c; @& n
netlist="" % t5 r3 p) K9 e9 _! Q% e minusT=NO! [8 {! [6 E( o Y: k- X
useStdCmdOpt=0 ' }# W( k) N4 U6 G2 r" J# c/ d prefix=""& j2 W% h. {$ r: q& |8 ?2 ~6 F* k$ K
circuitType="") \1 L+ J9 Q+ }" p6 w6 w+ H$ j# b
for opt in $CMDLINE' l; P; |. a1 Y1 O0 Z( ]
do0 H: L$ |7 d7 |
case "$opt" in " Z) U6 @6 e: j- Z; }6 m- ?5 L -T) 1 T d0 [% n' R' g/ w6 Y- Z minusT=YES $ P0 ]9 @- A: b% I5 ?! i ;;3 o' j8 p0 D2 D/ k4 d, s$ f1 G
-*)2 E* i7 `, L2 w" Q- I
# using standard powrmill command line( }8 Z7 T2 ?) O+ |) y, _
useStdCmdOpt=1% C5 p6 _0 y) d- c# W6 |! J
break 9 Y* I5 C" I- @! k5 P ;; $ S/ A: W x8 {3 J: L *)% m6 P" \' a- V4 y$ @
if [ "$minusT" = "YES" ]; then ( |; P5 P! t) N/ r4 |% p8 v* S circuitType=$opt3 V g! q$ V* h" r9 i, Q) m
minusT=NO # reset flag # x* S" B+ x5 U& k8 m4 s! J else ! o' Q( z$ }1 G' j* M3 F
if [ "$netlist" = "" ]; then # F S' p+ g9 V6 {* P3 Y prefix=`basename $opt` . H$ p4 s5 }2 x/ }1 m prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix` ' g5 K4 b* N" L" [ fi: N8 O( F7 x9 t' e
netlist="$netlist $opt" . u; K% i/ f- w. ^. R fi + H5 x% u( q# A! }9 h+ r6 t& P ;;) r4 r8 G, s5 H" P" W% E( _" u( e$ v0 H
esac , Y- A8 A9 `' L3 W Q/ Z7 n done" p' C4 Y4 ~0 n7 U
; V+ s3 B( z2 M$ O, T" H! A3 R' _$ D8 b' M
if [ $useStdCmdOpt -eq 1 ]; then; ~2 {1 b' A. U! P+ _, g
# use standard powrmill/timemill command option1 |: A; ?/ M1 |& {) B
for opt in $CMDLINE, W3 x: H7 y& i& S& J$ I# a; E
do+ ~1 q1 U/ z4 `$ V0 l
case "$opt" in . n+ h5 h- n4 F9 B9 n1 u8 \
-A)& ]0 G% r0 e! e$ h, S: Q
DB_REAL=1 & i0 q& D' [2 k4 V6 F2 c ;; - [: J( a* `3 \) C" s8 w esac1 F1 t( W9 z3 @
done P5 n& h* V" D: C7 H
if [ "$netlist" != "" ]; then7 _3 W& e+ x/ F3 L' k
CMDLINE="-nspice $CMDLINE" 0 a5 K5 W( I& s4 E( D9 M: f& x- E& ]8 A fi . o$ `2 p4 z' V3 C3 o( R else. d2 z9 S+ r$ D) R7 P
if [ "$netlist" != "" ]; then & P1 f. W' g/ |$ t3 @% a- n, p EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"}) Z7 H5 t# o% @. `
# construct new command option ! v0 g- H/ @3 B" j% w5 T4 t. q3 W if [ -f $cmd.ini -a "$circuitType" = "" ]; then ) n: E- M ? ]/ R, q9 s CMDLINE="-nspice $cmd.ini $netlist" # Y9 Y2 `6 X" N% Y' Q: k( _; b3 q else 4 a N; p- M" W2 t7 V1 l+ ~ if [ "$circuitType" = "" ]; then " X/ o- o; S+ D9 |- [ circuitType="msana"( Y* o3 V) D i p5 e
fi2 k+ m! ~; X5 _8 H8 P4 j
CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg"3 ], C, z$ y7 A: K1 F" Y
fi $ d ^ V9 Z' j# I) E+ M CMDLINE="$CMDLINE -A -o $prefix" , M- G J0 Z# Z& `- \0 ? DB_REAL=1* E7 @& L. {6 L/ K
echo $cmd $CMDLINE , ?9 x; }: f6 V& C& L; \; x fi; P; s7 X9 C* R; o
fi( O ?4 l0 i8 c8 |! j; D% o
fi # cmd is timemill or powrmill or nanosim or railmill or pwarc( c' Z. c! L0 P& |: f5 C8 P9 U
" i2 U+ v1 A8 m! Q5 l
[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a"! H% T" q3 }( t! H
[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a" & D' G# K! M5 T[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v") u8 @; `9 u. R3 G6 L
8 f0 [8 P2 \0 bif [ "$__engine_wrapper_called__" != "Indeed" ]; then! h7 _- V6 ~; Y1 ~3 q" C% e' ^
__engine_wrapper_called__=Indeed - H* j8 j5 y& v, [0 h! p4 r/ Y if [ "$cmd" != "amps" ]; then ) h5 H! u4 R4 U export __engine_wrapper_called__& I6 r; i% S5 w
fi% p! M6 E2 @# W& D: y2 E
) N+ p! {6 s* l; c) G) ]
trap "cleanup" 0 % q( I% G8 C6 S) z$ Q( b trap "" 23 |. k; T+ o' U7 y* ^' Z8 `+ s
. K. i u& G/ ?; }; h [ -d "$rundir" ] && rm -fr $rundir; J q6 a4 g8 K( t* j6 Z. K* }6 m
[ -d "$rundir" ] || mkdir $rundir . g- ?! }' C! K( f. o% Y& a4 `- _+ P3 X4 Y" q
case "$EPIC_ARCH" in . @( Y% ~4 u" L9 a* z9 P' C* o *SUN*64) 2 l6 x% q" o/ Z" C LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"# a) Y, @, t! Q! G* t
export LD_LIBRARY_PATH ( m* x% G3 E; u3 ? suffix=.so , N* |) t" Q0 |& m ld_err_code=127 # K: j' u) S4 x* h% @1 Y9 } ;; 8 F4 u2 }% W5 h. S& Q *SUN*4) 0 z; c, C- F+ `( s3 |
LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"* L! S: ]4 V4 w' j
export LD_LIBRARY_PATH 8 u- ^2 d, T6 B; r( S8 Y suffix=.so.1.05 ?4 c# x% d* g3 }4 Q: u8 y
ld_err_code=127+ T2 _, U! ]* s
;; ; g" [+ P' h2 K7 N' k *SUN*5) 9 I& t' b% q7 y/ A9 _& B LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH" + S W' ^$ h1 }; l1 Z export LD_LIBRARY_PATH* T2 R: d o" o9 |+ ]! w
suffix=.so! ~# y0 l i' _0 J; g C' ~) e P& O
ld_err_code=127 6 x3 \8 x: y2 g5 F& E0 i ;; - p/ ?: c2 n: H x86sol*) ! b7 r6 ]( V3 a4 | LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH" " I+ ~+ _9 l5 _0 L. H+ }8 m export LD_LIBRARY_PATH # o* O/ N5 o5 b$ M, \# m suffix=.so 6 C2 E' w* [4 H/ t ld_err_code=127( m7 L: |% ?% e
;; * m' Z3 I% U2 E& Z *AIX* | aix64) 2 C5 o) s. x# A; i
# When genepiclib creates shared objects, it creates a import file and / [) |- `' E* l% N # uses timemill as program. So at exec time,program timemill is needed - A+ ?, Q5 z; J
# in LIBPATH8 w( g! C/ x) H Q0 l) ^, w
$ln_default $command $rundir/foomill+ H2 l9 p9 k( M: J4 [- o; ^8 H
LIBPATH="$libpathLIBPATH:/lib:/usr/lib"7 q3 N O% O9 w- o+ S3 l
export LIBPATH 2 n0 w' ~$ c5 P8 C9 p suffix=.o) X6 b3 u" `" {7 o
ld_err_code=8 % u5 f( r, o) j/ C* z* L5 E% z if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then8 a; a5 |6 r. k: e: T
tdir=`echo "/tmp/d"$$` , `- [( ^0 X# R, {' Q [ -d "$tdir" ] || mkdir $tdir . L+ }% B7 e, j- V# q1 z if [ -f $EPIC_DIR/libCustom.o ]; then+ T% p& p7 _% }) w; W7 }
cp $EPIC_DIR/libCustom.o $tdir/; l, e" m* d4 g# E9 k$ D
$ln_default $tdir/libCustom.o $rundir/ i5 `9 H, E- k. e' x/ ^8 g& k3 D
fi ! L! o- S5 @# o$ o9 F if [ -f $EPIC_DIR/libModel.o ]; then 6 G; G% X$ o* d$ I& r8 u cp $EPIC_DIR/libModel.o $tdir/ ( Q. [! ^/ J, C& b: k) U+ `" O& @6 V1 f $ln_default $tdir/libModel.o $rundir/0 `/ x9 Y: }# k0 b- [0 }/ Z: y
fi0 Y# e9 S/ l0 O e! s* F3 v
if [ -f $EPIC_DIR/libFuncModel.o ]; then/ d h, |+ L F! H A
cp $EPIC_DIR/libFuncModel.o $tdir/( ?, K, }. |6 j1 H% j2 O5 w
$ln_default $tdir/libFuncModel.o $rundir/ ! v: B0 G5 \% s( p! W) N( J% Y, _ fi : n7 U* b# o5 b/ ` if [ -f $EPIC_DIR/libFuncModel.34.o ]; then ( z4 o$ `! Q, q# w' Y cp $EPIC_DIR/libFuncModel.34.o $tdir/ ' i/ f- P5 [$ T# V1 b' }8 | $ln_default $tdir/libFuncModel.34.o $rundir/2 g, j$ a% }* ~; H
fi $ T( t+ k0 q* V! B/ i( O( u- j2 K5 _ fi 5 g" O) Z3 g2 T' z- R' T #Set the IBM flag to enable more shared segids ! e+ w$ s; X: A* ]% n# ]# e2 u' f+ O EXTSHM="ON" , _) e/ q$ r$ v" T6 X( @ export EXTSHM 4 ^7 j/ b- s, \! ?/ y; k ;;% P; ?) \3 Y+ P6 {& e
*LINUX*) # b8 h: ]' g1 y0 {2 K suffix=.so : R: G1 [6 C4 F3 K n9 @9 Q ld_err_code=1 5 j& e2 a1 g$ W4 F8 ] ;; 9 O- U6 j, B8 ~, L8 u5 J9 ^+ X *amd64*) 4 w( G3 u! z5 D z$ X; I# Y suffix=.so 9 J. C8 S9 o1 D. k7 h! p" a4 z ld_err_code=11 O- z; ?) v1 R2 e* u! G0 u7 ]
;; $ A/ V# y$ ^: i% Q! n r% H *suse64*)) r! h# L" A+ X0 s1 x9 K# O; O: k
suffix=.so , e `; W; d3 s6 s. J ld_err_code=1 * q% D7 h4 H9 R. \9 v7 h$ O ;; 6 ?' M! G6 J9 T *suse32*) - h: _6 X& k P) v" J: a" N" o suffix=.so) |5 G9 a$ f1 N" N+ a
ld_err_code=1( y0 t3 r. E: ?3 Q
;; 9 B# G% Y3 O! Z( ~ q9 V esac r+ a- h5 N5 W. _/ d& q: v , H2 i4 B$ N1 M5 M) p" d6 U0 F [ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix"& ]) e$ m) }! c( `- ^9 c
[ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \/ [& S, [4 }% ?* {% M" Z" A
&& [ "$cmdname" != "nanosim" ] \ ' n$ `: K* j6 p- h: T && [ "$has_model" = "YES" ] && ulib="$ulib $cwd/libModel$suffix" - u# Y/ T* Z- k5 V [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix" . P0 i& J) y9 O4 V2 C# p0 O( ` 2 I7 M* ?8 c" {. o: R#Look for command line option for libFuncModel.so2 I0 _+ L8 m ` k
# user_library_next=0' O q8 w- X2 v& h' s
has_fmlib="" " H8 J$ a1 @% L) ~% v" {& g for opt in $CMDLINE , i% G3 g& Z, _& t do5 o D; B8 j- g: r* u# t; J8 H
case "$opt" in , ^7 ^6 l/ f) ?, m
-fm) ( X8 `6 V4 z6 s% Q; P7 ^ CMDLINE="$CMDLINE $cwd/libModel$suffix"! Y1 G1 C9 B! \+ w/ }
;; 9 @9 j! K: p" c. M0 T; e6 g$ M -fm_user_lib)$ k% v; Q5 P0 p
has_fmlib="YES" 4 J M. z; s' L% A% M' v# user_library_next=1 / V) ]* M7 e+ i# o ;; 1 J+ C$ z7 P; Y: H2 Q -xc) 3 n7 R; \/ _0 K% Q; L* {9 H; C if [ "$EXTRA_CAPACITY" = "NO" ]; then& e! C+ `. q c5 X
EXTRA_CAPACITY=YES 2 H6 p. ~1 ~3 t& [4 Q fi9 b2 A: u% v7 H# N1 }9 K" h6 L; W
;; ; A( O2 P! G& d) O! |. f% F# *)$ c2 E$ L) g Y2 s. t
# if [ $user_library_next -eq 1 ]; then7 P, z9 [/ z- ~: k% C h
# if [ -f "$opt" ]; then7 N; n7 W8 n2 @5 a8 O. [
# libfmodel=$opt ) j' ^5 H; R% c# else! l6 }: r& @' ^+ J
# echo "-fm_user_lib: Specified file not found" % A% L& _- R* j3 G1 `# echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages ( m8 N: Y9 j8 _5 R# fi' G/ V7 y$ n+ b }
# user_library_next=00 X; x# k6 X) ?$ t: z
# fi # Q+ i3 Y4 N/ O# w5 x8 b! ~6 ]# ;;0 g! u. z4 B9 b. u7 B
esac7 D$ }9 J V2 }/ @+ \7 H- H+ `
done& N8 Q, h g% k8 I0 i
( Z: R+ v* u6 o/ m if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then : k7 F! }9 T+ X# @+ X+ d; w# D flib=""4 a' U6 ~! e' G& j7 }5 T x$ T
if [ "$has_fmlib" = "" ]; then , ]) M3 O& m/ R' a y4 N) M- K( O flib="$flib `get_epicrc ./.epicrc user_libraries`"1 Q- V+ C8 U8 x; W( A) n. K8 W J
flib="$flib `get_epicrc $HOME/.epicrc user_libraries`"7 D7 N7 G- c) U+ p& |' o
flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`"! n! u8 T" h! D2 X- |% C
fi9 L0 T0 F* `2 q, e" r
fi 2 j% }2 _% |% Z( Z/ ?2 T* B* s. P k$ z$ y3 O- ^) Y x8 o" s6 e
for i in $ulib. y4 l0 Y+ O( r, K5 i# p9 ~0 ]. \
do % g0 P) [. ^! q7 F' N, ?6 E [ ! -f "$i" ] && continue / M$ |8 }8 Z$ u& p7 t4 n dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd. m5 L' }( f/ H! k
i="$dir/`basename $i`" # {% W6 A$ _" ~$ c% D+ y6 F case "$i" in : h- V2 e C" B *libCustom$suffix*) [ "$libcustom" = "" ] && libcustom=$i;; 7 d9 V$ Z% Q" a+ H; Y, e# X% B *libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;; - U; ^1 ]2 o) r) I1 t& z1 D$ w0 p *libModel$suffix*) [ "$libmodel" = "" ] && libmodel=$i;;! J/ G2 K% N! T, Q# U
*libva$suffix) [ "$libva" = "" ] && libva=$i;;8 ] q, A% [8 l, D1 z) `/ @
esac : }( F; A: v/ H [ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \ ' a$ o5 C' ]0 B9 O. a && break 7 T8 t! K8 ~# R0 g! V done* m+ l5 ~% q+ U
. p% U" b$ V+ ^( {; H, C # symbolic link shared libraries to .epicrun$$* n) a) H5 {7 B# b6 w6 e
cd $EPIC_DIR; epicdir=`pwd`; cd $cwd @0 A4 ^0 A } if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then& c8 r: q% s( u2 i2 v
if [ "$libfmodel" != "" ]; then 4 w, B' a% A" h) }/ ` [ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \ / \5 I( d2 h* |/ k9 ^ echo "Using $libfmodel ..." && \$ ?' B: a5 t3 o3 }
echo "Using $libfmodel ..." >> $EPIC_SCRIPT_MESSAGES_FILE# m8 f e' Y9 ?
if [ -f $rundir/libFuncModel$suffix ]; then + ~5 h% ^5 y6 z1 {) ?6 K rm $rundir/libFuncModel$suffix: A( U/ b% |- Q! P6 f/ f0 j
fi2 ]( I, }1 R5 ?* \- F7 n7 k
$ln_default $libfmodel $rundir & o5 ^) N4 H) p1 w6 H. c* m( J
fi- d# ]5 I; p' ?& ^8 ~9 z
if [ "$libmodel" != "" ]; then / A& U# Q* A4 |+ `; ~- o5 l( j [ "$libmodel" != "$epicdir/libModel$suffix" ] && \7 q3 F0 [8 T. ?: j
echo "Using $libmodel ..." && \- h$ g9 A* E' @ L# m: J
echo "Using $libmodel ..." >> $EPIC_SCRIPT_MESSAGES_FILE$ }! N& p3 d4 R- Z7 R5 q- R* {' D
if [ -f $rundir/libModel$suffix ]; then0 H. {1 [" s( U! M
rm $rundir/libModel$suffix - V! A s( r" L& b fi( f- z; q- X/ a* R
$ln_default $libmodel $rundir 7 H% u4 p2 u& Y: _ fi o$ s$ |5 X4 R4 [* _; i( B
fi ; F: e* d6 c" a5 u if [ "$libcustom" != "" ]; then 2 a; j6 |" Q3 p$ b3 E3 } [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \( I* v2 `2 S" Y. i, Q
echo "Using $libcustom ..."9 N$ E( M7 M {6 c; r" S
if [ -f $rundir/libCustom$suffix ]; then) u1 q: M' F3 b2 r' p
rm $rundir/libCustom$suffix ! v5 L, k: \+ N$ `: e% s/ B3 M fi 4 |4 M5 P H% f6 D $ln_default $libcustom $rundir 9 J4 S% }) e% R! m0 w( v% d fi ( |7 S3 C2 S: @' j3 d. F 4 }* E1 i& y. i5 x* P9 o2 V if [ "$flib" != "" -a "$flib" != " " ]; then/ ]: _0 k. I8 ]; ]
CMDLINE="$CMDLINE -fm_user_lib $flib"( |" ~8 _) R. d& ?$ }# y9 K
fi : y' k; K1 t5 y6 l6 |( O0 L' R/ I6 r, b
if [ "$libva" != "" ]; then) I5 `; m$ d+ o3 _) W+ M
if [ -f $rundir/libva$suffix ]; then ; M _2 P5 ~% K, H: T& | rm $rundir/libva$suffix & Z; V# }* I+ V6 ~: [6 m5 m0 t fi 5 _( Z, F$ ]$ v8 w9 |. S$ | $ln_default $libva $rundir ; @6 y5 W3 D- @5 K: a# I fi* a! m) B( z9 ]# l
+ i+ t, Q! M, O' j% W) Q1 ]" p
1 s/ e7 I/ c( O' |/ r& R* U # VCORE design library! x* V; A1 x$ |. M6 ^: {
if [ "$vlog_design" != "" ]; then; s0 z1 s" c/ \# n
$ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`7 p/ F* f4 e5 V1 ?
fi/ \6 q1 B8 r9 M; y, S0 m
( k( Y& Y7 z8 k7 K* O
if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then, A; W# ~3 f) K! O
EXTRA_CAPACITY=YES 3 G q5 \: |, T fi0 S9 c" g9 M9 c
# u) r' E9 i* B ?! G# i
[ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc"! d- Q- k0 X$ {
[ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc"7 l/ Q( B: h* }5 ~2 s; I
#Create temp file if dual process is on 8 w H1 h( l' {1 H5 z if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then2 [: f0 R! G( V% j3 }$ u
if [ "$EXTRA_CAPACITY" = "YES" ]; then5 ?+ o9 w' j9 J Z! g% y
touch $rundir/rpcidfile ; m, J( {+ o1 _7 \. U7 W fi . B0 A0 E5 U5 Y- Z. j p fi 6 H: v0 K( n' ~$ ?fi 2 _# x t* n& e1 N: Z0 ~( C, C : s% u2 [* {2 j9 a6 ?; Nrun_cmd()) I: c) m2 l4 V" b$ H
{( e6 G/ j, a R' Y
command=$1 ) ]5 F: f2 R7 a shift / y! i; x# M% A: l ( F* Q* ?' b+ r& h( Y$ J! i" G$ E if [ x"$VA_FILE" != x"" ] ; then * F% s- f K/ _. n1 w! N cmdline=$ARGV7 x u- K+ h( I2 {8 [% v$ ^
else P5 S7 X0 G) o7 N cmdline=$@ O" b. y m& s4 {1 y5 j
fi 4 @. t5 D& S& H5 t& i # J5 D' {! M6 h6 r1 S* j6 b; m debug=${DEBUGGER:+"$DEBUGGER $command"}; & b: _' [; B/ x! i 5 @- J8 q! _* f2 z0 h+ L( w # To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a % ]: A9 L- v! @7 l% `5 G$ } # so save-restore may work. 7 ?2 T' L4 I3 }& f! z4 ?. G/ R; q' T5 u" L setarchStr=# P- z# ]: S- ~0 s' T/ t- E5 a Q
cmd2run=`basename $command` / g& A ~7 u$ r; n( l) u if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then / \2 b8 ^9 N" s l$ O if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then) @* `# k( I8 l
setarchStr="setarch i386 -R " . x$ X; ^6 G f# i fi $ h" @; y U5 D* A+ B" V7 D W if [ "$EPIC_ARCH" = "linux" ]; then " c: E) I' }7 O/ f' o! ]- O setarchStr="setarch i386 -R "" o! f; m9 Z* J( S* p* ]
fi- I# Q5 }& ^. @3 V7 X8 X5 x
if [ "$EPIC_ARCH" = "amd64" ]; then 2 V+ \, f4 n7 M7 {1 A W setarchStr="setarch i686 -R " $ I4 ~% Z n/ I5 k5 z* Q fi: z7 ?. H0 ~& S ^) g0 h
if [ "$EPIC_ARCH" = "suse32" ]; then' F/ X0 `! f( S0 o2 f7 Q4 {+ Y
setarchStr="setarch_suse i386 -R " % R3 b' e6 X6 u' \" T- P" f fi ; @8 Z0 E ?+ g* M2 e if [ "$EPIC_ARCH" = "suse64" ]; then " T6 w) K/ H R, e) w% u6 z setarchStr="setarch_suse i686 -R " ! z$ R& J; F4 s fi) E% h4 f/ C9 b- \
fi# v0 o t; ?# L" C G$ _8 H z- [ I9 [
9 m7 ~, m0 p) c
ret_stat=0, ^! ^2 ^/ `) e: H% ]
if [ -x "$command" ]; then 3 v" ~4 J; c# ]! b. |( T8 n3 H if [ "$debug" ]; then3 | s$ i; _8 z/ ~2 J2 u
_debug_args_=$cmdline* E5 c3 q% b' c8 Z
. .epic-debug1 ]' Q# K$ J5 U+ H/ w! s( E2 u5 D
else - T* g6 j! t- r6 G) @7 A DEBUGGER=; export DEBUGGER2 u: s0 X" K0 @9 Q
$setarchStr $command $cmdline 5 y C. v: N/ {( Q& Z0 R fi * f6 s6 _! N5 g ret_stat=$?- f6 g2 {% a. n Z
else( ?$ ^4 i4 W3 x9 {1 M
echo "Corrupt installation, executable \"$1\" not found!"' ~, I. {0 \5 i1 t K) i+ [& D
ret_stat=1 3 O2 L9 F1 r# A( y& p k6 \ fi4 J [8 Y- f' a* \( N$ _
} 8 o2 P5 Z$ p2 d, L7 m. e: |) B/ T" i3 x# I% p$ H
# keep runing cmd if ctrl file exist ' m7 ~. m7 C" g! W: \8 D) I 9 v1 ^5 Q) t1 I4 l/ brun_loop() & [6 l2 b, R( a9 v{ 8 b6 W( x6 X, n9 L6 `; h command=$1 3 W+ @8 \2 s1 _, ^: P7 }. Q shift , ?$ Y( R( ?% V7 n8 M4 O+ H" e! e 2 ~! g8 Y: Z( K6 g7 F; }$ P if [ x"$VA_FILE" != x"" ] ; then0 ]* A ~* {/ \1 F- S6 `
cmdline=$ARGV! o0 S! g: ^1 t* i1 J% z4 Z* L! N
else : d: G1 {/ I* x- O0 @) O! q! c cmdline=$@9 F/ n" q$ @$ N& g( K' _
fi+ U7 Z( F! v, {" A
# a9 v- i, o. J! J6 Y* ?
while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do 4 L. c" B: e9 u2 G . $LOOP_CTRL_FILE$$ / z9 U) w* e; p2 Y run_cmd $command $cmdline -banner 2 % ^0 s# z4 h) D6 U: ? done;4 M$ D- l" |1 Y3 q
! v+ I# m; j/ k. C& |) x' ]4 K if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then % N% J; g9 ~5 {+ x rm -f $LOOP_CTRL_FILE$$ - m0 G% n2 E, l+ j9 } fi8 \2 {, `' a4 w4 S! a; P
} 1 E) N" a3 s7 \! M% F9 k8 f( l7 k8 F; y @
har_check_ret_stat()+ k$ H& d! J+ Q/ r: r, F% W
{ 7 G* x! t% p @8 f- G if [ $ret_stat -ne 0 ]; then , |* ]1 w, {/ }: S* | echo "Simulator returned with non-zero exit status. Stopping." 7 N S5 H( P% u exit 13 }( R, ^, v; P
fi4 M* b& e, y9 b% _8 u
} 2 ? F: P* N8 C3 X8 g$ ^ 0 r( s5 y! P1 N4 m4 s5 x$ C#4 L2 U1 k+ f: e. |) Y! [/ x8 c
# set stacksize and datasize limit O$ }9 I; V" R: G% j2 D- _# W#" U- g7 j' G) c/ H4 o/ c
, c$ z1 Q% [( ^& m+ cset_data_limit 3 f& }0 U( k0 x+ Cset_stack_limit 8 V6 x( P) a: g. A7 i; F& h4 e ! C) W: |. ~6 r$ _$ h#rm -f $LOOP_CTRL_FILE ?1 z+ E e$ }" K8 P7 O6 y5 ~- {/ Q) d
run_main()" L! u4 K' U. j! W0 Z+ k) v+ p
{( Y* k9 W6 `4 s+ U9 ^: T# f
if [ $is_special_har_run -eq 1 ]; then " e H7 v4 t# L! E6 f: P if [ "$har_ofile_prefix" = "" ]; then - m( J- _. K3 B echo "Wrapper bug. Notify Synopsys technical support."8 }' G: S0 }: @9 s6 u ~
exit 1; n8 S* o' N1 C* m" A- i
fi/ }3 b/ C0 w. G- _, F7 C' n
if [ "$har_hilo_file" = "" ]; then2 G9 [4 Y4 Z) c
# no user specified hi lo file - do both runs* A% I$ z q8 z7 p1 j
run_cmd $command $CMDLINE -har_one -har_setup 7 K" v7 }& s( b9 S/ W if [ $ret_stat -ne 126 ]; then $ K) K4 q+ n$ z& T/ H har_check_ret_stat $ y6 H% K- F( p3 G% J9 c/ O if [ -r $LOOP_CTRL_FILE$$ ]; then/ e) z6 [0 s5 x0 M1 @
run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl $ b. c( e/ t$ Y" o {) f# j rm -f ${har_ofile_prefix}.hl % u& l) N) a2 v$ P- c, G' e8 Z, b! w else7 b) P$ x/ @+ i* e0 ]
run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl ! a8 q- }) f5 _! i fi 8 C; g) q2 P3 \, B: B' x; p else 1 g; }9 r! w4 g) ]% t6 s ret_stat=0" Z+ u9 \( D6 W) [. l% ^: D. u
fi - h" }' i/ |5 V6 ~* R) o$ m else: H- b- Y# K0 k9 |/ N. f+ C0 d
# user gave a hi lo file name. {# H; A+ p& a8 u9 _/ y
if [ -f $har_hilo_file -a -s $har_hilo_file ]; then$ x! }1 t6 y: }0 V. N; Q
# file exists - use it - only do sim run " R9 z: h+ K( c8 s/ k run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file} 7 d' k( @# L+ y" s o+ C5 G run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file} o p+ P8 r% t l2 N4 Z X! O/ Q else) V6 I( _9 X3 |* G
# no such file - generate it - do both runs; m( v! n8 P1 r9 \* Q2 P
run_cmd $command $CMDLINE -har_one -har_fnf -har_setup / t: _" V2 N; j7 e' x; ~# q6 }+ L if [ $ret_stat -ne 126 ]; then3 T( ~) F @2 m. L7 w
har_check_ret_stat2 y, p" b$ L2 k s% d
if [ ! -f ${har_ofile_prefix}.hl ]; then f4 ?1 \: _+ T# D" D% z! k echo "No hi lo file generated after setup phase. " - | t& k T/ N9 R1 ~7 |8 f echo "Contact Synopsys technical support."8 q+ _3 e# K+ r. t& V Q( n0 v
exit 1 ( t# W7 }: h1 w" C4 _ else7 P/ W+ |$ T5 b! C# U% \1 c
if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then' K a7 |) M' P
mv ${har_ofile_prefix}.hl $har_hilo_file / F8 z4 J: l) k# w/ _$ q7 q fi , }9 m1 h1 h- U fi + v5 b! E6 S6 ` e) L4 o if [ -r $LOOP_CTRL_FILE$$ ]; then8 d/ r& {% G" i" ^: d7 e. i* o
run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file& y* L) q2 v: R& `/ v' a2 _
else. [# B3 z& J) ^4 q! K' c/ j3 I
run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file , }0 m9 H( M+ S9 B/ z fi ; p% D0 X0 C# `5 r9 j. \& ? else ' j3 `6 e$ _3 O7 A. F q
ret_stat=0 $ q' L' f7 c4 u D- P fi 8 A. K7 }) h' d: w ~ fi" z- ~( w* b B' h% a ^( |6 c
fi9 \4 @( y3 e- { `0 W( u
else 3 l6 H) J& E$ v& x# don't loop if -har_setup 2 z s- t5 u3 t: L/ a X/ r0 C1 G if [ $have_har_setup_flag -eq 1 ]; then9 @ f" D+ S3 r, h) q5 _
run_cmd $command $CMDLINE3 y4 X; v3 c4 ~% d, K; U
if [ -r $LOOP_CTRL_FILE$$ ]; then : q6 Z+ H& v( V: J1 m6 R rm -f $LOOP_CTRL_FILE$$& o9 K+ M' `- Q5 J) B
fi / p! T% G" @5 E6 r' Z7 d+ ^9 R else 6 E! I. W% f3 `6 L run_cmd $command $CMDLINE / i8 n9 `- g, G% C" i, { run_loop $command $CMDLINE; c Y0 x$ k1 i$ `
fi ! ?) i% h$ e, O/ j/ ?fi4 m3 e, a3 \4 t8 |9 ~
/ S% Y2 \' x( U" k% i5 j+ P
if [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then2 L4 x* j. d$ S
pwCreateErrDB -w $workDir -e $errFile 6 b& ]0 F1 v# F, v7 R ret_stat=$? 0 _! ~. s/ y$ }7 n2 Xfi( L- n7 p: [; z: S' J
} # Q" Y9 P& H! ^4 l$ T. S1 J$ [" L% ?" R) m! D% \" |
cleanup_alter()5 q- S3 S J+ g9 F; J3 I% K- B
{2 o! z6 Y! r" Q6 R
/bin/rm -f $ALTER_COUNT_FILE 1>&2 9 h; L% S/ Q$ } /bin/rm -f $ALTER_HK_FILE 1>&23 t0 G8 v' w/ t+ Y
}1 o7 Y6 G2 i- y3 o+ k! @/ X
" z* {. C, v2 o+ D* P# h#generate alter temp files based on pid/ ^' ?2 M& t: C( f/ B
ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$, q# Z+ U B6 f# D1 H- }) ~
if [ -f $ALTER_COUNT_FILE ]! R9 Z Y0 U6 s x( T* E
then * v b9 J. M: v: I2 \/ k
until [ ! -f $ALTER_COUNT_FILE ] 2 u4 T3 {+ r4 I3 y+ B7 r; |! D do+ M/ M. ^# H7 G% t' @
ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$6 a- D6 M( ~2 K0 c7 r
done }& U8 O5 j8 L' \' G
fi2 B# D! `5 q; j
export ALTER_COUNT_FILE % ^1 L$ `" r9 J. P2 Z8 u4 A# Y9 `( X4 V$ U E7 ?! g0 ]
ALTER_HK_FILE="$ALTER_HK_FILE"$$ 9 I0 T6 A; B1 t4 B2 Bif [ -f $ALTER_HK_FILE ] 7 p4 T% A4 P8 j" x6 Q9 `% w+ bthen ) P; b# i# O) }
until [ ! -f $ALTER_HK_FILE ] - E7 ^) W, ]) C% U1 x% W5 ? C Z do0 R) J, y( f. u, _2 f# l
ALTER_HK_FILE="$ALTER_HK_FILE"$$ + G% }7 x' j0 n, p6 e, r2 B done ( F: m+ k( B$ x6 j1 X" _fi) |- h% ^1 ~1 b/ s( M* q
export ALTER_HK_FILE " S- U% g8 E6 x$ M5 A/ { . W& r6 ?3 v5 _4 S. P, f#generate monte carlo related temp files based on pid ! w T0 C$ p$ `! O$ J# q) tcleanup_monte() * @- V; Y- W! C4 m* S" U7 k{. Q& o7 f6 a9 U% ^+ B" a
/bin/rm -f $MONTE_IMG_FILE 1>&22 Z1 T F q# j& q2 S% X; E
/bin/rm -f $MONTE_IMG_FILE.gz 1>&2 , f' `: `3 m& s/ _ /bin/rm -f $MONTE_COUNT_FILE 1>&2) n! a6 q0 O* Q+ _
/bin/rm -f $MONTE_CFG_FILE 1>&2& f) Z, M9 L1 F0 i, y! |4 k/ q2 W
} 4 g5 Z* L! |% l6 z$ n( m : \6 Y% f8 q8 X$ w+ G5 V2 jMONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$ : p. C+ n( W- F: Mif [ -f $MONTE_COUNT_FILE ] 6 D) m. _* }* Othen 5 q' J/ H: ^8 Q4 g9 E$ T until [ ! -f $MONTE_COUNT_FILE ] : o4 O4 K! L: r2 _" g! |6 M; I2 c do " O' Q+ T+ J, S! X/ ~- r3 _ MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$ 3 N5 r; R- c. Y; R done 1 y8 {2 a5 x7 D& ]! L% R% |fi0 A8 c4 z7 ]2 e( p( H
export MONTE_COUNT_FILE7 p% _$ U0 t0 }9 Y5 n; ~
- ]+ f0 ~* N, B6 y3 L! UMONTE_IMG_FILE="$MONTE_IMG_FILE"$$ / U% o1 @# ?! n# q6 W: D+ ?if [ -f $MONTE_IMG_FILE ]( \+ G; o4 d$ ~$ [
then " F I1 R- v9 |! E# y until [ ! -f $MONTE_IMG_FILE ]9 q% Q8 T' f4 m' f$ G
do % V) `8 X! J/ S C5 O% `7 x. P1 K6 u; ? MONTE_IMG_FILE="$MONTE_IMG_FILE"$$( x" `% N; ^, O( r$ R3 r( x5 D
done # l- J% @' v* ?, d; l4 F3 ofi0 X; ]4 Z# I; U3 Y I! r6 E
export MONTE_IMG_FILE ; r6 m) Q K: D% O( K 6 ?9 q; h3 n9 y$ D9 v& I" TMONTE_CFG_FILE="$MONTE_CFG_FILE"$$: J" \9 m! U( G: U4 B
if [ -f $MONTE_CFG_FILE ] 0 @3 g5 X0 R3 Dthen : j+ [- |. S, H" S until [ ! -f $MONTE_CFG_FILE ] 6 |7 u. a+ r( j i do 2 A. F0 B3 _; t. O3 D6 l) T MONTE_CFG_FILE="$MONTE_CFG_FILE"$$ % u! b7 i2 v8 d( Q1 W+ _ done& ~5 T/ {7 [2 W
fi5 o& a4 a* g5 {) e- @% O; b7 ]
) H o2 |! K/ a3 M9 J6 ]" r: W# main iteration E G% |# Z) X, x/ d, a& \
run_main - n& ~( k* B$ b7 h' }; m6 C4 {+ f, y. ?0 f
if [ $ret_stat -ne 0 ] * m5 G: C& M8 D0 E! u
then " x! u3 I& w; C* Y B s
cleanup_alter 5 v3 E1 R6 |% n8 f$ M2 @* V cleanup_monte ' c: L" l; q" d$ ~. L( [ Exit $ret_stat* ~1 S* l+ V5 Q
fi, I: `3 E) v, \" @
1 i+ W5 g% A. k% W# q0 A+ T. O#Alter related iterations0 f; k! @! V( \$ G4 M# U
% ]) u$ \8 _! @8 I7 {& ?1 O' ]iterations=0' ^7 H. P n+ k" h3 \% L j' b
count=0" G9 R% A v6 r
if test -s "$ALTER_COUNT_FILE" 7 Y- y G% L$ y2 w1 Y$ \0 Fthen8 } X) }" ~; B
if [ -r $ALTER_COUNT_FILE ]; then6 }1 X& \3 n9 r9 H$ o( i
exec 7< $ALTER_COUNT_FILE 7 m4 `0 d# R/ q( F( a4 q6 F/ t read iterations <&79 O' j- Y# ]3 Y1 z
fi, q0 V. z6 j$ }' G
fi( {# r" ^# u+ \5 l: w
) h8 z& k4 [" ?) W! F2 P* n, _: q
trap 'echo Program Interrupt; cleanup_alter; exit 1' 2 / u! c! G1 H- v+ Ewhile [ $count -lt $iterations ] - a! C8 r M8 x: b3 bdo) f8 k: ?3 d$ {
count=`expr $count + 1`5 v" p) J8 _) v+ g$ `) `
ALTER_COUNT=$count+ p. k" c# F- Q8 P# K
export ALTER_COUNT , i# |, @* j! U( L) V) `! f" E, c
run_main% E8 h/ @ J: _; T9 o
' ~: Q0 w1 Z! q& [
done $ B6 E& W! x- n5 W9 U) q* G, F* ~) f! |5 A# x. U- H% y" ?8 v
#Monte carlo related iterations " q+ m( `' q2 g9 H3 ?, q7 n. J6 W6 `8 [5 `9 U8 K9 }
monte_runtime_summary()+ W4 w% T) s4 Z: S
{: D- q8 A1 m' \+ z) b7 P8 S# t
keyword_1=real8 Y% o! C( I a- K# A7 g* ^( `
keyword_2=user/ x3 q% a& T% f% P" ?& h- O( p) H5 S
keyword_3=sys u7 N' R; V! W$ z6 l
ofile_prefix=nanosim : ^6 K- |; |' t) i' N' @8 L* ~( ]8 \/ @- C# _' t6 D
if [ ! -z "$o_option" ]; then" b8 \& }! ^; ]
logfile=${o_option}.log ( r; @" R/ u0 f, F; g else+ ^+ O4 K( J4 q6 K
logfile=${ofile_prefix}.log: X+ W' d. z+ n* j: p+ r5 s& Z
fi & z. D5 k% n9 A7 ~; S$ L+ W2 O3 _7 [ I J7 h) _3 e. I x" p- } if [ -f $logfile ]; then& f- \- ^! ?0 \5 Q R4 r$ P" c
echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile + _9 S. K3 Y& H3 A
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 # c6 V9 {: \- N# i& H4 c* j4 ?7 U! v fi 2 b& P% r, R- M1 e6 b- L0 Q} & }5 ?' g8 d: |) G& F/ g. R; j4 m . U2 u& z b* T6 [) R$ d7 Z+ y1 ^next_monte=0 4 X& A( `* o+ l% f* a" pcur_monte=0 9 v# N( T' J; L' [1 U0 X 6 o! E: U t) x! c3 g( v' wif test -s "$MONTE_COUNT_FILE" ! T j) x! `; k/ v& e- F) lthen0 E" J* J: d* j3 Q n
if [ -r $MONTE_COUNT_FILE ]; then + T* R% _. X( M: s exec 8< $MONTE_COUNT_FILE: l9 N* Z: {0 F: ^
read next_monte <&8 # l- }( s- h5 ^8 @* F$ I fi1 B# U. L" b1 S' P, \
fi 9 c1 N; b. U/ Y" o3 W1 W0 w. k 5 p- z3 v) \! V/ ~' xtrap 'echo Program Interrupt; cleanup_monte; exit 1' 2) G. R, [4 |5 b" ]( z* o# ?
while [ $next_monte -gt 0 -a $next_monte != $cur_monte ]& ~+ F" P) Z! j4 e6 f3 t) e, `
do [0 Y+ W6 ?, ?1 m* ^
NS_CURRENT_MONTE_COUNT=$next_monte% h$ V. k$ D" L/ L1 L8 c* W# U! g+ s
export NS_CURRENT_MONTE_COUNT2 _, O9 P+ u3 w% a7 s r! ]3 [
6 G- Y- l+ z" U1 p1 L
echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE 7 P! \; h1 U7 U2 d# f0 [% [1 ? CMDLINE="$CMDLINE -c $MONTE_CFG_FILE" - N. n9 |! y7 K" ?3 I7 |6 B run_main; S3 r& z/ o9 I3 @, e
& Y; s- o9 `% K! r& {, R cur_monte=$next_monte# U/ z$ x. v+ |) r9 H7 S5 s+ x
exec 8< $MONTE_COUNT_FILE! e( j0 D: o0 n1 L; g( _, u. [
read next_monte <&8. L) s. h a$ s' K* T5 U2 D& X- ?
done , N! E, O. P( V( t( o1 c) C) y" L- X U4 U
if [ -f $MONTE_COUNT_FILE ] " n# L2 o- ^8 Ithen% A' d: C' x( A. ]: Z3 o' S" o! A
monte_runtime_summary % Y4 V. B) W& R7 c, F6 afi+ U0 E2 T& l( g( C1 L. [
& b1 \9 Y9 M/ I1 M' G8 O, N
cleanup_alter/ r- J5 z" r( [* r! \2 A/ \0 F
cleanup_monte. s6 S! g% v1 w