Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

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

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

[複製鏈接]
跳轉到指定樓層
1#
發表於 2012-5-6 13:58:13 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
10Chipcoin
各位大大好:  q; |$ m/ i& H9 e
                      小弟執行nanosim時,卻無法跑出視窗來,有個錯誤可是我不清楚該如何解決?問題如下1 m( [0 B2 K# q) I4 {( Y! d- u
                      [: 113: 64: unexpected operator
: H  J1 q0 r  ^9 ?% b/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim: 1: Syntax error: Unterminated quoted string6 v& l% H4 O. I
有大大遇過這方面的問題或是指導我方向去解決, 謝謝.
/ l4 z; I# L/ {" A1 a4 s我在猜可能是這個檔案內的文字需要修改 但不知道該如何修改?
# N9 C+ u7 F' s- p; X以下為/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim 的檔案內容:4 e1 r8 U( E& c, `! d( @
    #!/bin/sh; v4 X5 x0 L; a, {! u7 U" z7 d
#3 I: o. R* p- o1 ?2 E( {
# Copyright (C) 2001 Synopsys INC
& ?0 i5 D7 b" a7 Q, V! O# EPIC Dynamic Simulation Wrapper (DSW)
. j# L2 d  S0 a# n#, X: E& y3 b. z3 H  w
eval ${DBG_EPIC_WRAPPER:+"set -x"}
$ c4 N! X" h" B& \9 k5 h/ q" V+ N% n
if [ "$EPIC_WRAPPER_DVLP" = "" ]; then
0 e! L$ x1 @9 O    TEMP_ARCH="$SES_ARCH"
+ ]$ _+ N2 A. v3 s) I) S6 Jelse) I5 y# n5 Y3 F) B" a
    TEMP_ARCH="$EPIC_ARCH"" m" B, M6 ^3 X6 t! ?, ]2 D
fi. v# H/ }3 Z& }* K% p" u/ @+ r
- A5 ~9 ~( s9 w9 s  W
scan_for_hva_args()
& ~1 |6 U- x. V+ d' e, K{
, ]' U+ K( n+ k5 l" d1 J% h  /bin/rm -f hva.init 1>&2
6 ~0 U  W; O$ u- [- I( A  while [ $# -gt 0 ]; do) }" [3 R: T6 N/ ?
    case "$1" in
- e+ r& b; J% b1 m      -vaf)
/ ]2 h2 w. v) k! u           have_vaf_flag=14 P( z$ b( r+ d" \
           have_va_flag=0$ H+ X# j* Z) @, Q" k$ y  j
           shift;
7 |/ O  a" V9 P2 A' L5 v  i! Q$ D           continue;
, f+ G8 ~& D# K        ;;
9 H! [1 g( N' U- M9 U; d      -va)' [- B& o# G7 l
           have_va_flag=1
  `( J5 g% u1 j8 r; F) W6 o           have_vaf_flag=0
/ p" d( |( C! |$ z* G' v1 e* N           shift;
9 f' l( n3 a' i, ~           continue;  @. w; V4 M5 {. C
        ;;
; c8 P5 n& s1 i) `1 g% w      -*)" B8 q( w9 r& j; Z. S; W
           ARGV="$ARGV $1"# h' N. v3 b" \2 C1 t. H! |
           have_va_flag=0; G) H/ a1 p, I
           have_vaf_flag=00 t# ~; k6 C8 X0 X7 X
           shift;2 n; [5 G& L9 s! D( m5 ^
           continue;: R- Z' K# }$ }4 ^  F3 B6 j
        ;;9 ]7 b7 s; U, ]
      *)
  o/ v- K- c. Y( r           if [ x"$have_va_flag" = x"1" ] ; then 9 C: i( s1 S4 r; k, Q# d
              VA_FILE="$VA_FILE $1"
+ R- U$ E6 ~6 {/ f           elif [ x"$have_vaf_flag" = x"1" ] ; then   y; s2 p6 x) A, i7 f
              X="`cat $1 | sed -e '/\;/d;`"
! Q# g/ G+ _& ^3 T: R              for token in ${X}; do
5 f; c! l" K& P8 X                 VA_FILE="$VA_FILE $token"7 \: U' a' }& X3 R+ o/ }$ g7 B
              done
: m; b5 M9 B( @' J           else! J. ~8 F, u. H7 n/ a
              ARGV="$ARGV $1"
* j7 Z& [  ^; B3 N: a. o5 N+ p7 c3 Y, ]           fi
7 @' L. n! h. f2 I4 \0 N; s9 P& P           shift;: ]3 u% i' A. k( }8 g+ W7 J' R
        ;;+ D' _9 t; U. v. L" t- V6 a4 F6 u7 u
    esac7 {, k; F, [2 o/ M
  done3 A% x9 C. Q+ L. c
& n' N" p& \/ @7 Q. b* V0 X2 N
  if [ x"$VA_FILE" != x"" ] ; then
  g# T/ n0 }* @##     /bin/echo " xxx ARGV $ARGV"
7 {( E' s7 m( q0 `6 L       /bin/echo "choose nanosim $ARGV ;" > hva.init
4 F0 M8 a( P1 p4 r       echo vcs +ad=hva.init $VA_FILE -o simv/ `, _; l! _, n
       vcs +ad=hva.init $VA_FILE -o simv
# o. m+ M: w, U' X! l7 s1 k! R       exe_status=$?+ X$ d3 s1 H) i6 A
       if [ $exe_status != 100 ]; then
3 d; M& W' F3 I" k* w4 H( |# _          /bin/echo ""* ?1 o9 n* ~( k- t3 y
          /bin/echo "ERROR: Execution of vcs exited with code $exe_status"- R9 g" {: k! V
          /bin/echo ""4 n5 B  X7 o) }: K# F
          exit $exe_status' d6 x+ o2 l: |: ^& j& |
       fi, @1 j, U+ u/ @3 O0 I, R7 V8 P9 E
       hva_files="-n simv.daidir/amsVD.ntl simv.daidir/amsWRAP.spi"
4 V- k1 e1 y  h! [- }       ARGV="$ARGV $hva_files"  Q8 S/ J& e$ |& w7 F/ N
  fi/ t" ~3 F0 @0 Y
}
0 t8 {* m, N: q4 l2 O* j. P% f#-------------------------------------------------------------------------
/ G( }% N3 w5 f- ?( e! `% f, \
) I0 X6 i. X' R3 q4 @9 D1 _, Vcleanup()
7 i8 i  Z5 j3 h/ z" c& g{
  s+ h+ u/ U5 c( h    if [ -d "$rundir" ]; then
5 x( \) M: l: F        # On AIX, a .nfsXXX file is created if libModel.o is removed
- c* W1 C6 t- c4 ~6 _        # so .epicrun is not removed because directory is not empty.
8 r/ E' U2 x: [        # Solution is to remove it again if the first rm failed- l; }9 r' E3 B
        # (rm -rf $rundir || rm -rf $rundir) 1> /dev/null 2>&1$ e/ |7 L; l. w+ \' r; r
        if [ "$EXTRA_CAPACITY" = "YES" ]; then
* \2 z. h7 u- r        chmod u+x $rundir/rpcidfile* @$ b) A5 R7 M2 _" d2 E, J  T/ `
        $rundir/rpcidfile  Y2 J/ ~& k( [/ @3 P5 x" P' x
        rm $rundir/rpcidfile
8 D4 ?2 U, E( O& r        fi2 ?& ^) y: V/ {8 x+ [
        rm -rf $rundir
: a) Z, E6 R" D3 g! g4 y3 Y) o% G0 Q7 A8 `2 }7 U
        #Due to NFS problem, we have to copy files needed to9 [( L! ^9 r4 [
        #/tmp/<temporary directory>, then symlink's files
7 o* F) e# ^  g' a        #to the local temporary 'rundir'. This avoids the problem: v2 D- v; D! f+ O/ U6 ]' q
        #to remove 'rundir'
- v' b7 Y* z  L  x        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
! ^1 d( P3 @- p. J0 r" C! n          if [ -d "$tdir" ]; then! D: z3 D2 Y6 f. K5 d
            rm -rf $tdir
9 ^  ?6 F! u- @2 `" U- u0 I/ f0 P          fi' G0 ]; Y' T" o2 Q2 A
        fi, U0 L) L0 V. Z/ ~& i
    fi
4 y9 K( w/ N3 |  h7 k( g$ [    if [ ${exitstatus:-0} -eq $ld_err_code ]; then
; M5 x- k  @, c3 t7 W* ]        [ "$has_model" = "YES" ] && rm -f $cwd/libModel$suffix
. S+ a8 M6 v& @# m* r, c        [ "$has_custom" = "YES" ] && rm -f $cwd/libCustom$suffix
# O: I$ q+ H6 ?$ s7 I) X% A# p    fi
; g; p2 d! O( k/ |    [ -f "$EPIC_SCRIPT_MESSAGES_FILE" ] && rm -f $EPIC_SCRIPT_MESSAGES_FILE 1>&2
, U% d9 m- m  i; U    exit ${exitstatus:-0}
7 m3 |. D: N5 E( B% F: H! B! r}
  X) r# t0 u& @- ~) x" T; G
, ~8 S2 ^& {% W$ c' LExit()
% \% P+ |) \9 E/ Y4 w5 w{8 Z" B  @0 D/ X3 E- G+ _; Z
    exitstatus=$16 s: R' c1 M6 @/ a# C0 E
    exit $exitstatus3 c! B' ^7 X' q( a4 q5 t
}
4 y* c! z1 b. V& t- U4 }9 S
2 j! f9 E  P) K# get_epicrc filename keyword
3 i8 x  n) h* vget_epicrc()
2 j6 j3 X6 n! h" A; u{, }. x' M* p' P; |
    [ -f $1 ] || exit 0
: o4 e2 Y, p9 v+ U9 j    key="/^$cmd2:/{print \$3}"
. {5 j: b: d+ Z/ W* \# t$ i    awk -F":" "$key" $1, o! Z$ g: m! W
}
9 O, \% l% \. ~8 F: ]/ k9 u7 K2 a# o8 c" [4 P' Z  G& d) L
#
- c  h0 Z, A) [7 k# set datasize limit to hardlimit
9 Z, a8 J& U% |% J9 X+ O8 N! W7 s#0 f4 w- o" C! `4 k% }, ~
set_data_limit()
2 l+ J4 {- V3 l! C" T! Y3 u  u! s! s{
3 C/ @1 M2 q/ `8 v) F% {' O3 o9 G    dbglimit=0
4 [2 o' G2 B9 c! a: n# q! `9 O    hardlimit=`ulimit -Hd`
: V' ?: i% l* v/ T" b    softlimit=`ulimit -d`
2 d, W% ~% Y3 m5 S* K: W0 W    desiredlimit=3500000
- S' S) E$ E4 y$ g! V5 s% }    hardisunlimited=09 X+ e) z  I  e
    softisunlimited=0
. V8 q: ]. o8 `    is64=0
) N# ~. x/ ~; I# }* v, O" a3 R0 R/ I
    case "$EPIC_ARCH" in' r% ?+ o8 p$ `  t; u0 }' W! \
    *SUN*64)( \5 m' `2 Z5 i) `) P2 D* n. A
        is64=1
4 T" H. Y, c- \- n- \        ;;9 B; E# D. M0 b8 t+ v
    amd64)$ @! F( V" M4 a/ u
        is64=1
9 I* k/ b% n! T# f8 h" i$ |        ;;- N6 g5 ~; {* F" |- x; ^
    x86sol64). ~% F+ H3 r; U
        is64=1& R9 H/ Z( a. p1 o) M
        ;;
! r+ t0 }2 W! y: Z    aix64)
9 U+ V' G! ^2 _/ E0 G3 u9 p        is64=15 W) s* \! K  y3 e. u: Q
        ;;
5 [) I) q" a0 A    suse64)
" ?9 m1 X; p, z* O# S4 ~( j* u        is64=16 g: `8 v* k" M2 _. W  z" {5 f1 E6 o
        ;;8 N! }; v5 h) A* w. N$ x. `  e! f
    esac
0 z1 h* r& j$ _
# O" y7 [. w2 u2 p" r1 J    if [ $dbglimit -eq 1 ]; then* I! |! I, C# T. Z2 ~% [
        echo hard $hardlimit soft $softlimit
; B9 o! E$ p. z' {+ L  n2 ]    fi1 S, T- P  t+ u, ]' Z
7 Z6 z( e. l1 y& P5 u9 \4 }
    if [ x$softlimit = "xunlimited" ]; then, _+ J& m1 s) r( o$ ^% {: r# p
        softisunlimited=1
- e" D1 y0 R% p0 E; o    fi
& x6 u1 u! Z- Z* Q& v( K6 H# m1 n# `8 J- ]
    if [ x$hardlimit = "xunlimited" ]; then( z2 D' Q& L' K; B4 q% e
        hardisunlimited=15 z3 T+ d. V: K' a
    fi
* d( p4 |, @2 |- n9 S+ L8 ]8 p9 L
    # 64 bit machine should have bigger than 4G
  ^+ }: M) B6 n; @. Z    if [ $is64 -eq 1 ]; then
* I/ Q' m4 M9 S, e* G! S% f3 K8 I        desiredlimit=5000000/ O3 K  f# x1 s; R0 X
    fi2 P, Z& ]( Q, W# q" @" m0 j1 i; \
2 l, `9 |8 ^; v; r, }( u
    if [ $hardisunlimited -eq 0 ]; then
3 z) V# y* F: G: Q9 ?! c" w        if [ $hardlimit -lt $desiredlimit ]; then  g) m. G6 Z! D% w( a* K
            echo "WARNING: datasize hard limit $hardlimit K is too small."
) S- _  C6 a/ a5 N* ~5 _1 `: U        fi
# e3 j% T: @4 u- Y* e8 [. A; F0 \    fi
! f5 C/ v: M, G  J1 ~/ r
# W) y* y+ c' h    if [ $hardlimit != $softlimit ]; then! A* _! ^1 t- d  `& P4 R3 K/ c
        ulimit -Sd $hardlimit
  H% X& [! w5 O% x#        echo "WARNING: datasize limit is set to `ulimit -Sd`"
1 k/ Z' f! ?2 [+ R: f% j    fi5 I0 B1 E- x( z' u# {  Q

& z# d% ?! k+ g/ o" t. S8 A    if [ $dbglimit -eq 1 ]; then
: g% f7 m7 `! Q" j6 b# e+ f4 t. n- [        echo datasize hard limit: `ulimit -Hd`
- J! ~$ r* m; F1 m( L- \        echo datasize soft limit: `ulimit -d`: p9 W2 o$ [3 g; q7 G
    fi8 n  U; {# ?/ g+ L+ A
}' d) o- @) c" t* D$ X/ ]  F; i

4 W( D+ i6 R0 C/ h3 A: S#
9 [8 @( f$ q0 A, ^# set stacksize limit to desired limit
1 ^& ]+ d1 _& Y% B0 X; T; j% k#
! x  w+ ?2 ^  K9 R0 d2 oset_stack_limit()
4 D  w+ ^& W. z0 S9 J1 O{
8 c, A) o" s6 H& N0 I    dbglimit=0  H: E8 k5 P; Y5 r  u( c5 s
    hardlimit=`ulimit -Hs`
# F" Z% x7 W" X1 k& y+ ~5 |    softlimit=`ulimit -s`
4 ?* |# q- U3 j- J    desiredlimit=60000
9 ]$ P$ ?0 H: c5 i' N5 t( s    hardisunlimited=0& C) [! x8 |* |6 z/ B* P1 j/ m
    softisunlimited=04 F6 X( x8 T% y6 [' D
    is64=0
8 c0 D4 Z3 y1 M' [5 b0 [9 j
* W8 ?0 c& H3 |7 }% V( }    case "$EPIC_ARCH" in" a6 b( d5 @4 d. E! M) f( y
    *SUN*64)& X  e  i6 W$ h/ ]
        is64=1
9 z) D6 ]4 k+ u1 p9 C        ;;  W) \4 t! ^4 x8 c& a+ N
    amd64). c, ^/ z5 ?" P0 n8 i$ A  f
        is64=1) z$ ^/ P2 K/ q4 p" `/ {
        ;;
* J: o7 F7 R' t    x86sol64); B# S) V& a% s: p# j) F8 s
        is64=1
% j) {- C( @9 r7 [3 I( }! i        ;;
/ d. q% N! `5 r    aix64)
, A4 y8 @7 J5 B7 p        is64=1
4 x3 d$ H! [$ G" y0 W        ;;
- ]7 k1 b4 o; V7 h" p5 c& P5 ?    suse64)( O7 o+ \7 Q, P+ i1 d; T7 m8 J6 ^
        is64=1
5 O- u1 o1 ]0 q' [* Z8 s8 d0 e        ;;
9 T' ]  s1 P* {2 v* p) Y    esac
0 Y2 ]. A0 R: L, {. T  l2 y/ X3 g+ x; W0 S' Z+ K( O! F5 V
if [ "$EPIC_WRAPPER_DVLP" = "" ]; then! G' J! ]5 W  R$ e- x) L
    if [ $is64 -eq 1 ]; then1 {+ n  k% v, e. R4 _- W( a! b7 s' x
        desiredlimit=200000+ ]  q* o* n0 m' p; C% D
    fi
' v; I: \. L7 n! I: a; jelse! l9 F$ k+ d) ~' z6 H; ~
    case "$EPIC_ARCH" in8 R- [) Q* C9 B9 Q  {
    *SUN*64)9 D! X2 p" C  @& G6 d! `
        desiredlimit=200000
( A# o% i% u  q4 {- N( m9 T; @        ;;
5 M( v: P& E. L    esac
8 Y, S: `$ g# G, ]# Jfi  N2 t4 ]& `& ~$ v+ {3 N
        - a* \5 Z4 E+ X
    if [ $dbglimit -eq 1 ]; then& y8 v( H2 i7 P4 e% J
        echo hard $hardlimit soft $softlimit
' M+ U: Y, w3 f+ O: N    fi& d7 u- U) h9 i) G3 z5 Q) R
0 B' H- R; C% P/ h5 M" X( R: Y4 n4 Y
    #stacksize can not be unlimited, pick smaller number6 L' D$ W( R6 h9 X
6 i1 C$ l: X, p+ z' d
    stacklimit=$desiredlimit5 }  w1 W3 f" J- v0 T

% Y# i7 \7 `  Z& s. }    if [ x$hardlimit = "xunlimited" ]; then
) L/ h. f. R0 ~        hardisunlimited=12 }" W6 e1 ~; }) y7 N* c+ e5 V
    fi! e9 n- o6 s3 f" Q2 N& c0 W9 V

  s# z2 t8 F9 q% Q* u    if [ x$softlimit = "xunlimited" ]; then
' b# _  {/ x3 {) }' C. C        softisunlimited=1( O& R! i7 O( a& L7 L9 u
    fi! h) G6 n" Y5 n$ ]% N; ], e

2 i4 M7 e( P7 u8 h    if [ $hardisunlimited -eq 0 ]; then
; o4 q& F+ m  i6 M) S        if [ $hardlimit -lt $desiredlimit ]; then/ {3 ^! F1 Z7 }3 O$ q1 h9 L
            echo "WARNING: stacksize hard limit $hardlimit K is too small."
7 l8 F; r$ n1 Y5 `' W            desiredlimit=$hardlimit, u; V0 R( Y$ ]! I+ I. w% ]
            stacklimit=$desiredlimit
! `( i) K8 m1 B" o0 X. W        fi  z2 _0 ~% i- H( t4 K: I
    fi
: d' f# Z: y8 m- ?) z9 J9 R0 M+ h2 }
    # desiredlimit is set to proper value (< hardlimit)
2 T# j1 q  p: W8 R7 U: e2 Q- ]% n# b1 ^8 D6 m* V+ P
    if [ $softisunlimited -eq 0 ]; then( Z5 ~9 x" r( S& j0 B" i5 O
        if [ $softlimit -gt $desiredlimit ]; then6 J! v, |+ i7 ?' v# {. n) u* R
            stacklimit=$softlimit/ P0 o% W( ]- H9 o' P
        fi. @: }0 n2 W2 W2 l, d3 g8 ]% v* D
    fi0 K3 H& p* s/ e9 K/ h: l

1 q" y' }$ V9 H) ^    if [ $softlimit != $stacklimit ]; then
  s' k6 x3 P5 g( E2 Y        ulimit -Ss $stacklimit5 r) J* z4 j( z. _* I: D
#        echo "WARNING: stacksize limit is set to `ulimit -Ss`"3 ^2 J* K7 i; q+ A2 ~* d, q
    fi3 X8 ^: d) |( v$ A2 i

0 e6 Q+ l& e( J% w    if [ $dbglimit -eq 1 ]; then
# }% ^( F' @% R# ^        echo stacksize hard limit: `ulimit -Hs`
5 `" V0 y, W7 X7 L+ B        echo stackize soft limit: `ulimit -s`9 B) w4 f4 j; A/ }  i7 B# J
    fi2 y2 d( [7 F5 E9 d) M
}
  ]3 C' O1 M8 y% t! y% D" d6 Q
$ u6 c  Q7 V$ {4 o+ }+ Gopen_epicscriptmessages()
3 Q; v* u; ]/ n# O) Q  k" g) M' F{, u. G' O: M$ ^9 U
#generate  temp ".epicscriptmessages" file based on pid- u' \. U" q0 G9 c
EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
- \' ]$ l# B: ?if [ -f $EPIC_SCRIPT_MESSAGES_FILE ]3 t, T$ j# }2 L  O! `
then
8 e) Q6 ~% O/ w  until [ ! -f $EPIC_SCRIPT_MESSAGES_FILE ]
1 o9 V" @6 c! f) p  do& P& V9 c* y3 c8 [+ y& n+ ^
    EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$1 n3 ~( Z! P# y  Q0 G
  done' K3 P% |' j; v0 y- y" Z! C
fi$ h  g! A; U- X
$ Q/ L; X; z2 P4 a% e" Y
export EPIC_SCRIPT_MESSAGES_FILE
% n: K8 I5 @/ _8 c' Q0 W}
+ }. [5 K" r: T( P" d  O' d& C4 a2 q9 X6 G

* ~* w- w0 ]1 f- j0 p' gcmdname=`basename $0`
( g- ^" [( [8 S& _6 a3 epostgres="n"" v* N8 S& Z6 [" {
ostore="n"
- m0 f( w7 T* K$ g  bgui="n"$ Y1 J1 h2 Y5 H2 U/ h5 A$ |
databaseOn="n"0 ]9 g$ ]) L( X7 F
f_next=0# P1 a1 j2 T  q
f_option=""9 F0 C, R2 F, ~0 e
o_next=0
3 f( \$ L) y. @$ s' B8 i8 K1 l: So_option=""
: I) X- f3 N# w5 BworkDir=""/ |: m9 x0 }2 P+ z; d$ C# v- |3 u: k
workDir_next=0
# C( j, ?- k1 j) h" verrFile="powrmill.err"' e+ e! s4 [; h! z4 j- Q
win32flags=""  ]/ e  q0 V' ]! w- C" }( }
ln_default="ln -s"
3 x+ _4 p" P5 F! a9 G$ I3 I/ B$ y/ ^
har_hilo_file=""
+ Q3 a0 E. _2 D( _6 n5 a1 J/ y2 N7 Rhave_har_flag=08 C( _; e5 ?3 R1 B1 X1 ~6 Z
have_har_setup_flag=05 A. ]3 w# ]) L
is_special_har_run=0
: L  }$ D$ r! X- Z0 O  phar_ofile_prefix=""' G, g) b6 _0 i# Y1 D2 ]

* B2 ?& i# w' g' Z- `1 Khave_va_flag=07 b: i$ t4 W$ B- x9 {, z
have_vaf_flag=0
! @, `7 \1 [( m2 |) ]: w# i9 |% RVAF_FILE=""
* ?/ U% Z! p1 M) PVA_FILE=""
% O. Q- E$ e4 L4 UARGV=""8 P+ [" D( [( E& I5 l8 }6 `

# e2 s! ]5 \2 GORIGINAL_COMMAND_LINE=! w$ ^) p  H0 {" x9 o. a& [. K
LOOP_CTRL_FILE=".ns_ba_env"
/ y+ q8 R! u, P# OALTER_HK_FILE=".alter_hkf"0 Y, l' q7 O3 {8 ~, J
ALTER_COUNT_FILE=".alter_count"
- q3 r: R+ R; \. {* ZMONTE_IMG_FILE=".monte_img_f"
- N* E" r2 `& Z' G* {MONTE_COUNT_FILE=".monte_count". e! o% B; j7 q1 n8 x
MONTE_CFG_FILE=".monte_cfg"& i# f6 S3 @( ]( `0 w; H* ~: p& y
EPIC_SCRIPT_MESSAGES_FILE=".epicscriptmessages"
! V, ^5 K, U# X, l% m% k' k& U9 f3 j$ ~4 @
open_epicscriptmessages $@
! u- O/ P7 R5 R& [. K9 z$ n( Y4 k. T
, @; n/ D. |& o$ c4 j$ jscan_for_hva_args $@/ B0 L: B$ f! _! D1 e& Z$ F
& J8 T/ c8 y6 Y3 ^8 U. g8 W
scan_for_har_args()
6 h1 @' }, G& S( _! w$ c) s{) E) q6 c1 k! a7 A  P
  while [ $# -gt 0 ]; do! v$ M; A# W' ]- v4 q, M1 E
    case "$1" in
4 N8 n  @5 k. B; P1 ]. k      -har)/ J; i6 m* E) q
           have_har_flag=1% m9 T- \# b3 [% W+ y
           [ $# -gt 0 ] && shift* V. V1 |- j! E
           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then0 Z$ i: \1 f0 t; I4 g* \
             har_hilo_file=$1( M* n- }  U& O( q" e8 s$ `+ P  ]
             shift# h0 D9 B; |+ \/ B4 ~
           fi6 ^& P5 l7 j1 T/ U& }" Z  E$ w. u
           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then
/ L8 L/ _5 B5 t. }             echo "Too many arguments to -har flag. Only one hilo file allowed."3 X% z6 j: f' _" d7 t8 e
             exit 1
5 |& S5 }$ X: n" I( z           fi
0 ]. h$ }6 P3 J' Q           break
5 E! K& M' t- x        ;;5 E+ o9 R% Q/ t7 A: G9 R: R
      -har_setup)# s* N5 a6 T7 }+ J$ K
           have_har_setup_flag=1
& d& a+ o( i1 q! C           break* C; u5 Y% r- z( d
        ;;3 `) L& W# ^3 R2 p4 X* `! K3 f$ U
      *)
  Y+ f1 _2 g! P        shift! g' n/ p& ~* [% J" y7 U  {
        ;;' z/ L1 C" h6 k: k( J
    esac% d( @( W" i7 A4 G* D& B' v
  done
! @( {; t7 \! i9 a# P}. K7 D/ S' W) y8 n  ~( C7 ^( f
+ E+ L1 T9 A/ I9 w: X9 U
scan_for_har_args $@
1 l+ \; g4 K" D9 p0 f0 }: t8 ^" t
4 g7 c9 E9 ~! H$ l+ V( H9 @for argv in $@
2 ]- ]+ T6 q* N/ P1 `& V) U6 bdo
! z; `+ l0 N3 U7 d9 c: S+ U7 c   ORIGINAL_COMMAND_LINE="$ORIGINAL_COMMAND_LINE $argv"
! {( c7 K8 F; i9 D: O. K; Q    if [ $argv = "-gadb" ]; then
8 u9 K6 J  V& h/ J7 G& j" U        databaseOn="y"1 F1 V7 U' K. Z2 I
        workDir_next=16 B* H1 a# K9 n, G6 F! z
    elif [ $workDir_next -eq 1 ]; then+ E- t) o4 q% h6 Y
        workDir=$argv
/ t0 t' X8 d2 }7 M: c        workDir_next=0' v0 ]' U4 G( c/ f" b
    elif [ $argv = "-ga" ]; then* j) }2 |+ ]: T0 l' K
        gui="y"
3 N. P$ j3 V+ X( u2 y    elif [ $argv = "-f" ]; then/ z8 J% ]' G6 b" h6 _
        f_next=1' Z( B+ K4 h0 ~5 Y2 O* ^
    elif [ $f_next -eq 1 ]; then/ ~  z6 x8 P" g  e- m' h/ ]
        f_option=$argv9 R9 V5 ~, }5 J& d- l0 s& y
        f_next=0
9 O( O9 O4 ~8 |; c6 C0 k8 e7 x    elif [ $argv = "-o" ]; then  a- }9 S2 m3 p. u/ n, O; o8 \
        o_next=11 i+ W! `% H! S) g
    elif [ $o_next -eq 1 ]; then' m% d. ~+ n4 d# N
        o_option=$argv* ~8 k: q9 }! J
        o_next=0
# ]: E9 @" v+ ^- G# q8 {    fi+ |) m1 m$ b6 p* o3 h
done
( d3 V4 `- B! G7 Y1 l) B; {echo "Command line options: $ORIGINAL_COMMAND_LINE" >  $EPIC_SCRIPT_MESSAGES_FILE , f) q. O7 C' Z9 C: L  X# J

! U  I5 i2 j% c/ B+ j' ?if [ $databaseOn = "y" -o $gui = "y" ]; then
& C. B; w: y) |0 ^) M! T& P' T  if [ $cmdname = "pathmill" ]; then9 I, L3 m( i0 p! O
    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5"  -o "$EPIC_ARCH" = "SUN4_SUNOS_5_64" ]; then
: e  `8 k* }  o+ j0 N         ostore="y": R, e+ }4 g- e2 I# q9 g# ?7 p
         postgres="n"9 [/ a0 U2 O% {9 ~3 X
     else0 y+ s% I" Y* }( J8 g" m- |
        echo "athmill GUI is supported on Solaris platforms only" 1>&2
4 L0 E$ J& ~5 G) e        exit) n5 u4 i% F8 T# o" b
     fi
. n  o: X: e! X' G  else
* [/ x' P3 N( e& F    postgres="y"
8 m  [8 g( Z2 \8 W$ i; z         ostore="n"
3 K, U/ u. z7 Q8 Q1 Q" C# L% v  fi
; D' T& X0 ^' y% {) nfi
7 ]; ~  N. |* k; ^& o- \* I) m
3 G5 i' v) }" @9 ~if [ $gui = "y" ]; then
7 E% j' K/ p* h% Z    if [ $cmdname = "powrmill" ]; then
) n  B! T. N: ^& l6 T        pwga $@
! R2 `3 z$ k5 ~0 p3 O! Q( ?        exit
9 @* u$ a1 N1 f7 Q. p: |    fi
5 g( u5 W8 t3 K! b$ D * `4 y9 `: X  t1 u1 ?9 A$ G
    if [ $cmdname = "pathmill" ]; then
$ S4 O5 e& F" l! g5 r$ s        if [ $ostore = "y" ]; then+ |' O, _  `2 Q
           ./pathfinder $@; H% k$ {; l3 I: O
           exit
4 Y7 ^1 a9 ?7 \        elif [ $postgres = "y" ]; then
' U; o9 o  B; G' ~6 N6 u           pmga $@, B$ h  O) M+ }  h3 C, r+ g
           exit/ D" Z& a- i; \5 }8 ?1 _5 C
        fi% g" E9 x& b% p4 l2 A' ]5 Y) U
    fi
5 A) b/ ^# E, z4 q' Z( w8 Pfi
5 N  U1 U5 C4 |4 Y7 y0 s
1 S" ?' ^; e) H, wif [ $databaseOn = "y" ]; then
' d5 K. q& v( X9 T. x   if [ $ostore = "y" ]; then& @' E6 J, w: N; N) w# f
      if [ -z "$workDir" ]; then
8 R; L/ Q+ c3 _6 J' S4 T         echo "Error: Missing argument for -gadb option"0 a  j% X6 q: n8 k
         Exit 1
4 T5 q$ I/ z4 d  B" _9 W. l      fi
3 P' c# k4 v3 R3 L, b  l3 Y   fi
' }, F7 f3 R1 y& ]- h   if [ $postgres = "y" ]; then( ?  R( ^, `/ v% S: e3 x
      if [ -z "$workDir" ]; then
3 o4 R9 @1 ~7 s4 b1 A         echo "Error: Missing argument for -gadb option"! N5 w/ y( V! u: y
         Exit 11 u8 t6 k5 K/ _" d, E7 _# U
      fi, n! j  C0 W1 X: }5 `" f
   fi
: T/ U9 [+ a8 J6 f3 ]8 Efi1 L* \/ l& k- Z+ B( J1 y4 n

) V) b# H3 f# kif [ $postgres = "y" ]; then/ ?* _. A3 }$ r0 Q3 S

8 J; z4 G6 |& o! K$ f/ \, F& ]    if [ -r $EPIC_BIN/scripts/gui-init ]; then
7 _; F0 w# k# N1 K* I0 m! K        . $EPIC_BIN/scripts/gui-init
4 M) y4 L+ ?2 Y$ A  Y5 N6 x' v    elif [ -r $SES_ROOT/bin/scripts/gui-init ]; then
' {$ L5 `5 _, L: u- h, B- K        . $SES_ROOT/bin/scripts/gui-init
# l' t& v/ ^9 n& @: A  ?) K1 A    else
. U( `8 Q2 u4 {6 F5 U, n        echo " ** Installation in \"$EPIC_HOME\" has been corrupted!" 1>&2
9 a+ e! B& z2 T  Z; [- u$ f, u        echo " file bin/scripts/gui-init is missing." 1>&2
4 W' z' {3 q" q  n    fi9 L" j/ z+ q  p# x+ V2 r' r
2 w8 f: @9 l) B$ w- G
    workfile -tool $cmdname $@6 X  Q" u, e  A) c
fi& G2 L3 a6 x' }  I# ]: g8 M
+ @% n0 h  L. X1 _/ P5 e: V/ Z
if [ ! -z "$o_option" ]; then% O6 M- J  _( m& V) F& b) N
    errFile=${o_option}.err
+ n$ r; Y8 p* N1 i8 Lelif [ ! -z "$f_option" ]; then3 g4 j$ E% Y7 T9 R
    if [ -d $f_option ]; then
, o# r, L  E  y4 j  S% }- g        errFile=${f_option}/powrmill.err/ G: H3 w: L) |  [! A# d6 u1 s
    else errFile=${f_option}.err
0 \. t- }9 Y; y  o4 Q! X    fi
2 p9 E# S  s! l% _; w5 G; Mfi
5 ?0 u5 }; S4 u" E
. o( Z& Q7 L5 K0 }6 S6 B
3 U$ P, W2 H4 Xif [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then6 a' K2 E& v, L. V; ~: E% X
  rundir=.epicrun& H4 b% i% H% {1 h. R! ]
else
8 V+ M* [' U% d: r  rundir=.epicrun$$
) n2 d  M7 T/ X; Q6 Gfi
( Q" a/ r) m$ q& d) k7 D7 w, _4 f, ?1 T
libpath="$rundir${EPIC_DLIM}$EPIC_DIR"& N2 v7 e: _3 {' o6 r

+ m" o' N5 h& o' W7 b8 mcwd=`pwd -P`
% \/ W( S: ~, ^, c1 n2 e+ }if [ $cmdname = "acehdl_w" ]; then
. A" T: {; G: B  cmd=`basename $0 .sun`
5 E5 U* \0 o  _6 _  p  cmd=`basename $cmd _w`3 r9 O$ `# x/ e: b
else
# z2 O) n5 Q; l! w  cmd=`basename $0 .sun`
$ N+ s2 j( U* w* I+ ]. xfi9 g- g; b; i! h& z4 f6 _

/ L' F2 _" V% s5 t" A6 J! u* Icommand="$EPIC_EXEC/$cmd$EPIC_EXEX"
- _) j. B9 r% E7 [  D$ v7 R7 i[ ! -x "$command" ] && echo "$cmd: not installed!" 1>&2 && exit 1) ~! c4 b6 q. H# M( c

0 v9 i9 \: {, ?  B0 e9 t# buildmod extracts -u/-fm options and calls genepiclib* M% R/ |4 t# v3 d* g5 _  {9 _5 c6 p4 s
# It also set the remaining options to variable CMDLINE
8 G0 K3 r, B! M' w+ r& l( s4 T# look up in .epicrc for -fm & -FM parameters
0 Z# l9 w3 Z& j% t$ a, k' K* H! S7 E- I/ c/ C0 @
fmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`": ]2 R, H; R; T
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`"* b& ?0 \8 e, M  G" \
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`"
* [5 E5 h; p4 a6 Q8 y7 N
' p6 m$ ~! _. f8 gFMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`"! w; F% W# e. Q4 d8 t" _
[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`"
5 T  X% |$ d8 t: K# R8 Y[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`"
* Z- Z& B! l* d
+ F& W) F" D2 V! oif [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then) M  j" b% X# T$ e& {) H3 b6 b  m4 z% J
    # note that the buildmod script will set the CMDLINE variable
: s, o0 h) k1 |$ b6 x    . $EPIC_BIN/scripts/buildmod
. T; i4 U5 V5 L; Q7 F1 o. ^8 C! K- g% x9 H1 x
    #echo "This is the value of cmdline=$CMDLINE"
" S- O( E# R( P' W    #exit 0! X* k( [8 u) ^7 x
: K% s. t9 u! e2 B
    # if a new timemill/powrmill/pathmill built, run the new one
4 F+ \, Y8 _# U$ y    [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX"" Z* ^/ O8 K) K1 x1 J4 o
fi; @6 d  i. u, ]: j5 c5 O1 c6 y
3 d8 f+ O1 z3 u) v$ U$ K% m4 O
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then
$ Y- u; ~, R: X- \/ O. E# |  if [ $have_har_flag -eq 1 ]; then
% t) b7 m- v( G% W; N    is_special_har_run=16 o/ |$ E! v' u. b+ l" R6 n3 }
    if [ "$o_option" = "" ]; then
; s/ l7 L. {) K  b/ U) Z      case $cmd in  f9 Z9 F% M  W
        timemill)
, Q# a. _0 S5 t, K8 `  j0 _          har_ofile_prefix=timemill
( h( D+ i- ?/ f9 P. c' E8 O          ;;; a) m& N' m- v  ^3 N& f
        powrmill)
5 b( T6 D  o; E7 w$ q4 {& a          har_ofile_prefix=powrmill
' y* m" Y! V( @. I          ;;
) m9 K+ Z+ R0 ^7 a2 H        nanosim)
/ {9 Y/ ~8 s* {( }          har_ofile_prefix=nanosim# U3 B4 L9 s2 R( i( k
          ;;4 E! s; k7 d% @  X
      esac
0 H' i7 R1 n& q* G2 j    else: v2 E& L; _7 K; f8 }( T* Z
      har_ofile_prefix=$o_option
0 `1 T+ f- m% X" o  F    fi2 r3 I% p; d4 Z4 P+ i
fi
$ y  L. K! b: g- @  Hfi8 \" ]9 d6 C6 ~! M/ c( p) D3 ^

2 o4 }, L* G2 F( i+ b( ^% M3 Q6 A# Call Double precision version of the product if -D" X+ W% f- a8 f' k8 E: p
# or simulation time > 1,000,000 ns.% U6 N! P/ L- o9 i8 B6 m8 d- z
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then7 S  i3 b5 b; p, K

. e4 C4 I. ]$ `6 |* }- Y$ L6 i/ G  # Now the binary always has the ACE feature
: F- X7 t. v9 W* S% }% _* ^, V5 @  i  USE_ACE=YES7 \: _/ F3 m  @0 e' U1 o

, S1 Q& H! h* Z1 X. @  HAVE_DP=NO% x# M  @6 M$ M/ D1 Y/ D
  EXTRA_CAPACITY=NO+ [& v$ d; X: }9 p; ?
  DB_REAL=${FORCE_DB_REAL:-"0"}
8 r% D; _% N: @, n( u4 _4 n, m. q/ `3 q9 ~; X' e0 |# a
  # Enhance for ACE ease of use
' q3 g9 E* G3 |, I# H3 d  # If no command line option or only a -T option, do:. j/ v4 I& K& ~: f/ _
  #   1. set -A option/ q  O' I0 v0 u- T0 S$ y/ e* r
  #   2. assume input file to be hspice1 ^1 q8 N4 z  H' a1 i
  #   3. set -o to input file prefix* i0 ~3 r; O7 B# p2 H
  #   4. set -z to input file prefix# W; _$ X% [5 f5 q
  #   5. set -c to default config file
5 p$ }& w8 q) l# \* u" V3 O  netlist=""/ n" w. h7 O5 M- q2 t# E+ @3 W
  minusT=NO
& h3 h, s0 n% f7 G  useStdCmdOpt=0
1 [) k* @' b% B* M$ A$ Z  prefix=""0 h) W% p! o& `' O! }
  circuitType=""
/ p' J- h( i  K2 S* h$ x  for opt in $CMDLINE$ z$ z# Z4 J* Z) m0 c9 C
  do
% r0 [+ y1 O3 q  B' f    case "$opt" in
/ ]4 H' W( I& N. Y$ T' s0 G, w/ y      -T)
+ F+ a2 S" s- S7 p% s- S  N& J7 k. h        minusT=YES" ]) f0 W" m2 }4 x+ Y/ }
        ;;
; T% I2 `7 m) G2 g0 ~. _4 i. ?      -*)
0 a# g- H  V5 r  }. F% i        # using standard powrmill command line
9 \& N) u+ F% r1 t' U/ z        useStdCmdOpt=16 W7 u8 g4 J1 E- r
        break1 V) U* \/ w  x2 _' q
        ;;
8 Z3 n/ H$ t! o& c1 e8 b- e1 L- n; d      *)3 A" j/ f2 q6 _8 n3 i& j
       if [ "$minusT" = "YES" ]; then
$ t3 i% w4 I7 S8 e8 [' R, o) L6 t         circuitType=$opt
2 J" o3 d5 `' s5 b1 d         minusT=NO  # reset flag
. H2 \4 L) ?1 D* X4 z       else 7 d% g: e  m2 Q# N; L% A
         if [ "$netlist" = "" ]; then
- N! Q% n6 L( t4 }! q1 Q9 @           prefix=`basename $opt`
% ?7 F9 I& H% P) h, V! @           prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix`
) [" N. w6 q# K0 a' ]4 E2 C         fi
1 N0 ?$ E! u4 Y( H% W: I         netlist="$netlist $opt"
6 j- |! h3 S" E7 w       fi$ q+ E* R. _, E1 @
       ;;
  V3 g& U0 _7 V! X    esac
' ~0 H/ _' _7 @0 T  done& ?, k6 B+ ^& u3 s* Q: b: x. V6 j0 @
) T) F5 b, ^/ h' Y* u( O5 N
( w; J2 g- c% j. c* r- D4 M+ S
  if [ $useStdCmdOpt -eq 1 ]; then
9 J1 n+ ~3 |0 }6 o$ s' V    # use standard powrmill/timemill command option
8 \% w* n- F2 k! y, i/ a    for opt in $CMDLINE, p2 |: Y7 Q4 }. w# I$ V$ Q0 z
    do1 s- T4 n+ V  @+ C
      case "$opt" in
$ S; a/ s. w0 f# Z4 @        -A)/ ^% P4 U) a6 h! j3 u; M0 z
            DB_REAL=1
9 M) s5 |/ Z' _3 Q            ;;
5 O& a- [: M2 V0 B8 e7 G      esac
, y% M, Q" r( w) T4 ^    done* m9 I  V  ~& ~$ I7 Q2 ^2 ^; p
    if [ "$netlist" != "" ]; then& S5 j; l+ S+ v' `" A4 \7 S* `
      CMDLINE="-nspice $CMDLINE"  a7 x; m8 _# w
    fi+ ^, _5 x1 V) C0 I0 b+ `  D. n
  else
+ a* l8 n4 Q0 C5 |9 L% O    if [ "$netlist" != "" ]; then7 F4 }: R! r" |! @- N" V
      EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"}0 w6 e$ u7 \. e- _7 F
      # construct new command option( \# ], y/ `& U8 f' q
      if [ -f $cmd.ini  -a  "$circuitType" = "" ]; then
! u" F. B2 t9 @6 v1 p6 g1 C" E        CMDLINE="-nspice $cmd.ini $netlist"" w3 O2 Y$ U* A/ X: \& X, R8 ^
      else
9 m0 C2 e/ s1 }+ G# y        if [ "$circuitType" = "" ]; then! D# g2 M. i, M. c5 _
          circuitType="msana"
( X" T3 G9 I3 {        fi) d6 K# G9 }* I$ A8 R! Q
        CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg"
+ P) y- r) K! F( j( f      fi
6 N# V6 s4 i/ ?' ?6 K, @      CMDLINE="$CMDLINE -A -o $prefix"! E) K% V! B9 s. l' |7 D% f( I- Z* \
      DB_REAL=1
1 s' h3 O; s1 c3 b; e2 T8 U      echo $cmd $CMDLINE
) V* Y. Y( K6 n    fi& R5 r* q7 H  e2 F. W/ p$ h8 `3 C
  fi
9 v+ D1 \# T! J& Sfi # cmd is timemill or powrmill or nanosim or railmill or pwarc9 Z+ o& Z' ~9 ^" u( l

( K& x' Z1 c6 L8 W( m; L& S* g6 c$ w[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a"
+ e, q  r9 j" r[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a"
$ [! i  Z) L( [[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v"
! U! ]1 d+ w7 f7 F
' w$ j7 e+ V% `if [ "$__engine_wrapper_called__" != "Indeed" ]; then* h- w7 J. M! f8 F  t# ~
    __engine_wrapper_called__=Indeed
& c* h! I! @2 \2 ?; t( O! b7 u    if [ "$cmd" != "amps" ]; then/ D& m5 b2 U8 }% i# P7 ]
        export __engine_wrapper_called__* h9 F1 \4 S7 d0 @% B! b
    fi
0 O6 A4 m" e( B( {6 m! V
! j+ ?& F* e' l; O1 h  c    trap "cleanup" 0
% \: {1 a6 _0 M# |& U" V4 H    trap "" 2& I. k5 J! ]8 r: l( A8 \) O6 Z

0 X. ^6 c1 }* n# N) R. e# S    [ -d "$rundir" ] && rm -fr $rundir! U+ v3 I# A  y- Q
    [ -d "$rundir" ] || mkdir $rundir! Q- \) j5 ~, C. S& f, t

2 S2 P( M0 R( f9 z    case "$EPIC_ARCH" in
  G: |2 p7 n( l6 K4 c7 m$ P5 _( C5 M    *SUN*64)   6 w9 d, K4 ~9 W" ^4 z" }
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"8 ^; e5 R' R8 j' g3 x3 |7 H
        export LD_LIBRARY_PATH
0 o5 O% I& R$ A, h% o0 k9 c+ b        suffix=.so
- z% ~2 ]0 _" O$ X        ld_err_code=127
; T  e' U# {% Q1 {4 F0 u' i! q$ O9 l        ;;" y( i% X- m/ t5 l, k9 t8 G) g# N
    *SUN*4)   
0 `4 |1 `% |) [  B( Q  Y        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
* Z2 u2 R: P0 i" }3 N7 c3 M3 z5 q6 k        export LD_LIBRARY_PATH
/ F: H! l  {* n5 h1 R        suffix=.so.1.0' f5 a+ N4 J- f2 E
        ld_err_code=127
' \2 B) U* t0 x) D8 K, s7 r" z        ;;
5 b& `; b  o9 C: u7 v) r. W    *SUN*5)   % v1 ?5 o; y- D" A
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"7 Q0 E& g, c0 f( B# Q
        export LD_LIBRARY_PATH  N/ k- e) K9 A% o
        suffix=.so
& m$ Q& [) T9 Q2 E9 D* O8 V5 ]1 u        ld_err_code=127! ]/ P6 _' c; x* Q4 s
        ;;" Y. F: [2 p( n6 M- {3 A+ V2 V8 R
    x86sol*)   
7 W9 \3 [/ G! n4 J9 S' L- g        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"8 E8 `9 W* s- r3 M  ]
        export LD_LIBRARY_PATH6 i5 ~, @) h; ^4 k3 ]: W# i
        suffix=.so
9 Q% J' G$ U% S3 j% V        ld_err_code=127; A6 ^- L; o  H1 f" [
        ;;
1 B0 ^7 y* r; f  g3 y  i" q    *AIX* | aix64)   
% _) b, d" @6 i6 b, P! ~        # When genepiclib creates shared objects, it creates a import file and
* S8 @/ v/ p9 K4 }; @        # uses timemill as program. So at exec time,program timemill is needed : J; l! m9 ?* x
        # in LIBPATH
" n7 U7 J' k' d/ ?        $ln_default $command $rundir/foomill- q2 [/ T! T/ f1 w7 Y  h# y
        LIBPATH="$libpathLIBPATH:/lib:/usr/lib"
5 M% F% r. F' c1 d* D5 X6 n& d7 [        export LIBPATH9 L, @# D  q4 c  `" |( V: [, ^
        suffix=.o
5 P' x0 F' t% @        ld_err_code=85 @1 y1 v2 _& |& e) J+ u
        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
4 b/ e! G5 Y5 ?, M2 F" M8 ^) Q          tdir=`echo "/tmp/d"$$`
, ?9 {  V! `& a! g9 V/ L/ B          [ -d "$tdir" ] || mkdir $tdir
  s$ K& Y' V: v0 ~: f          if [ -f $EPIC_DIR/libCustom.o ]; then6 j8 b& A/ R$ e5 x2 U4 K! r) F, j
             cp $EPIC_DIR/libCustom.o $tdir/
6 a/ h# A! y) C3 I             $ln_default $tdir/libCustom.o $rundir/# }- ~& i  @4 h; [) e6 m3 }4 s, }
          fi
# ?6 P8 P- }' d: o, o: g. e          if [ -f $EPIC_DIR/libModel.o ]; then
: C7 c# T& o! n+ @7 c9 j             cp $EPIC_DIR/libModel.o $tdir/
  {. z9 \' k4 s6 k: p; e             $ln_default $tdir/libModel.o $rundir/' C1 ^, E! \6 p- i& }, X
          fi
" Z4 v, l! Z# d* b$ W          if [ -f $EPIC_DIR/libFuncModel.o ]; then
  _2 z) t8 W! s             cp $EPIC_DIR/libFuncModel.o $tdir/6 Z% G& n- K% M4 t; i: z$ _% Z0 q
             $ln_default $tdir/libFuncModel.o $rundir/
" q$ A$ t* t( a# s          fi# I8 I8 X9 e' s6 R' R
          if [ -f $EPIC_DIR/libFuncModel.34.o ]; then
9 Y1 m* e1 `; q3 W8 B+ [             cp $EPIC_DIR/libFuncModel.34.o $tdir/' `" W/ G$ F, \1 [5 c
             $ln_default $tdir/libFuncModel.34.o $rundir/
+ u8 A- m% h) F0 Y* u. c1 m( A! U          fi
: K8 M# ~) X) @' w& p. O        fi; r' K2 K$ m. E9 q% L2 u/ B$ U+ w
        #Set the IBM flag to enable more shared segids
5 f: z' Y) n/ J; S; C$ r0 x" \        EXTSHM="ON". j. {1 ^- b7 G: _2 H" d" ]& V
        export EXTSHM
5 a7 Z& ^9 \2 H1 }1 `3 W        ;;
3 f( |3 z8 [% m' F/ F* S) [( s, H    *LINUX*)    - Z% N( m3 J6 ]
        suffix=.so+ }8 Y4 d$ `* ^& B3 }. ^
        ld_err_code=1
4 f  \( x. R  {) Y1 I        ;;0 H$ u* r$ w" \& ^, t# j
    *amd64*)
& I3 A. O& K; Z" B8 v        suffix=.so
# H* g6 ?; [: P% l( Q/ O5 g        ld_err_code=1
! `3 e& l! l( w9 c( t" @        ;;$ P7 J% Z6 k3 _$ k% j! y
    *suse64*)! Q" Y" V! U* n, e" L8 h. J9 s
        suffix=.so
# b! o+ a, t! I. A4 \: q        ld_err_code=15 s$ Y/ h9 ^. ]$ V
        ;;
# j1 u- d4 t, s/ W    *suse32*)   
% L( M! y* r0 o3 F( z8 D        suffix=.so& p) D+ p6 T4 a3 i6 e! p
        ld_err_code=1
% I( L+ z$ d: w* @: x        ;;
* m' Z4 `3 |" A: l" M( {6 z( l    esac& R0 P# E8 k$ [: l

, h3 {) x( x. Z5 O    [ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix"9 Y9 K/ m4 }8 ], h% ~, l; O
    [ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \8 d. `7 d3 J" C, z# j; s
        && [ "$cmdname" != "nanosim" ] \
5 N2 z: u; Z5 d8 N* e        && [ "$has_model" = "YES" ]  && ulib="$ulib $cwd/libModel$suffix"; e- z$ W' L. @  g) H8 E# w, K
    [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix"7 @7 m/ o1 x8 k: t
) }0 D8 r/ n# n
#Look for command line option for libFuncModel.so
8 C# E/ o9 t$ [#    user_library_next=0$ J6 b+ z: Z, c8 J% t1 B7 ?0 ^
    has_fmlib=""0 Y, x: i! \* b1 A5 j+ o. ^
    for opt in $CMDLINE1 I4 f% P* J* y
    do
4 l$ C' u, ]% x      case "$opt" in
! v! N2 g! k1 s; X/ W+ z2 T        -fm)
& s3 l! S) F7 v. J7 Z            CMDLINE="$CMDLINE $cwd/libModel$suffix"3 R& O# b1 r3 h$ {( j9 P2 v! @
            ;;" c1 N% D1 ?6 L. y$ Q* a
        -fm_user_lib)$ x% V( E( b8 s
            has_fmlib="YES"+ y: n) q4 M% E" g
#            user_library_next=12 i6 e* o) g: O
            ;;
3 ]: b& A/ I5 E3 ~# p0 y        -xc) 0 q/ H5 i0 ^2 k! J% D' P
            if [ "$EXTRA_CAPACITY" = "NO" ]; then& x  _9 v% U$ U  q: K, K7 u
            EXTRA_CAPACITY=YES
. E" f$ ~/ F# B' F: t            fi$ F/ s. i4 e( G* j' y, ~1 z
            ;;6 I/ n+ H6 n) k0 |
#        *)
) j2 m* p- D* H% ]1 @#            if [ $user_library_next -eq 1 ]; then& z% ?2 k* o; o, q
#                if [ -f "$opt" ]; then. v! x+ x5 t; }3 ]
#                    libfmodel=$opt% I: ?. Z. J8 _% l& S7 `
#                else
* a: N0 C: s% @3 j' y, K- G0 T! k1 Y#                    echo "-fm_user_lib: Specified file not found"* g1 k$ u: ^4 m: i! n
#                    echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages8 G% ^( q# p4 j; O. i: M
#                fi
; V1 H* n8 }, v1 |, c6 X#                user_library_next=0
1 \0 z1 Y8 j) A#            fi$ U7 E" N# k' V. Z2 A6 T
#            ;;, M' ^" U& ]# [8 \7 m+ L
        esac5 w9 z6 u. Z. R. G% P  O; c
    done( P3 F- @. K$ P. I2 o" o5 q0 Z! s# T
+ o) U; o- l4 v( V
    if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then
/ q( i$ {# b3 N        flib="": D6 [# F& \( x. {* H
        if [ "$has_fmlib" = "" ]; then( C) p. v% `' ?; Z
            flib="$flib `get_epicrc ./.epicrc user_libraries`"
5 D, h! O+ [! V$ c$ l# u            flib="$flib `get_epicrc $HOME/.epicrc user_libraries`"7 I2 S& v) K. B6 G
            flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`"/ g' x* j: S3 [  j
        fi/ `! l. g+ r5 j
    fi
% C* v/ D1 e3 ^: p' O# B$ j7 E, f
1 E* n: w4 S9 H0 r  b3 H   for i in $ulib
0 i9 t' W( \% }* D8 d   do
- H3 Z) i  n2 @* J9 |       [ ! -f "$i" ] && continue
: _9 t* A# H- F+ i$ q% g9 g0 P' Q6 u       dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd2 m5 x0 ~" |) Q' h5 w$ E6 Q
       i="$dir/`basename $i`"* U0 E) k' m" A/ t1 ?
       case "$i" in& l- Q$ n$ |7 ]4 @( V
       *libCustom$suffix*)    [ "$libcustom" = "" ] && libcustom=$i;;2 `, I( r2 e% l+ c4 B  G- F
       *libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;;
! u0 Q5 `) D  Z! z# B6 q2 f       *libModel$suffix*)     [ "$libmodel"  = "" ] && libmodel=$i;;( N5 R# H' M' C$ L0 s2 A( {' w: l
       *libva$suffix)         [ "$libva"     = "" ] && libva=$i;;( M8 v1 F# M# `+ `, h' P
       esac
9 d; w& S8 A+ ?- j3 o" b       [ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \
& x: T3 h8 s  q1 m( Y        && break
  L- L5 X. q" `' @' ^   done& V5 V% ]7 q: o7 x8 D# O' ]% [
$ A/ [$ b* h. `, ]6 O
   # symbolic link shared libraries to .epicrun$$
5 D! R, ^3 d( _9 x' c9 W. l# Q# h    cd $EPIC_DIR; epicdir=`pwd`; cd $cwd' h1 G4 e6 w8 ^2 L
    if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then1 O5 p0 k5 p; |% M# @1 a( b
        if [ "$libfmodel" != "" ]; then
" }% o7 S# l) a2 M             [ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \  f+ n  T% F/ x/ C8 Z
             echo "Using $libfmodel ..."  && \
- D$ x3 S" w5 n: N5 Q7 y0 P             echo "Using $libfmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE3 K, B. m( }/ {  \! K- r9 @) o! o$ i
             if [ -f $rundir/libFuncModel$suffix ]; then
7 P5 N: V8 N" p( [3 e7 @               rm $rundir/libFuncModel$suffix
0 Q( E  V& M# G; H1 O( ^             fi7 D6 w2 v% U8 Y# |. S2 Q
             $ln_default $libfmodel $rundir / H% v& `9 b. O, ~
        fi' k& Q1 H' X5 a! V+ C5 m
        if [ "$libmodel" != "" ]; then
  F* I; h/ y* x6 _( v& c             [ "$libmodel" != "$epicdir/libModel$suffix" ] && \
/ G* \* E: E* M% Z# V/ Y             echo "Using $libmodel ..." && \
" R- K' i6 B: S- @4 O             echo "Using $libmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE
: c( |/ \1 z2 L+ ?, e, Q             if [ -f $rundir/libModel$suffix ]; then
& g; ]( H2 Q! A/ G" G& y               rm $rundir/libModel$suffix
3 k% h+ ]2 b, T# H             fi# F" w) T% g  f3 q5 q( D' l' r% k2 r
             $ln_default $libmodel $rundir " ^9 H# j0 n* O% h5 n% z7 j% p
        fi
' Z8 x' n3 n3 h( U. A( a0 t7 s4 @   fi
0 B) N/ ]: X( E; I6 ^- g   if [ "$libcustom" != "" ]; then
% x# ^6 h* j& s        [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \
( q7 ~% u* Z: x, r- p/ _$ _        echo "Using $libcustom ..."
1 D) }, `) @% @; O2 b) h        if [ -f $rundir/libCustom$suffix ]; then+ r: i0 @, N" s
          rm $rundir/libCustom$suffix
! S* Q) c1 X, f% B. T4 l% [2 L' V        fi6 }8 a5 s# a1 a4 @5 l: s
        $ln_default $libcustom $rundir
' V: Y& w4 L+ ~0 A# n& v# e9 r   fi, M9 o# B5 t$ M' f; H/ A1 ^' |
' R4 L' X& W9 b* ~6 t  V+ k
   if [ "$flib" != "" -a "$flib" != "   " ]; then
, |) E! v! q% x3 m. b        CMDLINE="$CMDLINE -fm_user_lib $flib"
1 s2 q+ O# M/ N& T   fi
( z/ ?4 A8 {+ v0 x0 U
$ [  ?* g5 |2 P+ {% L   if [ "$libva" != "" ]; then# W: n1 p" k" ?! }, O+ h) r
        if [ -f $rundir/libva$suffix ]; then
$ m4 U3 i  U6 r) o          rm $rundir/libva$suffix; V- a3 c" a- Z4 z4 y$ A& S% S7 J9 @4 k) C- o
        fi
$ G7 M: E. F, w2 O* a0 S  b7 x% Z        $ln_default $libva $rundir
$ w$ B8 F  ]5 B   fi
- g( s6 U$ M6 _8 F) c3 C7 q2 X9 G! ?' y  h! N8 n0 Q$ z
/ m5 W; `7 r; z+ n* d; ~2 l6 S) k
    # VCORE design library
/ ?4 I7 x: ?. [- L6 |; c' O    if [ "$vlog_design" != "" ]; then
0 n2 z+ O% ?6 @  X+ `" S        $ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`
  Q/ H; B. m0 b  b. {0 _; s    fi# O  ~2 r+ i7 B; }

& `' O. \2 r6 A    if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then
* x2 n3 o8 @4 m$ ~        EXTRA_CAPACITY=YES
5 C, H; }& @7 h% A  {/ m- A    fi
$ _0 ^' P. P% y& u4 j
( c2 ~6 t+ b6 p7 x+ i    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc"
- ?/ c' h) n5 O) R4 l    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc"
8 n( m  ~, `- ^% r    #Create temp file if dual process is on& B" q4 [7 ]+ R) h
    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then
8 ~* O" o; l" {. ]+ ?3 V        if [ "$EXTRA_CAPACITY" = "YES" ]; then9 g+ {1 P! d" J& c
            touch $rundir/rpcidfile: v* r+ B* }- d! r# i- g
        fi0 c* e/ Z# U9 k# J
    fi
4 M5 U$ a* }; f( ~fi: Y3 _% f3 L2 N; b7 e: W& ~
8 R' ~. q; @, [9 m
run_cmd()+ e4 |& b+ G* q6 ]; p- n  b+ p
{9 t; ]" Y5 K) r$ X2 Q
  command=$1
* x1 d$ p0 `/ j+ J8 U  shift0 h$ s' E1 X* G8 n/ o. q) p
4 i8 {6 d+ T  K. q& W/ Z; }+ a
  if [ x"$VA_FILE" != x"" ] ; then6 P4 r1 T/ y8 z) V
     cmdline=$ARGV6 T# K. `5 ]  n* _  v/ I  R
  else
0 \1 t% ]# H1 ~     cmdline=$@* u/ `# L* U0 E, p5 ~9 \! q
  fi
/ t/ ~* r$ ]% y/ W- j  o+ ~0 K! r1 |+ b) J0 N
  debug=${DEBUGGER:+"$DEBUGGER $command"};% t" f' N1 t( h

$ v6 z% i" j% J( @& e# X: Z  # To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a5 q6 u! b7 M+ s
  # so save-restore may work./ Y! r7 e  i. Y& H5 `6 M' Z
  setarchStr=
# Y* |" i! k! }. s# l3 l+ E2 n  cmd2run=`basename $command`. a+ h' S8 k8 A& i3 [6 c9 ?
  if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then
0 |: O1 r6 `6 [5 B6 N4 _    if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then
9 C3 n5 M' x: U7 ^, o      setarchStr="setarch i386 -R "
7 M% [, c  r8 L, k/ y. k    fi
+ ]8 f4 w9 ~+ I, g1 F/ R' @    if [ "$EPIC_ARCH" = "linux" ]; then
2 {. K  q. P5 c$ [% v* b! D      setarchStr="setarch i386 -R "" a* D  `! M3 h- R; y: z9 A$ \
    fi. y+ X/ J% _8 {$ `1 [( |- e& E
    if [ "$EPIC_ARCH" = "amd64" ]; then
& f( g0 \) T1 J9 }) o% ^      setarchStr="setarch i686 -R "
- n% I! e: Q0 w/ I    fi1 s2 n+ U8 Y5 h& ?5 {, s
    if [ "$EPIC_ARCH" = "suse32" ]; then
; B  S' P" L, J* r0 j$ W" W      setarchStr="setarch_suse i386 -R "% s* N; c  [+ ^8 H4 _7 K( r
    fi
+ {: P+ y$ P" h# H" D8 H. n0 K, ~    if [ "$EPIC_ARCH" = "suse64" ]; then
4 M8 ~4 S1 h0 r4 s' r3 u      setarchStr="setarch_suse i686 -R "
; _( E+ t6 h+ {  N5 ^6 j9 O    fi
, N' i7 j+ X( b# U6 V  fi
6 Y  `  b0 B$ P+ Z+ ]& L! q7 m3 I" Y0 e; E- q/ d- {; ^! D6 [0 {4 P
  ret_stat=0
1 f( l( @. I8 L( k8 I" O- d: j  H" _  if [ -x "$command" ]; then
* ]! I8 a  {+ H9 ~6 a- \      if [ "$debug" ]; then& r5 P. U0 F3 B# Z
        _debug_args_=$cmdline4 m* R5 {( Y9 y  H3 M
        . .epic-debug3 h9 W9 X" a8 L
      else
& \4 ^5 m. _8 U+ A: u& K/ s7 D        DEBUGGER=; export DEBUGGER
( H& n$ n! o/ n& o$ o        $setarchStr $command $cmdline
0 b$ V. E; O* k3 Z, @' Y8 e      fi; ]0 i4 p4 {* A: `
      ret_stat=$?
8 \+ g) N5 q; t5 q+ }  else. m, C# z/ h$ F- w1 M" o7 E
    echo "Corrupt installation, executable \"$1\" not found!"
% y7 ]; V7 ]; Z4 X  b    ret_stat=1
6 J' Y' G; X2 R% V  fi
0 u" z( P0 r+ K1 r) `# j# Y}5 T0 Z. a5 w# n4 W, p( ]+ o6 |& \
  ]8 I/ N1 c  z
# keep runing cmd if ctrl file exist
- X5 q: h1 g8 h9 A- W
9 g- O( K. T: y1 K  P9 k: hrun_loop()
+ C2 s! i1 }* ~. E$ N{) r8 q8 X0 D5 t# ?  a7 z
  command=$1
# {7 G' W& [( y+ e, F& B4 _  shift
! h9 h. H7 p! I3 u7 j" O% P7 ^% O$ J' }3 j# @' K
  if [ x"$VA_FILE" != x"" ] ; then8 Z5 G9 R6 o5 |- v1 Z% r- y% t% i
     cmdline=$ARGV
" {% e5 F0 H  a# U9 C$ S  else  a9 d1 Y/ q+ ?( r: H
     cmdline=$@
. \$ p. Q8 s5 n" P4 v: S1 S+ x  fi+ E9 e. [7 I1 B  u5 ?0 Z+ t
$ n, Z" H" ~# k6 W+ }$ V9 `
  while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do
. n3 J  v6 l0 L9 G1 a6 d    . $LOOP_CTRL_FILE$$
- X' z7 f2 p3 G% C- Z) [    run_cmd $command $cmdline -banner 21 p% Q9 q  h- g* p. }' P8 G4 I
  done;- ?% M$ Z3 D* X1 p  W; W, ?$ K
! q! t4 @' F" n9 P3 \
  if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then0 A/ \9 J6 f4 z+ O" ~! p
    rm -f $LOOP_CTRL_FILE$$4 p; v* {% k. y9 H) N6 m6 z
  fi2 i- V3 [; U7 E! ]8 W1 c
}: U5 J3 ~; R0 X4 s
! q/ l2 l' {6 B8 _  \' E8 w
har_check_ret_stat()8 m$ M6 l& G  Q2 o4 |' K, P. }
{
5 T5 r9 X, w4 F2 ^, j  N5 ^  if [ $ret_stat -ne 0 ]; then
- L: W$ R; [# P; O    echo "Simulator returned with non-zero exit status. Stopping."8 s" _7 P# d- F! @
    exit 1
. A. n: z) J( j  |: A2 z! j  fi& i2 ^# E& s) O0 F# V+ J+ a& ]$ C) j
}
1 q/ H) V6 R, Q  D) `( d  t. S$ K8 d+ ]* D, l5 W1 M3 h' ?" K
#  t9 |1 I- D! n# t0 p% b3 @( Q
# set stacksize and datasize limit
/ x% W# t! B( M  @3 p( e2 A! h4 d# g#
5 |& ~. K7 `, K9 ~1 I5 p9 [) G& o) o; f
set_data_limit
, E7 L+ b- W4 o0 r8 @/ hset_stack_limit. i% |" r. n( |2 u9 `& K3 }- C

6 ]8 v9 S  d, Y, o, t0 U% i#rm -f $LOOP_CTRL_FILE
) x" q. G- S/ T4 }5 e: l; @$ h! R' d5 c# Y- K
run_main(), g6 n7 Z7 k8 M7 s9 u
{
5 |" G+ o! ~5 q& U; G4 w5 W9 V& Nif [ $is_special_har_run -eq 1 ]; then0 E, G0 s; a/ k& p
  if [ "$har_ofile_prefix" = "" ]; then- o; U" [9 c  L  c7 n
    echo "Wrapper bug. Notify Synopsys technical support."  ]  @; v/ Q- q3 {! |7 N# J1 Y
    exit 12 B( E: w6 J# s! p# p
  fi$ Z( a+ V& a# `. l& x- N! i
  if [ "$har_hilo_file" = "" ]; then
, s* e4 G' t3 u2 ~    # no user specified hi lo file - do both runs  n  t9 [% A6 v; Z  [- f
    run_cmd $command $CMDLINE -har_one -har_setup
9 c5 b/ x6 J* u9 F% V& n    if [ $ret_stat -ne 126 ]; then% q0 q  y+ a. V6 C/ |7 {
      har_check_ret_stat
# _& k  |/ |: n! F, r- ?      if [ -r $LOOP_CTRL_FILE$$ ]; then
+ j/ H! u  }9 Y* c% \* Y        run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl; p9 S5 A9 V6 v, S' ?, h
        rm -f ${har_ofile_prefix}.hl
$ B" {8 I: p) M, H' E& `' ~      else  j6 g5 W% v  E2 @* b
        run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl' [' n  K) z# {" {
      fi( b9 C" Q; p4 Q6 K7 \9 D
    else
/ U6 U. {; S& C" r/ \      ret_stat=0  q; {+ z; \, Y* K! t
    fi
+ X3 }: P& \  k# }! U8 x6 N  else# c) V4 H0 K  c* }9 {
    # user gave a hi lo file name& c2 l" g2 l+ F# g
    if [ -f $har_hilo_file -a -s $har_hilo_file ]; then6 [2 T  q5 T( [! |, n. s
      # file exists - use it - only do sim run
8 S, ?% ], b0 `* N      run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}$ ?$ P. d& a, m2 P
      run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}# i6 U* `0 |4 n* c# z( P
    else; n5 {# `( Y1 K9 h7 N3 N: w
      # no such file - generate it - do both runs8 F' l- V, a8 @  l4 F% n
      run_cmd $command $CMDLINE -har_one -har_fnf -har_setup4 Z7 M1 p4 f0 }
      if [ $ret_stat -ne 126 ]; then) l7 R- N" y/ y, a
        har_check_ret_stat
$ `9 _3 _. F# g2 b8 @        if [ ! -f ${har_ofile_prefix}.hl ]; then
9 u; X$ q$ X2 O/ e2 l! F          echo "No hi lo file generated after setup phase. "
3 \( K/ I, S+ z% g0 T          echo "Contact Synopsys technical support."
; I: Q9 V( Q* z# Q  k          exit 1
" M" R0 D9 I3 X/ f. n        else) h: q" X9 A$ P' L8 |; z5 D6 M
          if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then
: F! y( ^6 h9 M8 @3 ?9 @            mv ${har_ofile_prefix}.hl $har_hilo_file
# E1 A( A) l$ f          fi
' Q& P$ e- q0 }5 N* T2 ]6 Y        fi
) v0 m/ a: t* Q/ L" Y$ U        if [ -r $LOOP_CTRL_FILE$$ ]; then6 e8 W) w8 `+ U7 z
          run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file) H6 B4 j2 I8 c  W2 ^
        else
5 x1 p. H8 r! @& H          run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file
/ c" Y9 o, A3 K. B: N* M* z- w        fi
: }: q5 B0 f# Y+ N3 Y' _+ ?2 A: \      else
+ C( H+ }& q) t3 Q9 q        ret_stat=0
! ^$ p7 a2 f* S4 p& |5 o      fi
) Y- `* b/ t" P+ [7 Z) _' \    fi
1 l$ Q% b) T0 e) u9 `6 C, Z8 W0 o  fi- g7 m! j3 ], p3 x. T4 X+ W! d' q3 t% V, A
else  
0 h0 T% C% b2 r3 O# don't loop if -har_setup2 p; D0 W" v9 f3 x' m
  if [ $have_har_setup_flag -eq 1 ]; then
# C3 ^  R* ]4 M; R' i; v1 A    run_cmd $command $CMDLINE5 }/ }2 V" V! l9 }" V7 Q$ W+ ]
    if [ -r $LOOP_CTRL_FILE$$ ]; then7 G* N% B! E; a& o! o6 v
      rm -f $LOOP_CTRL_FILE$$: O- T& W" t5 i% B( V5 _
    fi
( h3 Y5 z( Z7 _1 F  else
/ u* D8 o- M  R, @1 D( n; L    run_cmd $command $CMDLINE. C7 b: @* {; \
    run_loop $command $CMDLINE
: R5 t) y4 Y4 g* G0 r  fi/ s5 `0 r* I8 F7 f
fi6 A* @1 x1 s, ]8 Q. w
2 @7 _( w8 u2 K
if [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then% d2 x1 d8 o- F1 x1 v
  pwCreateErrDB -w $workDir -e $errFile9 ?/ s3 l, E+ C" D
  ret_stat=$?+ W% y$ Q  O0 ~5 x( r
fi% E4 c  ^6 S. i3 d  r
}
# j0 b( f: y- L* S5 A
% V* H! R. k/ Z" zcleanup_alter()
  K, M* p) j9 G) _  R{
. x& e  V! X$ Y# \. A   /bin/rm -f $ALTER_COUNT_FILE 1>&2' B  o4 R+ j$ C' S2 r; Z
   /bin/rm -f $ALTER_HK_FILE 1>&21 O8 |1 \* p+ I6 J  ^
}7 F5 }, p+ ?; d6 _" M* E& Y3 S
" f. C% t% F5 @* N; W. p
#generate alter temp files based on pid
4 n5 e8 g9 @% f0 R0 HALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$
# Z9 d1 ?7 q8 D7 {8 ~if [ -f $ALTER_COUNT_FILE ]! e* j8 `0 O! l4 ]% B5 ^, k( N4 }# P
then
) w* P; _, j/ d3 H# s  until [ ! -f $ALTER_COUNT_FILE ]2 D* N0 ~$ z3 Q* a$ d$ r
  do
& F6 I: z/ V+ Z    ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$
! c# O$ d( |1 R: i  done, n, |; V( Q! u+ a: x" @
fi! a; [* g$ R) X% X/ ]+ Z
export ALTER_COUNT_FILE
$ N9 v! k- Y8 R% i7 |
$ q% k2 A0 K% C$ J9 B' L; z! h/ LALTER_HK_FILE="$ALTER_HK_FILE"$$0 H# J! r( w2 J1 H
if [ -f $ALTER_HK_FILE ]+ ?7 W/ V5 V, W5 l7 s1 v* e
then
6 x9 A$ ], C1 O: Y% g  until [ ! -f $ALTER_HK_FILE ]4 d+ v: _6 ~. z8 O- Q
  do; c/ ]7 l+ `2 k* z7 I/ |$ Z) X) ^
    ALTER_HK_FILE="$ALTER_HK_FILE"$$' e, w$ T1 [, q- ?- |( N
  done. t, {  |& l" U
fi( n2 \8 Q7 z8 B5 H/ M
export ALTER_HK_FILE
; l) s7 I: x$ v7 S( n, B1 P7 O$ Q  f( m6 F* X+ O$ ?
#generate monte carlo related temp files based on pid6 H# }1 G1 k6 s
cleanup_monte()
7 P' ~% D: |& `{% X. U$ u6 c' }3 y* k2 [$ Q
   /bin/rm -f $MONTE_IMG_FILE 1>&2: h+ S: c7 s. ?' I& f2 B  D
   /bin/rm -f $MONTE_IMG_FILE.gz 1>&2
0 ^0 \9 p  [1 x+ d  I   /bin/rm -f $MONTE_COUNT_FILE 1>&2/ T3 m4 [( p" Z% G5 V- `0 E1 q
   /bin/rm -f $MONTE_CFG_FILE 1>&2
2 V& ^( r* K: ^3 x/ F, t. d/ z}, a. M5 |) N; k$ ]! J

% s# f: v4 s# T& p& x2 F; jMONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
; H# U7 S$ _# E( J9 \if [ -f $MONTE_COUNT_FILE ]
$ ^1 h' a0 k2 z" R0 f, a4 t, uthen- u6 v4 ^4 u( p' d$ ?3 Y
  until [ ! -f $MONTE_COUNT_FILE ]4 R0 Y  s5 r2 V& x& h9 f
  do
6 @# F# r3 E  @' i. ]    MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$- n; F) w3 h5 w
  done9 u7 p- D/ R4 F% P+ \" [# t! U
fi
! o- \5 p8 _% L) ]1 v' R  texport MONTE_COUNT_FILE
- q" v- u" c# }- I- f1 _
! Q, S8 \% A! hMONTE_IMG_FILE="$MONTE_IMG_FILE"$$7 R! y+ W( o: g9 o3 |% {
if [ -f $MONTE_IMG_FILE ]8 ^. u+ K6 a! x3 j
then
% e1 i+ _  a% H6 p4 s# x$ N  until [ ! -f $MONTE_IMG_FILE ]
9 \0 V# P2 d  p+ p& ?+ g. M, g  do, D4 g9 a- B. V
    MONTE_IMG_FILE="$MONTE_IMG_FILE"$$
+ L% O; V- w) g  z9 N  done
3 A. t$ ?; y6 _6 U  [/ m$ J) Ufi5 j5 Q2 i* y, C) J4 U
export MONTE_IMG_FILE4 x8 i! ^' n' {) f2 i$ i

  h% T# R: |5 ?; iMONTE_CFG_FILE="$MONTE_CFG_FILE"$$
% c+ n: r. O0 o5 L& a  H* |" }if [ -f $MONTE_CFG_FILE ]
$ z4 V7 \6 y0 W6 y  ythen" z3 G4 {; J4 z) D
  until [ ! -f $MONTE_CFG_FILE ]
+ g+ S; v4 ]3 }6 z, b( K3 P  do  g6 p& p$ c/ f2 h6 p4 @
    MONTE_CFG_FILE="$MONTE_CFG_FILE"$$
/ A& l/ Y- y7 ^$ _$ _! H  done6 C# a. E5 [5 {5 O; l$ e/ r
fi
# S, H6 A7 v9 i% o1 E' u
  n. \6 i6 l( T' B6 C" v# main iteration- j1 U2 F3 K0 w6 t  a
run_main
% A( f" ~9 [  Z/ s
. J# `8 |+ q/ h/ Q4 @" U& u. Aif [ $ret_stat -ne 0 ]
4 a0 X' J  v9 ethen 6 G2 A1 Q7 E$ @
  cleanup_alter
- ]3 r, o- ~) T- v1 Y! V  cleanup_monte# F/ J4 M; \. K! M1 n: F0 z
  Exit $ret_stat
+ t0 N0 ~" X* `- kfi
2 U6 y/ `- a7 L% j- Y4 }! u# V7 z0 V: @; }/ K5 Z& s1 o
#Alter related iterations6 F9 a' v% c" s, Q9 G1 }

8 Y/ z. {4 w( Biterations=0$ X: i: A9 L  ?8 W: _- W
count=0, B4 G9 h) h/ k3 o
if test -s "$ALTER_COUNT_FILE"  ^: e/ }4 j! J# b0 h# k; m
then
- Z1 q+ _, S8 ]$ {6 f  if [ -r $ALTER_COUNT_FILE ]; then- _. f3 ~" ^* F! f! a3 J
   exec 7< $ALTER_COUNT_FILE/ z, |; C0 b- \
   read iterations <&7
4 t: @1 U& U) K1 q fi6 e% T* ^) T; @$ H2 n
fi
$ X5 s" q3 ?# c1 n
( |* P0 d& i- v$ e* Ftrap 'echo Program Interrupt; cleanup_alter; exit 1'  2
5 \/ o! k( k2 s9 m- F, s0 ^- mwhile [ $count -lt $iterations ]
% Z8 Y5 l1 F2 Z0 ]1 T5 ~do
  {" I1 s; b# z1 ~- @5 y: O count=`expr $count + 1`
& V/ }/ w6 j/ S9 \% \ ALTER_COUNT=$count
" \, Y7 I4 k8 J8 I6 D- j export ALTER_COUNT
8 O( B, N/ A8 q( V, F8 P* B/ d$ L  h: F  W# U* O$ S! c% ~
run_main9 u, e" L% S0 y+ K- Q2 t- H

* f  ^6 y5 K* I9 T- ddone
4 N# [2 [! o& A- S: u0 A0 t* o
, V! |  R6 n: |# \4 x/ T2 i#Monte carlo related iterations
# H8 B4 Y6 E5 d2 R1 k/ U6 e& |7 J
7 o6 [* k+ G( f- V2 Umonte_runtime_summary()
+ Z" u! [/ B) f7 M9 R* p7 i{
- E% ^( v8 i+ z  keyword_1=real
  v+ }; C3 a' C1 J. a/ p  keyword_2=user
3 U* z5 ~# t! b7 K) d$ w( ~  keyword_3=sys3 q+ W" n7 p" T
  ofile_prefix=nanosim- u' s+ `2 w( b# x( Q( U3 n" W0 E
. |' e# ^; }( v1 [" E; L
  if [ ! -z "$o_option" ]; then
) R2 a* c* k3 g- i7 a    logfile=${o_option}.log/ x. y, @9 Y% ?* Y
  else
! |9 H5 m6 f4 ~; q9 M$ [    logfile=${ofile_prefix}.log% L' U, s( d: c9 u3 X5 p
  fi
: ]' n- |5 m) d3 W. c# v9 [2 ^! d9 U3 F' w$ f5 o' j5 a5 \: c
  if [ -f $logfile ]; then9 w8 I. k" y' c: T/ `
    echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile      & q! r. b0 U% [$ R9 ]7 j3 ?1 Y8 U0 F
    cat $logfile | grep ${keyword_1} | grep ${keyword_2} | grep ${keyword_3} | awk 'BEGIN{ t_real=0; t_user=0; t_sys=0; } NF==6 { t_real=t_real+$1; t_user=t_user+$3; t_sys=t_sys+$5 } END{ print "\t", t_real, $2, t_user, $4, t_sys, $6 }' >> $logfile# g; l9 I# L) x
  fi
4 C1 u: Z  D' M1 ~) ]! Z}& i/ ]! t) t, m9 G* [
, K4 c& n8 K- l( L
next_monte=0. j- D0 N/ [: w' l5 ?8 s: G$ S
cur_monte=0! {# R9 b$ r2 `8 V/ W7 B4 I- q

- `* p5 y! ?7 x& w5 Z* x. Hif test -s "$MONTE_COUNT_FILE"
" Y3 N/ l( a- _: Y; i. z& c; L( ithen
7 `+ s* r, l5 p  if [ -r $MONTE_COUNT_FILE ]; then& k- k5 o2 Z6 \  c0 k
   exec 8< $MONTE_COUNT_FILE* {, ]8 b. k$ c
   read next_monte <&8
" l+ L3 p& x+ x8 a) K1 [: B( Y  fi6 i9 l$ u! r) Q( V4 `) R
fi
9 L: ]% F7 x: c4 ]' v1 e& d; e7 _/ ~: j% T, Z/ o/ S& N, j; V2 t
trap 'echo Program Interrupt; cleanup_monte; exit 1'  29 D# g/ r; W$ i1 M' p) J
while [ $next_monte -gt 0 -a $next_monte != $cur_monte ]
4 ~2 J  i& F) F3 Q6 Q/ Ado5 `: e7 p( d) w
  NS_CURRENT_MONTE_COUNT=$next_monte
! A. p2 B, t* O  ?; T  export NS_CURRENT_MONTE_COUNT- \0 `' D& Z. C

2 F# S0 A  p, v/ _  echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE
6 }! t4 B8 m- T2 S! q$ a3 P. u  CMDLINE="$CMDLINE -c $MONTE_CFG_FILE". W' K3 U. k5 B" W, Y  j1 U
  run_main9 T' c8 w- a; m  t& l1 t, `; ^
" W/ h) V4 ~7 T" D
  cur_monte=$next_monte. R9 M- U2 ?8 S0 ~5 B6 v
  exec 8< $MONTE_COUNT_FILE8 D2 {) q5 w+ H  o1 |
  read next_monte <&8
3 W" a( ]+ L! |: ]done
3 I; t1 w" u. m: u! w) C- l/ l& M7 d1 L1 L3 q5 ^; I2 ~
if [ -f $MONTE_COUNT_FILE ]0 w; U) X  a" g+ B. j
then; F, _5 j% Y( T, l
  monte_runtime_summary4 c" Z5 H0 }  h
fi4 R, w9 t) F5 i: d9 F' r. m
4 g) ^7 Z) C$ G9 {5 j& b
cleanup_alter
: U( O% h8 Z3 B& A4 m9 M3 Dcleanup_monte
1 _# K% Z1 A" t4 ?$ U8 R+ H- F) c0 a2 Y/ h' U9 ^
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-6-3 12:02 AM , Processed in 0.153020 second(s), 16 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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