Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

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

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

[複製鏈接]
跳轉到指定樓層
1#
發表於 2012-5-6 13:58:13 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
10Chipcoin
各位大大好:
4 `( V: G* I4 Q+ e                      小弟執行nanosim時,卻無法跑出視窗來,有個錯誤可是我不清楚該如何解決?問題如下& f. Q! S* C/ Y5 Y; u
                      [: 113: 64: unexpected operator
9 e2 B( @& H! v0 Y" F/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim: 1: Syntax error: Unterminated quoted string
2 z$ k! T/ P# u2 }有大大遇過這方面的問題或是指導我方向去解決, 謝謝.
# R6 X, t! f: |我在猜可能是這個檔案內的文字需要修改 但不知道該如何修改?
  D) E% q+ ]- _9 g% G以下為/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim 的檔案內容:
: A& b$ e! ?! r    #!/bin/sh
* P' A, d. c/ u- H3 `9 w* T#
9 N: R  i: P+ l& [# Copyright (C) 2001 Synopsys INC+ b/ f8 ?5 @' V8 Z, H, Y' Q
# EPIC Dynamic Simulation Wrapper (DSW)' N  f- S4 r+ X  C
#0 P# D( y* d7 c/ l) f
eval ${DBG_EPIC_WRAPPER:+"set -x"}
3 l9 Y$ Z9 d3 x6 }! c- X/ p
9 g3 W6 [* O- Y, M) o4 gif [ "$EPIC_WRAPPER_DVLP" = "" ]; then
! m- j1 n. _7 V# ?5 {' z1 E) d' h! @    TEMP_ARCH="$SES_ARCH"
: b6 v+ V- _- a  j8 _  k. n0 e( Qelse
4 x: J0 y9 F* Y# M* ^# t) r    TEMP_ARCH="$EPIC_ARCH") P0 `* R* U3 p9 i: [( C0 N& {) |
fi
( V& R# G2 r/ ?9 M9 M- ?; V" Q1 H. U1 B7 T- J! l' I) F
scan_for_hva_args()
9 p6 H) _* u- \{
0 I# P2 V6 r! }8 j  /bin/rm -f hva.init 1>&2
6 j* ~5 E% Q; u  while [ $# -gt 0 ]; do4 M, [  r7 [( t; y
    case "$1" in! @% g. O7 R6 Y
      -vaf)1 l1 V1 E' n1 Q" v7 Q0 \
           have_vaf_flag=1+ B! U) Y, B2 Q6 X6 k
           have_va_flag=0
) ~  t/ @2 @/ [" r5 p           shift;) C4 h9 A% o4 t9 \% Y. e0 _% N
           continue;& ]4 ^& w, ^" @
        ;;
6 p6 r( N) [) x; A& S      -va)
- B7 e' V* k: W0 l) A* [0 c! u- [           have_va_flag=1
6 [, `/ U( w5 l  X           have_vaf_flag=0
3 P( I* ]6 a, @! `# _2 R           shift;# U; x! G0 ~3 p5 e6 m# H
           continue;# r( L$ V2 A1 {5 g5 S
        ;;; K/ p- y( s: J- B( @
      -*)
3 t/ M. L5 [2 ]6 `           ARGV="$ARGV $1"
$ {* \) N: j0 ?3 @8 K           have_va_flag=0
+ q# Y$ r/ i0 }. _+ [; T           have_vaf_flag=0
" O/ q, `, F; U8 [. W# M2 A           shift;9 m9 p1 W7 I/ V' d
           continue;5 p% X9 I7 z5 [
        ;;
( V' R& F& B% X/ L( B, F/ }% S* N/ B. }& e      *)2 v6 Q% h6 D9 p* D
           if [ x"$have_va_flag" = x"1" ] ; then
2 X3 o* I& y5 P1 y# e              VA_FILE="$VA_FILE $1"+ a8 [0 k/ _& P' D5 v
           elif [ x"$have_vaf_flag" = x"1" ] ; then ) D4 K) [/ |- v( k' [  I$ s( L
              X="`cat $1 | sed -e '/\;/d;`"4 z, n1 ]9 L% F2 K* z
              for token in ${X}; do9 j0 e2 L+ l) l( Z0 |
                 VA_FILE="$VA_FILE $token"# |3 z6 e  k0 R) d  i1 k
              done
! _# {2 t7 R! i" _+ j' l           else; {6 Y. z& W* `( o
              ARGV="$ARGV $1"
+ Y! i3 d. K4 |  g' C           fi6 ~( }! w4 V" _' \
           shift;! U! m- P' g6 W- l; ^& [3 |- s1 |7 a% ^( v
        ;;
# p6 P* {7 O1 N# p) g! r    esac
" G% z$ h$ f% M, x  i% |$ ?/ [, }  done
- A0 O% C: ?: g5 l$ Y1 r& ^* F2 A/ [
  if [ x"$VA_FILE" != x"" ] ; then
8 G2 n. g2 i- P0 J% C+ j3 b##     /bin/echo " xxx ARGV $ARGV"
7 k8 d2 t( w9 o+ Q; \- t$ {& \4 r       /bin/echo "choose nanosim $ARGV ;" > hva.init0 ]8 G! s# d" \$ Y* ?  q$ Q
       echo vcs +ad=hva.init $VA_FILE -o simv5 d* k8 N! u2 Z  C- i/ q
       vcs +ad=hva.init $VA_FILE -o simv0 n" Z  }3 q& `- b+ ~4 y" ]$ t& v
       exe_status=$?
3 B" L( P; p% e; Y# a" q$ _       if [ $exe_status != 100 ]; then
& a4 n+ P) f9 J9 C2 A          /bin/echo "", I1 j$ P/ _0 V# ~9 p6 }
          /bin/echo "ERROR: Execution of vcs exited with code $exe_status"
3 v2 I7 f8 Y, g# w5 x6 T          /bin/echo ""
/ S8 A- Y) c& J) X7 o: E          exit $exe_status
* J+ ~) X8 f6 N7 ?4 ]       fi
' Z1 _2 T: x& Q       hva_files="-n simv.daidir/amsVD.ntl simv.daidir/amsWRAP.spi". ~9 W. I9 N0 g$ w4 f
       ARGV="$ARGV $hva_files") o0 _3 |5 q( j- B% \* x. t
  fi
" s' V, U7 [6 x3 M  s+ E}$ l  L: G8 a9 Q- k
#-------------------------------------------------------------------------
% ]  p' F1 A- \: v% n) z$ U6 Y. O$ _- B; M  o' d6 b5 v' o# M) o. q; u- B! J: x
cleanup()
4 D* j2 m! P" Y  T5 y% c& ?{
- D: x8 k3 V* ?6 A    if [ -d "$rundir" ]; then
( [& F1 A4 F* b6 }' p- m        # On AIX, a .nfsXXX file is created if libModel.o is removed5 k. w8 g% Q3 j/ q& y0 L0 e% e
        # so .epicrun is not removed because directory is not empty.. |2 q0 F4 v" O
        # Solution is to remove it again if the first rm failed4 f+ Y- E3 k, o& @: E
        # (rm -rf $rundir || rm -rf $rundir) 1> /dev/null 2>&1# R' m+ ?3 p4 j8 b2 q! ^
        if [ "$EXTRA_CAPACITY" = "YES" ]; then  T8 R" }0 [/ g4 p8 f  A) D7 T
        chmod u+x $rundir/rpcidfile
6 U0 ^& A: [. l8 G1 @        $rundir/rpcidfile
" L8 y+ I( v" O/ c        rm $rundir/rpcidfile+ \- `9 q/ {+ M* \& ~$ V
        fi
% p4 p: x% ]& h7 k' o6 C        rm -rf $rundir" ]7 b6 f9 ?6 _

, }1 c/ Q! G6 M        #Due to NFS problem, we have to copy files needed to3 h  a/ T0 ~7 ?6 O4 S
        #/tmp/<temporary directory>, then symlink's files
) `( I: ?! C9 x! w6 s6 h0 t, L        #to the local temporary 'rundir'. This avoids the problem
4 ^  d5 Q' M2 f) H        #to remove 'rundir'
) ]! _: ?" j9 Q* g        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then7 ]3 E  \9 W7 I; s  d2 v0 y: d7 x
          if [ -d "$tdir" ]; then* o. s/ f: g* l8 `
            rm -rf $tdir
4 r# s! t+ ]$ H, X4 ~8 R          fi- k3 P  V: N8 ?
        fi6 H; G& ~# H. \$ W1 r
    fi/ r0 ]$ x' F2 W/ B$ Z
    if [ ${exitstatus:-0} -eq $ld_err_code ]; then
+ ?2 j  {0 k$ b( A& h        [ "$has_model" = "YES" ] && rm -f $cwd/libModel$suffix
$ n! C4 `  m8 A        [ "$has_custom" = "YES" ] && rm -f $cwd/libCustom$suffix
1 ~& G/ B! m  D/ N( q    fi
8 }: H$ M  k# v" }# e    [ -f "$EPIC_SCRIPT_MESSAGES_FILE" ] && rm -f $EPIC_SCRIPT_MESSAGES_FILE 1>&2$ _* k# b0 {9 C1 K: O  F6 h5 |* N
    exit ${exitstatus:-0}
$ G) z( D8 ?/ e}3 {' Q. a+ ~4 x1 ^+ O$ I9 J
7 |, }4 V* g' I/ M! X4 ~  j
Exit()
  F) z; F' _- E& X{" ^3 L3 |. `& [1 j4 q
    exitstatus=$1
3 m. w8 ?! y* w# S- D    exit $exitstatus
- |* r7 ~% ]5 E2 p+ t$ Z2 B7 l}
+ {  t- _* o( f
; U  K+ D, x7 F# get_epicrc filename keyword
& _' V9 m3 G$ b* X+ Y2 z* B- hget_epicrc(): \% R! a+ E; c( X6 Z
{
) w9 g( |- O  ~' P7 S( ]    [ -f $1 ] || exit 0: T8 \$ s2 e, \3 H
    key="/^$cmd2:/{print \$3}"
* w) [4 R2 }* c9 k# x3 l    awk -F":" "$key" $1& }* E6 E' H9 k
}/ c: R1 S; g+ ]( [5 n. L; C, k# Y

1 d3 ^1 q2 I4 @4 {6 [3 Y8 N! @#
, U; `: @/ z. {% `# set datasize limit to hardlimit! L* ?! F, f2 Q  e3 V# y! e2 t5 ^" @
#
% S9 h4 R' S$ n/ K2 i4 X! W. G+ ]set_data_limit()
) b" E1 g4 h7 d+ J{8 Y; f% V( N" X' e$ \
    dbglimit=0- y. b5 @& ?: p% \
    hardlimit=`ulimit -Hd`
$ i9 {' j' u  X4 u+ g, H% |    softlimit=`ulimit -d`
5 Z- i5 w# y2 H# r3 P    desiredlimit=3500000
$ @' N% y  R; m( F# L# m! O    hardisunlimited=0, [4 w3 {1 s$ F3 Y  y$ b
    softisunlimited=07 V- g4 W2 \6 V" Z
    is64=0
7 o4 Z. i2 @6 u( c3 b& t
4 A" [! {' H% h9 `9 O* ~9 r3 `3 f& x    case "$EPIC_ARCH" in/ [1 J# W; l1 h# e, t
    *SUN*64)
) w8 Z. `  n0 y. d( |2 o* H        is64=1
. g# G# Q+ u7 N$ Z        ;;
9 D/ X- ^9 D: N8 o. s    amd64)
5 y) f& B7 }1 t$ f" e        is64=1
2 g1 _( R5 p; |5 c1 P: J; s4 f        ;;
6 G& m2 q$ k: Q  N( X    x86sol64)
, ]2 ]3 j$ c3 ]' o' Q6 w2 ~. w4 q; i5 p        is64=1
7 J1 e, e& c- [/ c        ;;2 i% |" _# U- x
    aix64)3 Y3 Q' _1 C* G# }
        is64=1
9 F7 R1 L. j  ~* T        ;;( |1 }9 N2 e6 D8 ^* E9 L# }
    suse64)
+ I$ e4 o9 C+ M        is64=1
. E2 Z& F0 }1 C' [- A3 [8 Y        ;;
5 U, O; H& [" h* ~    esac
% _1 c' Z+ N8 B8 r! ?/ @3 k0 B. n, T6 j, B7 _' }
    if [ $dbglimit -eq 1 ]; then' C/ Z; |, M& D7 h
        echo hard $hardlimit soft $softlimit
: g0 F5 U  w" y    fi; {! \: _7 Q: f* N9 Y: @
9 }) a/ n+ L( }/ y+ V) \9 @" O
    if [ x$softlimit = "xunlimited" ]; then$ s) a  }4 Y# D% w3 J+ c- I
        softisunlimited=1
  X" b. @6 H6 z9 k/ ~+ H# A$ U- k% j    fi
$ M- u& c# I+ J  g; B- _7 |
; ]2 N  L3 i: d4 O    if [ x$hardlimit = "xunlimited" ]; then. k8 ^' n( F9 p) D; z7 S! c% L
        hardisunlimited=1: f- }# Y3 M) v, d: X, ^
    fi
5 f- D6 O, Z8 g- D* q+ z- X+ x& p- g3 j, D
    # 64 bit machine should have bigger than 4G
! v) J8 x5 o0 ^, L    if [ $is64 -eq 1 ]; then8 {6 Y/ h( {" a% q# m& t- g) n
        desiredlimit=5000000
3 h! o( |" c/ y. u    fi
3 \3 o+ ^1 L) |% t/ ]8 U( v, A- ?% i' X. ?9 e6 o: j$ P9 Z+ B
    if [ $hardisunlimited -eq 0 ]; then
" L$ ]( b$ M, j+ x  P/ X3 `        if [ $hardlimit -lt $desiredlimit ]; then, Q' F! }$ y  K1 ~
            echo "WARNING: datasize hard limit $hardlimit K is too small."% @$ \) e" h' Z& a! B$ t& `8 x1 a1 D
        fi
6 g1 ~8 s8 |1 [9 }9 m3 g) b# |    fi
$ ^+ D2 U! ^2 R7 w
9 O7 U: q' F0 N- W4 P    if [ $hardlimit != $softlimit ]; then! ]7 j, }$ R$ H* n! P0 F
        ulimit -Sd $hardlimit+ B' u  l, `1 O5 i9 x
#        echo "WARNING: datasize limit is set to `ulimit -Sd`", ]: m' q" m: w' R+ E
    fi
4 P, T2 t! f$ _# {  K3 U; ^6 P# V* N+ R+ }3 v* q( q0 [# G
    if [ $dbglimit -eq 1 ]; then
# q- c1 s, E2 K3 f# J6 y6 e# t        echo datasize hard limit: `ulimit -Hd`6 Y6 t- e# s8 o- @+ B7 K
        echo datasize soft limit: `ulimit -d`
8 G- [: Z; a4 o    fi% r$ w8 W# z8 i3 {! O
}+ |; L; `/ V- F) x$ ^$ S: h
& W4 E, e+ P1 R; D2 i, h
#/ b' e$ b% n' h8 j0 g6 E% h
# set stacksize limit to desired limit2 @. b& W8 f$ [7 \' J" t/ G0 x3 m) Y
#5 \% Y1 V2 y+ Y8 G7 h& C. V
set_stack_limit()( W2 k; X0 b$ W0 `8 p  A
{
3 C8 }/ l8 U3 R  g9 V1 H  C! B    dbglimit=0$ b& V* Q8 d9 `- {1 E! J  e
    hardlimit=`ulimit -Hs`9 O3 S( z2 U: ?
    softlimit=`ulimit -s`' ]' H6 P9 y& L/ F, n7 W9 K0 W: p
    desiredlimit=60000
" T" ]2 M: z/ d& E    hardisunlimited=06 W5 F! ~: j$ v- i
    softisunlimited=01 ]5 s3 m0 j( }
    is64=09 y2 B$ c+ w& I# L4 ?' H

8 V+ Z8 T3 g2 ~" G& M3 g; y6 j1 n( o    case "$EPIC_ARCH" in' V9 f5 i% o! k9 x' {  w
    *SUN*64)
# P. y0 [- p' ~* ~: _        is64=1
) t' N2 q7 R1 t# ?% R! P        ;;% G8 O+ c0 P' \9 Y
    amd64)7 |9 F3 K8 S5 M
        is64=1
0 R7 {9 b! X, k8 o$ C# B* c$ Z        ;;
0 G6 N) j, b* q% W' ^+ `    x86sol64)* d5 s$ m) l# Z& ?) ]& _
        is64=1
. W! v; t7 S  R        ;;% O4 p9 A- H# G/ W. F
    aix64)- |" q$ w. _8 u2 y# n( L9 E
        is64=1
2 w9 `1 X' }$ Y% I4 m' e        ;;8 R# Y* I  r, E( k+ d/ B
    suse64)6 z! r& V! D8 o/ t6 E+ }2 q, i/ v
        is64=15 Z& w  i7 d; [& k" r; i! z# I
        ;;
" t6 u6 A0 {' ~1 ]  N    esac
  p  M# C. s; `  O8 y! Z1 i5 P9 O2 S: I- l" A4 A9 ?2 L  r* Y- ?
if [ "$EPIC_WRAPPER_DVLP" = "" ]; then
# j* |) y( c" i8 u2 ?& {( o    if [ $is64 -eq 1 ]; then& h/ t, F/ g6 r: ~
        desiredlimit=200000
; P  t& I: }4 K* Y% P: V8 x: y    fi
* Z& S4 I+ ]! H. ^else  v6 b  [& }9 h. J; _+ R' X. c
    case "$EPIC_ARCH" in+ [9 l$ ~* x9 H: s' y6 N+ V
    *SUN*64)
+ K6 ]: @1 s  K9 X4 `        desiredlimit=200000
# D) `# {( B( {' h; c( y        ;;
" o1 B( O0 z5 O, w! r; j    esac& }- z4 C; J( c
fi; {) p$ {4 A' v! _3 ^! e! m# z; E
       
* V- o9 H/ i* j9 ]! _, }% m; e    if [ $dbglimit -eq 1 ]; then
( p' e! `+ K& S4 ?; Y- L        echo hard $hardlimit soft $softlimit% C* C* A; ?1 w8 o
    fi  m7 j) y# \, b- h; e9 N

' i$ R2 z& o0 Y: i    #stacksize can not be unlimited, pick smaller number1 L9 T7 b6 V, H5 N; m5 M4 P1 }

! }  _4 g6 D/ e8 l. W    stacklimit=$desiredlimit
$ s+ ^0 |5 U% f* D& h
$ B6 h5 T/ b$ Q" o; [. u: P    if [ x$hardlimit = "xunlimited" ]; then) G& i0 G' z0 g/ J& f5 R6 v  z4 ?
        hardisunlimited=1* C7 @/ ~" w  b" z% X5 W% t: g  V
    fi
2 D' b; I2 P5 h0 r9 O) ]/ X9 y2 W# B+ c$ x1 P: r  ]( L5 M
    if [ x$softlimit = "xunlimited" ]; then
2 t6 N+ A, Z0 N) g/ v  K        softisunlimited=1
$ D6 ?: \7 D/ s, n: g: y' A% {    fi3 ^4 d/ @( L3 {/ R* O
$ ?6 A$ m) v3 A$ u6 J+ l" A
    if [ $hardisunlimited -eq 0 ]; then- V: k! C& k; E7 ~
        if [ $hardlimit -lt $desiredlimit ]; then: g- f4 w6 y5 u) Y/ T
            echo "WARNING: stacksize hard limit $hardlimit K is too small."
# u8 F" C9 O" t8 @" S# Y            desiredlimit=$hardlimit' H! n4 m- q8 k) r7 d; ^
            stacklimit=$desiredlimit$ E3 |; K7 L9 u; P$ e  j  `% a' Z' E' {
        fi
1 ]( M9 F3 @$ q: y# D4 G    fi
0 v# J% H9 M) }* F  q" B& Z7 m9 p  |( d: S3 z7 a8 H
    # desiredlimit is set to proper value (< hardlimit)
) R9 ^) P% p9 {9 o" @3 z
, X0 J: Q) K# D    if [ $softisunlimited -eq 0 ]; then
5 ^2 o  I- s1 U- D. r6 l        if [ $softlimit -gt $desiredlimit ]; then
+ O% r$ s, L: g0 ?' r            stacklimit=$softlimit9 n* w( p# |* r( x5 L# `3 d3 B
        fi
  r, ?5 j2 a2 j9 l9 G    fi
7 I# Z1 `* g3 x) u
9 W+ u/ j, c0 k# f    if [ $softlimit != $stacklimit ]; then* b! g! J' Z0 a. q7 c
        ulimit -Ss $stacklimit
+ L* I% b* b/ T#        echo "WARNING: stacksize limit is set to `ulimit -Ss`") ?1 m$ H' Z7 T0 E
    fi
# G  J9 u7 i! r$ c7 I! |) V
* ]) D" H1 j. d6 [    if [ $dbglimit -eq 1 ]; then  i$ Y' u- P. G, G4 I
        echo stacksize hard limit: `ulimit -Hs`
* X; d- e$ x, u0 r        echo stackize soft limit: `ulimit -s`
0 z* f, s: T3 ]+ y    fi
4 I6 F# K/ K# |& a. V}+ y$ O7 _' e/ H3 N! \

4 c$ P5 r+ M& m6 n8 Iopen_epicscriptmessages()
# n+ @2 L/ v! U1 o{! e. N- Y6 o# i. n
#generate  temp ".epicscriptmessages" file based on pid$ Y+ F0 p5 [( g. N) g- G
EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
  i3 q: m1 Y( |. Dif [ -f $EPIC_SCRIPT_MESSAGES_FILE ]
2 U( N9 e$ F) T3 M/ ~then
* v4 S, F: p% i3 Y# t5 D3 f  until [ ! -f $EPIC_SCRIPT_MESSAGES_FILE ]
  k% E5 z' t. W: H0 h# x2 q  do0 w& t; b* x$ ]0 Y7 Q
    EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$5 b% _8 S- _5 A5 q: T% ?3 N6 T. M
  done9 o( ^7 F7 n  m. ~4 t5 ~
fi: I3 h7 _( y* P3 a" r
! e: ^* l5 ^6 K) Y
export EPIC_SCRIPT_MESSAGES_FILE
1 ?# t  P" b, h# A6 T* G}
; l" x1 j9 {5 y7 G3 d: k& g, q- x# A1 D, a: V. m( a+ Q. P. W5 S9 f( j

  ^0 G2 r* e! x- K2 Z4 E9 H* X1 Scmdname=`basename $0`5 T  g9 @7 k' t& k( p9 ?% @  ]# E' C
postgres="n"
& @, ^) O6 Z! _* B" ~ostore="n"
. u# Z2 t* t# f* B' W( Lgui="n"
3 A! B2 I# O; g; tdatabaseOn="n"' T/ l. ?" q: _; Q
f_next=0% \7 m; Y/ b4 Y; U. m
f_option=""
) z* v9 [* ?1 m: L) Fo_next=00 D' F- B& B) f3 n! u* O
o_option=""
  R/ j" D# g( i# y7 WworkDir=""3 R: S' v) B) K3 W
workDir_next=0- f) _) b) m4 l. @/ ?! Y9 J8 `
errFile="powrmill.err"
3 Q  V; H  K( Z: [+ g& D9 n9 v. bwin32flags=""
! z' Y3 {  y; Q! J+ tln_default="ln -s"7 f, ]1 f$ ?, C4 ]: W( p

) `7 a; K- o4 w. G$ Lhar_hilo_file="") W/ n$ P& M' m/ ~9 d' @
have_har_flag=0
$ C. j3 P! w% x, ]* shave_har_setup_flag=0
* `& G. p  R, U/ q$ A, i1 _is_special_har_run=0
" E. x% `6 P- c5 p, ^0 k4 i5 ?har_ofile_prefix=""+ W0 J( p9 B4 r  Z; _2 H4 N

6 d& O; f4 G& n' m- {0 B7 ^have_va_flag=05 O5 Z: }) {1 Q- a5 n
have_vaf_flag=0
: `5 k9 H) Y' q0 u7 aVAF_FILE=""
, n) F$ e/ }5 X7 R0 jVA_FILE=""
3 Z* j: P! ~; I- K) {8 vARGV=""' F- j* z+ x9 B% k' V

) A: V% k" c. S* H$ {2 aORIGINAL_COMMAND_LINE=
* H- `  x6 M- x" l  TLOOP_CTRL_FILE=".ns_ba_env"
5 w5 H- g( w, C, KALTER_HK_FILE=".alter_hkf"5 C# l& X6 u+ N6 f9 ]5 X- h
ALTER_COUNT_FILE=".alter_count"7 H3 L1 {# Q3 h- l  w/ c
MONTE_IMG_FILE=".monte_img_f"- v. k) n6 T) v8 ]- r
MONTE_COUNT_FILE=".monte_count"3 _* {. g" Z% j- V9 i# _
MONTE_CFG_FILE=".monte_cfg"* S6 q$ U6 f7 ~0 C7 a/ z
EPIC_SCRIPT_MESSAGES_FILE=".epicscriptmessages"
3 c1 E  k* x4 n* H( V) I/ n' m% n- c- j( I3 S0 }& z
open_epicscriptmessages $@5 r9 h: _; h  I8 P2 Q: h, ^. B0 q8 ^' i

) ?0 L) U. i$ L4 _  L6 uscan_for_hva_args $@
; {5 }( O1 o7 F- p5 o+ G5 i8 c. c2 C, I! A: f
scan_for_har_args()3 k" N0 L! z4 [; k
{  Q, G! R  Z* B! A( l. ?
  while [ $# -gt 0 ]; do* e' L4 t8 c7 ^8 B# k; J
    case "$1" in! u" _7 F% Z! H  o  u0 q
      -har)
4 h, L/ N: j/ R2 U+ [9 F6 }           have_har_flag=1
+ Z. G7 ?8 W& R8 h" Q           [ $# -gt 0 ] && shift$ i/ @& w9 y4 }) u3 _2 _4 Y2 K
           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then$ Q" [; ]/ d6 G* ]0 @2 P. f
             har_hilo_file=$1
! D. ?4 Q9 k) U) A             shift& S1 Q/ o$ q0 V% q( I0 h
           fi
5 p1 r- ?- T5 [' q$ j1 w2 g3 a           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then( o2 W) j4 N. b) M5 b, ]
             echo "Too many arguments to -har flag. Only one hilo file allowed."; T* i6 c# D! B/ j
             exit 1
# S; g/ q6 `/ `. l0 T           fi" W" l( O3 m9 C5 K
           break
% G8 w1 Z5 w; p: [: W        ;;/ A  ]$ z5 J( y! ^( K) t( p/ H
      -har_setup)
9 Y: G* [5 l. k; ^1 C6 ~           have_har_setup_flag=1
" {# B2 h4 |1 I; C0 H. Y# K- z- X4 Y           break5 I, y$ |! g& C+ |" F8 {
        ;;
+ M( y* K6 F+ y& Y9 g! s" U      *)) c7 B7 {) _- Q; s
        shift7 d$ d+ g/ E4 w3 q
        ;;/ k; W* m0 r/ c4 g4 A
    esac; m# f/ M6 i6 I2 h' D0 z" \3 u
  done
  h' x6 b6 t4 S2 x3 a}4 K5 O  |/ d4 O$ F, S8 S  c. _
  G' Q8 X: E5 y" y, v: U
scan_for_har_args $@
2 i7 O6 Z; ^8 @- v: C7 ~" u1 k! v! \8 w, C& U
for argv in $@
+ C) Z) A! T) @( }5 ydo
9 v) D9 L  J" W; f1 Q# f, g# T0 f   ORIGINAL_COMMAND_LINE="$ORIGINAL_COMMAND_LINE $argv"- Z5 a( R5 L1 ]$ E7 E
    if [ $argv = "-gadb" ]; then
" b+ {* z" \( M5 J2 H        databaseOn="y"' ~2 w2 T  C2 ?, w2 z, `
        workDir_next=1
3 L3 ^* @) I. @    elif [ $workDir_next -eq 1 ]; then
  ^9 M/ H& W% F: n+ O        workDir=$argv
# |, M7 f2 N' y5 z# n5 H        workDir_next=0
- [* {% q' y% I2 B4 ?* `0 k0 q- k    elif [ $argv = "-ga" ]; then. W. A4 N# Q! V4 L2 g* ^+ |2 N9 g, }
        gui="y"
' C' d6 V6 h# y) |    elif [ $argv = "-f" ]; then+ w' H# G. G% M) `- ?6 B
        f_next=1) G" b' ]+ |) ?9 |" c+ a1 v  C- E
    elif [ $f_next -eq 1 ]; then
  E# ?: P' T1 ~  Q) x        f_option=$argv
& m% p2 \5 d; X( L: N        f_next=0
) m/ [# x) T! ]+ z& w; Q    elif [ $argv = "-o" ]; then
/ ?0 ?) n* }, @$ Z        o_next=1. o$ A! w) C$ v* R+ C  q- r3 ]! l
    elif [ $o_next -eq 1 ]; then
4 v. w7 q0 }$ L        o_option=$argv
  e" l+ p7 c  {! S, J        o_next=03 l3 p4 p  `+ H6 J" R
    fi; Y; }% t3 J/ @. V
done$ f5 c4 [% O& u; l$ y0 Q8 l
echo "Command line options: $ORIGINAL_COMMAND_LINE" >  $EPIC_SCRIPT_MESSAGES_FILE
  I0 G6 E4 ~9 v/ H' A
/ ?- P9 p% D) D  uif [ $databaseOn = "y" -o $gui = "y" ]; then% i- S/ Z* t% i
  if [ $cmdname = "pathmill" ]; then. x6 f& q7 W" e2 v
    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5"  -o "$EPIC_ARCH" = "SUN4_SUNOS_5_64" ]; then: l, d! Y9 e2 ^+ W5 N/ k% y
         ostore="y"2 w2 r1 p' F" m
         postgres="n"8 I/ y6 c0 J2 g" d
     else
2 D. _3 X: V" k1 Y# b        echo "athmill GUI is supported on Solaris platforms only" 1>&2 1 u. W$ Y% E4 q
        exit
1 v5 u7 V9 w5 ~6 B- ~     fi
1 a7 c9 w2 G' E4 s  else" i1 _5 A1 A( r  i1 q& e
    postgres="y"
" a2 q) p' m% x6 i( ~+ z         ostore="n"% ]1 P6 b5 R& q
  fi) M0 }4 ]' o# T; N
fi5 V! i* `" R: x, O5 w

$ T9 O0 d# y5 V- l7 p/ ?2 Oif [ $gui = "y" ]; then
3 c' z  o; T) E6 L    if [ $cmdname = "powrmill" ]; then
! x* v5 x4 J6 h0 W8 N4 Q        pwga $@: H- G! W: X1 `
        exit) P# k0 E; k' B) X
    fi4 B, l( F, I* W9 g# s% D& L6 y
& O/ ~- H  @, D9 z, b
    if [ $cmdname = "pathmill" ]; then
; J5 C) {' ^2 w2 ^  T0 x' \        if [ $ostore = "y" ]; then
# S+ T# `& t1 f           ./pathfinder $@( k! B& @+ y! }3 k" }1 z8 c  b% M
           exit0 P' _2 y' X, u- [- A
        elif [ $postgres = "y" ]; then! s  H8 {1 @  I$ [( \% [, I" J
           pmga $@
! j" W" V* B" @( K           exit
, g. }. r9 e2 x. W5 |  t        fi& g2 ]6 F! \5 W+ W+ `
    fi7 U  O. x7 @; i7 a
fi
: V0 Z$ B1 k# V. R9 L
$ _; F' ?3 P2 Uif [ $databaseOn = "y" ]; then( L+ p4 B7 U" s; M
   if [ $ostore = "y" ]; then; j8 {$ j0 S7 h7 Y* r! P% Y! B8 P
      if [ -z "$workDir" ]; then
( I2 P# X- v: K) N% H         echo "Error: Missing argument for -gadb option"  E3 h) J, {( X' R. G, A( k  a( P
         Exit 1- |- c- r* x2 Z3 r4 q& c
      fi
. D# @8 P! l' P3 H5 W8 M1 k$ }" X5 N4 o) s   fi4 s  G8 f5 J) p) w  S% z
   if [ $postgres = "y" ]; then
; ?; l$ V  D6 B" k$ v% ?8 P      if [ -z "$workDir" ]; then% p$ O6 M; P, j% k  ^9 B! I9 @
         echo "Error: Missing argument for -gadb option"+ F4 p, F) u" g+ v
         Exit 1
' \& t; G- `' X' |- c/ h      fi
- h/ f, B; J6 p7 p   fi
1 R' h1 F* d$ W3 ^fi
9 V, i( m' R! m' Q* a" t* r' U6 k8 \3 u+ _# Z* U. F$ e
if [ $postgres = "y" ]; then4 t# f( G7 o: D- i' H" n5 [

' R- b: B- Y+ Y* I! g& ^    if [ -r $EPIC_BIN/scripts/gui-init ]; then  J- e' v: V3 ?# w1 l1 _* G
        . $EPIC_BIN/scripts/gui-init
" F  r% l7 `6 G- Y% r    elif [ -r $SES_ROOT/bin/scripts/gui-init ]; then
$ x( I) ^$ _9 x8 j        . $SES_ROOT/bin/scripts/gui-init0 s6 W3 E. D# {* z1 C1 h2 ^
    else+ U) J/ k. n3 G
        echo " ** Installation in \"$EPIC_HOME\" has been corrupted!" 1>&2
3 e( g+ |# U2 }+ g# E+ j& M+ ^        echo " file bin/scripts/gui-init is missing." 1>&2
- x2 Q! g1 B& R* R* T" Z* |    fi$ c5 T2 D* x& i; i! d9 M3 h
* Q6 w# i! p1 R1 [. a" _
    workfile -tool $cmdname $@" w6 C( g) `* q9 ?) p
fi2 ~: K2 @" @/ O+ }4 R- Y$ k
) _3 n8 H  K& G. I1 o
if [ ! -z "$o_option" ]; then9 o+ w8 R7 U2 s) Z- j
    errFile=${o_option}.err* y2 m' ^& w' E4 D3 d* k
elif [ ! -z "$f_option" ]; then
# y! p  \% h4 q' r- i5 \! s2 M    if [ -d $f_option ]; then8 ?2 X& R2 t+ b- L5 {3 z
        errFile=${f_option}/powrmill.err' x3 ?" m  J# }  j% S: \; A
    else errFile=${f_option}.err
8 L7 [# |' k( U( w. W' L    fi
: B3 l7 T7 x! t' Pfi) A/ ?/ I6 @1 z. H+ K/ I9 o

9 v& \$ Z: W% V% m$ D% N
1 K" C3 @; q, Y1 W8 b% aif [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then  M' n' `. A* w; t) `
  rundir=.epicrun4 f0 O* b) ~/ X# _0 {' r* S
else
. I. |  d6 d4 l8 P$ \  rundir=.epicrun$$
: R9 U0 `8 I! v$ `3 Lfi
0 h3 u- i: {' u" p
* k2 j6 O+ N. u6 X2 G  e9 @6 c  \libpath="$rundir${EPIC_DLIM}$EPIC_DIR": H: m6 [; W" s/ i* r6 s4 q% f
" Q7 n' k* v6 }: c8 O
cwd=`pwd -P`( |+ E9 o+ {- h# Q
if [ $cmdname = "acehdl_w" ]; then
! [: B# l5 Y3 ?  cmd=`basename $0 .sun`
2 _. w# e' ^- o7 r/ J2 P  cmd=`basename $cmd _w`
: M: \3 M: W! g! s4 p% ielse
& U  t1 u* j* D! I+ C) V" m  cmd=`basename $0 .sun`: u) z1 x  Z; z; \: |) s
fi
* G$ `+ b, W- E* B0 T" p- V( j1 d# U- A0 N* b
command="$EPIC_EXEC/$cmd$EPIC_EXEX": b. _; _' q# C9 E. R. x  E
[ ! -x "$command" ] && echo "$cmd: not installed!" 1>&2 && exit 1& i, W7 C% K7 D8 B
0 H) C7 P: o1 X4 B
# buildmod extracts -u/-fm options and calls genepiclib; K0 |# y8 N: {- W+ q; T
# It also set the remaining options to variable CMDLINE
% r& {) @+ e' |; q# look up in .epicrc for -fm & -FM parameters
5 V5 x* X: }- L: i
. x. C. E+ ?" Y7 ~+ ufmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`"+ l" P1 @6 W% A1 ^# t
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`", M- x* h, @) `. A. x
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`"
- m0 ]* u6 J- c( Y- ], X/ `( l
& k$ L; }9 Y3 |; |FMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`"
2 P  }: C+ i5 [1 c[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`"9 ^$ c" G2 R& J( J5 `7 k: |
[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`"
: l' w- I7 h! A; U& a; |9 m) |+ K/ _
if [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then
2 s* M: v& H- W3 \8 p1 l    # note that the buildmod script will set the CMDLINE variable
$ C7 S# {) S( p1 E; t6 j    . $EPIC_BIN/scripts/buildmod: X1 [7 {8 p: `/ H( _% t
) L' v1 a, V- v$ e1 z& g
    #echo "This is the value of cmdline=$CMDLINE"
' L3 W9 j" ^8 ?3 {    #exit 03 w2 |0 S6 J+ |& C
, t0 Z" a3 E; C; I  m
    # if a new timemill/powrmill/pathmill built, run the new one
  r: Z  ]  ], j/ G( W& U# x3 e; Q" ]  k    [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX"" _" |+ g. V2 D: W* U! Y
fi
& B! F8 H8 Q+ R) p" R6 X; O
! U: r5 z! d: ~3 e0 P* O( ^if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then
; f0 T/ s7 r3 J2 G* W  if [ $have_har_flag -eq 1 ]; then
' B9 C0 X, r, }7 {' @    is_special_har_run=1
# Y8 K1 O" {$ k( p7 }    if [ "$o_option" = "" ]; then9 {+ U. f0 [  h" F5 z& L
      case $cmd in3 d" ^8 E- U0 [% f
        timemill): r9 F3 {7 X) E
          har_ofile_prefix=timemill
& S  g8 l" R; k          ;;
& k- {6 j) Y" W+ V        powrmill)
2 m. F7 E# M$ ]" U4 l) V          har_ofile_prefix=powrmill( t  h: _0 v3 E0 R% O# B# C* I' E$ v
          ;;
- @- ~; P* ~% o: a2 _        nanosim)
! y6 P  u8 }1 h' p          har_ofile_prefix=nanosim
- k0 ?' ~. g4 Z9 {" U8 f$ g          ;;
. V4 U  h& i- B      esac+ G8 X6 W. p0 y5 r: G' w- `
    else  M0 _1 M$ j9 f! o3 s5 C2 x3 |
      har_ofile_prefix=$o_option
' N9 G: @2 q; K4 Q    fi' M  y; a! |7 b9 I* x; s
fi
) ~/ n: \+ g( j% g( ~9 x( Ufi- a0 t& H! ^0 v' _& T5 N6 n
, {9 z. q2 J, Q' l! U
# Call Double precision version of the product if -D# w: z' M: J" W8 a
# or simulation time > 1,000,000 ns.: q# u; u' `0 S; f. b
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then) y  g2 ]5 Q5 j( A2 a9 C* _8 f
; K5 b$ m- _# d$ ]
  # Now the binary always has the ACE feature
4 T  }- s' }( z! |! o8 _# j9 }2 J  USE_ACE=YES
3 l1 q- I, D; Q; v1 o5 }! z) v$ p8 W, Z: J, a) b. g
  HAVE_DP=NO) i& j& e8 U, ~6 _+ I
  EXTRA_CAPACITY=NO
- J: P  H  O0 Y% W9 w  DB_REAL=${FORCE_DB_REAL:-"0"}
; l' }. z* V6 u0 c2 k/ J  g" V3 d. y7 K6 M
  # Enhance for ACE ease of use
" ]; d$ }( M: X  # If no command line option or only a -T option, do:5 r( X" `2 q% ]6 y1 v
  #   1. set -A option- ]5 \( {% O/ P% A
  #   2. assume input file to be hspice
' C& l( C# l  w3 H' {  #   3. set -o to input file prefix1 u1 x- y! E: C, b. L" t; t
  #   4. set -z to input file prefix
, a: o2 e* E% ]/ A+ ]0 x6 {4 z  #   5. set -c to default config file$ J% u% [" I" P8 h, K
  netlist=""
  `# |) z7 q7 ]  minusT=NO" b, J. D6 l. H, S5 Y2 j- Q* ]
  useStdCmdOpt=0
% s& C/ A, d& t* H  prefix=""
* o6 a! v2 P! g8 _( y7 ^  circuitType=""! y  i2 a4 T: e1 f" C# ]) R
  for opt in $CMDLINE4 {0 w, \+ J% J3 z
  do
+ t" c7 f( b, ~+ v, D. E    case "$opt" in
, Y3 s& J# V+ G      -T)
6 }  b/ @1 x  P- l        minusT=YES
8 u. Y7 V; O% h( @        ;;
- o* R! F2 K. i4 \      -*)
: \7 S- h& N3 c+ Q& Z1 V        # using standard powrmill command line
$ I5 ?  Z/ o; Y1 s- x. B9 p4 X        useStdCmdOpt=1
! S2 C: z' ^- f/ T  P        break
3 y+ @" J9 ?3 e- b8 w        ;;5 [$ O0 @5 j. O
      *)& ]1 u# |9 F9 {  C" S
       if [ "$minusT" = "YES" ]; then
; _. W$ _/ h2 l         circuitType=$opt
, C( `2 S) K( y; F: g; u         minusT=NO  # reset flag
: [4 C2 s+ ]) P+ P& }       else
7 r5 K! V: ?* j, f# }         if [ "$netlist" = "" ]; then
+ {* M, n7 \' Z( |* M1 b( L, d           prefix=`basename $opt`- Q9 U, P* z$ R2 t
           prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix`- K7 ]8 S, W) H$ N7 k' Y  g
         fi" s6 j- e8 c5 A4 W& l
         netlist="$netlist $opt"& e5 x9 V7 ?0 Y; l. ]0 |2 Y1 R" G
       fi7 p' `. I4 J. W% B) F# ~# k
       ;;7 M  ^% |# B7 w. t% H8 Q9 W
    esac- N4 z5 B& l: T  r8 w& w3 n" D1 u; Y* l
  done
: N  j1 {4 B+ M. J
/ \/ F$ n: I0 @8 b) E+ g2 p7 q. [6 s% [3 p- Y
  if [ $useStdCmdOpt -eq 1 ]; then
0 q" f- [; t) b% t    # use standard powrmill/timemill command option
9 N* \& u5 ^' ?! e    for opt in $CMDLINE
" S( S& E8 n1 u1 T: I! u* u    do
; [% k; E. `& h& h: ^      case "$opt" in
3 ~3 E3 ~3 h5 ]' \/ L' c        -A)
( f* F" b" O% c7 y) R( ?2 o! t            DB_REAL=1
, l# Q  M0 a) b, [$ x* z            ;;
. `, ~& |# [7 I8 A" ~' v      esac
8 `3 {& M$ l$ [$ E+ O$ {6 v- n1 o    done
' }2 P3 g5 t6 M0 w7 A' r6 [8 [    if [ "$netlist" != "" ]; then* ~: n, k4 \# x" w
      CMDLINE="-nspice $CMDLINE"9 G+ X3 B- g! N+ C) p1 j3 J9 u
    fi
3 l' }! u, o0 B+ @2 X6 b- f. J  else
- s  v- Z) }1 e7 G6 b; L- b    if [ "$netlist" != "" ]; then# K5 P2 V/ [: Q+ e/ G5 i6 S. S
      EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"}
. A4 F3 r$ ^) u2 k      # construct new command option
% ]/ v  a* l+ o1 q) j, ^      if [ -f $cmd.ini  -a  "$circuitType" = "" ]; then
6 p4 \, O( k7 `& f' n) J( [        CMDLINE="-nspice $cmd.ini $netlist"
7 Z' j+ g, k1 F& M! q6 n      else
" x6 ~& \" g7 B$ g        if [ "$circuitType" = "" ]; then% b$ E! _& R) n' ~" G5 d
          circuitType="msana"
# C- z9 R/ ~. [1 \, O4 a/ K3 Z        fi
1 U5 t6 \/ C5 O0 y3 d        CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg"
! v# Z- E4 K9 g! I      fi# `2 P9 x& o( {6 Y. A8 k. R% b$ b
      CMDLINE="$CMDLINE -A -o $prefix"& S1 v9 V# x& j6 }
      DB_REAL=1
8 T( q4 S+ w- u  N" Y      echo $cmd $CMDLINE
0 H+ f4 B4 G* l6 k, f, ]7 o) L    fi( G) B0 r# p2 V% ]: w8 ?
  fi
& E5 ?5 Z- C/ S- p, w' `fi # cmd is timemill or powrmill or nanosim or railmill or pwarc& K$ W8 T% e+ W( f$ I/ \6 I
: ^/ `: X6 `: @3 w
[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a"
/ H* Y; F; Q. B: U  ]+ b  q% n[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a"
& `* c# P- w1 Y$ {1 L[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v"3 [7 S8 |# c$ N0 c

1 g% _( K; S7 Rif [ "$__engine_wrapper_called__" != "Indeed" ]; then
2 A7 v6 K% r& C7 I0 E; g    __engine_wrapper_called__=Indeed
- W( I, i# i# O% y    if [ "$cmd" != "amps" ]; then+ C3 w% A* j/ t: x
        export __engine_wrapper_called__
) Y! v. ]" T+ O: c    fi% X- {" T; x% v' E- {
! p. [) c" c. y9 Z, J7 R$ H
    trap "cleanup" 0
" e3 ^3 J  \0 o' v  d    trap "" 2) j0 F7 s. y1 l  Q* X
) y' N/ ]7 I' Y) I8 I( |/ Z
    [ -d "$rundir" ] && rm -fr $rundir% n0 b7 i7 V4 r
    [ -d "$rundir" ] || mkdir $rundir
, g9 N0 c; U+ p3 _) _
4 q9 {  c$ `3 |8 w) Y1 _    case "$EPIC_ARCH" in
* H4 [# c6 Z% `: Z, M    *SUN*64)   9 B3 u, Y/ ~7 E8 ~. S3 |% x8 q
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"' O2 r# h9 K2 t  U
        export LD_LIBRARY_PATH
" r' j  {9 n& @5 \/ `0 l, U3 N        suffix=.so
* a2 y$ L0 [' X) ^5 B        ld_err_code=127( ~. P4 p2 A0 g- m+ y7 F9 {" J0 e2 ~
        ;;2 B/ p5 _" y3 R  `2 A
    *SUN*4)   
3 E7 k7 t5 N6 }# D$ `        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
2 f) H- W2 ?+ O2 j2 g$ a        export LD_LIBRARY_PATH
% e7 y& ~9 L; {( v8 A4 x        suffix=.so.1.01 Y1 m: T* y4 r4 D4 \1 O/ ^
        ld_err_code=127
+ p- |+ ]% R1 ]: m/ v/ t9 A/ {4 o        ;;
% U7 Z  J# D8 k$ i; T# o    *SUN*5)   # r* B. s4 F6 ?* p, B2 F
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"8 k  R$ [$ u+ i! H# t/ _# T1 H0 r7 D5 i
        export LD_LIBRARY_PATH
4 L/ j" O: C& R4 i2 L        suffix=.so  r) ]( k7 ?( t$ B& \8 E2 `
        ld_err_code=127
: ?1 C. P/ v1 T        ;;2 N# I" ]6 T; ~/ V$ o% f
    x86sol*)   & o! [. b$ l! ~4 f; k
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"( I4 _) {2 `* p, ~5 X1 E
        export LD_LIBRARY_PATH. q9 \; j' W0 i1 t/ q! i
        suffix=.so
9 z  d; L" x( j7 L# K        ld_err_code=127
5 Y" z1 P/ z3 N# f' j/ ?! S        ;;
0 R+ b6 _1 S- f5 C! I0 D, {8 N    *AIX* | aix64)   ' x  D  k) G' \6 z1 {
        # When genepiclib creates shared objects, it creates a import file and
4 v" \1 J0 w7 L2 \' A        # uses timemill as program. So at exec time,program timemill is needed
- ?2 U9 G) o: {7 _1 p" `        # in LIBPATH( e6 X; ?6 E- j0 Y" }
        $ln_default $command $rundir/foomill
: }. X3 Q5 G* G% `9 j- V* C' \        LIBPATH="$libpathLIBPATH:/lib:/usr/lib"
4 D+ k+ o: M6 @5 o! V" a% L+ Y        export LIBPATH
3 d: j$ b( G& e; f: T        suffix=.o
, |9 s- [3 }+ M$ G5 ^        ld_err_code=8
; r8 d# \- T& f9 n% I' r) n        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then; c( E+ j# T- ^, O3 B
          tdir=`echo "/tmp/d"$$`" f' N* X6 w  F, ?; Q- l+ p
          [ -d "$tdir" ] || mkdir $tdir
2 Q4 a9 Y5 Y' S3 `) q/ J1 h/ h          if [ -f $EPIC_DIR/libCustom.o ]; then' e* W( W4 x1 c' _
             cp $EPIC_DIR/libCustom.o $tdir/  Q9 u7 M, b5 z$ ^" U* b
             $ln_default $tdir/libCustom.o $rundir/0 x5 ]! X: U" \+ ?
          fi9 q! G1 x3 F: g" q/ H
          if [ -f $EPIC_DIR/libModel.o ]; then
7 C2 }- M4 P% G. z7 ?9 k8 d             cp $EPIC_DIR/libModel.o $tdir/. X  _/ r+ m/ o" s: V
             $ln_default $tdir/libModel.o $rundir/
0 j6 \$ j" o# S          fi
& Y) W. \! O. R& _2 `1 j, e, G) g          if [ -f $EPIC_DIR/libFuncModel.o ]; then
9 B- W: z' h% `4 h/ T* H4 c) z* G9 ^             cp $EPIC_DIR/libFuncModel.o $tdir/
$ H6 e. N9 z2 H             $ln_default $tdir/libFuncModel.o $rundir/
+ M+ O$ d& s# }          fi( g+ R4 n6 J) h- s$ S
          if [ -f $EPIC_DIR/libFuncModel.34.o ]; then
  J" R" W; m1 k             cp $EPIC_DIR/libFuncModel.34.o $tdir/0 x+ Z# w0 Z  [
             $ln_default $tdir/libFuncModel.34.o $rundir/7 L$ `/ f2 s$ l/ N$ _" e
          fi3 r5 T" }* h4 \" u8 _, n4 H1 e
        fi
. d# c( q5 \% j9 P0 z" t: A        #Set the IBM flag to enable more shared segids. i9 C: r0 V; _% [# [& T( R# R
        EXTSHM="ON"" R" k1 K- j- g* ?+ l
        export EXTSHM) Y9 V, j. G: V
        ;;
/ v5 o% r/ W2 p6 y6 e: h( [  S    *LINUX*)   
. d2 q0 r) |# j        suffix=.so
- i& \) j5 ]  W3 _" A3 z        ld_err_code=1
0 f& g: Q1 Q4 _, q# v! W4 n        ;;+ _* A7 _! d% ~
    *amd64*)% Y, e% b" U9 j0 u) l6 \
        suffix=.so  a1 Q" y: d( x+ y" J5 G
        ld_err_code=1& h5 K$ W2 p1 x. K
        ;;
6 G9 p3 ~2 M4 A* b# H( a  F. F6 d    *suse64*)0 b1 O% _2 F( G3 s
        suffix=.so
4 g. o/ U6 Q# g6 w  M        ld_err_code=1
& G8 p+ ^: Z& W! I9 I, c/ {% e        ;;) N& m0 r* [9 }
    *suse32*)    7 G  m. L8 U% @
        suffix=.so
, A: \3 X# h$ T% ^        ld_err_code=1
5 I+ D7 n9 x2 S- L& K9 M        ;;
& X6 e" k/ ~( ^    esac1 Y* x% h% A& D2 A2 p

( G$ U1 i) i. z7 T    [ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix"  z7 g- y5 x& ?
    [ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \
  b* d5 C% @% e. ]- F* i! G3 Y        && [ "$cmdname" != "nanosim" ] \4 R" N1 T) ]- s- N0 C6 E) C
        && [ "$has_model" = "YES" ]  && ulib="$ulib $cwd/libModel$suffix"
: L3 w+ `6 X; _# Y& @  J# O( X    [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix"
( f, C( w, _. s
+ }. `2 H4 k5 V# R. Q/ F#Look for command line option for libFuncModel.so
. }+ e+ H+ w. Z4 {- _( A& x7 n3 v#    user_library_next=0: V$ z! e; Q: W3 A! ^; c
    has_fmlib=""
3 r7 Y! K, j2 c5 k; t    for opt in $CMDLINE
3 v4 G2 R+ w, |' R- ~& y, \    do
( H0 f. c2 q9 l$ J      case "$opt" in % A9 y" M) Q  o6 C3 [7 }% q
        -fm)* ?+ N* r6 e( u2 v5 l# G
            CMDLINE="$CMDLINE $cwd/libModel$suffix"
8 A: ]5 K$ k9 e2 s) N, U) @            ;;8 l, R* @7 A  G7 Q; v& W2 W: `/ X# n
        -fm_user_lib)1 i3 E# o1 m0 d( {# o0 |. m
            has_fmlib="YES"# B/ f( q) s" R/ x, [) m3 t& B8 w- L
#            user_library_next=1
. `# _' E, J, S. {            ;;6 K2 l( h9 m! ?
        -xc) ( P# T7 t' Q; ~: [
            if [ "$EXTRA_CAPACITY" = "NO" ]; then* Z0 r( r# ~& b* j7 m/ x/ H: j
            EXTRA_CAPACITY=YES8 z  }6 O2 S3 v9 U
            fi# X$ C+ i7 y% L7 u
            ;;
) `6 F9 s5 z( o% ~4 `#        *)
% ?( q2 g. W" D+ U' Y#            if [ $user_library_next -eq 1 ]; then
$ J7 L! [; q6 n$ U  d: {) x#                if [ -f "$opt" ]; then, F9 t3 l2 W9 H' H: a0 |
#                    libfmodel=$opt
' |7 K6 R5 k* e#                else6 c8 [$ U& ^! h& \8 |
#                    echo "-fm_user_lib: Specified file not found"1 J( v4 _! \% }
#                    echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages
; G- ]- V& f9 P7 Z#                fi
+ g# C: z# ~% b$ v#                user_library_next=0
+ r0 A4 z# q; \0 ]) `  f8 l0 _#            fi& \+ ~& Q, o9 @. x8 \
#            ;;" [, e) e1 E+ ^. J9 R/ L
        esac
  A! O7 V3 r% F) n. p    done
# r/ j# b+ Z( Q6 ?. @# ^
$ Y+ @5 H5 [# M6 O    if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then$ o# h0 e$ T$ i7 C! X, U" J; F; K
        flib=""' C. G% s* x* ^$ E! ?
        if [ "$has_fmlib" = "" ]; then, V9 ]4 G' o: J. R
            flib="$flib `get_epicrc ./.epicrc user_libraries`", o% d: q2 q2 ~2 X) h1 R
            flib="$flib `get_epicrc $HOME/.epicrc user_libraries`"
, W2 f! L2 K5 H/ i            flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`"
9 }8 t. ~: z; h' |        fi
, C6 T& k' G. G8 L) @    fi
8 ?4 F% g; }5 G  \) i3 W
+ D8 R: w. ~2 n' D; w& W7 J   for i in $ulib/ o; f9 y2 E* F  J  l- B
   do7 J7 @% ^* _+ A8 k& O# z1 N4 _1 \
       [ ! -f "$i" ] && continue
+ w- n8 ?8 r# B% j       dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd
5 p9 ~  q. y$ K! l       i="$dir/`basename $i`"
4 d' ^0 ^2 D/ E' @2 B" d       case "$i" in, r. Z( \" @  w5 W0 l, C5 X
       *libCustom$suffix*)    [ "$libcustom" = "" ] && libcustom=$i;;; w- `6 U+ l9 n% @' e
       *libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;;
0 M0 s8 _( |" w9 B0 M9 c: P       *libModel$suffix*)     [ "$libmodel"  = "" ] && libmodel=$i;;# ?* O" e. B4 h  Y; V
       *libva$suffix)         [ "$libva"     = "" ] && libva=$i;;0 X5 U. g* q7 Z- c" H6 t( [
       esac
! M! p" c! n; Q# e       [ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \
" z0 Y& T6 O% C. Z        && break
. o  n' ~3 p# H3 H' ~6 X/ \5 F   done. a: c; z6 g( U8 p2 f/ i

' d2 k6 h% ?0 L! T9 e   # symbolic link shared libraries to .epicrun$$
( H3 p) _: e+ i    cd $EPIC_DIR; epicdir=`pwd`; cd $cwd/ j+ d  f8 k$ E
    if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then- v" B# _( f/ r5 O; |- z
        if [ "$libfmodel" != "" ]; then! l; |% ^9 r0 Q1 s' F
             [ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \& n% Q( Y1 X) W
             echo "Using $libfmodel ..."  && \1 N5 h2 {4 E6 H' u0 J( h
             echo "Using $libfmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE/ Z- P  C/ g  ^
             if [ -f $rundir/libFuncModel$suffix ]; then( {$ M8 A! Z7 x
               rm $rundir/libFuncModel$suffix
4 t& l- E5 ]8 n  P! v             fi
+ d. Z% Q& `- z0 x             $ln_default $libfmodel $rundir
* f1 l4 p% Q6 a  N        fi3 ~% w" G9 |) d% C8 _
        if [ "$libmodel" != "" ]; then
) E. p- G0 M4 D) C3 h0 J; M, p% u             [ "$libmodel" != "$epicdir/libModel$suffix" ] && \* `' x3 j& E- w: {' U2 v; Y
             echo "Using $libmodel ..." && \- T8 q5 ^' R" z% k6 U( L4 q" V' G
             echo "Using $libmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE, g$ i) n0 Q3 {) [
             if [ -f $rundir/libModel$suffix ]; then
) Z. \# ^+ w: U) B               rm $rundir/libModel$suffix
* R: ]  g5 {; {4 R/ x2 H             fi
4 E9 l1 x% l9 S; Q- Y             $ln_default $libmodel $rundir ! K4 A/ g* `$ ~" ]5 D) ^# B- }' c- ^
        fi
7 o- ^' L* S! P8 F0 z. A# [& e   fi
) y$ K$ k: ~" f9 s   if [ "$libcustom" != "" ]; then
/ t) z" ^/ l% g" @, r        [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \: Y% r6 T0 q! X- ~) N: q* i; s
        echo "Using $libcustom ..."2 t, I2 m( c* X/ }; c- F
        if [ -f $rundir/libCustom$suffix ]; then
& e# M( |( `: U1 [9 L          rm $rundir/libCustom$suffix0 x/ \2 i* m* a8 u& y3 m' ?
        fi) H/ I1 C" n% l6 P3 L, j1 x( ]
        $ln_default $libcustom $rundir
2 Q) ~' \/ M3 a. u* X$ {9 b   fi) M# n; T& {' q$ v
7 ]$ K; k3 n& V
   if [ "$flib" != "" -a "$flib" != "   " ]; then
8 ?0 E$ I, }: [# H        CMDLINE="$CMDLINE -fm_user_lib $flib"
' g* I3 B* p9 i   fi
+ t  V* G+ f  [  U3 D$ h( d7 H: T, `& C# }3 v( P
   if [ "$libva" != "" ]; then
; a& t. p/ ^) k  J: R8 Y        if [ -f $rundir/libva$suffix ]; then
8 g: ^8 r9 H: e& V0 C/ ]& I          rm $rundir/libva$suffix' M) m, a4 o' r- t
        fi6 s6 R8 y! l' `7 q7 U
        $ln_default $libva $rundir % q$ C/ K+ B( L6 ^2 m
   fi( i2 K3 A8 v/ G. i
* m+ _5 L. j- p% Z

2 X. e7 ?  V/ D2 ?' j3 p0 `; I    # VCORE design library. W$ s6 w% ~* G$ v) F+ B
    if [ "$vlog_design" != "" ]; then
. B: |2 Z9 Q4 |7 r$ u9 G8 H3 Y( ~        $ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`' j( {. r4 a3 G$ V
    fi9 X. V2 ]0 n6 _3 E$ _% [% I3 \5 o
! r/ g: C, E8 ]' m" |$ @# x, ^
    if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then4 R8 P+ J: [* g3 q( f$ r( }' t7 d0 Z
        EXTRA_CAPACITY=YES
% U) `' k, w; @# {5 K& u& `    fi) Q. }: u! p, f3 r: K) d+ l8 t) ]
' u" L% e. W, o* D, j, a) x' }* r
    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc"0 u! W0 `( O- m! b
    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc"7 ]3 Q8 @; q4 g6 u6 R$ M5 e% n
    #Create temp file if dual process is on# F/ p& G  p5 X% _8 U) l. ?
    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then5 I& q5 A- N: E3 l+ v5 i
        if [ "$EXTRA_CAPACITY" = "YES" ]; then% s; \  f- U8 ?3 y( y  E3 L1 A
            touch $rundir/rpcidfile/ |3 k. d+ F7 y; ]
        fi
* ]; f% ?# M, S% C6 D# a    fi$ i$ p! J+ P: _  r: l' l- E: Z
fi
  @% C' b! ~$ L9 ]7 q/ t9 |) r# y$ p. F
run_cmd()
" v' l# D5 _) Z2 V{
+ Z; h9 Y2 ^$ x4 f  command=$19 u5 D, ~: c( C4 \) [8 F
  shift; I/ L* `* y% k8 e6 M! G; n+ D
! y) ^/ l" G$ {
  if [ x"$VA_FILE" != x"" ] ; then
( F; y  h# t0 l% h+ z7 O$ S     cmdline=$ARGV1 V2 C! o9 f6 P7 k6 Y8 m) e
  else
- W$ l1 X' H" z1 e- f* G; f     cmdline=$@8 V" k% w0 S$ n( h, f1 ?; r
  fi
% E% ]# S* s8 ?' o
5 w0 ?* r  s9 q! y3 P" B  debug=${DEBUGGER:+"$DEBUGGER $command"};
* T% Z2 N$ L: |( S
7 x7 e& P2 [5 N/ Q  # To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a
' y2 a6 v# G4 y. ?3 ~* ^  # so save-restore may work.
+ M& N/ C2 T) X5 u  setarchStr=; @! Y# C0 n" z( @6 s5 w! l  c
  cmd2run=`basename $command`
/ I( Y9 N0 R4 G1 w  if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then( w9 w' n; X  m$ c9 ?
    if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then  t! a8 g8 o7 f( O7 b
      setarchStr="setarch i386 -R "
$ p- v, U8 {* e1 h4 h    fi2 R9 M) P+ d3 L4 T) ?: L
    if [ "$EPIC_ARCH" = "linux" ]; then/ J. [1 ^- ]; u5 x* E
      setarchStr="setarch i386 -R "0 N2 V( W0 l' r5 o; N
    fi
/ ?& P4 E5 A. y. D    if [ "$EPIC_ARCH" = "amd64" ]; then
/ j1 a% a  n9 b+ c      setarchStr="setarch i686 -R "2 D1 l, z, w. L3 W% `& @$ Z
    fi
$ G- \. T1 m! K7 S& ^0 r    if [ "$EPIC_ARCH" = "suse32" ]; then
) Y) d  `! d% ?+ ~- o% ^      setarchStr="setarch_suse i386 -R "
% Q& ~, v2 B1 G    fi7 {6 o  ]* A' h
    if [ "$EPIC_ARCH" = "suse64" ]; then4 \  Q' H9 h" Q0 g; u( f$ h0 V
      setarchStr="setarch_suse i686 -R "; @7 g) K; d' T+ a
    fi+ G3 e7 e4 p* H, f0 u' F
  fi3 \  {. @8 b9 u% V( v" T
1 x: t6 S, d% r: k: V  O! l0 F
  ret_stat=0  D& n, P! G2 {: m4 G
  if [ -x "$command" ]; then" f( @8 E3 U$ M2 t4 d
      if [ "$debug" ]; then+ R8 d6 I6 F2 [" {6 ?4 X% X
        _debug_args_=$cmdline5 x  Y' K* X. ^( y" P4 T
        . .epic-debug; C2 s" q' A% L
      else: c6 N8 p: _0 M+ c2 ~( v0 K
        DEBUGGER=; export DEBUGGER/ {$ j8 M4 }% h' F5 C1 }! i
        $setarchStr $command $cmdline
* e7 _% k. |  U: O# s      fi
' j4 F2 [! ?- A; F      ret_stat=$?' r! h( i$ `' h
  else% t& k# V9 u& R! R
    echo "Corrupt installation, executable \"$1\" not found!"
2 E- i4 A1 ^6 S+ R- h    ret_stat=1) C% V( ?# L3 c. D) R: B! I4 S
  fi6 K! ]  Y8 ~/ i4 L' K5 `
}
/ L' Q; |# H# M6 f6 P9 V0 h5 p) q+ D* \7 E
# keep runing cmd if ctrl file exist
  _  `. T( X+ b. ?$ O8 a7 C' c6 [
$ h  I9 w' O" Z% u+ V3 r7 G, lrun_loop()1 V- ]: v( z+ E
{
3 ?9 B0 ~. U$ W) v( B# _% e# N  command=$1
! Z9 A7 m. t; G6 w4 \- |  shift
$ P6 h% m. \$ u1 h. K( J
9 [0 W5 e% l' d  B  if [ x"$VA_FILE" != x"" ] ; then3 E+ |) z9 w0 j1 C. v, ]$ u* L
     cmdline=$ARGV
' X/ d' V# S' m3 o& Q" }  else
8 [( P- V; ^$ F     cmdline=$@1 M$ Z% f, E" x( k0 @0 x2 ]
  fi
7 O9 e' W2 K1 J/ D" a
- b+ Z# c$ m/ C8 {4 m; W; W1 D  while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do
8 K# u1 S7 S( h8 W2 w/ u    . $LOOP_CTRL_FILE$$
% O( e( X) W! z9 l& R- J5 Y    run_cmd $command $cmdline -banner 2! i5 w) m6 v; X' K# @
  done;
2 l- O1 S& m1 ?9 z* e! w, Y# D& s$ Q: N3 X) U4 `, N4 x2 p* A
  if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then
  e% z8 H: H. A" E3 e    rm -f $LOOP_CTRL_FILE$$" ?! P7 d0 m; w3 Z; P8 K, U
  fi
/ B. \- _" H- B$ c  @}( u4 ?. Q+ W" H  t  m
: s/ Q' {  C% J
har_check_ret_stat()
' }5 S% X4 o) Q8 {{3 O0 i, _: g3 S5 j4 y7 @' N/ s) M
  if [ $ret_stat -ne 0 ]; then 9 _) W, @$ m6 t1 w; L& P3 J
    echo "Simulator returned with non-zero exit status. Stopping."1 v4 M, f3 R$ ^
    exit 1
  T" d5 `9 |6 \: u0 U  fi
0 O4 Y& ^: a' W& Y+ O) z}
) a1 m* Z" X' w9 u( [2 f. ^: Z5 y7 |4 H7 ?! V
#
2 L; I1 y! n- a# k. D1 V# set stacksize and datasize limit
0 X9 y( H! C  n4 O  u#
2 d$ Z8 z6 f4 G: e6 L
* i; N1 ?6 j& }) yset_data_limit
' D# l7 _; M0 T! f4 sset_stack_limit
7 ~9 t2 l; P% F/ x
, L" G0 j  n" v# m8 v#rm -f $LOOP_CTRL_FILE
, U; ]; l5 Y7 D/ A9 J
! [2 h: P+ g" u& x/ hrun_main()
+ @6 s8 C6 [9 L1 L& l- r{
0 M5 q: y2 ~- A+ hif [ $is_special_har_run -eq 1 ]; then
' ]; j# ^8 R: V# t9 g: z% A- V0 J  if [ "$har_ofile_prefix" = "" ]; then) |$ E' `7 p  p! B
    echo "Wrapper bug. Notify Synopsys technical support."
& P' H% D+ g( O. A4 P1 e    exit 1* b! g. Z! T5 V, ^
  fi
/ K6 F( y5 q- R  i  if [ "$har_hilo_file" = "" ]; then
, j. x0 k4 ~' u& \5 b! Y! Z    # no user specified hi lo file - do both runs. Q" ?$ `0 p- T& j
    run_cmd $command $CMDLINE -har_one -har_setup
% ^8 o6 B. W  {/ I    if [ $ret_stat -ne 126 ]; then  ?/ ^1 U4 [! j% r' }3 _
      har_check_ret_stat* |/ M) p6 h% K- i# |# O% ~: f
      if [ -r $LOOP_CTRL_FILE$$ ]; then5 w! z  S' ~1 o: Y: A
        run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl% ^7 V; O! i. d2 D6 d. K
        rm -f ${har_ofile_prefix}.hl
* B% r7 ^1 d- f* a/ ?; D      else" T8 I  J( A! Y; v) o
        run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl: V$ S% r) s1 G0 N1 }& _' k
      fi
$ S1 ^: z# ~# y9 G( V) m. i+ x! K    else
/ a* I+ J+ S( l5 ~: T8 f4 F      ret_stat=0' d! `2 ?; G1 s1 K: m1 u
    fi
) {# y) F8 a# i4 w: w; o# J5 s6 \  {" V  else
6 |7 ^& i. p) h9 n" |; a" d+ V6 Y    # user gave a hi lo file name( t7 R3 G( Z+ q
    if [ -f $har_hilo_file -a -s $har_hilo_file ]; then
" _' r) I+ w/ T; D, N5 s8 n3 {      # file exists - use it - only do sim run
3 q3 p5 @9 y6 z. u( j' j      run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}
! v0 `2 o. ~7 `1 i8 b# |8 u      run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}
. E. d% d: |  r- X    else
) S/ H, J2 w9 I- }: H9 a      # no such file - generate it - do both runs
% v" I) [  F5 y) a  ?      run_cmd $command $CMDLINE -har_one -har_fnf -har_setup2 b& ]/ m3 A$ N4 |+ ?$ b, g
      if [ $ret_stat -ne 126 ]; then
: i. C1 `# j  M6 L: p- `, H        har_check_ret_stat/ S- t" {( Y9 U# Q/ c4 ?
        if [ ! -f ${har_ofile_prefix}.hl ]; then! ?; v2 U0 `, [; I* L  \9 R
          echo "No hi lo file generated after setup phase. "
  v' \7 |1 \6 I4 S          echo "Contact Synopsys technical support."0 M! N1 n0 J5 Q! ^7 I
          exit 1& B" g3 @* s* p+ J( A9 v
        else. \7 g- o+ ^8 l! _3 y% P
          if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then) m9 x3 M" w9 h+ ?8 I( V9 }
            mv ${har_ofile_prefix}.hl $har_hilo_file8 @: Z( K& d$ X# L8 F4 c" a, P
          fi% x- @9 `6 t0 H+ p9 h  v- z9 n
        fi7 Z, e! b$ V! x6 x
        if [ -r $LOOP_CTRL_FILE$$ ]; then9 a  U9 l/ X; O, m4 u8 t, y
          run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file
. e( d1 g2 u/ s- q% x/ }$ E( D        else0 Y( r2 K* E' T3 o9 I/ W" i8 Z
          run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file# d: d& x; Y( U% T# W# \  Q
        fi4 z- q7 H: C1 i9 ~# O3 c
      else
% ~0 T6 Y0 [8 k' V        ret_stat=0- q2 h  p5 w: [+ _; ]: e
      fi
' f( c8 @, E2 K6 G* w: x; f2 {5 Z5 K- e    fi
  I( F0 `' c4 R# {- r4 |  fi
+ f4 F4 u# x2 T+ l7 P" \+ Lelse  - h/ k) G9 r7 t- y8 |( S' k1 S; G' I
# don't loop if -har_setup6 f$ e' M/ U" T# b
  if [ $have_har_setup_flag -eq 1 ]; then6 p% M( _+ a5 q. j5 O  A
    run_cmd $command $CMDLINE
" b, L: y7 _' r6 F, Q    if [ -r $LOOP_CTRL_FILE$$ ]; then
5 p$ a- `- Y" L8 n- R* d- A      rm -f $LOOP_CTRL_FILE$$6 G' P3 a$ k1 R0 E, d  `
    fi1 |7 I1 W  e/ t3 r* ~2 d; `9 k
  else$ L( c+ n4 X! p  _1 P- F8 G
    run_cmd $command $CMDLINE7 ]% L" h" Z) M, I; n
    run_loop $command $CMDLINE1 m" J: ]' k! |+ N: w
  fi
' X5 M$ V& l. S, ifi9 n. ^; p/ O) }3 Z% b0 k" e5 `

8 A9 i; }% c) t2 `4 Pif [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then
% C5 x' S2 f# e9 R1 O  pwCreateErrDB -w $workDir -e $errFile" t* \! L6 K0 e5 _/ L
  ret_stat=$?
+ Z' a1 v' c. F4 H! C0 \( \* _0 yfi
' T/ W- x0 t. l3 m1 F2 J' P  C}$ Z3 Z8 P8 H) L

: d; O* Z: J2 }  \cleanup_alter(), a5 r+ o! R1 k8 @" o2 y. Q
{3 A) k& i1 ]" h+ n: c2 L2 i' T# T( t
   /bin/rm -f $ALTER_COUNT_FILE 1>&24 m% R% J+ ?  o, r' n
   /bin/rm -f $ALTER_HK_FILE 1>&2; M7 j' i9 |  o; v  L" ]7 c  ^
}7 s1 d' ~1 K6 Q5 g
. x  M( C/ t1 X2 t) l9 P
#generate alter temp files based on pid
# }- O) J, M/ L- t- W4 ^7 s, g3 uALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$; y) Z& y) d) t3 O4 n+ i
if [ -f $ALTER_COUNT_FILE ]
) B/ R0 I9 e% m: X  Y" ]then 7 b, `/ @! L; A% f5 k
  until [ ! -f $ALTER_COUNT_FILE ]
# J' D9 E3 i/ V2 y2 `' {. t! i  do
7 c3 O: S+ n: P, Z, K, ^    ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$
  f1 Y8 X; }5 l% \+ ^  V" ]  done
. C$ t6 Q. Q# d; y0 efi
* j- S* P2 o6 R: k1 m7 W4 d( Wexport ALTER_COUNT_FILE
, ?2 X* ~+ v1 c# j" U# ~, ~4 ?) Z+ }) Z" \1 s, i
ALTER_HK_FILE="$ALTER_HK_FILE"$$
9 j8 Q0 l# l' n) s( n# S$ Oif [ -f $ALTER_HK_FILE ]
5 S* {' o1 d# K0 Sthen
2 |5 ?4 ?* r8 P  until [ ! -f $ALTER_HK_FILE ]
. e6 g" {9 ]" n4 \8 i, ~  do
2 V& U0 ~! @% ~& o6 R: K  F! x    ALTER_HK_FILE="$ALTER_HK_FILE"$$: ]1 B: h! E9 P1 S6 @
  done
* i: i2 X# b+ e0 w% jfi* f9 d7 e* Z6 }8 Y
export ALTER_HK_FILE
: k; `# F& h0 C( c7 |8 p7 K. A$ e; y2 _+ _# S5 z/ u
#generate monte carlo related temp files based on pid7 A9 @  P* {7 C/ u- l
cleanup_monte()
( Q" S+ ?; H5 D+ E; o, W) J{  L& P4 c$ E( D3 R
   /bin/rm -f $MONTE_IMG_FILE 1>&2
" |! X+ G& T3 j% G5 v; L   /bin/rm -f $MONTE_IMG_FILE.gz 1>&27 r' X# K, o! o. ~# J
   /bin/rm -f $MONTE_COUNT_FILE 1>&2* L6 Q3 @/ D0 B4 H+ Y4 e3 X+ L. o
   /bin/rm -f $MONTE_CFG_FILE 1>&2
, t% a3 u  p$ a2 ^6 r5 y}
7 ~; R5 E- `+ r0 D0 C
4 T5 A2 }# D4 w8 G* n1 K, _6 H7 FMONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
! C& |6 Q8 Y7 B( H- ^! Oif [ -f $MONTE_COUNT_FILE ]$ \. r3 J4 S: l* B, N4 u9 y
then
2 C- \! l$ U# Q4 g2 I  until [ ! -f $MONTE_COUNT_FILE ]- d$ ^& S: J2 [3 t/ q/ e1 I3 p
  do
% B; Y8 f2 o7 y0 ]! U    MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
7 o4 B4 R2 }' z0 y" c  done- u. w& _$ U  l) q* n
fi0 X. c8 W0 {$ |4 T/ U" Y
export MONTE_COUNT_FILE9 l; C! B. b5 N$ F3 _
) c# v* u, ^* k5 s% L
MONTE_IMG_FILE="$MONTE_IMG_FILE"$$! o0 ?+ Z) s+ n6 t$ t% O/ q
if [ -f $MONTE_IMG_FILE ]7 N: ^1 I" v4 G
then
) Z% e1 @, C) p- U! l5 ]" Y0 w  Y  until [ ! -f $MONTE_IMG_FILE ]( A+ @: V; q' R, f7 S7 u
  do3 Z. Z: A9 M7 b4 R. J+ w
    MONTE_IMG_FILE="$MONTE_IMG_FILE"$$8 I) v: O4 s: E
  done
& e" U, r- t0 ~$ Zfi
7 \3 G  P, j0 Z& U$ _: nexport MONTE_IMG_FILE9 }/ b% Z7 `/ }: }

2 W* W9 m" |4 v* [" Y" LMONTE_CFG_FILE="$MONTE_CFG_FILE"$$
1 o( t: S2 V) S+ `if [ -f $MONTE_CFG_FILE ]  D* G. A7 O* P* q" J' L
then+ l3 Y8 e- G- k1 E% V1 U) u  W
  until [ ! -f $MONTE_CFG_FILE ]
: ]: b. h0 h" j2 h( @  do
. X+ E5 g5 r6 W! _9 q1 j1 Y% ~    MONTE_CFG_FILE="$MONTE_CFG_FILE"$$, u; _. y4 }2 V0 t8 ~! }6 O" f5 f
  done! A& |1 |& M+ y
fi
% t/ [* F' f% a6 O
: q# }7 t- i& {3 }0 ~* J7 F% B0 M# main iteration6 g2 t7 R: |" S+ ^1 _
run_main
% A! n7 o& J7 m! i# P/ S  ^/ A$ R' K3 W0 S0 c5 J1 n
if [ $ret_stat -ne 0 ] # N- V4 y$ y4 B5 F- w4 l$ T% N, k2 z
then
8 m2 X$ y. d: H4 J- `2 l  cleanup_alter( z/ _1 v; c, R# D# m! p
  cleanup_monte
5 g. S' a: h, @1 \, Y3 u8 S  Exit $ret_stat4 `0 A, Q' I$ Z( S; l; Y
fi/ Y4 A" Y0 P( {7 ]' @3 ~2 G8 i. s- b

- v& x+ F% z' [. x. U#Alter related iterations. r' {; x" u  C% Y
+ \$ `7 P( w! U" D- i1 u5 J
iterations=0* H2 ^9 E) o# O, F0 O
count=0: T' Q- S( M' x9 t3 m" b3 T# n) k
if test -s "$ALTER_COUNT_FILE"% }. ?$ D5 c4 T2 |. K% b" @4 `5 B
then
% ?" U( N' I& d+ d+ S  if [ -r $ALTER_COUNT_FILE ]; then% Z( V& Q; p+ E8 P( n! j" s
   exec 7< $ALTER_COUNT_FILE
8 y8 P3 c' S2 z3 C- L   read iterations <&7
% I. L+ O4 Q- Q- j1 Z6 q fi8 ]3 c; G+ c3 h! j8 k% U5 i
fi
0 U7 k7 M: R  ^: Y) L- c4 N% q6 r8 a$ X6 e. V( _6 b' G/ L  m
trap 'echo Program Interrupt; cleanup_alter; exit 1'  2
4 E& A" [0 O1 twhile [ $count -lt $iterations ]5 w8 _! i& `# m/ f  `, A
do
  @6 s) w' D( e* c; { count=`expr $count + 1`
. E$ X. x! W) {3 D" @ ALTER_COUNT=$count
! u( w, R$ `8 k export ALTER_COUNT
- W6 T0 z' x4 b8 K* o, s% F+ m" s4 v% y4 m0 j9 m7 v; N
run_main
: Y) x/ f9 ?8 t% B, |
! o$ t( R. }" w2 L, ^done
+ x; a4 s6 f0 e# R  N( v4 i
0 m6 X8 y: C( E2 l#Monte carlo related iterations+ Y5 X: T! w# l2 U( Z; t

% N4 ^- j: Z; ^' W. Nmonte_runtime_summary()4 w, v: O2 M7 n' Y% a! v
{- ^6 n1 \& N1 h# [% A
  keyword_1=real
4 ~- e9 @. u) B8 v. [  keyword_2=user! T$ a- S* q- }! g
  keyword_3=sys
- |0 k" T) S! H& n& o  ofile_prefix=nanosim
. b& _) ~0 D6 c% K5 @7 _- \) E, t/ g7 H# l+ G) f4 `
  if [ ! -z "$o_option" ]; then
* s4 C. M7 r( r% L! {$ [- A8 `    logfile=${o_option}.log
& b& y. e" m+ }/ U4 T' Z3 z! l/ H0 r  else' ?/ f* }2 m* P' {9 p" S: j; G& o
    logfile=${ofile_prefix}.log: c" i" b9 `6 P; ]1 K
  fi
( C; Y) ]8 ^/ L2 w! @/ A
9 |; y/ g5 N6 d) j  if [ -f $logfile ]; then
) ^6 K* k5 i* H+ n' `    echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile      4 f: l6 D$ F3 t, L& ~0 Y: a
    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
/ z4 c/ Z6 X1 g, d' o  fi' k, Q2 U6 O2 k6 l' i! {2 b
}
: }+ E% H4 q" {( L# Q$ z" w0 R. d" P- }
next_monte=0* M- I/ N% m6 f. j/ s
cur_monte=0
) m  P5 Q$ N& F+ b" T$ t+ A/ j# k( G5 r" e8 y
if test -s "$MONTE_COUNT_FILE"
$ w6 E: P1 }" x) \then
: D/ y0 w* {) j' X  if [ -r $MONTE_COUNT_FILE ]; then
3 N: ^5 X! X4 T   exec 8< $MONTE_COUNT_FILE$ M5 |4 y( c( h4 _+ b/ W
   read next_monte <&8; ]" I- d7 q0 T5 ?0 B' U" {
  fi
3 a# {: `5 H7 P7 R0 D( d2 ?, Nfi
. E4 C3 ]  m+ G6 I' |/ g5 e' Q) H2 O, [; x1 ^3 R! g7 H3 u
trap 'echo Program Interrupt; cleanup_monte; exit 1'  2
6 e! L- M0 M7 Swhile [ $next_monte -gt 0 -a $next_monte != $cur_monte ]
2 M  R0 h) a8 U) e9 ndo7 E# m, n: m0 f) d6 M* b
  NS_CURRENT_MONTE_COUNT=$next_monte9 Q* d) w9 Z# W1 O
  export NS_CURRENT_MONTE_COUNT
! R, E! q0 Q- U4 e
- X: ?% U/ j' A6 D" o! q% q& s' m" N  echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE
: X" l% ~- ~  T1 T7 u! C1 d  CMDLINE="$CMDLINE -c $MONTE_CFG_FILE"6 n9 `6 U- \; c3 Q! q$ t1 i; v
  run_main0 V% T" \- e5 q+ N. I3 m7 ?
, \1 f1 P% B! S
  cur_monte=$next_monte
( ^3 w5 r5 f. a; z1 b% j3 ?9 o7 l# k' C  exec 8< $MONTE_COUNT_FILE4 _" e5 A8 _7 S& F  |* i- d
  read next_monte <&8; V% j3 U8 h" z
done& z: e/ [3 B$ v* `; ]
4 v3 U/ {/ ]- W7 T* A
if [ -f $MONTE_COUNT_FILE ]; ]& |* K3 |& H7 w
then
9 s6 o3 h) u# W4 c. @' T9 s  monte_runtime_summary' |/ I( }: q/ T+ r! w+ l# u; x, W
fi+ H5 t2 u) C; O1 j: c
# c# r! r4 z, C! O6 Q' B4 _
cleanup_alter
( A+ X* E2 F# C" q% T  ]3 mcleanup_monte. I( Q' ^/ c$ p6 G! m4 G# |. ^/ ]

, e) P9 v, F( ]" R( v' M! N$ _Exit $ret_stat

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

使用道具 舉報

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

本版積分規則

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

GMT+8, 2024-6-8 05:48 PM , Processed in 0.196025 second(s), 16 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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