Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

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

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

[複製鏈接]
跳轉到指定樓層
1#
發表於 2012-5-6 13:58:13 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
10Chipcoin
各位大大好:# [4 x7 B+ F* h  U4 Q$ c
                      小弟執行nanosim時,卻無法跑出視窗來,有個錯誤可是我不清楚該如何解決?問題如下
+ S& J- E0 x. s  ~' I& H3 S: v                      [: 113: 64: unexpected operator$ S- E, [+ y6 u. c& I/ \
/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim: 1: Syntax error: Unterminated quoted string
, a! p% D1 q' H1 k有大大遇過這方面的問題或是指導我方向去解決, 謝謝. : J% a" q- u5 r4 p! Y3 g; j
我在猜可能是這個檔案內的文字需要修改 但不知道該如何修改?! W6 _( K+ y% K0 R+ b
以下為/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim 的檔案內容:
2 I1 Z6 d4 k+ \1 G. k    #!/bin/sh  C: H; M8 \( e- {
#
- s( _) q3 y% r7 k# t) |1 C# Copyright (C) 2001 Synopsys INC
2 e! y0 @0 e0 L4 [& B# EPIC Dynamic Simulation Wrapper (DSW)
) O4 B" N$ s+ G4 Z# h+ J#1 Z; H4 x8 u2 ~( P
eval ${DBG_EPIC_WRAPPER:+"set -x"}
* j$ C' Q5 u$ h( E$ l# x9 `- {( S2 k3 B
if [ "$EPIC_WRAPPER_DVLP" = "" ]; then! q/ \4 [& m8 |8 T: N: x
    TEMP_ARCH="$SES_ARCH"
: A# k$ G8 \" `" |! Helse
6 k* V! \' Z- D  {# S; L" m    TEMP_ARCH="$EPIC_ARCH"
+ B# @" ]% J1 D* V# \) Y4 Efi) k" N0 `, d1 d3 ~: @6 I
9 s3 v0 ~! N1 D
scan_for_hva_args()
# A, m. M% R  b  }{8 `  a! f7 m' Z- n/ |( y
  /bin/rm -f hva.init 1>&2
  q/ K5 }+ V3 y5 ~/ A  while [ $# -gt 0 ]; do
0 i9 A* M& i; w. `# W    case "$1" in+ G5 k8 |5 t. X0 x
      -vaf)
$ F% z2 h. x6 Z7 {6 D& l           have_vaf_flag=1* i" e  p% }! C4 v& ~
           have_va_flag=0
/ P3 `* J1 \2 Y% o           shift;
* X& s3 y- z6 l' j0 K1 P           continue;
! W+ p: n! P8 v6 S% e& o) E        ;;
! G& k/ C- ~) F1 X: ~$ B: O8 M  \      -va)
: T# f! O6 z+ S- T           have_va_flag=1# o& U% W  a4 I# F3 X
           have_vaf_flag=0( ~5 I% G* U( x+ w: m! q
           shift;6 Y5 O1 `. r' {, O3 _' \' w
           continue;
2 t& H8 }8 i; b        ;;
+ }+ ^" ~9 V! t0 f! i      -*)
9 ?9 d- k& t4 Y" L/ L" W" Q           ARGV="$ARGV $1"" O7 q5 _( F- L/ |
           have_va_flag=0
0 F5 ]3 g1 D6 ^( V+ i           have_vaf_flag=0
$ @, D+ v8 R$ a! b5 ]& k' X* d& C  u           shift;
$ a; `( p/ l* X& t% ?5 x           continue;' i) }4 z3 r0 }% J
        ;;$ j$ n- D! p7 f. U
      *)5 o3 V$ ]7 F: M# j1 I/ B
           if [ x"$have_va_flag" = x"1" ] ; then
( _! X9 J) P" [2 ?, _              VA_FILE="$VA_FILE $1"; r( q8 i. d# Q* l& S
           elif [ x"$have_vaf_flag" = x"1" ] ; then . `; L% c- |! E3 b6 @! Z$ L) l) g3 b
              X="`cat $1 | sed -e '/\;/d;`"
' l' S( p* X) T) D9 c1 Z              for token in ${X}; do
8 O2 N% Y6 F5 Q% j0 N2 O                 VA_FILE="$VA_FILE $token"
4 Y% E3 f8 s( }4 \              done 1 F# {! q% C( j2 z
           else/ B! a0 m. e% C4 R2 m
              ARGV="$ARGV $1"' n) R+ _1 S0 W$ ~* K' g! @9 A
           fi
# E/ S& [0 k% R8 Q9 g8 v2 @           shift;5 n+ p9 c; n$ s6 I- h
        ;;
9 D0 Q6 H9 o2 K5 P+ Z1 b    esac
% `3 k* @7 f1 k  P8 y. _. ~5 \; R  done7 Z8 F5 }. g2 ]6 S1 i5 ~: G

0 ]8 a' t( a% r& }) o  if [ x"$VA_FILE" != x"" ] ; then
) s) C% c0 ]1 [) g##     /bin/echo " xxx ARGV $ARGV"
# o* C8 [; t' p% f- P       /bin/echo "choose nanosim $ARGV ;" > hva.init% V1 @2 S9 \" j! _  s: O: I& h
       echo vcs +ad=hva.init $VA_FILE -o simv
# R. {7 w. I  m4 h. ~/ F$ L       vcs +ad=hva.init $VA_FILE -o simv0 F2 y* A+ m$ T$ l/ K3 t% P
       exe_status=$?
4 L! O; o' H- ?7 C: x% ]       if [ $exe_status != 100 ]; then/ P) _/ p0 z3 `0 q0 n5 e
          /bin/echo ""1 T, X7 o9 }' m( [" ^% n
          /bin/echo "ERROR: Execution of vcs exited with code $exe_status"
6 G$ Z: M" A. X* K, C8 _          /bin/echo ""- n3 Y  @; H+ b2 S" o- p
          exit $exe_status
1 U2 @' D5 c0 U- C# d       fi
, Z! E+ D/ X- i2 E1 }       hva_files="-n simv.daidir/amsVD.ntl simv.daidir/amsWRAP.spi"
' k$ n$ o6 h" v1 B       ARGV="$ARGV $hva_files"" r; h& ^$ n: @& O6 b/ H
  fi
3 o( `+ |7 `" O, @}
. u# ^9 d8 L) P7 T# I" U#-------------------------------------------------------------------------) s" V4 c! W5 y6 u$ Z, ~  ]4 n6 k

4 J+ K9 C; a$ Z- Icleanup()
2 C; X$ V, J/ o{: Y# c9 z3 x  u) ]% y1 u
    if [ -d "$rundir" ]; then8 X) a9 E+ b' p, j6 S
        # On AIX, a .nfsXXX file is created if libModel.o is removed
( Z5 Q6 a" q( A( ?+ f1 ~        # so .epicrun is not removed because directory is not empty.# V; n- Y. e. `+ s2 \2 E- |% M
        # Solution is to remove it again if the first rm failed$ h' k( c0 ^2 x* Q
        # (rm -rf $rundir || rm -rf $rundir) 1> /dev/null 2>&1
# t$ v" T! y5 i1 `1 e$ G0 V        if [ "$EXTRA_CAPACITY" = "YES" ]; then, w2 ]: f5 L) U3 k
        chmod u+x $rundir/rpcidfile
$ V0 Y3 u4 Z5 A        $rundir/rpcidfile- D1 b* }! g8 ?3 I  ]$ z" Z
        rm $rundir/rpcidfile2 |0 J! o  ?) V: {( L+ o
        fi
$ y' [( z: s% n* {! W        rm -rf $rundir( a3 B* u& P7 j( i
0 L. p( ]* B3 p: v' M5 H8 f2 y
        #Due to NFS problem, we have to copy files needed to5 h& ~' O  `" N
        #/tmp/<temporary directory>, then symlink's files- [1 T4 |& A* H( ]
        #to the local temporary 'rundir'. This avoids the problem
$ ?4 H. s% v; W; A% T        #to remove 'rundir'- L3 z. w& {# A. A! D* d: \
        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then( C, I; j  }/ V8 g  D" L
          if [ -d "$tdir" ]; then
4 H2 {# Y  {* I! p, d            rm -rf $tdir
8 j, M) C* C/ |( L2 K. F          fi9 s+ s' e; q/ l8 K
        fi" F0 g1 w3 H' ]5 {
    fi
/ [$ \/ i1 e* [) \- Q! l    if [ ${exitstatus:-0} -eq $ld_err_code ]; then. h3 J8 }# C" \4 n. B0 G  r, P5 v
        [ "$has_model" = "YES" ] && rm -f $cwd/libModel$suffix- J0 F: t6 {1 o
        [ "$has_custom" = "YES" ] && rm -f $cwd/libCustom$suffix
5 A! I* R% r8 I    fi) d5 x4 _0 W5 R0 k* J2 G( ]- \9 I
    [ -f "$EPIC_SCRIPT_MESSAGES_FILE" ] && rm -f $EPIC_SCRIPT_MESSAGES_FILE 1>&2; X9 w+ ~( {! D
    exit ${exitstatus:-0}
- Q8 `9 e) j( Z}( i, c% j7 N4 M+ D; M; _

1 e& Q9 c' m& }4 lExit()
% m: W2 X& v; r) Z{% h6 C+ N! T( Z+ d5 F3 ?1 W2 k
    exitstatus=$1
2 l8 i) A3 W( F( _7 h    exit $exitstatus; L8 h1 i  t0 S, ~
}& W8 _% d# o/ E2 m+ P3 W2 D
) i4 W; s: Z1 S+ s
# get_epicrc filename keyword6 |  w0 ]1 F( U6 R3 D
get_epicrc()! O3 Q+ k* _% f1 ?% ~# H' d$ D7 h
{
, R6 M9 S2 y& @5 b; N( X" E    [ -f $1 ] || exit 0' i+ k) L- W+ B0 _. ^: b$ w8 A
    key="/^$cmd2:/{print \$3}"
6 n$ q+ P3 {3 o8 F. P    awk -F":" "$key" $1
  ]+ ]# x! B$ {) i}
1 z& c3 n# W) ]9 B, s; G+ |& i5 I# J2 G6 h- l  c
#
2 h# |0 f! V5 w; _$ ~( l5 N# set datasize limit to hardlimit: _0 K( r; m# }) A. S
#
- ]% {' k! S1 b- [8 O* _% Cset_data_limit()
3 H, x% m! e/ q, f; ~2 V{  u$ A* i9 \; C5 W* g1 w
    dbglimit=0
0 z7 W, g% U5 W( [1 a    hardlimit=`ulimit -Hd`5 c2 R; I/ Q; {) ^
    softlimit=`ulimit -d`
1 e; Z, o/ J$ e* b2 X* B    desiredlimit=3500000
* k7 C& D6 Z  C9 q% P5 a    hardisunlimited=0
, r+ a' n8 I2 M/ J: p% M! M    softisunlimited=0
0 d. q/ V! a/ E8 O6 P/ ?    is64=0
# A, s' |, d. K$ ^- g4 Z) Z. x0 ^9 }
    case "$EPIC_ARCH" in
3 ], Y4 K# k* C1 }. [    *SUN*64)5 l5 R6 L. H5 }- \& [- a, Q
        is64=1
# [: g4 Z* J( l" u& W' j. F        ;;
1 F# U/ [5 S2 A  f/ V  z    amd64)/ W2 W! U8 F3 \- s5 u, m6 F
        is64=1
  v% a: A% D, M* `. l- V( s0 n        ;;7 m( m# h  ~9 Y" S& D$ [+ G
    x86sol64)2 k8 ?7 y4 p% J, Z" V- H" ^
        is64=18 B. }3 Q, u2 b5 W1 |: H
        ;;
: ~3 }: K6 ?5 b, R. _+ t    aix64)
  n3 B% V( V' N  e        is64=10 L4 L0 A; M, Z2 d, Z7 T( x, O0 {
        ;;
3 a% [/ R% ^2 g, o2 i    suse64)4 r9 S7 y  g; D1 {
        is64=1- o' d* N( k  u- t# \0 ]6 g: k  P0 y
        ;;( R/ H/ t4 J9 s1 K: v7 G/ B, [% }& U
    esac
; k' V( A8 R* W( `0 L5 ^  F: Z3 {* v5 i2 Z5 Y( P/ N
    if [ $dbglimit -eq 1 ]; then
# Y/ Z" B1 r3 b" i1 R* p: t0 T) Z        echo hard $hardlimit soft $softlimit
/ u' y. d/ U+ D    fi. ^" l: q  ]; R% l" e0 C
0 F* T7 L; I+ N+ r! ^0 D
    if [ x$softlimit = "xunlimited" ]; then% {2 f+ o- |  L. w& R
        softisunlimited=1" s1 R  F& v2 K$ F
    fi
' u: Q3 d* Y6 q9 I5 x
" h  c+ m9 F+ O$ N, T    if [ x$hardlimit = "xunlimited" ]; then
% a$ l: z1 Z) C' O" e' w        hardisunlimited=1& t' G! Q, B* k$ U/ V) p: y0 y; c
    fi
+ |2 O$ ~0 R) A3 I6 T8 b( ?% H- \* h
    # 64 bit machine should have bigger than 4G/ G: n" ]+ i2 `( W3 k  H
    if [ $is64 -eq 1 ]; then
% ^# N3 y* X+ K+ B, H4 g        desiredlimit=5000000) H( R5 ?5 c  c& K, j, w/ K& Z4 }
    fi( _6 ~1 I/ i/ {! |' a# x' h

/ h6 M: U& g1 z* s2 E    if [ $hardisunlimited -eq 0 ]; then
% u0 p6 k1 g) g4 Y6 q        if [ $hardlimit -lt $desiredlimit ]; then( f2 a( a+ W4 u+ |5 j0 v
            echo "WARNING: datasize hard limit $hardlimit K is too small."
1 w$ g" Z' M# E, L9 G# q        fi) B3 F& T& \! s# i3 V! L9 Q- f, |
    fi) j: W0 M1 m; G
8 J# C/ w, Z7 K* c
    if [ $hardlimit != $softlimit ]; then
  o* X) W4 E$ n) j  i: ^- g4 L        ulimit -Sd $hardlimit* r8 a. Z% g/ P8 G1 W; v. u  \4 K
#        echo "WARNING: datasize limit is set to `ulimit -Sd`"' f/ b9 p# A7 M! E+ z
    fi
* M2 b& q' ^1 ~8 J$ H& M+ O3 Y" A; Q3 b/ J
    if [ $dbglimit -eq 1 ]; then
' z& j  f  C5 E: w7 }) V" M        echo datasize hard limit: `ulimit -Hd`
: w! D7 z3 q8 j0 `- Q$ ]        echo datasize soft limit: `ulimit -d`/ |, |0 c$ I5 x' f
    fi) j7 f. N0 h4 h$ A+ l- g7 v1 ~
}
/ p$ S! g, L, K6 j* G6 @& M3 ?/ n# {. D6 P+ _' ~! K
#" ~9 r5 p1 T6 `7 B
# set stacksize limit to desired limit6 `  O& d/ i! X+ e7 c- y1 y
#
/ g  `# F, h! L3 Sset_stack_limit()
3 ~( p( v$ h; j0 M' d8 Q* ~{8 j" ~( q: [( g4 ?1 D0 [
    dbglimit=0) v8 w" o) a( m" w. |
    hardlimit=`ulimit -Hs`
4 `0 _' [$ _9 ]    softlimit=`ulimit -s`
+ O7 ~' ?8 e( C1 W6 l    desiredlimit=600002 h1 q! m1 M; u
    hardisunlimited=0
& j# P/ ~. n$ f& N+ [    softisunlimited=0
6 |% N' X0 n+ ~# g: R$ w    is64=0
  `% \' q  ?  ~0 M
: k% ~9 e( U$ S% n' e    case "$EPIC_ARCH" in
5 l: X$ E2 s; s. q6 y- ^    *SUN*64)0 \$ n; s0 K! c" d; K; n
        is64=1
5 O* x7 x) n8 L$ c: b% P; B        ;;
% c$ T5 f$ }9 _7 r3 ?8 P. P8 S    amd64)2 }) U2 g9 y$ q: E
        is64=16 z' q3 ?8 S! I# C& V$ l
        ;;
$ Y3 k, }* l, m! B# T    x86sol64)
" _. D$ o7 y0 P* M! }5 x        is64=17 m5 k& N  q" Y2 A9 y  L
        ;;
- y% s5 T9 o/ E7 H    aix64)! ]2 v* u; Q( `" p2 M4 ^- d: ]" A$ ]% o
        is64=1  v2 C& l  t  n9 m; u6 m- W  D/ u
        ;;
; W0 s8 q- I& C8 X    suse64)
$ W0 @. g- c' ^2 c        is64=1- V2 R: t8 K# S& @
        ;;
; Z. T( c* [2 x( R; B$ C    esac
! }1 H5 A& k0 C3 K! o6 b0 f/ @$ t
$ E1 I4 z9 m7 dif [ "$EPIC_WRAPPER_DVLP" = "" ]; then7 C+ h0 g2 `- E; J, C5 g
    if [ $is64 -eq 1 ]; then
8 }8 I% l: N! U$ F$ j7 u2 D        desiredlimit=200000
) e( z7 z' X. B( [& D" b- a    fi
& w5 m1 ]4 F6 b/ F$ Nelse
6 e7 p0 F& i: A+ T7 ~/ A    case "$EPIC_ARCH" in
2 x7 b* j$ O; M8 ~4 j& w) D    *SUN*64)
) D  d; N+ V7 o+ o7 n* N        desiredlimit=200000
- @9 b0 `: M$ `2 J) \) x/ W        ;;2 ?6 U& C& x" j0 o# s
    esac
8 R4 D7 Z% k" R6 x& Rfi
  Z5 z/ k" I, g$ q/ j0 N) [        ) i! L+ ?& h# H! w! d3 M
    if [ $dbglimit -eq 1 ]; then/ x# |, y: ^3 Q5 p0 K
        echo hard $hardlimit soft $softlimit
' m1 W2 I+ n- B0 r* M8 n: m    fi% I  k& n7 j' u' v3 |
& [3 u  \" P& S/ Q
    #stacksize can not be unlimited, pick smaller number0 i* |# m8 |3 a1 s4 H, v

/ {4 K( m3 y9 b4 o9 l    stacklimit=$desiredlimit$ H4 o% K" q% }. W

+ U8 N0 Y$ b) `: ^% w! D    if [ x$hardlimit = "xunlimited" ]; then6 d4 s+ Z: }: L' r) ?2 X, O
        hardisunlimited=1& j$ x0 {$ S* {/ m  K  h+ j
    fi/ b3 B1 W' m" d0 |* n0 m. U
8 t. H4 ~. F+ e
    if [ x$softlimit = "xunlimited" ]; then
: A) r- {% H" ~; y  z        softisunlimited=1
! m0 [( K, @$ A, k; F    fi! W1 v( l0 X$ J* X" N9 C

0 O. J# ^+ G/ J; \  g7 g1 J    if [ $hardisunlimited -eq 0 ]; then8 A1 }7 E; K0 Q% H0 w. E/ F
        if [ $hardlimit -lt $desiredlimit ]; then
3 N2 x3 D7 V3 N1 {, A            echo "WARNING: stacksize hard limit $hardlimit K is too small."3 F* B- ^5 Q( t
            desiredlimit=$hardlimit
) o6 Z$ ?1 ~: E0 i            stacklimit=$desiredlimit
8 S5 F3 g0 n5 y- q9 v$ Q5 ^        fi0 z7 w9 ]1 a1 o% }# S0 t8 _" d7 a
    fi5 k8 q+ z: \: V& c  S
6 x0 ^2 e) p$ B2 K  [
    # desiredlimit is set to proper value (< hardlimit)( S1 R  m# [* `/ \7 @

0 S# W% z( F% h) v* v- X* i    if [ $softisunlimited -eq 0 ]; then
1 k0 H/ {  w2 y. s5 v* S6 m        if [ $softlimit -gt $desiredlimit ]; then
6 W/ u" P' d5 h' x2 j' Q            stacklimit=$softlimit
% T+ L$ x1 T' E8 B        fi
, S2 ~& N( K0 M$ J6 _$ x$ f    fi7 \5 |) r' v2 X, @$ S9 z. D% A2 V
$ e( T  d/ y2 `1 ]  Q" K
    if [ $softlimit != $stacklimit ]; then% v4 }2 x0 P, d! g/ Y1 o  W
        ulimit -Ss $stacklimit
5 X$ s) D/ s% P( N! A#        echo "WARNING: stacksize limit is set to `ulimit -Ss`"
: g' A* N, R6 }) ^8 ]7 m    fi
3 Y5 }7 m% R1 T- a1 \6 G& I
- Y8 a2 N. R4 B! j2 [    if [ $dbglimit -eq 1 ]; then9 H3 v7 j1 Q" P. O4 @9 \+ W
        echo stacksize hard limit: `ulimit -Hs`" f8 W3 X7 o5 L; n/ i3 L
        echo stackize soft limit: `ulimit -s`1 S. d" c; z7 w2 r8 b
    fi
6 n& w; w, q" G1 W0 ]# l( U$ o}
2 j# ^! L- V5 I" O& E# H0 k3 C6 q0 \5 z8 R
open_epicscriptmessages()
, r2 P4 n6 v. a8 n4 q. e- l, P; E4 H{% d3 c3 i* d' E! @. _! F' E
#generate  temp ".epicscriptmessages" file based on pid: m7 f) J, z! A
EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$- Z% v8 i* ?. X' g# }
if [ -f $EPIC_SCRIPT_MESSAGES_FILE ]  A# s1 A: E- L' k, v4 @
then
9 u, p0 @) Y5 W* Q; u  until [ ! -f $EPIC_SCRIPT_MESSAGES_FILE ]" t+ \2 R, |5 u2 L; |6 z1 |
  do5 @9 k4 ?" a. G* B: f" b
    EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
2 }2 Q3 X+ W7 R4 R$ `  done
% h' f) E' W' z7 q7 E' v7 Bfi
3 B" G  G$ o/ }3 M, z
8 m3 L4 m9 n* [+ P" z3 Jexport EPIC_SCRIPT_MESSAGES_FILE
- ?: D2 ^/ x2 f* V2 r1 Z2 m}- Z* m9 V6 O; N5 ~9 I- {/ x# ~

' |$ ?6 g' C, ?5 ~- q4 A" h0 G5 C- }7 D4 y0 M$ D
cmdname=`basename $0`0 P5 r4 `2 h4 c6 p
postgres="n"
  w& v6 G3 {$ ?ostore="n"! ]" q( y8 w: l; X2 m0 N
gui="n"
% {: R" x, ]; s6 m+ [8 H5 QdatabaseOn="n"% y$ @4 ?. E$ P" X- L& W% y
f_next=06 d& n- G& [* o7 N/ V. @8 \
f_option=""$ n: Y! F3 o; B5 E, \
o_next=0
* G. L0 V2 c: Z4 x( F! ?0 Jo_option=""5 ?% w4 Z4 c6 R$ j
workDir=""
/ }, q. W, f; t% N# |: ZworkDir_next=0# _: q  n* L6 [9 ]5 h! S3 \2 P, u
errFile="powrmill.err"& \$ d- q& O; j% U
win32flags=""
% _8 M7 g4 d8 o2 g: _1 b/ D# s$ Nln_default="ln -s"
. o5 O5 S+ ^# t1 z' ?0 ^
, ?5 ?9 Q3 x# ]; k! B# v: X( Fhar_hilo_file=""2 I) C+ V: f$ X! |* J2 l8 p
have_har_flag=0
) G1 m8 p. z6 G; I$ u0 v! l# N; [have_har_setup_flag=09 o' [, Y9 H3 U8 G& e/ S
is_special_har_run=0
- i7 S# b) J9 C) \2 ^  X& nhar_ofile_prefix=""
- W7 N6 [+ A# }
! j; r! o9 `8 F5 |" p8 O) zhave_va_flag=04 z6 b# f3 D. T: x- a- q% ]. p% r8 w
have_vaf_flag=0# `4 H8 K, a3 q% N  C" v# g" ]
VAF_FILE=""
9 k5 r# v" l7 `. N! a+ {VA_FILE=""
4 D$ P* f( h# s+ \8 {ARGV=""
+ b% c0 j7 W  o& C$ |, ~" l, r& e  T- Z0 B2 p, t; i
ORIGINAL_COMMAND_LINE=! F7 Z; c8 u' ?4 ~
LOOP_CTRL_FILE=".ns_ba_env"+ y$ d/ W0 ?- Q  Q
ALTER_HK_FILE=".alter_hkf"
% n8 g8 M- Z: Q: IALTER_COUNT_FILE=".alter_count"! A" w" H  y; F+ ?
MONTE_IMG_FILE=".monte_img_f"' Y+ W* `, L1 z- [6 ]
MONTE_COUNT_FILE=".monte_count", N2 o' h0 Y9 W  `
MONTE_CFG_FILE=".monte_cfg"$ f/ B. }! g1 c4 d6 I
EPIC_SCRIPT_MESSAGES_FILE=".epicscriptmessages"
( ^1 t3 \( N& y8 R0 I+ V9 ^4 |( y3 h2 Q% B" |! i0 `  k
open_epicscriptmessages $@5 C0 K: I8 t4 y0 v8 M" s' Z  O

% }+ D2 F) J8 l# ~7 `scan_for_hva_args $@, O# }# j: n( A& {0 \
& a# x) @, c& D9 m, v& t: V1 z2 q
scan_for_har_args()6 q, J% L: s  Q7 q
{
( K$ s1 u+ K( _  while [ $# -gt 0 ]; do8 k$ k9 k; Q8 ?# L1 x& _0 d3 b
    case "$1" in
- m8 S0 c* @, R* h/ k6 A& \8 T      -har)
# @# K0 |. W4 k7 A! U9 p! W) S           have_har_flag=11 N6 g% @# U1 s) p
           [ $# -gt 0 ] && shift
% j0 Y3 G& M9 i$ O  v& q) j           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then9 e2 M7 l. o. Z
             har_hilo_file=$1+ @6 F, Q+ Z+ s* Y+ J2 `
             shift6 C1 ?, d# ]& I! @( g
           fi
* ?7 T' C7 H3 ^. Q% u9 ?) T& v7 B           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then
/ V$ e! C7 Y6 y             echo "Too many arguments to -har flag. Only one hilo file allowed."
: M9 o. Y, i# F! t+ D8 e             exit 17 ?; r1 y, |( H/ K/ e
           fi5 X! E& p7 B/ ^
           break
4 C2 R! }4 v) _        ;;% k2 }1 W2 U( Q% @3 H: n9 M! T
      -har_setup)
! R$ a& z" n: i( B: c" |           have_har_setup_flag=1
  a9 i! F5 r1 Q  p           break
# X( d% D6 z% L& z        ;;
6 M& C2 i+ [) K, R- j( A$ ^( Z      *)
+ n* W5 F' V1 q3 a0 v. P        shift
3 P" b& S) D' N; Q2 G; @4 l5 u        ;;
: n' D( \0 {0 G$ K8 ]. o    esac" U$ d6 N7 ~2 P- W3 A; ]
  done
9 \+ \2 I8 `. u% N9 R) O}
/ [" w: W8 d1 {% `9 H8 b3 X- C8 ^! y1 \+ C# J4 P( j2 p
scan_for_har_args $@
& g0 x) e& H% c8 P+ k. s1 |7 ^
' f% Q, @1 z5 o/ cfor argv in $@
  a& Y+ E( O% Ddo
; E  C4 s3 o: L   ORIGINAL_COMMAND_LINE="$ORIGINAL_COMMAND_LINE $argv": h" i4 r# ?3 B" r( P: y' f) ~* `
    if [ $argv = "-gadb" ]; then$ J) Y, y, \' }, b; j
        databaseOn="y"
. [8 h, {# w# x        workDir_next=1
9 d9 v( z& ~# m    elif [ $workDir_next -eq 1 ]; then
/ T9 }, i" d% A$ G' T3 Q        workDir=$argv% m3 G# k8 q7 c# X; h& B& B
        workDir_next=0/ d* Q, `( U/ N1 g3 u' |7 z% z, ]
    elif [ $argv = "-ga" ]; then
% \0 e3 w9 k' i. D, Q  T! N1 E, d        gui="y"; ?# d! @# R( R+ @
    elif [ $argv = "-f" ]; then
) b0 |. N5 F! z! _        f_next=1
/ g8 T2 |9 z  F0 s0 I    elif [ $f_next -eq 1 ]; then/ I# Q& B$ T0 r( L; g; \# f* N0 }
        f_option=$argv4 N3 E1 b4 G( }7 Q
        f_next=0
7 j( @5 Z' e0 [4 i# W. \! C+ W0 @, j    elif [ $argv = "-o" ]; then
  j" ~* W; {! n% [" ]1 s/ D        o_next=1
6 u, }0 e! k) p# H% Y. R  K& |    elif [ $o_next -eq 1 ]; then' ^, @/ X4 k+ R
        o_option=$argv
! i) f( k% \7 I        o_next=0; _( |8 T7 `) T8 k" A
    fi
3 k/ h# D9 Z" P0 J: `" m6 ]/ xdone9 y- g$ ^) o7 c$ j: w
echo "Command line options: $ORIGINAL_COMMAND_LINE" >  $EPIC_SCRIPT_MESSAGES_FILE
- `1 D9 L3 A8 }$ N+ C; A* v  f3 v7 W. ]( ?
8 I* B3 ^: X7 Y& {- l1 F7 Sif [ $databaseOn = "y" -o $gui = "y" ]; then
* d2 R% R1 V5 W6 n$ [6 G/ a3 k  if [ $cmdname = "pathmill" ]; then/ @: C2 Z2 R0 G9 I
    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5"  -o "$EPIC_ARCH" = "SUN4_SUNOS_5_64" ]; then
% U" A' _8 u8 ~$ C/ |         ostore="y"8 L1 K$ j" ~. q+ O7 B8 s; ?
         postgres="n"# w+ C9 F/ h0 [2 y. X" l) }
     else. y: g0 _5 V, t. U5 o$ t
        echo "athmill GUI is supported on Solaris platforms only" 1>&2 1 A5 ~1 {" B- B9 T
        exit
& L# ^+ m) e2 ]. c5 A     fi( Q; M1 Q) T( y; ~
  else% z$ A$ m& e' p; [' q
    postgres="y"7 X& ^6 Q1 m9 w7 R% e- a  W+ C
         ostore="n"
" f* K# x% P. o. ?. c3 |  fi
8 d- R- b" m  C2 s) K& Afi0 [% d- h/ E2 W1 a. T

2 H/ @& D$ k8 e+ g1 Aif [ $gui = "y" ]; then$ u$ }. D" g( y/ Q( a; f4 S( |2 q7 C3 y
    if [ $cmdname = "powrmill" ]; then
+ n4 d: _+ ^: S2 h7 ]$ x4 L        pwga $@
3 \  m0 W" n- o" H* w, n, c7 [' _        exit$ k9 S) D' L& A9 g, @1 v* Z
    fi
* a7 O- y. l8 B5 W$ t/ A : B4 c, b1 {6 _7 D# P
    if [ $cmdname = "pathmill" ]; then
* G: h: c# U3 N; ?( \6 p        if [ $ostore = "y" ]; then8 t, A( L& j9 i+ w
           ./pathfinder $@
# ?" C( O8 l' ^0 d           exit0 q5 Q) D( O1 @- z9 A
        elif [ $postgres = "y" ]; then6 ]6 ?. ]: {( N" k6 g
           pmga $@
& ?3 F- W$ a; }5 s           exit2 @4 z( o% ~0 p! h1 z- z
        fi" _5 g8 N% x  y5 R7 m
    fi
2 \9 @8 A! L& t! [: j$ Wfi
7 n( |& y% P% c7 A) ^' O! m, O% i& \9 T" l
if [ $databaseOn = "y" ]; then
) j7 u% Z/ ?( F$ D: b   if [ $ostore = "y" ]; then
, B0 W" W# I) C# Q" O      if [ -z "$workDir" ]; then2 R0 G7 S, r  e# G) M. N6 l. ?
         echo "Error: Missing argument for -gadb option"
  T3 Z  k- n2 H         Exit 1
1 f2 ~4 _8 o7 g% R  Z      fi
: X+ _+ G6 o9 e9 U7 v- ?6 o  E1 W- p   fi
, O8 V' D+ u7 i  s   if [ $postgres = "y" ]; then
4 z) _* K3 r. B2 T3 b/ @      if [ -z "$workDir" ]; then. C0 i7 i$ j0 F" [; O* }9 h
         echo "Error: Missing argument for -gadb option"
& o& O$ d; a! J( N/ s0 \         Exit 1
* A) X8 \5 T% W8 V) O      fi
  U! V: s0 x5 Z6 ^/ J   fi
9 `+ @/ E. N% Q8 nfi
# W4 \6 t# Y, I1 p. N/ |5 q+ y8 |0 J' q: U6 |
if [ $postgres = "y" ]; then9 y2 u( }2 m4 I; a/ X
; ^+ P$ }' M7 m! L
    if [ -r $EPIC_BIN/scripts/gui-init ]; then
! u( B; l5 h; E% b7 y4 @' d        . $EPIC_BIN/scripts/gui-init& b( \  ]2 }; C! l9 j' s; {- E
    elif [ -r $SES_ROOT/bin/scripts/gui-init ]; then
, F$ }* x/ l, A8 E        . $SES_ROOT/bin/scripts/gui-init; [! {" C& Q$ H0 H" y& e
    else
/ l( G: h: ?! \# c2 w        echo " ** Installation in \"$EPIC_HOME\" has been corrupted!" 1>&2. @3 g9 ^8 K: ]' r2 c
        echo " file bin/scripts/gui-init is missing." 1>&2
$ r0 ~! R1 T4 l; M- A7 Z    fi1 h$ v, |$ ?, u9 q- O

( o8 p3 B0 G0 l0 I! k7 J) T    workfile -tool $cmdname $@
; I$ x7 f9 h& J8 f' }fi
2 \0 K6 u! C. \0 a; v7 V# ?' ?  S' e+ R& z% N* p
if [ ! -z "$o_option" ]; then* \9 i  K4 ]" ]$ A: d' B
    errFile=${o_option}.err
7 K" v4 h: F: a; b7 celif [ ! -z "$f_option" ]; then3 b. n4 a2 d% Q: K6 K
    if [ -d $f_option ]; then7 X- \& @7 O4 _3 y. X) R$ T+ }6 n9 X. t
        errFile=${f_option}/powrmill.err
) F" s( A+ A6 Z    else errFile=${f_option}.err" }$ N1 N2 g2 \! Q/ v
    fi
: m$ V' n3 I; yfi
5 H3 c( [0 B+ F. E7 s/ q* w
/ ~7 [+ ]- w( D1 T- G
* V3 W. P" L9 w2 dif [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
4 x2 R" [, b) X  rundir=.epicrun
# y" n8 C. G3 V. q5 \& Telse
# K+ ^! q! M8 c' ]. n  rundir=.epicrun$$/ ~, Y, ~6 m: S! }: q1 A
fi9 ~0 [  v0 V8 u! r" b2 l# L
' D5 n( g1 i* V( H
libpath="$rundir${EPIC_DLIM}$EPIC_DIR"
4 F; s5 O, A& N! g% U5 K! H5 t- j0 N+ |
cwd=`pwd -P`: I$ Q7 p- d; a+ Y+ j! S2 P  N
if [ $cmdname = "acehdl_w" ]; then
" q0 W4 B: p, y$ J* C& P  cmd=`basename $0 .sun`5 }+ m  g4 K. a8 \! B% S; N
  cmd=`basename $cmd _w`
* u, @1 v' q2 S$ q* J& {. aelse8 t/ X" t8 Y- |
  cmd=`basename $0 .sun`1 V6 R1 t; B0 z2 v2 N( @' }
fi
5 O& b* R5 A- n! y% X6 N$ k6 I/ @1 z/ C# m
command="$EPIC_EXEC/$cmd$EPIC_EXEX"
+ f% ~4 {, S% |  B' ]: U[ ! -x "$command" ] && echo "$cmd: not installed!" 1>&2 && exit 19 X" p' |+ n/ o$ {! D

; r6 Q6 ?& [, o# F# buildmod extracts -u/-fm options and calls genepiclib
% C8 J5 T5 A% V# It also set the remaining options to variable CMDLINE
, U+ B. ^- c, \. E& a* Q# look up in .epicrc for -fm & -FM parameters) a8 m1 S2 }* t) t
7 s9 X$ t: X. ?
fmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`"
" Z: v4 U8 H- N& o4 \5 e( p) B3 R[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`", g2 N  {1 s- r1 I. Y
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`"1 h! j5 _+ W6 E

. H: q- c5 J# r5 F5 qFMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`"
5 k) t) a( d$ w* b. @4 r* e* P[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`"
2 D& K; q7 u4 ]/ C[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`"
1 z5 k/ |$ l- G, y2 E6 y) d8 m
/ r' f0 x. _7 e2 }! jif [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then
! E. g7 r/ c% ?4 n0 \    # note that the buildmod script will set the CMDLINE variable) ?0 b5 d- U- ~
    . $EPIC_BIN/scripts/buildmod
, N5 r- `% o# u+ a8 x4 M, y# h- @7 _; Z1 r0 r. o4 Q, q
    #echo "This is the value of cmdline=$CMDLINE"& f* k5 b/ i! o
    #exit 0
1 j  U/ u6 m3 ]) B$ U9 B3 x
/ L. b0 m2 B9 X8 u    # if a new timemill/powrmill/pathmill built, run the new one
  E" g. |4 x) b% s8 e& ~  B    [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX"
7 C/ L- @, g  lfi
4 B$ x% I7 j% C8 `& C' T# G5 w; c% H) `3 P
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then7 C0 G3 J8 R) _5 r  \0 d3 d
  if [ $have_har_flag -eq 1 ]; then
5 F. Y2 `% k" u' }9 v; a9 C    is_special_har_run=1- p/ w3 c3 m* \- ?# J
    if [ "$o_option" = "" ]; then, F) P) s# O! M# G0 N" N( b" `) Q; \4 Y
      case $cmd in
" Y( h6 N' m2 n( w! v        timemill)0 k0 N, W0 f" H- M
          har_ofile_prefix=timemill
) T& G: ^( c/ y9 R3 R          ;;
( S/ |6 E8 y* G7 }! A        powrmill)
5 f! ]9 `7 I, A/ M          har_ofile_prefix=powrmill
4 S2 U6 y7 q+ W8 X: [          ;;
) R! D  C/ r. L' e        nanosim)
' |- t3 }6 a5 R# e. `          har_ofile_prefix=nanosim
. G* `! K* m9 q/ J" M+ j8 e6 A. g          ;;
$ n3 h' v( ]& T+ }, f      esac( R8 Y0 i! y& M2 Z9 e' Z
    else3 c* L1 W) }0 d; z# g
      har_ofile_prefix=$o_option
# K- @8 A$ ~: Y+ r* q8 `    fi
- |" R/ ]: ~2 h/ K+ J fi7 s" |6 D# @. b( J6 L
fi$ @; c7 {0 U$ t, l

4 p1 Q/ `, _: `! a- e; X) E# Call Double precision version of the product if -D
; _: A" f* E" a# or simulation time > 1,000,000 ns.
- l" t9 m0 ^7 n: S# M% ~if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then
: [- U7 a+ L4 p  ~  ~1 ^
. [" Y+ l' v7 ?  # Now the binary always has the ACE feature1 O; M: h2 D& y# T& Y9 H* V8 K
  USE_ACE=YES
- S4 A# x. L# _+ V. h# A: l0 F/ ~! z1 J$ X- V2 E( q  d( k. T
  HAVE_DP=NO
0 D$ ^9 J2 i# X- a6 s( p2 x  EXTRA_CAPACITY=NO
1 }( b8 a- H/ |; L  DB_REAL=${FORCE_DB_REAL:-"0"}% G' T( K. G4 S9 p- \4 U

6 Z1 Z1 y" ^) Z# E  # Enhance for ACE ease of use
6 h3 B5 o2 M$ `# h8 g  # If no command line option or only a -T option, do:
4 D8 l, x6 v4 i. L8 z# |& f  #   1. set -A option
+ E. q  C( ?2 T  #   2. assume input file to be hspice- h; T4 |% K- z
  #   3. set -o to input file prefix
. t4 Q8 m3 O9 m: {  #   4. set -z to input file prefix8 P$ j9 f  M. L7 G' I( o8 C
  #   5. set -c to default config file
( J" ?1 D- y$ H  netlist=""
/ k6 H" U8 Q# ~8 s9 ]" W7 I& [  minusT=NO  l6 w* A1 T- T
  useStdCmdOpt=0
. N+ t9 j( ]) y  prefix=""/ g" I' ?/ t1 R7 N& u1 U, M
  circuitType=""9 O" A2 P+ N5 w
  for opt in $CMDLINE8 Y  c* `- y# j5 d0 W+ L
  do
4 w# {3 _6 C$ V. E% J    case "$opt" in " a" A& h& S8 S8 {1 @" w, N+ h0 @
      -T)
9 ?; C5 j) ^! M! H        minusT=YES, G/ k7 D7 h( ~9 C
        ;;
% ]: K4 s- _7 K+ M      -*)
0 p: |  r0 z" T% j) x: f6 o        # using standard powrmill command line9 a6 r2 b. @) H  q6 U5 h. f
        useStdCmdOpt=1' e, S( i$ w4 U  @' x; K
        break
7 P( E+ ?+ L3 q, H/ S! Z! r' d5 b        ;;! G0 r& \$ l. K2 d6 R
      *)* e+ f! k) i. A0 }, i
       if [ "$minusT" = "YES" ]; then
% o7 t! j0 K5 U         circuitType=$opt) u9 t, T# a& |" |0 O
         minusT=NO  # reset flag$ \! _0 K$ V1 ]4 t2 P
       else " r7 `! y' d, x3 A# x0 @
         if [ "$netlist" = "" ]; then
7 P! L8 z" p8 f+ R           prefix=`basename $opt`
1 W& I  W  Y- |8 Z+ N# n: f           prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix`
4 L. c3 J/ W) P0 D$ W- V/ u         fi
) z# l* K8 }# K5 c7 d, V- T         netlist="$netlist $opt"
$ ?) k, X3 s2 u       fi& [- |9 _& p: o& O
       ;;
7 v" c" r. i0 o+ l) a0 n, }6 T" Y# f    esac6 u7 ~4 H6 W. W
  done
1 \! A8 t; q3 n/ p5 l5 g9 t& m5 Y- W, u  ^7 @

# H3 e: M/ G# Q  ?4 ~) m  if [ $useStdCmdOpt -eq 1 ]; then
* s2 k* _( X. m5 a0 `) b    # use standard powrmill/timemill command option
( a1 _2 R  p% `3 P7 E    for opt in $CMDLINE
/ H. q2 }* W) P! N  V    do2 U: P7 b* h/ W8 ^+ v- i& W
      case "$opt" in
, F( ^$ |( ~' \, G        -A)) R2 M5 ]  D' e5 R3 e; N% L# y
            DB_REAL=1
* r% U7 U+ `* d1 ?( ?. N: b            ;;, K. C( U8 ]5 M6 F1 e
      esac
& X7 H# v9 S  }9 W/ L0 ^/ l2 o: z    done+ ~9 C" [8 t- H7 }
    if [ "$netlist" != "" ]; then& j# P, u" f4 U7 ~
      CMDLINE="-nspice $CMDLINE"
, }: F6 E! ]) s    fi2 E# u  U" R' h, ^( c! e% ]$ J
  else* G8 Z( N" T( b( [$ T
    if [ "$netlist" != "" ]; then
# k9 h$ O) k2 w% {; g" @" o  k# u( ]      EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"}% F0 W1 M5 z! W- n( c5 N
      # construct new command option
5 G( C: D- U( v      if [ -f $cmd.ini  -a  "$circuitType" = "" ]; then
/ ]2 F! Q' o) o$ Z        CMDLINE="-nspice $cmd.ini $netlist"6 u/ g. i/ T+ H* ^7 u9 P
      else4 Z$ X# o* U/ |
        if [ "$circuitType" = "" ]; then
( c" S. E6 z6 Q0 x8 [, ]          circuitType="msana"( ?' k* D1 S2 r" v: Y; t4 t5 R+ p) R
        fi
4 y2 a& h* |0 p! v  H/ t3 E) }+ p        CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg"
! c# C: ?3 S& g# `7 `4 R  a      fi
2 A- Y7 Z. b; [! _      CMDLINE="$CMDLINE -A -o $prefix"5 X# t  U6 \6 f, f# |+ ?" R0 h
      DB_REAL=1, V! E+ F4 x4 |  m7 `  {
      echo $cmd $CMDLINE% k0 X% ?3 [- R  J! h( n" e
    fi
4 w. D4 w" T, t$ f  fi
- I* G2 w% {1 @3 ?! _. K5 Q* c; gfi # cmd is timemill or powrmill or nanosim or railmill or pwarc% q7 q4 B! p9 n( s

7 M, U. t# y# \- f, L/ P[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a"
( e, t1 M& S4 i# r3 p1 w7 J[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a"
0 m! I8 y9 M$ Y5 n- i+ K[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v"& i" T: r* R- l- Y9 g% H. b

' c2 k" d: `' s  u; m& Cif [ "$__engine_wrapper_called__" != "Indeed" ]; then
  P# H7 K# o* O- Y    __engine_wrapper_called__=Indeed+ ?) ]7 t) Y* _
    if [ "$cmd" != "amps" ]; then! E0 ?9 w! {4 ~; k5 k& G
        export __engine_wrapper_called__9 |  t. D0 u/ h$ l6 {
    fi& w/ u% F, O- H; C+ V" @

+ k) F* J3 \  a" m# Y+ t    trap "cleanup" 02 R# @( W2 `; E, a2 x7 Y' o3 @# Y
    trap "" 2
6 ^+ o4 F& Z8 \0 b  T1 n
# _6 P3 ^/ O2 B) [9 r    [ -d "$rundir" ] && rm -fr $rundir
# P, d( y; ^! F    [ -d "$rundir" ] || mkdir $rundir  J  Z& r$ c0 }8 }
$ V# n+ r* A7 E6 Y" {. x/ C6 l
    case "$EPIC_ARCH" in
/ ~9 [, c' A- b# t% J  D0 ~  e    *SUN*64)   
$ u4 s, u0 m, Z; E        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"8 L+ W8 N6 T( y4 k6 X+ L
        export LD_LIBRARY_PATH
7 O" W& k# e" y* m% x3 z        suffix=.so* i4 A. l" x1 `
        ld_err_code=127# a0 B" v, e% W5 d
        ;;
: m- q4 @% y4 p3 j2 N    *SUN*4)   & K9 E- o/ O- D# u  J& z
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
) o' J' _7 c5 s9 l        export LD_LIBRARY_PATH
3 K8 @9 N' @* Z! b) w0 @: B        suffix=.so.1.0
5 F. y2 M0 d3 T. C$ g& Y        ld_err_code=127
( l1 |  L. Z. q/ c9 n        ;;
) t0 @, ]! Z! x. @- B    *SUN*5)   2 \. @% ^. j. B; c; u' o( G
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
" T) \8 a+ Q5 s5 _2 i% |  g        export LD_LIBRARY_PATH
4 H7 T3 s; Y- P5 ]6 g2 Z( ~7 d        suffix=.so
0 M( M( |. C, W3 b$ A, y        ld_err_code=127
9 R" D$ @3 o: H        ;;
9 @0 _$ V- K& N    x86sol*)   
% Z1 J8 D. y. q9 u" H: ~        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
- G6 a) ^  I; W$ ~        export LD_LIBRARY_PATH" e5 x2 ^' l0 V5 A
        suffix=.so+ G2 S3 q' _3 J) Y
        ld_err_code=127, A" k$ D2 T( E% Q; G
        ;;
( H, W) J# Y* C% ]4 [1 A. M4 `    *AIX* | aix64)   
) n& R3 n/ z+ {4 w) x  m        # When genepiclib creates shared objects, it creates a import file and 3 ?- l3 j* n- x6 w) F5 X. |% c2 m
        # uses timemill as program. So at exec time,program timemill is needed
; Z2 P. A4 U- Z/ H1 i8 R2 J6 i2 {0 E        # in LIBPATH0 i$ o) ]+ P4 h2 I
        $ln_default $command $rundir/foomill9 M. m* v) L) f8 R. o
        LIBPATH="$libpathLIBPATH:/lib:/usr/lib"8 V' H- [& e8 i+ ?) u7 K$ S; Q
        export LIBPATH
% S- B( D  H  l' q: ]% p4 c        suffix=.o
! Z7 [5 B5 `/ `8 w; c" t6 G$ T        ld_err_code=8
* c: i) A! t' t# r0 b1 d0 e/ J( F        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then" ^2 f6 v: r8 D2 @0 D& J
          tdir=`echo "/tmp/d"$$`. U# ?$ b8 n- q# l) O! x
          [ -d "$tdir" ] || mkdir $tdir/ ]. G9 w( ?8 N3 z/ l. P) I
          if [ -f $EPIC_DIR/libCustom.o ]; then
5 C  D1 G; Q5 F0 o             cp $EPIC_DIR/libCustom.o $tdir/
3 X" }9 T6 S! Q: }, w( f             $ln_default $tdir/libCustom.o $rundir/4 p1 K! e2 T! f( @- f
          fi* o* w- }: m! O; D
          if [ -f $EPIC_DIR/libModel.o ]; then
( U4 r7 j8 _( m6 a             cp $EPIC_DIR/libModel.o $tdir/
& K/ d- `- b3 I; L             $ln_default $tdir/libModel.o $rundir/
+ @& V5 ^+ V" U$ x% J          fi
: P$ a- o( ]' n; E4 Y6 V* Y          if [ -f $EPIC_DIR/libFuncModel.o ]; then0 y3 ^$ m; \3 B- I
             cp $EPIC_DIR/libFuncModel.o $tdir/- H" f/ \* L! {8 M4 a
             $ln_default $tdir/libFuncModel.o $rundir/
% J5 m- K9 q" Q          fi' t& x9 ]" A$ a& H
          if [ -f $EPIC_DIR/libFuncModel.34.o ]; then# }7 H+ b3 k& k) l" I
             cp $EPIC_DIR/libFuncModel.34.o $tdir/
; {8 d6 j6 F7 y# S4 I; k/ A             $ln_default $tdir/libFuncModel.34.o $rundir/
8 O7 o+ }. q. h, Q  {: o. V5 \          fi* S' ^- P3 X1 g6 `
        fi
! J( E: Q4 J* ~3 i        #Set the IBM flag to enable more shared segids7 s3 S$ B8 P( I4 v4 N
        EXTSHM="ON"" Y4 @+ S3 ~' E  M; w$ w2 \
        export EXTSHM( T& _) r  I" U- Y# B) k  j
        ;;7 X0 s# J* F3 w$ J" P; |
    *LINUX*)   
$ i% b$ ?  u% Y% [2 g6 f" l        suffix=.so3 }' ]) d2 J0 E5 {  A8 E" J# Z
        ld_err_code=1
# k5 N( R2 W1 Q0 q& R8 B: {4 H        ;;
( |8 T5 J/ o( {# t- [, ?    *amd64*)
, C; W3 J. d+ I; m5 \! G5 j        suffix=.so" I) N# o( y4 ~& O5 B/ z+ H
        ld_err_code=1
$ m+ p: H5 O9 e, m        ;;* [9 Y: b% F& }+ x6 R, T
    *suse64*)$ n" d; v; O; S, J  s- V( K
        suffix=.so% J$ J3 G. _: k% Z! ~9 @9 ]
        ld_err_code=1
! S0 e' L5 c* N5 g        ;;7 e+ g9 u% W; e
    *suse32*)   
9 `0 t* I7 Z# F5 s        suffix=.so, h! t3 A* n1 R
        ld_err_code=1: c5 p* k/ j0 F
        ;;: @4 B  r. L/ C/ j
    esac1 I) @$ _8 C' w1 O2 U- [
! p, u$ t0 a" P! v4 s
    [ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix"
( L; p: l1 P! K! R  W! L8 `    [ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \
: T' g2 _* Y1 g        && [ "$cmdname" != "nanosim" ] \8 q5 B- v5 G8 |
        && [ "$has_model" = "YES" ]  && ulib="$ulib $cwd/libModel$suffix"
7 K7 o9 t! H, V: ]    [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix"
# x5 v  s/ r9 R: ]% r( D/ p; U
5 |' ^; y3 S; K" d! T#Look for command line option for libFuncModel.so
+ L, \+ K( I( i- e#    user_library_next=0
4 U  O: Q+ k3 Q7 e# K4 d. @  X, n    has_fmlib=""3 w; ~" E6 b  ]2 ]& _1 ^
    for opt in $CMDLINE
0 n1 G! B( S+ f; R    do- g; ^0 o- e6 h  P; v# T) R
      case "$opt" in
& n. Y) l: ~% t4 u& V        -fm). [3 j. [% t( q3 D' U
            CMDLINE="$CMDLINE $cwd/libModel$suffix"
- ~9 b+ y2 @* [) X) H9 c  C" r            ;;3 L) k3 k& X9 {5 w" R
        -fm_user_lib)) I4 m' p) \0 O. I
            has_fmlib="YES", e# F8 r! B% f- ~  @
#            user_library_next=1: Z3 a0 B" i/ w2 w5 x) _
            ;;
& Z$ s' y  D2 N        -xc) : s6 S/ Z2 Z% g9 C4 m5 h/ a! u
            if [ "$EXTRA_CAPACITY" = "NO" ]; then
( |  Y( K% m4 r9 f6 e9 x% |2 q            EXTRA_CAPACITY=YES0 U3 `/ O. l7 d/ d
            fi
2 n0 _" ]( `+ W            ;;3 h" }% E( G$ h6 y: t
#        *)
1 I6 u8 t0 J: a- @#            if [ $user_library_next -eq 1 ]; then
. ?# I1 ?. z# R$ B8 H4 j; f#                if [ -f "$opt" ]; then! S9 l- F; t+ p) D6 _! f! V
#                    libfmodel=$opt. m: {. @- d) t5 S% w
#                else/ H2 Q  o6 T6 \  F; {0 r
#                    echo "-fm_user_lib: Specified file not found"
- ]) m, q0 M7 |/ K% N% J% Y; m#                    echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages% D# A* O4 I% V5 P* t: w' h
#                fi
1 r8 T# n; Y8 J4 R( Q  n# U#                user_library_next=0( Q4 K' }/ R( z# _! a+ m
#            fi
1 g3 {7 [3 l/ |#            ;;
: N! Z- X3 z+ P2 u4 c+ b        esac) f% ]% X7 T/ o- d2 n
    done
" @  Z( b8 A  N9 r6 W  R+ K" b. s0 \  Y$ Z8 y) i6 {, q
    if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then
- v6 F" @+ [% ?$ m        flib=""
$ n' Y5 Y; `% O: D        if [ "$has_fmlib" = "" ]; then
) L+ m6 \+ g! T' J+ o. {/ v, Q            flib="$flib `get_epicrc ./.epicrc user_libraries`"  Y$ V8 a$ E5 z- s2 C$ m2 b
            flib="$flib `get_epicrc $HOME/.epicrc user_libraries`"
' }# Q0 u( C* T+ h            flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`"
% b  b2 R- D2 N. _$ R% O        fi
# j8 Y: C& ]7 }    fi
4 |8 W5 B  I! O/ i+ y3 l# @
4 j. ]# d8 U8 G6 D   for i in $ulib9 l$ ~0 F# k$ X+ X1 z
   do
3 h& o# T# D! \! \7 t% \+ d       [ ! -f "$i" ] && continue1 A0 p. [, z3 T9 o3 m9 A
       dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd
$ C0 q& ^# r& R0 }3 g1 F       i="$dir/`basename $i`"
. U9 |6 t! w5 {0 D6 k6 m       case "$i" in7 u8 {* v& A- r
       *libCustom$suffix*)    [ "$libcustom" = "" ] && libcustom=$i;;
& q+ H4 v+ V6 E- t3 a9 Z$ {       *libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;;7 }+ y! Q# N; Z+ M
       *libModel$suffix*)     [ "$libmodel"  = "" ] && libmodel=$i;;8 H" x# ~$ l3 e1 w6 D
       *libva$suffix)         [ "$libva"     = "" ] && libva=$i;;% h( L/ I* q- s. g8 O( Z; J/ `
       esac; |: g7 a  ]/ E
       [ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \6 X0 p  b# E2 C+ j- m5 X3 t
        && break. w! _7 q) v7 }7 Z5 h/ i# f
   done8 \* ]5 u+ N& P6 a9 s- `
7 F  _$ _9 Z& x  h9 B
   # symbolic link shared libraries to .epicrun$$  e! v6 f0 s: a: F+ o3 O" h& A
    cd $EPIC_DIR; epicdir=`pwd`; cd $cwd6 _. o) V  M) w
    if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then; W7 ~& M; \$ M1 O
        if [ "$libfmodel" != "" ]; then( J6 K1 @# ^" b9 Q+ U8 r) u
             [ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \" Q$ `% L$ }4 W) E0 n9 j& L4 C
             echo "Using $libfmodel ..."  && \
. ^3 }7 E6 x2 b0 v5 p6 `. A% l+ f             echo "Using $libfmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE5 }* m) y! d3 p
             if [ -f $rundir/libFuncModel$suffix ]; then, B4 n0 c. _0 V7 W% ^
               rm $rundir/libFuncModel$suffix
! K- o$ u" W" o% A( a3 K) p             fi
4 r$ p2 `0 Y4 [9 \$ V* H; A* [             $ln_default $libfmodel $rundir
$ ^4 D* k. Q" ?' R; |# e        fi: Q! T9 }5 u  d) L4 Z( u8 e
        if [ "$libmodel" != "" ]; then
, ^4 U, R5 Q5 c             [ "$libmodel" != "$epicdir/libModel$suffix" ] && \9 P8 o1 y2 _& g; z  n" K! F
             echo "Using $libmodel ..." && \
: G& E" Q  O& K: N) m" L             echo "Using $libmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE2 W3 T# F& i7 i; r' q* ^0 D# K
             if [ -f $rundir/libModel$suffix ]; then& N7 E8 t0 e7 B0 Z1 }1 g  i, I
               rm $rundir/libModel$suffix
& ^3 l" S& E! R  i: b             fi, ]/ @) h# c8 `! g3 E+ K' Q
             $ln_default $libmodel $rundir
2 \) p, A8 l0 B, B8 e2 x        fi
: W  t! q) k9 o! Q# M   fi! D" T4 ^! Q: c9 y
   if [ "$libcustom" != "" ]; then$ p6 v7 j& [! U- @! z4 U
        [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \: Y5 |0 T! l$ ^' N. a9 A7 v7 z
        echo "Using $libcustom ..."
1 F3 c9 v& g1 ^2 @        if [ -f $rundir/libCustom$suffix ]; then5 F& R. i1 M$ L8 ]
          rm $rundir/libCustom$suffix5 Q; K. M; y8 Y$ |  _. e- S: D
        fi
3 v$ u7 ], G. ~& y2 B. h0 ~0 ~        $ln_default $libcustom $rundir - _6 w, x) U" I% B  I
   fi8 d( d% }/ o8 f2 C) h  j, p

- W. |  Y5 S, r0 p. N( v/ q   if [ "$flib" != "" -a "$flib" != "   " ]; then
. H! i  F% f) y# I& g5 }* d3 _, V        CMDLINE="$CMDLINE -fm_user_lib $flib"
0 b8 D% ]& }9 A6 u+ P, f; l   fi
/ q4 @( f2 r, w2 ?! G. i3 S9 r% P. v! [& _8 T
   if [ "$libva" != "" ]; then
& |& O9 y8 ]8 @+ V  h) E        if [ -f $rundir/libva$suffix ]; then
, s% ~, a# G$ V  E0 {7 A          rm $rundir/libva$suffix
; ]: o7 T! P4 B0 f# s6 V) N7 c        fi3 M7 k% _5 z& o$ D8 Q8 H' ^- r
        $ln_default $libva $rundir
( o- [6 a) l4 N3 N2 R   fi$ o6 v1 X# x& S. b, ^/ k

" L8 k+ m* e+ D" V5 g* `2 b. D1 U. g6 X8 r. S& U" E
    # VCORE design library) F6 @7 n' J6 m" R/ Y1 }
    if [ "$vlog_design" != "" ]; then, s8 |$ y6 \! ^/ x
        $ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`; \  G; O8 V2 |7 H) t5 I2 G
    fi; C+ I/ A: I2 F
1 \" k4 r; c6 n* G0 z" ^
    if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then
. f' T6 P8 V" x5 p0 p        EXTRA_CAPACITY=YES
2 K& g1 @- W9 D    fi
  y; i1 L! I7 B' w# z7 m; g3 f, L" E5 m1 S- {# S
    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc"
% S/ {: w4 A5 J; T    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc"# k  q5 T% T: i* e3 o3 Q
    #Create temp file if dual process is on
! f' r/ e& J5 G6 N4 c    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then0 J( Z0 G9 P8 v* D  J- W
        if [ "$EXTRA_CAPACITY" = "YES" ]; then
. S3 k, I3 M" s! d6 _            touch $rundir/rpcidfile5 ]/ h! f( x5 ^( \4 p8 w" P
        fi8 N& Y$ }# `' v( \  w; l9 a% j1 @
    fi- d; c, K; @/ [9 u
fi
/ g/ [. G; a, ^" Z; f& r6 z$ u1 k! t
run_cmd()% W9 K  K0 P, |+ L9 p7 S% N
{) y+ K& Y! t! I1 P
  command=$1
6 e& _% D6 g" N  E& f  c, L8 Z  shift+ M, k4 }; V+ w) p- {+ W' J7 i
, K1 V3 j, u6 z+ ~* y* y! C
  if [ x"$VA_FILE" != x"" ] ; then: l* D* u" e; k( X$ |6 H" l
     cmdline=$ARGV
- b% Y% G' T5 b$ \! b  else
( C+ c# ?1 o, v! E' q+ k" G4 \     cmdline=$@
, d. G. T: x4 h; a  k1 x  fi
' ~2 [4 f2 V& B7 b$ m; z
7 b; q8 W# g. R* Q2 w! s# {  debug=${DEBUGGER:+"$DEBUGGER $command"};
1 T: q! D1 ?( M2 i# b7 y2 w" n( h* N6 X% [. P$ B5 D
  # To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a
5 I6 W; e1 G, z" n, }4 k  # so save-restore may work.
5 _' c! p2 l( {# F9 ~/ g( x" i& S  setarchStr=
# N/ _1 C. k8 [% |$ |+ D( p) @  cmd2run=`basename $command`3 W  ]( d0 o3 a3 o/ i/ t! D
  if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then
; j7 E% P/ n8 @; X1 {; g  K. g    if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then
0 c  f- U8 {/ `0 Y( X8 e      setarchStr="setarch i386 -R "
$ ^5 Y+ K. O- @$ U, m7 w& p, ?) E    fi6 N  K* O7 P6 a% b7 F& x. T
    if [ "$EPIC_ARCH" = "linux" ]; then
2 [* _& i) J4 W2 l0 t      setarchStr="setarch i386 -R "
- p) O; k/ w3 e( A6 o5 J    fi
% K8 v- Z1 @$ T. b& y9 Z    if [ "$EPIC_ARCH" = "amd64" ]; then! m) k2 P5 F' V8 ]
      setarchStr="setarch i686 -R "
0 l$ X- D# u' j/ [0 u- g    fi& ^, b2 o% B8 m" R6 u! \( z
    if [ "$EPIC_ARCH" = "suse32" ]; then, S! U1 T( Z9 K, n1 D& ~# y
      setarchStr="setarch_suse i386 -R "
7 G. R  @" d! b: U0 n; e    fi/ k. D% M" N# c3 l6 y8 q. ?
    if [ "$EPIC_ARCH" = "suse64" ]; then0 w7 J5 E# V6 w% O6 Q
      setarchStr="setarch_suse i686 -R "
* b$ |9 |. d5 Z    fi; O8 B9 x' Y1 Y. W; \. l( w
  fi
. D1 H- w* `* o, e5 O' H
0 Y  @! [1 ^- C$ f  ret_stat=0
& X, R2 K2 Z8 S8 b6 E. [$ l; k7 P  if [ -x "$command" ]; then4 z" M1 Z, z+ P0 [
      if [ "$debug" ]; then2 q  E+ N: |% q3 k$ V0 o  F% s
        _debug_args_=$cmdline
; {  H, f: U4 q" y7 t: n" x        . .epic-debug
% o* O% _7 l8 v( u1 d0 C1 J      else
3 o% p9 h( S3 w, a) n7 G8 L" d        DEBUGGER=; export DEBUGGER& S6 b' \# Q& O+ H" w9 H, F
        $setarchStr $command $cmdline- m6 H0 E, v/ a, E5 j9 X
      fi
# P: v7 ]7 `  P0 ]      ret_stat=$?- u/ n8 Q) g# {
  else" h  j5 w' D9 j+ M
    echo "Corrupt installation, executable \"$1\" not found!". a5 I5 `- q, n! ^6 w
    ret_stat=1
* X# i9 ?, i0 u- a  fi
7 Y6 U7 E$ M! z" ]5 J}/ |2 r4 }$ }" A3 x0 ^% Q* t7 t

+ {5 D( q- R' H( ^  O7 y# keep runing cmd if ctrl file exist
6 e! e9 e$ v4 ~2 Q- x6 v
7 ?; \) [5 E& c+ [. @) {) wrun_loop()
/ _3 s, K6 K% }6 M' R+ Z/ A; }{
1 A! V( |; {0 \' d  [3 B0 H  command=$11 g5 C2 U( \8 y- A: b# Z
  shift
9 @8 g9 a" h$ [0 O$ F2 U0 x# Z  G2 ~& B% y
  if [ x"$VA_FILE" != x"" ] ; then( x7 @) [2 j5 e- I' I0 R% V
     cmdline=$ARGV
* {! A. N4 O4 e" F+ `4 z) I  else. Y; U" L" v( g. T: ?) D$ c
     cmdline=$@
/ c5 W8 O' Q3 W2 J, u* F% t  fi
- a/ d/ u1 X/ [2 _
& s. ^6 P* x* z+ c/ V  while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do
( a4 N- _. z, u+ N$ Y    . $LOOP_CTRL_FILE$$
# v  x& T7 e+ X* i0 ^, _0 M1 P    run_cmd $command $cmdline -banner 2  f: z2 M, K! V: c9 |
  done;
. t- m  y8 v! Q) Y& m3 e) R
- |8 o8 Z3 B. ?  if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then
0 _  s9 f/ B- Q6 V    rm -f $LOOP_CTRL_FILE$$4 R/ B# b. t1 n5 S' B1 A0 g# y  S4 z
  fi3 g$ s7 _1 w8 Y  W6 w
}
" V2 W5 e( u6 i5 b- P, }. ]# d8 I6 p+ K7 I
har_check_ret_stat()3 Z8 ~6 ^6 T$ x6 @7 g* y$ e
{  t5 i0 R8 u7 e; t  R
  if [ $ret_stat -ne 0 ]; then
  K# F8 a& P1 L1 O    echo "Simulator returned with non-zero exit status. Stopping."( ~* Z4 b$ f1 J
    exit 18 a' C7 `- D; P7 s: Z( d
  fi
# P( @6 {" [/ W}$ S' ?$ ]% [% @! f, c* v$ d

$ O( u3 D9 [$ D- v( i#
, V* D- z/ _' c8 f* [2 E& p# set stacksize and datasize limit1 N! @: Q& H/ b
#% Z, S1 j+ l+ t

$ i0 R3 q5 |; C) n; g1 C( ?1 _set_data_limit3 z, t: w- f# M/ m0 o, `/ Q' q, y
set_stack_limit
8 O) Q, q$ c8 u; @+ n0 ^/ P0 h1 y( n# O; P- ~: P( f, M7 G
#rm -f $LOOP_CTRL_FILE
* W5 r5 |! d+ k3 w! L; d. x/ Q- s9 T1 g" L# u; u
run_main()
! i" l* n4 ~6 G2 r; U* D{
- q( u# x- Y: ^& L% R5 pif [ $is_special_har_run -eq 1 ]; then7 W9 r- O, P& A$ H* N) f
  if [ "$har_ofile_prefix" = "" ]; then* K. u: ?$ t; q* K
    echo "Wrapper bug. Notify Synopsys technical support."
( [+ ?( i2 G2 V    exit 14 ~( r0 n, W; Q
  fi
- ^' Z! U7 O8 S7 w; Y  if [ "$har_hilo_file" = "" ]; then
9 }' s  A9 y& }' X1 G    # no user specified hi lo file - do both runs
' S0 @: y$ T" G' A9 q/ a) K8 P% @    run_cmd $command $CMDLINE -har_one -har_setup3 H6 ~) j5 w) _; I: ?
    if [ $ret_stat -ne 126 ]; then
# j( C. E% i7 X5 y+ |      har_check_ret_stat
) p) i+ Z$ k" I5 z5 q0 G6 z2 f% m      if [ -r $LOOP_CTRL_FILE$$ ]; then
" M. U" ~" l5 E) |/ {/ Q! G        run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl
! s% U8 S/ P$ ~% I0 n3 T+ f9 S; S        rm -f ${har_ofile_prefix}.hl8 Y1 {  v1 u& z2 o" ?
      else
$ f  Z- s1 b# z+ W        run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl/ S4 Z/ S0 ]/ j6 }/ t+ a
      fi
- j0 a9 q/ q7 W* M) N) t( V( m; [    else
' V" ^4 |, _- W7 w      ret_stat=0
; m7 Z$ z. U- X7 v! b  @% T    fi7 {' e( j5 U( ~  l3 |! X. w
  else8 d" \6 a6 r" M  `, m
    # user gave a hi lo file name
  \8 r/ |! e* _( K) I+ |    if [ -f $har_hilo_file -a -s $har_hilo_file ]; then2 i& N9 o# h! U2 K6 B4 p% M0 f
      # file exists - use it - only do sim run
$ i2 d/ f) I0 s; d      run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}
. @9 ?7 G& j! y7 \( ~, K0 G; I+ @% K      run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}
9 n6 a! ~: P6 O: ]4 ~' h( W3 h    else2 N; a/ Y# u& h/ Z
      # no such file - generate it - do both runs$ M" \+ f- U7 t# b
      run_cmd $command $CMDLINE -har_one -har_fnf -har_setup
0 K) d$ O( z5 [7 c' Z1 N( C; [      if [ $ret_stat -ne 126 ]; then
- g1 ?6 m! f2 d( J: X        har_check_ret_stat; h; E: G& t; [4 Y. Z
        if [ ! -f ${har_ofile_prefix}.hl ]; then% h) ?7 q7 k, C( b
          echo "No hi lo file generated after setup phase. "
2 L3 y% ^+ e  o( X, c0 h5 C" E# X4 u          echo "Contact Synopsys technical support."$ m( s) P. y( V0 F+ W5 K  `
          exit 1& X& ]4 B$ V0 z# \- b' |; r
        else* U7 Z1 L+ J8 l8 j# m4 q
          if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then
; C2 Z9 S1 Z0 f, v            mv ${har_ofile_prefix}.hl $har_hilo_file
  @+ c( j6 ^* c! J' @6 r6 `          fi% ^% Q' x% B5 z4 k
        fi
/ {+ D3 a, {- o4 r; B7 N4 b        if [ -r $LOOP_CTRL_FILE$$ ]; then! a& p% y/ O+ y1 R- E
          run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file2 A& Z7 ~' q: l& u9 u' w5 Q; N
        else
! V7 E/ ^' h! M+ z8 |/ L" X# J$ x          run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file1 d5 ]4 S3 v1 y; X" h( ]
        fi
1 V- y' A; V4 z; ?/ Y6 R7 n8 F      else & T/ p; b; S: L- Q6 \
        ret_stat=0% d& P$ q" ?/ t5 D6 R
      fi
1 F  i" g# H$ v' q    fi  ~. }; H: J0 E: {( t0 m
  fi
4 _8 O2 T( C" ?" W2 B7 @else  ) m: h. Y; r; \  F7 h
# don't loop if -har_setup
6 [3 X5 C" t% r7 e  if [ $have_har_setup_flag -eq 1 ]; then3 d" a( f% ]0 f* g7 s, c/ e
    run_cmd $command $CMDLINE
3 Y7 j+ A; F2 |) g# b% a4 n    if [ -r $LOOP_CTRL_FILE$$ ]; then1 J0 w  H" c2 q: u4 G
      rm -f $LOOP_CTRL_FILE$$
4 F! f6 p( b. ?    fi
) k: W/ ^, O2 g3 M" E. C/ X- B- V5 Z  else$ [- P$ t" h. l
    run_cmd $command $CMDLINE
( n! y& Q8 [0 A, w# W    run_loop $command $CMDLINE
6 A- {( r7 @  ?  z" b; a! [& H  l  fi) ^' h- W+ \, l9 c: r
fi
' g# P2 t6 j0 C: S* @6 d, g9 p9 y2 O0 P! R+ z
if [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then) f* V+ I( ?6 N! j( L
  pwCreateErrDB -w $workDir -e $errFile
% b/ K+ l- h2 j# n5 a+ q- C  ret_stat=$?2 R7 y6 Q/ h4 E1 Q# [: K- N
fi
: Y8 J& s0 a( }) X1 G) v% A3 W3 Z0 `}( c) U) Q* j! t3 W" o  I" s. R

/ d- [% ]; c1 [! z% @: j; ycleanup_alter()
! c" D4 A$ M' e  X{
8 D3 L. s$ i6 w: m5 c* K   /bin/rm -f $ALTER_COUNT_FILE 1>&2
( a- U0 H9 W# ^3 w/ }! B0 U   /bin/rm -f $ALTER_HK_FILE 1>&25 M$ R- ~* F7 F# V8 T7 T
}+ U: B3 G7 f0 n# D4 z+ q

) \" {1 _$ G& A. f. o#generate alter temp files based on pid
: U. n' M7 x% N$ [( [0 }6 E( |ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$
: E1 b. v( |- vif [ -f $ALTER_COUNT_FILE ]
3 g' w0 w, L& \) P4 W% z1 t6 Tthen
& ~, g; t+ r- C; o5 j  until [ ! -f $ALTER_COUNT_FILE ]1 S) N$ K4 F- Z' a
  do
7 z0 E4 W) h8 N. M1 D    ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$
0 Q+ K# b$ Y( J2 P" Q5 N  done
$ ^  J9 b& g4 ]  U/ o7 U  |fi- G' M, Q: f# y, P
export ALTER_COUNT_FILE
/ s: ^9 U* `. \7 P& x7 d; V$ w% f9 X2 z+ M7 V' p5 d
ALTER_HK_FILE="$ALTER_HK_FILE"$$* |; ]6 o6 W7 d3 l' H) v/ H3 |, Y
if [ -f $ALTER_HK_FILE ]
; G9 L/ d+ K2 V( a8 ]then
/ U- b& C, b/ u# y0 E9 J# b  until [ ! -f $ALTER_HK_FILE ]0 e1 M) D8 Q% {& X' T, d& @
  do% O* p- w+ d: f" N! p: Z7 l
    ALTER_HK_FILE="$ALTER_HK_FILE"$$
$ L. a! O/ _2 g' ~  done5 D9 N6 G9 @4 M0 U4 E
fi$ ~+ `1 M( }5 D3 \: u  h' b; ]  J
export ALTER_HK_FILE
+ D8 F; ^: m/ P
! `1 ~- b0 ~' |$ g( u' I7 k$ W#generate monte carlo related temp files based on pid: q7 k" k, n3 z1 E' ~8 i
cleanup_monte()* Z4 g, W! Q* A
{
" F: ?6 }+ s9 Q* e$ N6 }+ ^   /bin/rm -f $MONTE_IMG_FILE 1>&21 |. K/ d' k2 T- f4 ]
   /bin/rm -f $MONTE_IMG_FILE.gz 1>&2
! [' T( d4 }: W. }9 k   /bin/rm -f $MONTE_COUNT_FILE 1>&2
# z8 z' a7 D: _+ p1 X5 B+ ]0 D* L% f   /bin/rm -f $MONTE_CFG_FILE 1>&2
9 h9 \% e8 Y6 m5 X  w" h1 t}) D3 S. e' |+ r( n8 S* u# g+ J8 F

: g# b" @, p# s7 z) OMONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
' f$ f0 _$ q- }if [ -f $MONTE_COUNT_FILE ]: @. H. d7 }7 b. j& s3 R: r
then' r, X9 h" p7 V/ s
  until [ ! -f $MONTE_COUNT_FILE ]& z* {  v& v9 e( G+ P
  do* t9 _6 O  Y) B9 l
    MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$  S/ A$ y% F4 U5 P3 o, p( Y' }4 }4 i/ p
  done) ^/ N* I4 B% i3 C5 f
fi
8 b- t7 `3 Q2 d: rexport MONTE_COUNT_FILE: x0 g% D% R: B

9 s! M9 u" [$ q* R1 [+ fMONTE_IMG_FILE="$MONTE_IMG_FILE"$$" T1 ?" R. T1 C$ k
if [ -f $MONTE_IMG_FILE ]! U  I+ _7 b9 M3 ^
then
* \/ a' Z4 f: O% l3 Q+ H  until [ ! -f $MONTE_IMG_FILE ]. q2 m7 Y6 K3 |+ u  \' A+ b0 K
  do
9 H+ ?+ W5 R1 ?7 }. _: u3 N( N    MONTE_IMG_FILE="$MONTE_IMG_FILE"$$
( g" s- \, h- b3 n. ^* |  done
' N  k* @8 l3 z5 xfi
7 w9 C" k6 u, C6 nexport MONTE_IMG_FILE# a" n' |6 }( `& l% J* x$ P* N

( v* t) P4 Y# u) K2 a0 s* K$ \MONTE_CFG_FILE="$MONTE_CFG_FILE"$$
* ]9 @& x, p: c# w# tif [ -f $MONTE_CFG_FILE ]2 P5 B+ ^& I0 q2 l1 {# b
then. Z; ~3 q  T1 K9 W0 q
  until [ ! -f $MONTE_CFG_FILE ]* b7 A- I/ y- Y
  do, K, t/ y+ V% [, p9 A+ |
    MONTE_CFG_FILE="$MONTE_CFG_FILE"$$6 ?, {3 k  c! W. g; r8 d& ~
  done4 e5 u& q% C& k, I# A2 @
fi' d0 ?7 f4 R6 h  K# p
. z6 H9 |" C9 O2 Y
# main iteration
8 C: x- U' @5 ]run_main' P. F/ |2 S# z
# x+ L+ d0 h1 f( d+ p) d5 m* L
if [ $ret_stat -ne 0 ] - q( h) q+ G7 Z3 F7 G: u
then
0 U+ K- T2 e; z% n# I. W  cleanup_alter! A4 A# M: l9 ?( s9 ?4 C
  cleanup_monte2 L+ m" O+ `% p6 v& ?! ~
  Exit $ret_stat
7 H3 c3 M0 q: E9 o) N( Z9 r) tfi
1 z7 _: O/ G) i. N. s0 k3 q
3 u, D  L9 [4 \) j#Alter related iterations
- T9 {4 w$ |( L# C5 V2 n
- [8 g5 l9 D5 l3 n. ~iterations=0, @1 G2 H0 e4 H8 s6 R1 Z& w+ c
count=0+ ^( k: Y9 L! e) f
if test -s "$ALTER_COUNT_FILE"
6 ?1 K) P! z8 f  p: Z9 @then
4 _  `8 a( N- M1 o5 z, e8 Q  if [ -r $ALTER_COUNT_FILE ]; then4 L& J3 S& Y# p% n, x
   exec 7< $ALTER_COUNT_FILE- T" c$ |" U4 U$ v
   read iterations <&77 Y# j3 \* o. j2 {. |/ \- }4 z1 t
fi' _; \; E2 l8 x! T3 i$ a! F& A$ M: o
fi
$ K4 z: ^3 H7 }2 N% e  O7 A8 @3 m. S- u% B- a- n
trap 'echo Program Interrupt; cleanup_alter; exit 1'  27 H: D+ P' P+ V& S$ }
while [ $count -lt $iterations ]' L% N. g0 \" K7 l' s( y) a) M
do9 S  P- }2 H- q8 a! F; x: o( B
count=`expr $count + 1`, i) B2 C$ K8 B0 R, ?: ~: t7 C
ALTER_COUNT=$count6 ~( i% \/ Z. ~) g! L, d  [
export ALTER_COUNT
0 b# I% X" E- k4 T' T2 T; }/ T  q4 W. ~  I4 X" i
run_main% h7 y- s' k. k

1 R9 N: u/ ~0 R2 G: |; ~3 ]- adone; b8 V0 \2 O( g1 q5 u& F& I9 w  z
; I" E4 z" }/ m0 U
#Monte carlo related iterations8 x9 _4 |* N1 i" _2 V
! C3 [1 p1 X1 P# P1 E, ]/ Z
monte_runtime_summary()
8 j" _* J( i& n. t, ]+ m9 `5 z8 M* C: \{
5 K8 Y1 |, J' s7 k9 O! X0 ]( ?  keyword_1=real$ O  s! D+ s! K0 f2 f1 F- B
  keyword_2=user
" H" H. P; \$ q2 A  keyword_3=sys* l4 N9 L5 n) n$ `1 ]' ~
  ofile_prefix=nanosim( I5 ~5 s, W; x: P
2 }. B. v( h( Z
  if [ ! -z "$o_option" ]; then
) Z9 f+ g  d  ^6 E% F  Y    logfile=${o_option}.log
6 o1 l$ p2 z# l. a8 t  else
1 y& t4 o/ T8 ?  @    logfile=${ofile_prefix}.log
' h8 X% y! d/ d$ O  m  A  fi
7 L+ `, I0 ]0 u3 }9 B0 m/ ]
1 @/ r3 V- n: Q) U% B3 I& S  if [ -f $logfile ]; then
" X  I# k4 w; S5 }; r5 u1 g    echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile      8 U+ O) X  {1 D5 j9 u
    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
& o+ v+ i& X4 I  fi
: h: p* u1 C) e+ C- ]' B% u}6 }! G, k- a  {: }: [8 S3 l

- j: p' G' _2 Enext_monte=0
1 ~# P% q/ k" Ccur_monte=0) a9 ~0 n2 E- D
% m2 f, T/ e( O- A
if test -s "$MONTE_COUNT_FILE"
: L3 h  L$ w2 R* f8 i# Vthen
; [; o3 n/ w7 N  if [ -r $MONTE_COUNT_FILE ]; then
2 \! i, a: x6 r   exec 8< $MONTE_COUNT_FILE
, P! h1 i8 q3 t3 M; c   read next_monte <&80 r3 K( `! n# y# i# q  G+ \
  fi- M( C- Q- l7 l. g: s9 f+ |
fi/ }+ |) k- q& L# j3 }
0 ], R5 t0 T5 W6 M: D
trap 'echo Program Interrupt; cleanup_monte; exit 1'  2
' I6 w) i1 s* j* y' S/ \4 Awhile [ $next_monte -gt 0 -a $next_monte != $cur_monte ]
( D* t. N- C% Mdo% ]( f" C+ c6 r+ A
  NS_CURRENT_MONTE_COUNT=$next_monte
+ a3 a1 a- u! k; x. ^6 e  export NS_CURRENT_MONTE_COUNT( g+ d; N" d5 r& c/ W5 v
: H* q3 b8 [2 y3 P2 h7 ]/ G& y# }
  echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE
5 O  U. n7 e9 R- M  CMDLINE="$CMDLINE -c $MONTE_CFG_FILE"
5 D3 e! [7 b1 V  run_main
4 p6 b% E# v/ S  c  Z4 W3 P; Z" C- G6 C) _3 F% `2 |8 r& Q
  cur_monte=$next_monte
3 g( |% `+ F. R) w1 T& p7 Y/ N  exec 8< $MONTE_COUNT_FILE
0 b- }& x) G' A4 l4 N! a  read next_monte <&8
1 i- V6 t9 B. ^% }3 }, @7 Qdone; v4 z* x' s2 J, X" r8 W* w

# w# a! t1 b$ G  gif [ -f $MONTE_COUNT_FILE ]
( P5 w. S2 a1 G) s$ hthen4 ]3 V! c8 v4 ?9 p
  monte_runtime_summary
9 Z- A3 l9 A) V" X  m0 U- b4 gfi; Z, k5 }5 |. o4 }+ }

" _  X9 `5 m& G( B. ucleanup_alter- k% Z' K. a& E; i8 a
cleanup_monte& B9 n) @+ L( Z. H, n# x8 r0 z4 ^
$ o5 Y( O- T% @7 x  s8 F5 T- L4 \0 V
Exit $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-5-14 11:28 AM , Processed in 0.138007 second(s), 15 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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