Chip123 科技應用創新平台

標題: 版本ubuntu 11.10 軟體nanosim 無法執行錯誤? [打印本頁]

作者: leaf1989    時間: 2012-5-6 01:58 PM
標題: 版本ubuntu 11.10 軟體nanosim 無法執行錯誤?
各位大大好:; ?  R# U& _; W0 }
                      小弟執行nanosim時,卻無法跑出視窗來,有個錯誤可是我不清楚該如何解決?問題如下
# f  T$ W$ i3 j+ \                      [: 113: 64: unexpected operator
  }9 R- Q1 ?. I% y; {/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim: 1: Syntax error: Unterminated quoted string
. c- ?- P+ Q3 a: {4 i, e3 w+ h; N# s3 X有大大遇過這方面的問題或是指導我方向去解決, 謝謝.
% F5 ?) I/ B6 ]3 ^我在猜可能是這個檔案內的文字需要修改 但不知道該如何修改?
+ p- l0 t' ^' D1 W( T0 d) p以下為/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim 的檔案內容:5 {% q$ J  H+ h% {9 [) ^; f& _
    #!/bin/sh+ u! @* M8 g  e( N5 K7 q
#
, h: h, |/ M" r$ ^$ g8 M# Copyright (C) 2001 Synopsys INC: B+ g  S( P8 q8 Y) S. V
# EPIC Dynamic Simulation Wrapper (DSW). ]4 @4 `6 Y8 M5 b
## p. q5 Y  M# X9 ?! G# B4 v, b
eval ${DBG_EPIC_WRAPPER:+"set -x"}. U# u. l6 ]5 V6 F
: K1 c9 d* P. K1 |8 v
if [ "$EPIC_WRAPPER_DVLP" = "" ]; then6 }6 q5 T8 R$ S
    TEMP_ARCH="$SES_ARCH"
8 B+ t( e# I4 {9 g; ~else! |4 B9 e) p- J/ \
    TEMP_ARCH="$EPIC_ARCH"
: g6 R! @: _3 kfi- F6 E  ~6 C5 D

; u& c& |# C# N; E$ i5 l& lscan_for_hva_args()8 b1 Z  O# _9 b0 `% }  a/ U
{
. }7 b% p2 c  v) C  /bin/rm -f hva.init 1>&2+ Y; c1 r0 P. P
  while [ $# -gt 0 ]; do
; Q# c' q  V' ?$ `# g    case "$1" in' h& V3 {, f# s
      -vaf)
, G. z5 o* O! m( v+ \( Z           have_vaf_flag=14 E; |! F, ^! u; m
           have_va_flag=0
4 h, a; Z, @5 ~- G( W! E$ J# ^" H+ `1 C           shift;! D+ R9 {* N5 {& O& t; h  p) L
           continue;; @2 m' b" u5 Y/ h9 i; R' X. ]
        ;;
$ R; r9 G: b0 q# X! f/ K* w0 ^      -va)/ [  b, ?! J1 K! Z0 n
           have_va_flag=1/ K0 t! c0 x. {" t( u" H8 \
           have_vaf_flag=01 x( H) F' ~1 S! G- Z# e- i; Y
           shift;
4 _+ ?& j2 Z+ X9 R  r5 C           continue;
4 g0 e; N/ c) C( T% v3 f        ;;* d4 d6 B+ @5 G' I: p  ]
      -*)
5 H, Q! T5 D& Z& _( N           ARGV="$ARGV $1"* D; z! @( |: O4 i$ R1 f: W; D
           have_va_flag=0
. Z6 \3 _+ E! o           have_vaf_flag=08 |. r4 P! c$ |
           shift;
' P  w- i7 m2 o           continue;& g6 ^. _% d# a: g2 F9 n; ~
        ;;
: F& b) V0 d5 a% S$ e      *)
2 ?3 R/ d5 r" ~" x* ]           if [ x"$have_va_flag" = x"1" ] ; then
  F$ a& ~9 G6 N              VA_FILE="$VA_FILE $1"9 Y7 ^# k' l( j; K
           elif [ x"$have_vaf_flag" = x"1" ] ; then
, K/ T& l! A4 W# Y. W. ~9 P              X="`cat $1 | sed -e '/\;/d;`"
9 T, w6 d4 `7 i; h7 Y* N9 J) V              for token in ${X}; do
3 l  O6 b$ ^$ `                 VA_FILE="$VA_FILE $token". U* s# T. J, E& d  g+ Q* H
              done 7 z7 I) [' D* J0 W; `- @7 }
           else
  z2 b% C' l* p& V% K  s. s, o              ARGV="$ARGV $1"
/ }2 C( A; w: r2 b9 K- Y0 p3 m           fi# P3 ]3 G' i" M- j# C+ [
           shift;
& {6 G, k) D7 l- R+ K7 F+ y        ;;
3 c7 ^+ N4 @: s9 o    esac( U$ C9 a7 p7 [
  done
7 ^1 _+ C, B, U; Q7 U! j3 z$ U
: ^3 z5 {) F$ U# ?2 y  if [ x"$VA_FILE" != x"" ] ; then
6 }' I. y% |1 D) U9 k  P##     /bin/echo " xxx ARGV $ARGV"8 I! C5 u7 Z: G) D+ A  K2 z% B
       /bin/echo "choose nanosim $ARGV ;" > hva.init0 N! n( k' I3 T0 f( H9 k! u. R
       echo vcs +ad=hva.init $VA_FILE -o simv
3 M- d! W. `4 w       vcs +ad=hva.init $VA_FILE -o simv
* G1 o  k5 o0 w. K. K* q2 b       exe_status=$?& N, J1 K! x3 N+ \" n; {% A
       if [ $exe_status != 100 ]; then
( n/ ]1 ^7 G" c) ?% I2 e& u          /bin/echo ""; t% u. b/ @5 \3 `
          /bin/echo "ERROR: Execution of vcs exited with code $exe_status"! a6 Y; c: f. ~5 K$ C- R
          /bin/echo ""
$ Y; k; K- w$ g: b  r$ y( J- F+ ?          exit $exe_status7 ?+ R: r9 l' ]8 h& s2 u
       fi9 o4 G. w: a) \/ p: ~8 l  E
       hva_files="-n simv.daidir/amsVD.ntl simv.daidir/amsWRAP.spi"
) T4 z0 ~  A) {+ K       ARGV="$ARGV $hva_files"
$ J. o4 b2 u- k- \  fi! L( U0 z3 Q$ s/ H& n5 j
}8 V2 ?* ^/ i$ C8 I" k8 {; ?
#-------------------------------------------------------------------------: w. Y; Q4 P  h+ n

  F+ H1 C; h' i6 r- M) J8 ]# a3 vcleanup()# D- A6 J* q( D
{( F6 q& ^( O0 X9 R% U2 q
    if [ -d "$rundir" ]; then
/ \5 U( m9 }2 P        # On AIX, a .nfsXXX file is created if libModel.o is removed# ~7 L: j- `6 E) D# H4 L/ u2 G( Z
        # so .epicrun is not removed because directory is not empty.
% [; D4 b" n$ G        # Solution is to remove it again if the first rm failed
& }- o" K6 L+ N' o& Q4 i* Y        # (rm -rf $rundir || rm -rf $rundir) 1> /dev/null 2>&18 n$ y! g. E! P7 \7 i
        if [ "$EXTRA_CAPACITY" = "YES" ]; then2 }9 s& H4 G( G5 ?: o
        chmod u+x $rundir/rpcidfile$ V1 O# U. }4 G' ?- f# U
        $rundir/rpcidfile* _& @/ `1 g0 S  K& T$ l  e1 s
        rm $rundir/rpcidfile
3 X) k; o4 Q- A! f1 \4 m        fi$ a3 N$ d# @% }, f& T: I+ A
        rm -rf $rundir
0 N% _2 s! w- k) E8 {7 T
9 J5 X! H$ O" E) X& j        #Due to NFS problem, we have to copy files needed to
* e! p. q5 R1 R3 D; N6 t        #/tmp/<temporary directory>, then symlink's files
% N1 M$ [2 b, @        #to the local temporary 'rundir'. This avoids the problem" G+ ]7 I5 F, \
        #to remove 'rundir'
4 V. R3 }+ K. M$ E0 B( Q" w! X6 Q% d: H        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then5 b& j/ Z8 V, N9 d8 ^' X6 @
          if [ -d "$tdir" ]; then
2 A( e( [3 r1 t; O7 x4 d3 ]            rm -rf $tdir
  j/ X. V2 ?4 S% Y! u4 l          fi8 |# ^" l! b) Z& P6 y4 G1 @4 O
        fi
. c! B0 Z6 u2 X0 j: j+ v    fi" [' o; G& m4 j
    if [ ${exitstatus:-0} -eq $ld_err_code ]; then
; V/ [& \$ N$ l  g8 K; o+ `# o        [ "$has_model" = "YES" ] && rm -f $cwd/libModel$suffix" y$ N0 ?1 L# @! Q. t' Y
        [ "$has_custom" = "YES" ] && rm -f $cwd/libCustom$suffix! L7 A' ~0 r* v
    fi, b  Y0 Z# J, ?! R" S) F
    [ -f "$EPIC_SCRIPT_MESSAGES_FILE" ] && rm -f $EPIC_SCRIPT_MESSAGES_FILE 1>&2! C, K6 I8 w0 Y( W2 h* c: }
    exit ${exitstatus:-0}
3 C. ?5 B$ d& d6 {5 k( Z& t0 ~}
" [3 |- r& E( N. e( o1 `: h$ i3 Q0 C# Y+ D, ~7 g
Exit()  k. j) [. P+ r+ B$ E# H  C
{
7 G- I+ C0 M: H7 P4 R$ k    exitstatus=$1% G0 l/ C! F2 ?. b# T2 M
    exit $exitstatus# |: A5 V- g8 O
}1 d6 U# H4 d# }0 k

+ m: g$ P% ?% `. H" ?# get_epicrc filename keyword
  Z" v+ D) i4 }% B4 Y3 u8 C( jget_epicrc()4 F( M( X6 {# d8 g! C' W& q1 F  M
{8 `3 Q: ]# L4 E8 }
    [ -f $1 ] || exit 0
3 W" V/ ?: `3 p0 Z2 |    key="/^$cmd2:/{print \$3}"" B5 z+ y+ f6 r& w% A5 d! c
    awk -F":" "$key" $1
7 p' V. O, P: V# J, G$ A) ^4 S}9 V" v5 v# G& v# H8 l8 w* x

- p8 J, I+ }1 R0 B- M#
/ ]+ |' c2 h% ~6 b2 S# set datasize limit to hardlimit
1 n5 J$ W% K3 {/ e& n9 f#  V( x" S, k4 b/ p1 [8 m& q; d
set_data_limit()4 t! w& Z  `$ n; s7 J
{$ y4 |; k2 P: e+ {
    dbglimit=04 o- F& F/ C$ P& W! d4 F" T
    hardlimit=`ulimit -Hd`6 Q- U+ N$ E; V3 z, `, a
    softlimit=`ulimit -d`8 a2 u, N- e. m7 t
    desiredlimit=3500000, m$ _' d' H9 {$ N6 `$ F. s& L
    hardisunlimited=0
  Q$ d1 o; U! x0 {, B    softisunlimited=0
' T9 l+ Z& x3 l* C# O. f5 |8 O0 r    is64=0
" r! e0 g% A, ?7 y6 z& q4 U( _0 ~; y) ^9 A6 H
    case "$EPIC_ARCH" in
$ W( Q- k8 m% J' m( i    *SUN*64)
: d! i+ t4 p0 t9 b: o/ u% a        is64=1- a) _' Q9 N# O% i5 M
        ;;
+ O, G. w. f' \2 C  f3 C    amd64)2 O5 R, G7 u; w# z4 I3 Y: z8 b& i: D
        is64=1
% w2 o: i7 O- F: G; y        ;;
# l8 r7 h; i2 \( Y1 F    x86sol64)
- N2 f" h$ a5 C' O        is64=1
# U2 `, R4 r& [/ W        ;;. A" f+ |6 ^6 L
    aix64)$ a: |* X2 ]* W# d
        is64=1& L  h' R: Y; p! o, [  ^! _
        ;;8 i0 F2 |1 V! N3 [
    suse64)( ~' D, Q% [1 T" v" j
        is64=1
1 u+ ~" j- o* C+ F3 {        ;;- B& @0 e) w& e& W# \6 x8 x+ R
    esac
9 f& b& ?3 [) u  M: |! G+ I
- t# G, i4 ?' |3 {6 `" ]    if [ $dbglimit -eq 1 ]; then1 }8 a5 J1 @' B8 h; z
        echo hard $hardlimit soft $softlimit
- ]5 T/ i6 J2 H* o* [    fi
8 \6 V( l  c% `: M
7 @. {4 Y) k1 s    if [ x$softlimit = "xunlimited" ]; then1 S2 H& P- y2 P- o! u; q- A
        softisunlimited=1
4 @: G* g3 t3 e. Y    fi
$ D2 o' @" c2 I+ E0 b! T7 v+ `1 J
    if [ x$hardlimit = "xunlimited" ]; then
: R: L( n( `/ v        hardisunlimited=1
$ [( T6 A. _9 X  E1 @    fi
9 \( h. V) P7 N2 |; Q% H( Y* I+ ?# a! Z
    # 64 bit machine should have bigger than 4G
$ ]  a7 n! Y( Z# g& N0 P( O, w    if [ $is64 -eq 1 ]; then
3 S5 W* Y) }( Q" O$ S( m9 J        desiredlimit=5000000  U& ?- T  E- W5 J& K: U) A
    fi
9 s& i2 y& [8 [+ R8 V: H* R3 J: r! Y
* D4 V! m) ]; l2 P# s% H    if [ $hardisunlimited -eq 0 ]; then- d2 C. r8 B  x. J/ f
        if [ $hardlimit -lt $desiredlimit ]; then  x/ o" Y3 H+ o
            echo "WARNING: datasize hard limit $hardlimit K is too small."' e- L  h7 g' H3 E& S, b) Q
        fi( t* q8 A0 N  G
    fi
" g' p% Y2 w/ c: P( o5 j# b& M3 R7 C* F$ ?  ?
    if [ $hardlimit != $softlimit ]; then
0 n  [2 ^' g7 u* q" D- n        ulimit -Sd $hardlimit
8 P0 C6 o& a. M" }) q#        echo "WARNING: datasize limit is set to `ulimit -Sd`"' ?7 {$ z5 f3 N6 O) Y( [, o1 M
    fi
* ]( d1 \2 H& F9 u9 R9 g& K& v! S6 r' ^% A0 {4 c8 Y
    if [ $dbglimit -eq 1 ]; then
0 I. a1 n8 `. v8 f2 i        echo datasize hard limit: `ulimit -Hd`
, Q$ _3 x& U# f6 z2 ], `: b        echo datasize soft limit: `ulimit -d`0 T7 P$ p7 S) x  R  }8 l
    fi
) r% ~7 d& d+ b4 Y' b}! v, U7 j: T: P5 s# S* p
2 ^' Q& i4 t5 f5 D) Y' C5 K
#6 f; J- W4 b1 @4 Y9 \. }
# set stacksize limit to desired limit2 E: V4 v( ]/ d' @/ j+ Z; a
#
6 a# a9 u5 J: M* C. C. cset_stack_limit()7 u2 T( ~! H; x; Z0 J
{
: b  ?6 E! U$ z& C% z( Z7 _    dbglimit=0% b+ s' n/ T, m: p2 F/ O
    hardlimit=`ulimit -Hs`8 Z" `4 }. B/ n0 I5 g9 T8 L2 Z7 M
    softlimit=`ulimit -s`& K' G& o0 f  E& g8 H  h
    desiredlimit=60000% W0 O8 Z0 v1 K8 s
    hardisunlimited=0
; n( Z# s+ e, c7 L# y    softisunlimited=0
' a( X6 w+ I. K0 m) s1 J    is64=0
: J( z8 ?8 e& j! f
! s: @" w+ ?: {% g2 }- u    case "$EPIC_ARCH" in9 L" B! k7 e! M4 o5 c0 @# J
    *SUN*64)7 X& }  }5 j+ P$ a1 H% R
        is64=1
5 y" B; `4 J; |$ [) {        ;;
7 h7 y' L) N1 _6 U0 p' H    amd64)
/ k5 E  n$ f3 q- V# Q  K0 {        is64=1
: |: b& _$ B2 O# q& ^8 s2 f        ;;: z6 z! L" q8 m
    x86sol64)
$ l  |# F, p/ j( K2 i8 z        is64=1
; e5 z9 k- o6 U  q3 G+ X        ;;3 M1 n' z/ N# e% w9 M
    aix64)
) |) T2 A! _6 P7 Q, h        is64=1! X& ?6 R; n: i3 k3 h3 \
        ;;
5 Q+ g- y# ^: N& b2 N8 }    suse64)
! |# t$ H0 n7 U        is64=1; I$ b9 Q+ o2 }3 s, ~4 A
        ;;8 R3 F  `  P) a, n1 S( u/ ?8 ~
    esac
1 U+ q6 |' {. V( S) \1 g3 I4 S1 _! `% G  L) ]$ d! J. z9 m" I9 Y
if [ "$EPIC_WRAPPER_DVLP" = "" ]; then9 s# D' s# ]/ M4 {' v: S+ o0 B, T* z
    if [ $is64 -eq 1 ]; then- P) r! ~1 d" x  Z/ ?: D! u, g
        desiredlimit=200000% G; N1 V7 I. K$ z
    fi
" E. H& M* z* M' P% Y6 J) p2 _  qelse
* N3 Z0 K5 O$ i0 }5 l    case "$EPIC_ARCH" in
4 Q5 l. y8 P, [    *SUN*64)
5 o6 G9 N& c% J7 W# y: F        desiredlimit=200000
, L5 H. Y' Q: n( q1 S- ?1 T        ;;
) a1 h% b0 C# V. w2 S5 M    esac
0 ~$ T% X/ a" u5 f: J& M4 Y* }fi9 u* B, E& o" \5 B; F
        " @& k" b2 Z! Q/ r% q- t/ q) q
    if [ $dbglimit -eq 1 ]; then2 @% B& S$ s2 l. E9 f; j& H, K
        echo hard $hardlimit soft $softlimit
2 i$ K* X' s, _! J$ t" k2 {    fi  `7 A0 |! O: |5 Q  A

: M0 ]" m% z2 F8 p: B    #stacksize can not be unlimited, pick smaller number
) O4 D" s) _2 o, z* U' B- X! r% X3 [  R% G$ [# x8 @2 n
    stacklimit=$desiredlimit$ F  d3 r) o5 O6 E, G
, y' P& G' Y0 x) H! P
    if [ x$hardlimit = "xunlimited" ]; then8 L% `! z) L5 V* W0 d2 ^  ?& d+ D
        hardisunlimited=1
" _& [. Z3 M# \% \# H* j8 F    fi  h. u  c) h3 @7 ?- ~
% T& a* Y1 ~$ B5 h/ ]* u
    if [ x$softlimit = "xunlimited" ]; then1 e! B! ]$ k$ m% W# T# a
        softisunlimited=1
' V; f$ Q7 {) e    fi
; O) d/ l: o: M% Q3 A% Y# w* O5 ]5 \! x) X. [6 x/ ~* D
    if [ $hardisunlimited -eq 0 ]; then
3 d# o0 n$ X$ }' N        if [ $hardlimit -lt $desiredlimit ]; then7 T& k5 F0 Q0 f/ N
            echo "WARNING: stacksize hard limit $hardlimit K is too small."  D: [" L8 W6 L- ]" K% F/ J
            desiredlimit=$hardlimit1 r0 d. G7 i8 U
            stacklimit=$desiredlimit3 d1 e- j3 l" n* s1 S9 P
        fi
4 ^7 m, y. s& W: l0 O% M    fi5 M  Y; @/ q) U0 i

$ y/ @, t; R4 ?% J    # desiredlimit is set to proper value (< hardlimit)
2 P# \2 G9 R  C
, n5 Q& ^, b7 H/ h8 c0 W5 g* R    if [ $softisunlimited -eq 0 ]; then
/ `# P# p* J! ^+ u, T        if [ $softlimit -gt $desiredlimit ]; then% f; [# F# m6 E8 x( m' e. X
            stacklimit=$softlimit
& L, n5 e6 I& W% C        fi
1 X! n9 }0 ?* V    fi* n5 b: a. ?: A* e* u4 e; h
& @5 m& {( H* N- K( i7 ]; p; K
    if [ $softlimit != $stacklimit ]; then
! L2 R3 G- }! [- b7 `4 I, W        ulimit -Ss $stacklimit5 w5 w* W5 `$ P. W# d- A" z1 @
#        echo "WARNING: stacksize limit is set to `ulimit -Ss`"
4 f/ ]! z; w+ B1 a    fi
, D1 x) M! m2 E1 ~* G- Y, F, F) A, ]' ?& A" V! p
    if [ $dbglimit -eq 1 ]; then
; W$ m0 T% k6 M& B2 }5 B        echo stacksize hard limit: `ulimit -Hs`+ F4 \) u! x3 q
        echo stackize soft limit: `ulimit -s`" T2 n6 D" u- o) O! X. K
    fi
; O+ n1 l/ Q: E, Q: G  `}
5 w/ x( U2 @! r' r, ~
6 @7 {& ~& |1 W- O; q  Zopen_epicscriptmessages()4 \: _* R4 U( r% j$ N  g: X7 H/ _
{
9 K% r/ l1 T4 R5 s8 M#generate  temp ".epicscriptmessages" file based on pid2 c- m( E" K* C& Q* P3 _6 [" a$ ]
EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$5 {# |" Z: |: m& [8 C
if [ -f $EPIC_SCRIPT_MESSAGES_FILE ]
5 Q( I  x$ R7 m6 ]% f1 w. a- Rthen 9 r, a: Y: {) M% _
  until [ ! -f $EPIC_SCRIPT_MESSAGES_FILE ]- l% m# S# Y. b% ]7 b) {; z
  do
, C- }/ G& m* A    EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
4 T8 m- E: x8 `/ ?7 C; \% \8 K# S  done, ~$ I9 K* X, L5 o/ A! x% @
fi0 d4 E/ Z0 o2 i
# D4 r! c2 s( D8 D3 e+ x2 H
export EPIC_SCRIPT_MESSAGES_FILE
& R$ ]8 d  N/ ]) T  i9 q}
1 h6 p- Q9 W+ y9 w8 ^* X2 D/ ?/ e% ^! q. y) @  P2 L

' D0 \7 B8 m3 N6 R: a/ u& Acmdname=`basename $0`
2 h4 a! z  ~! E+ ~4 v3 w" q- A/ opostgres="n"3 O$ Q2 t3 {+ L2 p3 W
ostore="n"" A. n( G5 ?, j  s! z0 ^5 Z
gui="n"4 k2 R% o/ R' x0 H; v
databaseOn="n"% q- L4 W; r9 l
f_next=0' ~* I8 Z1 K  g4 q  r1 `+ n3 e, u
f_option=""
, N3 ^% P4 L$ b) c/ |o_next=0
* U3 n: ?/ a5 y6 @+ go_option=""9 |: B6 R, m6 E# W
workDir=""8 w5 X: B* c. y% Z0 K
workDir_next=0) P* R1 R2 ]9 J3 D' u! F' P0 a
errFile="powrmill.err"3 T; A1 ~, r4 n* u. p5 d
win32flags=""
5 t: `/ G# Y0 v' d. {* f- @3 gln_default="ln -s") `% u: b, V5 r2 j1 t
0 L# Z7 \" ^3 [9 u3 ^2 W
har_hilo_file=""2 _& w1 `) D% h  z% m9 C/ o
have_har_flag=0
& `" d9 l+ J- T6 b8 [1 rhave_har_setup_flag=0
7 e; x% |% i: e. _) ~% }4 t' j' V1 sis_special_har_run=0  T6 |* d" v) a, e
har_ofile_prefix=""8 x! X( E! e* f3 g. P

+ [& t0 a" F) k: thave_va_flag=0- D) X) G1 B/ K9 U/ Q
have_vaf_flag=0
5 O& ^8 W0 X0 e1 r. OVAF_FILE=""
% {" d' N: M& H; F$ tVA_FILE=""
$ V7 h- ~+ o* s% R* MARGV=""' j" U" k; e# ?& U6 N! Y# R

  L" s2 B  |! W9 b1 b) S$ @ORIGINAL_COMMAND_LINE=. R" s: a& ]% Q5 A6 {5 Q) O
LOOP_CTRL_FILE=".ns_ba_env"$ s6 |. _# k% [9 O9 I$ _( z
ALTER_HK_FILE=".alter_hkf"4 U2 a1 O0 L" a* |) u3 ]# G
ALTER_COUNT_FILE=".alter_count"( G2 L8 c' Q, P2 B1 a; }
MONTE_IMG_FILE=".monte_img_f"6 w, ^) m" m. x/ f- o
MONTE_COUNT_FILE=".monte_count"  q% U+ o$ I2 G5 ]
MONTE_CFG_FILE=".monte_cfg"
2 e8 V' E% p. h  f% w+ e" DEPIC_SCRIPT_MESSAGES_FILE=".epicscriptmessages"
, f% e" s7 U, H; j
0 `7 w+ N* r1 I) i- Yopen_epicscriptmessages $@2 Y( ^2 P6 m# u& W2 z
8 ^' H" B7 P7 j2 }1 R3 r7 W
scan_for_hva_args $@
1 A1 B6 f3 [# ^) Q- [
6 y! d  Y4 k1 W* v& |scan_for_har_args()
% h5 O( q* }. T# |8 L1 u{5 G1 H6 U, ?. j" _8 }' t, }. b
  while [ $# -gt 0 ]; do+ j8 Z8 Z8 P. A4 e% t' s! K, Y' H
    case "$1" in
$ j5 o" p! C5 Z! q$ j, N      -har)2 X6 S$ V: v4 O! t' S' A
           have_har_flag=1
. v0 E( W1 c1 ^           [ $# -gt 0 ] && shift
- K) `( B3 I7 \3 J/ C* Q0 C) T+ F           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then
! |3 W9 \3 B9 _9 _( \/ n& y, J( I             har_hilo_file=$1
8 ~" [3 D% g5 V/ G6 Q4 q# U             shift
  R, y1 E6 f& e5 p7 x7 d           fi
9 K4 L# e- m9 n2 v4 C' G           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then7 o$ m1 m$ w2 Q) w% I
             echo "Too many arguments to -har flag. Only one hilo file allowed."3 e. M+ L/ a! A! L( S' B6 F1 S/ ]
             exit 1- l1 G# G/ e6 w8 M$ b: F& I
           fi' n9 h: Z3 w$ K+ l* D8 @. @
           break  W3 N9 m3 c5 C, g( P! L
        ;;, s, M$ g0 s* d, R% B8 G
      -har_setup)! }$ J7 k% M" I+ e
           have_har_setup_flag=1# N, C0 ]/ e( c3 t0 Z+ v4 |3 I6 J
           break
" b' l6 [+ ~! {; T        ;;
7 w# y! M4 L( H6 h7 c      *)
4 X" W+ q$ A, h5 o. L+ u+ b9 F        shift
9 l! }0 a. _8 i: T# i; F6 E8 C        ;;0 @0 i+ d- E: Y* r& M) ?7 b% b
    esac
% @- A; Z% v+ w" g# O/ J2 Q" s  done
( z# t, g6 ]$ k. m6 K+ u# x; i. a}
5 r' ?* |& |, o
! K5 Q9 X4 B; G8 H8 fscan_for_har_args $@
2 n; v3 |3 X: t; e  N8 U, T$ R# ]. {% Z, Q: _! U8 m: `! J
for argv in $@; h  d; o& R0 p2 M9 J' I
do( Q. Y7 p* h4 C# d+ A
   ORIGINAL_COMMAND_LINE="$ORIGINAL_COMMAND_LINE $argv": \  A' n8 O" J9 c
    if [ $argv = "-gadb" ]; then
( Q3 J# z8 v( l0 v& y        databaseOn="y", C3 J; g2 ^' l3 M% V- P
        workDir_next=1
" _% [, u1 u! ?    elif [ $workDir_next -eq 1 ]; then
  h% U8 P: @7 K8 j$ L+ p7 q        workDir=$argv! F3 W7 S, f7 G/ i4 Z
        workDir_next=0
9 B, X5 n/ O! ?; ]) n8 x+ v- ]) [    elif [ $argv = "-ga" ]; then
: j( @# x- j: P4 s0 E        gui="y"
9 u- X2 ]. e0 _! {% d0 E    elif [ $argv = "-f" ]; then4 t' a) J9 B$ N. g8 K
        f_next=1
1 v5 f. d: l+ N$ I/ A8 a    elif [ $f_next -eq 1 ]; then
! P- h4 V+ w' a9 _3 e        f_option=$argv
3 w" F( D* t; p5 ]- W+ l% N/ d        f_next=0
) t* H5 r; K) E" C) ?4 }3 v    elif [ $argv = "-o" ]; then
. B. d# c* F2 H. Q# y4 P' L        o_next=1, t% _* L- b6 M, B+ |2 N
    elif [ $o_next -eq 1 ]; then
% |1 \. m# e9 I- _- E        o_option=$argv
" s% \* S+ N: s, l, U6 e- r2 ^        o_next=0) M0 w7 Y2 L5 ^1 H1 ^6 O, @
    fi% b5 @) k' ^' T( M+ w" J$ b5 m1 u
done7 h( s+ B) t4 y5 w& g2 b
echo "Command line options: $ORIGINAL_COMMAND_LINE" >  $EPIC_SCRIPT_MESSAGES_FILE ( k; k) k$ f$ l3 I# o8 k% A

7 i1 I( E- g1 h( v! Mif [ $databaseOn = "y" -o $gui = "y" ]; then
8 g8 r( r' N( X4 ~: u  if [ $cmdname = "pathmill" ]; then- {& s; X% B! a1 A* t' S+ W
    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5"  -o "$EPIC_ARCH" = "SUN4_SUNOS_5_64" ]; then! K' Y/ E. m5 f7 s) m1 ~0 w  ]7 E
         ostore="y"! Z" v5 R' h& F* t  }
         postgres="n"2 `7 V; Z/ Z% |6 p( n
     else* }8 h  f! V3 e/ n# |
        echo "athmill GUI is supported on Solaris platforms only" 1>&2
# Q9 j0 L/ j+ t' c3 A4 G; C        exit
; A! F  n: N# a9 i! @     fi. O0 W+ z' g8 g& e  |- a  Z  ^& ?
  else, g+ b+ U) f3 T5 t* k$ y9 I- _, m
    postgres="y"4 a+ L& _3 R8 Q1 g
         ostore="n"3 i9 g$ {4 Y. w8 S
  fi4 F3 }  K9 q. J( X+ |. l6 ]
fi  P, q, p4 d( x% m
+ w+ S$ W: t" r( E  [
if [ $gui = "y" ]; then* p& p! _. l+ p/ @- u) n- M
    if [ $cmdname = "powrmill" ]; then! G5 [5 E6 B# E. R. }. {
        pwga $@/ X# O5 V8 X. D( Z! z
        exit
! q) d3 Z/ i3 h0 ~7 Z6 l    fi
* j2 F4 b! G- S; A& o6 R
0 @- z) n* D5 J6 U0 {    if [ $cmdname = "pathmill" ]; then
' B! Z0 e& C6 ]& m* g        if [ $ostore = "y" ]; then  G0 C7 U8 [) T1 V2 P% q
           ./pathfinder $@
3 d, T# x$ u! O$ v& U/ @6 q           exit% X  T# L' f0 s0 E
        elif [ $postgres = "y" ]; then
" A) k$ b' i- J/ z8 Y' o           pmga $@
( o% ^: R* C) X           exit
& K! A, _* `3 R2 M        fi( m! F* w5 X6 ^% v2 P! v- J, @
    fi2 S- ?' \$ V/ J, w: g
fi/ w) b3 `: c5 `0 |

2 H6 F; U, ?7 J2 }, u+ Lif [ $databaseOn = "y" ]; then
9 I  k2 A9 O+ M5 }1 r   if [ $ostore = "y" ]; then
+ j# [6 D$ `: s7 B: B1 c! Q3 [      if [ -z "$workDir" ]; then
$ j% F; x9 W  b, r         echo "Error: Missing argument for -gadb option"+ E1 n6 L3 k% G4 S8 V1 \& y- S
         Exit 1! V' [" m) J8 {5 T2 q
      fi
- `, M+ D& M4 Y! N7 e& ^   fi. d; M6 D, ^& n3 i$ `! G
   if [ $postgres = "y" ]; then
% g6 w3 K1 j1 F2 l      if [ -z "$workDir" ]; then, Q- K8 r; j8 p6 n' s; n* j  \
         echo "Error: Missing argument for -gadb option"
3 F# H* i" \2 l         Exit 1
: d& t8 U6 M5 l6 {. @6 ]      fi
' a' B# u+ h; T( Q$ T   fi
! L$ v* r- L, E- |fi
1 R7 C6 g. l5 E3 ~* ^) C4 s% i5 S( Y5 y. C  m
if [ $postgres = "y" ]; then8 y8 k$ |) Q9 r- b- b* a; \
& m$ V$ d. M+ D8 x/ V9 c& w
    if [ -r $EPIC_BIN/scripts/gui-init ]; then; d1 |9 p" u  C8 k( x/ v9 V6 I1 A
        . $EPIC_BIN/scripts/gui-init
8 K$ K: E! w* N3 |    elif [ -r $SES_ROOT/bin/scripts/gui-init ]; then6 L2 L/ [; _. L, i9 u
        . $SES_ROOT/bin/scripts/gui-init) Z5 h; r2 c; Q- ]7 X+ E
    else2 D" \: b6 `/ G, w& U: ]. I2 `0 |
        echo " ** Installation in \"$EPIC_HOME\" has been corrupted!" 1>&2, D  @: |7 |. g- ?" t
        echo " file bin/scripts/gui-init is missing." 1>&2! L/ f+ w0 @7 P: y
    fi2 W! B/ D' c3 i3 M8 }7 `# K% {& i
/ w, m5 E  q  n, o% X, z" Y( m
    workfile -tool $cmdname $@9 ^- ^2 {5 t( x# q
fi
8 l+ G' n7 q7 i5 \1 b/ `6 O6 c( P! S6 w
if [ ! -z "$o_option" ]; then
$ T- X3 i* b- I, L) j  d; p    errFile=${o_option}.err
6 M# I) Y4 l% y  w% w* ]elif [ ! -z "$f_option" ]; then
4 D; {* b# y2 H' s: ]9 e    if [ -d $f_option ]; then1 r1 |; i0 u5 a7 X( Q% j. e
        errFile=${f_option}/powrmill.err
) t* \/ q; f0 @5 y* p- o: ^    else errFile=${f_option}.err
2 z# m$ M/ {* g) @' Y) |/ g    fi
2 `% p, A9 M. q& h7 H; dfi
, R- L) S! a3 t! t, j3 x  z3 G& K" a" `" `& e

1 T5 E) ]' g- I9 _& lif [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
! d+ V; w8 H6 a" B  rundir=.epicrun' Y) n1 j' P4 L8 F3 G
else: V% D: R( D% {; a3 C; C2 T
  rundir=.epicrun$$
! n$ P1 L. ^6 \& b; Z0 H% l) Tfi8 D. o0 `: _% J9 n- n

- i9 E. [) [/ s( j3 p5 Jlibpath="$rundir${EPIC_DLIM}$EPIC_DIR"  g+ R: V1 A% i/ ^0 c6 W* l

3 f+ }0 B) V, ?) T. ?# Zcwd=`pwd -P`" ], R& O6 O9 s# W# Q- W5 _. z
if [ $cmdname = "acehdl_w" ]; then, z7 e* R3 P% E' F- n
  cmd=`basename $0 .sun`8 I7 q3 `, O. ~, F9 c& T3 g
  cmd=`basename $cmd _w`/ L& X' }5 o2 b, J4 }7 ?! w
else0 r2 d  I: y9 q8 j9 v
  cmd=`basename $0 .sun`, Z* [" Q( `1 r2 H8 [. ?
fi3 ?1 `& g) i' f
+ d9 |7 L& v' j8 K5 U/ @& P9 [
command="$EPIC_EXEC/$cmd$EPIC_EXEX"
  ~8 ]: k% Z6 H  s1 q+ e  e& I[ ! -x "$command" ] && echo "$cmd: not installed!" 1>&2 && exit 18 D. t3 G+ P) t
: u# L) o" G9 w! Z" B; u
# buildmod extracts -u/-fm options and calls genepiclib
% r8 \5 V" R: }& B  _- F! J# It also set the remaining options to variable CMDLINE3 x* [0 }4 L) L
# look up in .epicrc for -fm & -FM parameters* A2 M' I$ F# b8 d+ T* s. B2 o
9 q4 Y; S6 C$ i( n# ]& b& D
fmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`"# W; A* S9 E% Z# t( H
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`"
( i5 B9 v/ U% t; c6 E7 f) V) {; D[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`"
% T9 u& _8 O- m+ [( q! [3 K
7 L( X$ q( v; G- {- g" KFMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`"
; a8 i! a6 b# u0 \" N" [4 ][ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`"
6 {6 H: J: C0 d/ i. q' v* p! v# x[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`") ~& {. p3 N; n4 G$ m6 |

9 n2 c) n9 p" t# ^* \if [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then/ f5 K: D2 I; Z( w# Y  e. {0 O
    # note that the buildmod script will set the CMDLINE variable
' x% o$ c4 N" |    . $EPIC_BIN/scripts/buildmod
" J( I, T2 }$ _" A- l6 ?7 P' Y" n/ f0 Z+ @5 p. [1 t
    #echo "This is the value of cmdline=$CMDLINE"  d  ^# [  o& I# Q, I1 j" C# J
    #exit 0
8 f% ]8 f) R  ]) s5 m' p' l
8 U: T. G5 E6 a    # if a new timemill/powrmill/pathmill built, run the new one
, ]3 g/ y' P0 l7 d# N    [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX"
4 t, I! j! ]2 a; e% zfi9 F, {, k) m$ `7 j! _0 p$ x& D2 Q

3 h( U6 Q3 W. B) bif [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then% g/ r: [" d6 P
  if [ $have_har_flag -eq 1 ]; then
4 ^& A! y: g$ v1 T    is_special_har_run=1
2 s. ~7 ~8 Z  w, ?, W4 t& I$ e) ]    if [ "$o_option" = "" ]; then# ^  w) Y: o% K! T
      case $cmd in. T: S( a( e  Z6 Y* ~! p2 b
        timemill)
8 t* M) |5 u. X# v          har_ofile_prefix=timemill
" \$ i. \! Z  f          ;;
6 T, k# c  s' v3 B        powrmill)
0 i5 W" i* Y2 k- O* p          har_ofile_prefix=powrmill
. H, ?4 c, T3 @0 R7 D          ;;, u/ ^) L2 e3 E% u5 @0 g( W
        nanosim): f  h6 M) [- ^, g  j
          har_ofile_prefix=nanosim. s% F" v; J* Z( [3 T
          ;;
: ~3 F% T' r9 S7 V$ {0 v) m      esac( O) T. T. D4 K% S1 I( W* P0 @) f9 P
    else- J1 z5 Z! K" C- \
      har_ofile_prefix=$o_option
3 V5 ^8 H3 R  u4 o3 _3 p    fi, U5 U% R- ?2 O7 T' p  ^% r+ u
fi: D' S) ?& d; @! R1 F9 H
fi" U  Z6 k9 y4 W# q

5 ~  ?9 `8 f# S  r9 G  {# Call Double precision version of the product if -D
6 x& i3 k6 j8 w, S8 r# or simulation time > 1,000,000 ns.0 k3 b" K" w5 w6 G4 X
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then
: r4 v- D* b, f, m; z2 d; m) {, A7 m$ [- E4 @/ o' u* N
  # Now the binary always has the ACE feature; P# @: G  D! a9 G
  USE_ACE=YES
# z$ n& o7 L" _
! y5 u2 N7 m) c& d  HAVE_DP=NO
5 G# P4 W' ^; d9 U! x2 f- U  EXTRA_CAPACITY=NO
! E( o$ e3 }6 u2 R% D  DB_REAL=${FORCE_DB_REAL:-"0"}; _1 E4 q! }- q( B

1 }" y# w- o& i) L" }  # Enhance for ACE ease of use
4 m5 {: s" W$ R% U. `$ B" O  # If no command line option or only a -T option, do:2 @  Q; Q( e* ]  ^0 L* c
  #   1. set -A option
+ @8 N, n8 H+ B/ w3 K' i" {7 z% }, u  #   2. assume input file to be hspice/ G3 W, K9 @: ~
  #   3. set -o to input file prefix
( w' k3 ]1 C% ~9 h  #   4. set -z to input file prefix
) |) k8 Z* }/ _, h7 U  #   5. set -c to default config file
; v, E4 G/ N. f" d  netlist=""
# O( J4 [4 `/ F  minusT=NO
" v, [3 O! d+ n0 {" U/ M% `  useStdCmdOpt=0
" j' R% K" q* c# f6 D% t: c9 P  prefix=""1 u' r. |5 p7 q0 x% e7 E
  circuitType=""3 b- w4 D9 X* w  C
  for opt in $CMDLINE$ H7 e. }( g) v' Y$ c- b' r/ w
  do
! M2 J2 u% c+ z6 V/ U    case "$opt" in
: I4 e; _# l! k9 y6 ^: T- U: ?. l      -T)
% a- u7 [3 B+ B" G. e4 C% s' q        minusT=YES; F: Z7 n$ N, L. V+ [# j+ ]
        ;;
  D. r5 Q% j( H. B      -*), y* a9 f: a' a
        # using standard powrmill command line
$ K! O+ ~. b9 P8 e$ @- b        useStdCmdOpt=13 V4 n- U" b) @3 A# h/ i' i0 \. B( o
        break
4 Q" {, c+ R" B3 |; f0 a- F0 A        ;;" l0 A$ W3 U7 u2 p) G; B! d$ F) g
      *)/ K! J! Z9 j5 P+ ~: q
       if [ "$minusT" = "YES" ]; then8 j( `+ \$ z# F/ F  `" Z
         circuitType=$opt
: \) f, j' J% X, f' F& x$ u         minusT=NO  # reset flag
) Y5 w! u& u6 D, @3 t       else * E! h- V( X% f4 _# q6 }; ^
         if [ "$netlist" = "" ]; then, Q+ S+ P2 O3 @1 E' ?
           prefix=`basename $opt`
, n: N/ N4 k! G1 V9 n" c           prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix`
9 s+ G$ G+ v! s; Q1 ^0 w         fi. B* q7 ^0 w( A9 k% k
         netlist="$netlist $opt"
2 S$ M0 f) V, k8 r% J       fi
+ G; U0 l( i$ @7 m( W: \. F       ;;
; }# f, f" A( V# q, d    esac5 K; ~( |+ m" j) ^$ e9 v
  done6 ]5 a  q& n% p. n! E

9 t8 S/ [/ k( Z: U
( ^; c7 {, I- Z7 [  if [ $useStdCmdOpt -eq 1 ]; then$ A* \5 N: Z! U, G% G4 N% J
    # use standard powrmill/timemill command option
/ e0 V" e$ H/ I+ g# t9 K' l) o1 |! G    for opt in $CMDLINE; d4 @8 X1 y. l* B; Q# W
    do
; W7 j' A" @8 L" \/ V5 w! O5 h7 m) w      case "$opt" in 5 j6 p4 i% u' ^% X& M
        -A)
( z: k* S) Y' ^8 [            DB_REAL=1
! Q: t2 r  u2 ?            ;;: `$ G' ~( }" H+ {4 M' v9 f) d7 M5 I
      esac; e, |6 ]$ e* h+ P- d- x
    done
  c/ |5 c# d7 {- `9 Y    if [ "$netlist" != "" ]; then7 ~1 c0 M* N" E4 c$ U
      CMDLINE="-nspice $CMDLINE"! w7 ]) N* N: D; y9 y2 m9 Y
    fi: `' C5 e* v* D' d! x% _% c
  else, O/ J+ y5 P* }% U  y
    if [ "$netlist" != "" ]; then; c  ^4 r  q$ }7 f6 ^7 O# N. }
      EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"}& s. w, Q, M( L% B0 m( S
      # construct new command option
& P' n. t! F" A- u0 {& u      if [ -f $cmd.ini  -a  "$circuitType" = "" ]; then# Y$ z7 ?3 s9 F" X
        CMDLINE="-nspice $cmd.ini $netlist"
& L" K9 P2 }4 T5 l      else( v9 j' A# ?$ x$ ~& J4 L  r
        if [ "$circuitType" = "" ]; then
4 ~) `9 R0 x8 u8 n+ T1 ~          circuitType="msana"4 N" N8 o- P1 r) s
        fi" ^: g1 A( b& A: Y  H4 T
        CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg"4 C. I0 _1 y' f+ z
      fi# z! Y3 P6 Z4 u  ?; d; _/ f
      CMDLINE="$CMDLINE -A -o $prefix"/ s( F; @' ]  O+ q: R$ H) Z
      DB_REAL=1# C0 r$ c4 ^# d! a
      echo $cmd $CMDLINE: }6 e" C* Z# C' z- `$ q! X
    fi
1 E' m* Q. Q5 J& F$ X  f' j6 n  fi& y  i0 }0 v/ x. v
fi # cmd is timemill or powrmill or nanosim or railmill or pwarc! w0 R7 }* t: l

" C0 c! V4 C8 C5 d1 W[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a"
- F+ ~& d0 U9 S% Y8 |" i; a[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a"( B3 h/ U' `) K, u7 @2 \4 W
[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v". W. q. N; x' V' A6 d
0 r) w9 {2 P8 _) D( y
if [ "$__engine_wrapper_called__" != "Indeed" ]; then6 l: b5 m5 ~7 M
    __engine_wrapper_called__=Indeed! v1 H# _: C" C
    if [ "$cmd" != "amps" ]; then
6 {( {. j6 _* }2 }& a, B1 C: N        export __engine_wrapper_called__- M8 S8 [, H3 F* Q
    fi
- `5 k$ O9 J5 W/ k" T
- o7 f+ Z4 l  J( V+ @    trap "cleanup" 00 x* k, w- k1 A1 n+ O+ V2 @2 S: X
    trap "" 2
' t3 a7 b( ^' z% n# L6 d
# b+ v8 X7 U) \5 g( Z$ F5 U1 W% V    [ -d "$rundir" ] && rm -fr $rundir6 C- a' d) H5 O: g4 L* k
    [ -d "$rundir" ] || mkdir $rundir
$ P) Y& d# K9 a  G/ r; T2 X+ P- j+ Z% m& r
    case "$EPIC_ARCH" in
' I' T8 g- a) _- V3 m' x7 l2 t    *SUN*64)   
3 |( z4 U; R2 o7 N, C& ]        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
, k" f& ?) Y8 S        export LD_LIBRARY_PATH
3 F  t7 }$ d2 {* O        suffix=.so
8 R3 l0 N" t' P3 B( _3 Q( G7 A        ld_err_code=127. v; R' p; y& k- z6 P( z
        ;;2 s1 a# E% N1 X" O! e9 D# a0 m& j
    *SUN*4)   7 x: m$ @3 S8 Y$ p
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"6 P3 [2 W" t$ ~. F6 m* _
        export LD_LIBRARY_PATH
- a* z. \" M& Q5 y        suffix=.so.1.0
, z( m" p+ h; l3 {0 m# f        ld_err_code=127- o0 }/ F3 i7 j/ t* o* o' t( i
        ;;
& x  A2 E: g  y. T+ G    *SUN*5)   
9 z2 Z+ F, ~8 s: w$ G$ C% n8 k) ?        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
+ o3 B, t0 L$ k+ b5 `' V$ Y. `        export LD_LIBRARY_PATH9 z& F# h3 F+ M. g) c
        suffix=.so' C" r$ k' i2 ]4 F7 J. D
        ld_err_code=127
- X! V! G. w" r" K8 u        ;;
0 [3 G; K- C. d! Y' S    x86sol*)   & j; y; t3 a9 \7 Y0 P' L
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
& O0 R' Y  ^& c" G4 B        export LD_LIBRARY_PATH
' {$ M# x% i4 x( \$ O        suffix=.so! o0 ~' H% z& P
        ld_err_code=127, k# j; b8 k" j3 e$ l! D& v- j
        ;;
5 D/ c$ ~& f7 i) P( M! J6 J    *AIX* | aix64)   
7 W- V% ~! \/ V' k        # When genepiclib creates shared objects, it creates a import file and - Q! `/ O7 c4 V2 T
        # uses timemill as program. So at exec time,program timemill is needed ; B6 ~) G& ^& n: ]* Z  ~4 r
        # in LIBPATH+ G$ V/ W5 {3 m8 {9 d7 i
        $ln_default $command $rundir/foomill/ W* n% M0 S5 l' J; F
        LIBPATH="$libpathLIBPATH:/lib:/usr/lib"
$ z- i. h/ n# i) U3 C; m, M        export LIBPATH
3 f, T- s; M( m3 d/ J7 W        suffix=.o4 E3 {8 }8 Z7 p2 ^  s: R) n1 y! A
        ld_err_code=8
- j( x& q% i8 H- w+ M        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
5 E% C2 Y5 _8 I8 [7 l6 s9 L9 ?          tdir=`echo "/tmp/d"$$`
! G( Y/ J: e5 f  O& D% \          [ -d "$tdir" ] || mkdir $tdir
  Y! p- M* A3 N& g( l' {# a          if [ -f $EPIC_DIR/libCustom.o ]; then* m  s: d- e' z: y! f; I  r
             cp $EPIC_DIR/libCustom.o $tdir/
* J" ~; n/ X0 Y) B$ z             $ln_default $tdir/libCustom.o $rundir/
2 x. l: {% f  l! [6 t* {          fi
. p: T' ^7 r4 K; J7 t& E$ w          if [ -f $EPIC_DIR/libModel.o ]; then
9 b7 k$ _5 u0 L( w2 s. d* ?+ W8 T             cp $EPIC_DIR/libModel.o $tdir/
0 a) ^# {5 K" ^1 O  C             $ln_default $tdir/libModel.o $rundir/, |0 I$ f: R% ]$ g% a/ m: t! z
          fi/ t( H5 C* p  t  b+ ?4 B4 [
          if [ -f $EPIC_DIR/libFuncModel.o ]; then/ u* j* d+ Y' _+ p7 D
             cp $EPIC_DIR/libFuncModel.o $tdir/# ]* R5 |( \% }0 m7 s
             $ln_default $tdir/libFuncModel.o $rundir/+ `( @- \: M; A, k! j
          fi
  G( g8 H- |! _# l1 Q. N+ j1 p# B6 \          if [ -f $EPIC_DIR/libFuncModel.34.o ]; then$ p# b- Q. n- P" `8 {
             cp $EPIC_DIR/libFuncModel.34.o $tdir/
) w' k  d4 u0 n& \9 u6 J! K; ?. y             $ln_default $tdir/libFuncModel.34.o $rundir/
. L6 {% W& ]) F! S3 j          fi7 Z- e5 M" n/ q( m
        fi, M, L: u0 ~0 [4 S: ^  |+ L) p+ _/ Q! G
        #Set the IBM flag to enable more shared segids
# p6 i4 k% x& |/ g        EXTSHM="ON"$ [# X2 q# u  \5 K" p3 n; o; A4 Z
        export EXTSHM8 ~( D. l" P7 C- G4 q1 b
        ;;
2 O: P9 z: J' b3 K4 [: F8 R    *LINUX*)   
6 I! G7 \. L. Q- V: t        suffix=.so
" W& p4 y! E+ H        ld_err_code=1
2 U" [! @( i+ b5 P8 v        ;;7 p- P& a" @. V8 q" k
    *amd64*)5 G8 u7 q" @; D# `; ^) S
        suffix=.so( N/ ~, h( K$ I9 u, Q2 F
        ld_err_code=1
- M0 x  _3 w8 h; d6 J5 {7 N        ;;
+ F+ Q- B0 H. \$ p    *suse64*)
' E1 @1 A- F) u' \! t        suffix=.so3 q7 W: J$ ^. `, ?" ]/ c
        ld_err_code=1- t, m5 s1 t  E/ Q/ h! a- m
        ;;
! r3 g1 T; c9 O% K' H- C$ C    *suse32*)    ( {( p4 O& V) t' H5 `' c' Y
        suffix=.so9 ~% A2 w" w1 ~. S' O
        ld_err_code=1% a& l( f/ H) S  I; d+ M
        ;;: e4 c2 F# e# v3 `6 X) o
    esac
# y; ^# g1 A) J; e% ]1 ^! R! d- C$ f4 F
    [ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix"
8 n2 t# Q, T+ e( ~! e6 D# R2 Y, m- Z    [ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \& j; B6 \6 l7 ?. J
        && [ "$cmdname" != "nanosim" ] \, H1 V7 t- n) `, S" y, _5 {
        && [ "$has_model" = "YES" ]  && ulib="$ulib $cwd/libModel$suffix"' Y  T+ O! Z! M9 J9 m: X2 c1 z+ I
    [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix"
  t6 G( O6 [1 y, V3 j! c3 q! ^; v6 i/ `: ?
#Look for command line option for libFuncModel.so! Q: Q" R; {3 W
#    user_library_next=0
: R/ m/ O5 R: v    has_fmlib=""
( [3 o2 ?, n8 K8 {; D% C* U% c    for opt in $CMDLINE
$ l4 }1 M  {3 O0 ~& {1 E% _- \    do* f- s% A* r. d- }7 ?: j: B
      case "$opt" in 3 I/ l/ Z  n1 q8 m
        -fm)
- @% r4 D  v2 c* r7 s            CMDLINE="$CMDLINE $cwd/libModel$suffix"
3 y2 R2 p' u0 M9 M            ;;6 p$ v0 T" H1 E* |$ w& J
        -fm_user_lib)
. T% W, E, U3 V/ l. F5 _# A: D            has_fmlib="YES"
+ ^8 r2 V+ `, u. u1 Q#            user_library_next=1
- w+ Y! @$ Q, U" a" L5 A$ u: V            ;;
1 q, X2 T# b) f( b4 I7 q+ G. F        -xc) 4 B4 g; @( ]- ^
            if [ "$EXTRA_CAPACITY" = "NO" ]; then7 i2 Q6 C) R4 z' O0 Q
            EXTRA_CAPACITY=YES! y: i* S3 n% s8 w% ]" {
            fi
+ q, m4 N0 `+ T6 n' y9 `, T            ;;
5 C$ b& D" |4 u& o" j, N1 O# ~#        *), q' `) i1 V, G
#            if [ $user_library_next -eq 1 ]; then5 H9 _3 u% y# a6 b5 Z; ?4 y4 f
#                if [ -f "$opt" ]; then& c, o+ P9 o# e
#                    libfmodel=$opt
+ O  @- q# ]9 B$ U" y0 T#                else
" p/ {# V: Q" D$ r0 w#                    echo "-fm_user_lib: Specified file not found"  t  S+ ~7 E' t7 b" t
#                    echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages( s! w5 q0 ~# |6 u7 R+ d8 r
#                fi' ^' |) l$ T! O+ N. n
#                user_library_next=0' ]4 P+ u4 |: s  z# e6 v
#            fi. @1 ]& \! }  \
#            ;;
2 F2 O+ [3 j7 [! F% p6 b/ s        esac
- n8 Y6 ^, ~9 b, J1 ^8 T    done
8 @: O$ ?# S8 `8 \% j: k; N
# a1 o, `" |" ~; `8 y8 g4 m7 c    if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then3 o6 [& i/ }5 }0 r* l" I: J& i8 g1 b
        flib=""
6 B, L+ }% A+ L        if [ "$has_fmlib" = "" ]; then
* J1 {+ b3 ]* M+ }            flib="$flib `get_epicrc ./.epicrc user_libraries`"
% f* s" u' _8 q, c+ ?            flib="$flib `get_epicrc $HOME/.epicrc user_libraries`"# o/ E  `, Z) ^- B
            flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`": u% `! {0 i5 D
        fi# t4 W0 g$ ~' s! J0 `1 H
    fi
0 j: x3 D( [: Q! r* m9 y
( M$ C5 ?0 T) A+ W8 n   for i in $ulib7 S' ^# k( F5 T0 B! P; E, m7 \
   do) H4 s6 f/ P1 g, R2 }
       [ ! -f "$i" ] && continue" J4 u4 P& U' i, |6 ]4 X+ u
       dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd0 O9 e8 ^8 V  z  F, Y4 T
       i="$dir/`basename $i`"
! ~! {, K; C5 Y7 M9 I% }0 M. Y' ?# `       case "$i" in) o# @# T4 c( i+ t2 f
       *libCustom$suffix*)    [ "$libcustom" = "" ] && libcustom=$i;;  ]. h1 s3 C: i$ K" u+ H$ S5 J
       *libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;;
( l; E, V& l0 X) g3 P       *libModel$suffix*)     [ "$libmodel"  = "" ] && libmodel=$i;;
. E* f  N( u8 v0 R       *libva$suffix)         [ "$libva"     = "" ] && libva=$i;;
+ n% T& w( I' i1 a7 R       esac
  ]9 B' {# Y! _6 }. \4 @; R       [ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \
$ V( l$ Y, [# T) d2 H; Z        && break  f& ^/ b. k2 \
   done
# C0 `. G5 V  h0 u( ]$ Z' {& L! B) P7 o7 O6 z
   # symbolic link shared libraries to .epicrun$$* E" Z9 V( L: Y; c/ v7 Y
    cd $EPIC_DIR; epicdir=`pwd`; cd $cwd
4 F4 A" W3 i' U" G    if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then# V/ g' F+ H9 F0 T
        if [ "$libfmodel" != "" ]; then
9 o2 ], R( k( x3 l" {& S             [ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \
% Z/ v! [$ F: b2 S             echo "Using $libfmodel ..."  && \
- `; I! r! B$ `& M( T) F             echo "Using $libfmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE
. x0 [! G- O, y2 h3 o1 q9 A# [: @             if [ -f $rundir/libFuncModel$suffix ]; then+ K% |4 d. @. \, Q6 J+ g4 n
               rm $rundir/libFuncModel$suffix
$ S/ [( i5 ~4 Q7 t$ ~, u9 @, R             fi( b9 N8 k+ a# b
             $ln_default $libfmodel $rundir - `% q$ Z1 t( X2 b# \, W: o
        fi
7 D0 H" k# B7 F% L1 t8 P        if [ "$libmodel" != "" ]; then8 z; t, P4 i# J% C
             [ "$libmodel" != "$epicdir/libModel$suffix" ] && \
' t; Y. u- o' X9 M4 A% O             echo "Using $libmodel ..." && \
! U0 y* P' Q+ V             echo "Using $libmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE7 `# h2 U+ C' |% F/ {: R. y6 ]9 E
             if [ -f $rundir/libModel$suffix ]; then. E& E8 S3 o1 ?; p% w3 G
               rm $rundir/libModel$suffix
/ m7 W5 h# E1 n! K             fi; R2 p2 Y% y: d1 u& Z8 z0 @
             $ln_default $libmodel $rundir # e$ I; V- U- Y) l
        fi; X& n" W; C* @2 c! R1 R
   fi- P8 U+ n4 D  D- O$ z! d+ N1 O
   if [ "$libcustom" != "" ]; then
5 s7 k! Z4 x% b! {5 s2 K$ d        [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \
  h4 f) S9 p5 ~3 M        echo "Using $libcustom ..."; C0 T  m& C& S1 Y$ y! [
        if [ -f $rundir/libCustom$suffix ]; then2 g, N% Q. d# f" \. \
          rm $rundir/libCustom$suffix! w5 k; N$ C: t
        fi
2 h4 D6 R7 _( W* w: }3 [        $ln_default $libcustom $rundir
# r& x3 `; `2 z   fi
* x. Q8 ?0 P+ H2 P! W4 k$ I4 S+ k6 c& R6 d
   if [ "$flib" != "" -a "$flib" != "   " ]; then* R- u3 z. i7 k. H
        CMDLINE="$CMDLINE -fm_user_lib $flib"
" s9 ?" u5 i' m; v+ T& Q; I5 a9 s   fi; i% C( Q: l0 F  H, g- D& A

+ L: S2 _' v7 |' s8 H   if [ "$libva" != "" ]; then
9 v) i) \7 G1 {: K: k  w& @% L: Q/ F        if [ -f $rundir/libva$suffix ]; then
  j# v. l6 E% v1 t, h. _6 N2 V          rm $rundir/libva$suffix
) s* C' _' k& f7 J        fi
2 |4 |8 j7 ?( K/ R8 U# u1 y        $ln_default $libva $rundir ' Y4 V% l1 ]$ Q
   fi4 g8 c6 o: A* E
1 z: r0 I  Z% q# s% i, e

$ K% v* `, z% X) @- L" Q    # VCORE design library
6 I( ?7 \: P& O2 q2 e) c    if [ "$vlog_design" != "" ]; then
; M6 ]! J) D, S) d. W: \% ~        $ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`2 `; x0 x. v: t5 l4 u7 p
    fi7 j2 ^5 E8 _9 |( ~9 X+ p2 e( z

6 _7 u8 W9 v: s2 z: V    if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then5 Z9 C  Y" @" }  T0 c
        EXTRA_CAPACITY=YES, f% l; Q- `6 L  V0 w
    fi
/ y8 [3 f, j' y$ W0 A3 ~% Q' p, b# H& ^* `/ P
    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc"
" r7 F3 K- F/ |6 _0 ^+ M% n! [    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc"
4 Q! U2 S5 S6 d" Y- J2 i    #Create temp file if dual process is on* L; M* E2 w. C# Z' X8 U# q1 Y
    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then
* U# B2 r8 g8 F# r3 `, Z( ^" e  J        if [ "$EXTRA_CAPACITY" = "YES" ]; then
: R" P& {' M: k0 V" r            touch $rundir/rpcidfile
/ |: b# i# R& Q: v  O$ S/ S) w        fi# @/ B/ c* ]6 A( [8 I( w  J
    fi, o# a" Q$ y' `9 Y# ~9 y8 O
fi6 v, i0 h  A' r* N' L
+ Y2 Y% ^# d; i6 \( [
run_cmd()" V4 d" r- S$ B
{+ k; O  K& B4 ~( u$ D. M' |0 D
  command=$17 [# R: V0 ~: Q+ _: T
  shift6 y1 }4 Q3 R( [; `

& |1 ^" p* R) O  \' [# L/ f7 R. V% f  if [ x"$VA_FILE" != x"" ] ; then/ H/ V5 O9 s% i
     cmdline=$ARGV) [) u1 n3 A. [( r& ~' Y: ]
  else
7 p. a  t  @9 q     cmdline=$@
1 t" S' P2 Q% s% i# ]6 K' O  fi
1 r& }  M" R3 \( _( \( F2 B( Z
1 s1 a( {7 J; n' F5 ?( H  debug=${DEBUGGER:+"$DEBUGGER $command"};
7 I& I. H" T  y' I5 v4 c7 |: J0 L$ x9 O0 {$ d8 {
  # To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a, j9 u( N" q/ F* T# d1 j, G
  # so save-restore may work.6 \7 R2 U, q6 v# l
  setarchStr=, {; a7 O8 m/ {$ a
  cmd2run=`basename $command`
8 p  G9 w2 Y  r: E# P; q5 h  if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then1 ?3 l/ d5 q! ?& A# H$ I6 l
    if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then5 V1 n& h+ o( E- f& y* i
      setarchStr="setarch i386 -R "! ^2 Y* H' J3 F( z
    fi# _, t* a  s* g; l
    if [ "$EPIC_ARCH" = "linux" ]; then9 K* N7 `; B" W/ R) E4 Y  r
      setarchStr="setarch i386 -R "' m/ r) y3 L1 g1 d  b8 a* H5 Z
    fi! ^2 h6 `5 b: ]0 B4 h
    if [ "$EPIC_ARCH" = "amd64" ]; then
, x0 F1 s0 {$ _, N+ q* C# v7 t      setarchStr="setarch i686 -R "
6 b* J2 {4 F8 o, y    fi
+ Z* D, N" P0 u- ^2 ^$ C0 ~% W    if [ "$EPIC_ARCH" = "suse32" ]; then
/ P+ `2 R/ q9 M/ z      setarchStr="setarch_suse i386 -R "
* a% x( U* m* I    fi
7 p3 ~& M7 W' L    if [ "$EPIC_ARCH" = "suse64" ]; then* @0 s- i- @  C& I6 \# b
      setarchStr="setarch_suse i686 -R "
! N8 i; ^; `4 c2 d' b1 M  Y9 a    fi
8 i* ]" c. T2 `. X7 j! J  fi) S+ ~; r9 x4 `6 y- Z+ L
7 m+ v; J8 }0 g$ Y
  ret_stat=0: M5 y( `4 Y; D  i  ^7 L
  if [ -x "$command" ]; then6 S6 o/ F# H1 G* _7 Q- q
      if [ "$debug" ]; then
0 j$ j1 j/ a, |& n        _debug_args_=$cmdline
3 j5 r9 n# B9 L( g        . .epic-debug
9 F! H9 ~# }* ]* A  [( J      else; p' ?0 u+ r  C9 w
        DEBUGGER=; export DEBUGGER
6 r8 w5 _1 `( ^  c' B        $setarchStr $command $cmdline
* z- k% z0 H' @# o      fi
' G- f7 @# h, F      ret_stat=$?. G& N2 [: q9 u2 i6 e) {3 t
  else6 U  x0 K- T+ r2 T
    echo "Corrupt installation, executable \"$1\" not found!". k  ~+ c, L% b) z- f2 F
    ret_stat=1
, c% P: N' q  j2 A' |; z$ r  fi, x; y& j. n; {  v
}/ m- ]$ M1 }; c! d& V3 Z9 Y
: y5 f% D: }4 V7 S* ]
# keep runing cmd if ctrl file exist
& O9 B3 e& ~* m% G
6 U4 C( i, ]# s9 y* Y" M5 u' Brun_loop()% @1 O4 a, _/ e2 ^/ Q) v5 c
{% I" Q5 L9 L5 e2 A
  command=$1! \6 ^+ U4 G& b% [6 A3 r% d# I
  shift
" E# c  d' r7 ~. n  i7 ]
: h- R% l0 B$ s4 |. r' I  if [ x"$VA_FILE" != x"" ] ; then
$ [" ]- _/ x& k; c: T     cmdline=$ARGV
) L8 W5 E3 W* O2 A9 ~6 u9 ~  else4 G' v1 C5 V- G2 G1 W  D6 j
     cmdline=$@
: W# b( [& x! m# d2 a) ^* J& t  fi( N  o1 y$ n- l/ a3 I# X/ j0 Z  M0 d
5 W! I: N' p; w' Q) g& U7 ]
  while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do! Z8 l. a2 z4 X8 u4 _3 {  G
    . $LOOP_CTRL_FILE$$. Z7 V& I  `" X1 y+ W  f
    run_cmd $command $cmdline -banner 2) [$ A: E: \# f1 L& m6 b
  done;  g- _# v, F9 t) o* r4 v5 w

/ v' q* G) S+ {! \; B1 J  if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then! ?. c4 f7 |7 A4 Y, j
    rm -f $LOOP_CTRL_FILE$$
5 R3 h- T- z, J0 g8 N  fi
! V( H, b0 H3 \4 _8 w}
/ i* {7 j% F9 X5 O7 {' d  Z$ G
4 ~# o5 H# W! x# N& ?har_check_ret_stat()
# b2 @3 t, Y9 }7 B5 b{
9 m/ e1 s8 S1 K& R& a8 \1 ^  if [ $ret_stat -ne 0 ]; then
5 \6 `) ?) j  `% B& b) z, V9 `8 {    echo "Simulator returned with non-zero exit status. Stopping."
2 ?4 o+ l8 e$ h# Z5 f    exit 1- @  t" Q) w' b3 n
  fi9 m4 P2 ~# _. X$ j% c, M
}3 B9 g. w. J. `5 p" D0 s4 E3 ?

8 J2 {6 Z6 C, i. ^#  e3 B8 y6 C- d- L5 ]; R, f( v
# set stacksize and datasize limit! \* V1 C) L( c0 R5 ~
#
1 X1 u% {: G; n+ f3 Y2 ~& b
; w9 e$ H$ X$ r. Y/ E* |* xset_data_limit
  Y8 ]$ ]8 j- Y0 k2 s# cset_stack_limit
) M/ E/ @# K$ N& j9 P+ {$ U6 H: v1 N+ ~, X
#rm -f $LOOP_CTRL_FILE+ t  m0 B" K8 q

/ @! o+ K$ m1 h2 Lrun_main()/ f$ W6 D3 w7 P' Z
{( ~9 V  H) r0 m6 [0 R
if [ $is_special_har_run -eq 1 ]; then# p  z' T1 H9 n
  if [ "$har_ofile_prefix" = "" ]; then
- D% O$ x/ |) k1 L# I! O( N    echo "Wrapper bug. Notify Synopsys technical support."
# [6 p4 v& v1 l% s* |" w8 J    exit 1" q9 g6 v6 v+ v& j/ S6 b+ x
  fi3 ?* h  a8 j1 X! c. s+ D, v- F
  if [ "$har_hilo_file" = "" ]; then
8 B/ e" A5 X, r( Q1 _% X7 [    # no user specified hi lo file - do both runs
+ b( v' ~3 q- @    run_cmd $command $CMDLINE -har_one -har_setup
6 p6 d; ]- g& @! c) j    if [ $ret_stat -ne 126 ]; then
/ \" j. n& c2 i3 }2 X      har_check_ret_stat
  R$ G5 y' q# m      if [ -r $LOOP_CTRL_FILE$$ ]; then
5 z- {" X* V  [1 u3 A5 R        run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl
. p7 H7 m( w2 K$ G% F5 k7 w        rm -f ${har_ofile_prefix}.hl
0 M2 a6 i2 z$ {* h$ {      else
. O8 B2 w$ y, d1 e- M$ o, y        run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl
3 V' I  |3 J3 d2 u      fi# D7 B: w- `7 }8 ]4 q
    else# ?) ^8 ^! x/ z
      ret_stat=0" @3 L4 T4 I; v4 _& g7 l0 ^* B
    fi
  @( C, B3 a, B  else
6 ]6 q$ r! b- u+ O; d2 t    # user gave a hi lo file name6 u) \1 S! D0 m1 x' n  j" h
    if [ -f $har_hilo_file -a -s $har_hilo_file ]; then
, C' D$ B0 h( N. E# H' p( R6 f( t5 \      # file exists - use it - only do sim run
' M5 J  ~' y4 n4 Z- Z5 _% r      run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}
! d3 q+ a' X2 }/ p      run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}  v$ W" ], E9 Q; h! ?. |
    else/ F1 p. E+ A1 M1 n1 e
      # no such file - generate it - do both runs& J; L6 Z! b8 w, O0 K! D
      run_cmd $command $CMDLINE -har_one -har_fnf -har_setup7 r/ J% _/ L9 ]% M- l% i
      if [ $ret_stat -ne 126 ]; then
' n) E+ z8 A3 P  l4 r# Y) j        har_check_ret_stat+ R& k) J, H7 o: U7 C- r7 r
        if [ ! -f ${har_ofile_prefix}.hl ]; then( i8 W6 q4 s! E- b
          echo "No hi lo file generated after setup phase. "
, n2 P/ S: J2 K          echo "Contact Synopsys technical support."  U7 E  q$ Q# x0 Z( k0 l
          exit 19 x2 d$ j2 r' q- V2 j$ z
        else
4 R: Q* n) J2 @, G. h- E          if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then
$ Z/ ]1 C% w& X  V; [            mv ${har_ofile_prefix}.hl $har_hilo_file) N# s; p( @6 i% c( H
          fi+ y3 a: i# y& k4 C
        fi! K4 O5 f* k7 P+ O( y
        if [ -r $LOOP_CTRL_FILE$$ ]; then3 ]& \3 R( K% ~, S0 W1 y
          run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file
5 P( ~, g! p! o9 A( p' w7 z, i3 u( x        else: [+ d4 `3 ?2 M7 r
          run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file
: n& {, j& e  v# _% p8 M  e! a. U        fi
) `1 g+ s' k0 V; u. N' Q      else ! j/ g% X+ @4 Z  V6 B( j# p# c
        ret_stat=0
8 R3 n5 k1 n. L- p4 X# r      fi
+ B* K3 v1 c' U2 k    fi
6 ]8 L* P" ?2 z2 v  fi0 ~# w" x' J1 P0 h- G% l
else  
: A8 [8 b$ I2 z. k" ?& l/ g# y# don't loop if -har_setup- i& |! b$ R/ M; L: @- _+ q
  if [ $have_har_setup_flag -eq 1 ]; then/ Z3 U9 v: x3 z$ m+ H9 T7 W8 v
    run_cmd $command $CMDLINE1 M, a0 I$ f4 X
    if [ -r $LOOP_CTRL_FILE$$ ]; then: q5 E: K( m) b( B' b7 u
      rm -f $LOOP_CTRL_FILE$$
$ R. n( Z% g/ x    fi  A: c6 c8 S& j( V
  else
" j+ m; ^- o/ ?; k/ Q    run_cmd $command $CMDLINE
3 H. f3 Z+ C5 w6 u1 q    run_loop $command $CMDLINE
/ v! M% T- j( ?" ^8 Y& S' |  fi. [" i: C: }' O8 u- Y
fi
9 h0 I( b" M' B2 F" S
, n0 T0 H) V  O/ B2 y% ?: p, Jif [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then
2 r" f  g6 H9 I! x( R  pwCreateErrDB -w $workDir -e $errFile  b6 q+ ^  }' C+ p
  ret_stat=$?+ m; T4 \/ ^% p1 c' s4 q
fi5 b3 s. I) G8 a1 a
}
! h* z% c* s+ u0 B& ?& J& y/ |4 k. q( ^) N( j
cleanup_alter(): Z# g. \5 U* `& f: r
{
) s& m, `  M. D$ ?* a( T  s3 m6 n   /bin/rm -f $ALTER_COUNT_FILE 1>&2
4 m& {' s" B. m* ?, \; Z   /bin/rm -f $ALTER_HK_FILE 1>&2
2 m! h6 z  |0 m% A}, A) a; g5 P# y
; i- d# X  P9 Z1 _
#generate alter temp files based on pid
  P+ A* h* T8 Z9 P6 H. KALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$; b! L, R$ u1 P6 w
if [ -f $ALTER_COUNT_FILE ]3 L  i. y5 ], n2 k$ f
then
# W. W) t4 |3 C  until [ ! -f $ALTER_COUNT_FILE ]8 X4 Y$ n; A! v* ^+ h: e
  do: C3 q4 P9 y) K. O4 y1 I
    ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$& T  _/ v& n. ^" e+ |
  done
1 z. G, X/ `* Z4 i, Wfi
4 E. J' i% h& l* }- ?7 Xexport ALTER_COUNT_FILE/ C6 f9 c* ~! K- ^0 ?. o
0 q  X( K- f5 C  w
ALTER_HK_FILE="$ALTER_HK_FILE"$$: B* i7 X; `9 D0 [8 ^4 @( \4 \; o
if [ -f $ALTER_HK_FILE ]/ I+ q5 `$ c! P$ S( e" C, _+ b$ X
then
% V9 J# F1 E+ c* {3 G  until [ ! -f $ALTER_HK_FILE ]& N# |& o( [; N8 r( D) Y( N
  do
, g3 C1 U2 ?$ t# c) j, b    ALTER_HK_FILE="$ALTER_HK_FILE"$$
% _3 o5 }: a5 v9 Q  done$ D$ @  @' y2 n: a
fi
7 d* J+ S' t  s6 h! hexport ALTER_HK_FILE
( D; O0 [6 m9 ^! U: }, H6 _7 C1 [, f
#generate monte carlo related temp files based on pid2 G" W8 _7 N- X& U& g# d- o. q
cleanup_monte()& Z2 l7 L) I) L# s: R; p
{
5 M1 B# @. W1 P6 O   /bin/rm -f $MONTE_IMG_FILE 1>&2
' m! g" [3 h) i, Q   /bin/rm -f $MONTE_IMG_FILE.gz 1>&2
) G6 s4 [9 e6 [1 F: w" _   /bin/rm -f $MONTE_COUNT_FILE 1>&2$ B" u! S3 B2 i/ [, q6 d
   /bin/rm -f $MONTE_CFG_FILE 1>&2
' X3 }9 D" V2 h3 e: @/ {' R% B4 Y" t}
- z2 j/ _- b1 r0 @, W! _( c% `7 O( b9 ~7 J0 L) C) E4 s9 p
MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
9 \/ J0 G( v7 Qif [ -f $MONTE_COUNT_FILE ]
$ [/ F! C; o& M  P( u' G& \then# k- J! N3 A: O% O7 I4 n& U  b7 y
  until [ ! -f $MONTE_COUNT_FILE ]
$ _/ Q% k6 D! `. o' ]* \2 V7 V  do
5 P/ }. d" j7 T  f) V  h    MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
4 E. I8 O/ E( ?8 [  done- p8 K/ T0 [+ x1 `# E
fi
8 T7 y9 P  t/ [! ?" Oexport MONTE_COUNT_FILE
2 d0 e+ [8 }* ]0 {5 |; B: U' S
( ?: G6 F- i% Z' G& p7 z! B( EMONTE_IMG_FILE="$MONTE_IMG_FILE"$$
3 d' B8 W1 p8 [. Y5 O+ q) P! i) Yif [ -f $MONTE_IMG_FILE ]. @  U# k  R8 b% V
then
* _7 J* V' H/ t: n- Z# q  until [ ! -f $MONTE_IMG_FILE ]8 N- K1 n/ x8 Z4 d5 Y) i1 i
  do
' v% H: P/ L$ A: v    MONTE_IMG_FILE="$MONTE_IMG_FILE"$$/ b5 g6 d( c) h; ]% D
  done% K! Y! R6 c) T; l1 j
fi
( _2 s/ p1 n4 f2 e1 j4 \$ ]export MONTE_IMG_FILE! D+ q$ ]: ~9 B& b9 ?% k) O

. _% I# i+ l3 i0 ~# S0 _% yMONTE_CFG_FILE="$MONTE_CFG_FILE"$$5 l2 O$ k5 O; x. V# Y! A9 e  W
if [ -f $MONTE_CFG_FILE ]& h5 X' o: E) x
then; m  F2 e9 m* F  L; M
  until [ ! -f $MONTE_CFG_FILE ]: k" p. I3 g$ U9 t/ S/ I
  do3 K; d+ `! P! x8 O& c
    MONTE_CFG_FILE="$MONTE_CFG_FILE"$$
% |/ V( f' j9 s/ E* Q  done5 ]$ s1 W8 \( E$ e( G/ A5 G* F$ p( E
fi
" E+ @- B, i' n9 u+ i2 q% k9 e! ]0 B% @
# main iteration
1 S( F9 r( }6 y% B% rrun_main7 p8 m. y0 T2 ~! m
) G, B- P' a& O) W" Y* g$ |
if [ $ret_stat -ne 0 ]
, K1 t% F2 H' W0 q% @4 m3 M8 Dthen
5 c- _& [% B+ R  I9 x: G7 v( U8 F  cleanup_alter
. B, w# f- k# [  cleanup_monte: L( X8 m0 Q0 \
  Exit $ret_stat. s' u) ]/ k2 M2 y  Q  H$ j; X
fi
6 H+ v; i0 ]# i* |+ Y( B
3 \  U8 z" v& D) j2 L#Alter related iterations
4 V7 G1 a) P0 F$ g
! D( f' G7 w$ c' q7 diterations=0
: ?4 c, M4 t- n1 F9 Fcount=0( m$ x. Z, L8 Z+ N
if test -s "$ALTER_COUNT_FILE"
* y( u% w6 E! W6 v# W- t& h$ Q/ Z3 rthen) q* a' ]+ B, }$ r+ U; f
  if [ -r $ALTER_COUNT_FILE ]; then
( G/ \# l. P6 c! j& ^6 N   exec 7< $ALTER_COUNT_FILE
' p$ z3 P5 R- I) G   read iterations <&7
9 c/ ]0 w5 a  U( r- T. | fi
$ f, K( j1 y7 M6 r: {% afi# d% R# h* j3 `, Q/ H
# O8 p& A2 Z. H# @+ Y4 y6 J/ B$ V
trap 'echo Program Interrupt; cleanup_alter; exit 1'  2) {+ k% |3 Q. N2 X' a
while [ $count -lt $iterations ]( C. s: P; h; m& {9 q
do/ B) ?9 l7 ~3 H9 Q' h
count=`expr $count + 1`, B! z; K6 p. S2 ~
ALTER_COUNT=$count
9 ~( L' _. W0 v8 ^/ b& F% q export ALTER_COUNT8 k! p1 a' r$ m8 j/ K  _

* ~9 t8 C6 D* _# ^) u run_main/ L  [! j  L8 G/ p' o4 R( l
7 N2 i/ `8 ]1 Y) J; G- V
done0 v7 K+ k" C/ m1 T: E7 u

: b, h+ t: q# m! p#Monte carlo related iterations' N5 z& W* @$ H
2 F7 m- {4 }9 `2 s4 t5 P
monte_runtime_summary()2 a! Z' e6 D$ ~! O' \9 r. q& H
{
: f8 n5 I( L# f/ x2 g% ]  keyword_1=real
7 z& [* o1 B, q5 Z3 \5 C  keyword_2=user8 r- y; i( j! H0 w% k' q4 |( u; H# ~
  keyword_3=sys
+ r) I* O$ l+ o) ?1 i- @; _  ofile_prefix=nanosim
/ F! H/ H4 v4 k, _3 _* M5 W3 \* \$ U% N4 X% o4 [( b: t( O/ Y* E
  if [ ! -z "$o_option" ]; then
5 u1 i" S/ L  c; c  V: W    logfile=${o_option}.log& n6 d& E6 w( z( @9 m
  else; t4 Q6 }# y' h8 n/ q& T
    logfile=${ofile_prefix}.log) }3 I! u* Z! m
  fi
! O! }' H$ T$ H# E% H! w! [1 i9 g% Y
+ W5 W/ ?  R) ?3 Y6 }6 s  if [ -f $logfile ]; then% H( y/ v4 o( \8 Y
    echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile      / h2 X% a# @% k" ?+ u' O6 q
    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
/ v& g: M' \: A" o( c  fi
$ m4 V& L- m* U5 Y- [}. A! J0 F$ [2 Z
/ _- h: q( N. f! R6 s: W
next_monte=0
) y+ v) n& ^  D. O1 scur_monte=0; D! o- I- ]( ?3 {1 T8 a5 h7 X

) D6 M; R) c" K$ W! C1 i- aif test -s "$MONTE_COUNT_FILE"
. f0 s! ^8 Q3 O3 a  U% Jthen
) w' S$ }! s8 d5 p& f  if [ -r $MONTE_COUNT_FILE ]; then
- h6 T6 r' {: U2 k   exec 8< $MONTE_COUNT_FILE/ ^' b$ ]: O6 u6 D4 Z
   read next_monte <&8
2 D0 e4 m0 c2 d$ I7 \# y0 \7 [5 r  fi
4 d8 s$ M" B8 @) c8 {fi0 \' X, Z9 B+ h9 s" G

) k' K  |- t1 L% y9 Ctrap 'echo Program Interrupt; cleanup_monte; exit 1'  2
, z+ K- b+ ~+ Jwhile [ $next_monte -gt 0 -a $next_monte != $cur_monte ]1 p1 k1 q" k7 a
do
& u2 C! P% \2 O( \" A  NS_CURRENT_MONTE_COUNT=$next_monte1 \% G: e7 c2 c
  export NS_CURRENT_MONTE_COUNT: K. A! m- c% r, d8 h

' ?  O  N) C! ~7 b  echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE6 r$ H% D5 C/ q/ U% B# d
  CMDLINE="$CMDLINE -c $MONTE_CFG_FILE"* f; N6 P/ D- s8 |0 w$ H- S
  run_main
+ t5 e3 ~2 Y  }5 |/ g* Q+ @' c" S3 a
  cur_monte=$next_monte) c5 I- @; \6 p3 C
  exec 8< $MONTE_COUNT_FILE
7 B/ s# z1 Y# }4 j: ~1 S; h  read next_monte <&8
1 h: o5 G2 d9 M) q" n* X6 Ldone! P2 G9 z: b" a1 Y" [3 y  U
4 u& Q" g& o5 G5 ]
if [ -f $MONTE_COUNT_FILE ]: M% O# R* e7 C+ Q4 B: z, v
then
# u; N: M% l- S' ]. o& |/ R  monte_runtime_summary
4 q  g- J& Z4 ^' efi
& {* |* a. [" Y3 \+ r( v' i  r4 n8 ]' g) {  ?- _
cleanup_alter0 I% s: N1 o! ]& C+ l1 o& O0 R
cleanup_monte
& n! y. C" `4 J3 e/ {' j- H4 \
5 _6 G! Q& ?% B: \; M, ]Exit $ret_stat
作者: jerryyau    時間: 2012-5-24 09:22 AM
nanosim有說支援ubuntu 11.10?為何不用RHEL5,這才是EDA的主流linux os




歡迎光臨 Chip123 科技應用創新平台 (http://free.vireal.world/chip123_website/innoingbbs/) Powered by Discuz! X3.2