Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

搜索
1 2 3 4
查看: 8050|回復: 1
打印 上一主題 下一主題

[問題求助] 版本ubuntu 11.10 軟體nanosim 無法執行錯誤?

[複製鏈接]
跳轉到指定樓層
1#
發表於 2012-5-6 13:58:13 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
10Chipcoin
各位大大好:
" k  }3 m% n: g, v                      小弟執行nanosim時,卻無法跑出視窗來,有個錯誤可是我不清楚該如何解決?問題如下
: K0 i: \2 Z0 W: {                      [: 113: 64: unexpected operator
. _  e- Z7 p# \/ G2 _/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim: 1: Syntax error: Unterminated quoted string( l; T; a( G5 F" |1 r
有大大遇過這方面的問題或是指導我方向去解決, 謝謝.
  o0 u) G; g- d! [, r我在猜可能是這個檔案內的文字需要修改 但不知道該如何修改?
% G! L6 c5 @: S6 F3 Q5 }: W% j以下為/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim 的檔案內容:& O8 Q( x! ^/ t* r
    #!/bin/sh4 U7 M/ E% ]; I* ~$ V2 N- T! t9 }  C3 L
#
. v1 e& z' P2 z# Copyright (C) 2001 Synopsys INC* e" y! @# G1 s7 q6 q1 H
# EPIC Dynamic Simulation Wrapper (DSW)
1 M! Y! ]4 v- h( G9 T#
$ H4 ]; H' }0 s' K1 Y3 b8 @9 jeval ${DBG_EPIC_WRAPPER:+"set -x"}: w8 ?* U! p1 m. }9 H  j+ p
; _2 m: B4 i: c; C
if [ "$EPIC_WRAPPER_DVLP" = "" ]; then8 s' C* g3 V6 U' Q9 k
    TEMP_ARCH="$SES_ARCH"
& Y9 z3 n9 S+ _5 ~7 {+ M( Velse. B! V& z  G' @* `4 k1 ^* y8 W6 {
    TEMP_ARCH="$EPIC_ARCH"
2 J5 r$ ^# y. X! |6 Vfi
+ @& u  n& c1 n$ h9 l: A' Y7 S" d2 c8 L/ A0 r3 G9 }, t  F9 a  ]
scan_for_hva_args()6 J1 E( @' C! i
{( P7 l) r) ]3 D1 _* W  t* U& f" w4 ^
  /bin/rm -f hva.init 1>&25 ?& j1 K/ v- N! `- W) S
  while [ $# -gt 0 ]; do
: Y% _) Y$ A% T: G) c7 S    case "$1" in& O- P6 D" n$ l$ I- [( H  Q
      -vaf)" n! ~' c4 k# \  T& x! J
           have_vaf_flag=1& t, v' n2 R0 g+ L$ Y% ?" A3 @
           have_va_flag=0! L) Q% O5 m1 v
           shift;6 `( i) i$ I$ _2 S% U7 U& @
           continue;
' m: S5 m. W) Y' w  O( `$ N# J6 E+ o        ;;+ l" L0 J( L; a) Q
      -va)3 ~3 ?$ ~. ?, r
           have_va_flag=1
) c# W7 I/ T! g, T           have_vaf_flag=0
) J" O, l" f& E6 X           shift;
+ Q2 R6 ~: G/ o/ R8 q7 B3 f% {           continue;
" O0 M- O8 x8 l& H7 P! I        ;;% g/ w+ ]" g6 K& }# Q! I
      -*)
; R' L: R3 f# ^( o           ARGV="$ARGV $1"
. K% W3 _9 w, h3 W, G           have_va_flag=0% {6 E9 A7 O1 [- q  _0 n
           have_vaf_flag=0
7 u0 T$ X/ o) @; t           shift;3 R7 \, o9 }) F+ a) O. y. a
           continue;. W5 S  ?7 O3 C" o
        ;;
3 X2 \# ~& m- i4 @9 A      *)
4 B; W) e5 h# T5 [* T; S6 {           if [ x"$have_va_flag" = x"1" ] ; then ; Z# a& h0 Y  [
              VA_FILE="$VA_FILE $1"
  S- E  I  S# _1 R! F( s           elif [ x"$have_vaf_flag" = x"1" ] ; then % F" V' c2 |5 p- r7 _8 Q5 B
              X="`cat $1 | sed -e '/\;/d;`"
5 u7 }$ _( y, g+ ~3 F3 T( M  m              for token in ${X}; do
0 h* x' w  w3 W$ [' E9 P: {0 W! W                 VA_FILE="$VA_FILE $token"
7 }# m: Q4 z; f3 m+ [: ?9 a: R              done ' I% I- Z# ^$ x0 C: v
           else/ d& E/ ?# d  {; @1 z
              ARGV="$ARGV $1"
) ?* B' H5 H" \1 ~! C* @+ X           fi
& a& ^  a* X/ J8 \% n. m           shift;/ S7 b1 u- C4 s2 O* |( Y
        ;;
. i) K# _% B! k+ E5 O7 J' Z    esac- Q0 D& G3 k) m9 f. |( w/ Q
  done
( W) F. K0 b' U& z4 n3 E9 P- Q; \2 Z( G% q
  if [ x"$VA_FILE" != x"" ] ; then
8 @1 s& v! B- o##     /bin/echo " xxx ARGV $ARGV"- S( |; b( H4 |, v9 ^
       /bin/echo "choose nanosim $ARGV ;" > hva.init
% h" u, ?/ r' y& S# B       echo vcs +ad=hva.init $VA_FILE -o simv
+ I# C8 V2 t# j/ r2 v       vcs +ad=hva.init $VA_FILE -o simv
+ B5 ]  ?! V  Y% }1 F. k. j8 o  u; {* c       exe_status=$?
% z- m0 k. @  K       if [ $exe_status != 100 ]; then. J0 r' c! J3 O/ @2 {6 j
          /bin/echo ""5 r- @0 @) J% Z- V6 l( c0 @; D- N
          /bin/echo "ERROR: Execution of vcs exited with code $exe_status"
# \& A- ?( u, E+ G. V7 n          /bin/echo "". ]1 P- K- L  q- R
          exit $exe_status
- b$ C1 ~" t' a0 D' H       fi
2 b0 L! }! a7 [: n       hva_files="-n simv.daidir/amsVD.ntl simv.daidir/amsWRAP.spi"
7 H3 ^& @" n- W) M3 U$ y       ARGV="$ARGV $hva_files", {# h8 H: ]: O# ]
  fi
5 h9 S+ E) t1 `0 l+ u+ J}
, u; W( l8 R+ g' x#-------------------------------------------------------------------------- p& g3 l! |  h
( @6 Y) F. v9 M$ S* g' x
cleanup()
) r4 u& k7 \' |1 p3 N. a' f  y/ f{
; K9 N/ A( S* D, U- x    if [ -d "$rundir" ]; then
  m" ~! z. v( t+ T2 u+ @        # On AIX, a .nfsXXX file is created if libModel.o is removed
3 L1 s) \1 q5 o1 S  a        # so .epicrun is not removed because directory is not empty.* D- \( d8 Q8 ?( J% L7 ~$ ?& M- {
        # Solution is to remove it again if the first rm failed
/ d5 b. E4 ?$ R+ d. B- J. n        # (rm -rf $rundir || rm -rf $rundir) 1> /dev/null 2>&1" H& j. v. E# _1 ^3 A7 |0 F
        if [ "$EXTRA_CAPACITY" = "YES" ]; then
" h3 L: N9 W+ F7 b3 c. x        chmod u+x $rundir/rpcidfile
9 G0 p1 f, ^  j8 f4 I3 s0 D) M) F        $rundir/rpcidfile7 W# S0 @% U9 K7 C
        rm $rundir/rpcidfile
( u' L( Z, R6 V5 T" C' F) f" T4 w        fi
2 X& f- b0 L! Q" D+ A" t4 Q0 {$ s4 Q        rm -rf $rundir
3 Z, C. Y' o! T
( ^3 g. e! a) ~& u4 Y8 n6 r7 w( B        #Due to NFS problem, we have to copy files needed to
% i9 t3 i) w; Q* U: A& ]/ n        #/tmp/<temporary directory>, then symlink's files
& o/ J; U% c! }+ D9 h, I% V7 J        #to the local temporary 'rundir'. This avoids the problem7 B! ~* L8 W+ V. v. K4 o
        #to remove 'rundir'& l; t8 q" ?$ ~( C
        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then+ o% |8 f( E! m1 N; j& S
          if [ -d "$tdir" ]; then
% j3 ^5 ?7 N: E1 j( c' p            rm -rf $tdir
' e2 W, [' L- m8 u$ l          fi
! U8 d' J) }7 p. c        fi1 ?9 O2 c# v6 Y2 B
    fi
: y  U2 @% u3 {) R; i* M    if [ ${exitstatus:-0} -eq $ld_err_code ]; then8 a; e; v2 _; ^- _# ~5 h
        [ "$has_model" = "YES" ] && rm -f $cwd/libModel$suffix2 g. n" J: D9 ^4 X1 p
        [ "$has_custom" = "YES" ] && rm -f $cwd/libCustom$suffix6 G: I  ^/ A" R4 g' ~
    fi5 `# a3 E. f% r3 s! \
    [ -f "$EPIC_SCRIPT_MESSAGES_FILE" ] && rm -f $EPIC_SCRIPT_MESSAGES_FILE 1>&2
( x& [' [; d! }; n1 `8 c2 |+ C4 X    exit ${exitstatus:-0}
  d" B1 k3 e/ N) B" i$ p: h" n7 t}
: b5 x0 M# ^8 `( E7 i/ b
2 v: V" g- d2 L7 S% jExit()8 L& N* i' Z/ L3 @  F7 `8 U. a
{: C, _% y. g! x3 R; R+ ?
    exitstatus=$1
% \5 l, v! \; E8 k2 i    exit $exitstatus5 p3 }, S7 Y# b/ I
}
  Y% e6 \! b. k; W% _& K- o; L% i# P3 \- w1 L
# get_epicrc filename keyword
7 V2 c' P$ q# C' w. g: B! M4 }% O; jget_epicrc()
; n) \( @5 G. ?" ]3 _$ l{' g9 X/ b7 B4 H8 t
    [ -f $1 ] || exit 0' U9 K. \. Q8 m: `3 v6 \2 a( M
    key="/^$cmd2:/{print \$3}"( q5 j8 H4 X: ^, X9 F
    awk -F":" "$key" $14 q. T0 m0 ^7 B! `% V" H- w" M
}: }6 C* j" u1 G3 _& B& i7 g

! y. y& i# ^1 n7 p: H7 D#* K- ?) d5 m: o
# set datasize limit to hardlimit, G  F1 U8 c& V' m5 A, U
#
8 @$ j/ B& t( x+ ]set_data_limit()  P5 C4 U$ t( x' Y# ]3 ]+ t
{
8 h* N# y, F1 K8 R, }2 s* Y, I    dbglimit=0
  |/ e, B: G) W; Y, I9 C    hardlimit=`ulimit -Hd`8 Z3 X- E) b5 z/ F7 x
    softlimit=`ulimit -d`
' I1 V5 W6 M, ]1 q7 d* M    desiredlimit=3500000
$ w$ `% G( G5 _/ h    hardisunlimited=06 ^; j* X! F! d: l" x; H
    softisunlimited=0
* v: a9 M1 V3 Q0 ]2 T5 R: o1 a    is64=0; Z2 O$ R. \3 X$ e  R
! v1 U3 S- B# R) J( l  y* \4 h
    case "$EPIC_ARCH" in
  L4 ]  O- s: k" N( _    *SUN*64)) b. z& r- `" W) Y! Q9 U% P# r
        is64=13 k9 U' G1 p* i3 N, i" z) G
        ;;
9 t8 Y+ S  q0 p' E% r: e# e/ a    amd64), {/ E5 T6 g3 g+ K5 {9 M/ D
        is64=11 C! ~! N) H5 C+ J, }5 ^
        ;;- e* B5 s8 }( U6 O
    x86sol64)
' ^2 K' G8 {/ t' E; T        is64=1
9 M0 i* s: x2 n3 T        ;;: N; d% A" u5 p5 j9 e- P6 B
    aix64)
! m0 e% w2 `4 A, C        is64=1
, o7 j. N6 E' ?4 P& ]        ;;8 t- p- B5 k, y! C, b: z5 ]1 }
    suse64)
7 a; J( I# x' d! K        is64=19 U% T, l6 I( }
        ;;
$ I1 C4 F/ Q+ F1 P    esac$ P9 X9 {- {7 @

/ o- j: Z0 d8 p8 q# d3 [/ ~    if [ $dbglimit -eq 1 ]; then
( w/ g$ s$ Q) n8 z        echo hard $hardlimit soft $softlimit
: x$ \8 j5 C7 X1 e( F; @, V    fi
$ j% d5 z  {' Q9 z- H9 Q% X3 C8 z
/ E  x# r4 M+ D* i; s3 D- r    if [ x$softlimit = "xunlimited" ]; then
9 }# R, C7 x5 |' p8 J        softisunlimited=1
$ F; d( n3 }3 x) j) C# _# m7 h    fi
* S: l7 p( c+ a% l: p" G4 a' S% g
    if [ x$hardlimit = "xunlimited" ]; then
: J3 t/ q2 {5 f8 i1 g# k+ u$ y        hardisunlimited=1
1 z/ E) i; v! m7 q    fi
  j- ]% K: a( O4 V* X& _6 z
8 E; {' I0 \. r3 k) Q    # 64 bit machine should have bigger than 4G8 K% g& l4 ^, G% g0 I( A
    if [ $is64 -eq 1 ]; then. K' M. K) E+ Q
        desiredlimit=50000006 l/ U; D# a0 A6 o) ^  P1 b+ K& J
    fi
% M! d. R& G# b1 n% G4 y# ^4 x
0 g; ^+ d1 p1 d& v* T( o    if [ $hardisunlimited -eq 0 ]; then. l5 @" l9 K% D% l/ @' Z. |
        if [ $hardlimit -lt $desiredlimit ]; then
6 K- {* S' ^% m" _+ w% m            echo "WARNING: datasize hard limit $hardlimit K is too small."7 Y( T3 ~# ]( b7 |
        fi
. B3 f/ [) W6 M( q: F    fi
; ?" f; S! ?' v# e: e5 `- E+ K( t' q5 G& L
    if [ $hardlimit != $softlimit ]; then7 u* y* _% d3 \' I6 s
        ulimit -Sd $hardlimit
$ z3 Y; h5 ~: ~1 j2 E#        echo "WARNING: datasize limit is set to `ulimit -Sd`"- j6 j% t& R! G1 Q  ^6 p- |
    fi
8 b# L( ?1 n: B3 J# R9 X, [& `% ?6 J) ]- _. t
    if [ $dbglimit -eq 1 ]; then# q+ k  o3 y# r
        echo datasize hard limit: `ulimit -Hd`
# l7 l" s0 k8 E* R1 e: _" E        echo datasize soft limit: `ulimit -d`; v2 b$ e% t; G5 o
    fi
1 X2 k% d: b3 h. ~( T% u- S}
+ s7 Z" {) r: A$ Q9 @. H3 o0 S* T  S) d; a+ `/ J! E4 D6 Z
#
" J" y) y" _' O" e' p( C7 r( L# set stacksize limit to desired limit7 n0 w; j/ L! V( D8 S7 `3 U( f$ s
#( W$ L! b0 u( N: |
set_stack_limit()' u( j. Y" s# K  d+ u0 O
{6 d5 `. ^9 _/ _3 T  W
    dbglimit=0
% B9 E7 B% t8 |# p    hardlimit=`ulimit -Hs`% F9 M" Y5 N* [" o/ x5 _) }7 u
    softlimit=`ulimit -s`
. C- ?: B9 i+ b% E9 P; f0 P    desiredlimit=60000) ?( X* @3 r8 [% @6 [
    hardisunlimited=0
( t: ?. Z* A, w9 k    softisunlimited=0
' Q1 Q. N; O3 \  p/ Y    is64=0# c! X! _. \& x1 b- b% k/ x! a
. D9 G* c- w# P
    case "$EPIC_ARCH" in- F( ]2 t/ T6 H: a1 m( Z- L
    *SUN*64)+ ^/ e% q$ w( v8 N: ~, X; n
        is64=1
# _6 U0 D: [" E. r- y        ;;4 {' J7 \" w- j) Q" E
    amd64)! v  ]- W8 S: d1 I2 s3 d% p* L2 e
        is64=1
  ~& v/ a/ S; @$ l' I: A5 A4 F        ;;
3 r5 ^" b* a- i. @    x86sol64)
$ J$ ]2 f) X) y; }- U        is64=1
1 S' D3 E$ s+ e: D! U        ;;
% x# C9 s' n, f5 w9 |    aix64)
* q1 t1 f) F' g0 }        is64=1
  v, A2 _0 x. _, x        ;;
8 j" s5 f* w6 B# ]- D& Z. y    suse64)
. n' x1 w' D1 _! z: F        is64=1% p; a+ b% H' e# L9 R' u
        ;;- z/ `  F0 ^+ o! w/ k3 y
    esac) K' i: m( N# f! H! m" p) K

( S! T" ~/ u4 X% |6 N& Z" mif [ "$EPIC_WRAPPER_DVLP" = "" ]; then
7 S1 O, w) y% ~- m5 n    if [ $is64 -eq 1 ]; then
6 x! B- M2 ^; D# Q3 m7 i# Z        desiredlimit=200000* ^5 c6 ]5 E/ g' x* T
    fi& L. F- d; C- ]6 }3 \2 Z" L! T* t
else0 j# L0 ?6 a1 s8 V# p3 t
    case "$EPIC_ARCH" in  U1 k' f  l, {# Z% c) d( M
    *SUN*64)2 X) i3 A! {3 C5 a* q! [" R
        desiredlimit=200000! f7 n& x7 ?( }  L
        ;;5 Y7 N2 [! O( M; e! Z
    esac
  T" e( l( N2 {( O8 f1 `fi
2 W7 H+ A! A7 C/ ^4 x; o& `; t' ~$ Q       
6 `6 n7 l1 {$ D5 u3 p& `# R  ~( m9 a, c    if [ $dbglimit -eq 1 ]; then
) p( T/ |2 u3 q        echo hard $hardlimit soft $softlimit
4 r: ~6 T/ D9 W" ]% J    fi
- d& I( v( ~$ @6 [5 Z  @
6 s1 G. F/ s, t' a0 W    #stacksize can not be unlimited, pick smaller number- |: x$ i1 ^1 D( ^

; k; e) `. R8 E1 }7 P    stacklimit=$desiredlimit
+ @, v- ]9 J6 X7 v+ Y7 m5 T+ @; c$ `
0 I) y6 K/ y1 E5 k' T1 Y; U    if [ x$hardlimit = "xunlimited" ]; then
; \6 G' `1 n! v( ?/ Q        hardisunlimited=1( \5 L8 s$ G7 Y# o! J/ v1 B
    fi- P1 o, N4 m0 }& l& ^) l3 f7 L+ d

' X" H/ j% A" X    if [ x$softlimit = "xunlimited" ]; then
) i& ]8 k9 x2 C9 |        softisunlimited=1
; T3 D8 [, c3 x% o2 ^7 I5 w: w' K    fi
7 q, u. X- S2 h
& ], b" f; }* v5 `+ G    if [ $hardisunlimited -eq 0 ]; then; E& t2 d& T' g9 E
        if [ $hardlimit -lt $desiredlimit ]; then# S8 V7 e1 \) c3 G- x" X: a
            echo "WARNING: stacksize hard limit $hardlimit K is too small."" E; V: Y; l) I& J
            desiredlimit=$hardlimit$ E7 F( R) q- o4 K. w
            stacklimit=$desiredlimit- }, |% B2 a" C: N" m
        fi& v5 h$ w; m6 {9 {" T
    fi
* ]3 ^( c' a  n: t" Z4 P+ J8 c6 }* n/ r8 q
    # desiredlimit is set to proper value (< hardlimit). g7 ~# Q& Q* E7 H% K7 t

: i) Z& J# S# r' m" F    if [ $softisunlimited -eq 0 ]; then9 p) G( w0 G3 j4 W
        if [ $softlimit -gt $desiredlimit ]; then+ u: O. O( }" ?& b
            stacklimit=$softlimit  {$ u! z3 t$ R
        fi
2 n% T$ C% k9 ?; D6 Z3 A) ^3 _9 l( B    fi
9 h2 R- A1 c5 a( Z8 P& u+ p
; x. S9 N  S- C; D' x/ C% c    if [ $softlimit != $stacklimit ]; then
. n9 a5 r3 f. |2 l7 d. N        ulimit -Ss $stacklimit
! o7 P4 _4 Q( I# d2 i, K. [#        echo "WARNING: stacksize limit is set to `ulimit -Ss`"
5 t7 w  M7 Y) E' {5 d  _# M7 }" \" U    fi1 e$ R! ^1 }% V- P" M
; h5 Y0 r/ D( ^+ ]* e0 f
    if [ $dbglimit -eq 1 ]; then
/ N1 @- Q* V- @; [        echo stacksize hard limit: `ulimit -Hs`
" J) h1 ]2 `$ R  D. a8 t        echo stackize soft limit: `ulimit -s`
* K; O  w- o# b    fi+ ?! U/ ^& j! D5 h1 k4 }9 e# R
}
( @9 V' p* W, f1 a4 h2 O; w$ `' K( \# m5 X6 J' F
open_epicscriptmessages(): `8 @- P8 h3 R0 K) J% r2 w7 q
{
) T% h; r7 A: E* a#generate  temp ".epicscriptmessages" file based on pid0 v" `1 A! K! \: [" y
EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
4 |& I1 f# c! _7 w5 {$ `if [ -f $EPIC_SCRIPT_MESSAGES_FILE ]
) z- S4 M. y' I+ {then
  @6 [, N0 s2 I1 j" c; w  until [ ! -f $EPIC_SCRIPT_MESSAGES_FILE ]! J. i4 N+ `: L& K! g9 c
  do$ G& T8 n6 v1 }1 ^% A! Z
    EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
. o' m  y7 L( K3 i) w9 c4 q  done
2 {! U1 f3 e5 n8 p2 i2 G9 I) Efi
) @( {4 i) S$ Z( B# {& q3 `1 x* ]6 Z% ~9 o
export EPIC_SCRIPT_MESSAGES_FILE
% t0 a) r7 \) M  [* g- |}
2 g! X7 M7 Y% c. n+ j, D$ p3 `4 S. v. \* \  O

+ C, K6 b! A3 X+ y+ `# Kcmdname=`basename $0`
' c6 I6 @' X* o0 l( S3 {postgres="n"
' L0 h3 {0 t- m- u. C  E2 Wostore="n"
* P  R: {1 P" hgui="n"# [) a0 E9 U6 n1 l+ `5 y
databaseOn="n"
+ C/ P) c! k8 r: H; f" Zf_next=0
. Q+ ^4 e& _- S) R' i% B6 bf_option=""
- M2 B' o; s+ L* U. T% @# Go_next=0
; q+ R: y) T2 _& \2 h, Yo_option=""2 t0 n6 e/ |* h4 w" ^7 ~8 O8 w
workDir=""0 ]( p; C% a; X
workDir_next=02 Q; m/ S' |5 }4 @, `4 W+ f" _
errFile="powrmill.err"- E; g* z2 X1 s7 r4 `' U
win32flags=""
8 H( p: Y+ R. N4 @; uln_default="ln -s"
7 ?5 {0 c) j+ Q6 `
4 R% G5 U0 v2 C" Jhar_hilo_file=""
6 M! V. R# `- Hhave_har_flag=0  K, @  F3 T# N4 A% Y
have_har_setup_flag=0
  K) E/ M( P( \2 J; _/ iis_special_har_run=0' \- G- y: x& |
har_ofile_prefix=""- L5 Y3 k, c# X& d- f1 P1 s

) J( Q2 x; p0 J$ |8 a+ nhave_va_flag=0" i2 Y! R$ C* e- S- v
have_vaf_flag=0
$ e5 w6 q5 s5 [6 p, k, WVAF_FILE=""
6 m' h6 {4 L% D( R& P* E, _: `VA_FILE=""! P  C- }* ~9 S7 G, c
ARGV=""# A0 H* B4 f3 j' w- d" o" }

  U/ L7 X0 G7 r* DORIGINAL_COMMAND_LINE=
, I5 B$ K( o# b4 u5 y7 S3 NLOOP_CTRL_FILE=".ns_ba_env"3 a& }) f( y$ n% q( u5 x3 |
ALTER_HK_FILE=".alter_hkf"8 a: v7 h% g$ a) k  q& G2 t3 g
ALTER_COUNT_FILE=".alter_count"
5 g( I% C! H2 x$ H- V+ K! ^MONTE_IMG_FILE=".monte_img_f"$ ?0 D; v1 A0 A, X4 r+ E3 g9 b
MONTE_COUNT_FILE=".monte_count"
  H5 e2 X- W7 Z2 l5 }MONTE_CFG_FILE=".monte_cfg"
+ }! |$ y1 T" t$ c; _. {0 v8 |EPIC_SCRIPT_MESSAGES_FILE=".epicscriptmessages"
$ e8 Y2 R& _& c8 ?
( X: d5 o) ^, {3 w( vopen_epicscriptmessages $@: ~# N9 ?4 @% _( V
) Y4 A2 ]4 ^" v3 K- `/ P- e
scan_for_hva_args $@
# t5 K1 u! h# s0 v% Q, X$ k: i1 w) H% A; s
scan_for_har_args()! g( z/ K& V* T- L
{- m- R* o. C  ]" o% [  z3 _% q
  while [ $# -gt 0 ]; do. T; t7 N4 Z( {3 S) L; [
    case "$1" in
1 X  N3 e) ]) Q1 z      -har)
8 }9 P" c5 T+ y+ }# X           have_har_flag=1
6 y- h3 \) h9 s$ Z           [ $# -gt 0 ] && shift1 [/ ?1 K: I8 g) }  i9 O
           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then/ B! x9 |1 x8 N1 M! y8 e. o
             har_hilo_file=$1& a1 c7 k7 y' Y7 @' k5 ~4 T
             shift8 E6 N; ], y% M8 }. {) K6 O5 l/ _0 {
           fi
: s7 E1 X0 O7 d; @% f           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then
. ^9 t- c7 j+ _/ t% {  L0 y6 C             echo "Too many arguments to -har flag. Only one hilo file allowed."
3 k9 R% Y1 M6 Z7 ?$ ^$ p' p             exit 1+ z+ n0 \2 E) J* r, y! N6 s1 x* P2 A
           fi$ }* S! {( |+ ?' Q  w
           break1 r' o* |- N% ?& ]: h
        ;;
; ^9 `4 L6 a7 d5 Y8 v) ]! y, x# V0 T5 K      -har_setup)  c/ J8 P% g3 B! P; E
           have_har_setup_flag=1) ]4 a3 n6 c$ r5 |; I! v; R9 e: ]& V* @
           break
! w! G& c" r( K) ]& ]        ;;0 s( q6 C' J* Y; p: z. n: T
      *)+ {6 W' A4 u2 M! F
        shift5 M' b) e8 t; r* |9 H9 [6 P, t
        ;;
6 b7 q) E3 g) ~! D! |    esac+ i8 [" y" I0 _
  done
0 H) M% L1 l  S, T7 R}! [  {; K1 j" x7 j8 L. t$ V9 B

, A, m" E0 d( W6 L! V% v0 y+ cscan_for_har_args $@
" K0 ]4 p& [3 {. e; T- F  v' n7 e3 v- E8 P  y1 X. ^
for argv in $@* d7 i. C# c6 h( x. H2 ?
do8 R' S8 v! N/ W" e! ~0 E
   ORIGINAL_COMMAND_LINE="$ORIGINAL_COMMAND_LINE $argv"
: T& i# j1 d1 b' \8 c% F- p    if [ $argv = "-gadb" ]; then
+ k! W$ Z( z0 c7 m# k        databaseOn="y") k& o8 z/ k  V+ c0 \
        workDir_next=1
6 e& Z4 S2 o6 z8 r2 b    elif [ $workDir_next -eq 1 ]; then1 k% z* H1 g8 ~9 D0 _6 Z
        workDir=$argv
6 M- S, N3 E3 r" A+ V# d, P6 |# x& N        workDir_next=0
4 V% ]8 q+ ^* i5 {3 L) C    elif [ $argv = "-ga" ]; then
( Q9 H7 z8 I- g0 f+ ~' F        gui="y"
) d7 g( F8 ~3 ?3 N9 y5 {    elif [ $argv = "-f" ]; then* V  E3 o/ ?5 v) X: W) R% R6 m0 V
        f_next=1
3 [- y" j3 f5 i5 H6 A# ^4 L6 R    elif [ $f_next -eq 1 ]; then
0 R: D$ m, K- k  C        f_option=$argv
: O+ ]" Q& k) r) f4 H: Z5 |% }        f_next=0
+ [4 D( ?" N- ^2 A# T7 E, n    elif [ $argv = "-o" ]; then
5 s0 Q' B" G& l- W        o_next=13 {1 i$ H" a! u# v4 {0 U
    elif [ $o_next -eq 1 ]; then: V# S& r1 E# M  E
        o_option=$argv
9 Z. r" @0 @4 X2 C* E: F; d& q        o_next=05 m' S0 L& h. `
    fi/ }) y5 g6 ^; ~6 t
done  N0 P$ \( v  a  I: |
echo "Command line options: $ORIGINAL_COMMAND_LINE" >  $EPIC_SCRIPT_MESSAGES_FILE
- K( K0 V2 R  E1 ~$ O5 m
/ }8 a; S- o. I' n) o. t: u- v  jif [ $databaseOn = "y" -o $gui = "y" ]; then
9 |- m! F& y' t- R% n* d- Q  if [ $cmdname = "pathmill" ]; then& i/ u9 Z. m3 j( p# T# r
    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5"  -o "$EPIC_ARCH" = "SUN4_SUNOS_5_64" ]; then+ A% a" Z2 d+ m3 _4 p# m  q7 v' x# b
         ostore="y"
. {, d5 E5 u. b" G# F         postgres="n"/ Z: F+ }7 Q+ u  \" s9 C
     else
- @: c. Y) h# I6 ^7 _& N& i8 U        echo "athmill GUI is supported on Solaris platforms only" 1>&2
+ B9 j) G% ^/ C6 k9 e/ A- I        exit* D3 |+ r# Q* L% Z  B
     fi
! x1 j% h: S( L9 d$ j- o  else
; C4 d" l3 m0 y" ?    postgres="y"
+ t! T- t( {  V7 }0 X6 `, Y         ostore="n"' s: ^6 f4 t; ]. P* S
  fi
2 `* |( X7 j2 K8 x7 f9 ]( n& W0 |0 U, qfi
7 P8 q# C. B: k& b( h2 @# H# @: _- j9 Z% F. a- c3 l
if [ $gui = "y" ]; then
9 G# m# e- p, Y  `- K2 M  s: _    if [ $cmdname = "powrmill" ]; then
, z* B/ |: H. V" ?# D3 j        pwga $@
; J0 u1 g6 G5 s( g0 O0 p        exit/ Z' Q# n( M9 @
    fi' f5 C/ Z% \+ x: g5 ~

+ S+ Q! z; Z/ n  j- i) d/ r    if [ $cmdname = "pathmill" ]; then5 [8 G" }" V$ V/ P
        if [ $ostore = "y" ]; then5 J8 `0 ^+ d/ g" t5 {
           ./pathfinder $@; R% @9 _( i5 }6 C
           exit: ]5 q5 c. I, k3 j  I
        elif [ $postgres = "y" ]; then
( X/ S7 g! p. V. }2 `7 e           pmga $@
8 \) r! x. X, S7 H6 p           exit$ c- H' R7 t1 z# {1 I; X
        fi6 _5 i5 l+ z7 w4 I
    fi
4 C! E8 C  l# A% c! e# ^- k: rfi. F4 X) |# s7 c2 u/ g

# {" U$ n4 }" z5 Bif [ $databaseOn = "y" ]; then
  K1 j- }5 a  e5 W   if [ $ostore = "y" ]; then1 v4 B" J0 o1 M/ d2 n
      if [ -z "$workDir" ]; then
8 t4 x2 \7 B0 n9 A: m2 c         echo "Error: Missing argument for -gadb option"
9 C  j8 ?& w; J         Exit 1$ i9 u" i+ o' t
      fi
) W0 m  r! K" P6 h   fi6 ]: F8 K3 f5 u. q3 Z
   if [ $postgres = "y" ]; then
) S9 _9 Y+ M" y3 l/ h! s4 y      if [ -z "$workDir" ]; then6 F* @( g; [& V* y1 K
         echo "Error: Missing argument for -gadb option"
1 S6 q6 u4 [' S         Exit 1. j8 z4 T/ d, N6 Q, ~
      fi% P3 r- V1 a$ t" I
   fi) f; D; B7 J, E8 N: ~* `9 h  o
fi0 q0 A* f: R& d( D8 \# q. L6 s

6 o; D+ K) Y- r1 \0 ~5 yif [ $postgres = "y" ]; then
6 l! I; Z5 W- T1 F( v
. L7 i; m0 a' d+ w9 h8 G    if [ -r $EPIC_BIN/scripts/gui-init ]; then
5 @& ?/ b- a8 p1 J        . $EPIC_BIN/scripts/gui-init; b$ `% U' S9 R4 t/ f
    elif [ -r $SES_ROOT/bin/scripts/gui-init ]; then9 {) z/ Z5 G, l+ G! y$ S" m: l; Z
        . $SES_ROOT/bin/scripts/gui-init
1 d& ]6 [2 {+ i/ f- A2 U    else6 n1 ^* ]/ S! Y: m
        echo " ** Installation in \"$EPIC_HOME\" has been corrupted!" 1>&2
: w% v9 N+ X- `; Q        echo " file bin/scripts/gui-init is missing." 1>&2
  a. [) ~& v+ ]) A1 i6 B6 {2 Y+ k: R    fi* M6 N; M3 P" X; K. C
- [; m3 _& K( s2 p# Z
    workfile -tool $cmdname $@4 @, w. B  A% Q! g1 c
fi- o# ~8 _* d0 ^: z. [, J$ l$ ]
0 A# ], H- A9 G( ?" a, w
if [ ! -z "$o_option" ]; then
" @( ]9 c2 \( @    errFile=${o_option}.err7 X9 q2 L; X% I7 {
elif [ ! -z "$f_option" ]; then
- f# P5 U* T$ l, D    if [ -d $f_option ]; then* D' @/ K4 i$ W" [0 K' ~+ z
        errFile=${f_option}/powrmill.err
& y2 H" _/ K& D# `3 ~2 X" A    else errFile=${f_option}.err
# O3 k2 g5 t; @& R9 K    fi& a: s% `6 y" L
fi
/ A2 r+ c( p+ C: Y3 G4 N$ c3 m8 F! D- ]! f4 \4 l- c8 F

7 s0 j% ]$ {9 J, ^+ tif [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
1 O# M5 M# w& d& q+ A- {( b  rundir=.epicrun& P; c8 E8 U; e2 U" g
else
  s; x# ~$ j$ x9 Z  rundir=.epicrun$$" `, q7 D2 ?, A2 G: q& h6 {- v# `' P
fi
& H5 r1 q# c+ M' B7 D% I, y8 A
; {7 {7 N  G3 {. C6 hlibpath="$rundir${EPIC_DLIM}$EPIC_DIR"5 p) s7 p6 ~, D0 ?; C
7 g. z) M" D% _  ^6 C: @
cwd=`pwd -P`8 Z) V( l/ N( n$ L" w: s: G
if [ $cmdname = "acehdl_w" ]; then
9 b5 d1 w/ y8 Q2 X+ L5 ?8 @: c  cmd=`basename $0 .sun`
6 \2 l' M# m* r" m: K! `6 e  cmd=`basename $cmd _w`( G) ^- O7 l; @4 j2 d
else% y/ R- ^# L5 W, D2 ~- t* L
  cmd=`basename $0 .sun`
2 y. x6 X4 |. x& V$ }fi
( z  q: G5 \( H  s! Q  t8 o/ H. n) M. P- S' B  ~
command="$EPIC_EXEC/$cmd$EPIC_EXEX"$ `' u/ b1 z/ n7 L2 A* p
[ ! -x "$command" ] && echo "$cmd: not installed!" 1>&2 && exit 1
) t( j6 K+ X. O5 j% e: ?
$ j+ L; j) c& \) r9 W5 G' h9 V# buildmod extracts -u/-fm options and calls genepiclib
4 H- T  }9 e- f4 D* y# It also set the remaining options to variable CMDLINE
; c$ m8 j# j+ d" h" i0 N7 e0 [# look up in .epicrc for -fm & -FM parameters
5 ^4 j2 O" m4 |4 J! A2 l" \; b2 ^7 `/ g: I) N5 L3 N/ p
fmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`"
; G5 c2 u4 q1 f, f[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`"
- q5 C9 a# a$ P" t. ][ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`"' P' ~$ d; v. I" g- a* y- n3 M
2 X/ ?1 u' v' {2 T/ J) o4 I
FMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`"
! I( T) ^+ {+ h3 S4 B[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`"8 ^" U+ E! m3 _" P+ z
[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`"4 I, i: o( P8 v  [# w! j

) k& Y: ]2 a! f/ y: `4 F, l6 Wif [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then
+ h  x8 c. |/ }" o& E2 U    # note that the buildmod script will set the CMDLINE variable
/ U/ d: F% D, @    . $EPIC_BIN/scripts/buildmod
0 c" U: B: Y4 q( W  ^. t! K* a& o
    #echo "This is the value of cmdline=$CMDLINE"/ w7 d* {& b; ~' h. E9 n; X
    #exit 09 K) Y5 y. [( Z/ v" t9 J
" X3 L: K& n& u7 l/ x" }/ B$ |, Y9 Z6 \
    # if a new timemill/powrmill/pathmill built, run the new one8 C2 O( M# z6 `) E+ I# |$ N( H
    [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX": O% P" k) X0 \  f
fi
1 O( g/ ^9 J7 j) g/ p7 {
( X: ~2 z- f: r+ g2 tif [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then5 ]) \+ k* g2 V4 P( x
  if [ $have_har_flag -eq 1 ]; then$ M. k0 F3 e* I2 k  W  }
    is_special_har_run=19 |, L. Z$ K! Q9 m0 p" I
    if [ "$o_option" = "" ]; then
# _/ I/ ?( }* |/ o2 ]      case $cmd in$ \1 o3 y9 u+ @5 [8 X: c4 ?( Y
        timemill)5 G7 j9 N. e: e) p
          har_ofile_prefix=timemill
9 y" m& S& I1 i- U9 l( e          ;;
3 S, H+ w7 m* B& a0 F        powrmill)
6 g% Z& o. K: o: F1 X- v+ m/ |          har_ofile_prefix=powrmill
/ U$ h; F8 c; }% l- \          ;;' F0 v( L1 \/ h# s: \
        nanosim)4 S" K4 B% B2 N& D, z* t* e
          har_ofile_prefix=nanosim5 {5 q% T0 N4 v$ A. H, J" Q
          ;;2 {( }/ J; ^4 Y# f
      esac
; I3 e6 m( g8 k* ?% k/ m    else
  x% v( e5 K+ p$ b4 z6 E9 \      har_ofile_prefix=$o_option
3 @0 b! N1 \+ a" N# v9 u    fi
. C% K: ^" E  O" j2 @7 i! j1 p fi
; {. m( `- W8 T8 j$ O$ dfi
8 y" Z  S' U1 K! A+ f4 W
. E* p9 l9 m6 @- H# Call Double precision version of the product if -D
$ ~, }: U$ r# o" o. a& |# or simulation time > 1,000,000 ns.
+ p5 F( N( T% M& p, R  Tif [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then
3 X/ D1 {9 U+ F6 W# @, E9 ~1 _/ }; O. V, u/ a/ x0 ]8 S! `
  # Now the binary always has the ACE feature  [+ i1 N9 W8 j2 I/ H
  USE_ACE=YES: A& Y2 a4 U3 f- o# m: C% O
& H, x! z; \5 q! D) q* D  W  ^6 B
  HAVE_DP=NO
1 a5 c) _5 z% [! I  EXTRA_CAPACITY=NO( Z7 ?' u2 q4 \$ O3 w
  DB_REAL=${FORCE_DB_REAL:-"0"}# v) r, @3 z, j; ~
3 X9 u/ O8 I3 R% @: k
  # Enhance for ACE ease of use) H8 N4 n/ b! n* F; f3 n
  # If no command line option or only a -T option, do:
$ L4 H4 f. ?' h6 W2 z  #   1. set -A option
8 ?' r. F8 j* N- q2 T# {1 w, Z  #   2. assume input file to be hspice
& x+ r5 ~9 A+ j- Z! H  #   3. set -o to input file prefix+ E" J" d5 Q: e, h1 K+ A
  #   4. set -z to input file prefix
; ~: S0 Z  A% b$ B" S  #   5. set -c to default config file
! N8 o3 r8 H4 J; m0 y; J5 V4 ?+ H  netlist=""
* {: y) V" P* x  minusT=NO
5 \( P  T5 m# _1 e1 Z; Q% I  useStdCmdOpt=0
) u! B+ y3 K5 j  prefix=""
2 ]( M- _  `6 o, q. V  circuitType=""
; c2 j: F! f( I  for opt in $CMDLINE. h! _+ [- S( g& T4 |
  do5 J  s9 T1 ^3 s0 Y8 ]# s+ ?5 N" c
    case "$opt" in # i0 W0 m/ X+ f2 V) Y7 F3 `4 _
      -T)
( {) _; `3 ~7 y% i        minusT=YES
% R% k' R4 h7 {( E. z: p        ;;
/ a1 V+ a( X3 u. f      -*)
9 |8 t# q: n0 @) r* _: H        # using standard powrmill command line
% ?& m2 u% Q; j9 t; [& H  E$ ?3 R        useStdCmdOpt=1% V% C1 G7 k( i
        break
) p7 Z" {2 j$ E  q  ^0 k        ;;
3 y; ^3 u1 B, o! F- U: L9 ]      *)2 A3 b, ~1 C0 |* w/ \
       if [ "$minusT" = "YES" ]; then' B3 u7 U/ s% U+ P' J9 x
         circuitType=$opt
0 p, i, s9 b2 `# P3 J" c         minusT=NO  # reset flag1 k$ c5 F3 c& V- }, ]2 _
       else   v$ P* }3 K! b1 D' Y  u
         if [ "$netlist" = "" ]; then
' k4 j3 S- L: n9 X6 d3 Q( B7 [) Z           prefix=`basename $opt`
7 D# J9 Y0 Z* `3 u3 Z           prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix`
- m, F$ C5 x2 ]" Y: A; G         fi
$ M7 R$ W! H. X0 }9 t         netlist="$netlist $opt"9 }* |4 O2 [+ H: t* m
       fi
4 P; ~* L) N! d: D       ;;4 u. m8 [6 C0 b  Z
    esac
9 g7 k. x3 r7 W  ~; R. e6 i  done
# [0 t4 g0 B; E5 f3 R7 a
0 F) }4 K7 s% S. @% W& u
8 E, w/ g+ ?! b9 U. v6 a( x  if [ $useStdCmdOpt -eq 1 ]; then, a, w. G* a% h* T
    # use standard powrmill/timemill command option3 v; J$ Q. l1 A! a4 I. o( E( H
    for opt in $CMDLINE
& {; Z! t0 H  a0 C" T+ f    do
' S6 F+ c: f; f" ?" ^' L      case "$opt" in
2 D' _6 Y5 O7 f' u6 \) @' L        -A)5 I. f3 Q. r3 S" L2 n0 B6 K$ X4 D! W) d
            DB_REAL=17 Q3 j; I7 C! e: J/ |8 {- q8 s/ c0 P
            ;;4 f, y/ y, V0 }
      esac5 R) U, |1 [. D& G
    done
( L0 X7 D# W; T    if [ "$netlist" != "" ]; then8 j# _4 j/ ~4 ~" O! K
      CMDLINE="-nspice $CMDLINE"8 F2 S+ q) D# e% }$ k" }2 S! ?0 K
    fi
; k# }, D; t" F" S" B& ]  else: V$ J& r3 F% k1 c
    if [ "$netlist" != "" ]; then
$ t6 |7 o& D$ s      EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"}
+ ]2 a% |/ g" W0 ^& ]- D4 Q      # construct new command option
( v2 l/ `4 l1 x" x( p) w+ Z      if [ -f $cmd.ini  -a  "$circuitType" = "" ]; then
5 N3 l& U7 v1 W        CMDLINE="-nspice $cmd.ini $netlist") a$ H- q: n' w4 }" f/ `
      else
: h6 f* h8 A0 l* P' t9 x        if [ "$circuitType" = "" ]; then9 r! m$ L$ D/ x! z; h
          circuitType="msana"
! ^4 l; n9 o. C% a7 z7 I        fi9 t2 P* ?4 s) W1 n% d
        CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg"
3 l8 j5 A; B: ]* s$ M      fi
4 ^% @( B: U  f0 A# c+ T/ L      CMDLINE="$CMDLINE -A -o $prefix"+ d! v, b/ a" e1 @" J
      DB_REAL=1
2 V' H. }, _. p( d      echo $cmd $CMDLINE
; w# p! F7 O9 |    fi' }2 P7 ^  f6 `5 u5 c
  fi
' V- h: B1 {1 u& f2 Jfi # cmd is timemill or powrmill or nanosim or railmill or pwarc
8 ?6 {& |& E+ Y5 r6 M
' R  B  H5 ]& |5 R0 y[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a"* A7 m; e" ^% ~: a0 i% t: g
[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a"& I1 U5 `( @& w( P' ]! V! \- ?) }
[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v"
! K& s3 Y8 T! j6 X7 P2 Y- m# U/ g8 f% k; K  d1 w" U0 a, w$ h4 T. W
if [ "$__engine_wrapper_called__" != "Indeed" ]; then* h6 B: ^1 ~+ P, W% b# x/ p' `
    __engine_wrapper_called__=Indeed' P' y/ x- y4 i2 _) p
    if [ "$cmd" != "amps" ]; then
7 y2 E  c1 J+ a  P0 J9 E        export __engine_wrapper_called__
$ c8 m. J% a9 e% ]2 Q    fi
0 R. y3 K" e# a
8 t/ g9 U' o' F$ }7 O3 _9 a4 K    trap "cleanup" 0
$ M) o, W; q' e6 U$ N& t( h: p7 c    trap "" 2
2 q& H0 V! r  l' z) f/ E8 \7 |( a1 ]: ?5 D' O6 ?% ]% f5 ~- r0 w( Z# R
    [ -d "$rundir" ] && rm -fr $rundir8 }  c3 v. f5 N
    [ -d "$rundir" ] || mkdir $rundir
7 A+ h( y) K( J4 s9 s* H9 z4 k; a' T- k6 G# N) m' ~4 y* `
    case "$EPIC_ARCH" in9 l8 m6 K2 {& w% y& f3 P
    *SUN*64)   
- L! a: X& b2 F- z% s        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
9 m: _5 q: ~9 t; S$ i( U( C8 f        export LD_LIBRARY_PATH* L. n, I  K; W& I9 P
        suffix=.so
! @5 Y, n3 V, R        ld_err_code=127
) M! p4 u  O* M$ _. L. |  \  w        ;;
8 ]3 c( ~$ L4 [    *SUN*4)   6 J* z' H" {/ C& y! ^
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
* M. w( F4 \& Y6 ?, H7 `        export LD_LIBRARY_PATH
, m, K% G4 f/ A, d- ]        suffix=.so.1.0/ C$ |/ F  y0 Z$ J+ O
        ld_err_code=127
% k+ }3 f) h0 {        ;;
0 n+ I- M4 Z5 k    *SUN*5)   . F7 [( V& R) h9 \7 q" F
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"2 F+ T- e, [. j7 k
        export LD_LIBRARY_PATH8 H5 ^# f* V- }6 K
        suffix=.so
+ H9 b* v' d2 S' D7 G# }        ld_err_code=127: s# m* e  Y" }0 A
        ;;
3 t2 E7 W' q- m! g+ ~, l9 \    x86sol*)   ! f+ o. O+ ^9 _" J2 U% ?. \: X
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
# e  e8 p# q  H  b        export LD_LIBRARY_PATH
. F- k7 F  [3 T6 B0 N/ B3 t9 `$ k        suffix=.so
  v1 u4 I/ q/ O: Z6 Q/ q) O        ld_err_code=127. g4 u; m2 L2 a/ W
        ;;' G- Y: Z5 Q6 ?9 Y. l+ u3 F
    *AIX* | aix64)   . d% ~( J, a6 |( [$ _5 v9 P( U8 R
        # When genepiclib creates shared objects, it creates a import file and , F' O/ E+ R. ]; ^4 l
        # uses timemill as program. So at exec time,program timemill is needed
8 q" }& N- C; ^3 U; ?4 a' b* b        # in LIBPATH. t5 u/ p7 A0 u" f! h1 e1 F
        $ln_default $command $rundir/foomill; D9 B1 i$ m+ g% V" S6 s1 E
        LIBPATH="$libpathLIBPATH:/lib:/usr/lib"4 C8 s' @7 T4 v3 L& w% B
        export LIBPATH
: J3 b/ K' P* b" u        suffix=.o# A2 Z; [, N3 d1 b+ i) K
        ld_err_code=8  n' n* s0 e1 n1 y
        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then$ G. @" R2 Q$ t* G- Y
          tdir=`echo "/tmp/d"$$`7 K. C+ N8 ?5 r1 [4 o/ H
          [ -d "$tdir" ] || mkdir $tdir. j8 G8 [7 n- p3 x0 V
          if [ -f $EPIC_DIR/libCustom.o ]; then
8 A. g& r2 U: ]. }             cp $EPIC_DIR/libCustom.o $tdir/+ I: ~8 R& a5 H4 H6 P" R2 o- r# A
             $ln_default $tdir/libCustom.o $rundir/& [$ @0 o4 b, ^
          fi
% u+ c" b/ o' Y: P          if [ -f $EPIC_DIR/libModel.o ]; then
( F6 V5 r9 m( w. l             cp $EPIC_DIR/libModel.o $tdir/( e/ X6 T# N7 C1 q" M4 j7 b: i
             $ln_default $tdir/libModel.o $rundir/8 [- s" k7 h( U# l2 \4 @7 ~; _0 k5 {# {
          fi
" n8 g, N) k+ a, _+ `- g& ~) Z          if [ -f $EPIC_DIR/libFuncModel.o ]; then
1 ]  A' d" n$ J. c             cp $EPIC_DIR/libFuncModel.o $tdir// j8 i' W# ]* S4 C
             $ln_default $tdir/libFuncModel.o $rundir/
* N  M) h0 ]# r2 `; I6 V* E, v          fi
6 |4 x+ r4 `9 V' l. l          if [ -f $EPIC_DIR/libFuncModel.34.o ]; then6 I. A. m1 \/ t& z$ Y
             cp $EPIC_DIR/libFuncModel.34.o $tdir/
9 a% ^9 X- `/ D  N9 ?             $ln_default $tdir/libFuncModel.34.o $rundir/
6 ]% u! f3 O6 ], _% c5 P; v          fi
  m' I  K) i& `        fi" e8 Y. c+ Y' ^8 s6 A" \# j3 i  A
        #Set the IBM flag to enable more shared segids+ z' {" D% G( s/ k. \9 b) F
        EXTSHM="ON"
$ i6 j& Z( u$ O+ W/ z4 C- o        export EXTSHM
1 }8 p1 Z6 r: s/ A# W' ?  [7 |( J- c        ;;
: c9 b9 ~, o2 p$ H0 q    *LINUX*)   
$ S  M5 S7 R* @( s+ @1 Q7 A        suffix=.so7 A3 p+ ]& c$ n
        ld_err_code=1
0 l+ r" x8 E1 J: T. H0 G        ;;
+ v3 x4 [/ U. N% o9 `- M    *amd64*)
, q& o4 V- g# z7 N+ Q        suffix=.so: T- c1 ]$ U% F9 C+ d* o' X
        ld_err_code=1
3 d5 Y9 y& Q( d2 f- O        ;;9 m' Z& O% e# B' |. P
    *suse64*)7 I  \- q. H- u
        suffix=.so! Q5 ^( |2 x$ z4 s
        ld_err_code=1
6 |+ ]- Z0 Z$ i* L  F& f2 X        ;;
$ t0 N5 z" d# Y& r    *suse32*)   
( d4 [; Q, P" K1 J        suffix=.so
2 o) M% B. }6 S- i) I0 n9 U! O        ld_err_code=11 S$ a3 M# Q) r: \1 F
        ;;
8 ]  ^9 B& W( b1 K    esac  a# Y+ x# @; Y# n4 P0 q& Q1 z
; j! r3 j) |8 \
    [ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix"% L% ]8 ?+ C- v
    [ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \
( F" q2 Q  y5 b: y5 h0 b/ P        && [ "$cmdname" != "nanosim" ] \
$ a) d% g9 x) t2 }. h        && [ "$has_model" = "YES" ]  && ulib="$ulib $cwd/libModel$suffix"
+ w5 J6 Y. `. \1 f    [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix"- r; g. ~: G+ r

) f, H, ?5 I/ c7 O) i0 T1 A#Look for command line option for libFuncModel.so1 j( q3 Y7 j2 \
#    user_library_next=0: g# i* W5 y$ x9 V
    has_fmlib="", I: Q# h, b+ c9 F* |2 ^
    for opt in $CMDLINE8 P/ o, A' M3 c0 K! `+ e
    do
" j" n' Y* G% o1 A$ T2 [      case "$opt" in , _( A  R' K- t) f' K
        -fm)! T" L2 Z0 B' N; `5 u6 y
            CMDLINE="$CMDLINE $cwd/libModel$suffix"9 f( W! n  ?( \! F' z
            ;;( o# N+ ~) G; m8 S
        -fm_user_lib), P5 f! f9 N0 a; Y& K  J) T
            has_fmlib="YES"
9 N' o* ]+ g4 f3 m7 x5 P& a#            user_library_next=1
0 g! E1 Y9 p7 T0 m0 f            ;;
$ u: \4 `4 G: V  \( U; L        -xc)
6 L/ f. c% e% |( X            if [ "$EXTRA_CAPACITY" = "NO" ]; then# a, V/ F  g. |" E
            EXTRA_CAPACITY=YES! O) e1 g7 }. @3 d
            fi
7 P" f1 y! `# y0 b; s7 c# Z7 }            ;;
( }) W$ y" t1 I#        *)5 \& f$ F& F* _! T, [
#            if [ $user_library_next -eq 1 ]; then
1 I) u6 H4 c7 L4 l$ E6 t1 y1 q5 e#                if [ -f "$opt" ]; then
. N& E/ }+ v- a. E6 E) s#                    libfmodel=$opt, c. N" Q0 S0 |. n
#                else$ L+ @. P% e5 K; E
#                    echo "-fm_user_lib: Specified file not found"
% g, h8 S7 \3 O#                    echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages) d" \7 O# h. s) V
#                fi3 _' ~! W: p  A9 [1 x1 K: t
#                user_library_next=0/ G0 c  n; X3 W- E+ G' c) R8 L
#            fi
+ n' {0 @2 f+ p1 U; b' v  e; \#            ;;" Z: r; j% x3 t' p3 B" a1 f; H
        esac
- }) x" b$ H9 f! O, }    done9 `2 F: \$ @, O
6 [5 j1 t/ d! s+ K
    if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then, x3 V" i, q1 T: v
        flib=""
9 \+ P+ F- y) g        if [ "$has_fmlib" = "" ]; then8 L1 f, m6 D( d1 D
            flib="$flib `get_epicrc ./.epicrc user_libraries`"
; [. a* O9 {- s* x2 _            flib="$flib `get_epicrc $HOME/.epicrc user_libraries`"% f, D) ]" l7 E+ r% N- J3 K! `
            flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`"
4 W2 z3 t4 F: ~& u. `& f        fi
5 R0 [7 B: I4 C    fi
! u+ E5 F& W& @! \4 h
/ _! s% m5 C% u$ L" N6 V  U   for i in $ulib/ t* d8 Y# p' G+ S
   do
4 G: U( V! x/ f, U/ a       [ ! -f "$i" ] && continue, K& N: ~; ?* U# n
       dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd, Y$ t) J; r7 v" X
       i="$dir/`basename $i`"( W& E9 _% X" O; ~! W( ^& j  d
       case "$i" in
* D+ ]3 V- @5 V# L1 n! X2 H       *libCustom$suffix*)    [ "$libcustom" = "" ] && libcustom=$i;;% N6 S, i  D9 F; B9 ^
       *libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;;
5 {7 S, H) G4 o3 l; V       *libModel$suffix*)     [ "$libmodel"  = "" ] && libmodel=$i;;
9 w  A1 X6 }% A( X2 z7 @       *libva$suffix)         [ "$libva"     = "" ] && libva=$i;;
0 h% B+ e: i8 `; x       esac
' J3 c* C+ R! S. A* s2 V+ c       [ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \3 v4 t8 F2 N# E) ^+ C
        && break
, @# ?4 o7 P& o   done" P( J* z" ^3 O! K
5 v2 D7 d8 O3 F
   # symbolic link shared libraries to .epicrun$$
8 y* t8 t) f% S' o' `8 e    cd $EPIC_DIR; epicdir=`pwd`; cd $cwd
1 R( q+ n- Q4 k; Z8 m  C' u2 p    if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then  `: {' [* g$ ~$ k- F( c
        if [ "$libfmodel" != "" ]; then3 y( r) p% Z6 F4 S/ |
             [ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \
: E2 z  {5 C$ _/ J7 g5 j             echo "Using $libfmodel ..."  && \4 N' B! {# h7 Y. T6 t8 p. m
             echo "Using $libfmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE
8 v5 f/ f% y) d, W             if [ -f $rundir/libFuncModel$suffix ]; then# Y" I( Y4 p$ z6 k
               rm $rundir/libFuncModel$suffix
& `. I& K6 }9 O& a# R             fi- m. g% Q0 a6 R& ?9 G9 K- }
             $ln_default $libfmodel $rundir % I) d  b- A2 y/ h7 [% s
        fi: c- J  S1 p4 \; Q2 ^; {
        if [ "$libmodel" != "" ]; then8 u- E, F) ?1 w3 U/ B. c& c
             [ "$libmodel" != "$epicdir/libModel$suffix" ] && \' Q, c6 ^& q: Z0 K* g* C; {
             echo "Using $libmodel ..." && \
- \$ w( u0 |/ r; g5 e" Q             echo "Using $libmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE
3 F0 H* I% c, I; N" U1 g             if [ -f $rundir/libModel$suffix ]; then
3 c6 @+ N1 d# ]3 H7 |, c/ m6 R               rm $rundir/libModel$suffix
- ~4 s9 s6 |$ @( i3 G             fi4 {# U* m9 k8 |- _& [
             $ln_default $libmodel $rundir
' x) B5 k1 e6 T& }% r7 Y        fi
8 K# K* ~) R& Y1 x: E   fi
2 L( ]( \+ o/ Y& v' K3 Z- C   if [ "$libcustom" != "" ]; then
, l: _' y: b9 P- @$ y        [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \& O4 [* u$ t9 m4 ?0 n$ q
        echo "Using $libcustom ..."# u/ F9 `% C7 F
        if [ -f $rundir/libCustom$suffix ]; then; B) y- ?4 O. l; K6 x
          rm $rundir/libCustom$suffix, J7 }! D+ `& t, K4 q% s
        fi
& |7 e. B7 g5 O6 I- E1 b. @" N* }        $ln_default $libcustom $rundir - u9 {2 b4 v0 J/ S+ P+ T; c
   fi
4 h' x0 n. m/ P$ J
$ _% z+ b( |0 U+ u0 B  |  b0 o  C   if [ "$flib" != "" -a "$flib" != "   " ]; then
2 b; S. R) x9 z8 w9 z2 Y3 o1 B        CMDLINE="$CMDLINE -fm_user_lib $flib"
& f: W8 l8 o9 ^: s& m5 K   fi  _4 m& E; b6 j! ?8 v
/ ~% d( b4 G3 X: ]& Z; q7 x
   if [ "$libva" != "" ]; then
0 N5 X. G2 m2 s  k        if [ -f $rundir/libva$suffix ]; then
$ r. ~# j* Y' [0 f- c" ~2 a# v          rm $rundir/libva$suffix
- ~1 H7 p5 a. Z) l/ m, B5 n1 V        fi) Y1 b; _' y2 W' c9 j- Z
        $ln_default $libva $rundir & O  K) e9 k( D- y6 m2 o
   fi5 K/ t; {4 w1 B* t( e6 q
+ G( N3 {+ d! \, c2 o, \

" p& y* ~0 g. N- }. |% e    # VCORE design library
8 g, |) b4 b! z$ ~7 z% K    if [ "$vlog_design" != "" ]; then* L- L7 S8 v+ }
        $ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`2 S8 n4 X+ N8 ~6 c) i
    fi" S2 N8 ]8 @! ]9 H8 ?. Z1 q7 \! H

( A+ L: ]) V7 w* w' X    if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then0 o9 R2 V6 i7 x* j/ ?+ Z
        EXTRA_CAPACITY=YES  o* }! _0 F) p; L. r
    fi$ k+ x% s1 T: f7 i/ i1 @

9 X- P$ R" B$ C* t+ y    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc"
- ^( D: m* R" r* O' Q0 P- J" Q    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc"
2 Z4 n1 Z& v- w% N( ~  |' b- N    #Create temp file if dual process is on
4 T& H; R8 b  H3 n, j# r' ?% p    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then6 k: T" H  v" f. C2 E/ E
        if [ "$EXTRA_CAPACITY" = "YES" ]; then- n1 Y2 J3 t, ]9 t' W% ?
            touch $rundir/rpcidfile! K( I- m+ b3 G
        fi  Q, R. F. V3 x9 ^6 t3 G& }
    fi- q. v; L/ @; c% E1 S
fi
, q. @5 B0 R# o3 ?) v6 H8 W6 o  j7 E9 A" j$ W5 N, |* @- {2 q
run_cmd()8 m# V9 |' }; H8 }& m0 h! v
{, i: c9 H0 s* i% {* q/ ^
  command=$1
" K# c/ V9 M. `1 s5 r* A2 y  shift
5 t, d: x% l. f$ @# ~# ^8 S8 s8 R' T' r6 Z! q" J
  if [ x"$VA_FILE" != x"" ] ; then6 c2 N& E, h; S* }3 x6 `
     cmdline=$ARGV: ^+ `, X% P9 X! ^
  else- W# X: D5 M5 e4 P
     cmdline=$@
# v7 U% \0 h- T& n8 ?/ N, Q  fi
& @  C2 t& |2 Z5 W/ c) W
/ g0 b& `$ X/ H5 z& s  debug=${DEBUGGER:+"$DEBUGGER $command"};) a7 M( U& l5 W% z
8 M$ Y, o; C+ @+ H
  # To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a
+ [7 Y, r' S) m3 h0 I* }  o  # so save-restore may work.$ v$ y7 V; k% Z# p4 p: m6 Q! A0 z
  setarchStr=3 t6 T/ E# q3 p' Z
  cmd2run=`basename $command`, v& E5 R1 ], r! G4 o& f- N3 b
  if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then! t# a6 R; Z! `( T& \0 x4 T+ |
    if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then
' }/ B* t+ z' X& f) _5 s2 ?& K( j! [      setarchStr="setarch i386 -R "
4 j5 |2 r7 B2 r' w1 z( `- O    fi" ?' D7 P$ l8 I; I
    if [ "$EPIC_ARCH" = "linux" ]; then
% x1 K5 b% u$ ~" h+ V% b3 S      setarchStr="setarch i386 -R "
# A  x5 ?1 A. @9 K1 L# W    fi
$ s( V0 C1 o) }1 P    if [ "$EPIC_ARCH" = "amd64" ]; then
' p: Y. o9 ~, D1 |5 n" W      setarchStr="setarch i686 -R "$ r% E$ a9 K4 s  D# y$ H
    fi! _+ l: t! s0 a5 Q/ g
    if [ "$EPIC_ARCH" = "suse32" ]; then0 D& x5 \# N+ w2 k5 k2 D: W; C7 a
      setarchStr="setarch_suse i386 -R ": b7 {4 p3 ~6 J2 C% p7 U
    fi$ P) k& ?* }9 w$ X! @$ x* v
    if [ "$EPIC_ARCH" = "suse64" ]; then; [9 D' L, J5 u; Q, ?9 C
      setarchStr="setarch_suse i686 -R "3 |5 H% i% ?/ O" N& ~
    fi$ U0 k! v* [+ Z
  fi2 @  e. w, z9 g) B; D6 G# |

4 M  K7 B! ~. V  ret_stat=0. z0 U5 V# C% z, m$ @
  if [ -x "$command" ]; then6 A% P$ f1 O5 u- f5 v# v" a3 i/ x
      if [ "$debug" ]; then9 Q7 m/ a" F* T9 k( P
        _debug_args_=$cmdline
& X5 ^! e/ ?7 K8 B) @" M5 h* |) c        . .epic-debug9 X, n; \. K" S# M9 y, q" d
      else# ^/ v' s& f4 n) s! J
        DEBUGGER=; export DEBUGGER
$ t- [. \, w9 ^2 y        $setarchStr $command $cmdline# ^5 f  g# |& _: @; E
      fi% }8 X  A* `2 @- J
      ret_stat=$?
2 n% q& i; w6 w) S; i( V  v  A  else
) d  Z4 K4 e: W% ?3 p3 r9 g    echo "Corrupt installation, executable \"$1\" not found!"
" q. O, o2 k) o2 b  M    ret_stat=13 F9 d' A6 L3 M; i$ d$ N, c
  fi; }. T* q' x& ]" Z1 H
}3 p+ Y( t  K% U9 ^7 K

: D! F1 e( }; e' K! K" G# O# keep runing cmd if ctrl file exist
. z; i* }# b5 M, K! Z- b9 Z- s( a2 W& _6 K. e' n  k) @" r
run_loop()6 o- F# U7 d7 y- ^7 W8 T
{
) A7 x" }! X0 e* u4 v0 M; `  command=$1+ s2 [, z% w! }8 m
  shift
, A3 c5 G( V9 C$ @/ t/ L
( J# `' c* w% }* C  if [ x"$VA_FILE" != x"" ] ; then
% S* L# k  U5 o: x& t; S% D     cmdline=$ARGV% ]! t. i: t9 Z$ F
  else' g1 P: B! x) l4 }6 f+ L0 Q9 \
     cmdline=$@
9 U& y8 a7 N0 t2 n  fi
% p4 C% j, _) }  }$ [7 I$ }0 I: W
/ y; M6 _) @8 k% a& R* w, l3 I6 Q  while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do9 \  Q% L& U" P* r0 r  ~: Y
    . $LOOP_CTRL_FILE$$7 M! |0 T1 y, r& Z4 o$ W* _( N% y
    run_cmd $command $cmdline -banner 20 C: |! r- q& I9 Y& j9 V  {$ e
  done;
4 D3 g, B* P. c7 k2 d( e
( [, h: i$ `: d: j( t  if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then/ w1 L6 a' Z2 w. P& _; L$ z  j
    rm -f $LOOP_CTRL_FILE$$
* R. B. J3 n- A: h; o  fi
1 I! |( [2 e; s' ?}
6 O* i! W1 L; x/ z' M$ m
2 A, X7 Y- @# a, qhar_check_ret_stat()) M! f6 C7 i) F  u# X4 A
{# F" }/ R, t; y2 h' X
  if [ $ret_stat -ne 0 ]; then # D7 ~, @6 l7 x5 V$ R
    echo "Simulator returned with non-zero exit status. Stopping."
0 C! j4 \! C/ D$ m& N; e    exit 1  v, R- F7 z2 I) b' a* [
  fi
4 Q: Z5 k7 h* P5 T" Y}
, m- D$ j# V# g; `/ N2 O6 p' w$ y+ |$ o) J8 e' ]
#
" Z9 o7 \" v0 G# set stacksize and datasize limit
, H9 k9 [. S' \, x4 w#1 l* |# T) F$ |9 ]- `; ^: U, K

5 u7 e! C( z% {& c9 rset_data_limit! x  h% Q9 Y( H2 A6 Y/ a( ?1 d$ \7 z
set_stack_limit3 A% s  G  v! f) T

, x+ Q9 P5 C( L6 S; e#rm -f $LOOP_CTRL_FILE
% R9 p2 ^) u0 C6 I; A. Q' P1 \" b% p
run_main()
( \5 K  L5 Y# j0 A4 ?) [{) G; [  G3 Q! s
if [ $is_special_har_run -eq 1 ]; then
; W4 E5 D9 R( Q, {3 R  if [ "$har_ofile_prefix" = "" ]; then. t- B  x! Q5 P: ?, g
    echo "Wrapper bug. Notify Synopsys technical support."
2 ~2 z' w! I& G% s    exit 19 g- e5 T2 S7 E$ L9 B7 _
  fi( U" ]6 M1 \0 }( \
  if [ "$har_hilo_file" = "" ]; then  H* r1 B* v" A& X
    # no user specified hi lo file - do both runs
7 S6 U' d0 J3 n3 g7 n6 m    run_cmd $command $CMDLINE -har_one -har_setup
0 x/ l/ z/ f( Q2 L6 V: N. F  L    if [ $ret_stat -ne 126 ]; then$ G7 c- H& c- R2 q' T
      har_check_ret_stat
% c2 R+ L# P# W0 j: \      if [ -r $LOOP_CTRL_FILE$$ ]; then9 I! v$ i- R2 m+ R7 x% D
        run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl7 o3 V0 b/ s% c2 V8 t; F2 u
        rm -f ${har_ofile_prefix}.hl. R& m+ V% c, r
      else
8 q- U% ?9 x4 |( j. n        run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl8 O7 v0 v7 E7 E  S/ u0 `% f
      fi8 q/ r% \; C- t
    else8 l0 K2 B1 B' P' g% I/ ^2 A5 ?
      ret_stat=0- j1 {( E: J' F9 h! h4 J, E
    fi! e2 J. u+ w; l# l/ w0 c* b! b
  else! @* `4 D9 ^" V! ~
    # user gave a hi lo file name
1 S; w1 O/ T) J/ ?& I0 Q    if [ -f $har_hilo_file -a -s $har_hilo_file ]; then
7 f9 N! J$ F" O8 f. F      # file exists - use it - only do sim run2 E- [9 ^& Y, @- `6 A
      run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}
2 n/ K# t! B1 w  B6 s+ Q      run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}
* |) ?$ G# w: ~    else7 v" ]7 j$ ~- ^0 `9 x- D; g
      # no such file - generate it - do both runs7 F6 g8 @% x1 R+ I8 ~
      run_cmd $command $CMDLINE -har_one -har_fnf -har_setup  R1 ^  N5 V. r. A8 M4 K; ?
      if [ $ret_stat -ne 126 ]; then* L, O9 ^+ G+ ]7 p1 S/ {' x. y
        har_check_ret_stat6 R8 q2 i) y" C
        if [ ! -f ${har_ofile_prefix}.hl ]; then
( {4 h/ B4 v" H; t          echo "No hi lo file generated after setup phase. "
: a6 l) A( u( _3 H          echo "Contact Synopsys technical support."
/ T+ H% {% e5 Z/ d% f! K- x/ x          exit 16 c1 l6 l6 q' ?# v! m' L
        else, S9 Q0 @4 F' r
          if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then
: K; J0 i, J, r            mv ${har_ofile_prefix}.hl $har_hilo_file+ Q" r) c& ~; c% w) K$ T
          fi
4 L; L$ R8 s/ v0 M7 K  l& }        fi
# W' {: b; I! G8 a  E1 J, f        if [ -r $LOOP_CTRL_FILE$$ ]; then; [% x- r4 a: f4 ~
          run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file
% W& {1 J( ^( _        else  a% A5 c4 _% N
          run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file
" g+ x; b* w8 W! g8 x        fi. E: i6 j/ O9 g  Y" k5 T
      else
- s3 l- v, q2 E/ G! P$ G, F        ret_stat=0
/ i( I1 G  f' ^/ |      fi' O7 D3 J% U8 ^2 Z; a5 G+ ?# n! B
    fi
, z; t$ r, `0 o2 ^  fi; y8 l0 G- P) L6 K7 `+ M, T9 X
else  ' U& ]0 L4 r  w6 l7 E" ?
# don't loop if -har_setup' I0 ?5 F* C( p9 z" w; S
  if [ $have_har_setup_flag -eq 1 ]; then4 F% H: J" x$ T4 U& M' J6 C$ i
    run_cmd $command $CMDLINE
5 V4 Z: G6 p, \' s    if [ -r $LOOP_CTRL_FILE$$ ]; then
1 o7 V* M3 c& @2 o      rm -f $LOOP_CTRL_FILE$$( m  @; `. }8 L- @" b
    fi6 u. i- p( R0 M. P
  else6 ^+ @9 S! c4 |9 c
    run_cmd $command $CMDLINE- e% X9 z5 E4 ^2 Z2 X
    run_loop $command $CMDLINE: Z) L; ^. r/ k
  fi, _  K9 e( q+ O# |
fi
' R% ^* Q0 `' o) `
) {. q0 j( l6 b1 `0 Cif [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then
3 t! l- @3 z9 Z  pwCreateErrDB -w $workDir -e $errFile5 \- Z0 S; x" x, j5 L
  ret_stat=$?
* ]" W& c  ?& ], V: F& y/ {fi
. B! S7 D' O# @2 v5 p1 a}
% A6 A4 Z9 a/ @0 I/ a* C
8 B1 u# {- Q' t9 I# Hcleanup_alter()
2 Q. E! |3 j9 [8 W{
/ b3 S% t: h& Y/ Y9 ^   /bin/rm -f $ALTER_COUNT_FILE 1>&2: w9 P* @2 _2 ^" J7 W. R7 E/ C2 f
   /bin/rm -f $ALTER_HK_FILE 1>&2
9 P- I4 }4 \  d}
% ?+ l0 C( i' w, m8 Q) k% y
1 M: f9 D% m# f( n. ]#generate alter temp files based on pid
3 [" R! c6 N& C: D5 E' A/ _ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$
4 c& _: h4 G7 ~; cif [ -f $ALTER_COUNT_FILE ]% n- i  `7 a. G1 C
then 5 J0 z  G5 C# S
  until [ ! -f $ALTER_COUNT_FILE ]0 N) m: C; A; ]0 U( [* [
  do- H7 u- @- Y+ y7 R, s
    ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$# g! x! v9 e. E5 m3 V
  done5 F. @! a4 w" y5 Y
fi
, C% o6 f* ^6 y3 ]; Q4 R* Nexport ALTER_COUNT_FILE$ V5 H) B) K5 E7 t. U% d2 U
- E; y/ R5 A( S& P
ALTER_HK_FILE="$ALTER_HK_FILE"$$* n6 L9 d: k# E7 V: h7 E9 @
if [ -f $ALTER_HK_FILE ]7 n6 H# M* ?7 t7 o. z8 E
then
) k: _2 B. d# P2 ], _& J, H" b  until [ ! -f $ALTER_HK_FILE ]" P8 R( g: p- |7 s  ^1 J
  do7 n, D' \7 n# I! U/ C; h4 x* X
    ALTER_HK_FILE="$ALTER_HK_FILE"$$6 ^- \8 ]( k5 B+ o
  done
) T0 A' K* z$ w1 Tfi$ u" A3 _# j& o3 ?# G* n
export ALTER_HK_FILE
6 r% W0 J8 u$ I0 H% i
) ?9 i+ x% ^; W- Z#generate monte carlo related temp files based on pid
( k! _) a! l& Y/ Vcleanup_monte()3 j# j, h- z+ }) u8 ~: m/ [
{
* O1 M4 i: R0 t4 m% o# J/ I* |  f   /bin/rm -f $MONTE_IMG_FILE 1>&2! H* C' {( W5 R" O9 M5 d4 P
   /bin/rm -f $MONTE_IMG_FILE.gz 1>&2+ [1 j; l/ R' I9 P* a
   /bin/rm -f $MONTE_COUNT_FILE 1>&2
; c7 }7 T1 O0 @' d5 f$ Z   /bin/rm -f $MONTE_CFG_FILE 1>&2
1 p1 S! C4 M+ ]3 c}
' V- L  q' L+ D0 O" X. m2 P2 n5 @$ J7 y1 N4 c
MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
/ u4 j) K% ^) N* X* qif [ -f $MONTE_COUNT_FILE ]
. C9 t( Y! z9 Q1 y3 y0 g0 }5 vthen
' c) |/ W+ N# \3 `4 ^  until [ ! -f $MONTE_COUNT_FILE ]
5 _8 Q& I+ @% v, h0 z  do
1 j9 S; e' @1 J1 V8 h5 b6 K& [    MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$9 J6 E; K4 N* A& d) y0 E" f; i
  done' \) A4 L2 V) C
fi
3 s5 a9 @2 i" Q+ r4 _1 Uexport MONTE_COUNT_FILE
; \, }- F# |4 i9 L% @( n0 D$ D8 Z# A5 V( l/ ~
MONTE_IMG_FILE="$MONTE_IMG_FILE"$$
+ H9 v( T! d, f  bif [ -f $MONTE_IMG_FILE ]3 p, u  ~2 V3 S' D2 ]5 Q
then) F7 Q6 c- R, ~2 ~
  until [ ! -f $MONTE_IMG_FILE ]$ y) g$ ?+ z$ A. B- T) u
  do
9 ?+ [& Z' }% ~3 ]# A3 ~* L    MONTE_IMG_FILE="$MONTE_IMG_FILE"$$
) b$ v. l; w! y6 _" \* `  done
& c& M; G4 j' `/ ofi* L- |6 q, l8 Y
export MONTE_IMG_FILE6 ?0 \# U& B5 G: Q. E5 D  f4 y
) e2 I7 H1 w$ B/ r' y' N
MONTE_CFG_FILE="$MONTE_CFG_FILE"$$% B8 C1 M, z" ]% z) G1 l9 }  w0 P$ k3 n
if [ -f $MONTE_CFG_FILE ]
! ^3 X3 I' L0 P" K0 c) kthen
! O* j0 E9 p9 p! P9 C- E4 _7 Q  until [ ! -f $MONTE_CFG_FILE ]
$ W$ v$ s/ W5 g7 a7 M4 b  do% Q+ q- I' F5 x( m% j1 T5 P* J
    MONTE_CFG_FILE="$MONTE_CFG_FILE"$$
2 @% n% ^/ n7 o% T9 _  done
1 R4 b. e0 K7 Q( K: W8 r, yfi" z2 j. p9 J  o" J" e' u

! c0 c" E: k& ]* d; q# main iteration
& E- x" u8 u. krun_main1 i% ?- _% n- v

  C0 Y  S; ]0 Aif [ $ret_stat -ne 0 ] ( J- J  T$ m7 Y
then
. \: o" S. e: |  S5 w& B8 [6 y  cleanup_alter5 E% b9 o( N& {" h2 M: C' b  p
  cleanup_monte
0 T7 D& j) u, m  Exit $ret_stat& r$ ~, L) V: Z: ]* S! D
fi( A4 _% D# _2 q+ z4 J

$ F6 U  i; v1 R( f* F7 q! ]#Alter related iterations
& X  [- p  _5 G! q1 c: P
" Q, w- @! b- s4 `& |: Miterations=0: {5 M+ I  j! x% t
count=0
6 ^6 D9 t' u' R& B7 @0 j% ^if test -s "$ALTER_COUNT_FILE"( s" V0 J- B, G" x( C
then- |! @) T  h0 `& ?( ~" ?& Q2 U( V
  if [ -r $ALTER_COUNT_FILE ]; then$ E) v, d$ Q2 O2 F
   exec 7< $ALTER_COUNT_FILE) |" Y8 b/ c0 K
   read iterations <&76 j/ _/ u, V6 A# n- T. a9 `
fi
7 h0 X% {5 y) r- f; q1 G% U, _fi
( Y" k: {5 {0 ~5 Y4 x" v2 `7 d$ L( k( n! L
trap 'echo Program Interrupt; cleanup_alter; exit 1'  2
7 f2 V% p4 P' cwhile [ $count -lt $iterations ]8 o& ^8 U# c+ c2 G6 p& e# h
do
0 R+ S+ c" u6 k! e count=`expr $count + 1`  e, ^. Z' p! q. J; q6 e/ r
ALTER_COUNT=$count
, l1 K. ^9 P8 [% |: j6 ~/ L export ALTER_COUNT
" q8 J2 z$ i! x) w) U! h5 N5 e* ^+ X& G+ M4 A+ n9 R
run_main+ p3 p# O; c3 U1 ]8 ?4 y* }0 k6 x

; P0 x& B0 l& r% {done
0 o) X, Q, E- F& v2 |# l: n6 r& `' U/ ?7 z% X% q; w# V5 M& J
#Monte carlo related iterations
' s; a3 G- D+ L+ j, ]  Q4 Q+ Y
monte_runtime_summary()
, i9 N: _! v8 g) p' U2 P1 N{& N0 q  z3 v; M) o' ?
  keyword_1=real4 k6 J' f9 k) q6 p1 W# h" K
  keyword_2=user: a0 ^& ]: e4 M/ o/ ~5 G
  keyword_3=sys
; w5 k7 I0 P) S. ~! T  ofile_prefix=nanosim
4 c  [! z- E( u" ^9 S6 b6 d/ {% x9 s
  if [ ! -z "$o_option" ]; then
: T7 t  U' \9 y# W    logfile=${o_option}.log
" O4 {% h# ?' q, B  else
8 ?. A3 ?) F$ D) I& |( i    logfile=${ofile_prefix}.log9 q& E5 k9 D! J4 U' p
  fi% K7 p; @  S1 x( D* j
$ K& W# w/ F# l) f! ~9 Y$ V3 U
  if [ -f $logfile ]; then
: u% I+ B0 b3 J, {    echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile      ! C7 J2 ?, ^# f
    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
+ U- L) j8 ~& v; w4 ^  fi# u. h7 p7 o# V( G' P  [4 K
}
* u5 U9 `6 F9 e3 m( f
, Z$ ~7 B: n% s2 V* cnext_monte=0+ y/ L0 K4 F+ R  e+ b1 i- J
cur_monte=0
, E" n2 r& S  C. x$ ?2 w$ ^8 }  W
6 p5 S5 q( i! D# m$ Yif test -s "$MONTE_COUNT_FILE"% \0 v9 b7 i, L# E
then
$ w3 I1 U) O! w2 I: E  if [ -r $MONTE_COUNT_FILE ]; then
/ S5 D( T8 y) ^$ [1 G3 [! j   exec 8< $MONTE_COUNT_FILE
( ~& Q$ v0 k9 M& e: T   read next_monte <&8( {! E- ^, V) R8 w
  fi
! l9 l; C# ^  {5 x( {$ Q* ?! }fi
2 p1 {( G4 l6 x0 G5 E' S; f! m: u5 @+ _  f
trap 'echo Program Interrupt; cleanup_monte; exit 1'  28 }3 X7 j) p/ D( u+ q9 c% n
while [ $next_monte -gt 0 -a $next_monte != $cur_monte ]+ F) u8 W: X; g, U6 b, K
do
- f9 f+ x" t0 q) V9 t$ L' b, r  NS_CURRENT_MONTE_COUNT=$next_monte
( r$ O& @" x# G2 O& h5 O1 u- M* X( E+ ]  export NS_CURRENT_MONTE_COUNT4 ]. e5 d( a3 T$ f8 K. O

. y( t% X: o' S' O  T: q9 K  echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE- c/ w# {& }- f  y  z( r
  CMDLINE="$CMDLINE -c $MONTE_CFG_FILE"
/ `& P7 ~$ ?) F  run_main; u2 S1 \0 T+ A" @! O

7 D2 D) v+ E( a( T+ K  cur_monte=$next_monte4 K. z% N1 |6 [: k% m- @7 J
  exec 8< $MONTE_COUNT_FILE
  `# X$ s+ j, E; _8 n2 f" \5 N+ {2 `  read next_monte <&8) z- S6 |; m  m
done$ ], `  D& u: R
- I* q  n, ^. y5 L: {
if [ -f $MONTE_COUNT_FILE ]& y* ^8 y: X, R
then0 ?9 n2 l+ v9 n' S3 K1 u+ V5 g9 `
  monte_runtime_summary
6 ?6 Z5 b5 D8 U4 G: bfi; m5 Q# z! \1 D3 O, _# M' |6 I: ]( A$ P

7 p5 [  {+ Q" {0 |. s. Y  pcleanup_alter
' l6 q% E: z  V0 L- l4 ]5 Fcleanup_monte
# P! J# ?) \: F3 p% y
5 s0 c( E( [7 e5 aExit $ret_stat

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享分享 頂 踩 分享分享
2#
發表於 2012-5-24 09:22:22 | 只看該作者
nanosim有說支援ubuntu 11.10?為何不用RHEL5,這才是EDA的主流linux os
回復

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

首頁|手機版|Chip123 科技應用創新平台 |新契機國際商機整合股份有限公司

GMT+8, 2024-6-15 05:50 PM , Processed in 0.152519 second(s), 15 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表