Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

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

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

[複製鏈接]
跳轉到指定樓層
1#
發表於 2012-5-6 13:58:13 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
10Chipcoin
各位大大好:
1 f! G/ j! N; E$ h+ @0 p                      小弟執行nanosim時,卻無法跑出視窗來,有個錯誤可是我不清楚該如何解決?問題如下; h/ I% N+ K4 |8 W6 ^0 I
                      [: 113: 64: unexpected operator0 j* g  s5 x2 X8 k6 Q
/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim: 1: Syntax error: Unterminated quoted string$ X  i$ H/ Z7 ~  g# }2 [
有大大遇過這方面的問題或是指導我方向去解決, 謝謝.   {9 a, L: j# q
我在猜可能是這個檔案內的文字需要修改 但不知道該如何修改?4 m, l; Q+ ?* I  f' m1 Y' D
以下為/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim 的檔案內容:
1 g* K; c! h5 ~8 S0 N$ P    #!/bin/sh9 X9 M, z$ ^- c+ m3 N) c' o
## }( d+ E7 b- S; {3 w" p* s
# Copyright (C) 2001 Synopsys INC
8 J7 m( Z+ S3 S* z0 r# EPIC Dynamic Simulation Wrapper (DSW)
: [$ ?  M! W2 R#
3 z5 w& g( _* O6 weval ${DBG_EPIC_WRAPPER:+"set -x"}, \: w& T; y8 S0 o3 f" ~2 U, T

. {& r3 z7 N, @if [ "$EPIC_WRAPPER_DVLP" = "" ]; then) F- I. s( h# a/ P. |) |1 r
    TEMP_ARCH="$SES_ARCH"
& m8 P# k6 @% S# belse
$ c) C" F7 I/ k& K% U) I/ x    TEMP_ARCH="$EPIC_ARCH"
, Z7 L# T8 u  u4 A2 a' K4 @' K" x: jfi
& q) _3 S- C6 ]1 P* }' C( A6 G1 m' K9 F# {, j1 a+ [0 @/ |0 [
scan_for_hva_args()
% e/ U1 _6 t$ y& G{/ w) H- a) S+ N  R' P7 g
  /bin/rm -f hva.init 1>&2, Z0 Y+ m8 I- r: _# Y/ _; ?6 i- t
  while [ $# -gt 0 ]; do) a0 s  g5 O* h* d
    case "$1" in0 X6 f3 D2 o4 h% E
      -vaf)
# J7 D0 B7 y" {3 V3 v. V& A" t           have_vaf_flag=1
% K5 R; X# L$ O           have_va_flag=0( c  f! b& \3 O0 l
           shift;7 W9 ?8 o: O% v/ g5 e6 Y
           continue;
+ @2 v" [) Z( W4 W# y8 g9 c; S9 K9 ^        ;;
5 n5 M# h+ T/ C      -va)' h/ L- E- R6 _( N
           have_va_flag=1/ H. X0 F* N6 X1 p) f1 q4 M
           have_vaf_flag=0) P  {  B% O* R7 Z7 r- E
           shift;
& a- P6 Q5 s. p5 \; h           continue;, U/ D8 ^5 n. A6 V
        ;;
& f! V$ A9 M% `5 a  |1 B. h! r9 w      -*)
0 D+ b: P9 k* Q' T5 q1 I           ARGV="$ARGV $1"  B7 B  }4 ^9 O( n8 b
           have_va_flag=0
# E8 x5 T4 E6 V2 t/ X- L/ L           have_vaf_flag=09 A1 C, F6 o' T$ `, I" W
           shift;
1 [: A! Q4 |3 f$ \) e7 Y  r           continue;% u7 A) [6 i, i' |6 x+ K
        ;;
7 E4 ^7 p8 n2 r8 g- G9 ]      *)7 |5 x) i$ D' P  S3 V. p
           if [ x"$have_va_flag" = x"1" ] ; then
8 J) @# S4 i' D/ \7 \" S              VA_FILE="$VA_FILE $1"
5 K& V8 o. D2 Q6 `( [8 h3 V           elif [ x"$have_vaf_flag" = x"1" ] ; then
+ a# j7 ~) A8 m+ F  d, }              X="`cat $1 | sed -e '/\;/d;`"
* B/ d9 n/ A" n9 x2 k/ G              for token in ${X}; do; K! w0 f- H: S# a  o. V
                 VA_FILE="$VA_FILE $token"
, C! K5 ?3 z7 D9 \: |5 C              done 2 Y$ ]; }, t3 G9 N
           else1 B+ Q' Z2 q0 @3 U( A
              ARGV="$ARGV $1"
5 X3 V2 M: R; n# @           fi
* u* Z! S! L& c5 N8 @2 o           shift;- {2 Z% C! C& B/ O: x# ?. ?
        ;;+ J0 p7 R, j) r7 x) V2 {& v9 [5 ~
    esac- n2 L4 L' D, P! W! V/ W
  done7 }6 d" O: ^) U8 b

* R* ^) `/ m% m  if [ x"$VA_FILE" != x"" ] ; then
1 f1 Z1 ~) C- w##     /bin/echo " xxx ARGV $ARGV"
! h5 O7 e) k2 d4 H8 j       /bin/echo "choose nanosim $ARGV ;" > hva.init/ Z7 H/ @2 A3 I; }5 l8 }+ I
       echo vcs +ad=hva.init $VA_FILE -o simv
! k4 u7 i4 j7 u, N       vcs +ad=hva.init $VA_FILE -o simv
3 X; n% F  w$ D7 V* |       exe_status=$?
+ T% A8 ^% s! e: B; f: f1 T       if [ $exe_status != 100 ]; then5 p  q1 G- |/ {% e8 m
          /bin/echo ""
/ `: ?" B$ G* x/ h& j          /bin/echo "ERROR: Execution of vcs exited with code $exe_status"
: R; J. _, t* R/ c          /bin/echo ""
9 x6 ~9 n2 w/ p3 X; w6 w8 O; V8 I( f          exit $exe_status9 o$ U! S4 P9 Q3 T# u5 L4 z  y: z- `; c
       fi
* V8 U4 R( i% k" l3 ~/ m) p       hva_files="-n simv.daidir/amsVD.ntl simv.daidir/amsWRAP.spi"
: j; x) h" ^6 W       ARGV="$ARGV $hva_files"4 |  A6 f( [  Y, `0 R( |
  fi: |, u! ?2 W+ x4 B9 ~8 A
}, A1 {0 p; R; l: C
#-------------------------------------------------------------------------/ g, T# L* C: J  o( j5 R
4 ~  R  ^4 C  t; U% O3 |
cleanup()! J8 d' I6 ^6 J
{3 j% b% @" j- ^0 }6 D+ ~
    if [ -d "$rundir" ]; then0 X% k" K( K: r* C
        # On AIX, a .nfsXXX file is created if libModel.o is removed
7 G# h* f& x! @! O  ^1 K. D        # so .epicrun is not removed because directory is not empty.( v7 k* R  `# ?% {( I- b5 ?% e
        # Solution is to remove it again if the first rm failed  c5 Y* n+ p  l' q
        # (rm -rf $rundir || rm -rf $rundir) 1> /dev/null 2>&1
; h$ c) ?1 R! T' Z8 u) n$ |3 N        if [ "$EXTRA_CAPACITY" = "YES" ]; then8 W' q' ~: ?  L, E2 J* B: ^3 S+ {
        chmod u+x $rundir/rpcidfile
- q( A( q# q" H' T$ r. p+ J        $rundir/rpcidfile
- s( x; |7 z" d# X        rm $rundir/rpcidfile3 a/ c: h3 ]2 H  c
        fi6 E3 M0 A/ B1 \+ R/ o
        rm -rf $rundir! C0 E' \: Q$ u4 B; Z1 }: J5 g& S

( ~& c- b6 Q& ~6 p        #Due to NFS problem, we have to copy files needed to6 _# b" k9 ?! H. P3 Z) N( B1 o
        #/tmp/<temporary directory>, then symlink's files- d/ m, K  n# t9 Y5 L. O* {
        #to the local temporary 'rundir'. This avoids the problem9 u! h5 @2 v' E% R. p
        #to remove 'rundir'
) q1 |" B' E  i* X# S        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then% V4 z% ^9 W# Y- s
          if [ -d "$tdir" ]; then) g5 {, x  [. m7 d6 L4 R+ T
            rm -rf $tdir( k, @! T8 F/ ?
          fi
. I6 k( p. H+ ^  S+ c        fi) X  {1 t' w* @8 Q. |
    fi: @% [5 Q" S6 M+ T/ V: f
    if [ ${exitstatus:-0} -eq $ld_err_code ]; then! }1 v; Q4 Q) w
        [ "$has_model" = "YES" ] && rm -f $cwd/libModel$suffix( `8 l) b, j6 S( B  O8 p- I
        [ "$has_custom" = "YES" ] && rm -f $cwd/libCustom$suffix7 S6 |7 a( H2 C' i9 K+ I
    fi# @  b% |( p$ y# E% A0 T) C
    [ -f "$EPIC_SCRIPT_MESSAGES_FILE" ] && rm -f $EPIC_SCRIPT_MESSAGES_FILE 1>&26 ^# Y- _* p/ Y% W8 G9 k: j  w: [
    exit ${exitstatus:-0}
/ F# z! G- T, O( X  f}
8 O" u' r+ M$ }+ O* S* {: x
/ K- L7 n$ L1 l2 j- xExit()
# e* j. p3 a8 K, p' E: o0 I3 y{+ |" |- q# g5 s- J
    exitstatus=$1
; H3 M+ ?0 o: n    exit $exitstatus
* }/ P9 b0 }# j4 Y2 I  w}+ k- y% o, a* j9 P6 x

( w. h& V1 W; W" M0 n. A2 A# get_epicrc filename keyword
2 f; h4 ^" P) I) Eget_epicrc()# \& D4 b: U, e  k# @
{. [/ R/ |4 o( y  v5 ~) S
    [ -f $1 ] || exit 0, M# {: P& Z6 ^% q5 g. `
    key="/^$cmd2:/{print \$3}"; m4 q4 J1 v3 i: G1 r* o1 w1 V
    awk -F":" "$key" $1
$ {) y. B) a5 h8 W* `}
* x$ m( @6 S2 `+ }: e+ `
2 R4 l4 U) c) }- j0 O#
8 `% Y7 A- Q5 E3 N1 V5 m5 ~$ F# set datasize limit to hardlimit1 L+ C  j2 n0 z) ^# q
#
9 \0 Q! l. M$ j1 w$ w2 @5 ^set_data_limit()
; `; w2 H5 o3 _' Q& |8 A5 y{! e5 Q) g: O3 k. q! z1 D6 z
    dbglimit=0
, h, E; N0 r% ^( w  j    hardlimit=`ulimit -Hd`) f- k8 N/ ]9 B% s
    softlimit=`ulimit -d`7 o/ _. h$ I' O8 X
    desiredlimit=3500000
, X8 }1 H3 w. q2 C: F0 m    hardisunlimited=0& {* m' o) G6 Z( A$ t
    softisunlimited=0
( I0 I/ \+ [1 k    is64=0( [% l) r% L# j
$ n% p. H- a% k9 ]. j
    case "$EPIC_ARCH" in. \8 B. A0 B9 S+ @
    *SUN*64)
( N& u9 }  T- H- \. w        is64=1
$ K1 g2 Z6 a, @- h        ;;
& r3 K- q1 y/ i) x    amd64), p9 J+ }$ B; J/ _
        is64=1; n+ R) k3 X& Y! l4 [0 @
        ;;+ p. O! g4 v* C8 r0 `
    x86sol64)
7 R1 l* @0 T8 A% l$ j        is64=1
; Z6 Z6 g# K  Y4 F3 A1 o        ;;  A6 |7 k  w! k! O
    aix64)
. C+ {+ X$ p1 m        is64=1
# W( I4 h5 u6 Y3 [        ;;& I9 L* d2 S" Y6 H' Z. B
    suse64)/ F% q0 j4 _: q
        is64=1
5 v! |/ q# s# z5 [9 b) C0 X% t' @7 @        ;;
  t1 X  y" [8 Y0 ?2 l, ^    esac+ k1 P  a7 t, `# {! T) F( z* @
* a2 k5 E9 x% Q8 ~9 N% A
    if [ $dbglimit -eq 1 ]; then8 K0 P& f/ d: ^% Q/ n4 y, _
        echo hard $hardlimit soft $softlimit- r9 I* B/ ~  q0 N9 K; W' D& o
    fi
9 s3 t# M) _1 _9 c
# c- t7 `3 P' A* X    if [ x$softlimit = "xunlimited" ]; then2 O3 O3 T9 X' ]
        softisunlimited=16 K1 ^1 W5 b, M
    fi
8 B3 h9 U: A+ i' W9 s9 ^* X0 Z# S% L
    if [ x$hardlimit = "xunlimited" ]; then
* B+ {. w, K' [8 l. V" J        hardisunlimited=1
" c$ k5 n# `1 ]' G3 W. w    fi3 v% s8 t1 H: Z6 w: o1 q

0 R0 t' D- c  T* d    # 64 bit machine should have bigger than 4G
7 h: {6 A1 Y, w$ c& g. x9 q' V    if [ $is64 -eq 1 ]; then% }. ~6 @$ U  B) B( S3 }! k
        desiredlimit=5000000  L3 v$ g6 Q/ R
    fi
+ \' d! B/ z$ g  Q. y
0 d% ~+ ~1 n+ T" a; I0 A' ~    if [ $hardisunlimited -eq 0 ]; then( F0 B! O% P' T& x, U3 J0 a
        if [ $hardlimit -lt $desiredlimit ]; then
; D, J- n9 v; I8 u3 h) `            echo "WARNING: datasize hard limit $hardlimit K is too small."
( S$ w/ I, d1 a4 S        fi, w1 w) t- M6 }% N
    fi
" G# U5 E1 a5 t9 @0 [+ L5 D1 ~$ x+ O, D$ h3 y! N1 D
    if [ $hardlimit != $softlimit ]; then
( [; [* y) g  O- K1 e        ulimit -Sd $hardlimit
* c) P2 ^' R! x3 N. X9 \#        echo "WARNING: datasize limit is set to `ulimit -Sd`"
3 d6 P+ c$ \# \7 J* C    fi  ]6 M+ r7 D2 w5 d

2 c+ M. ]1 @- L/ O+ N; P    if [ $dbglimit -eq 1 ]; then7 O2 C, ?% U# @- G
        echo datasize hard limit: `ulimit -Hd`% Y; F7 V+ z% H" k2 p: i0 u* f* O
        echo datasize soft limit: `ulimit -d`5 [2 w! |! S- }' A6 q: i- G3 t5 h+ e
    fi
! X" w) p( C8 Z: z% Q3 L}  @2 v& [, @( _# u
1 f( |8 U) c: H$ d5 q9 w
#; |5 K3 K: V0 Y: D9 q; y+ e
# set stacksize limit to desired limit
  P6 B; T% V* I# _% ~! ?4 Q4 y( Y#
+ B4 j/ I& m) Zset_stack_limit()( {+ v4 x0 v; n2 ]- z4 y
{) i5 s! I( u3 T% C: z9 t# _2 Q
    dbglimit=02 `8 H/ G2 ^, }  A6 v& [3 ]& m2 S
    hardlimit=`ulimit -Hs`
' R$ ]# m* ~- U$ @( X3 k2 f    softlimit=`ulimit -s`3 q! D. k3 ?1 S$ e+ M6 D
    desiredlimit=60000
6 I3 Y5 {+ q+ _% a/ Y    hardisunlimited=0
1 A( [" ?# z: Y2 [" t+ `    softisunlimited=0
5 t# [# C7 x& v4 T  P* o9 F# n$ Z7 z    is64=08 u( `+ }5 z) \% `8 f* |

; Z7 ^! P; s; M) q( p* ?) D2 ~    case "$EPIC_ARCH" in
/ b# K$ ?+ |1 Q! f; F    *SUN*64)
6 t3 e" r& k) G/ \9 C        is64=1
: f1 K( I7 v/ p! k        ;;
2 a/ f" e: ?# X    amd64)
% ?+ k" G; z$ t- c" `. G/ j# |        is64=1
$ z+ n0 z) K7 t5 q$ g/ a        ;;9 G4 p" H4 N1 g
    x86sol64). W' C0 N& o+ ?+ @. ?
        is64=1( F; e! w$ t5 F9 z3 r  w+ j/ r& N4 {
        ;;
" }+ ]9 e* v: M: ?; n% C( O: b$ i4 S    aix64)
, P2 U5 D5 u+ \) M" S; ~        is64=17 l. m  o2 V: c6 p% A, W/ B7 R
        ;;
( M9 T) X" g! a2 w) Q    suse64)
0 m- k9 q0 n5 Z+ q. y3 ]        is64=1
' Y' L; a$ ~/ H+ y4 A        ;;
$ X* z5 Z5 Z& o9 y' C+ Y    esac- |( T1 Y1 r$ M
) I. j% h" A2 m; b/ [$ G: F; W" H* u
if [ "$EPIC_WRAPPER_DVLP" = "" ]; then
: A5 R! I: ~& u5 }    if [ $is64 -eq 1 ]; then. A2 W) {7 b# |* c4 N0 F0 @8 g' H
        desiredlimit=200000! O  f5 E% J: w0 ]/ @
    fi
" J" q0 l1 S' f. o8 g& X! Belse
: S" F# L" ]6 `; ?    case "$EPIC_ARCH" in! E/ s+ |' l6 Z5 N4 {/ Y3 C, i- K
    *SUN*64)
$ d0 p  D1 x) l        desiredlimit=2000007 T6 E: P" M5 a
        ;;0 S+ U- ^- ^: i) Y
    esac: p- H2 ]; C2 M4 r) ]! C9 S! t- G' d
fi
( P, K2 K& x6 X) w! z+ ^        , B% {) ^' u" b0 n
    if [ $dbglimit -eq 1 ]; then4 A7 ?2 E% [4 U
        echo hard $hardlimit soft $softlimit
7 t- {' x* b; g; ^. @( D7 M/ l3 V" X    fi
6 z9 h) q) w6 W; F' c  J9 G2 c5 M5 u. E9 C( i% L! c
    #stacksize can not be unlimited, pick smaller number
# i% ^% t: h- W5 U+ `& Q4 X: h( }. Q
    stacklimit=$desiredlimit
* E- l5 \( N& w/ ]2 L2 h7 m6 V8 c9 q0 C4 S, g; f# J
    if [ x$hardlimit = "xunlimited" ]; then
( [& q5 c. B* W7 N# ~9 x# E        hardisunlimited=1. \1 `3 B6 u4 u+ I# m! J
    fi7 {; v' o) r, \

- [  I9 J( M: \: D& J+ y    if [ x$softlimit = "xunlimited" ]; then
( f% S/ _/ q# M6 h1 w6 K        softisunlimited=1
+ b/ z4 I" e5 }5 P8 f    fi) ^5 R6 B9 n- c# ?* i6 q8 t: w
$ Q, \0 W+ ~4 ]- Y0 \/ g, T
    if [ $hardisunlimited -eq 0 ]; then6 ^# T* S; j9 @! z9 ?0 w
        if [ $hardlimit -lt $desiredlimit ]; then
, J$ K& y! q2 j4 k* }            echo "WARNING: stacksize hard limit $hardlimit K is too small."
2 L# K% s1 D6 l+ ~" r! m            desiredlimit=$hardlimit3 Y" l( ?1 G0 \$ o) u  }+ ?
            stacklimit=$desiredlimit
0 t6 F& t% {* E4 `- n& C        fi
; \: y- q5 q8 i    fi
7 C9 B) g  J1 I6 {" w- G
! E9 B! I& {5 B8 K* r; @    # desiredlimit is set to proper value (< hardlimit)$ [! e, U+ x/ |" K
* J: W8 ^$ B3 K6 k( ]8 t/ u
    if [ $softisunlimited -eq 0 ]; then
5 `+ Q' I0 b! z" d        if [ $softlimit -gt $desiredlimit ]; then3 l6 R3 `& `% A+ F% y) n- b
            stacklimit=$softlimit
# f, P9 l" }3 j0 u4 L0 v- D        fi6 |: F3 K3 g" H- S
    fi
2 E$ j9 d' J5 ~8 }4 B
7 W) E4 C! W$ O; I; N: L# e+ `    if [ $softlimit != $stacklimit ]; then) K  T) ]4 E+ R+ X
        ulimit -Ss $stacklimit
4 \# B9 f' O2 }5 h#        echo "WARNING: stacksize limit is set to `ulimit -Ss`"
' Q; a' B9 s: A! B    fi0 O% P2 Q) w% b* t

; N- [/ U8 u# m9 e2 K    if [ $dbglimit -eq 1 ]; then1 W( u$ R, K8 y& \6 p
        echo stacksize hard limit: `ulimit -Hs`2 S- K5 F* }+ w5 t4 E; [9 u3 R
        echo stackize soft limit: `ulimit -s`/ M0 ?- G$ g8 ]
    fi
* [9 t6 s  i9 I) L# Z+ _}
+ z( c) k0 N7 z* D8 w. Y
, d& d+ h- s/ b% e1 S& lopen_epicscriptmessages()
; `. z; z9 _7 h{
+ B+ i+ L- B% T" \: Z0 M#generate  temp ".epicscriptmessages" file based on pid
; p: S1 z. J1 {EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$6 B# f+ U; C6 Z0 N
if [ -f $EPIC_SCRIPT_MESSAGES_FILE ]8 k! g) e: f! k4 |9 C3 b) `- L
then 8 O  A, }( O+ f( i8 @9 g0 \8 D
  until [ ! -f $EPIC_SCRIPT_MESSAGES_FILE ]
! Y" |' s4 p% O8 q* Q( L3 U  do
2 z3 r  X$ ^8 y) G5 o- w5 j/ Q- t    EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
; d, n9 E: D4 ?1 b0 W  c  done
$ X' f7 v/ t2 L! i6 c$ cfi3 Z$ V* p, E& T, A# w. Y
- C3 C6 A: P: Z
export EPIC_SCRIPT_MESSAGES_FILE2 s/ a" f7 n$ O" o: X/ \1 [, e
}$ E3 f7 i! s& V9 h
' m" N8 Y6 O* Z$ q' C6 d9 x

- ^" m* \4 k. f- M% ]/ {2 O% m3 r+ M0 vcmdname=`basename $0`
: G" B) w3 p3 tpostgres="n"
) ^1 E  [  ^4 L# ^* o. z4 U$ R' U  aostore="n"
1 g( y$ y) x# b, N7 M3 c4 y+ |gui="n"% E; }$ B- y4 j% m, T
databaseOn="n"7 v2 t) [- a3 u0 v6 w. |* `
f_next=0
7 J* S8 N* N- G: S, Z" t; `f_option=""! O' C$ n  C0 T: N, J
o_next=0. s$ ^$ P! y6 N; `# u3 O& [
o_option=""
4 X. _0 x7 Y" Q6 rworkDir=""
3 J% W6 {8 Q0 g/ p- n/ {% fworkDir_next=0
+ ~% g1 P) M! s+ _3 U% W8 F9 W7 k. terrFile="powrmill.err"! W2 g& _( p/ F- X: b, p
win32flags=""
. e$ K6 x1 T8 }: T$ Lln_default="ln -s"
) [1 N$ R0 a# U( v1 g" r3 h# @% T1 _. |
har_hilo_file=""
; U6 X( g) {- Y" k1 `& l, S4 Jhave_har_flag=0" y% L/ L2 B7 y/ w& L4 n7 m+ e
have_har_setup_flag=0
" k# V0 ?! `+ a! L% dis_special_har_run=0
) ]4 D) m9 f1 o. B5 e: Yhar_ofile_prefix=""
- ^% j5 a( O( e% Q: J* v: m+ E: ^+ J. Y5 N' X! W. _
have_va_flag=0
6 F5 m! j0 i" V+ \& |3 _have_vaf_flag=0: p8 n' E5 s( l' `  C
VAF_FILE=""1 y0 |: b& a2 P" ]" L
VA_FILE=""
/ G# G8 G$ U/ p+ N; c7 F# yARGV=""
5 N: |5 m$ r# W1 x3 }4 d+ Y9 ~
1 Q" f- {7 H0 y1 WORIGINAL_COMMAND_LINE=
- C' K( u2 J$ k& s4 l; L) D" V; kLOOP_CTRL_FILE=".ns_ba_env"
9 H0 w! t1 @) eALTER_HK_FILE=".alter_hkf"
8 r1 a; X4 ?5 B- V; |: [ALTER_COUNT_FILE=".alter_count"/ G. m9 r% R6 x2 g
MONTE_IMG_FILE=".monte_img_f"2 Z5 D% q* U" r) G8 B- r# z
MONTE_COUNT_FILE=".monte_count"; c% L' p% a% L( ]/ E" T2 y* M5 L" }
MONTE_CFG_FILE=".monte_cfg"! z/ h4 ]8 B3 Z1 a( t
EPIC_SCRIPT_MESSAGES_FILE=".epicscriptmessages"3 J; X3 F2 V; i4 _- _+ D
2 j" D$ y8 u% ?
open_epicscriptmessages $@0 M. [6 z& n% ~

. B( f9 o& `' y+ b, [3 k2 Hscan_for_hva_args $@" C8 ]3 Q3 {# l( c1 y. e2 J

5 d+ Y1 H9 H5 @, xscan_for_har_args()
$ x* N. _) X) T1 @# t{
* p- r" Z0 B+ a0 }( K; n  while [ $# -gt 0 ]; do$ [8 }+ |8 f, F( {6 k- i8 D% `$ K
    case "$1" in
5 W% O9 X7 o9 `: v' O% n0 S2 X9 {      -har)' z8 g3 q" ^- R* F) f; @. V
           have_har_flag=1
' V6 G* g" X# E+ [$ e: t) t6 {           [ $# -gt 0 ] && shift/ v& h! b2 Y: K
           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then& i3 D. v& T8 h- U& ]
             har_hilo_file=$1" O! m" U, D2 q9 i! X7 c
             shift
" f6 j: t/ ?* G  G# m& r           fi
) f$ F) E4 X) G( |' M           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then2 `4 s6 {7 t; O
             echo "Too many arguments to -har flag. Only one hilo file allowed."% r' c1 I0 A  a# k
             exit 18 S2 d# s4 w) d3 t3 Y  d
           fi9 k7 X! [; p' m
           break* e; g* c- I. J* e" c% `  y
        ;;
( r) e8 r( U- ^" E4 u      -har_setup)& E) d( T; b& w
           have_har_setup_flag=1
! ]. `- n/ o) g( Q           break
+ {- n. \: X9 E/ |6 i        ;;
/ u) s) I1 {/ W& X      *)4 @1 R$ z+ U  ]- W5 G! _
        shift
; t, W- U2 _3 X1 C2 K6 T1 }        ;;
4 l1 s3 P8 c3 V0 y8 e; s8 Y    esac7 `0 D2 k* E8 ?0 \4 X2 ]- J% f
  done$ \# x7 ^$ F. g2 Z
}9 h4 Y5 z- P  N  a5 U- i
. t7 [0 f6 {2 j4 P7 Y
scan_for_har_args $@
6 h/ s! a/ X' B/ l% p
, C) s5 R0 w# n' ^, ]3 Pfor argv in $@5 E, @2 F" h0 @' X. [
do# V/ J8 V2 M1 g- Z3 s& E2 b6 p+ ?
   ORIGINAL_COMMAND_LINE="$ORIGINAL_COMMAND_LINE $argv"9 l) s1 [+ t/ Z+ a$ \) D
    if [ $argv = "-gadb" ]; then
" ^* |( i& ?! g- P& C2 C$ w4 {* w        databaseOn="y") S  D; ?5 l5 n6 i9 [9 t
        workDir_next=1
) c- c% s2 z: P    elif [ $workDir_next -eq 1 ]; then
7 }" U+ Q( H+ P1 |        workDir=$argv9 Q# J" Y1 v  D
        workDir_next=0
+ u4 Z$ O# W* W8 t    elif [ $argv = "-ga" ]; then
( l# K7 H* W4 x$ h        gui="y"6 H, @. U, V( \, k# }
    elif [ $argv = "-f" ]; then
  j6 S: i1 ^  b        f_next=1
6 o3 m8 M) h. i% j    elif [ $f_next -eq 1 ]; then
, @3 |7 Q  P3 B; L) P" U        f_option=$argv) y) @3 Q' v( _
        f_next=0
# G: e% v) O' X/ ]# Y  k3 u& e    elif [ $argv = "-o" ]; then
; h$ f5 A4 D& x; S: I, E        o_next=1
$ |( g/ f. J' G1 c/ K    elif [ $o_next -eq 1 ]; then: |' l5 h. i2 C5 |& U
        o_option=$argv
: `1 O6 h  i  \0 v7 m        o_next=0! _' q8 V; T+ B3 Y( @$ s
    fi
& |2 L* e6 X8 n7 {# k* L0 P9 u: g3 Ddone
, M: c& x& k" d$ cecho "Command line options: $ORIGINAL_COMMAND_LINE" >  $EPIC_SCRIPT_MESSAGES_FILE
8 p* A/ j8 n$ n- h( |. w8 ^+ ?* ?: V) V, W% N, U1 z1 {
if [ $databaseOn = "y" -o $gui = "y" ]; then
  q  @+ X! [7 q4 r+ Y4 s; ~2 G  if [ $cmdname = "pathmill" ]; then
. ^! w4 L- c0 _    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5"  -o "$EPIC_ARCH" = "SUN4_SUNOS_5_64" ]; then
, R& e' P& S% E" z: b: i         ostore="y"% m0 Y& G9 ?+ ^* |) a
         postgres="n"
0 ]# ?2 y4 Y0 o+ k( K" Z& Y     else. o8 }* T( f  Q3 ^' {% D4 d. ^
        echo "athmill GUI is supported on Solaris platforms only" 1>&2 ( |3 `/ W% d; O( X' M
        exit5 P* |5 V1 k0 M% C+ j
     fi
# D- F0 T$ S7 e5 I& J; H/ U2 H  else. R* j: ~1 U9 j
    postgres="y"
5 Y7 L' d, J' \( ^0 w         ostore="n"
! @* S2 `7 N! V$ [4 e" ~$ ]- o  fi
8 L8 n' ]5 H$ I' |fi
( p0 `) n( v8 r: s4 ~. I  s$ {* X3 A2 @& x
if [ $gui = "y" ]; then
" p( S6 o5 c% F3 u+ W6 U8 _* q4 o    if [ $cmdname = "powrmill" ]; then4 d7 x& M8 f  j; U& l* `% r
        pwga $@
; {& x; }7 t) Z( ]! |9 |        exit: @+ l- Z, e( z
    fi; N* J7 P0 Y7 U
& @7 g6 Y) A) R: }) Q& x- d
    if [ $cmdname = "pathmill" ]; then  j+ I* |6 S5 S# h
        if [ $ostore = "y" ]; then
5 ]# l5 }& }! E7 ^/ V; T6 c* ]8 s           ./pathfinder $@* d/ y+ t! ]0 ], ^
           exit7 d% Z0 ?) x* \
        elif [ $postgres = "y" ]; then
2 W" j+ \  d* s# U% E/ Y           pmga $@
% T3 m" r# z; D+ F$ S8 [; y# V& D           exit
/ ^; ~0 a( I/ ^1 ?* `        fi; S9 I" Y: ?( j8 S
    fi5 @' ]* \2 ]1 ~6 g6 t' N6 u( p( |: N8 G
fi& o0 [) w& C4 S2 N- M  P
3 s) q0 D4 ?3 r4 Y
if [ $databaseOn = "y" ]; then
" p3 r- M% x5 B* S7 n/ e3 U   if [ $ostore = "y" ]; then: g# n" b$ U) l1 G) y6 C, `
      if [ -z "$workDir" ]; then
$ N4 c3 h$ k( P8 s         echo "Error: Missing argument for -gadb option"
% |: c$ ^! g3 N6 h& T# q         Exit 10 S% H  @3 f$ T
      fi  H% _: E1 N3 a7 b
   fi
5 u2 W6 e0 A( q* A0 E; \# t   if [ $postgres = "y" ]; then
. U0 S7 f( _* x1 |3 G3 @7 U) ~      if [ -z "$workDir" ]; then
$ |' N% o2 ?2 `! v. {, f         echo "Error: Missing argument for -gadb option"
7 q. g9 f6 e2 j5 ~0 m  [8 c         Exit 18 X9 u3 t/ A% @: v4 z% U+ B; a
      fi
7 _- R3 v; X  }* y6 k9 p" i   fi
9 J7 p2 V1 d4 w8 \7 bfi
1 a5 j% k0 @1 w6 G0 \6 h# K: @5 Z
4 {$ P; w  ]. L' X4 Nif [ $postgres = "y" ]; then8 Y  D1 ]  y8 P

  W2 J/ T8 ]0 Z    if [ -r $EPIC_BIN/scripts/gui-init ]; then
- V8 Y* _7 s. g        . $EPIC_BIN/scripts/gui-init
5 ~, B. ]) e$ k$ D8 H5 _    elif [ -r $SES_ROOT/bin/scripts/gui-init ]; then6 ]$ N' M7 W7 H/ H. C+ @# P
        . $SES_ROOT/bin/scripts/gui-init4 g  a; T% J3 V7 n# h6 |
    else
/ J- @3 G: g9 T- ]% z' i; _        echo " ** Installation in \"$EPIC_HOME\" has been corrupted!" 1>&2
% o. p' }- v+ |: X. S! c! K, B( `9 u        echo " file bin/scripts/gui-init is missing." 1>&2
: a% x: g& u! l9 ^' d' P    fi
% o. E; a& \  ^* i& D
' _/ @! T( x# ~# n$ N8 v# J    workfile -tool $cmdname $@' K1 g* [7 h! m0 y$ \9 a
fi8 C9 Z4 G- v" E% m' F# Z) }
; ]: X% [8 H8 k. v$ k
if [ ! -z "$o_option" ]; then/ t9 h0 A3 g2 g2 Y3 D
    errFile=${o_option}.err
/ n: G& z& I+ Relif [ ! -z "$f_option" ]; then
$ J! _) g9 @. W7 H    if [ -d $f_option ]; then
$ g' [# \6 L2 y0 }6 v        errFile=${f_option}/powrmill.err
" R; t8 [- }; P" H/ S* O5 r    else errFile=${f_option}.err+ L  V" g5 y* E+ x
    fi4 \2 e" l$ B; n5 W$ T( P- p; F
fi! v. j% v+ e2 Y  `5 q

' f+ ], Y5 [1 q0 u' E& q
7 F/ I& O/ q$ c( m5 Nif [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then/ X) i! I2 [7 ?: O
  rundir=.epicrun3 o! ^1 ^* \% K2 f( `$ J
else
# C2 u, X! Q. m/ V9 T$ B  rundir=.epicrun$$
9 B8 U: `/ o: N! P; N9 }fi
- ~$ Z2 w; M: V  g
( y$ l( [* v% ~/ z1 D2 a5 U8 i5 C# plibpath="$rundir${EPIC_DLIM}$EPIC_DIR"
9 Q- y+ z% i( n% s! Y2 r. [$ S7 o
cwd=`pwd -P`
( X, p6 S1 x9 {! Y3 x9 T& M6 Zif [ $cmdname = "acehdl_w" ]; then
6 H% {5 t6 u; e0 }  cmd=`basename $0 .sun`
$ f6 m' ]' Q9 d" o  cmd=`basename $cmd _w`
# l  U" e( Z- o# [else
7 k  s1 d6 y  l# e0 r( {  cmd=`basename $0 .sun`
+ E/ j" z9 H) t) k/ L6 g3 Afi' z# M0 |6 [3 D0 S) ?+ g- v

  S5 e& Q8 u9 B( H! U2 Wcommand="$EPIC_EXEC/$cmd$EPIC_EXEX"
; m9 Y; e$ l+ A0 M/ l3 I[ ! -x "$command" ] && echo "$cmd: not installed!" 1>&2 && exit 1) y! q6 g) u1 q5 b
. Y9 h- Z, x  p* H' A/ p4 \
# buildmod extracts -u/-fm options and calls genepiclib
4 y+ j+ @) K" ]- U# It also set the remaining options to variable CMDLINE& s. w7 P% E! c. |9 F
# look up in .epicrc for -fm & -FM parameters
# h* v4 _, x; a- D5 `
+ w1 ^0 K9 s, i) qfmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`"' k& ?" w( O$ S0 J* v
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`"
5 t+ Y% R; O/ J. @[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`"/ U: e8 L1 m! ~

7 S$ ^9 m$ T# t4 z, b; y% eFMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`"; U1 ]- H5 f+ ?- ?7 d( y& k7 ]! A/ Y
[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`"
! F! y( d3 k1 l1 g& \& |  h" w[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`"0 l+ Y; L; |  p1 ^# T
: n8 c# E! f: _! ~) v, ?
if [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then' ?# ], O1 N  s+ a/ ]* Y
    # note that the buildmod script will set the CMDLINE variable8 ?" @1 k- L4 |# F! h6 o
    . $EPIC_BIN/scripts/buildmod
" P9 I& B2 }  d- f
+ ?; q& O# E& a* ^6 H    #echo "This is the value of cmdline=$CMDLINE"9 o3 J& w( i/ b. p' w
    #exit 05 q$ G; p* D& l7 V" y3 r& _7 K" Z

( V# u, S( O* t1 i: o    # if a new timemill/powrmill/pathmill built, run the new one2 M2 T6 q- ~& U6 n; X
    [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX"! A, O9 Q& X1 }
fi  J) e3 a% c) B% ]
" M" v  G: F$ b# x
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then' Z# ^5 A7 x- _. `+ K
  if [ $have_har_flag -eq 1 ]; then2 `& ?- c1 f0 X
    is_special_har_run=14 k6 E: n7 u/ ~: p* y
    if [ "$o_option" = "" ]; then
" t  v& K6 U' b      case $cmd in" W: W% q8 f& k" k1 Q' Q/ r# N6 c: a
        timemill)
( {3 L4 c0 v" r( M          har_ofile_prefix=timemill6 o9 \) [: i. u8 T. `7 m4 y
          ;;+ I+ K; p6 w' k0 m( w# C
        powrmill)5 N  b/ ~' ?3 }7 G) R2 F
          har_ofile_prefix=powrmill% E- Y8 K' E+ p7 Y' Z) {/ e/ q
          ;;
, H% E7 j0 Q% k, u, s' i( S( N        nanosim)# N: z0 p# K4 Z; q9 ]2 d: Q6 h0 a; L" E
          har_ofile_prefix=nanosim: W- l3 v' s  u- L9 b  _* g  m
          ;;
) i. o( c2 [/ O2 P( x      esac5 M/ m9 Y6 h7 F& T% L, K3 I
    else
" s' P) r: G# {- t5 n. M      har_ofile_prefix=$o_option
/ E0 [  W5 z. W    fi
! J) ~* \2 x: m5 L fi. h9 ]( U) a* H1 k& Q& |0 ]
fi
1 M. ^) {" [% o/ T0 F4 r) f, V2 d% v/ ~3 |
# Call Double precision version of the product if -D# ~4 g( l6 h) h7 h
# or simulation time > 1,000,000 ns." ]4 X" b4 D7 w6 _8 i0 e- k/ m
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then
% f7 z4 g( {: w3 c" x1 U" e; k' S7 Z8 i$ F% `0 Q
  # Now the binary always has the ACE feature5 ^  Z$ A! S* T# n; M5 ^
  USE_ACE=YES
! o: I1 C/ E0 L1 L: u& I( h
% R. l" A' n  ~6 ]  HAVE_DP=NO* b9 A, x: E% o& p9 x: ]
  EXTRA_CAPACITY=NO) J; q8 [5 _, _0 i" V6 p! G# P$ r8 c6 O
  DB_REAL=${FORCE_DB_REAL:-"0"}
" |! b- D# G$ K$ y2 N$ C' B/ h3 D$ H- I, |$ m' U5 O* o
  # Enhance for ACE ease of use) L& `  w& J6 ]8 W" r1 Q
  # If no command line option or only a -T option, do:6 x+ v* f% f8 M6 e" D
  #   1. set -A option
+ _  ^( p! a3 u; s1 s- H  #   2. assume input file to be hspice
$ Z5 y" }2 R, e0 O) c2 A  #   3. set -o to input file prefix
4 L% d" z5 Q6 M& N5 I+ _/ G  \  #   4. set -z to input file prefix' V- \, l' s. V6 Q; f
  #   5. set -c to default config file
' X$ W" a1 ~( A3 m2 p: J. V  netlist=""8 {; |" Y+ O5 U; f. u
  minusT=NO- J6 t# B: K- Y3 c2 b
  useStdCmdOpt=0( e# m9 i- `6 g3 I( V5 |8 F
  prefix=""" g9 J# y: p. F( n  k
  circuitType=""
  |# s, D! t; V( F  for opt in $CMDLINE
6 ]. b* @" E1 m8 a- b0 C% G) e  do/ @% I/ C+ s0 c8 D( Z; v* M+ h
    case "$opt" in
9 F3 j: A( Y' F% p$ P, a- L# {      -T)' D9 ]0 g0 l( G# Z: A$ J
        minusT=YES
, Q0 {6 C3 X1 K8 b0 k        ;;
" M9 q0 ^7 s0 G; A7 K      -*)  ]$ S! {1 S" f9 h8 a- z  U9 U
        # using standard powrmill command line
& w9 ~+ U( D; X: u6 f; o        useStdCmdOpt=1! L2 G/ p7 G* F  l) h: u
        break
# @, F+ f+ W- L, o        ;;
# ?% n; f2 I  s/ @      *)
" h& b2 J" S2 C1 z- Y* P" t" D       if [ "$minusT" = "YES" ]; then4 D' y# F, @4 j7 M1 I: v
         circuitType=$opt
2 u: o0 e1 j; U7 P8 W  J         minusT=NO  # reset flag4 U6 l- E$ ?' r$ b8 {  i
       else 3 j1 F* U8 _2 F$ W# g8 T
         if [ "$netlist" = "" ]; then
) u) t0 a" S, q( f" s- e9 h9 o6 K( m           prefix=`basename $opt`
4 {! u' f- m- y1 ^; X; P+ H           prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix`/ u+ _1 F' @* y, {
         fi( M- a( c: M0 o3 T  \3 y/ S8 U
         netlist="$netlist $opt"
: C; a$ n- V3 p+ L- q       fi
. l1 t- _9 {+ g       ;;2 P, A# |- ]1 R: B0 ^9 U2 f
    esac$ }7 a* e; [. C: v
  done
* r6 f# r% F0 O2 Z# w7 ]( @
" j( g; r- E6 }  v! h( g8 [, Q
  U3 @; S6 }- R. b7 t  if [ $useStdCmdOpt -eq 1 ]; then: C% m; D6 G# ]) l" v# G8 A
    # use standard powrmill/timemill command option
0 c( y/ w0 z7 v  k* P( }" A    for opt in $CMDLINE
; R, I5 q/ B7 g' i3 R; N# E8 s. o    do% ?/ \2 c1 t  [( S
      case "$opt" in * n2 v8 m7 |1 {- O1 l* a
        -A)
  |7 G  I2 Q' i9 P% x9 W( L            DB_REAL=1
2 V8 e2 J( R. |            ;;
6 Z- u7 G9 [  |: P) l. J# B      esac! P. s+ n' X; ~- B7 R3 a/ l
    done6 n2 g# \7 T+ m7 S% F
    if [ "$netlist" != "" ]; then) q  Y  ?5 g6 p0 D8 m9 ~$ H! z7 O
      CMDLINE="-nspice $CMDLINE"
4 Y2 |; K' e3 \6 H9 n    fi! n3 _$ H8 ~' `! S
  else
2 U+ B% f. N' z4 p$ A    if [ "$netlist" != "" ]; then
7 O1 v9 H2 B1 Y, d* y5 V. O      EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"}
$ L5 y+ U( {* I" p* w3 `4 `: U      # construct new command option
  d6 b( y1 H, a6 v" I7 ^& ^      if [ -f $cmd.ini  -a  "$circuitType" = "" ]; then8 s4 j- r: \; t; L
        CMDLINE="-nspice $cmd.ini $netlist"
& d2 q& ^8 N8 B      else  B9 @& e0 s+ p& O  z
        if [ "$circuitType" = "" ]; then
; ?7 l5 B' v( G  P% k" t3 W  I$ `/ \3 Z          circuitType="msana"
4 e7 n( a- ]9 w% }        fi$ n7 T2 L( T+ d1 E
        CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg"
# q. u% o( Y1 o9 R  I      fi6 L" M" S! x/ P+ Y9 ~8 `
      CMDLINE="$CMDLINE -A -o $prefix"
) y+ X7 U* c* }5 f7 y" c+ j      DB_REAL=1
7 t! l6 D0 W4 H8 B: `+ W; e      echo $cmd $CMDLINE
9 }/ L5 b1 F% f4 S    fi
0 c; C: a3 B% J, F9 `3 }( F+ v" W  fi
, V& I" c- q5 l) J  hfi # cmd is timemill or powrmill or nanosim or railmill or pwarc
' z, G8 m: w) K7 s
0 @9 ^; I1 M' }; R2 A+ f6 [5 {8 r[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a"* o6 A" \: n2 p" v
[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a"1 f7 A, Q* Q! ]4 r. H
[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v"" z  [/ x$ b8 o4 N( B+ k
( g  R6 M& y9 m. v5 n
if [ "$__engine_wrapper_called__" != "Indeed" ]; then
1 N# y' g4 _( X) \  V& U& e$ S    __engine_wrapper_called__=Indeed
, D* I( r7 f$ _: h# U! G1 N+ R    if [ "$cmd" != "amps" ]; then
7 m1 G9 c8 X$ y* J) t( i! k, s        export __engine_wrapper_called__
5 o& Y+ M. |* W+ j$ v    fi
2 H$ c9 p$ ^' t, Z
. B+ U9 L4 d- }9 c    trap "cleanup" 0
. t0 \( `$ E0 e% Q    trap "" 2
; o! b0 D5 K# X0 [1 ^2 V" L6 c. W: T0 o" @' V+ R" g% c; r
    [ -d "$rundir" ] && rm -fr $rundir4 Y1 C& A( t; Z* h3 _
    [ -d "$rundir" ] || mkdir $rundir
1 Z7 s. a: X6 E' O! L
. t) o- D4 k8 e" Q2 e! _  r    case "$EPIC_ARCH" in
9 R0 l7 i: R/ r$ t; S    *SUN*64)   ; p: i% O$ u# G; [' c* S1 ]
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH". F6 l: `: k4 h) Y$ d2 Z0 ~
        export LD_LIBRARY_PATH
! ?+ E, X- b2 `" Q% Q  `4 H8 {        suffix=.so5 ^) A4 i. ~% q8 t( z6 U
        ld_err_code=1277 u) [& o4 v! g, G6 Y2 G3 Y
        ;;
% b8 c( c2 P. Y0 o    *SUN*4)   ! R1 q! W5 `& J: z  q# r7 F$ p
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"  U9 ^$ [- x4 Y! ]( B& h
        export LD_LIBRARY_PATH: n. C" e9 g7 P( a
        suffix=.so.1.0
  n' f; X& K0 L" j$ e1 \6 A, r        ld_err_code=127# q9 m5 Z8 [) z9 }' u/ P8 }$ s# J
        ;;/ _4 R4 C! L" T; T
    *SUN*5)   
2 E/ w! c4 x. {& g        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"9 U& {$ W2 i$ O6 T, o1 b
        export LD_LIBRARY_PATH
( W6 ~5 q: `4 k1 [8 T        suffix=.so  Z$ n8 ?0 [! K: U, G* G
        ld_err_code=127
% v/ L8 f* c* w  S  v' a1 h; c) c        ;;
2 i: r' C& e& t    x86sol*)   ! G* y1 O$ P+ P/ l
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
7 j  H; y% L% i1 L" [% t" o; W        export LD_LIBRARY_PATH
. w$ b9 n: u5 }& o        suffix=.so
  i% v# }4 m: S) M7 }+ S" c; {! o        ld_err_code=127" r: |5 x7 W$ P+ A0 ^$ ^
        ;;
  e* Q+ v- ~0 I) B: D/ u5 J, U! E$ O    *AIX* | aix64)   ) L. m0 B# T  w
        # When genepiclib creates shared objects, it creates a import file and # }" o* Z7 i/ w% F. C3 j
        # uses timemill as program. So at exec time,program timemill is needed
8 U; l9 {3 L* j2 T        # in LIBPATH
; g# X3 Q7 K# x        $ln_default $command $rundir/foomill
0 }0 a# `3 ~# y/ s        LIBPATH="$libpathLIBPATH:/lib:/usr/lib") l7 _1 N: K/ I: j) d
        export LIBPATH2 f% l5 q7 q1 e/ ]4 I
        suffix=.o
2 W$ O: x: \+ r9 h# F" g        ld_err_code=8& h* X" S4 u) k# a6 v/ N: j: u
        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then! N( z3 N- Y/ Z
          tdir=`echo "/tmp/d"$$`# d% S. u" H: K7 Q
          [ -d "$tdir" ] || mkdir $tdir
1 M( R$ ]% g1 m# K. I          if [ -f $EPIC_DIR/libCustom.o ]; then
) g( f0 T7 a/ g3 |% I4 ]             cp $EPIC_DIR/libCustom.o $tdir/: m% i! I9 ~/ Y; \
             $ln_default $tdir/libCustom.o $rundir/% X1 n4 k! f4 j; ]' D
          fi) |9 Z3 |; c6 k% Q4 @
          if [ -f $EPIC_DIR/libModel.o ]; then5 `  H5 K0 Z# h! ?# H/ a
             cp $EPIC_DIR/libModel.o $tdir/
4 T( p& m; l0 c; [; N. y, ?# t             $ln_default $tdir/libModel.o $rundir/# O" c* h. s  x( m2 c4 V
          fi
( R3 v' n# D3 }$ p: W; s: j% g          if [ -f $EPIC_DIR/libFuncModel.o ]; then1 d7 e1 h: T% O5 l( m
             cp $EPIC_DIR/libFuncModel.o $tdir/1 Q# _; [5 f. \: r
             $ln_default $tdir/libFuncModel.o $rundir/
" E* r3 ~$ r" a& ^# [$ o, l; y) d          fi  a; }& ~( X+ Q9 @- y
          if [ -f $EPIC_DIR/libFuncModel.34.o ]; then
; n( M- b6 i: V) r3 k/ X             cp $EPIC_DIR/libFuncModel.34.o $tdir/) |+ y3 {' }0 R
             $ln_default $tdir/libFuncModel.34.o $rundir/
: u9 E. n$ N1 c- |6 N, I: Z          fi5 V; b: S4 y, H5 u
        fi0 n: f9 C( f" ~) y
        #Set the IBM flag to enable more shared segids
1 B* C, D  j7 ^5 C2 G. G        EXTSHM="ON"( Z9 r2 A. ]  J# E: F  K
        export EXTSHM+ k: q6 x' R$ O/ a+ Y; t
        ;;# M5 \8 ?6 P3 R+ X) ~, N4 q2 X
    *LINUX*)    # Z1 U7 S/ p6 d/ E# Q! D# J% R' P
        suffix=.so
% G) @9 d7 i# ~' @2 S        ld_err_code=1
# f3 x# t; S+ ~6 p! ]( V        ;;4 B8 s3 |% I! _+ H- M
    *amd64*)
! `& g& G& _+ F9 {        suffix=.so
: W+ q% t# a6 f8 y) d+ n& v        ld_err_code=10 B, ^% Y/ \0 v1 b
        ;;
1 B% {4 t9 ]2 l& y0 \7 x7 e' P- Y    *suse64*)5 `9 i! l1 R% L4 I: a" Y! L3 C
        suffix=.so
1 ^+ U: `9 D$ w  W# c' v        ld_err_code=1
4 D, p5 z5 s8 m% `        ;;
; z& |9 z4 J( X3 h% I* J    *suse32*)    2 Z6 v7 L6 O1 g
        suffix=.so$ B+ I, ~9 D* u. G3 b
        ld_err_code=17 h: ?- ^/ X% U8 ]# R9 {* C
        ;;
6 a% ]/ s1 D3 b) s* |7 n    esac9 @' z$ P) m, q

0 }5 J1 E% O# ^    [ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix"
* I0 V2 W) ?5 Z5 I( a% A$ j8 k    [ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \+ w) u- L& a' p6 {, n/ u
        && [ "$cmdname" != "nanosim" ] \( I+ T$ o0 m7 p( |7 |, @, o( W
        && [ "$has_model" = "YES" ]  && ulib="$ulib $cwd/libModel$suffix": m: w/ @3 C- q( B- F" N; [
    [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix"# |" ?7 W# k: m6 z/ f* z, E

+ S" c5 k6 [+ M2 N8 u. \! z* y#Look for command line option for libFuncModel.so5 _/ I( n8 ^: I" M; V0 b7 p
#    user_library_next=0
2 n) P) @6 Z6 O2 x    has_fmlib=""$ d+ p* O/ L) ]8 f  O  G
    for opt in $CMDLINE
7 T+ {, U9 C- ~) w    do3 H% H% f9 R! R$ o
      case "$opt" in
0 o2 Z9 q. L' l, T        -fm)# }, m. k% B: L- N! C- P) i8 N$ O( V
            CMDLINE="$CMDLINE $cwd/libModel$suffix"
$ m3 R' }* H! @! G% {( R            ;;
9 h3 U' ^- P+ i* s" R7 P* X! a        -fm_user_lib)
( E( ]5 X, Q+ L/ Z6 R- L8 F5 W# T% ?            has_fmlib="YES"* h0 L- X; G; u$ e! T. ?
#            user_library_next=1
: ?7 Y! x9 ~) C2 H4 Y- |( F* h7 I; o            ;;' ~) R7 _+ p6 J6 |8 z
        -xc) ! b: f( V. Q9 f. X! C
            if [ "$EXTRA_CAPACITY" = "NO" ]; then% E) D( t% y1 T' P% A
            EXTRA_CAPACITY=YES& z# P1 _7 }: t2 a  _8 R9 F
            fi
* k3 T9 i. n# K            ;;1 m6 J, d  e3 }7 M* c4 N) g
#        *)# F4 M' Q- o8 G5 @7 F6 `
#            if [ $user_library_next -eq 1 ]; then
9 B( T8 K% q' b+ b0 X#                if [ -f "$opt" ]; then
8 X! f. z0 ^# f$ A( c# d' N#                    libfmodel=$opt
* o: z2 U$ J7 ]9 C5 m8 q/ M& a* P' S% ?#                else  [3 Q# F6 Q0 S9 ~
#                    echo "-fm_user_lib: Specified file not found"
2 W# r& r% h' G; i- P; S#                    echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages6 V1 t) R: }& W
#                fi
! ^* c6 n9 p  j, B0 {#                user_library_next=0* X) b1 i" h* p8 o* x
#            fi
0 C( T2 v- k+ q% v  [# z4 i+ r#            ;;
7 f; n, O! C" c/ k        esac6 H0 e$ {: F3 O1 H4 m
    done
. h' G2 o+ N' y- Q& N: v
1 |; T& Y9 j1 @, Y    if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then# }, W/ H  @- k7 s# f
        flib=""8 y' }0 ^4 b5 C  R! Z- @8 v
        if [ "$has_fmlib" = "" ]; then
+ m4 Y9 \) t$ F: }& a1 M( x( R( i            flib="$flib `get_epicrc ./.epicrc user_libraries`"8 a7 K' J# e. v" A2 u" R  @/ ?
            flib="$flib `get_epicrc $HOME/.epicrc user_libraries`"; }; N5 r% }/ P) K" D! N+ ]
            flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`": `  T1 r0 X- Y2 ]. e9 Z
        fi
0 d9 o: |$ g4 h( f6 ^6 d+ E& j    fi; V9 d; x( c3 w' F# J- X

4 _! E* z, }: Z' L   for i in $ulib
& \7 Z: u( H/ K$ h+ |/ T8 z/ D! J   do* c9 g5 {) ~7 `: c5 e2 H! k$ F+ I3 D
       [ ! -f "$i" ] && continue. p+ i9 X: D, \5 y7 B
       dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd; o4 B) W* U! L* Q" G6 z
       i="$dir/`basename $i`"
( V5 F1 G7 A3 k" ]1 U3 J; g       case "$i" in
3 x- Q& G# ~, W       *libCustom$suffix*)    [ "$libcustom" = "" ] && libcustom=$i;;
% p, u, F% m7 L1 \/ ^( J7 ^3 m       *libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;;
, D! T3 A. B" `5 {       *libModel$suffix*)     [ "$libmodel"  = "" ] && libmodel=$i;;+ \* x" n, l: d7 v# {5 H
       *libva$suffix)         [ "$libva"     = "" ] && libva=$i;;3 y  T5 q) M  ?6 k0 z& l% j  k3 p
       esac
3 [0 M$ f7 r, }" Y6 Q       [ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \
7 F; l4 `! u4 W# B: z        && break* @) o+ }2 ]: ]1 a4 }
   done
! p, O- u) y) n6 E7 w  z% `- |2 l3 A& P* }4 p3 i. y
   # symbolic link shared libraries to .epicrun$$# X1 S( f$ D, U  I
    cd $EPIC_DIR; epicdir=`pwd`; cd $cwd
% r) F) K) m6 H% _+ R- S    if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then
/ B5 e+ E0 w' N        if [ "$libfmodel" != "" ]; then  n: c* b( D6 h, l) N/ o3 h) K
             [ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \
% V1 B% T. x4 f" y& A& w% n             echo "Using $libfmodel ..."  && \
( O$ u2 f6 ]" Z( w1 v2 S8 R             echo "Using $libfmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE
0 h% y& h$ I1 Q+ K9 R. I8 `/ j4 o             if [ -f $rundir/libFuncModel$suffix ]; then2 E# Y5 _6 e. x: B. i
               rm $rundir/libFuncModel$suffix) S# w! ?1 x, |2 C, _( z
             fi6 o8 a: c7 Z8 Z* E
             $ln_default $libfmodel $rundir
; p: k) E. I# r, V- ?& g2 H  _% l        fi
7 f5 s  \7 {5 ^! y        if [ "$libmodel" != "" ]; then
9 D7 f3 l1 z% k% W5 C9 e             [ "$libmodel" != "$epicdir/libModel$suffix" ] && \) N& v6 X. d8 _* F
             echo "Using $libmodel ..." && \
% t- ^/ b7 D" E             echo "Using $libmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE- i- O4 b. ~. X) @& W; M' H9 |
             if [ -f $rundir/libModel$suffix ]; then
$ m- k$ _* X. m               rm $rundir/libModel$suffix0 i" j0 t# @& e8 N: ~9 H1 N) X5 \8 p; {
             fi
- K( P# \5 s7 Q# A. k             $ln_default $libmodel $rundir 7 Q, L5 s0 ~3 a' z& H
        fi
0 I& _8 E8 `$ a: k; i6 W4 A   fi
  ~" l8 h% ~" M8 Z4 D% q& d# Q: a2 K   if [ "$libcustom" != "" ]; then
- I# f; Q- p' D( e/ X# ?        [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \
, t( g9 y: }9 L& @9 M        echo "Using $libcustom ..."6 u& U( k, J$ V3 M. I) c( X$ Q0 X
        if [ -f $rundir/libCustom$suffix ]; then: w6 V5 n# Y# T! T3 E
          rm $rundir/libCustom$suffix
2 }7 x& Y8 N! X- l5 {9 q  k0 [/ ]        fi. M6 p2 u  W- X6 L7 F" @
        $ln_default $libcustom $rundir 1 C& w6 S: o7 _3 I
   fi
+ g0 g, h/ Q& ^
2 K- Z, ?$ S& s+ t. l. N   if [ "$flib" != "" -a "$flib" != "   " ]; then
: Q  h& Z  A% R9 K0 U        CMDLINE="$CMDLINE -fm_user_lib $flib"3 ]9 b: q) Z% G7 a  ]1 @8 s
   fi  @: E3 C0 f9 g

1 q. D4 Q" J2 A2 D4 e   if [ "$libva" != "" ]; then! `* U1 x; J$ I+ [
        if [ -f $rundir/libva$suffix ]; then
) a5 r0 k# s1 G8 ]9 B1 n5 |/ D/ ^! _          rm $rundir/libva$suffix
. t% e4 d9 u! ^3 N* y        fi
& v, v  p& r9 E1 M  Q% f( _( f8 p        $ln_default $libva $rundir
7 H) v# q( i+ l' |   fi
5 N; ^$ p2 c9 m0 J6 `! X# z8 z7 _! P3 \* O  y2 m/ U8 S
# C, G. |2 y. `% E3 e/ F6 K: x
    # VCORE design library4 Y( B7 F/ ^0 N# F
    if [ "$vlog_design" != "" ]; then# z) ^5 j6 Q7 `6 j& @9 [* P4 b
        $ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`
6 Y7 m* v  ~9 r$ f, O* Z! i/ j    fi7 _5 J, s$ z) a  ]0 e  o

7 z0 y( `- n9 I8 U' {9 ^" j# c    if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then
) g- F+ O0 }- T3 o; D$ K1 U" l3 K        EXTRA_CAPACITY=YES
! f/ O% V, I& w    fi2 I3 c# W, W: ?+ d. v/ u7 q
& M- y# t+ V2 u& \/ p. k
    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc"  I) G6 H: k8 k6 ?- }1 }7 q
    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc"6 e0 v- U, s6 @! b1 T
    #Create temp file if dual process is on
3 r* N/ ?0 D: {7 R$ E# P1 M    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then
/ B$ ]6 w4 A: d        if [ "$EXTRA_CAPACITY" = "YES" ]; then
5 R( f5 X' L6 Z            touch $rundir/rpcidfile
5 x3 {2 ?# t; u        fi
' p! _* d, Y# h2 u. p: a    fi
* R/ Z& j  {7 s: }, c5 Y& Yfi
4 E0 H7 G+ k/ V( w9 z
- t9 U- y! s7 E+ u% B5 R2 l( Jrun_cmd()
" h( H, b2 N: H( a{" l- f% e" G, e( Z5 y/ N
  command=$1
  ^% R. V' P) P5 O5 Y2 a  shift
; G8 g0 o7 l* Q3 z$ w: u1 e$ p) ?8 I0 ?! E2 Y: N' N5 L
  if [ x"$VA_FILE" != x"" ] ; then+ W! \+ C$ W# m2 O2 p' ~
     cmdline=$ARGV
$ c2 h- t$ k: s2 a6 q: o7 `  else
5 t1 a/ w1 \* ~- j     cmdline=$@* R% K+ y- Q/ z1 W7 _" _
  fi
3 l8 O6 A; z. D  H
8 @6 s; @/ [+ N8 r1 ~1 }0 V8 G6 b  debug=${DEBUGGER:+"$DEBUGGER $command"};
' L% G7 z) N5 S8 E+ E
, k, a- E0 i0 o: D/ T* N  # To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a2 a8 l) W6 Q. b! i. O
  # so save-restore may work." E: |  i, y4 \2 X+ h* r9 J; o+ n
  setarchStr=7 J( h8 [: P3 |3 x: F
  cmd2run=`basename $command`1 D! \$ r2 _, \  H( R' Q6 e
  if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then
: S# J) f& C) n/ F, L% q1 e0 ~0 q    if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then
" P2 p' O4 w( h* _) r! Z      setarchStr="setarch i386 -R "% W, v0 j  Y& E2 V& I0 |+ K
    fi
) Z: `& d# U* X- A) K    if [ "$EPIC_ARCH" = "linux" ]; then: R1 G% U3 w1 m) [" G5 L: n
      setarchStr="setarch i386 -R "
2 L1 y1 t7 f0 M- X    fi
, z* a, G$ j3 x4 r& `& w    if [ "$EPIC_ARCH" = "amd64" ]; then: U4 R7 q; U! M* Y
      setarchStr="setarch i686 -R "' X4 C  P) X4 ^8 A
    fi8 [1 s& w. c6 x" K4 Z4 U# W
    if [ "$EPIC_ARCH" = "suse32" ]; then
& ?7 [  z! F6 T! |' J  x2 U      setarchStr="setarch_suse i386 -R "7 f, [- I  W% x5 q6 D2 V- R! h
    fi
+ S) X/ r* L6 s- w1 V    if [ "$EPIC_ARCH" = "suse64" ]; then
0 E2 t( y, Y" _- M      setarchStr="setarch_suse i686 -R "& y' @9 p. Y" L7 T
    fi
  h  ]3 Y% i1 z% P  Y6 {  fi( }% \$ [( D2 z2 o9 Y4 J& l; E

4 y! S2 V6 }" [- i% z9 e( I& Y, i  ret_stat=0
# j9 C4 f# c4 X  if [ -x "$command" ]; then* R  t5 D) p4 n, y
      if [ "$debug" ]; then5 K2 |  ~6 {; f
        _debug_args_=$cmdline
, J, ~8 a8 F. s6 n2 Q- r5 D        . .epic-debug, g, V6 Z2 }: S: S. g, }
      else
3 k4 z0 Q& U" b. ~9 q        DEBUGGER=; export DEBUGGER. K' D2 {3 s  V& s
        $setarchStr $command $cmdline
; x4 E& z4 t4 c! |" K& M      fi
# O0 H1 `1 c: {& J      ret_stat=$?
- r8 l, l6 k: B. R0 Y  else
' a: w$ I8 _: w5 M* M1 L    echo "Corrupt installation, executable \"$1\" not found!"/ a3 p: l% h. V& r* p7 m9 u
    ret_stat=1
2 W) N) m7 i% C5 p8 f  fi. R3 i, Q& }4 i
}" F, A* I- _" g& B* S+ v& l7 {
8 x8 V; T8 r! J! [
# keep runing cmd if ctrl file exist
0 [0 i: O5 y; B* Y: N4 ?# O) l- f( D# N
run_loop()9 q. V* i6 I$ t2 {, y3 P
{
4 v( J) j& K, M" E1 `0 F  command=$1" t( @8 z! b$ ?  \# g8 A
  shift
4 i; b! D1 `' }$ e! a6 J4 O5 R1 m
  if [ x"$VA_FILE" != x"" ] ; then
' P4 |$ _: R4 n- v( f5 Q     cmdline=$ARGV
- q4 V: }* ~, N; \/ w& T  else! d* H# X; [2 x6 W) y. o" I
     cmdline=$@
" J; K! `* Y. u/ e" y; A+ x8 _  fi, J5 G- L$ F# Z% W/ _, b7 T
! P! }- A% q  `8 ~* d
  while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do
4 o) j) r! ]; J$ M  p- f6 S" j8 Z; d    . $LOOP_CTRL_FILE$$
; N1 X0 g7 u. o    run_cmd $command $cmdline -banner 2
3 o8 X- O) Y8 ~2 N7 b  done;. Y3 O9 i( k, w' U0 e5 x2 Y

7 D  z: k- Y! r' t  if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then
3 o9 w0 j- T1 M7 ^    rm -f $LOOP_CTRL_FILE$$
6 i. L- P( [( I. o  fi
# }5 u, S0 N3 [}
# Z$ Q4 S1 M5 f2 B4 U% u5 w
8 q$ Y  y5 ?7 y" b3 w4 E: `8 Thar_check_ret_stat()
& A; L! m% h, ~0 T* R  m{  l4 T) h, Q8 E+ l7 J! U: f( Y
  if [ $ret_stat -ne 0 ]; then
& j. [6 R0 ?% O% [    echo "Simulator returned with non-zero exit status. Stopping."
: T$ `8 U! C# a    exit 1
8 K2 d% M" e  c! _' x  fi; o8 z+ Q/ x: A; u) S
}
! e2 k  v( U7 ~2 ~& ?
' t3 X- d2 G# p. e#8 d$ b" Q% n0 e! p5 z
# set stacksize and datasize limit4 f; I. \9 r7 P) N3 c. z  {1 B
#- q; |! c& ~, `
; p) c* x6 |5 n5 x
set_data_limit
: W' w. q5 G7 `. pset_stack_limit
' {; l% }4 a' x7 V0 t' @1 c4 E9 J7 {, s0 D
#rm -f $LOOP_CTRL_FILE
7 B4 X& I4 w- W3 |/ v8 ]  H5 e
" L! ^/ w. ]3 C& e2 Vrun_main()/ t% n/ t5 I4 S: @8 `7 b
{
2 A- U9 u; K4 A7 R4 _6 wif [ $is_special_har_run -eq 1 ]; then
5 C9 x$ h  y9 B( m3 @) Q  if [ "$har_ofile_prefix" = "" ]; then
- v% k; h# V' K4 z, T4 _" s    echo "Wrapper bug. Notify Synopsys technical support."& g. F' ?. U; }4 P. Y. n9 D5 q
    exit 1
* k' w- s# G7 O6 f  fi. O1 b3 S0 M/ L
  if [ "$har_hilo_file" = "" ]; then; a. `1 `2 c/ q' f/ d9 I
    # no user specified hi lo file - do both runs/ a8 y3 A# ]+ P. j5 i" u" c+ D
    run_cmd $command $CMDLINE -har_one -har_setup1 ~, f8 q) N' C
    if [ $ret_stat -ne 126 ]; then
2 b+ t) m4 T1 i; t' ^+ l      har_check_ret_stat
$ H0 F; N! p* ~' i% N& b/ h7 a      if [ -r $LOOP_CTRL_FILE$$ ]; then
/ G- G* U# a$ |, [8 i) }" D  P4 Y1 C        run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl
# C/ k0 w4 e; }# `' w        rm -f ${har_ofile_prefix}.hl/ I2 I: `5 y) y4 @9 N9 q
      else
1 h+ S9 N8 [1 l! J3 u        run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl& I& u8 H: w! K8 R  |  I
      fi
# j; z: X' [# y- R0 v    else( ^) D; o6 O2 O% f
      ret_stat=01 O8 w, R. i; h; }+ z! j/ h3 i
    fi% W* k. W3 y/ `7 ?9 u' ?
  else
& r0 ?; m+ R. Q: M9 N% Q2 {    # user gave a hi lo file name
! E* n& @& @1 o! N% i+ _! r    if [ -f $har_hilo_file -a -s $har_hilo_file ]; then
9 `8 ^* Z6 L6 V: P. K      # file exists - use it - only do sim run8 _/ ~$ o( j# G4 h7 A& J  ]& P9 S
      run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}
( D! O/ C' S/ O      run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}
9 K4 e# r9 X8 h% E    else
1 X# b8 U5 K: \, x7 g3 l      # no such file - generate it - do both runs
5 p" R! S* ]$ J7 ~0 p      run_cmd $command $CMDLINE -har_one -har_fnf -har_setup
' v2 z+ L  o& f" C+ ~0 K) k& F      if [ $ret_stat -ne 126 ]; then
* n7 n0 {" G8 p$ O; Q        har_check_ret_stat% Z5 t& w  O& D
        if [ ! -f ${har_ofile_prefix}.hl ]; then7 P4 S2 {1 G4 |0 X* s; X
          echo "No hi lo file generated after setup phase. "
3 M: l4 i4 M7 W( m; F$ }          echo "Contact Synopsys technical support."  J7 [& S- m; O
          exit 1
: P- N4 }* Q, G9 d6 j. ]. s: M        else' `: `1 v% W; p' L' E# [, k9 T
          if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then* \5 X. ^: s/ ^2 u% [  x
            mv ${har_ofile_prefix}.hl $har_hilo_file# S) l: Q4 q& l  _
          fi$ M- f. m8 t; `2 m  ]; Z' ~; p
        fi7 t( L, z/ y. J0 b5 e% @/ M
        if [ -r $LOOP_CTRL_FILE$$ ]; then% _; m. q1 A) j+ R
          run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file% `/ `7 Q- C' z( X
        else, m; a7 e, ]( i6 {8 S( I- ^8 N% k
          run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file
+ O, Y5 p1 b3 A# P' f: l        fi* j8 V0 I8 K1 P+ O: V0 x$ w' ^
      else
7 F* B5 @5 X* }5 `1 ?        ret_stat=0! X! n5 y+ t' x3 E; J9 r6 f( u
      fi8 e1 F4 _+ c2 i
    fi* @7 q; G8 U+ Q" F* Q
  fi9 x. ^9 j  Q! N- C
else  
9 O) P9 j) P( V- u2 d" N( p* A# don't loop if -har_setup& T3 W7 y# k& Z
  if [ $have_har_setup_flag -eq 1 ]; then
9 X+ U" c% c) H    run_cmd $command $CMDLINE. Z3 r) Q1 s* y( D6 E# I
    if [ -r $LOOP_CTRL_FILE$$ ]; then; q: G3 x5 h0 a/ A
      rm -f $LOOP_CTRL_FILE$$9 s- j" X3 B. U2 r/ V3 _
    fi
: z6 M2 R( u! f. z) B$ X/ U  else
1 \) `* h4 k: D! n0 g    run_cmd $command $CMDLINE5 _1 L. T. J- J6 x  [9 Y
    run_loop $command $CMDLINE
* `$ n9 b) G" |# A4 N) X9 ^  \5 ~6 k  fi
1 {* f! |8 E' b- w2 ifi
! E3 s. c) l7 O' p3 o/ @* S7 L
5 n3 N/ z9 p- E8 o2 sif [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then
: l: t: A/ [3 Q. n2 U/ E  pwCreateErrDB -w $workDir -e $errFile
+ p; D2 s& I. e2 G% n' G. f7 V; v0 A  ret_stat=$?/ r8 Y! a$ Q; V3 ?$ I5 E
fi
0 I+ C1 _% E9 ?+ z}# o! Y, Q6 f3 `$ s; a( w
( x4 W7 F  a+ _4 Q$ P
cleanup_alter()
( C; r1 w0 s( ]" M' M0 E" |, _- \{
3 X) c8 Q* R0 L/ g8 B2 n! f3 d' y0 T   /bin/rm -f $ALTER_COUNT_FILE 1>&2
* h+ W3 b! ]; {/ J+ I6 t   /bin/rm -f $ALTER_HK_FILE 1>&2
9 L$ I& ?. y5 |( `/ |}& K0 U/ R0 @. j9 j4 y7 {+ N! X
6 s# f6 h1 o" i0 N/ c. D3 d/ M- O
#generate alter temp files based on pid
6 y/ [8 k( k1 k, FALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$
% U" h- J) v0 w8 g& f: Lif [ -f $ALTER_COUNT_FILE ]
! k; U; |7 L  [+ Y7 B. `1 Qthen
* {. @* k5 O1 m4 P( M  until [ ! -f $ALTER_COUNT_FILE ]9 o. b1 s$ y* P; F: K$ I6 k2 Q
  do  b: J! L6 l3 P# F
    ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$
' c- u7 }1 R5 l1 L0 w  L- X* {  done, K4 v: ]- Y5 d- W# F3 H4 _
fi1 K7 e0 A  S& l7 Z% C& Q
export ALTER_COUNT_FILE3 H9 i9 j2 ]; E9 Z
- q( u( d* N3 }! l4 h! x$ f: V
ALTER_HK_FILE="$ALTER_HK_FILE"$$
0 c6 g  p3 l, }# d- c" Zif [ -f $ALTER_HK_FILE ]2 F3 f) D$ |+ w9 y5 N# I5 D
then 5 N3 }0 W# R2 A( @5 C: X
  until [ ! -f $ALTER_HK_FILE ]. d- Q3 G% w* Y. b: y" B! ?8 M% `
  do
- G' |* w  A3 t, C. }( d( t/ h    ALTER_HK_FILE="$ALTER_HK_FILE"$$
" e6 t0 e; [6 W9 o& Z7 {1 w  done" j2 A* [) Z  s
fi6 ]% O( D- s5 G* p
export ALTER_HK_FILE; E. f5 H& n' R8 E+ m1 T5 x+ J# E

) W7 f; T6 v0 Y4 X4 \) D#generate monte carlo related temp files based on pid
/ _! U; ]6 I6 }9 Mcleanup_monte()7 ?. {$ ^/ l* Q8 |4 q1 ^
{
7 D) b" o4 d! ~+ d   /bin/rm -f $MONTE_IMG_FILE 1>&29 R  s$ X4 K) p; ^
   /bin/rm -f $MONTE_IMG_FILE.gz 1>&2
' V2 q$ U: P4 I+ u% |# p) }   /bin/rm -f $MONTE_COUNT_FILE 1>&26 C2 Y2 V0 R) O/ C. d& x) ^
   /bin/rm -f $MONTE_CFG_FILE 1>&2
) s  K; C9 X" T# l4 {# W}
7 L( D: U" [3 ^4 o8 ]7 j! s( ?
5 t* B4 N$ f' v/ x0 ~2 _MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
9 ~+ n4 y% k: \! iif [ -f $MONTE_COUNT_FILE ]
  A/ m& y1 w2 X5 n. E6 _then. V! r1 X$ W) j% J5 l: H
  until [ ! -f $MONTE_COUNT_FILE ]
+ i1 o( k) f+ Z  s) D  do
& D% x6 e0 Q. ]( N    MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
* m7 T8 U7 B7 M; ]& E  done
  r3 L. f3 m  k8 X1 [fi
3 k; B9 z& H/ i! o3 N' k8 Texport MONTE_COUNT_FILE
$ V- F4 e7 p  S( p/ D% s* x' l: J. x, f! z
MONTE_IMG_FILE="$MONTE_IMG_FILE"$$" x# f5 z% S/ \' T* E2 U- B' d
if [ -f $MONTE_IMG_FILE ]- t2 U5 ^: a$ M9 _! p: k5 r
then+ f1 ?9 {7 x& i- j8 e9 w
  until [ ! -f $MONTE_IMG_FILE ]
0 d: V  Y$ O  z* s# d; V# ]- P  do& `# U# r9 t4 A% C* C
    MONTE_IMG_FILE="$MONTE_IMG_FILE"$$
7 l+ y# ~# J) {( B4 M  done
7 {) q( V" N! |' R) I( [# xfi: S5 v  {7 S& ^. W) ]
export MONTE_IMG_FILE8 H0 G# U6 ], Z+ z# E! c/ A# J' ]9 J
. D& R9 L8 W1 ^0 I' i  h
MONTE_CFG_FILE="$MONTE_CFG_FILE"$$
: ]4 P% W' T! E3 F" [if [ -f $MONTE_CFG_FILE ]# s7 P+ z7 ]  p  |/ x
then
; q0 {* d: l: r, ]2 ]8 g- W  until [ ! -f $MONTE_CFG_FILE ]9 @/ P3 R3 e; M0 e
  do% R0 E$ C$ M4 J. w" ^+ s
    MONTE_CFG_FILE="$MONTE_CFG_FILE"$$$ q) g  E3 s) N2 n, r, {
  done
: p3 T7 c$ J5 I" yfi
/ }; M! A% K* \2 [/ @- ^& v
/ ]" K; n1 S* M+ g' u* u# main iteration
$ A9 {2 H% `7 w3 t1 G& @8 {run_main9 j7 T/ c6 {1 X, d4 Q, [7 z; ~
) U9 S! I8 V1 U( R
if [ $ret_stat -ne 0 ]
! ^& c0 U* Z! d' u8 n; V/ m. ^then
! k- c" [. A" @  o  cleanup_alter8 F, ?; e6 ~0 g& ?  F/ H$ }
  cleanup_monte
/ b, H, p: {+ }; U! ~  Exit $ret_stat
! A! ^8 L. ?. j% J: T% b% ?fi( v' o  X+ x+ D3 Q! ?

( {+ K3 d4 E, ^7 i#Alter related iterations
% b0 ?3 G5 c+ v& ]3 i6 o% z, r* \' Q
iterations=0
& E3 P( W( m! w3 W& Zcount=0
- p; }, B( W; Tif test -s "$ALTER_COUNT_FILE"/ \  `7 }# B" t0 o! q; g, v
then
# D  c$ V1 z3 B; A9 m  if [ -r $ALTER_COUNT_FILE ]; then
5 v: {6 A- S" b9 a   exec 7< $ALTER_COUNT_FILE6 r1 U. S( A: B9 D8 j2 x( f
   read iterations <&7
) t& M. _( A4 Y( M9 ^ fi& c& p# ~) F& L* d9 K; {
fi" s/ T9 n1 F+ Q
5 c' U$ a1 `: F" D6 {9 l) {
trap 'echo Program Interrupt; cleanup_alter; exit 1'  2
' }; s. |% f  B+ J  l- R" Wwhile [ $count -lt $iterations ]
) k8 B7 r4 }8 C3 k7 qdo6 i1 f% d0 {: Y4 y5 ?! z! K5 u
count=`expr $count + 1`
( D$ L8 r0 P* I8 L7 p ALTER_COUNT=$count
% m6 K, s1 n8 a( ~* L% t export ALTER_COUNT! Q4 r! \( S0 n' k  ?; @, n

/ Q1 k3 ?/ f! B' V2 r- f8 F. D2 T run_main: A) H9 g) ?8 k9 Y, J& G

0 y9 m; _$ v3 Pdone
' [, r/ I7 D9 [; X( k- ^7 D. v  T7 h: e
#Monte carlo related iterations" ~8 \) c. }: R) S% Z

$ H! n# a! _5 B$ |: C' y( \monte_runtime_summary()
) ]: _  u2 E* Q2 L) ?{
; V' K0 M& A; Y" v- u4 S( v  keyword_1=real% H, Z' q) b( R- @) ?4 o* \+ f1 j
  keyword_2=user) n) j8 K0 }+ o6 r
  keyword_3=sys5 i3 L  p: y' u9 N8 H8 ~( l
  ofile_prefix=nanosim* z' u+ U* M* k/ }% [6 N
7 S3 Q  A+ M" B
  if [ ! -z "$o_option" ]; then
* ^' e4 d2 @* o% z: F    logfile=${o_option}.log
# T4 r  w8 [$ A) d  else% S- a3 Q  n  _0 P0 K; q1 h7 Q
    logfile=${ofile_prefix}.log: a1 z$ h" Q; L5 s9 @1 p) ]# K( M
  fi
7 [5 |* q6 A, k9 k& ^9 `3 E
; j* [( R9 m! q- T: V7 p/ R) |  if [ -f $logfile ]; then4 K' `& C2 j+ Y+ C* g5 r. P& ^1 |
    echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile      
! S# x" m( C3 h; M) M) s% v5 ]/ c    cat $logfile | grep ${keyword_1} | grep ${keyword_2} | grep ${keyword_3} | awk 'BEGIN{ t_real=0; t_user=0; t_sys=0; } NF==6 { t_real=t_real+$1; t_user=t_user+$3; t_sys=t_sys+$5 } END{ print "\t", t_real, $2, t_user, $4, t_sys, $6 }' >> $logfile
$ O* S6 L5 e+ p* ?  fi
5 X8 o. a5 F4 B) @$ L* s5 b7 S}
- p: c+ O: \5 b: J
& g9 U& X$ \) Z7 T9 pnext_monte=0
& L- v* p3 Z: r: f- f( \) ncur_monte=0/ u* p! D' |! [! p& I

  {% W8 F* G, C% }- U2 M# R( \, Kif test -s "$MONTE_COUNT_FILE"% H9 {. E, }4 y* T& z8 k! K
then# X! Y3 G- h# R5 D( k0 _$ d
  if [ -r $MONTE_COUNT_FILE ]; then- X7 B% B+ b% u
   exec 8< $MONTE_COUNT_FILE
3 G! @: S% S  \. M   read next_monte <&8
$ b3 _) m2 D' ^  V7 {! j  fi
4 s. |# B& K' q6 `& ?fi
- P8 Z* o9 w  y% L) f/ [7 M) S7 \/ s' _' h2 w7 |* ~
trap 'echo Program Interrupt; cleanup_monte; exit 1'  2
% h  j! M, K. n: b9 B4 |6 Bwhile [ $next_monte -gt 0 -a $next_monte != $cur_monte ]
" E5 i' k. g% J* Ndo7 A8 l+ t9 S6 M: [9 u/ P9 Y4 r
  NS_CURRENT_MONTE_COUNT=$next_monte
1 k. a5 E$ D3 _& ~) j. p% Y( C  export NS_CURRENT_MONTE_COUNT+ ~8 c: d* i! l) _* C
2 h2 Q% n5 N; f) u* D7 T. }* i% J
  echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE
( H' b4 U9 V3 \  O8 i. `  CMDLINE="$CMDLINE -c $MONTE_CFG_FILE"
: u& J: W' ]+ K! k" ~  run_main
( G6 `$ a' B3 X* o/ L. x4 m; T/ }5 o* x1 N
  cur_monte=$next_monte
! c: F2 m! W- X  exec 8< $MONTE_COUNT_FILE
* O# T- I4 V, J  read next_monte <&8
7 o: i- Q, j* _/ K1 rdone7 e) f( D1 G! H" {  B  q- Q4 w
. H2 w# u4 W: o- t
if [ -f $MONTE_COUNT_FILE ]
( U7 M  \, H. V& K; Tthen
9 _7 Q, t/ W5 Q$ d7 Z& [" f0 i8 x  monte_runtime_summary
. ?0 Z9 h% p# W* ffi& M$ g* A* n5 j
+ ?$ x1 s8 g% g4 c
cleanup_alter
: F9 X! F' ^9 t& m  @' scleanup_monte
: k+ l+ N. o* l4 ^- x8 C. J4 X6 m- ~4 p
Exit $ret_stat

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

使用道具 舉報

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

本版積分規則

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

GMT+8, 2024-5-4 12:53 PM , Processed in 0.131007 second(s), 15 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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