Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

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

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

[複製鏈接]
跳轉到指定樓層
1#
發表於 2012-5-6 13:58:13 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
10Chipcoin
各位大大好:! @8 C4 m5 D' s5 w
                      小弟執行nanosim時,卻無法跑出視窗來,有個錯誤可是我不清楚該如何解決?問題如下
% N2 i8 d1 V# V/ J                      [: 113: 64: unexpected operator
7 ^! k' T! j, l) M/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim: 1: Syntax error: Unterminated quoted string
1 g& O  E& w4 p0 s有大大遇過這方面的問題或是指導我方向去解決, 謝謝. / Z3 u4 J2 m# w4 g( b/ ^/ k5 |
我在猜可能是這個檔案內的文字需要修改 但不知道該如何修改?5 f1 Z. ^1 n. b# l
以下為/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim 的檔案內容:; `8 F7 e$ z4 ~5 @; I7 n+ h9 {. U
    #!/bin/sh* M, G6 q' G! ^9 y+ M  b
#( o6 c' _1 r$ c) m4 m( ~4 ]. \
# Copyright (C) 2001 Synopsys INC, Q# ^4 a, T. R, M8 b  F  R
# EPIC Dynamic Simulation Wrapper (DSW)
' a1 N  Y% }' n% w$ |) v0 t; Z#
+ |: Y) [& B% B  Aeval ${DBG_EPIC_WRAPPER:+"set -x"}/ ~1 i1 {: V7 O' j3 J/ t+ R

/ G5 E5 c$ S$ r5 f- ~$ x$ _if [ "$EPIC_WRAPPER_DVLP" = "" ]; then
( G' W& g7 T9 x2 l6 `) m+ ~    TEMP_ARCH="$SES_ARCH"
0 b3 |) J& i1 u* Y7 }- Xelse1 Q# j4 b% S" D
    TEMP_ARCH="$EPIC_ARCH"
# a: \( C! O* Z! z  |4 i$ D9 M6 Gfi9 J; q4 m9 |( T3 Q, s

+ P3 h6 m+ j3 `8 ?scan_for_hva_args()
6 Y! d5 o; d! L{4 `; T' L7 \* h, j
  /bin/rm -f hva.init 1>&2% P  S- G1 J9 W: O6 p% y+ s
  while [ $# -gt 0 ]; do
) C9 R4 C7 \+ T8 }    case "$1" in
( X) [- k& ?9 `! f. @( Z      -vaf). N5 I8 |+ B, H0 L- M% U; q" x. b. a0 _
           have_vaf_flag=1
, z3 r1 U, j- [; q, T           have_va_flag=0
3 x+ ~, L, N4 z5 w. z           shift;) {' H# t6 v+ o& R. f
           continue;
- u' B# P) X, E( ?$ o        ;;
* c, A& a; H7 c- P" j+ y3 V; q      -va)
/ c- j. r; J: K           have_va_flag=1  k+ \, w, C. `6 N% e
           have_vaf_flag=0, s9 F$ M& w# k$ m7 d9 ~, x: z
           shift;  Q- u* v7 V# o! B5 j8 f4 _+ o
           continue;& O5 s7 A( O. e, A/ U, U
        ;;
4 u3 B! Y; K: B2 F: M/ @1 M% }      -*)
$ E/ Z3 l' w5 z9 S* U0 R- M           ARGV="$ARGV $1"; U. A- U# Z0 }( R8 ?) ^( S, f4 ]
           have_va_flag=00 \% P1 L. O/ P" }% b
           have_vaf_flag=0
6 E/ g' ~6 q- Z) w: ]* I) U           shift;
8 H+ O1 d3 e  s% }           continue;
6 h( M0 v! `9 n8 ?        ;;% h1 F' x) H8 ~
      *)
# u3 r9 `1 F# x9 e# ^           if [ x"$have_va_flag" = x"1" ] ; then 5 F. S: U8 M0 r( P1 V- G+ e  b
              VA_FILE="$VA_FILE $1"" p2 {) i0 L8 N: n: x
           elif [ x"$have_vaf_flag" = x"1" ] ; then + c) E9 p" q5 g& O' l  ^9 M
              X="`cat $1 | sed -e '/\;/d;`"- W4 f9 p5 w; y- l" s/ A6 l1 X* l
              for token in ${X}; do- R& {( g9 B& S; k; M( k5 z
                 VA_FILE="$VA_FILE $token"5 f; a, B, H* H1 M0 i- {6 l6 p2 K
              done
. K$ c7 V8 Z0 Y, d2 @           else
& r" `0 P/ J! Z3 E$ T2 a              ARGV="$ARGV $1"+ Y+ h" z8 r9 |- N9 y3 I- M
           fi' e/ b" g6 g" e% ?5 Q" [+ b; N
           shift;9 g, L! r- X3 u$ \1 M, T
        ;;" Q& g# P3 Q8 K& C4 K  y$ k! N
    esac
+ d& T6 g6 p3 m4 Y5 D  done
" |; j$ X/ }  R; j
. s! P8 v+ J4 g( m2 a. H  if [ x"$VA_FILE" != x"" ] ; then 8 f: Z1 k! _1 k5 [5 H' G- C
##     /bin/echo " xxx ARGV $ARGV". S# u+ r0 F! s
       /bin/echo "choose nanosim $ARGV ;" > hva.init, a4 \6 a3 z  z% N
       echo vcs +ad=hva.init $VA_FILE -o simv. R+ c2 m( t3 p; R! h
       vcs +ad=hva.init $VA_FILE -o simv& n4 Y) y- ?- r7 c
       exe_status=$?
/ ^* f8 K6 @! X. w       if [ $exe_status != 100 ]; then
" A) H4 I9 {  S( n3 E; w! G/ a          /bin/echo ""
: ?3 e* \" }: `% `          /bin/echo "ERROR: Execution of vcs exited with code $exe_status"2 v& w/ t0 F/ x/ V- n9 F" M- h  n
          /bin/echo ""
% P) o0 ^" Z  o- A% x- o5 T          exit $exe_status& r! z5 Z* q4 z7 i
       fi
$ j+ C" [9 k$ s" P  W       hva_files="-n simv.daidir/amsVD.ntl simv.daidir/amsWRAP.spi"
! Z# Q7 j5 C8 z$ R' E) T& i       ARGV="$ARGV $hva_files"- R6 Z7 O. n7 P) a
  fi/ Q1 ?& I! F9 f2 ?
}# j; W  j0 [6 {- j" M6 X% U
#-------------------------------------------------------------------------' D; }% \& ]. L# |. H

* g4 Q9 P; B. X" ~! q0 Ncleanup()7 E9 f4 i( y5 k; U: n$ s
{
! q; A* p2 n) q9 F    if [ -d "$rundir" ]; then
' G+ Y" p5 i+ b& J; D+ Z; s        # On AIX, a .nfsXXX file is created if libModel.o is removed4 Y3 D& c: g7 h
        # so .epicrun is not removed because directory is not empty.
5 u7 n+ W# Y( F2 r7 K        # Solution is to remove it again if the first rm failed* l% |" \; G8 `( H- U
        # (rm -rf $rundir || rm -rf $rundir) 1> /dev/null 2>&1
* \& @# p5 W/ F. o        if [ "$EXTRA_CAPACITY" = "YES" ]; then
' R  H  a8 W- a& ?! N        chmod u+x $rundir/rpcidfile
2 x1 N# e) o3 i        $rundir/rpcidfile8 |8 E4 Q9 m2 T8 Q, S% }
        rm $rundir/rpcidfile
, ?: ~: v0 W7 L# m& f* C( k4 f; |        fi( v9 J* |# l: n# i& M$ n
        rm -rf $rundir/ t& R) E! T$ M) {! c- |

* e( c! i6 k8 w6 Q/ i( t        #Due to NFS problem, we have to copy files needed to
" O1 h' G8 o6 f1 r        #/tmp/<temporary directory>, then symlink's files6 f3 P- Y- k' a5 t# \* G
        #to the local temporary 'rundir'. This avoids the problem% F6 b: h7 n( b7 ?  z  X
        #to remove 'rundir'' }; \! |0 W# [; d5 V5 d# S4 o: N* J
        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then! g1 T$ N( p" P
          if [ -d "$tdir" ]; then
/ w/ J9 h! t& O            rm -rf $tdir6 a4 C7 X/ R1 Y0 i
          fi. M, P2 C3 g$ x  C8 b: N
        fi
2 h9 m8 V# T3 a8 |; N    fi
6 o6 k7 k9 @& u) I+ O/ E. ~" k* [    if [ ${exitstatus:-0} -eq $ld_err_code ]; then% y9 ]1 L* Y/ W; x% p) |0 p5 j* P
        [ "$has_model" = "YES" ] && rm -f $cwd/libModel$suffix
% L  \) ^2 p& u% m( _& @        [ "$has_custom" = "YES" ] && rm -f $cwd/libCustom$suffix9 k) E0 }& F* W$ L3 u, I+ j
    fi" }1 W0 F& p# P) B4 ~" b, y
    [ -f "$EPIC_SCRIPT_MESSAGES_FILE" ] && rm -f $EPIC_SCRIPT_MESSAGES_FILE 1>&2
7 A1 q8 [2 S& y# J; W3 O    exit ${exitstatus:-0}
& m; b. a" F6 ]. j3 I+ |}
2 {7 `  e. n1 f) N4 i* B- [5 C$ s6 `9 b2 z5 u
Exit()
+ B) \* j( T& s- A! k{6 i; `" m; E7 h6 X4 l4 v" t
    exitstatus=$1
. g+ p8 \% P: V    exit $exitstatus
- f! ^( m  z, u" W. I}% m; E% c6 i# J
0 [/ b3 o1 Y, j! k
# get_epicrc filename keyword  z/ k1 i7 Q3 f/ E' X
get_epicrc(): q) \/ R: U) a: L
{
7 @7 d4 G# E4 v9 p    [ -f $1 ] || exit 0
! j+ y6 N" y; `8 a1 X* i1 ?1 h    key="/^$cmd2:/{print \$3}"
7 F7 g7 a! E6 B$ Z$ V6 I    awk -F":" "$key" $1. Q: |4 E$ {+ A1 U
}: M. J# j6 q/ U3 O' d
: D3 l; L4 M  d7 U, O
#; N  c% a- b5 ]2 P0 e' h, d
# set datasize limit to hardlimit
( j# ~; x) T7 V3 _% s+ ^, \#- a2 I) E3 u- }# Q. D5 Q# O
set_data_limit()
, u7 f3 J. o% X0 V3 x5 T! x( A{
. w" T" Q% Y/ S3 Q    dbglimit=0  \8 Y2 Z$ T& t7 z2 C% m  _
    hardlimit=`ulimit -Hd`
) n* f0 }0 N$ t- p    softlimit=`ulimit -d`
' j; L$ `1 Q; _/ h( t" Y- @    desiredlimit=3500000
: w' u. L+ y9 f8 s( a    hardisunlimited=0
' t; z. x' e  e( @* Q1 [    softisunlimited=0# g5 `* Q3 _6 p  L1 D8 B0 @
    is64=0; I4 }0 R+ m- O

4 U# S- V% B" h9 ?    case "$EPIC_ARCH" in+ v) c+ z! _8 o+ w9 u
    *SUN*64)# c4 O- V- @6 k2 d
        is64=1
" n& Q$ I  [  Q        ;;
  S( e" u5 R# J6 L    amd64)8 x6 @7 O# g/ R* {* {6 d9 v4 S$ q/ e
        is64=1! k  q! M4 {& h
        ;;
% |/ ]7 J4 A8 J    x86sol64)9 S% t% H. x9 O$ q
        is64=1. e: ?- J% z8 Y$ f
        ;;
9 [) F( F$ X: v$ A" T    aix64)
0 Y; E6 D  A& {+ q$ B, h        is64=1$ _1 ~7 t3 _. ]' t2 o& M
        ;;
4 L2 n7 Q& L& n  Q; ^    suse64)9 \5 j1 h' |7 j/ H6 c
        is64=1& q" o1 c# o& Z/ A; n; L
        ;;) Q5 l  g9 Z: |' M9 D" W
    esac: [( p$ m( r- _) p5 H

1 q4 }3 w1 y$ L+ _+ Y8 N    if [ $dbglimit -eq 1 ]; then
5 n8 [' H* V' o8 ~; k. o1 @6 e        echo hard $hardlimit soft $softlimit# T$ Q1 i5 [  T; G7 u) k
    fi
4 P% T- ^; h( r+ l8 j) y" C! U- {" z
7 F+ Z* J' |# P  m    if [ x$softlimit = "xunlimited" ]; then1 x, ], ~6 E* V) y
        softisunlimited=1
* @) t2 d0 |% ]" `1 q    fi
2 {) Y1 h6 _7 `1 |4 F* G
( h  s7 ?5 D# y3 f+ S2 ]    if [ x$hardlimit = "xunlimited" ]; then7 n! X1 t9 q' y. z4 D/ s6 j
        hardisunlimited=1/ O& O7 C' ~7 U0 [( P
    fi
! m) ^8 x% P; E( j
2 Z- A3 i8 S3 b3 Z; Z5 b    # 64 bit machine should have bigger than 4G
; I* S7 h- G# m1 a    if [ $is64 -eq 1 ]; then6 K7 Z- B0 _! r/ J1 n! ?
        desiredlimit=5000000! [- o  r, i6 ^- D6 ?
    fi
' r& g8 ~6 ]# Z: G( y: P
- w* H8 j* R0 e% \/ p8 p- o    if [ $hardisunlimited -eq 0 ]; then
8 M: g6 p% q( c% v: P8 L& Z% ~/ ^        if [ $hardlimit -lt $desiredlimit ]; then
! }( \' P( L9 j) k$ Z' C            echo "WARNING: datasize hard limit $hardlimit K is too small.": ?3 L. @0 f  Y
        fi8 Z6 C- V9 _' g$ B5 s
    fi
+ t  h$ L2 B* o
+ ^1 X1 i1 x4 I( ~' {3 ?1 }    if [ $hardlimit != $softlimit ]; then& w3 e2 U6 Q  a0 ]
        ulimit -Sd $hardlimit) J% {5 }) u6 w$ l  K% u
#        echo "WARNING: datasize limit is set to `ulimit -Sd`"
& G2 ?# a( l! o2 R. N5 o    fi
6 s* F2 h$ z( A/ [' f& j) t; G' c4 W7 A, T6 s
    if [ $dbglimit -eq 1 ]; then6 K% U" i  N; M9 R. L4 m' Z
        echo datasize hard limit: `ulimit -Hd`4 z6 V% t) i3 n4 A7 g
        echo datasize soft limit: `ulimit -d`) G  \! b$ i& j3 L; F
    fi6 |2 d% l4 W- t- R5 w$ C
}7 ~+ d5 J* Z. \' J
9 U3 M% y8 l6 B# d. W! S
#
! c+ [8 P+ W4 o- V4 _, x; A% L9 I# set stacksize limit to desired limit
* y; {* U. ?4 `; z! I- w" S% k' z#
7 m* Y2 G' ]+ iset_stack_limit()
% P+ C# F5 K: P" g8 P2 b. M+ y) h% C{
! T, L. F6 T4 _$ {    dbglimit=0
; _, n' Z9 A  `! K2 ^    hardlimit=`ulimit -Hs`: }* x& z) p  H0 V& Q& _, T
    softlimit=`ulimit -s`; o$ A* ~* f3 ]5 J4 Q
    desiredlimit=60000
+ A" k6 B! Y* `& y% i8 w    hardisunlimited=0
9 c) O6 M* A4 Y, p/ K8 r& Q    softisunlimited=0: O/ c% G0 `9 w4 _8 p3 T
    is64=0
3 V( T! K0 R" @. p5 W
* F2 v( ]5 C: C  v- q  Y    case "$EPIC_ARCH" in
1 J$ K3 E. p+ B; T& j8 @    *SUN*64)
6 K5 J. q+ ~3 s8 p* V: Z        is64=1
8 r" N9 u( a4 E; z; }4 j2 U6 s+ u        ;;6 r; }/ a% S2 k( Q* E
    amd64)5 S1 X' q% m7 L
        is64=1/ W( T/ [+ Q8 o" h% y7 E
        ;;
( ^8 F& B7 g0 v. l7 Z    x86sol64)2 f$ r$ s( B" Q5 a
        is64=1
# w2 N# s! d# n' ^  V: w( }# ~        ;;* S; l  Y; j/ X
    aix64)3 A9 `. [% @; P9 a! y* z2 h' V
        is64=1- Z- |% i) u" B0 F# j7 s# [
        ;;
! N' r& s& Z7 T7 ~; D3 w    suse64)% K0 k7 L- i+ l! _* P+ Z; F
        is64=1
8 i' J; U0 r! V6 Y9 ~, m3 z2 \        ;;
5 f1 a4 S* |4 @. m% E3 ^    esac
& o  z* Z, R) L  ?3 w7 i# p5 L7 y3 ^
2 a" ~" f: X+ @& \. n1 lif [ "$EPIC_WRAPPER_DVLP" = "" ]; then1 g  w6 I+ a9 v8 D" i
    if [ $is64 -eq 1 ]; then
6 M  R- \8 h( o        desiredlimit=200000
3 W5 ]% N# e7 h0 Y$ e    fi
  R0 c' A1 b$ o7 \else6 w# V6 n- H# a( W" R2 U
    case "$EPIC_ARCH" in7 z4 ?" ^1 W- B
    *SUN*64)8 v% M  s  `( t3 ~, ~  V
        desiredlimit=200000
4 w; z$ W$ a$ S, \0 ?        ;;' {- L$ o* {9 J/ V: [7 c
    esac9 g. {, r* X+ }* K: ]
fi
5 G4 `) x& m6 \       
0 d- W1 z$ @5 J# @    if [ $dbglimit -eq 1 ]; then$ o- s" q  ?- r* k
        echo hard $hardlimit soft $softlimit, L. P2 @7 H2 W5 v. r% ]) z  C9 g- U6 N
    fi2 R: D; e* R5 p" |* r3 [

4 Z0 [  E6 v. h+ r) T4 L! c+ y    #stacksize can not be unlimited, pick smaller number
& p3 m) V8 S9 v0 G5 C8 H4 L1 }3 Q% N0 N% p. ?5 J
    stacklimit=$desiredlimit4 J$ c' a* i  x1 \7 h0 K- d7 u' P

, e7 @% i/ e, S6 F! }9 N    if [ x$hardlimit = "xunlimited" ]; then
* u" t% S# ]% q7 W$ V        hardisunlimited=1
2 o4 k9 C1 T' o' k: G% Q( F    fi$ T8 b, M+ P* G9 e5 K, N

8 \5 |/ F! t& I) z    if [ x$softlimit = "xunlimited" ]; then
+ b8 o/ }1 Q& |: S, c2 q        softisunlimited=1: W. M# I2 `" f
    fi+ P& ~( h' J! s3 ]
5 }& G( X( V; y
    if [ $hardisunlimited -eq 0 ]; then
) J7 o/ p  N) v$ D        if [ $hardlimit -lt $desiredlimit ]; then. X8 Y7 ~4 K9 r' r7 J, L
            echo "WARNING: stacksize hard limit $hardlimit K is too small."
0 _, I' \' o. Q9 O6 F: m5 g  L, u            desiredlimit=$hardlimit
; u- Y& k, S% W- O0 L7 i1 ?' S            stacklimit=$desiredlimit
% ]' q8 V7 G% @: U; z        fi8 P0 L7 v6 {/ Y/ |. h: r# N7 f
    fi
; i6 ^" l; S. a) Y0 f; r, q$ d! {! N) k9 n0 p. Z2 ]7 g  V5 R
    # desiredlimit is set to proper value (< hardlimit)6 v! ?* u) W( R/ Q6 Z' g- M

6 L7 z2 U4 R% {: ^    if [ $softisunlimited -eq 0 ]; then! X: I( U7 S2 _* T/ ?4 }' m# @
        if [ $softlimit -gt $desiredlimit ]; then
3 r; w& {* q) g/ P; `            stacklimit=$softlimit
  n* J! r- G; A" B/ O3 B        fi
% f& U* n8 i; a+ ^    fi
$ w6 g  c8 f8 B/ f
/ U0 F0 Y# H, k) @+ y" t! Q& Y) A    if [ $softlimit != $stacklimit ]; then
8 I9 n- l  J. p3 h! Y2 g        ulimit -Ss $stacklimit
. Z5 u9 i" ~) C* R6 l" j#        echo "WARNING: stacksize limit is set to `ulimit -Ss`"* }; a( E/ }, g2 C
    fi, l0 i3 X. ~( g% N7 \7 f+ w

* F0 o. s3 V0 J* T    if [ $dbglimit -eq 1 ]; then
' r* g2 z4 `2 f) J9 B        echo stacksize hard limit: `ulimit -Hs`; c# n+ t5 |4 O% a# J, t. b
        echo stackize soft limit: `ulimit -s`0 M4 v, m2 g) a# X
    fi) h/ N4 k& y" m) M( q4 d
}9 o' m$ S3 g5 F$ F/ G1 m
: ^# h% }- P2 e9 }( Q
open_epicscriptmessages()$ ~; |* s7 k( q# N
{
1 L- S8 j3 _5 A( L+ A#generate  temp ".epicscriptmessages" file based on pid' p# g1 Q% W1 c. b# q
EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
# D0 ?) \# d. c% h  ]if [ -f $EPIC_SCRIPT_MESSAGES_FILE ]
' I) _# y) q3 T/ i% [) uthen
. ~+ w, X6 @2 k( F: F9 I  until [ ! -f $EPIC_SCRIPT_MESSAGES_FILE ], H( V% J' _- i; ]- M% [% k
  do
' |# [' D% \8 @2 c    EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$- k6 T7 a# b. y. B" g- d0 o% j
  done  }" v; J. T) q7 d( ?( d
fi' M$ @* ^( q% q- Q
/ {) W8 ~: ]9 r" t
export EPIC_SCRIPT_MESSAGES_FILE7 z) H' U" b: e! h5 t* ]
}
# y2 F* i$ d9 r; u8 k: P3 S6 i- B1 \
* c2 C1 z6 ?2 Z) k) M. W* f( J
cmdname=`basename $0`; u8 b- u/ T, f. L, G
postgres="n"$ U8 V; T; F$ O, Q. a& S
ostore="n"
+ c2 S/ |5 o. J3 g% q$ x- Zgui="n"
9 P$ @) i' y) z" g& k+ _) c, gdatabaseOn="n"
7 l4 l1 m( r4 M# M5 Vf_next=0  {. F3 O5 y6 ~2 V8 A% C6 d/ }$ M6 t
f_option=""" C! p+ X; n; ~
o_next=0
7 k" X& Q, |  z% W: @" \: eo_option=""
9 l: P8 l( L2 i$ ^2 h+ gworkDir=""
  F, @) v: ^: J1 `  `1 x% }! o8 g) JworkDir_next=0
+ B% v. E. r2 U" e' uerrFile="powrmill.err"' P1 @: \) M  d4 m( i
win32flags=""
6 j# B, N- k! E/ Fln_default="ln -s"! m5 Q& X' z. v6 ?

- v' k2 c3 J# F# A0 w/ Yhar_hilo_file=""! A- H# U1 k% x  _7 u/ z. x
have_har_flag=0( U1 I8 h) R! I  y- o" ~
have_har_setup_flag=0
! {$ U  u( X$ Zis_special_har_run=04 w  T7 f) T  d; L
har_ofile_prefix=""
6 I+ ~' P2 f$ S& A
% y& ?7 {% V+ \! W/ d( Fhave_va_flag=0
# X2 P! ^& N! b/ V/ s1 Vhave_vaf_flag=0
, ~2 R$ Q! K& s: wVAF_FILE=""
* ], ~! d! J; s( rVA_FILE=""
, E9 M3 F" Q: r" E5 Z* u* p$ CARGV=""
1 J. e/ v0 d4 a" t2 r# P2 w  ^/ n
. w$ d' [5 o! z5 {6 K8 sORIGINAL_COMMAND_LINE=
& o4 N' W# b& O( DLOOP_CTRL_FILE=".ns_ba_env"" j3 R6 a$ t( z$ \+ y$ A# d
ALTER_HK_FILE=".alter_hkf"' ^" J1 g1 H6 b0 H- i. ?5 z" Y& _9 X
ALTER_COUNT_FILE=".alter_count"% ~; f+ Q% h9 ?' \5 t" U4 C
MONTE_IMG_FILE=".monte_img_f"
3 N+ x& z2 ]1 e- s$ cMONTE_COUNT_FILE=".monte_count": ?$ Y9 q2 V) e% z; }7 @* j2 }4 c
MONTE_CFG_FILE=".monte_cfg"
) }% c6 q. h! r% z" sEPIC_SCRIPT_MESSAGES_FILE=".epicscriptmessages"
* c) f: l2 P0 L4 }; Q
; ]3 E* }& x! R) Mopen_epicscriptmessages $@5 b- ]. v# Z* T2 v+ P; J

3 N6 O# |) y- W: Ascan_for_hva_args $@* L& P8 X2 w. ?, d* g
3 ~$ _) T" [/ t' y+ M% ]$ w* _
scan_for_har_args()- e( Y4 h. `% E
{
8 a' i: `  A; P  while [ $# -gt 0 ]; do$ f1 L! t0 L; L
    case "$1" in- r; Y6 y2 y8 Y# v
      -har)
4 A! D6 n6 E# S2 ~           have_har_flag=1. A; X# j0 N2 h, ?9 V# E$ G
           [ $# -gt 0 ] && shift8 c% A1 z+ U0 N! l; C9 W0 }
           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then
3 a' y4 G, V7 \$ I             har_hilo_file=$1$ O1 K9 Y( G* w/ t8 j( }
             shift0 g* P& F, g; X/ J
           fi9 _; |# s9 m, l/ o4 O" ?0 W
           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then
0 v, t, [( q* L1 o             echo "Too many arguments to -har flag. Only one hilo file allowed."% x- f6 I8 ~) p
             exit 1* s; W2 R5 g( K
           fi
8 C. v; M* k% j9 o7 D9 V% ~; ]. v           break4 w( m+ o; }# k
        ;;' A0 f; i! Q" i1 r6 i& `
      -har_setup)
: N9 ?! y9 H/ F6 s5 u( r7 s           have_har_setup_flag=1, S3 V1 N5 [( X7 l5 g9 a
           break
# \* l/ D& g) Z        ;;5 Z: r* _% a+ o+ C, W  E9 y
      *)/ }. k% @- c. i* k
        shift4 r/ B* P: z/ B# k9 [
        ;;
+ {# ^! F# U( g  D7 t: V1 w    esac4 ~3 }/ s( Z2 p/ I+ U) B7 R  W
  done
1 y/ p+ B! X6 L+ G}2 {5 o# |" D  o3 }+ ~( _# K% U
7 ~' h1 R: }* z  |2 v
scan_for_har_args $@6 Y6 _1 w( j# j- C' K' p$ J2 E

4 Y( l: m# a7 u, d+ ufor argv in $@
! ]6 |$ W) l$ p) R& Pdo
/ M1 M. [) x( d& F1 v   ORIGINAL_COMMAND_LINE="$ORIGINAL_COMMAND_LINE $argv"$ {3 |5 [/ s# O3 H( `
    if [ $argv = "-gadb" ]; then8 v: g% M( u+ i/ N% L% ?
        databaseOn="y") z; y7 `& Z7 n8 F5 ~
        workDir_next=1
( C6 Z; r3 x/ i6 \1 s: h    elif [ $workDir_next -eq 1 ]; then0 i; f1 q4 M8 H5 B  i* z7 p
        workDir=$argv/ u- B. f# a$ ~' `; s
        workDir_next=0
7 Q2 J' U8 l; q; E* t4 C  F    elif [ $argv = "-ga" ]; then
0 K# r9 {* z, z9 g        gui="y") N4 \5 K+ k% k" Q: ], w+ D' j
    elif [ $argv = "-f" ]; then
( E8 I( o: B# B& \; p0 ~* f8 p( i        f_next=1
0 M" K. O4 {: s2 ?+ X- ]    elif [ $f_next -eq 1 ]; then( ]1 i+ I: a: N( i% s
        f_option=$argv
- e* n4 Q5 M5 J0 K& e        f_next=0& ]) o8 y7 ?- E' I3 Q
    elif [ $argv = "-o" ]; then, D/ g3 q! J2 _5 E* B/ {
        o_next=1
) R8 U: p8 h3 F2 ^& t    elif [ $o_next -eq 1 ]; then7 x) U% w! W% t! E# |9 q$ a
        o_option=$argv
- f- J+ N. Z/ _: H' j! H$ `        o_next=0
& J$ t- \' \' ]; L    fi; T& b$ t( F! ^# J* j- a2 z
done; G7 ]& j  P- ?6 G: P5 M: b- H4 ^/ d
echo "Command line options: $ORIGINAL_COMMAND_LINE" >  $EPIC_SCRIPT_MESSAGES_FILE
/ ?/ n- a/ G7 @
0 r- t  F4 N) tif [ $databaseOn = "y" -o $gui = "y" ]; then
7 t. ]6 d+ Z/ z- S  if [ $cmdname = "pathmill" ]; then
' f0 C. s6 v" ~" {5 _5 {    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5"  -o "$EPIC_ARCH" = "SUN4_SUNOS_5_64" ]; then8 w" n9 U; z% Y% w
         ostore="y"7 Z( N$ p0 k6 f/ W4 e  B( H
         postgres="n"
' P% U- [, l8 D% `/ m' k     else
; l: \5 j7 s9 D        echo "athmill GUI is supported on Solaris platforms only" 1>&2 , y0 c* Q  M8 z' L: W% Y
        exit4 _5 s0 g* g! K! R1 v+ R3 S! v. i7 ~
     fi
2 f7 \# S$ @. Q/ ?- P7 o5 X  else
% n) u( g  u7 k  H8 ]( H- }/ ^+ o    postgres="y"
0 v5 Z: C" }( d8 J6 q         ostore="n"
5 ^7 D" G2 L# g+ A7 m  fi
4 K8 [) f5 V' Sfi
# C$ H4 ]9 x* y$ l# W. L7 K
" [! `* B: D6 N7 W; ]0 f+ x  v# ]if [ $gui = "y" ]; then0 E- C8 x: }; F" [
    if [ $cmdname = "powrmill" ]; then
' A4 r1 N2 x1 x( [( c  A        pwga $@% K. |5 `9 j+ e2 C$ g8 x2 L/ \
        exit% o9 i/ z0 S8 L3 ^' e
    fi
" a% L; X7 a6 c2 C1 R+ w# ~
" M; j+ H+ ~" H: P& P# ~* G7 {    if [ $cmdname = "pathmill" ]; then
0 n3 _+ M1 M& q: z        if [ $ostore = "y" ]; then) Z- H7 a9 Q7 {; g; }5 y
           ./pathfinder $@
, q6 N6 `0 A( U* k/ @: M) B! N( {           exit9 e9 A. o2 R, n( {. m4 E$ \. \
        elif [ $postgres = "y" ]; then2 ]5 |9 Z' i0 \% f  y$ \8 K
           pmga $@
2 C) A9 m2 _& T) k" a1 S           exit6 }: F9 k- z. v: s$ T& f
        fi* K2 j2 u) ]; G, |1 _
    fi% V2 l6 x+ R; G  b- ?
fi
# @& b* |! f1 e/ w- z
/ t* L% [- U+ t* N' Y) p4 Q7 e3 `0 a: Jif [ $databaseOn = "y" ]; then
$ n: O2 }  w8 P7 T& u! V1 y   if [ $ostore = "y" ]; then3 C8 `% j6 x* T6 x0 y
      if [ -z "$workDir" ]; then# o( C8 S+ f+ {1 v/ x+ T
         echo "Error: Missing argument for -gadb option"  z! r* ^) k$ J2 k1 @* y! j1 s
         Exit 1, X2 V' W9 P$ v  S
      fi
- g& V. G' t2 G) Q$ e, M0 H   fi
& I$ k. u. G2 F. s$ Z   if [ $postgres = "y" ]; then
8 {4 \' M& L2 |% S% }3 V+ h6 I      if [ -z "$workDir" ]; then' s! P$ {$ }& d# e
         echo "Error: Missing argument for -gadb option"1 R" H$ K0 \. |% w
         Exit 1
' F9 f3 r* V' ?5 l; I& `      fi: j) B. h9 S& s( W2 y' ]
   fi
( [) z0 l( H8 u( y% Ufi5 C- j: m3 o' C# f( g; {
: R  Z9 m( [/ m$ }$ V7 ?, O
if [ $postgres = "y" ]; then6 [4 X+ k: s1 A, P
% @" p9 y9 u: ?1 @4 D$ F
    if [ -r $EPIC_BIN/scripts/gui-init ]; then# ~# j3 _5 q& Z, n4 K
        . $EPIC_BIN/scripts/gui-init
% N5 d$ u5 }# r3 S& u    elif [ -r $SES_ROOT/bin/scripts/gui-init ]; then; B% H+ r  S' @
        . $SES_ROOT/bin/scripts/gui-init( {0 Z" A" e# {' N9 r* ?
    else
$ d4 f, w2 a. h4 e$ K6 W        echo " ** Installation in \"$EPIC_HOME\" has been corrupted!" 1>&2
/ K/ R+ s! K1 E+ U8 S! [        echo " file bin/scripts/gui-init is missing." 1>&29 g. F' c7 ?4 z# W' G5 N
    fi
" }' R( m& J: T4 ]$ L$ l/ D9 {' ~+ ]) [7 D* }0 q3 G
    workfile -tool $cmdname $@
. b+ [! E9 o$ Yfi+ d& C& e- U! R4 n/ ]

% v4 q8 C7 `$ W3 Wif [ ! -z "$o_option" ]; then
% r/ P. e5 [, ]  s6 h    errFile=${o_option}.err; @  Z  @. I8 e% t  h2 q; ]4 `
elif [ ! -z "$f_option" ]; then
. e; @6 I3 {# L7 d. Z" n* Z& p  U    if [ -d $f_option ]; then+ ]$ n6 o4 e9 L1 m6 y" X
        errFile=${f_option}/powrmill.err. f, B4 z7 Q- t6 O6 J5 |
    else errFile=${f_option}.err' |; P0 W0 X7 z* Y/ C' n- }
    fi
( a0 b0 @% N8 m" _fi
4 [, N5 M" k* g% y7 Y" i- q2 |1 u* t4 I$ T4 g; F7 a

( ?0 ~+ q0 c  X% w0 X" w) E; vif [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
% a* `3 @! r& S  k) w  rundir=.epicrun
. j. q9 z- T" q0 A/ \$ Zelse
. Z6 H! J% N" o, V) j  f  rundir=.epicrun$$: w5 Z% i$ c  o) U' ~6 ^1 S
fi6 {) Z/ b3 M+ S
3 _) n/ ^/ G( C2 H
libpath="$rundir${EPIC_DLIM}$EPIC_DIR"
8 [" ?" {8 h" d- _3 }% O2 _  W& b: @5 S- P: `
cwd=`pwd -P`
9 {0 \% d' r3 O. o. z/ f- T/ Aif [ $cmdname = "acehdl_w" ]; then
) ~- D9 o& {" y2 f# }6 }7 R" [  cmd=`basename $0 .sun`7 K% C8 f# B3 r, S4 R
  cmd=`basename $cmd _w`  `( Q4 K2 c" g
else1 d: J* V7 |1 d1 i2 `) N
  cmd=`basename $0 .sun`
* }) g7 S; ?7 @2 mfi3 K& [  N: t4 z5 I, ^+ Z) W, [) A

& y; m8 n5 a- ~+ A5 B& s% b. qcommand="$EPIC_EXEC/$cmd$EPIC_EXEX"& l: @0 t& ^7 D0 u7 H3 @/ x
[ ! -x "$command" ] && echo "$cmd: not installed!" 1>&2 && exit 1
6 t6 P5 i2 v1 `- B- N0 N5 ]& h0 G/ c3 o2 j; r' J
# buildmod extracts -u/-fm options and calls genepiclib
% U  q, X1 ?0 X; s# K+ p. A0 Q6 @# It also set the remaining options to variable CMDLINE9 w. Y, C9 p) x; E* P
# look up in .epicrc for -fm & -FM parameters
" ]6 S* [2 z) E2 ^4 \. r. l+ ]! b9 R/ @$ W
fmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`", f; ^" K2 W9 W2 e
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`"$ d; @3 p5 R- x: D" t
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`"
/ S0 B* G  x! X: \ 3 ?0 S0 S) \% D+ a/ U% H
FMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`"% k% Z! A1 C4 x* \# G
[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`"
8 C5 b% j# z& [" v9 S/ d9 n[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`"
9 }; v/ y% {5 r* ~( o) m& P
7 H. J! {9 [$ Rif [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then( j. c" Y& @; {' L
    # note that the buildmod script will set the CMDLINE variable
) ]/ t# E& s, d( a8 M  G* Z* v0 A    . $EPIC_BIN/scripts/buildmod
2 z& B, h, e, v  u# z8 b- \( n- M+ Y4 r
    #echo "This is the value of cmdline=$CMDLINE"* l: U# V% H7 [0 V: D
    #exit 0
+ q: r0 G# a% R: {" _1 w* p* p" e% f6 c' E. H8 a
    # if a new timemill/powrmill/pathmill built, run the new one- G5 J; \, W9 L/ g6 K3 V
    [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX"$ B9 v& V0 y& j: W4 C" P
fi7 \: q- j  L/ D6 \0 j
; H* Z9 w8 `# z- [+ Z# a
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then
1 ~1 Z0 u, g6 q9 P2 z+ |  if [ $have_har_flag -eq 1 ]; then
( s, W  p3 b7 v  [5 R- @    is_special_har_run=1, `' ]" F4 O( l) g
    if [ "$o_option" = "" ]; then2 t( @* Z4 J+ w8 A: T: |' c& S4 n
      case $cmd in
( T; m; ~# b: ]1 N        timemill)
. m) f, J8 Z6 ~5 A/ T3 d+ R1 W          har_ofile_prefix=timemill
& k& o) Z8 c+ R; A- H) x          ;;
+ `3 L' _7 d3 b9 b        powrmill)  `, j$ {( C8 C& C- M
          har_ofile_prefix=powrmill5 N3 B3 p% P8 |1 e* a
          ;;8 q6 v/ W" T4 a$ \
        nanosim)9 s& T+ n# Q" X# w' O+ E
          har_ofile_prefix=nanosim5 K! R# n/ S. W- s% `* v2 C% `0 j
          ;;
3 o0 r2 f1 F$ P9 s/ K7 G6 h  |      esac6 @1 Q! y% j9 @3 |9 z3 Z
    else  p  w* Z; z: g8 p
      har_ofile_prefix=$o_option: f8 M& p! \* z
    fi
4 ]( @2 W# p! _. M) c fi# l+ }+ g! b  y; V) O! l
fi" t/ |* x9 _3 J# ^  u
: b% p. ^" I3 W6 D
# Call Double precision version of the product if -D
3 r! I" P+ f( k  G# P# or simulation time > 1,000,000 ns.
- Q8 U0 ?, p# O' C# Pif [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then' k1 d2 D9 @) E5 s
& `) i$ |8 m! {2 K+ c6 K
  # Now the binary always has the ACE feature
1 y3 i2 B$ [& W# [  USE_ACE=YES
1 u7 p5 y% S9 m4 ?( Z# T' w* Q- f9 h" |. W
  HAVE_DP=NO
' }9 T1 M+ t, r( d  EXTRA_CAPACITY=NO! e5 I9 }/ a+ \4 e" H$ U& b2 O8 U$ F- t
  DB_REAL=${FORCE_DB_REAL:-"0"}
: D. s" n- m1 n8 J
$ F8 G  \7 H5 q0 F  # Enhance for ACE ease of use
4 U; Q; [# w/ l" S1 }  # If no command line option or only a -T option, do:) U6 b! R) \, G) {3 v! N2 ^7 r. n
  #   1. set -A option
$ l% Y% G4 Z" O# a  #   2. assume input file to be hspice+ W2 v  p  h9 D0 h8 Q8 G5 f# _) }
  #   3. set -o to input file prefix/ C$ o+ h( u) [# C$ y
  #   4. set -z to input file prefix
, L8 c/ Z( r$ z  #   5. set -c to default config file
7 }/ c# R( a* C1 ?. G& w$ X0 V  netlist=""
2 P# m5 L/ E7 h, M: l( e6 Y  minusT=NO2 w$ N$ W- F5 E# B2 V
  useStdCmdOpt=0
6 a- d7 R. _8 @# f2 m8 W  prefix=""
" q$ ]# d$ D: r. d" z$ t  circuitType="") ^9 G5 R$ |( g
  for opt in $CMDLINE4 p* K0 @6 R9 i% [0 B( R
  do0 q& W' j( p  [8 T+ [! _
    case "$opt" in
! m  r2 ?- d4 D+ T- h, M9 Q" A! L      -T)- _0 A# |: T4 i
        minusT=YES
& k! h! d  G; i/ s# x. Q% \        ;;: p0 f) R' m( I4 A. e" q
      -*)
& e7 H" h! C0 \  p( [        # using standard powrmill command line
( P/ _2 f/ C' O" d# Z2 z. f3 B        useStdCmdOpt=1! f) O3 v8 W0 x; f
        break
: M2 B5 a* A; ?8 N        ;;
6 H: w, N1 h+ v/ Y0 j, Y( B      *)
& f; [0 I4 t0 z* j5 Q, l4 w       if [ "$minusT" = "YES" ]; then& }5 G# \% y: t% h% H# N4 B* s2 [
         circuitType=$opt
: z3 P! e$ s( i) a         minusT=NO  # reset flag0 ^6 @- L, y) p( y3 [, Y
       else 0 Y4 k6 ~  y) ?; Q; I
         if [ "$netlist" = "" ]; then1 _1 t1 |( g/ f  h) D/ y& W
           prefix=`basename $opt`
. Z1 k  s# X8 z- U2 P, x- `           prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix`
4 B3 G( }# N6 z2 Q4 R5 O         fi3 p( v5 `- w1 I5 E6 S4 w% C4 T
         netlist="$netlist $opt": d/ U1 S5 `8 e, t
       fi$ o- H+ B" Z) o( Z
       ;;
- D* U- c0 \$ p; n& [8 [5 O    esac
1 ?5 T- e  [$ T. P  done2 M& \% r; p9 g( C( I+ |
1 |0 p: a  l  D. Q% q# a3 ?) b/ ~

7 Z% N8 {/ e4 @  if [ $useStdCmdOpt -eq 1 ]; then
* S3 Q& D& ~  J( w: C    # use standard powrmill/timemill command option
8 {9 P  T0 @# ]: v    for opt in $CMDLINE
/ H. v4 M* M% _  P! Q5 V& D    do4 m" R+ v2 F9 v+ T5 m
      case "$opt" in
5 p$ L! o  b1 x: `6 p) L1 n# V# {        -A)$ G% J2 E/ U5 t
            DB_REAL=1/ Q: x1 x0 Y6 F7 ~" Y
            ;;
5 i& F2 }3 B2 V# n7 K% z      esac
. z2 U( o5 ]7 B2 h9 e+ {$ j    done- c6 M" M' G# j+ e3 U* ?) J4 }8 G
    if [ "$netlist" != "" ]; then  {7 x* V, g5 O" E! I" x. x0 y2 D9 x
      CMDLINE="-nspice $CMDLINE"
1 z+ l" a, s$ [# ]! n    fi( O( V0 ], e1 G- v. I
  else
/ m/ r8 h( a9 _0 G# ]5 t& n    if [ "$netlist" != "" ]; then
/ y  x5 j; X+ A      EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"}5 v) `9 E9 c* _  M$ `6 O
      # construct new command option2 H, S1 x4 V9 L. D: `
      if [ -f $cmd.ini  -a  "$circuitType" = "" ]; then
: L9 s. [8 h9 @4 {: L        CMDLINE="-nspice $cmd.ini $netlist"
5 o# f9 P+ _1 S      else
$ M; |* A  o( Z; u        if [ "$circuitType" = "" ]; then
8 g* M% i3 X, E% R) \; @: l          circuitType="msana"+ O2 _8 b9 m! j* f9 ]
        fi8 q) {2 P" p* Y1 c* _& _( `7 d
        CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg", h& l$ C; o, o! M5 K  w
      fi
9 c/ z+ |7 l+ s: ~) |      CMDLINE="$CMDLINE -A -o $prefix"% z9 i! |6 E$ W7 W% @- O
      DB_REAL=13 t" f& U& n) L  X- F
      echo $cmd $CMDLINE7 }( O1 W6 N0 s$ Q6 @( ^' m
    fi
" x6 c" U& Y. z' B! S$ K  fi
* Y/ _! I$ a# K% G/ {; ?fi # cmd is timemill or powrmill or nanosim or railmill or pwarc% w+ G+ a& G' J
3 F! ?8 u" g% h- F5 {* Q9 b& M
[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a"
6 p4 T0 w% \/ \$ k$ n[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a"3 k! j" B% @" c  z1 p' B
[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v"& J8 F9 ^+ r9 Y

: K9 C/ \, ?: l6 ]: v5 Mif [ "$__engine_wrapper_called__" != "Indeed" ]; then+ q1 v- m7 }" V/ w. e- h
    __engine_wrapper_called__=Indeed
9 P8 P0 I. y2 \/ |; Q6 b    if [ "$cmd" != "amps" ]; then
+ ~( z& z& B7 W* a0 ~* L        export __engine_wrapper_called__
) ~0 o1 l7 o! ]7 M    fi
# ^8 R/ @; K3 N/ g. X! i7 N
- m2 D: ~) ~, \% @: n, C    trap "cleanup" 0- R9 w* h( C$ g& e2 V
    trap "" 2/ I5 `, t4 \8 V4 h$ w
' }5 g8 b; `- E0 W
    [ -d "$rundir" ] && rm -fr $rundir8 M# _3 q. K, p  p
    [ -d "$rundir" ] || mkdir $rundir; G2 y4 n3 O* a! ]: o- ~

8 `/ n$ U) e" O9 R' D    case "$EPIC_ARCH" in. t) K$ A2 y" E* }$ S! b
    *SUN*64)   
0 C- }8 f9 u* S. Y' Z        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
6 L: ^$ K6 f: |        export LD_LIBRARY_PATH
& Z! _' @# _, `% o7 [0 l! C1 N        suffix=.so% S. z- P  j  V* x! Z
        ld_err_code=1277 ]' ~, G- B" ?9 ^' ^
        ;;0 b) O5 ~: R0 Q( D: G) J  I
    *SUN*4)   " W, y1 X5 e" Q& ?" ^5 a
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
5 u) N0 U1 L4 L# s2 k: I# o2 K8 T        export LD_LIBRARY_PATH- r' P( k# y. x/ S' r/ P- W
        suffix=.so.1.0! m/ `# P0 x7 }: t
        ld_err_code=1278 g8 L% z% c+ s6 `
        ;;8 v" P, ]; q& I* s& I# g
    *SUN*5)   ( Y4 Q' W# _* P+ W. R( }1 y( L" l
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"1 }9 i4 t8 X0 z; M$ l
        export LD_LIBRARY_PATH9 D/ t  P2 i) U8 s$ x8 k: c
        suffix=.so
2 g2 n# i$ W1 w. `2 v        ld_err_code=127
! i( Z) G) o# @" e) B. ?* y        ;;
! d+ u7 A# q7 u8 K3 x: G    x86sol*)   * o% d4 ]" R3 W
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"( v# L, [& i3 |+ w+ B4 h* X; l
        export LD_LIBRARY_PATH
1 o0 G  O# n/ T+ t        suffix=.so! s" Z! z& b% \( U7 `
        ld_err_code=127
% Y2 D1 j+ g; o2 `        ;;. P  V/ v1 `2 A- ]) K; x
    *AIX* | aix64)   
7 i# ?* y( J9 K' o' H        # When genepiclib creates shared objects, it creates a import file and
  w' `4 U2 i' `. b% G' i4 u  @        # uses timemill as program. So at exec time,program timemill is needed
' [/ d8 [; O" F        # in LIBPATH
4 o) }% d& A/ Y# C$ r6 d/ P$ j        $ln_default $command $rundir/foomill
! K" C: F7 _! H5 E        LIBPATH="$libpathLIBPATH:/lib:/usr/lib"
% Z' s/ a9 h- J% a        export LIBPATH
7 G  K- w$ C  {# p        suffix=.o
0 f4 y8 ~4 }7 Y: c3 d5 t        ld_err_code=85 m6 f, O9 K1 \+ o* d
        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then( t2 v/ I% k# Z4 I
          tdir=`echo "/tmp/d"$$`$ [8 o+ }2 ?0 i* a
          [ -d "$tdir" ] || mkdir $tdir% m9 A" L6 n$ L( `4 r
          if [ -f $EPIC_DIR/libCustom.o ]; then
9 Y$ J5 n. c! k, c+ N5 w             cp $EPIC_DIR/libCustom.o $tdir/
% a/ B5 E6 k' x+ m             $ln_default $tdir/libCustom.o $rundir/, e$ m% |! N- A
          fi% f( i, m9 E- n! q" ~6 Y5 z) c
          if [ -f $EPIC_DIR/libModel.o ]; then* ^5 d, {  @+ k; @
             cp $EPIC_DIR/libModel.o $tdir/! ]- H! j9 q# m
             $ln_default $tdir/libModel.o $rundir/
$ E! {( w( ]: }7 \          fi6 a1 @9 W3 x) h# N- l! C
          if [ -f $EPIC_DIR/libFuncModel.o ]; then
4 m# T- {( w+ X/ Q# i# l             cp $EPIC_DIR/libFuncModel.o $tdir/
5 t- [1 q2 R4 S# \1 L7 r             $ln_default $tdir/libFuncModel.o $rundir/& O2 J9 u) P) ?2 [0 D/ d, K6 V' ]
          fi: g, [. x3 N7 p6 o5 H2 U6 Y/ c
          if [ -f $EPIC_DIR/libFuncModel.34.o ]; then
3 x! P; H. h% e0 P4 G             cp $EPIC_DIR/libFuncModel.34.o $tdir/! X0 ?$ k' A) R- e; o3 X
             $ln_default $tdir/libFuncModel.34.o $rundir/
& e: P- x8 Q$ }  Y1 l          fi5 m( [, p* f8 k+ k4 B8 E* m
        fi
' w, a9 Z# Q( v5 }        #Set the IBM flag to enable more shared segids
3 w$ W% q; ?& M/ U% l        EXTSHM="ON"
6 @/ L" L" Z( t$ o* ?0 P* Y  }7 Q        export EXTSHM/ r7 B! d% h1 U, O+ O  p; Q
        ;;
% q0 q! K. y# R4 Z- @: {    *LINUX*)   
- D, [1 p2 }5 z; `8 p* N        suffix=.so
% a. c3 c) `1 m# p        ld_err_code=1
* p  @& t# I  B& v9 |        ;;
# O" ^' L2 v) P* t8 w    *amd64*). J4 C. _. G% a8 u5 `
        suffix=.so4 p; i; r: [! U, Q
        ld_err_code=1
5 f9 s; {* ?4 R0 e$ N3 Q        ;;
  i3 l3 T0 @/ |6 k' u    *suse64*)
& O& v& u- H: J8 |        suffix=.so! \9 |) x9 X" }2 G
        ld_err_code=1
3 Y, Y4 d1 S$ P9 M        ;;
! J" ?$ v" n& d, B    *suse32*)    7 p. X* D( ^& }/ f
        suffix=.so
6 F6 X( c3 I/ K8 f- N7 o3 v        ld_err_code=1
. v- O0 V8 v! X2 ?5 m        ;;8 r" O+ }: ~! {$ R. q/ z* X
    esac; L- d: ^8 z7 m; P3 S" J+ d, x

6 d2 W( U( }1 [( o6 V    [ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix"
$ d. C. \9 T* e+ u    [ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \2 b% i3 t1 B4 s) O, a7 J* q
        && [ "$cmdname" != "nanosim" ] \. e5 [! y& a" w0 V$ |( F
        && [ "$has_model" = "YES" ]  && ulib="$ulib $cwd/libModel$suffix"
! }5 F9 @# u8 l  }    [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix"  c3 `- O* V' ?2 j0 W8 D4 M
5 A9 \. |- H7 i; {' A( Z4 k
#Look for command line option for libFuncModel.so' e, G  S- _$ ^7 K4 a; s+ }$ s
#    user_library_next=0( r3 z, l. m6 J
    has_fmlib=""
' O7 M6 M4 e. e. |; O& D) F    for opt in $CMDLINE
! d; Z$ J) Q. h2 B    do3 W# r3 y/ _2 [& r
      case "$opt" in
: X4 a  W  n& P: ]0 F        -fm)
) m6 |8 B, x3 k' t" P            CMDLINE="$CMDLINE $cwd/libModel$suffix"
7 n6 n; F: J2 w+ N            ;;
7 s0 P( t* x: f8 J) K. {        -fm_user_lib)' D+ C6 I  H% s
            has_fmlib="YES"1 B( r( P" I, w3 _8 S: K* {0 G% F
#            user_library_next=1
: a3 c, R/ O5 F9 {9 B1 b            ;;
, l0 j$ i, I; q5 @" ]1 B& j        -xc)
) v# r; f6 e/ p2 _+ M% r4 C! T            if [ "$EXTRA_CAPACITY" = "NO" ]; then
# F8 R: c* A' s            EXTRA_CAPACITY=YES
9 c6 d$ z; e1 ^- Z1 W6 N4 o; a            fi/ P. F4 y+ a3 `3 \, M
            ;;
' {+ X+ h5 Y! Q" T% V#        *)) E: t, P$ E* P. ^* k
#            if [ $user_library_next -eq 1 ]; then
" X; D9 a/ C4 t: ^, x  d7 ]#                if [ -f "$opt" ]; then
4 a1 e0 C7 e# }% T! y0 ^#                    libfmodel=$opt7 }! g/ _9 ~/ n8 o
#                else0 `6 ?* K6 K$ L, z
#                    echo "-fm_user_lib: Specified file not found"
. Z7 U4 `' x" ?, n1 n" n#                    echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages
6 h) i7 k  G0 Y+ g% b  o#                fi6 M0 j( ^6 |9 r! B7 p2 Y
#                user_library_next=03 L/ B, h4 I% c( j/ {
#            fi( y7 P3 _/ m8 R6 ^3 p2 g7 K
#            ;;
- {  s6 [6 F' l& b2 `5 m        esac& \  |0 i2 F  C* `3 i  M2 k" `
    done
: F/ Q% w' C2 U0 _7 g1 ~& u
/ _% K7 F# n' p1 m  x. A    if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then
  v. U8 C# Z# m; T! u& V4 l( q! e        flib=""
7 t" W# R0 c' `$ `- ~3 D        if [ "$has_fmlib" = "" ]; then
& @2 G3 A* V" l# D$ ?            flib="$flib `get_epicrc ./.epicrc user_libraries`"
/ I; a2 z8 l  p" L            flib="$flib `get_epicrc $HOME/.epicrc user_libraries`"
0 x% n2 n7 b- A3 J            flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`"
3 {' K6 {9 A4 d& V/ _. Z        fi& P. @2 I/ H( R. `% U/ K7 \
    fi
+ _! h& v; L7 G5 Q5 Y. v! m0 {' u- R& ]; f/ I
   for i in $ulib$ x( n4 N' \/ i
   do, c: a$ t) r+ v
       [ ! -f "$i" ] && continue) P8 J1 m* F# k; w/ W
       dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd
% s$ C2 V: C1 O4 N& j# q# J       i="$dir/`basename $i`"
9 e) a" v7 P( Q$ ?       case "$i" in
; I" i$ D- @& m! P. Z7 \. S: x       *libCustom$suffix*)    [ "$libcustom" = "" ] && libcustom=$i;;1 ]1 `5 D# E$ T! [2 M0 p
       *libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;;
& x: ^) o) S% t7 z) d8 B2 O% a       *libModel$suffix*)     [ "$libmodel"  = "" ] && libmodel=$i;;* |8 i7 P6 a' R# W# w2 s
       *libva$suffix)         [ "$libva"     = "" ] && libva=$i;;* D7 `" X0 l; l& r1 Z  w4 g
       esac$ w; }3 E2 B1 Q, ?/ I+ e6 K& Y. p% e
       [ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \* _2 K5 X: U6 H4 b, G
        && break
- H: o# E5 d7 l7 O" \6 n* W; ^9 P# `   done
- m" W+ f6 |6 V
! Z0 e2 @) \( N   # symbolic link shared libraries to .epicrun$$
% v& P9 E: p5 {' v- ]    cd $EPIC_DIR; epicdir=`pwd`; cd $cwd! d# S2 l! ~+ K" D8 T
    if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then3 z) ?/ r6 J7 a$ Y, [# g9 q: s
        if [ "$libfmodel" != "" ]; then- F% E& a4 n! _! }
             [ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \
  A) `7 C4 Y4 s+ U             echo "Using $libfmodel ..."  && \
& _. b* z+ Q" y8 Q/ T( Q             echo "Using $libfmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE- I( K9 k' l+ B; Z+ v
             if [ -f $rundir/libFuncModel$suffix ]; then& F' [1 n5 X' Z
               rm $rundir/libFuncModel$suffix
9 i7 d' t6 \$ E0 ^2 ?4 d+ ?             fi/ R8 P+ K& g  e
             $ln_default $libfmodel $rundir * W( k/ k/ Q9 [: H2 j6 \& ^1 ]
        fi
) P+ P& R3 g9 L* q# W1 }5 w        if [ "$libmodel" != "" ]; then
( B6 U( P* y' y) ~/ t7 f             [ "$libmodel" != "$epicdir/libModel$suffix" ] && \
. }9 \/ _; p9 L5 ?, _             echo "Using $libmodel ..." && \) v: K3 ^. x, P1 ~# v4 d
             echo "Using $libmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE8 I( E7 w2 H& ~$ _) ?6 h
             if [ -f $rundir/libModel$suffix ]; then
  e) f* |/ B- f! ?9 F               rm $rundir/libModel$suffix3 u, Y* [- G5 _* ~  I$ K
             fi' I. G( O0 V# D; t% l" a, w& X
             $ln_default $libmodel $rundir 3 ^. Y5 Q) L; W. R) H! a4 [
        fi& Z1 p; j. U2 n
   fi$ J4 w: O8 F# W1 L9 k' Z2 }
   if [ "$libcustom" != "" ]; then  |1 t& \& p$ F2 P! A6 P
        [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \
: U& S, Q6 ]# i  J/ Q        echo "Using $libcustom ...". _) H8 v7 s' C/ _0 K
        if [ -f $rundir/libCustom$suffix ]; then0 d3 g- O! k4 U' v" [
          rm $rundir/libCustom$suffix
2 r1 ^1 F8 U) p: |  W% `; S& J        fi
1 q: }) g2 f! I9 ]2 B" [        $ln_default $libcustom $rundir
& T* ?5 r1 ~9 W5 t& w   fi+ M/ t; n4 H/ o7 j4 L& P. ^& Y

1 o: x0 y+ J0 J   if [ "$flib" != "" -a "$flib" != "   " ]; then7 E" c; W* L; M
        CMDLINE="$CMDLINE -fm_user_lib $flib"& g" l* t4 v# I1 V
   fi
0 v: x+ B( A8 Y# l
, T/ s! A4 m5 `1 K% [   if [ "$libva" != "" ]; then  H* t% E( A2 j/ V, {7 @! z7 T9 i6 O
        if [ -f $rundir/libva$suffix ]; then4 M8 w# q+ \4 j: _
          rm $rundir/libva$suffix
/ Z; ~- r, U2 H        fi% e; o) G: A8 c' V; B" m6 f( [
        $ln_default $libva $rundir / ]0 j1 {3 o- `7 J8 m! J
   fi1 i. E8 s4 J3 s7 |, R
/ {) \3 k, d$ b% F7 \
4 Z& `: ?3 N, A/ K9 B  e1 k
    # VCORE design library
) N$ G! v1 R( Z7 n    if [ "$vlog_design" != "" ]; then$ T8 a+ B: \+ h) ~, f
        $ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`- L4 z+ U  [  q5 E9 r
    fi
& J; E* {6 c* z9 Y) a
; N8 ~3 ?- ?: x4 i; J    if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then0 w+ ]) M, C4 f7 x& R
        EXTRA_CAPACITY=YES
; c! J( E- ?; C$ O6 B$ B    fi
1 i4 p5 E9 {3 g; C+ Y% G3 q" a  q0 [2 [9 ~( @! d
    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc"
6 `( S2 s( A# P  {8 m* M    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc"2 b% C) I. g( b& D+ ^" q( `" G
    #Create temp file if dual process is on- B9 ]' `3 c- X6 }) J9 H% Q) ~
    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then! t$ r9 N. F  U2 i7 O; E
        if [ "$EXTRA_CAPACITY" = "YES" ]; then
' z) }) h: `' ^8 y% T/ C1 M% {            touch $rundir/rpcidfile5 {3 i/ m6 B- \8 c
        fi
$ ~! Q( L1 x: O. I$ t1 A, ]: z# Y: V    fi! y# E1 Z* n' z- F- h
fi8 T( {& C) w/ v% K
9 ~( K& |: g5 \( L0 E
run_cmd()2 ]7 l8 T4 _6 }4 G8 y8 H
{
+ ^$ `5 e) c+ s: B: X  command=$13 S$ W2 o/ F: D9 E' I3 Q# Q
  shift
0 ]$ z3 N' R% [6 w4 K0 q: F- H6 S
  if [ x"$VA_FILE" != x"" ] ; then
/ I: F: e" Z0 t' T' Q) f: T     cmdline=$ARGV
& Y* a  }5 C" \5 S$ O& V  else. ~3 V2 t: N: }, p8 Z0 W
     cmdline=$@
! g, X! A6 v' I( w" {  fi" V! h. o- Q/ P( H' E3 V; j
. w& J- ^$ p8 B, V6 }
  debug=${DEBUGGER:+"$DEBUGGER $command"};$ x$ X+ }) }% S1 p
1 O+ d: K+ b, u( \  \7 D
  # To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a
) s' v$ J; u+ [: k7 m  # so save-restore may work.0 Y  _" g, k( _7 ^
  setarchStr=" n) j  D( ]0 h& f0 }
  cmd2run=`basename $command`/ f* }( i- b# s# k: ^9 s
  if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then
- S' s8 E) v  S2 j5 D# X& g    if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then
8 T( I$ n) U' Q' s      setarchStr="setarch i386 -R "$ A* \9 }" D6 t4 Y1 q2 s
    fi7 `; x' z9 z$ y, J9 x8 @/ {
    if [ "$EPIC_ARCH" = "linux" ]; then
( }# P& q' c8 }  ?5 r5 D( @4 i      setarchStr="setarch i386 -R "
+ X* k% A/ |8 y    fi3 ]) Q  t7 @* o; A2 g$ `. h: j; ]
    if [ "$EPIC_ARCH" = "amd64" ]; then9 C- Q: Z- q" o
      setarchStr="setarch i686 -R "9 Z+ `; J- x: T( y4 T* K( {( q- p
    fi& v4 G% D6 a/ i+ G6 P0 S8 N; g
    if [ "$EPIC_ARCH" = "suse32" ]; then" `2 X- }. Y6 P
      setarchStr="setarch_suse i386 -R "7 O" r, T% s" o& K
    fi
- e! ]' k* v* @. o    if [ "$EPIC_ARCH" = "suse64" ]; then" _+ J% [; z; I
      setarchStr="setarch_suse i686 -R "
; a1 {/ O; B3 r; {1 G! {    fi$ N( s1 l, n2 X
  fi9 P* I) g. r+ j# `+ _$ h# D

4 z; v% m  j$ s  ret_stat=0$ y& b2 |; G& v6 q
  if [ -x "$command" ]; then  B: q! S. h+ V1 b* W# S1 C3 l- ?4 c
      if [ "$debug" ]; then
. d" I7 N4 t3 X( G8 j        _debug_args_=$cmdline5 d/ x6 P2 ]% n! H- w% z# h
        . .epic-debug2 O7 `$ m- x  i6 q% ~3 e5 g- o/ I
      else. s0 a/ d, U7 Q/ a
        DEBUGGER=; export DEBUGGER
3 i& x' f5 D6 S# Y        $setarchStr $command $cmdline
7 Z0 T3 u# w4 n8 o0 S      fi* T* U; F# R. W; Z/ t
      ret_stat=$?! }: `' u7 }4 C4 h0 i) o
  else/ x/ h: t+ Q( O1 F% m% l6 P
    echo "Corrupt installation, executable \"$1\" not found!"
3 ]8 p# K6 F% j9 g) d0 G    ret_stat=1
6 R) S4 P. ~$ P  x: p  fi
* L) t8 {2 t0 a" t  K8 `}
; K* \7 W" Z8 w7 R8 k+ g# B, a7 O; l6 K! L! D
# keep runing cmd if ctrl file exist0 r' V- L9 [! X: _) n. L/ Y; d

  T6 l( u- l$ }1 d8 p' E4 d2 n4 Z& lrun_loop()& ?  s: i# M2 S& I
{
& j0 g6 X5 |5 j1 P  command=$1
; y" D0 ~% f& `3 o) O( C  shift
+ y- p: [! I  A! }) p  e7 m' x, a  X8 M: X1 C' F+ E
  if [ x"$VA_FILE" != x"" ] ; then) g" D9 A6 D. P! E
     cmdline=$ARGV7 ~% z2 i# k( Z' F) ~: @) I/ c
  else' J# I+ `( W- O: T
     cmdline=$@
1 m" B& b/ p4 r- F1 R8 A; g  fi
$ U, k+ G8 i! L0 `8 k  X
' D, F: f# n6 f) h2 R6 w3 D7 t  while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do
3 i  A' H. u) t; X/ I    . $LOOP_CTRL_FILE$$
' q% z1 N0 X5 p7 M$ o; k/ d: U3 M: c+ ?    run_cmd $command $cmdline -banner 2
8 g1 q0 k6 l: r2 D) \0 z  done;9 q  u: g3 E3 a2 ?1 j" X

3 t9 U6 h: f8 R6 _  s/ i2 F  if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then( s$ y* X$ @' e, {
    rm -f $LOOP_CTRL_FILE$$1 }" [' g; w) i3 e9 Q+ a
  fi( v& u; B- _% b
}1 c4 k5 B/ _3 ]6 t* ^: Y5 J/ N
3 Y/ B5 {% M# C( h( ?
har_check_ret_stat()6 e4 ^7 C' @7 C+ E) P. g
{
1 K# Y9 ?2 Z/ i  if [ $ret_stat -ne 0 ]; then + u" i# w& p6 R  P0 @5 z
    echo "Simulator returned with non-zero exit status. Stopping."
6 a6 c) s* P( l  [+ J    exit 1
! g. J8 W' a4 z- l  fi& Z8 }$ _$ P! D4 j
}. w. C" x$ w" x- x
/ i9 ]( R+ o0 d. O8 l
#! _! x  S* ]& N6 |, E6 q& t6 T
# set stacksize and datasize limit
8 ^# S3 j6 X$ d#& @; M% G/ |5 F) H' g

8 @# h2 Y8 U% ~* f( |3 I3 ~set_data_limit5 e7 q: [0 [# e0 h" K
set_stack_limit4 v* Z- h$ I( J9 T$ ?3 \

; o0 k0 b: F+ m0 o7 C8 `4 m2 ^. J#rm -f $LOOP_CTRL_FILE; C: q3 a: c6 O1 V5 R" m( ?
# j$ b$ G8 \4 ^& }4 H! o. ~5 W, _
run_main()
$ S9 L6 a# \3 U5 d, O1 C1 b{
% u- Z" q  j' Jif [ $is_special_har_run -eq 1 ]; then
5 V4 f) w3 X8 U5 [* V  if [ "$har_ofile_prefix" = "" ]; then
% k6 c. [! Q8 f: v  ~/ L    echo "Wrapper bug. Notify Synopsys technical support."2 K8 p# f% X3 X  t5 e
    exit 1
* d6 B: X0 A" K) m$ _  fi
9 R6 |$ i* {5 B  if [ "$har_hilo_file" = "" ]; then
3 {5 E0 W/ e$ t2 H4 ?    # no user specified hi lo file - do both runs1 D! z8 Y$ g4 V! N& E: A7 C
    run_cmd $command $CMDLINE -har_one -har_setup
, i( T) D2 V6 J  }; ^    if [ $ret_stat -ne 126 ]; then% O6 e5 K5 P* _5 r' x+ \
      har_check_ret_stat) ]+ |: h. r2 G8 ^- ^! V
      if [ -r $LOOP_CTRL_FILE$$ ]; then
: f( W. b* v; L$ h        run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl3 q: }# ?% e. [' r1 p2 c
        rm -f ${har_ofile_prefix}.hl2 a7 D/ A, d& Q8 E1 x
      else
$ A  ]# I! x7 v# b$ D( G4 v7 b        run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl
& _# I; X, w9 B; d" ^% @/ w      fi
0 Z$ x$ I: k6 r    else4 _5 D6 ^) ?. g/ B( ~
      ret_stat=0% b, @) a% Q' O& ~7 N$ J
    fi
. _/ Y- w6 O. T" F; l  else5 f! }, o6 b8 `' ]8 t
    # user gave a hi lo file name
% _3 N4 v) ~8 r; E8 ^8 R; R# ]    if [ -f $har_hilo_file -a -s $har_hilo_file ]; then
( T- ]+ W2 j# f: Y# o, Q- }! c; O/ H      # file exists - use it - only do sim run1 r: B, F5 }. m* s! E  x
      run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}& W, o. F5 m- f* a  ?
      run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}, B- L0 A. V/ i7 E) Y
    else9 x* F3 ]7 N4 S$ d5 p
      # no such file - generate it - do both runs
  M4 |7 ?  j* V: L6 P      run_cmd $command $CMDLINE -har_one -har_fnf -har_setup
/ t# a% U$ W* B7 @- }1 J% G2 N" v      if [ $ret_stat -ne 126 ]; then# l$ n' H! V4 ^. ~
        har_check_ret_stat: Q* ^# F  s+ i
        if [ ! -f ${har_ofile_prefix}.hl ]; then
1 {$ G' h; F# B          echo "No hi lo file generated after setup phase. "
8 V+ G3 N9 @; t! c/ I( l          echo "Contact Synopsys technical support."( d. @3 J7 p& L
          exit 18 m  `6 q: G  a1 H$ k" s2 g3 v! y
        else
; t: c& X- E* V$ ?) |# g          if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then5 }% Y; a  g5 d0 d# E; E
            mv ${har_ofile_prefix}.hl $har_hilo_file' [- u7 W- {, \8 Y6 Z+ M
          fi& Q+ i% r+ o: R. q
        fi6 I+ ^7 v) F4 `' w' H3 w4 p
        if [ -r $LOOP_CTRL_FILE$$ ]; then# x( b' Y4 C1 ?2 Z& _9 S: C3 v" h
          run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file
) X$ m1 T8 h; L; T, U% n( @        else3 [% M. F5 [, g0 l6 n) G) d
          run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file
3 Y9 ~2 t9 H. ]- z1 I8 r; I7 L        fi( N( W1 I" R7 C
      else
' [7 ]) i5 ]0 t; H! A        ret_stat=06 e' B# a8 ]6 E0 l; H0 h
      fi$ O. [3 J4 W+ R6 j, Q' X
    fi8 k9 ~7 j  s6 g) Q! v
  fi
' t) d. J7 z+ [  c0 B; ^9 ?else  
0 s: I2 x4 l, C6 D- E# don't loop if -har_setup. C" p  H" U  p, a
  if [ $have_har_setup_flag -eq 1 ]; then9 Q* C6 m" y7 Y- @8 l9 R
    run_cmd $command $CMDLINE
% ?' ^: W5 ^9 r; p$ A    if [ -r $LOOP_CTRL_FILE$$ ]; then! C' z& L3 m2 z! ?) W" w7 X4 [
      rm -f $LOOP_CTRL_FILE$$" P& Q4 t: A: L+ p# {
    fi1 O* g; }9 i! Q% l' b: p
  else
( @4 T; m8 q+ l! Y4 R+ D    run_cmd $command $CMDLINE& \& S+ L% ^8 ~, ~6 C/ p
    run_loop $command $CMDLINE4 B0 b( M9 v% @8 h! K# A
  fi& p3 @6 ?; A; d* L8 L3 J5 p1 T
fi1 p, B4 G6 V$ T+ J, z) r( L, W6 _

- T* X; a! a" K/ {5 Sif [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then
6 y* |, m' I/ i. j+ ^3 o" d  g0 e  pwCreateErrDB -w $workDir -e $errFile& H6 K" @# V9 Z7 r) z
  ret_stat=$?) t% Y% ]$ b# b7 i
fi  ]' _2 R& V+ ^9 y( ]: q# ]+ Q
}5 d0 b* l/ ~  Q/ @5 x5 D- h: v

2 x! j" N* J) [cleanup_alter()
& A8 `$ ^; r7 d* @. u6 U{" {7 H# @- N# V) w  v
   /bin/rm -f $ALTER_COUNT_FILE 1>&2
3 z$ K  X; X7 |5 L8 [   /bin/rm -f $ALTER_HK_FILE 1>&26 z* \$ ?8 U/ f8 v& v2 D) E( b
}
2 X9 M9 W: O$ O5 i3 v) A5 \2 L! M+ U* Q9 n: }
#generate alter temp files based on pid
7 u: L' s) K7 O" sALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$( n  s5 N) H/ ]" m
if [ -f $ALTER_COUNT_FILE ]
7 t/ w$ G! i* A! g4 \% x7 N# d( ythen
2 I4 [" ^6 P2 q/ o8 J  until [ ! -f $ALTER_COUNT_FILE ]6 Q4 O% ~& b: k% E( }
  do3 N/ d3 e' C# h  p& `: O
    ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$
. K; Q3 ^0 c8 f1 e! m: w: c; I  done
$ ?* H1 [& m; }) g# f5 yfi# n& W+ N/ j/ g0 \* a4 T! {
export ALTER_COUNT_FILE
3 J. x3 l, @% o6 ~! F  m  u3 o
7 A/ Y; w8 i& k. o6 XALTER_HK_FILE="$ALTER_HK_FILE"$$- y2 U* e) v$ v/ n' a
if [ -f $ALTER_HK_FILE ]
) R' c4 K7 ~% Q; K8 jthen ) ?0 N4 I; W, z- t9 X0 n; i
  until [ ! -f $ALTER_HK_FILE ]* i, x7 D' i2 |5 o% j, P" d
  do
# j1 U! ~* i$ P# T% T    ALTER_HK_FILE="$ALTER_HK_FILE"$$% b1 y) P. p/ X$ [# ~+ B5 H
  done
4 o% C: n: p0 _3 Dfi
% I) ~# P$ L! L; i. uexport ALTER_HK_FILE
; V) `) p8 H6 H/ a+ d
9 V# O. f/ Q; q) D& Z#generate monte carlo related temp files based on pid, M3 A) B) D$ U. J% n3 X
cleanup_monte()
: C0 F6 T8 c' k3 @: ~* \2 l{
  p2 b: H* |4 O& C   /bin/rm -f $MONTE_IMG_FILE 1>&2
" n* ?# S8 x$ G   /bin/rm -f $MONTE_IMG_FILE.gz 1>&26 N/ I5 b, x: ]& h
   /bin/rm -f $MONTE_COUNT_FILE 1>&2
- F7 {/ [6 M4 ^   /bin/rm -f $MONTE_CFG_FILE 1>&2
( ~+ M" R( \( ^; \. v0 N6 q, R}0 O$ Q5 n$ M7 `& T' ^
$ |% k9 j$ u) e  ~
MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
2 a, Q. ]4 n) W* N+ S6 iif [ -f $MONTE_COUNT_FILE ]
+ o; f0 s* g0 t, `2 Jthen
" N: H, _) S  v6 S1 K- x  until [ ! -f $MONTE_COUNT_FILE ]; o3 K/ a) E9 j' n2 k& ^7 L
  do) I9 ?3 U! s5 R
    MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
6 g4 h8 D1 a: h0 e  done
) C/ U( M) ^0 Q+ Q! Ufi
2 f3 s+ u& t  B+ o6 O! i- Yexport MONTE_COUNT_FILE
, J% C- [9 `0 U0 A- y( {) j$ x' m' @5 o! _6 }9 h& p0 s( L
MONTE_IMG_FILE="$MONTE_IMG_FILE"$$# |1 Q0 c& a5 \- {/ U
if [ -f $MONTE_IMG_FILE ]3 G: R1 A/ F! m% }
then) P* @) \6 d$ U- [) A; g
  until [ ! -f $MONTE_IMG_FILE ]7 y  |- t& N0 w; ?
  do
) t7 X7 L) b% s. q8 t    MONTE_IMG_FILE="$MONTE_IMG_FILE"$$3 @& C* P* o7 Z7 N3 Q9 x
  done  [/ l7 `3 T0 P& |+ @9 k2 i
fi
) k& y" d+ V; D/ C& e4 Rexport MONTE_IMG_FILE
, G+ ]( @3 x0 }- c8 T4 |1 j) b5 D
& f' \4 w' t4 L8 }4 a, aMONTE_CFG_FILE="$MONTE_CFG_FILE"$$
, @( ~- ^7 E% K' Y+ m5 K) v$ \if [ -f $MONTE_CFG_FILE ]- j* _+ G0 X1 v1 d
then
/ l; ~, D0 Q( z( v8 H" e/ D( K+ F" \8 ?/ @/ C  until [ ! -f $MONTE_CFG_FILE ]
7 @3 O' e* n2 G' G  C: Q  B  do9 y. L8 S. h: s
    MONTE_CFG_FILE="$MONTE_CFG_FILE"$$! S/ i9 J. G# R2 @: o9 i4 p. `4 D
  done' Q8 ^# i- n5 n9 U$ U" P) M
fi- ^/ J/ f7 U! q- l# |

8 z% p3 p& r9 w5 l& _6 z# main iteration4 y4 ~2 d% ^4 e- d  H- D
run_main# K, t+ V9 Z  D% i; ?
0 F$ G) y3 ]3 L4 H5 A& }0 K3 B
if [ $ret_stat -ne 0 ] , [% Z! i0 D. P( b0 C* `: I
then 6 S: _, K  e4 k  e- n
  cleanup_alter
9 Y& Y7 j5 q; ~; z! S9 w1 c8 q5 g; V  cleanup_monte( s9 F7 v# R2 C/ h
  Exit $ret_stat
2 N& u2 K  R& U6 \7 bfi! ?2 ]8 |- W6 K  ], u6 h! U
5 j4 s* i* X# f# I3 }1 N- P0 t
#Alter related iterations
/ X1 }" O  B8 G9 @# q& ?3 y8 l/ [: Y+ C
  a$ c: l% `- Z5 piterations=0+ H7 F/ r! V2 m
count=02 z5 ], H$ _3 w6 g
if test -s "$ALTER_COUNT_FILE"7 u- ?; V5 Y, ]8 ^/ t. G
then
/ e# _! ?' Q; U% C- K) B  if [ -r $ALTER_COUNT_FILE ]; then/ s& P: J3 d+ D5 F* q0 ?- \, S. i
   exec 7< $ALTER_COUNT_FILE
0 j; H* `6 e: U! a5 r   read iterations <&7
. N9 M3 b/ D; L( r: i fi& y. b5 M1 r' ^8 [
fi% Z4 Z4 N: v+ s+ D* P; U8 S
; m; I1 M0 _; P" ^, {$ w- A& }  J
trap 'echo Program Interrupt; cleanup_alter; exit 1'  27 R6 c8 s4 w( A4 R' y
while [ $count -lt $iterations ]
  z  N' u3 a8 e/ y) p' gdo& r- d' Y: T, c% ?8 q& T
count=`expr $count + 1`! p- Z% s: w8 f$ E& }; I! y: g
ALTER_COUNT=$count6 b5 Y6 j$ U0 ]7 i% S! [" ]. v
export ALTER_COUNT
, B, i  {4 h" L
& I+ @5 t# B6 {# B0 L run_main6 b2 m' v6 ?6 q( {

- v" Q9 u( U, W. E* vdone
' B) d% f' u* e% l$ e$ g; j3 G. m: u# j- N" W6 @. J
#Monte carlo related iterations
, S! [* x7 H7 b5 X" _' t% O/ ]5 T" \6 X/ M$ Z6 r
monte_runtime_summary()
9 y' M& `8 z/ j2 ]' q{$ d* j, V5 s3 c2 Y7 Z) U5 Z
  keyword_1=real
( c0 s# U- k  f, x' s  keyword_2=user
6 y5 [5 V0 q& D4 @5 X6 \0 p( d  keyword_3=sys
4 N/ o% G' U5 S$ V* [" H% k0 R  ofile_prefix=nanosim
0 P: C6 P" K2 w$ O! K3 X! j/ H: ]
  if [ ! -z "$o_option" ]; then
; d, j) K* [. S- M( _' s% z    logfile=${o_option}.log6 J) X" O. c5 x/ F) ?4 B
  else
; p: ^% s' S9 u$ `) ?3 m# _    logfile=${ofile_prefix}.log
" E$ I, A. b) B0 k) P4 T' B  fi
3 `  j1 i4 j  C  v2 m# W3 t5 N# _7 w" w# Z/ c5 S9 R# U
  if [ -f $logfile ]; then
3 h' m9 _& a0 D5 b, A    echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile      
% i" g- P! w' K2 O    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
8 c1 z, ~6 G  A  fi/ R, \+ ?3 B1 t! G3 k5 {7 @
}1 ]. L" e! [  t" k- D' M- T2 P

* J# }) Q4 p, u& Q7 z& G8 Lnext_monte=0/ w# m4 m/ t: s+ h
cur_monte=0
  c# W, `' E: a6 Y) `) F; y
( l7 ]# t, D, Xif test -s "$MONTE_COUNT_FILE"* l. R$ B# {) ?. B" L
then
1 k& h' s4 e9 }; J  }3 u) C, k  if [ -r $MONTE_COUNT_FILE ]; then
/ ]# R% d: s5 Z3 A6 `7 g   exec 8< $MONTE_COUNT_FILE
4 H& x& D, X" X; ]/ @  B   read next_monte <&85 ?- j8 a/ ~7 c( l" O: ^
  fi
9 ]9 m- G6 e7 [3 tfi
9 w6 a& j) _+ g) W9 X/ k5 l
! p0 |: p/ T- a# i- i3 strap 'echo Program Interrupt; cleanup_monte; exit 1'  2, o  o5 a8 ^+ ~
while [ $next_monte -gt 0 -a $next_monte != $cur_monte ]
- X% }) ?" U, v' S$ sdo
# j& Z" W# G/ g8 p  NS_CURRENT_MONTE_COUNT=$next_monte, y3 Y6 x6 _* M6 T! q
  export NS_CURRENT_MONTE_COUNT
& @2 A7 {! W9 P2 U2 c
) u1 O  O, A- z2 M# w7 A6 y  echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE2 h" m( d% D* I9 Z; B
  CMDLINE="$CMDLINE -c $MONTE_CFG_FILE"
1 w4 d6 @# w7 x, S, c" `5 s  run_main( d  q+ Y9 y/ H1 e" p( `8 d

0 R- H" ]3 r3 M% f6 L( w" z  cur_monte=$next_monte
* Y/ @8 N  v, ]9 v: U! [& }  exec 8< $MONTE_COUNT_FILE
% E$ A" U6 U. W! n  read next_monte <&8
8 H% u, x. m" Odone! q. d" a+ e2 U% B7 Q6 U

; v9 e) k& a5 R' M& gif [ -f $MONTE_COUNT_FILE ]
" f' `5 }# {/ u; H, {then8 T. o: B( G1 y# X) U  r
  monte_runtime_summary
  A& h& n$ _# R. E" K- Mfi% v3 O+ s! H5 H

- X/ K! [$ S* U( o6 dcleanup_alter
' Z9 V6 j) k9 ~, R" Ycleanup_monte) p9 l  y5 U( ^. S' x4 ~

- p/ x2 D9 \0 T6 h0 V. _6 eExit $ret_stat

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

使用道具 舉報

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

本版積分規則

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

GMT+8, 2025-2-22 04:43 PM , Processed in 0.213013 second(s), 15 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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