Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

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

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

[複製鏈接]
跳轉到指定樓層
1#
發表於 2012-5-6 13:58:13 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
10Chipcoin
各位大大好:. G% g6 {6 C; S1 e  ~. O
                      小弟執行nanosim時,卻無法跑出視窗來,有個錯誤可是我不清楚該如何解決?問題如下! `. T  c/ N7 g
                      [: 113: 64: unexpected operator( _( A- \4 A, n$ V
/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim: 1: Syntax error: Unterminated quoted string4 h$ q- ]* ]" c3 n
有大大遇過這方面的問題或是指導我方向去解決, 謝謝. 0 @3 g) M$ P7 A2 ]( o
我在猜可能是這個檔案內的文字需要修改 但不知道該如何修改?% K* R! v* Q7 x9 ?: \4 L
以下為/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim 的檔案內容:) ]* a8 |4 B2 e2 ~
    #!/bin/sh
0 V+ V& q$ _4 }. V- S#+ }$ M2 x0 H$ n- z9 O2 q: w& O* K
# Copyright (C) 2001 Synopsys INC. A5 ~- B) @+ l& B
# EPIC Dynamic Simulation Wrapper (DSW)0 u  G- w' D$ I. G& l3 d% c* ]
#, V  @. @- ~% ]& V4 o- i) @
eval ${DBG_EPIC_WRAPPER:+"set -x"}7 n- y) b1 K4 l9 C
& i3 A) c/ `9 z1 q
if [ "$EPIC_WRAPPER_DVLP" = "" ]; then
+ N* \, R8 X6 a' o% Z    TEMP_ARCH="$SES_ARCH"
0 p5 x, u  d! `' helse( C- N  m0 B1 O8 Q" R
    TEMP_ARCH="$EPIC_ARCH"7 c+ S: S9 Y4 C; x2 r: ?
fi
% g7 G# M3 r6 }. s- }1 X+ R  v% s+ Z8 f3 P7 }9 n
scan_for_hva_args()
4 Q' l9 M' M- L1 x1 G{
# b9 `% @7 B- ?7 ]7 |2 U* `; x, w  /bin/rm -f hva.init 1>&2
9 S% p) f& y$ X% @( h! Z  while [ $# -gt 0 ]; do& D: T& A! H) n$ S6 N
    case "$1" in
8 y# \9 a1 c2 G8 \. |# Y8 Q% G      -vaf)! c/ Y. h# j4 W2 f  B
           have_vaf_flag=1& N1 h; c& C0 G% H) \1 t1 W: V
           have_va_flag=0
; P9 r; k/ G& i) W: k2 j7 X4 D2 ~           shift;
7 C+ i0 z: s2 Z  _3 n           continue;. Q1 B/ a9 D4 w1 ?. }
        ;;
1 \) U9 v* K$ J# F' _( a      -va)
3 P9 F3 N  \8 Y6 \7 U+ U           have_va_flag=1* W: G" A6 ~; }  y. H8 Y. H
           have_vaf_flag=0
7 D2 X1 s9 v- r           shift;8 D# m  _6 n1 r) X$ g' R* y
           continue;% f7 q, a1 [: J8 k* k$ I- K
        ;;
! I- l6 m# }" y3 v      -*)
4 x5 S6 F- N6 V7 i           ARGV="$ARGV $1"0 J9 ^0 X7 C! F' e; P
           have_va_flag=0
+ R1 r: `; L: H9 k           have_vaf_flag=0# z. y/ _" ^, R+ O! W0 y5 G) X
           shift;
8 ^9 C3 \7 A, B3 O* x8 |6 T: g2 H           continue;
) X' q. D1 W; U6 t$ q, w7 A        ;;! A2 j- X) k, O8 \- h# Q2 Y( D: u, B
      *)- k# g8 b" `7 p5 v& ?
           if [ x"$have_va_flag" = x"1" ] ; then 2 O- t; w# X3 a' W" Z1 ~. L( [
              VA_FILE="$VA_FILE $1"
5 {3 q4 K% J3 w           elif [ x"$have_vaf_flag" = x"1" ] ; then 8 Z/ T7 F2 o" ^! i7 f
              X="`cat $1 | sed -e '/\;/d;`"( B  z5 E& R; G/ c# Y/ G) l
              for token in ${X}; do1 t& V$ d$ k& g4 ~$ [
                 VA_FILE="$VA_FILE $token"
/ C1 j% `1 k2 E% ^- B              done ' ?' j" g8 F" R: l1 G4 O
           else6 a0 |( u/ [: ^
              ARGV="$ARGV $1"
9 s7 Z& A' J# t8 I           fi
' f8 W+ k& T# x           shift;) p' ?9 o, r: T+ y
        ;;
! @  S1 g0 f9 I+ q    esac
3 w9 Y* I+ G; _6 K* l* S- M: r  S  done
7 X& l& Z5 I; x* D
4 s  D! D  _2 e" P  if [ x"$VA_FILE" != x"" ] ; then
8 m" U8 O: Q  r/ j8 i% X+ t% o2 [% B##     /bin/echo " xxx ARGV $ARGV"* ~. E; \9 O" i* n6 V
       /bin/echo "choose nanosim $ARGV ;" > hva.init/ k# h0 e7 j& t& |9 F+ o" @
       echo vcs +ad=hva.init $VA_FILE -o simv
! c" B8 V, t1 g, G3 L% C5 x       vcs +ad=hva.init $VA_FILE -o simv
3 w1 @4 ]9 U. T/ s. K0 s       exe_status=$?
, D1 q0 U( W, ]7 J* l0 o       if [ $exe_status != 100 ]; then
7 B! N+ a! S) e3 d          /bin/echo ""
" {8 L$ d5 J; \7 @" h. V          /bin/echo "ERROR: Execution of vcs exited with code $exe_status"1 D2 x6 ]1 ?% ?/ F1 B
          /bin/echo ""1 _: k9 }4 E  u, J# R: p
          exit $exe_status( z) o7 r, X5 R/ Z. @* `8 ?
       fi+ Y2 @, ]3 X" T- [9 p* z
       hva_files="-n simv.daidir/amsVD.ntl simv.daidir/amsWRAP.spi"- _" P( p! s/ {  H6 V
       ARGV="$ARGV $hva_files"( Z  {/ k; ?; Q- h+ b+ d0 D
  fi
- O* g% X2 F/ e+ ^- a}9 A$ S# U# _4 ]; Z
#-------------------------------------------------------------------------
( C5 J$ t  ]( u0 e- A9 q4 T* ?: m3 A3 _: z. q
cleanup()
0 \$ d0 A! r7 D+ O  J2 f{
& s. P7 [" A! r    if [ -d "$rundir" ]; then
9 L* x$ a; n9 `3 I4 a. h. U        # On AIX, a .nfsXXX file is created if libModel.o is removed
& j; g+ T6 X& s2 l2 o9 B        # so .epicrun is not removed because directory is not empty.9 ~" H! A4 t) `
        # Solution is to remove it again if the first rm failed
1 W1 `4 K- {# S) v0 q1 `8 ^        # (rm -rf $rundir || rm -rf $rundir) 1> /dev/null 2>&1; i* m* s. A: h' f3 g% {, \
        if [ "$EXTRA_CAPACITY" = "YES" ]; then
7 M6 H0 X5 P6 w/ `        chmod u+x $rundir/rpcidfile7 h1 G& d1 R  p6 P" k
        $rundir/rpcidfile
7 T( m+ [: I) F2 ~. B, W6 K1 n        rm $rundir/rpcidfile7 \% i9 L$ L- s: x% |
        fi
  K9 }- T3 W2 `& a* a        rm -rf $rundir" {2 m9 q$ L" b8 ~* ]2 J. z* S) w
' i- R3 r# C: u! F0 H' z0 m1 K! _2 l- e
        #Due to NFS problem, we have to copy files needed to
3 h5 h# \# e7 t2 e( e1 T& t        #/tmp/<temporary directory>, then symlink's files$ V9 F! B1 `$ s! E: E$ P. V3 |7 d
        #to the local temporary 'rundir'. This avoids the problem3 y. @( L! \* H  [$ X( b
        #to remove 'rundir'
4 v: W) b* I7 p+ J        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then, M; F6 G/ N8 R5 X# ^9 o
          if [ -d "$tdir" ]; then
6 X5 @" Q# E9 _            rm -rf $tdir
) B2 u+ U; ]; ?; r0 N; S/ g* f4 k          fi
% G, T. V  J+ w' W7 _        fi
2 b3 g3 o+ {9 B8 L$ `    fi
0 s/ g) H4 c$ I    if [ ${exitstatus:-0} -eq $ld_err_code ]; then1 C4 E) ?* D6 N$ l
        [ "$has_model" = "YES" ] && rm -f $cwd/libModel$suffix
8 J: L: U4 @1 H7 m1 N        [ "$has_custom" = "YES" ] && rm -f $cwd/libCustom$suffix
) T- q' p! z3 V  R' q    fi. Z3 g! F: @( a- q% H
    [ -f "$EPIC_SCRIPT_MESSAGES_FILE" ] && rm -f $EPIC_SCRIPT_MESSAGES_FILE 1>&2; c) s. n# g; h# f+ y4 }
    exit ${exitstatus:-0}$ j. }" M7 m7 E% u) A* K" n
}! H+ `6 a/ B$ O* L& Z+ k9 ~- c, h
  j" l! o7 K1 }
Exit()
2 T" a9 p' H! d{
0 U/ a3 f: f- W* H$ m# V    exitstatus=$1
' A9 ?4 f% R* T' r, B6 h2 x    exit $exitstatus# H- q0 M- T5 Y  X, k
}! R9 r* S) b  ~; n- R
; r" Q- l0 Y$ u, ~: v0 ~) {# V
# get_epicrc filename keyword
( [, I" R4 V5 e' s% g/ Dget_epicrc()$ j. U$ h" X, v5 P8 @8 b! m
{
: u# Y+ B" w+ n+ w- @* `    [ -f $1 ] || exit 0
3 z- {9 ~7 U- U& ~  w- Y. Z    key="/^$cmd2:/{print \$3}"
$ L, e: j( M' `% Z) m3 Y; t2 w    awk -F":" "$key" $1" S2 h( \% |; ~9 E
}
$ b; i  B+ @3 c& F
0 T. O6 n+ H9 U7 `5 |  v) U" x#
) r1 }, @& j4 `5 j# set datasize limit to hardlimit
+ s) Z/ V- U7 ?' \) `#* V+ n( o7 t% K* b! \
set_data_limit()9 E8 J7 L; `' U# x; Q
{
# L! A3 P/ u6 a" ]    dbglimit=0
1 d* L  N% E' l! N1 O2 [1 ]" q    hardlimit=`ulimit -Hd`
$ o9 X2 N0 O  e3 i    softlimit=`ulimit -d`5 Z* f& {& A& G* |
    desiredlimit=3500000. j6 o: c# Q$ u
    hardisunlimited=0
6 T( ?$ _. `; p    softisunlimited=0
" m1 j' j4 ~# s9 A5 V6 F    is64=0, [6 e# ^8 c* k& V
! q! d9 c" O5 C  W- p  l3 Q" B
    case "$EPIC_ARCH" in: n6 F0 J  P. ]# R' d! W0 l. L
    *SUN*64)
" D. c4 M0 q8 w# b0 S4 X        is64=1& _  [: C3 d1 Z0 O
        ;;8 Z! h. ~$ s6 i* ~0 N. [- B. y
    amd64)
: l- d3 c; q/ o+ c        is64=1
: s. l" M" `5 Y% ?! [( h3 K9 T        ;;& W, j) d' ?& @% A
    x86sol64)" c; V! l0 \; m6 H' N
        is64=1
- \1 _& n1 q. |- d) I        ;;
/ }9 `  U: r' u3 X5 s) A' ]0 w9 Q    aix64)
1 w( E4 K7 {1 k. _$ i7 s5 k        is64=1
2 n  E: r9 ?0 `. [% @2 V9 i8 c% ^% N        ;;
3 a  V4 I1 B! Y    suse64)
+ I$ r2 A* N" O* Z+ N7 B- W        is64=1
' [1 W- p% n9 a( \' u        ;;+ K4 g2 m$ i1 y( ]9 q0 S- M% @+ |/ L
    esac6 [* T6 y7 Z  H: Y0 J
( d! w9 V" D$ _! M3 f0 U1 U
    if [ $dbglimit -eq 1 ]; then9 y. @( V% j- r
        echo hard $hardlimit soft $softlimit
# w$ |. Q" }: D, e9 s    fi
! P' q; @( F/ @% N! ~
- h7 b/ T) Q6 U    if [ x$softlimit = "xunlimited" ]; then
9 G; l$ L* z: X0 N8 H, ?( }        softisunlimited=1
% l" I$ o; t; [: ~, X    fi
$ O) s, w& i$ W  H0 x- m" B7 i* h" c% \7 x3 q% M
    if [ x$hardlimit = "xunlimited" ]; then
4 V+ r7 A% o- z4 Z6 E& v        hardisunlimited=1; W. q% Z' x) p7 Y" b
    fi% Y% _' ~0 m1 [
: i: s* g& A5 T) X) K7 p
    # 64 bit machine should have bigger than 4G
9 P3 [( k$ u" q0 t# Z    if [ $is64 -eq 1 ]; then
+ }' C( l, z- M: t! i- n3 [  e0 O        desiredlimit=5000000
0 L$ C1 \' {& B6 D2 V; g& P    fi
5 }; K0 x) ^5 k( X( y; G% R+ g& l; j" @. X7 s
    if [ $hardisunlimited -eq 0 ]; then2 q% q5 e( |1 m
        if [ $hardlimit -lt $desiredlimit ]; then
' a. u1 V4 {* R4 x% w6 ^1 `            echo "WARNING: datasize hard limit $hardlimit K is too small."
: q+ b) ?0 P5 Q1 p+ u0 {0 W4 d        fi$ b0 [7 C1 d6 `& Q1 C: v) U; e
    fi
, ^8 o/ W8 p! Z- h! h+ M2 C  j+ z. o5 q
    if [ $hardlimit != $softlimit ]; then
' H7 E6 A, K: n6 E        ulimit -Sd $hardlimit- q- F! e' H+ c) y
#        echo "WARNING: datasize limit is set to `ulimit -Sd`"
5 s; A* K+ i/ S. H" \& ~    fi
4 U3 M% @8 R2 B- j/ M! f. ]. L+ _) @8 _8 S& l8 l3 J
    if [ $dbglimit -eq 1 ]; then/ f9 g3 y" d9 }( o
        echo datasize hard limit: `ulimit -Hd`) Z, |) W5 K1 I% a1 Z
        echo datasize soft limit: `ulimit -d`
/ [8 Q5 d! z. F. x2 s    fi0 J, h2 X6 a9 h5 k7 T7 T- R: D% U8 P5 ~
}  z$ L) r. w0 d) Z% y9 p

5 I3 e( m, F; N6 U#
5 N2 x& ]0 x+ T# [2 ^; x+ H# set stacksize limit to desired limit
! E+ d* z" i* I. m5 n1 |5 F( M( t#6 K/ O- R- x% V% I
set_stack_limit()
" D6 R/ I- d# c9 p4 A3 K% e7 m{
( g. Q0 [  l  j4 b5 |" K    dbglimit=0
" O% U6 K5 U- \6 W) z$ @7 H    hardlimit=`ulimit -Hs`; H& [; q  w8 P3 `1 A
    softlimit=`ulimit -s`
( A9 H- m3 `. ]( J    desiredlimit=60000, G8 a0 s; |0 ^* V# n' ?6 x
    hardisunlimited=0
& `0 w) p9 j4 E1 M2 }    softisunlimited=0
: d' `( `+ [6 ?4 t" t    is64=0
  I) ^7 d+ s$ }7 A/ ?4 T
; T: k- r( Z4 g    case "$EPIC_ARCH" in
/ N2 N; u2 s2 @    *SUN*64)
" A% C. x# ?4 [* w, I5 X& g        is64=1
7 B, h2 ?, i! v; l. {. l; U8 C' G        ;;) ]6 K4 g+ C3 z& k
    amd64)
" G. I4 C: D" P6 S; n( I7 z        is64=1
0 u, R  }7 W; ]$ ^. t        ;;
: T; y9 K9 [" Z: o) T& Y' r    x86sol64)- L6 M/ g( ~% j" G
        is64=1/ N" c3 L, q" {) F! x. u1 c
        ;;, {' o3 U! R6 P* l% I' G
    aix64)
+ T% r7 M6 @: \" S        is64=1( @7 K, }7 U& X! K; V
        ;;. D1 ~, `( ]- C: ~
    suse64)
3 o: B. w+ s- J: v$ V. j        is64=1
1 j6 L) Y3 n9 V6 e( G# C6 B        ;;
- }/ M# {# A- c  \' @" j0 X    esac
# j. {) w* y1 e* M/ n, L
1 O, ~/ Y3 T! ?if [ "$EPIC_WRAPPER_DVLP" = "" ]; then4 i: _- O4 f8 q% s
    if [ $is64 -eq 1 ]; then
& n6 r( J3 S7 A8 B        desiredlimit=2000001 g2 m& d, j  `! `
    fi( y' J# d5 Z$ S' V
else9 _- m. X8 K! c
    case "$EPIC_ARCH" in
  _/ j" k4 X2 K# D3 v% _    *SUN*64)
4 M4 w' E# X8 g1 \6 Q; h# S        desiredlimit=200000
7 c- p8 g  W3 N5 Q" S& G, Z        ;;
' l0 Y' b1 m9 S8 Z- ?: G4 @    esac/ f0 {' S+ O# M: [% z( ^+ V" t
fi
( g7 b! a: Z/ l) |  p       
- O7 ]9 l; \" G& s- n0 r    if [ $dbglimit -eq 1 ]; then
& x; h' Y6 R) s+ z        echo hard $hardlimit soft $softlimit
( p7 e7 r; F. u6 E# m( Z( h! }    fi  q7 _) s. m, E: G% y

5 C3 g: y( C* L    #stacksize can not be unlimited, pick smaller number
/ ~6 t! j+ f6 @+ W$ H$ n( {2 Z9 X. X2 i
    stacklimit=$desiredlimit  U  [# h0 Q- G% D
; O/ |& O: \/ ^5 _* E! Z, v
    if [ x$hardlimit = "xunlimited" ]; then$ G! }4 ?, T; B; D# Q) A
        hardisunlimited=1, d& O& t4 @7 _
    fi
& `0 a0 }- v5 x5 t
3 \$ N4 P. p. L, r. [    if [ x$softlimit = "xunlimited" ]; then4 w5 V. g; u8 g8 x, ^8 S
        softisunlimited=1
; i  A) J, H! {% d& u' a( i    fi: _, Y  f" Z* e" h2 b; @

0 w! ~$ Z: p$ r5 t) t: e! j% R    if [ $hardisunlimited -eq 0 ]; then
& |7 c% e5 D! M( ~        if [ $hardlimit -lt $desiredlimit ]; then, k2 i( G, [6 ^8 |) {7 a0 A
            echo "WARNING: stacksize hard limit $hardlimit K is too small."
8 J0 D8 r$ e* M7 E+ y1 N            desiredlimit=$hardlimit- F" v! T/ v6 i; a9 b
            stacklimit=$desiredlimit6 t# h  K1 v  ^( l, |! j5 t% r
        fi
4 \& R  k" ^% }: T3 Q    fi8 j7 g" x8 V4 {5 r" M0 L6 p# V

# }! a) m# f. R* U$ C  E7 S    # desiredlimit is set to proper value (< hardlimit)
/ p$ M! {9 }2 S2 Y* V  J4 x3 j/ X
    if [ $softisunlimited -eq 0 ]; then
' v0 P& [1 K+ [0 w        if [ $softlimit -gt $desiredlimit ]; then! Q" C: z* w& p) v8 v! A
            stacklimit=$softlimit9 S' s2 K" j6 l* z9 C, b3 i2 a# {
        fi
: B5 a# N0 V( D7 m  Z: F/ c    fi
2 @2 g2 ^: T9 ]
" }+ s/ |) J' E3 R    if [ $softlimit != $stacklimit ]; then+ ^2 ]/ h) M% k1 ^
        ulimit -Ss $stacklimit. P; N! w+ S0 m
#        echo "WARNING: stacksize limit is set to `ulimit -Ss`"
# U! @0 d6 [7 I9 [. S' H    fi
$ l" H0 q) T  n2 G! r( j% `, [) `6 f  c% F% y. \0 h0 j# J+ J
    if [ $dbglimit -eq 1 ]; then: c4 }6 V# u$ ]. u* N: V$ O1 ?- C
        echo stacksize hard limit: `ulimit -Hs`
/ P+ A. z9 O- [: H8 U$ d) H  _        echo stackize soft limit: `ulimit -s`* ]8 T& O* r: o3 n0 M
    fi
$ B3 v; O" E0 |6 l}+ H4 J4 Y/ @3 y3 G! I0 p
! V; q$ ]5 a: s- @
open_epicscriptmessages()
5 z, M1 m  l2 D* Z5 f! p{8 _- e  |! H& g% v- u
#generate  temp ".epicscriptmessages" file based on pid* W& W( l: {6 N
EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$1 n1 F  o6 f. U0 B/ y
if [ -f $EPIC_SCRIPT_MESSAGES_FILE ]
7 j; z3 E0 e. y5 a' Y1 ~- jthen   L9 v- \) r$ j8 _: m
  until [ ! -f $EPIC_SCRIPT_MESSAGES_FILE ]& [* E$ o( k! t: v3 q
  do
5 N. i! O% K4 l/ i    EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
; j# {6 I% R2 M  `, B& Y  done
8 ~6 B' b" ^( ?/ ffi
2 D1 W$ v) D2 \8 q+ U9 O# l' R  {5 s7 z1 {( p+ n2 Q
export EPIC_SCRIPT_MESSAGES_FILE8 _) t6 k# D) _: d
}
( p, ?7 H$ {  y8 h5 Y2 B! Y1 s  {+ L* ]+ L' ]  d: n/ Q* W
5 [, _# b# i+ C& C
cmdname=`basename $0`6 |" ~% j1 m0 X: }  ?; I+ q
postgres="n", @- I' U. u, n9 u. Y
ostore="n"2 Z9 H. b5 l/ @: [. O
gui="n"
) ]# E1 m8 k, f: F# D  B; h- ndatabaseOn="n"  F, R4 Y5 ]' X8 R
f_next=0% M4 w( C4 u+ ?9 p
f_option=""
7 U- q( D  j( w3 n% Y' to_next=0
$ i8 s, O. I$ O% _8 ~o_option=""
8 ]8 M6 `& U: O+ O3 J% C, mworkDir=""' F$ U$ m0 B8 W) W' {
workDir_next=0& I; Q2 `. N$ C& u0 d
errFile="powrmill.err"1 K- n5 z6 Y3 a
win32flags=""
: [# \: A& w0 y$ Oln_default="ln -s"
( _. O' Y3 Q( ^5 a" V1 r3 s" q/ ~, h" |- K8 `
har_hilo_file=""
1 w  Q1 h3 L- w# N1 ghave_har_flag=0# A3 p# Q+ q+ B6 q0 Q0 G+ k
have_har_setup_flag=09 C4 _& a9 ^; v, L% W9 `4 ]
is_special_har_run=0
( R& H1 i, y( I7 v) m* }$ ?1 dhar_ofile_prefix=""
6 Z/ |9 e% b/ M' |* S7 H
2 r' R' |* O8 v. W# @' b5 N/ \have_va_flag=0
0 ?9 B5 a; |3 G5 _8 d. `# \5 fhave_vaf_flag=0
* c& y9 u, O$ Q! QVAF_FILE=""% n, P6 W1 `; i8 b. `
VA_FILE=""$ A1 m$ U3 Q, H; V: S/ L) ?
ARGV=""
& W1 ?9 f1 S" r' s# a3 {
# I- M5 f! s4 R0 w2 |/ U6 HORIGINAL_COMMAND_LINE=
  U8 Q9 P% I2 y9 O) l$ _LOOP_CTRL_FILE=".ns_ba_env": R7 j8 g7 V5 }. G5 g2 e& Z+ K
ALTER_HK_FILE=".alter_hkf"
5 R2 B, h: }: w/ n$ eALTER_COUNT_FILE=".alter_count"9 V, {- }" p. e
MONTE_IMG_FILE=".monte_img_f"4 N% A3 @3 z; N  R
MONTE_COUNT_FILE=".monte_count"! B% p7 R' L7 c0 C  i3 f# H
MONTE_CFG_FILE=".monte_cfg"
7 z% w+ ]- B  xEPIC_SCRIPT_MESSAGES_FILE=".epicscriptmessages"
, j4 `4 v% Z* F- R6 Z3 [- s' G7 }0 e+ p8 K7 j+ o9 R4 R
open_epicscriptmessages $@
. k  R6 w3 b+ r( R% K. G2 G( h: U/ v3 s+ z! w/ ^! X6 x
scan_for_hva_args $@5 @; `+ I2 n, r4 U
7 [# t5 h7 y+ c9 M( w
scan_for_har_args()* O& x) I) n3 ], v; q: Y
{
( ~. p  [0 P9 @: |1 a# X  while [ $# -gt 0 ]; do
3 s+ M9 D2 K1 u% G    case "$1" in! K' ~+ h$ J4 b- X$ T) _' B( I
      -har)/ F: N' F3 G# P
           have_har_flag=1
$ i6 W" W0 _6 S           [ $# -gt 0 ] && shift" l9 U! K* v, Y1 J- _2 P
           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then0 E& d9 r) i  d: y2 q
             har_hilo_file=$16 ]+ n  W5 I+ x( Q! o
             shift
! E8 O0 m* f. P           fi) q9 l* x0 h( s9 ?
           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then
# r$ F6 g3 O% O             echo "Too many arguments to -har flag. Only one hilo file allowed."$ s( @0 t  f2 r8 v6 V7 {' |
             exit 1; Q9 \0 l) ]; v+ I) W. T
           fi
7 }% O, x& ?8 Z$ K, H( n0 x           break
( N% q8 C5 m3 f2 ^        ;;
4 J  L1 h; s$ g* N      -har_setup)
# @  |/ Q# q5 f9 p+ j8 r           have_har_setup_flag=1) b- b- `% @9 ^% V$ w
           break
3 t1 ?! z8 v0 w5 d: x$ f* ^        ;;
7 B0 F7 E! S9 g1 ]3 D      *)
1 X% {0 R/ F3 n; U        shift
, t: H# R: d% \        ;;  `' S" a: `' O. A! ~
    esac
; I' {2 W2 }! k0 d* Q  done
' K4 |( j  D# X% W}. x1 h. h; K. l; E' `" m+ q) g: P
! ?& e% ^+ t4 \$ U2 ]
scan_for_har_args $@
3 O1 z2 u0 i0 K6 d" I* ?  N7 A% I9 ]. ^1 r/ L: c1 S
for argv in $@, ]5 |/ a1 Z; ]$ ~- c  c
do# X) C' L3 p0 C3 t$ v8 r
   ORIGINAL_COMMAND_LINE="$ORIGINAL_COMMAND_LINE $argv"4 v( E; x9 t" T
    if [ $argv = "-gadb" ]; then1 N1 d0 c, m* `5 W
        databaseOn="y": b3 ^/ F, q; q
        workDir_next=15 i, A+ `, M! T* K' v) f
    elif [ $workDir_next -eq 1 ]; then
& w3 ?- G9 d" f, W7 T  O        workDir=$argv, {7 N; E2 S' J4 t6 E
        workDir_next=0( X: l- c9 x+ W9 a# V
    elif [ $argv = "-ga" ]; then
" K- s3 E0 j' N- q4 H% y5 J        gui="y"
1 y- n# g, y1 }# R/ t6 p) P    elif [ $argv = "-f" ]; then  U$ e& O4 n) |/ ?
        f_next=1" n2 v! ]; [' ~7 u
    elif [ $f_next -eq 1 ]; then4 j1 W! ~- z7 n5 K$ `
        f_option=$argv' H. y& k& J$ Y, F0 _
        f_next=03 {+ r/ f7 d6 V6 V% B# ?, m
    elif [ $argv = "-o" ]; then
$ {, a  B9 U  M4 }        o_next=1
% \. q9 K0 g1 p+ o* S5 ?9 @3 L3 [    elif [ $o_next -eq 1 ]; then
0 }* o, Q$ o4 b) H6 s. W( ]6 ]1 m, m        o_option=$argv$ \$ Z, s! v' v, x9 u. w5 |+ c( k5 T2 P" @
        o_next=0
, p9 K6 R( ?- I: M' E9 ]    fi
+ C5 A4 e5 Y8 hdone) j7 _# L  p; o0 ]8 {8 H
echo "Command line options: $ORIGINAL_COMMAND_LINE" >  $EPIC_SCRIPT_MESSAGES_FILE
5 }/ l; ?* p1 r/ ?& F. v  A
6 g9 h4 }. }3 Z) v" I' i! Z3 ^" t9 Wif [ $databaseOn = "y" -o $gui = "y" ]; then, q2 }/ i0 Y3 e3 r4 V/ Y% ^$ |( D
  if [ $cmdname = "pathmill" ]; then
% U6 ]( S% K+ ?" ?& U7 l9 ^    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5"  -o "$EPIC_ARCH" = "SUN4_SUNOS_5_64" ]; then
( v# z3 l5 ]0 A$ d2 d; ?         ostore="y"
; ?  e5 ?) _& T8 {3 Q3 w         postgres="n": x0 @7 |/ V$ E) H, u. W. \
     else
; `( n9 ?+ C' [! t        echo "athmill GUI is supported on Solaris platforms only" 1>&2
+ }7 M. `2 J- G5 z( [8 T8 F        exit' V# R3 e! |$ p) F
     fi
' h: F3 C" u. M. d6 |; w$ }  else( g9 K- r/ W4 ?( f8 c* S
    postgres="y"
3 }2 m. B; z: H2 }& ]' R' Z/ v* Q         ostore="n"9 ?* S+ @, k  Q2 u/ }7 T3 k& V
  fi
% u" [' I8 [9 ?4 rfi1 U0 m4 Z' V* H! t! c( q( s6 O8 w1 m. |
" [4 W( ^2 A+ @  f! A
if [ $gui = "y" ]; then
# r: M; m! u0 K    if [ $cmdname = "powrmill" ]; then, M5 _6 f+ ]8 u& @' b/ X( Y
        pwga $@% `# x7 n& X* G3 N0 j# g6 I% o
        exit
" R3 `, P: o6 C4 p" H* X    fi6 ^3 {& \4 D5 a) A7 o/ n
* ]. n& Q; @9 z, @" w$ v0 k+ {
    if [ $cmdname = "pathmill" ]; then/ n- ~; g% K/ c6 r
        if [ $ostore = "y" ]; then
& O) x: |7 ?, `) j+ j* f9 Y  I6 y" ~           ./pathfinder $@! k' F7 l% b" A+ T. a
           exit
' j- }* A+ y( _* r( n  q' R        elif [ $postgres = "y" ]; then
8 {. A  H" k$ F2 z' A# M* b9 [           pmga $@) f0 x0 }0 A% r7 U5 A* ]: G
           exit
: `0 O% g8 O% R7 i: j        fi
- Z0 g# D# ]) a" z/ [2 P    fi
- }5 [6 Y5 W  s$ zfi( u( m2 N$ l  F2 {. x
% t- H: s- b8 \+ t" W& X
if [ $databaseOn = "y" ]; then& o( j7 j* m* @& a  w
   if [ $ostore = "y" ]; then. {5 H, E+ Y3 I- e
      if [ -z "$workDir" ]; then& _5 i  p1 V- b2 Z
         echo "Error: Missing argument for -gadb option"
" _( e# O( C+ z$ @         Exit 1$ L* C- `! d5 u. W" N+ Z3 Y& A- X
      fi
9 z) D# P# U! W   fi0 D* W4 X3 P8 g- b$ b* q1 k
   if [ $postgres = "y" ]; then
9 |& |; s) c6 p/ a0 W! S9 [      if [ -z "$workDir" ]; then
; |% R4 a- n; v8 u" d  y         echo "Error: Missing argument for -gadb option"
$ M  v% S( ?; N; y* S. d         Exit 1
. s2 v$ K, r2 o      fi  I8 ^( t6 g- ~& @
   fi
$ V% L; j+ k; e) G6 E# hfi
% n* p" p9 W" V; i$ G* O, J4 ^7 X, ]8 y
if [ $postgres = "y" ]; then
4 |; C4 q$ J+ _
: Y; J# N) `/ u1 I    if [ -r $EPIC_BIN/scripts/gui-init ]; then
; [3 ]" P/ t& t" M3 [- s        . $EPIC_BIN/scripts/gui-init: Y% \' \& r# A. ?+ i* S( Z  d
    elif [ -r $SES_ROOT/bin/scripts/gui-init ]; then- x5 J+ ]" k. X2 r% |2 K
        . $SES_ROOT/bin/scripts/gui-init
; t9 e" a/ F" h6 A    else$ H/ i6 Z3 C% v0 W& b( g- j
        echo " ** Installation in \"$EPIC_HOME\" has been corrupted!" 1>&2/ h1 q, Z; ^- a$ V
        echo " file bin/scripts/gui-init is missing." 1>&24 I# Z2 M  z- h, q2 e4 }
    fi. s" R# O  p- x8 t4 E) k( }

# E1 w- |/ z: Z( p' r  l5 T7 P% U" b    workfile -tool $cmdname $@
! E- P4 c9 N; j* Jfi
. q  {( ~* F% E; h! ]+ R) r$ I; K" I3 U7 d# W* L
if [ ! -z "$o_option" ]; then
9 ~. A! t( T" e& \6 Z    errFile=${o_option}.err6 w5 N; m' W7 e4 r# R  y3 i$ J
elif [ ! -z "$f_option" ]; then; S  |; M' t& x4 f
    if [ -d $f_option ]; then' W" s* j5 ^9 p/ O  M
        errFile=${f_option}/powrmill.err
+ r+ k. A7 |; U3 t    else errFile=${f_option}.err
' k" ]0 C9 j; N4 O: h    fi  D9 y: t: O8 Z/ j! ?
fi' U1 _" ?* L/ `2 d
  [2 ~, C+ z* a# ^+ ]

3 p1 M  i% @- g2 \' X! B0 I+ A. [8 @if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then. N0 j6 f' b4 {8 }# U( g
  rundir=.epicrun
# h6 Z' i4 _. yelse& K$ p1 z  p, L' z
  rundir=.epicrun$$$ N; f& }' F$ A) F: E6 g. w: v
fi
5 q5 {" V9 z6 X* q! a7 t- [7 Z, S3 h
/ ~1 ~9 B0 S( O* plibpath="$rundir${EPIC_DLIM}$EPIC_DIR"
5 o5 g9 p8 _, W: }, |! @
" Z4 ~% U9 b7 Icwd=`pwd -P`
4 L1 Y9 }/ {# A" m* mif [ $cmdname = "acehdl_w" ]; then
4 E/ C$ ]# p( \, n* `1 G( g  cmd=`basename $0 .sun`
* H, m  }3 u+ K& i7 ?- O  cmd=`basename $cmd _w`
2 T5 C* M* V6 O2 S, S+ nelse
9 Y1 j$ t; P5 H) t- T  cmd=`basename $0 .sun`% ?( {: g6 Q7 B4 W
fi
4 j6 M) H  s+ h+ g  E" V( G$ @7 M3 q
command="$EPIC_EXEC/$cmd$EPIC_EXEX"! H. P6 e$ F& s4 r& x. M
[ ! -x "$command" ] && echo "$cmd: not installed!" 1>&2 && exit 14 b% I, M* o8 V6 u* @7 \' H* X$ W
, i/ n( @3 n' A, l5 S3 k$ G
# buildmod extracts -u/-fm options and calls genepiclib
& X8 X1 `* u. z0 O# l# r# It also set the remaining options to variable CMDLINE: X/ f' ], H+ @0 J) ]) R8 k
# look up in .epicrc for -fm & -FM parameters/ I4 ~$ F2 W$ G3 [

& I" _# e7 m6 S9 ^fmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`"( m. {) w/ h, `1 {
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`"  u. f, C5 e, b+ l# `
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`"; F* c8 Z; {: l3 G( A

. ^/ I: W6 d* o% H; `5 }; i( cFMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`"
( T: F5 j& e: q7 [2 ^0 E/ D[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`"7 |" s$ h' C1 V, m$ c! L: Z4 v. |
[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`"' a( i* K7 ~: R* _5 m5 |0 \- a
& }: [- U1 _& x: I
if [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then
* A1 \+ G7 G4 u% u/ U2 K    # note that the buildmod script will set the CMDLINE variable
9 h" x& z, b0 Q0 ]0 W( _' H. M    . $EPIC_BIN/scripts/buildmod/ \2 i% k+ T- x/ W# \* t

( ~7 T  T6 o7 Z- }5 o  T2 I& n    #echo "This is the value of cmdline=$CMDLINE"! r2 y5 N/ n: G9 C6 k5 z7 d
    #exit 0
7 Z$ V3 W( [# W  [5 a. j* {
6 U0 l# h( @/ f# D" D/ [( u    # if a new timemill/powrmill/pathmill built, run the new one. [" w4 x9 z/ \, `3 X. k5 Z
    [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX"
9 \. D3 x1 D( gfi! C' q* o* j# D3 Z2 I. l. @! m

( m' d! I* |. u" w1 T# _$ [if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then' S  J# L+ V6 H3 [4 q' Z( Q
  if [ $have_har_flag -eq 1 ]; then
' x4 r, Q* P9 z' d    is_special_har_run=14 X) J1 t: U: R6 G8 s2 V
    if [ "$o_option" = "" ]; then
( {/ D5 M) O  q" F* v2 u/ j' K      case $cmd in
& n4 }! Z+ i% |" q: ^        timemill)
6 e9 d7 d2 ~, s  D( |          har_ofile_prefix=timemill
  X8 f$ L" r, S* i+ e' z- t1 |' l          ;;/ G" C# J. g$ l& l- a2 n5 w
        powrmill), U" ?" @/ y5 T0 h- n  n. Z0 b
          har_ofile_prefix=powrmill
3 I+ A8 d! k( @" ?          ;;
5 [$ K/ [4 _5 J* v; p3 \        nanosim)  D8 ?9 F0 J! |, R
          har_ofile_prefix=nanosim
: E4 }: }* _. @          ;;+ M5 \% x  I- k3 m, F
      esac
0 x, R  s1 |1 I; S) E5 r    else
# Q! d- {3 \2 ^) f' E2 W' a/ q      har_ofile_prefix=$o_option* r1 r4 V+ y9 R. u' n" ]9 p' M6 n
    fi9 K" j' i" S7 v# \8 p  b* I" T
fi
. J) f/ R7 S/ n. r( vfi
" r) |. g$ b/ r7 G
$ Q3 k$ E2 r$ ^) z7 v- n6 R# Call Double precision version of the product if -D: k7 d7 d0 X% C
# or simulation time > 1,000,000 ns.
6 D6 ~$ H8 |7 ], m* q  u# I9 A- fif [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then  r4 I$ p7 o$ m1 O
% Q  A9 V; ?. P5 X4 S9 `. ]
  # Now the binary always has the ACE feature0 ~# }% o: E0 J9 {
  USE_ACE=YES& @7 E9 d3 ]3 L& H1 i' I
; D8 r& |+ T/ H1 L1 Y
  HAVE_DP=NO( r% }0 i; E7 `. S# g: v
  EXTRA_CAPACITY=NO
! `& d) e  H1 V3 d" ]6 m  DB_REAL=${FORCE_DB_REAL:-"0"}4 A1 b6 X0 L6 a+ e
$ t0 p6 @* V. |% ~: c6 G* X$ ?( }
  # Enhance for ACE ease of use
: U- y# x, b$ O- ]* ?7 {" p2 q& D( \  # If no command line option or only a -T option, do:
" g, B: F4 q, R/ Q% t  #   1. set -A option
2 S  r& b! q9 k4 h+ H! W% G2 v  #   2. assume input file to be hspice
$ u( \3 q4 Z' O  #   3. set -o to input file prefix
' H( ?4 V1 W9 U! J; c1 ]! s. w, Z! p  #   4. set -z to input file prefix! {. X+ X1 y9 R+ N- d4 a: V
  #   5. set -c to default config file# A7 O# B" o1 b& x5 j
  netlist=""2 V, O) j. W8 W- z! A8 A1 t$ }
  minusT=NO2 H  f8 W) K2 F; s; x3 r# A
  useStdCmdOpt=0
: q! y/ R/ C0 p# S7 h  prefix=""- x# f$ ?7 B! m, v' s) n" \
  circuitType=""
% Y) y4 i; D% b. ^) i  for opt in $CMDLINE
& m( p/ j7 n  Y7 f+ e  do( `# k8 }8 T' J* p" h
    case "$opt" in # [- c) F9 C$ K* A7 ]6 L7 K
      -T)
% B( P4 S0 b: n        minusT=YES
9 b2 J: ~, B. `. m4 D5 J9 V        ;;# a+ ~( |% c8 X# x" \* j) B
      -*)
, `- e3 ^+ h# X6 M0 s5 U, H        # using standard powrmill command line
' r- R5 z' M- \: x        useStdCmdOpt=1
) R- u8 V3 L# N2 z        break
1 Z. Q) n2 }( `# W0 c        ;;
- q5 j9 J& u0 W* s. q3 J) `0 F      *)
# k' j1 j2 k8 p9 j       if [ "$minusT" = "YES" ]; then, x: I* X& D; i3 i6 C/ C, n
         circuitType=$opt
4 `0 A1 n2 z0 ]" M5 h         minusT=NO  # reset flag) G4 L2 u5 }6 W" M; M! p
       else
& y6 q; @" Z9 D2 L% a/ |) {5 l, @         if [ "$netlist" = "" ]; then
9 x+ \; W( v: O6 A           prefix=`basename $opt`  W# B6 B/ u( x
           prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix`
6 E1 [: U2 x) \# f% i4 O6 P         fi% I4 ~- _, Z7 b5 [) ?% f  J/ E8 A
         netlist="$netlist $opt". E2 s' e5 L: M  S* H
       fi$ d% J6 r1 e' Q) U1 s
       ;;) h1 x6 L+ j( r8 t# A
    esac, }( ?* J) H" n
  done! ?# }1 S; z2 _9 x; S  V
+ w" E$ _; C( V% K3 c
5 l( _  n. F5 D# z( s& }$ K( [
  if [ $useStdCmdOpt -eq 1 ]; then
; Y/ @" l' i( U% H5 l' c    # use standard powrmill/timemill command option+ z7 q9 I( ]4 `. l! m
    for opt in $CMDLINE
3 F2 f" k9 U" w/ T) x+ D    do
/ p3 R7 v( ?1 A- ]7 S' f/ O  A) l  h      case "$opt" in 5 H$ z; U  Z1 K. ^1 M
        -A)9 p* t" f" ?4 i, D
            DB_REAL=1+ q" K4 v- [% H
            ;;
, n' T6 ]9 `* k* M/ B1 s1 A# ]      esac
: c7 k2 J- z0 N    done
( x2 v$ p5 I- c" _' d7 y6 ~6 `    if [ "$netlist" != "" ]; then9 Y. T- _2 ^/ a5 I8 t
      CMDLINE="-nspice $CMDLINE"$ i) u( w. q) q" J
    fi  r# ^4 V: L% Z: U: o) C! S' ^
  else
- ^3 Q3 w$ t% q5 N& y3 F    if [ "$netlist" != "" ]; then
7 Y2 z  y# J. H% t      EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"}9 \9 t* Q8 `; V- w8 R* E
      # construct new command option3 K3 S% ]& B) A) I: w% G
      if [ -f $cmd.ini  -a  "$circuitType" = "" ]; then
9 a* R# f( J8 L/ E& R        CMDLINE="-nspice $cmd.ini $netlist"
8 M) S. e% p6 }" o, \3 S- E! \      else! I- P" U/ z! ?
        if [ "$circuitType" = "" ]; then
9 }" I4 K) q; v$ T2 r6 Y! N; f          circuitType="msana"! B* u$ W, d/ y+ f: [  t
        fi% b* i" `4 k) I5 I1 a: b
        CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg"8 S% W! {8 Y! U/ ^( S1 m
      fi
5 Z) {+ a9 h& n$ n      CMDLINE="$CMDLINE -A -o $prefix"
7 [" e$ j  V( n1 O" d      DB_REAL=1
6 W; J5 \3 F! R8 k      echo $cmd $CMDLINE
3 I) Z/ c' e- n* K6 _- {0 C- o    fi
  `6 C1 R& R- r# Y& s: [2 Z. @  fi
; Y  N" o+ y, L" n; H8 J+ xfi # cmd is timemill or powrmill or nanosim or railmill or pwarc
8 x- K% q7 e& i. u! u, E0 t5 w9 A& a4 U8 b6 T! H
[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a"0 R# H7 Y% O6 O- z8 k
[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a"
. U8 s$ k1 M+ A. f2 m5 o8 L0 {[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v") z2 i3 O- w: @9 B
0 K1 z7 U* _. \- o  y% ]' p
if [ "$__engine_wrapper_called__" != "Indeed" ]; then6 C* U4 ^3 l- S5 G
    __engine_wrapper_called__=Indeed/ ?# {7 T1 ]4 ]6 y. R
    if [ "$cmd" != "amps" ]; then6 S0 V+ J1 V4 Y+ k1 {9 g, W5 y
        export __engine_wrapper_called__
2 B* t7 T3 d; x( K; I) i7 a* d3 U9 e    fi
8 r* i- t  L7 D3 D, r: p6 [5 G$ Z  H( P% C& W4 \, [
    trap "cleanup" 0) ?9 i, D# L3 e! f7 O
    trap "" 2( @4 k. t" L/ S! r4 ~" B' X+ M
5 O8 W7 E* ]# p* ^# X
    [ -d "$rundir" ] && rm -fr $rundir$ u' V  _+ K+ t
    [ -d "$rundir" ] || mkdir $rundir8 U* ]6 D1 \8 c& c: V
2 C0 F6 {0 D5 k4 v/ e  s
    case "$EPIC_ARCH" in
$ ]" K- y8 b$ m. {% ~    *SUN*64)   
7 X9 V% X' N0 f, z        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"# A; O4 A* A/ |" ^: `7 g6 i5 R
        export LD_LIBRARY_PATH, ]! D8 \2 B* E( Z" O
        suffix=.so
1 F& G( w! A* ?: d        ld_err_code=127' }, O7 i. {& f/ D/ ?; w5 M: D! i
        ;;8 u1 X; N9 h9 I8 j: g4 h
    *SUN*4)   - P. N1 x' i, c  Z5 z" M+ D
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
- Z$ B" N+ m8 T) B8 E0 h" }# O        export LD_LIBRARY_PATH
, j/ y3 N2 ]& h' ^        suffix=.so.1.0
; q+ h+ ~) ]6 j" T0 Z# a: N3 y        ld_err_code=1272 z/ ?, \9 F9 X& |; \
        ;;
) W: W1 ^+ j/ B" h, }. x2 q# u    *SUN*5)   ) J+ {, z) r6 H
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
1 t& X8 J* Z" h' t) `        export LD_LIBRARY_PATH
. K8 U' L1 g) C1 o! f% P        suffix=.so
+ l/ x# k* u5 ?. y/ N1 _        ld_err_code=127% R2 t" R( p+ p6 e2 j" ?; G, \+ N
        ;;
. y' d$ u( C( Q6 m    x86sol*)   2 J( a2 F/ G* C, I; g4 t% h
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
# T4 i- c$ [2 e5 C# G        export LD_LIBRARY_PATH
) [" t  L8 }/ R7 T- _& }        suffix=.so* y/ u* e& D# ~9 d$ |( `" ]7 ]
        ld_err_code=1276 H3 W. z( `' l: z  r  W8 M
        ;;
5 M7 X; r; e  m9 P- F/ r2 n9 t: ?    *AIX* | aix64)   
5 f- a/ @" m5 P' q        # When genepiclib creates shared objects, it creates a import file and
" P8 f7 \* T6 z( @5 C  l2 ^        # uses timemill as program. So at exec time,program timemill is needed ! T- F0 _) w1 E: W4 r
        # in LIBPATH
, h4 |3 ~# m% y# i* z        $ln_default $command $rundir/foomill
/ J% N. ]: w3 B$ N- N        LIBPATH="$libpathLIBPATH:/lib:/usr/lib"  R4 H1 K1 p0 X* T8 Z! A! ~
        export LIBPATH! L3 E$ D! W3 x5 J
        suffix=.o+ r7 U) w9 B7 z% l! V# A1 a' \
        ld_err_code=8
0 U) H* V9 n- n6 ]5 v0 `$ A1 n0 e/ ]+ `) f        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
+ W2 l% ?% h9 n          tdir=`echo "/tmp/d"$$`% t% M* X+ f% A8 x+ @2 P
          [ -d "$tdir" ] || mkdir $tdir2 D( }. Z* N$ X6 B
          if [ -f $EPIC_DIR/libCustom.o ]; then+ f  D) n2 p5 B' a3 f3 N& P1 [! ]
             cp $EPIC_DIR/libCustom.o $tdir/
- `# t* s$ L2 Y+ F6 {% J9 O             $ln_default $tdir/libCustom.o $rundir/
) ]) m/ Z! Y) G7 A9 |& [          fi
) b4 U" F/ Y9 q1 O% w- n; ^          if [ -f $EPIC_DIR/libModel.o ]; then( ?+ w% y7 h# B4 l' X% j$ E0 B* o- i
             cp $EPIC_DIR/libModel.o $tdir/0 }; J6 c% Q0 E
             $ln_default $tdir/libModel.o $rundir/; n9 D+ N8 ^7 U6 c9 T* [. q. F; `2 S
          fi
7 G. c- s$ h, e          if [ -f $EPIC_DIR/libFuncModel.o ]; then6 ~1 g1 E  R8 H$ C( d% h: c
             cp $EPIC_DIR/libFuncModel.o $tdir/$ M/ ?( M+ F% s$ [7 H( o
             $ln_default $tdir/libFuncModel.o $rundir/
. b& z; _/ N) k9 L( m8 h! z$ a          fi
4 L' ]3 I4 a0 p% d          if [ -f $EPIC_DIR/libFuncModel.34.o ]; then- q' R4 p5 x2 e
             cp $EPIC_DIR/libFuncModel.34.o $tdir/
3 W8 q, Q3 p$ K' _% {- W- ]             $ln_default $tdir/libFuncModel.34.o $rundir/; A* D& o$ A1 p5 u& Z" Z5 b
          fi, |$ A# U' j$ P% C: Z& \" c6 Y6 Q9 }
        fi
5 V; Y% u1 k4 t        #Set the IBM flag to enable more shared segids2 ~) q! w0 h" L  m* X5 I% n, V
        EXTSHM="ON"! \/ U0 E1 o) ]' Q* a: ^8 ]
        export EXTSHM, |& z  \9 H7 |% j* b
        ;;4 Q7 g* x' Y' S! n0 y! @
    *LINUX*)      x( d/ Q9 \5 t- D# D
        suffix=.so
' F* N; q! q) y* R  x$ [7 [4 d8 _        ld_err_code=1
4 x7 n( T0 B: a3 X        ;;" {& b; ~1 \" u+ {1 U( z$ O" E8 p
    *amd64*)
3 s& s5 W% u( N- L, D        suffix=.so
, c! M3 p7 L! Y! F# W2 H) q        ld_err_code=1
7 m( j3 [) B) I) C+ |        ;;( l! \; d+ o- U3 r
    *suse64*)
4 i* H8 P8 v! o) ?/ x! z0 D7 {        suffix=.so" @6 j: N) o: P$ K6 x' v$ w" w
        ld_err_code=1: h6 j* t, |/ E% P
        ;;
7 V8 F) J' F2 z3 ?  `    *suse32*)    ) ]! m+ t- C+ x, M; N; S2 l6 u0 w4 }
        suffix=.so' s2 V( a' `6 I0 S' U6 n( k
        ld_err_code=1
3 z. \# a/ P2 {( |$ ]% ~        ;;
9 |# ?) ?* K' [8 F) j' V' _    esac
0 h. g  i9 j% {! x. X! u
8 p# v6 T( F: K9 ^    [ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix"
* \6 C9 O0 S2 H' H1 n/ F; E, B) e    [ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \
5 X' S  z! C7 ?- p- m( m        && [ "$cmdname" != "nanosim" ] \
+ Y+ L/ R4 @, M3 y9 R1 B: [, D        && [ "$has_model" = "YES" ]  && ulib="$ulib $cwd/libModel$suffix"
- p+ t$ e$ H5 O2 ?" w    [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix"
0 O: Y! r; }- r8 y' h1 h+ B# C* q# x- B, ?
#Look for command line option for libFuncModel.so
" Q9 f$ ]* f" g' K#    user_library_next=0
$ {; X- I  }4 ~$ v    has_fmlib=""
' T, s) B3 X+ w. w1 Q/ c! T    for opt in $CMDLINE% v( e" i5 t" I- P
    do. B# ~) w9 v* Q' [$ P
      case "$opt" in 8 j( Q/ t3 ^7 {9 C1 }' P% g# F; C
        -fm)5 ?. g. L2 H! R: _5 K( w  p
            CMDLINE="$CMDLINE $cwd/libModel$suffix"
! X  l3 q& ]/ {3 \2 ]# ?( @            ;;6 Y+ A* G# X& W& ^2 d
        -fm_user_lib)* K" |& w3 D' M2 g9 Z2 K: V
            has_fmlib="YES"
, N. o6 t! B" `( G. i, H. P/ a#            user_library_next=17 k- l5 l$ {! n7 h$ ]9 w
            ;;
( z4 G& X5 F/ _6 h; S        -xc) / ]# F* `) ?% _, X" |0 h# d+ _
            if [ "$EXTRA_CAPACITY" = "NO" ]; then4 N$ U$ [: f. f$ _; F* x0 f$ Y/ b: b
            EXTRA_CAPACITY=YES
! n7 k+ e  `- J- }            fi
$ p6 z! U% c+ L. c% N            ;;
) R" N/ Z  s3 O( ~0 k6 b#        *)! C" s4 b6 P& v8 ?# m
#            if [ $user_library_next -eq 1 ]; then
% y2 \3 K, `9 f! I9 t% a# v! o( A& p#                if [ -f "$opt" ]; then$ p" x* t$ ^; A5 @; M  N1 Q
#                    libfmodel=$opt
; E6 ~, S8 Q" Y$ H) D7 o#                else
% L+ {) ~+ v  x. u5 e; h#                    echo "-fm_user_lib: Specified file not found"
4 p! }  U3 P$ `6 o- _#                    echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages
6 o- U; u  E) D7 b) e  K5 `#                fi
% D- H  ^+ w8 x0 x" Q) m! L#                user_library_next=04 o7 A- v1 X8 X- v
#            fi
' e$ R- D7 B0 q$ U#            ;;6 a+ J# u4 p: O  A7 {# L3 V
        esac: U9 t; F8 K( ~; C+ q* w
    done6 u* r- C# p6 q& b, ]" X, G* n

1 Z0 |; o& j* P3 s2 b    if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then
  x2 F& X- |! \0 o8 P& @& n/ z( S$ I        flib=""7 z; g, t0 T5 z, G- x8 `2 k/ I
        if [ "$has_fmlib" = "" ]; then
4 O4 ]' Z5 ^/ ^! y& Z            flib="$flib `get_epicrc ./.epicrc user_libraries`"$ `) n+ t0 G/ W  p2 e% ^2 D
            flib="$flib `get_epicrc $HOME/.epicrc user_libraries`"; X  C% \0 I6 Q% r" i+ m2 @
            flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`"
. t3 o" l. E! k2 \) U. m        fi
1 H/ c2 t2 @: x8 L* Y    fi  v" c' h. j6 k- j& R2 r
. P) H  Z  [) ~, ?& z! R* P
   for i in $ulib: m1 [; g6 g7 a
   do3 T" E, p, f7 V" w* J# U8 R
       [ ! -f "$i" ] && continue
) c& M" Y, e1 C       dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd
: ?$ o# I' {1 y6 D# Q8 x3 w  X       i="$dir/`basename $i`"9 y* T9 r  U- @9 N% v
       case "$i" in
6 i) E9 |9 Q5 l3 F0 [7 i       *libCustom$suffix*)    [ "$libcustom" = "" ] && libcustom=$i;;
; Q0 M8 P  c! t. |0 I7 p       *libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;;. T7 `- |. Y0 U( n% V0 `8 ]
       *libModel$suffix*)     [ "$libmodel"  = "" ] && libmodel=$i;;/ d! e; b. ^9 f9 {; @
       *libva$suffix)         [ "$libva"     = "" ] && libva=$i;;8 }9 u$ c9 M7 \7 O$ _* o$ Z' ~9 d
       esac
' D9 D5 Y7 }* f" `1 M       [ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \
/ x/ _1 s/ J1 m* z/ ~( d. \        && break6 D' O* V0 f0 W5 \
   done: |# |! u$ \5 [
7 g# V. a  E7 Z6 H5 W3 ^  n$ d
   # symbolic link shared libraries to .epicrun$$
7 P6 C$ P0 R  D; H+ W    cd $EPIC_DIR; epicdir=`pwd`; cd $cwd8 K3 Z( W- }* p5 S' T( i+ d2 @
    if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then' L2 n# g0 Q4 Y3 T' ~
        if [ "$libfmodel" != "" ]; then, n2 @5 D6 E" u2 j' l. v4 S
             [ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \2 p( K& ^! e  y* s& |$ `* V" }0 t
             echo "Using $libfmodel ..."  && \- j( w& S9 s' Z' m7 g3 [
             echo "Using $libfmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE3 M: R) W+ [2 S2 k; y
             if [ -f $rundir/libFuncModel$suffix ]; then
. M# t0 A7 d( W               rm $rundir/libFuncModel$suffix- Q8 V! Y( ~7 [9 [6 ~
             fi, c2 k) U! r8 v1 {+ N3 x
             $ln_default $libfmodel $rundir 9 F4 v, }; D0 g+ [) L4 p
        fi
' [6 D1 P7 {2 X& }. _        if [ "$libmodel" != "" ]; then# @, F8 X; X  X. Q# v9 w
             [ "$libmodel" != "$epicdir/libModel$suffix" ] && \* b$ j* {# y* A) Y0 ?3 u. v% [3 D# i  r
             echo "Using $libmodel ..." && \+ t1 m9 b  r' Y. w$ Y# |
             echo "Using $libmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE  t8 H( T5 J! t8 R" y7 J8 L
             if [ -f $rundir/libModel$suffix ]; then5 i# l% t! u& J( F7 E, |) \
               rm $rundir/libModel$suffix
6 {! B) O+ d) |2 |+ [6 f: g0 T3 H             fi
9 V: `1 j, g+ O( \1 x/ v             $ln_default $libmodel $rundir , M' k' x7 |. Z, ^3 E
        fi
  r- ]9 l- Y; V- M  \5 t   fi# R# d. u5 a( w4 z, X* m9 j
   if [ "$libcustom" != "" ]; then& V: C( G4 b- L1 ~9 j5 C) e! |
        [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \( a, H; G' t1 N  t3 }/ p
        echo "Using $libcustom ..."
% g" Z! s& d& s1 I        if [ -f $rundir/libCustom$suffix ]; then, I0 g% U1 a% h7 c
          rm $rundir/libCustom$suffix
  ^# Q7 h9 {0 E1 M( J        fi
; s% K9 D3 e5 U6 q1 ^& k        $ln_default $libcustom $rundir . z4 q( Z- j$ v8 T6 V. R3 {% D
   fi
5 h# G# t& s" d% l; [9 S" I" w* A; b" C8 g" v1 l0 Q
   if [ "$flib" != "" -a "$flib" != "   " ]; then, k6 X  Q( J3 \( h
        CMDLINE="$CMDLINE -fm_user_lib $flib"
6 z4 b! E$ W) ?6 N   fi+ \, a; X' K8 }, M

$ S7 X/ c" U0 P! D1 K9 y3 P   if [ "$libva" != "" ]; then  `2 E2 W# `9 ]; {/ q+ c) V7 j4 B
        if [ -f $rundir/libva$suffix ]; then
9 m' i3 A) Y, n8 R. s1 m1 f          rm $rundir/libva$suffix- g% ^3 y' ]' g  S
        fi
! b4 }+ v3 ~0 i, i9 o        $ln_default $libva $rundir + y$ W3 [: z/ m. a
   fi& A2 P, t  u& e

3 h6 f& Q, t  P0 Q4 k4 c( X) }5 q
2 c& |) z! d* f- T0 }    # VCORE design library  Z) h' b3 C% l1 e, X: r0 k
    if [ "$vlog_design" != "" ]; then; T7 U6 O- _& M$ Q" Y+ c  h: R
        $ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`5 R( {8 ]8 d& O, L1 T9 r
    fi
# L! f& q2 Y: e
& s5 U$ n$ \7 J" h    if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then
; A/ \) m0 z. @! s5 }        EXTRA_CAPACITY=YES
7 A, h' r" V5 S    fi
$ m: P; h8 f' j7 V2 o6 ^6 K/ X2 k( F
    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc"
3 q) x$ _, e1 y! u8 J    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc"
& g( b8 S  K1 ?$ J    #Create temp file if dual process is on+ L& a9 v1 z/ q$ E# v
    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then
/ a& i8 q7 ~" a; M# s6 {        if [ "$EXTRA_CAPACITY" = "YES" ]; then& {% @. h1 a0 N3 k; c. N' F
            touch $rundir/rpcidfile
. z* A# m( o. k0 a5 i        fi, g# G/ k; L) O
    fi+ E; H' z6 F' [# u- D, m& `
fi
& C0 k7 J; S' t' O
5 U; @8 W5 X+ ^- j$ H1 d, T2 B' frun_cmd()
! [. K# E4 z0 Q; U* \0 U4 f{3 e$ _" y1 t6 b" P
  command=$1+ M- c6 l: `& \# V+ k
  shift
+ |& z: `: p% H" j) K) f% ~
4 E- D9 x2 U/ O  if [ x"$VA_FILE" != x"" ] ; then. u" f5 b8 H, M& X: Y; e4 z
     cmdline=$ARGV& G+ |! G, y2 x. C# M# U
  else
5 o  S8 j" W; f* G1 |     cmdline=$@+ @$ \- q% k$ s1 V$ T
  fi# C, H5 p9 Z4 t
9 T' Y$ K. k3 c2 ^  x
  debug=${DEBUGGER:+"$DEBUGGER $command"};9 ^  g; r0 L/ ^  w7 }0 b
- c# y3 J$ y% F* q7 T4 W
  # To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a. R( v* n" R) W" P6 D# r  Y
  # so save-restore may work.
+ K! c3 r8 G4 M6 s0 H7 d9 y  setarchStr=3 S7 {/ F4 v0 u- x# ?2 e$ A
  cmd2run=`basename $command`- z) R! ?0 V8 h  v) {# M/ f1 \0 R
  if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then0 e& t* O6 R, n; K1 Q; z
    if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then
, p# N1 Y/ |  L      setarchStr="setarch i386 -R "+ u' \0 v% B2 w7 I9 Y' m
    fi$ g- ^; y) z, m" q9 `9 a
    if [ "$EPIC_ARCH" = "linux" ]; then
5 w3 Y% L4 N' Q  a- Y      setarchStr="setarch i386 -R "
* A3 A) u2 O: `: y5 Q    fi
( w. m; R( Z( H$ h3 ~( k    if [ "$EPIC_ARCH" = "amd64" ]; then$ W# |$ l- t% e' _+ b8 H
      setarchStr="setarch i686 -R "
; J( E) \( @) _" J" ]  U  x: B4 }3 \    fi
" o. T$ m; f5 F5 q0 [9 S6 h" j" h) {    if [ "$EPIC_ARCH" = "suse32" ]; then
  n: g+ x9 [0 a1 u6 \: S4 y* i' b5 R* h7 N      setarchStr="setarch_suse i386 -R "
4 M! z: w7 f; Z3 l  k8 K    fi
. w0 Z0 X; [" p- q9 J; b    if [ "$EPIC_ARCH" = "suse64" ]; then
, E9 z. a, x; Q$ j* W2 ]9 u0 h      setarchStr="setarch_suse i686 -R "+ {  Q! Y7 g- J3 g4 w
    fi: X$ Q3 t2 Z* ?! Q
  fi9 r, p8 e9 x* I, o

9 ~% O$ d4 F% `- K* D8 \  ret_stat=08 T0 J1 n% T, n8 ?4 p8 H  k- p" i
  if [ -x "$command" ]; then4 N" C  C, |: F9 W2 ~* }; M3 i" C
      if [ "$debug" ]; then! x# U3 R- c  A4 ~4 ]# R0 J+ W% {
        _debug_args_=$cmdline
2 q( f8 K( r$ \! j        . .epic-debug8 m! W% V4 l8 {: E2 ?- _
      else
0 [5 M7 t9 q: j; D        DEBUGGER=; export DEBUGGER5 D% ?8 l+ l, e/ _/ M; x
        $setarchStr $command $cmdline
' @2 o4 L% j, B' K      fi
, _; J- U; `# {* M# I      ret_stat=$?' K& @# C4 S+ A+ @+ m, {3 z
  else
- M8 j0 p) e2 F+ ]1 U0 g! D    echo "Corrupt installation, executable \"$1\" not found!"
& U8 M- L: K% i5 R( G, x    ret_stat=19 l6 e7 H" o4 S: v; U8 N# L# _- H
  fi2 f1 X% k, H% j. r1 T1 s
}
/ F: G- w( r4 S' y" S3 ]! C  w3 H; S* w* Q8 Q: h# q
# keep runing cmd if ctrl file exist/ R: W  \- R% l# T# M% a" X

* i2 c1 w: {# m: E9 `1 orun_loop()
. s, @6 f) h+ ?, r4 D{! ?8 W  \4 r# D! S2 D( }( Q, ^3 p
  command=$1
/ W3 y* V6 F+ n/ `  shift
) n: @1 B+ \# e6 \  w5 U4 S
; u# Y/ M. _. }9 ~, P& t" a  if [ x"$VA_FILE" != x"" ] ; then( O4 k3 I3 ~( `- f" q* }
     cmdline=$ARGV8 X8 l$ ?% v# R" G5 M
  else) U6 a  t# D: b3 ^
     cmdline=$@; J- E' t1 f4 O
  fi
5 h  n8 {2 j2 h" |
2 b5 y5 ]% `" @& J  while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do
4 s3 Y, F; k1 x    . $LOOP_CTRL_FILE$$; o5 Y! s5 t/ l. ]2 S
    run_cmd $command $cmdline -banner 2# a. v/ y5 s  u* `3 E; T
  done;: R" N# p( f: l" C

' |0 Y. T) v- D/ _! {, W) i1 z( P4 b  if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then
3 Q. {9 g7 [$ [! |  v    rm -f $LOOP_CTRL_FILE$$) @  T2 O5 C; v$ X
  fi
& {( L, h0 r* U2 v}9 s( v# S1 R5 _7 h+ ]. B
2 w$ H" l* E% q
har_check_ret_stat(). S, [, @" D) Y8 P/ u9 [
{
2 R$ n' Q+ l' R/ r7 P  if [ $ret_stat -ne 0 ]; then 0 t: s4 L$ {4 l6 V4 m
    echo "Simulator returned with non-zero exit status. Stopping."
# O( }& o- N; ?6 s  ~: V    exit 1. @# c% {1 ]4 F  M; [/ K! o
  fi
  }5 L/ Z9 J. F% d8 p7 q4 [}
* _: B) P& [* d  m5 u+ N9 n) d7 I
#9 P0 R7 l9 t7 V0 ]
# set stacksize and datasize limit
0 p& ]* k. }9 r3 t#
4 k" t! W. r, E# R8 X6 ^# C" Q4 y! v# B5 }, l: [( u6 @; a0 z4 g
set_data_limit7 h# ^- g2 q  E) p# m
set_stack_limit  `. P( R3 b* u+ ]% ^

+ U) M- O" q1 `" [7 T0 b, q9 X#rm -f $LOOP_CTRL_FILE, z' r5 f& q5 q! h9 }, ~
% u; W, q) v# h1 B( e2 l
run_main()/ s! c3 V* l, a% l- O
{
0 ^( w7 d5 b+ {! E* b: b0 P$ |if [ $is_special_har_run -eq 1 ]; then4 m( D/ W! u5 ^1 C0 l2 e$ C% J
  if [ "$har_ofile_prefix" = "" ]; then3 l% p5 _! g  l
    echo "Wrapper bug. Notify Synopsys technical support."
1 T) O: X3 q1 A1 i+ h2 D8 {2 T" @    exit 1
) D3 N& Y# m+ l+ f. Y  fi1 C8 a0 A  S$ [9 [% W4 ?2 e
  if [ "$har_hilo_file" = "" ]; then
" Z6 Z. m3 T) |3 x$ [    # no user specified hi lo file - do both runs" H+ k. U. \- `6 |4 q
    run_cmd $command $CMDLINE -har_one -har_setup5 r+ D1 y4 K8 {& \
    if [ $ret_stat -ne 126 ]; then
  L; i. E) i# R  q, J      har_check_ret_stat
. C2 E7 L# T- R      if [ -r $LOOP_CTRL_FILE$$ ]; then( M# F; j: E. F, U0 k, {
        run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl+ i; R$ {( Y8 o& x+ p1 L1 A! x5 U
        rm -f ${har_ofile_prefix}.hl" X9 h, W9 B4 ~9 S) I& X- v' d* g7 Z
      else3 k, R2 _& d7 F% _2 R" R
        run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl% Z7 M: E- E5 C
      fi
' O4 h$ f6 @! O9 L, D    else
$ A- d) j0 N) h1 E7 D* A' G3 T6 \/ L1 S      ret_stat=0& x5 k' S2 ^! K7 [/ D
    fi
) P3 F5 E$ T  s! E5 D  else7 ?+ s5 j1 D5 y+ G
    # user gave a hi lo file name2 S8 c" ?) a, v2 R$ T
    if [ -f $har_hilo_file -a -s $har_hilo_file ]; then" ~( M0 a- k( P7 {5 Q0 |7 \' o/ Q. C$ w
      # file exists - use it - only do sim run
* h& B9 G& w4 }7 L% M2 W, f      run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}7 c5 j- N- J3 M8 X9 k7 a1 b
      run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}! U$ u2 W2 {: M
    else
1 n( r& D& t) [: c) d      # no such file - generate it - do both runs: z8 Z6 E8 b: S/ o7 X
      run_cmd $command $CMDLINE -har_one -har_fnf -har_setup
! u# o) K2 d; U  H      if [ $ret_stat -ne 126 ]; then# S* d% g# m; m) J, V+ Q7 h$ ^: K
        har_check_ret_stat" n8 d$ x9 x4 P- \
        if [ ! -f ${har_ofile_prefix}.hl ]; then
9 R+ O6 K* b& N0 m' a/ u6 {( T: o          echo "No hi lo file generated after setup phase. "
" G, F' P, y5 O5 i+ G          echo "Contact Synopsys technical support."
* d) S6 c$ C7 K% x1 m6 x) t          exit 1
8 ]/ T8 n/ x5 F        else' t3 X$ F8 T, X2 U
          if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then3 Z- L# {" S' J5 ]3 c; O- u; x( r
            mv ${har_ofile_prefix}.hl $har_hilo_file% g& H! a% Q4 L* }: x/ q
          fi
9 a3 y) c  P  a* O6 W, R8 A        fi( B# e" r# h7 N: A: z. w$ t" |
        if [ -r $LOOP_CTRL_FILE$$ ]; then4 K* M4 {# s6 F6 n  A, E& F( a' j
          run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file/ Q8 Q& U& z7 g
        else* K, N" r, A, g( _5 w$ E
          run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file
+ X7 O; z6 |& }+ x        fi" P: m+ \: ~+ g* R; m) v, |% g
      else % F9 y; h% m- r5 n8 d2 \
        ret_stat=0
" i# i8 s5 Q1 [# u# e5 ]/ P+ A      fi
* x7 m3 g" `" Q1 r" J8 P( P    fi
( v0 Y# f9 z& i+ N  fi
8 J! O! u+ U0 L' Z: T0 `else  
0 O2 r! `" N0 f/ @# don't loop if -har_setup, u& M. X1 ~6 W- f  e1 Z7 q5 U" b( a& g) }
  if [ $have_har_setup_flag -eq 1 ]; then
- v& e/ q) o& p8 t! Y" ?  V! ^    run_cmd $command $CMDLINE
/ ?& [8 W6 D* p7 p  B! m( t) ]    if [ -r $LOOP_CTRL_FILE$$ ]; then
; ^- N# }) e, |1 F8 G" [      rm -f $LOOP_CTRL_FILE$$/ ?8 T: t8 [- t
    fi3 V, y3 Z, r9 y: r. S) p# T
  else
; J2 ]1 \# \+ h5 j    run_cmd $command $CMDLINE% H% U8 J7 M: @1 j1 n! D
    run_loop $command $CMDLINE- u0 I- o1 J0 a: ~  L
  fi% ?8 a" z7 `7 [& C
fi1 E; ~+ L0 d! ]! x7 x' ~8 O
4 `# n: d. b* l+ k/ O+ A: g9 O
if [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then# q* ^" w) r" m; r. U$ B4 r! @) p
  pwCreateErrDB -w $workDir -e $errFile
2 M0 f+ E( r9 @* I- Y% z  ret_stat=$?' m8 f& J/ h4 D8 \4 ?
fi, r6 E6 n. r  _% [/ O* u! H
}; y; ]+ C0 D; T8 y* \( a) f
& Z% A% c- L! f4 V( m* T( I
cleanup_alter()
1 x1 U8 Z6 Y5 U. G8 T7 \4 N- L{7 [) S! @8 ~5 D/ q9 W2 W$ D' X
   /bin/rm -f $ALTER_COUNT_FILE 1>&2
! i, S% l' B: f% Z" V4 c   /bin/rm -f $ALTER_HK_FILE 1>&2
( b( A; [! a: G( p}
5 e5 V4 r- J! B( }
/ t( \9 y) u# j/ d' n#generate alter temp files based on pid
, o# Q* O; y' w+ u% T4 pALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$3 Q6 L1 x- Q9 H6 A; {/ b* ~
if [ -f $ALTER_COUNT_FILE ]0 W: X5 Y: d+ B" r/ {7 ~
then 6 R1 b/ K4 [( R" @
  until [ ! -f $ALTER_COUNT_FILE ]0 K# h( w" s! D2 \
  do/ @& b7 Y5 [$ }4 V( u" {- Y9 q
    ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$7 O0 o6 y2 S: b* V' L/ \( y7 J
  done
* H8 S: {  E0 g9 N, X* ^fi
( T. P6 d0 N' \2 R9 o, fexport ALTER_COUNT_FILE/ `. H/ N. J' i/ i* H) [
# R' t  K  m% M$ H6 D) a
ALTER_HK_FILE="$ALTER_HK_FILE"$$
% H( ~& F0 {  V$ z9 ]  Lif [ -f $ALTER_HK_FILE ]
9 Z0 N* Q4 ^  {then , ?( \5 s" `* b8 h( W8 C" F
  until [ ! -f $ALTER_HK_FILE ]
; D4 U; w4 T# `: d/ s! ?  do) a$ S2 a8 u6 z1 |
    ALTER_HK_FILE="$ALTER_HK_FILE"$$
# D3 S% c" K7 P  done
1 P! D6 L' w& [9 s% y% |fi3 }! d, N# {* @0 ~
export ALTER_HK_FILE
1 Y( ]( S9 U' K3 N8 Q
3 J: j" V* G. V  o4 s/ J3 A#generate monte carlo related temp files based on pid' B- Z0 r' l" t( W
cleanup_monte()
( I, S( ?  Y# k" Q{
5 B; ]  h; X! F8 z3 @0 m4 D   /bin/rm -f $MONTE_IMG_FILE 1>&2
  |+ X0 Q; y- ?) e   /bin/rm -f $MONTE_IMG_FILE.gz 1>&2
, b/ C/ e- h) m6 w) c   /bin/rm -f $MONTE_COUNT_FILE 1>&2
0 \: O" M5 G$ _9 Y   /bin/rm -f $MONTE_CFG_FILE 1>&2  ?/ h( Y# l3 F# Z
}
* G1 t0 Z, i( o6 [  L; k$ r$ P7 I1 G1 d# v! x' @  l
MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
& A( }& w8 j. _# X! vif [ -f $MONTE_COUNT_FILE ]
+ n+ i1 [- f- Y& m6 |then
- s  s  {8 X$ I- E8 u9 M4 ]  until [ ! -f $MONTE_COUNT_FILE ]: ?* |# l& W* s# i' D+ }) Y' v
  do  [& }7 p- u) A+ G, O
    MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$, u3 Z4 M- C4 H
  done4 A" i% S4 T' F$ s' _- s# K
fi
4 F; l8 s% a( \6 K1 Jexport MONTE_COUNT_FILE
, [9 i: Z3 i  O
" I& R( I% x  w1 z! N2 _MONTE_IMG_FILE="$MONTE_IMG_FILE"$$
- w& b: Z8 U/ K% @7 i# a+ fif [ -f $MONTE_IMG_FILE ]
6 m+ M9 [% h$ k- d" \then  i4 ]7 H% p9 p( E
  until [ ! -f $MONTE_IMG_FILE ]
/ e2 V6 E. y' Y. x/ t: g  do( k. w+ j$ T3 z+ U
    MONTE_IMG_FILE="$MONTE_IMG_FILE"$$4 s8 M* @" }$ a& U9 W: |6 ?
  done
* s6 M8 F( v& c5 V6 ifi- V1 ?; a2 i" R  T
export MONTE_IMG_FILE
4 j) y# a; k& w: R
! u7 F! K# `4 O6 w" a# vMONTE_CFG_FILE="$MONTE_CFG_FILE"$$
8 V' Q  x9 i- n; D' _5 Jif [ -f $MONTE_CFG_FILE ]  e; A& Z  f5 W: N
then
  O; v+ s! T1 a/ |3 ?8 b; ?; S  until [ ! -f $MONTE_CFG_FILE ]: J" I# I+ ^3 S" b+ C: C
  do+ B) }/ K( H, R& r/ v
    MONTE_CFG_FILE="$MONTE_CFG_FILE"$$  p5 x# T! l: q: u5 T& s
  done: [  G4 Y0 w, _& [/ k( ^% [
fi  u) c, f+ {( x

" s: p6 U" @; q# main iteration
8 m& G* B+ b5 n# d2 E* p& N: @run_main
+ u7 U" d, q' f9 f8 E7 W. T9 }" B, g; n; V6 j) F2 k6 C6 \
if [ $ret_stat -ne 0 ] 2 z6 {) S/ r4 b$ ^
then
/ ^8 m" N1 Z6 Z' ]* E% c% d  n  cleanup_alter
. Z, Y2 F: Y. c+ K9 g% ^  cleanup_monte
' [/ n- B3 S, I3 T$ R  Exit $ret_stat
6 H0 n8 _! i+ K; b  p( i0 r, Ufi3 j' p, W- M  i% p

& Y  u$ _# H. \3 A* i  ?#Alter related iterations4 s  N& ]9 f7 O* T+ j9 \

+ P4 s7 j% X4 r* A  eiterations=0
! f+ c# a4 P" n- t3 Q# zcount=0
% Z: {) S4 @( d! ]! ]1 Y! Q5 bif test -s "$ALTER_COUNT_FILE"
/ X& X3 H& @0 X( t+ N* [9 ythen
& \  j4 o4 N: b+ N  if [ -r $ALTER_COUNT_FILE ]; then4 B  H  m, v, n# g
   exec 7< $ALTER_COUNT_FILE& E( J0 `5 [9 C. n- a
   read iterations <&7
* d& i: {$ V; t+ F2 c  O; T; Z( B fi% u$ h, a& M9 \. A
fi
  M/ O: K; r8 B2 P  R
1 c9 B$ [& Y) u$ u: f& Btrap 'echo Program Interrupt; cleanup_alter; exit 1'  2+ C! _! R, {) D2 n
while [ $count -lt $iterations ]3 M6 K5 z% \# J2 }/ R
do1 a+ T' j8 h8 j8 K6 S
count=`expr $count + 1`
% S7 K% s5 g4 o* ] ALTER_COUNT=$count
* W: f3 z8 D2 g  B+ |$ B export ALTER_COUNT- p: b0 K& O9 R6 O* r$ l
) x' o  p% b8 u# K2 v
run_main2 n( G$ P' \( H7 V1 B
! [) [1 g5 q" g0 `0 i9 ], D
done% T' |  I- d, E4 A# I5 M) }
' C  p2 J* Y. k) u! q# R# A
#Monte carlo related iterations
5 R4 g+ u4 Y) f* M% e% q6 E' C
" T  Y9 q6 i& ?  N0 O3 \. L5 w* ]% Dmonte_runtime_summary()
$ E7 R" W+ Q* z% a3 J2 ]{7 Y' \! ^- {. c0 |  i" w5 C) a
  keyword_1=real1 W. c8 N5 w/ u8 s$ Y) \( x
  keyword_2=user3 _. W9 s! ]- f: C7 H
  keyword_3=sys  V  Y& C% {8 S8 {) S! z' F
  ofile_prefix=nanosim0 ~! T9 j; n# x9 y& z$ ?$ n% b

* D0 v% q" Q5 z/ P- n  if [ ! -z "$o_option" ]; then
- j: B+ G# h8 N6 m    logfile=${o_option}.log
! E2 l9 W) U3 v# f/ O  else6 [. q  r' M  B( B! l' Q
    logfile=${ofile_prefix}.log! h$ }7 w4 {" y5 H2 O6 |
  fi% S( Q) ]3 o, P& D1 U
7 ~! z3 s: W% H
  if [ -f $logfile ]; then
3 l3 U2 I& Y: v) @: G2 j( u) a. v( A    echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile      4 Z; g; ~' F" @* t; G! c3 k+ n
    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
! h# E( W3 j9 h+ E" F1 k7 F8 T' I7 t  fi
1 C& w2 {. {5 r6 _8 ^}+ Y: p6 I% d5 y4 q9 p: m

/ j1 ~2 V* }& {* hnext_monte=0
3 U0 c1 O$ x( A# `/ w1 qcur_monte=0; G5 J) ]1 p: ]) H5 _! \  J7 l

- c( O' Q3 j3 D+ p$ q# }if test -s "$MONTE_COUNT_FILE"
3 t- P6 a6 P1 N2 h, W& h. |then7 R6 w5 \6 x7 B" R
  if [ -r $MONTE_COUNT_FILE ]; then
! V* ]/ _. h- |/ P0 V   exec 8< $MONTE_COUNT_FILE
$ _* w3 z' g6 K6 Y) N   read next_monte <&8. n  X# r( T& H; N* R8 `
  fi  Z: e, u0 x0 ~  x8 G
fi
& q8 Z, |( p! ?+ ]0 h$ U( d5 I) D& n, l
trap 'echo Program Interrupt; cleanup_monte; exit 1'  2
- t0 m. H+ r  C& e$ m0 ~  P; Nwhile [ $next_monte -gt 0 -a $next_monte != $cur_monte ]3 T: S6 \# t% L! K' Z8 L  \
do
3 @1 l" o% X% C& t6 y  NS_CURRENT_MONTE_COUNT=$next_monte
. C, N9 t' F/ J% C% n' b  export NS_CURRENT_MONTE_COUNT
9 Y/ [3 }, P' E- S- Z" I) R6 P' E8 J- s- {1 J) E* U6 ]) A8 Y2 P7 Q
  echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE
! ^  U8 K2 [" ]* o- _  CMDLINE="$CMDLINE -c $MONTE_CFG_FILE"
& e0 A7 @; Y9 Z3 R% X7 i  run_main& e; K) ~/ X$ f/ e; r, t$ B4 S
% {$ K$ {# o! Z
  cur_monte=$next_monte
7 U9 \& c+ W+ v3 T8 T, V2 V0 ?  exec 8< $MONTE_COUNT_FILE
& K1 }5 W9 H* f# C$ B  read next_monte <&8
2 O- t! R2 U+ g6 {6 Ydone
- \+ {, v  _8 v6 v, l) n9 ~6 x6 f. u* V! C8 a& t
if [ -f $MONTE_COUNT_FILE ]% V" b- L5 {% u9 ^/ ?, ]; r
then0 r2 o% S! _+ g/ d/ \* }
  monte_runtime_summary
1 I3 S  F, b0 N; |/ H) l. R* tfi+ c9 v9 n; F) P* p) Y+ E7 C0 k$ ~

7 F3 A6 z+ @. y: G; Ycleanup_alter/ |' S2 y/ U& [
cleanup_monte
; A3 M4 y+ Q8 [2 X& s6 P- e) ~+ P4 ~" _2 }1 i8 e/ ?
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-9-25 11:23 PM , Processed in 0.214012 second(s), 16 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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