Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

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

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

[複製鏈接]
跳轉到指定樓層
#
發表於 2012-5-6 13:58:13 | 只看該作者 回帖獎勵 |正序瀏覽 |閱讀模式
10Chipcoin
各位大大好:+ t) l0 K& j" X9 [* z' g0 f" H
                      小弟執行nanosim時,卻無法跑出視窗來,有個錯誤可是我不清楚該如何解決?問題如下
) O. O2 P$ a  o. m  _. _) l! C                      [: 113: 64: unexpected operator
6 D: g$ j7 W* S8 [$ O7 A& J/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim: 1: Syntax error: Unterminated quoted string" o) N1 \' j% G
有大大遇過這方面的問題或是指導我方向去解決, 謝謝.
( l+ r: Q: Q$ i" |) c我在猜可能是這個檔案內的文字需要修改 但不知道該如何修改?. `; o( v# E" U# n- [# s* o: _* {! E
以下為/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim 的檔案內容:
, n; U4 G) n. U% D    #!/bin/sh6 \' r: D# i! {3 d; ~
#
3 E0 u% }9 v- ^# Copyright (C) 2001 Synopsys INC8 K$ |' b! D( J, \
# EPIC Dynamic Simulation Wrapper (DSW)
9 ^/ e7 P0 {+ t! M; g: ~0 {#( V  u) y2 w! d: J2 B; {; W# c
eval ${DBG_EPIC_WRAPPER:+"set -x"}
7 Z- @) \) s0 O4 V4 W+ H7 r( u: Y: W+ p3 v* ~4 D  Z: B
if [ "$EPIC_WRAPPER_DVLP" = "" ]; then
9 m8 `! \( S, q/ d5 O    TEMP_ARCH="$SES_ARCH"' Z2 P/ b6 N8 `+ p! r+ _' ~9 d
else
' W/ F% C& D7 ]& v    TEMP_ARCH="$EPIC_ARCH"
. R% ?1 J0 l# E- @0 S. k% R  g2 U( ~fi# `: B3 Y3 ^0 R  {9 a% b, I* b$ |* g

0 [3 X! ^, Q' P$ r- N* f/ Y3 K4 Bscan_for_hva_args()" n0 {8 D0 c& ~" b, B3 ^9 K
{
1 f2 p9 c. e* ~- U& C7 s8 y  /bin/rm -f hva.init 1>&26 R$ q# {" i8 i- h
  while [ $# -gt 0 ]; do
. b4 |5 X. g# h" c* U6 o. ~$ j, v( j    case "$1" in! u# i2 ?# N& @! F6 }$ c- x) E
      -vaf)3 u2 d( ?' B1 N, Z" q8 R+ k7 C( f, n
           have_vaf_flag=1
: v; o% ?0 R( A1 z           have_va_flag=0+ ?/ [4 J6 n8 v. Q7 k
           shift;( C# \8 V. i  R: f
           continue;% s+ Y8 F+ I" P% T2 z/ Z5 U+ n9 o
        ;;  N; V  E0 U4 u. U2 }. c
      -va)* [# G1 o5 g( Q
           have_va_flag=1
8 X$ B- K3 h3 H( j1 e( e! f8 ~" N           have_vaf_flag=0
% t6 P/ i% s0 _; o           shift;
; k: l' n4 h6 ]0 `+ @/ s  p2 w           continue;4 L0 [# R5 R4 T; n
        ;;
+ ]  Z) L5 X6 C2 G% q9 F      -*)* S3 ~9 _2 J( G" I/ p0 [9 {0 Q
           ARGV="$ARGV $1"
  R# A+ o$ A- }0 a           have_va_flag=0  o) p9 s; x2 J/ X& P( }
           have_vaf_flag=0, n4 r5 V# D1 V9 J
           shift;
9 f: O; V/ w' I/ r8 r/ [3 W5 _           continue;' f4 R; O3 c% f0 h  h, j7 n2 H; R
        ;;) j* f' @' j' ]4 t0 K! {: X
      *)
: X* M1 H; Z0 v+ _4 d  D  [           if [ x"$have_va_flag" = x"1" ] ; then 5 [& M, Z1 i4 ^; q- Q+ Z
              VA_FILE="$VA_FILE $1"% J$ k1 V0 T9 Z' G
           elif [ x"$have_vaf_flag" = x"1" ] ; then - t* g& \: I% i" U: p( o
              X="`cat $1 | sed -e '/\;/d;`"
- ]7 {/ G/ l7 k) K+ P5 k4 |: G              for token in ${X}; do3 r" _# X6 N  ?! K1 w
                 VA_FILE="$VA_FILE $token"- C' ?0 Y9 `  z
              done 5 G9 K8 N0 n$ {) ?; M
           else- [% l, c# R6 s& W+ ^% g
              ARGV="$ARGV $1"
6 b% O; }# P# g           fi. c2 _8 z2 e3 [, `+ ~
           shift;9 T) N3 c5 X6 u0 ]6 s0 b1 M
        ;;
8 }( U" r5 e5 m( W. S6 l4 S# J    esac
' `+ G) y' c0 N; C  done+ ^5 q1 d9 Y+ Y3 d/ l* _6 G% }

. X, G! z2 W2 t( _" b  if [ x"$VA_FILE" != x"" ] ; then & ^1 K& C) {$ }  k+ j3 l
##     /bin/echo " xxx ARGV $ARGV"
. N; Q2 f% m( S; S       /bin/echo "choose nanosim $ARGV ;" > hva.init
& G& t+ n2 S6 d" D0 q       echo vcs +ad=hva.init $VA_FILE -o simv+ V/ M5 a+ J* r0 T& R7 m% B
       vcs +ad=hva.init $VA_FILE -o simv
) p" Z- O1 c% \( z0 P0 E' O/ `       exe_status=$?; \% J% E  a5 f
       if [ $exe_status != 100 ]; then
( i  [- M7 d5 w$ \5 R3 I4 D) [. j          /bin/echo ""( @$ L: h% H$ a
          /bin/echo "ERROR: Execution of vcs exited with code $exe_status"
6 c1 J* N( S6 `2 ~# e3 Z2 T          /bin/echo ""5 _* a1 t! t& ^8 V7 j
          exit $exe_status9 o0 V2 W/ x1 I( s" F  k  {% b$ O
       fi2 ?0 l" L! T( R: n( u
       hva_files="-n simv.daidir/amsVD.ntl simv.daidir/amsWRAP.spi"; A4 I9 Q5 x! q
       ARGV="$ARGV $hva_files"
2 \, E) }! {+ ?) _7 a' h  fi
& t7 g/ p, d8 G; L  o}4 s0 T) a8 U- o& |8 l
#-------------------------------------------------------------------------
+ G* b  b& y* `5 `7 }3 v
0 b# m2 g. k0 s2 G) X7 K+ Fcleanup()9 \: Y, J) o4 v; I6 x- V" x" _
{  e9 C& {. [- Q$ W$ `0 |) V
    if [ -d "$rundir" ]; then" s1 E$ z+ A/ ^$ r
        # On AIX, a .nfsXXX file is created if libModel.o is removed' Z( Y9 l9 _# S# N9 H
        # so .epicrun is not removed because directory is not empty.% c3 {6 e7 K3 |1 D
        # Solution is to remove it again if the first rm failed9 H% y3 X) F: a3 [2 B$ E# T4 v$ \. Z
        # (rm -rf $rundir || rm -rf $rundir) 1> /dev/null 2>&1
$ ?: s; T3 J) ^5 b        if [ "$EXTRA_CAPACITY" = "YES" ]; then
4 ~& `0 Z: W3 Q( `) E/ z5 H        chmod u+x $rundir/rpcidfile2 b9 V0 c. e% E
        $rundir/rpcidfile
- b5 T$ |4 c- E6 L/ D: i        rm $rundir/rpcidfile
) Z+ i3 s$ s6 J/ L+ u7 ]. @        fi
2 j9 [( l+ [2 Q- T, j( ?1 c- t        rm -rf $rundir' w$ r3 h6 n* J' v6 d

# Z" E" D9 r' f* c& o" L        #Due to NFS problem, we have to copy files needed to! I4 }; w% q0 @# T( _4 ~
        #/tmp/<temporary directory>, then symlink's files" b0 w, b6 s. i3 P: A. Q! \9 l
        #to the local temporary 'rundir'. This avoids the problem0 m( _1 h: o  Z4 \4 b* K
        #to remove 'rundir') S( n- f$ u3 E" O( w
        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
2 q4 @6 z6 u. u- _: @. l1 ^          if [ -d "$tdir" ]; then; |8 f1 m/ _! M* f$ X
            rm -rf $tdir: C8 g) a0 M" p2 E% C; `
          fi
5 i+ ?$ N3 Q7 @# Z        fi' ]( `, h- p) h( s0 B9 z8 @0 S( n# }
    fi4 t/ t' e; G$ ^" }; o2 M( M
    if [ ${exitstatus:-0} -eq $ld_err_code ]; then4 ^& p. T3 ]2 [. n- [
        [ "$has_model" = "YES" ] && rm -f $cwd/libModel$suffix1 J; a# _6 V! \8 n- a
        [ "$has_custom" = "YES" ] && rm -f $cwd/libCustom$suffix
* A, C$ |* J3 m3 G0 H    fi
3 z/ t7 L8 d' C% f    [ -f "$EPIC_SCRIPT_MESSAGES_FILE" ] && rm -f $EPIC_SCRIPT_MESSAGES_FILE 1>&2
9 @6 {9 ]- j) v" }    exit ${exitstatus:-0}
/ i) O4 d0 |0 R1 D+ f! X0 q$ O}
" A: [$ S; ^, [" \, K3 r2 p8 S1 l/ N8 i4 q8 f
Exit()
" d5 i9 H6 f4 g. F{
# n8 X5 ^4 x, t3 n- G    exitstatus=$1
' A8 j2 _% I  [/ I    exit $exitstatus
+ {' C  t: s3 h$ |- ^3 d& `% D}, E4 }* J6 j3 R

. z* j6 _( g- l) Y# get_epicrc filename keyword
4 K- A% Q- l" X! Z) pget_epicrc()
8 Y% P- F& ]9 S6 s9 O  L{
' V/ `$ J( V7 r+ x$ N/ b$ F+ f    [ -f $1 ] || exit 0: O3 j2 `5 O7 r1 ^4 T9 h3 Z
    key="/^$cmd2:/{print \$3}"9 c0 R* q- M. c  q% A
    awk -F":" "$key" $1
- J( a5 o' ?; C9 a}& I+ P& K3 {5 s  Z% d
$ b" @  _6 Z- s/ Q+ z
#
; U# B( c& d8 }& h4 f# c# set datasize limit to hardlimit/ S7 ^3 e/ G2 u5 v) P2 A3 m
#
1 ~5 ~& m, u4 c& n, q  y( @0 o* w$ yset_data_limit()* o- W: z# H  F7 Y6 X* R% `9 [
{
3 Q4 r; j4 O1 F2 v# ?1 Q9 s$ z    dbglimit=0* r! K7 i& `6 c  A
    hardlimit=`ulimit -Hd`- V+ @$ Y% e7 q; f9 b$ F. _
    softlimit=`ulimit -d`
( J7 a' w; s3 e5 ]    desiredlimit=3500000/ `7 n1 ]: i  O% H' T/ L7 i6 W; K
    hardisunlimited=0
. D, N5 M8 A6 M" y; v* e! @    softisunlimited=0: O  t( ?; `) ^
    is64=0
) w( \8 k$ [- Y& p: l5 e( _9 e* b1 f/ o$ l3 q# ^2 Y
    case "$EPIC_ARCH" in
) D* d# O/ m) t4 n2 ~$ I    *SUN*64)
* o& y( Y; s8 K  [- N! d        is64=1* T$ O! T3 ^: J
        ;;
" ~; f9 E0 @1 h2 s    amd64)
5 N  G# t* F8 t        is64=1) D" l+ Q/ o8 ]# ?5 y, V& B! C
        ;;1 }5 T: ~9 j0 Q8 |
    x86sol64)
: Z, p/ H5 s$ T9 v, E8 B        is64=1: U0 V. ~# a  n) _$ V6 Q+ F1 O
        ;;0 i/ T# l7 C- M8 K/ ~# l
    aix64)
2 C7 b) e6 t  M0 V        is64=1
) d/ V2 ~: y* }6 z        ;;
6 ^3 y) L3 _4 O& }2 `- J    suse64)6 q- f- p- F4 v9 S( S3 f$ R
        is64=1; f" L( N$ x; y3 Y
        ;;
% `! k& r) f- L! s# i0 v: I    esac
; v. ]8 \* ?0 a, }! {& o; K3 G$ A9 k5 D* ?
    if [ $dbglimit -eq 1 ]; then7 D# W7 O* j2 Z0 q" Y. H
        echo hard $hardlimit soft $softlimit+ Q1 H4 \' J* d/ \
    fi
% j! E7 A0 ^: v, l% x$ ?8 \
0 e" T; y# R5 e& k- g' Y0 S    if [ x$softlimit = "xunlimited" ]; then8 h& q! q$ k) T% e; ?3 ~. `
        softisunlimited=18 w- d; i; V$ ~2 K9 u1 L
    fi0 I2 E- R# G# r* G

; d+ n$ |' _% x5 b7 ?( u7 o    if [ x$hardlimit = "xunlimited" ]; then
# m# X. }% D  p) n- B        hardisunlimited=1
/ n5 B7 B1 P  i+ A; U    fi7 p7 x8 B: t, C% ~1 x4 H0 N

! ?$ {' J" G0 P    # 64 bit machine should have bigger than 4G
& \8 @% d! d& a8 _    if [ $is64 -eq 1 ]; then
# W4 e/ {" ]( a( Q& r9 t: t        desiredlimit=5000000
) X1 C. G8 }- Y    fi
6 F: \6 i6 n# p3 s6 g/ c% u; k$ V' ^5 h* }
    if [ $hardisunlimited -eq 0 ]; then
6 ~& V7 k/ a8 R/ B8 Y- G  j% C        if [ $hardlimit -lt $desiredlimit ]; then; `( B6 Q3 J) T8 _" \
            echo "WARNING: datasize hard limit $hardlimit K is too small."; N  I1 L# s  l; R7 j
        fi
/ K1 n' ~3 k" H5 o- X. s    fi& l9 o: U, l3 O- \

: d, p$ |6 ~6 _5 F' X% C    if [ $hardlimit != $softlimit ]; then" X" a+ z! E# X4 R1 E5 x7 a9 a$ m( s. m: f
        ulimit -Sd $hardlimit* z6 E% {5 U8 h7 R
#        echo "WARNING: datasize limit is set to `ulimit -Sd`"8 e1 S, l$ C  \
    fi/ k  l: B0 w! V. j$ G' I
, F7 g0 K1 X% D0 n* P8 Z$ |' H
    if [ $dbglimit -eq 1 ]; then
* R- c! B, ~7 ]  [6 ?5 r/ W; w        echo datasize hard limit: `ulimit -Hd`* X: ?' @% Q0 {4 ~, g
        echo datasize soft limit: `ulimit -d`1 `/ K, K7 M  e  B% U8 w  N
    fi0 A! }% f1 T4 ^$ f* O: c% B) A
}: Q$ K+ V0 U0 ]/ e6 t: h& c( F- u  \
# \' t. x' l- m; e* Q0 L9 Y
#
4 A9 h( e& v. b7 g3 q1 a# set stacksize limit to desired limit
5 I; R! R3 O8 {  O#- J  b3 e8 o5 `9 R. J# b$ [' g
set_stack_limit()5 ]/ p3 K4 x, |4 \
{: n1 d, z! z) ?; @( K. s2 E
    dbglimit=0
3 [# b4 v8 k( s* Q- P! P    hardlimit=`ulimit -Hs`
% T$ d9 E1 E% p( r; U- z    softlimit=`ulimit -s`" J, R: Q* p: y2 [9 ~% d3 V2 S; O9 u
    desiredlimit=600003 r; s9 V0 E4 y3 q; Q  p9 }/ Q$ W
    hardisunlimited=0
5 R( [! [" Y6 ~2 A, w* B+ X    softisunlimited=0
, a; @0 ?# j5 H3 _6 z2 m- b$ l    is64=0# S, a: j& s$ ]' V( J1 d: A3 }7 E5 i
  i  ~0 f3 v, k5 t7 V
    case "$EPIC_ARCH" in
5 C$ r! G: H0 \- X3 h5 d    *SUN*64)* a  @3 u6 k0 W/ C7 T* a
        is64=1
/ {) X' A! S3 R; f% u7 Y        ;;9 G2 ?& a; B$ E- w4 e# L6 A
    amd64)0 S' L1 v% }5 t
        is64=1: B+ H4 A- }* C, n4 I3 F, J' r- b
        ;;4 p) G! z9 O7 |; X: W4 [
    x86sol64)
/ G6 J) ?5 Z: S" y, ~        is64=1
1 G. o4 Z0 }6 G' v. G( n8 b% _! W0 u        ;;8 z. b! F' V; N2 I
    aix64)0 o% b( t3 R- C$ f! R/ W7 P
        is64=1
& s3 z7 T: e1 F. j6 r8 \5 x7 Y        ;;( f9 C/ {6 r4 w1 [
    suse64)
! j7 n6 M/ j% \" s. [        is64=1
* H1 ]* b9 C+ D# i% z) ~, I4 Q        ;;
3 x6 f0 H6 X0 w, C    esac
7 G; c) a- g4 q: e8 b$ b8 T( R
( w9 u8 U) Q/ d- y! k1 Z* rif [ "$EPIC_WRAPPER_DVLP" = "" ]; then! y1 c% A- [; |' f1 h& v: E
    if [ $is64 -eq 1 ]; then& L; e* F0 ]5 F6 `5 t# a
        desiredlimit=200000$ Q1 i8 ^3 ~. m
    fi
9 t4 J8 K: V3 @9 helse
' T2 M: ]0 l1 v. }$ r    case "$EPIC_ARCH" in; V+ E( D& @, S/ A5 X
    *SUN*64)3 ]9 P0 b# Z1 k
        desiredlimit=200000
) B) u: e8 ^% h) _        ;;) v1 c" E& t/ H5 @  L
    esac2 N% L  D! w2 ]% q5 u6 b
fi
' ~- h' J" O5 k( ]* r       
$ f+ M- E! X; u( l    if [ $dbglimit -eq 1 ]; then
& R) i) l* x( q& x8 G' L        echo hard $hardlimit soft $softlimit$ G, \( B2 `" W( E! g+ V" {
    fi; v! a! l0 y. {. F1 M

* n6 @- T/ `9 {" _    #stacksize can not be unlimited, pick smaller number
# T8 _: X+ a' A  z" G$ m
. r) w5 F% J# {$ g# E( X, q' l  H3 h    stacklimit=$desiredlimit
; b: a. F) [( ?( M$ _% ?" u
" C9 X" j( I4 |6 f% g+ ?8 u    if [ x$hardlimit = "xunlimited" ]; then+ f( x  p* @/ z+ M
        hardisunlimited=1! c3 k* g" O0 J# Z
    fi) x! P) u# B$ [0 V) H5 ^
, A$ g' i7 }1 ~8 j6 ?7 D% b0 G: N
    if [ x$softlimit = "xunlimited" ]; then
% M. E6 H. r, e* h& |# D! L; y: A        softisunlimited=1, p6 Z: r- s3 e
    fi/ O  c8 Q$ O# J( Q  g' x

* M2 P: r7 Q* E" Y; X    if [ $hardisunlimited -eq 0 ]; then% b& k: P$ p5 g, ?
        if [ $hardlimit -lt $desiredlimit ]; then3 T  g  L7 t* q6 _; D) z
            echo "WARNING: stacksize hard limit $hardlimit K is too small."
" `; k7 y7 q! m3 Z% R- X0 b6 ^            desiredlimit=$hardlimit* x8 O: I0 {3 }% A5 r: M  y$ Q
            stacklimit=$desiredlimit
1 E6 t3 }2 L. x, s        fi
/ X" h) K$ _: C# W  Q6 ?5 Z& |    fi
1 U- S1 ]4 j1 u% [3 d' {  j
  s4 v9 I) s9 j3 Y! V% h( _# N# S    # desiredlimit is set to proper value (< hardlimit)1 m1 j* o% V3 ]  U

' {( i7 l' J. ?. }2 k    if [ $softisunlimited -eq 0 ]; then2 b8 R7 C( @3 F7 H: o; w
        if [ $softlimit -gt $desiredlimit ]; then
2 s6 f; r0 Z# P4 e            stacklimit=$softlimit, }2 S+ X/ }; \! y1 z
        fi( ?& s9 c. O1 w2 S
    fi
3 R1 ~1 e. V% _* s  G; U
7 T) m) @. n4 f% u    if [ $softlimit != $stacklimit ]; then
" l" k: K7 M2 @4 T. m+ D# a6 [        ulimit -Ss $stacklimit
+ M0 O0 g; S/ M. ]' }, ]& D; R#        echo "WARNING: stacksize limit is set to `ulimit -Ss`"0 x0 h! c& G4 V* k5 L* }+ _; l
    fi, d8 H: N. X, q. ?3 x0 E1 H
# m; f! O5 ]) h# W, _
    if [ $dbglimit -eq 1 ]; then2 i5 V3 i1 {& u. X, n5 ]
        echo stacksize hard limit: `ulimit -Hs`* M/ R* _7 {# w# S3 v9 K9 {
        echo stackize soft limit: `ulimit -s`
# f" @% ~8 M' ^    fi, D5 g  S8 D$ Q; r9 _' z
}- j  _. o0 {2 s

! B1 H. ^. p. Y' r! c* hopen_epicscriptmessages()
) _' t& E3 F! L! ^# R$ P- ^# e) P{4 s- ?8 [% r2 @/ Y1 F
#generate  temp ".epicscriptmessages" file based on pid
) N4 G' G" P( {! hEPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$+ c* m  d& P2 c6 S+ c4 d
if [ -f $EPIC_SCRIPT_MESSAGES_FILE ]! I8 u6 I. u9 T
then . P& d/ f$ u) J0 i/ F( V* P7 J
  until [ ! -f $EPIC_SCRIPT_MESSAGES_FILE ]
( j( i- S# ~, P7 Z% R6 V% c) ]  do. m3 q$ m$ |6 i" u1 y- _. Y4 T
    EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$7 U1 \) q2 O( T3 ]$ l( b+ s6 w
  done
5 A, K# N  e( [fi
, _  W0 s; y! f! U0 a4 p  @4 ?$ [% P. e; b& i
export EPIC_SCRIPT_MESSAGES_FILE
8 z, [3 d  k' [/ T}9 f  C) T3 Y0 p6 h* _* B

+ L7 x% J3 T/ R4 L5 Y9 S7 f0 m, v, l  m7 ?1 B$ Q& q% A
cmdname=`basename $0`
  |; m7 U# B& N" ~5 e* t- @postgres="n"
$ r7 K, Q2 k% T: i; v4 v0 rostore="n"  a" p7 _& j( x& ~  E4 G
gui="n"
8 ~- ?& T  N5 C2 N9 ~# K! u  ]$ qdatabaseOn="n"
0 [6 V; m" r, c, A/ T" cf_next=0( L7 m$ d, `. r. U2 D
f_option=""
$ c) h0 Q, Y" t' Zo_next=0
7 E4 c; D0 a  k% }; f! y7 po_option=""
4 M: \6 o! N6 u0 Z* tworkDir=""+ X( {" `4 Z9 J+ W
workDir_next=0: f' v$ y* p- w! C2 Y4 s% y
errFile="powrmill.err"
$ C* }4 q. l4 b: t6 }! y' `- jwin32flags=""
6 Z3 _2 I1 I) fln_default="ln -s"' v, y, A0 Q' y4 D6 Z% r

- b9 R8 r; s- q* Uhar_hilo_file=""
# r1 o, o" X. ?- H6 B  Xhave_har_flag=0. m3 Z# y1 s. n+ O  r, i' f
have_har_setup_flag=0' d, H$ g  Q; D8 h0 |
is_special_har_run=03 i. W4 L" b7 y0 f$ B3 Y
har_ofile_prefix=""9 N% k0 z: ~2 n) q" g
7 N* Y( |% |- h2 V- X
have_va_flag=0, t8 c2 o  ]+ K3 u
have_vaf_flag=0. R. s8 U6 Y6 F6 |& ?
VAF_FILE=""6 Q8 I# w$ \9 }& q2 P4 O
VA_FILE=""/ D. m% S5 N; }8 \
ARGV=""
  `, m( K. l" v, U: ]3 z6 S; T5 |. o/ k
ORIGINAL_COMMAND_LINE=
% L/ @0 ^& a( V4 K. }7 c9 eLOOP_CTRL_FILE=".ns_ba_env"
  V1 w$ Z2 O9 VALTER_HK_FILE=".alter_hkf"( o: T- b4 M7 \' t' F6 W
ALTER_COUNT_FILE=".alter_count"
3 [% c2 [% v0 jMONTE_IMG_FILE=".monte_img_f"
+ _# h4 N/ F  e/ s4 r" KMONTE_COUNT_FILE=".monte_count"/ \6 q+ l5 {6 W1 J, d- J6 |
MONTE_CFG_FILE=".monte_cfg"( H9 J0 o3 H3 e9 \! J$ q1 R% N
EPIC_SCRIPT_MESSAGES_FILE=".epicscriptmessages"
5 x" l: ?* g( g* p% N! ~  @5 _' e, Q3 E- A6 S- T& y( d  A
open_epicscriptmessages $@9 E7 x3 o9 T- y6 l8 B
4 n7 K3 \9 N% s( q
scan_for_hva_args $@* {+ I! ^- \# V

7 f7 n! R7 l3 B* V7 `4 wscan_for_har_args()7 v  h' O9 B7 S5 c) l0 }& s' \
{8 [) o/ k8 Y( T" R$ P9 e& T
  while [ $# -gt 0 ]; do
! u) e* a) y: C- |- Y& X) k    case "$1" in
% b+ O& A; f' G      -har)5 }. Y5 C+ _( Q5 e! D
           have_har_flag=1, z) N! [, H, `* _) {2 Y
           [ $# -gt 0 ] && shift* D4 t. l. v* J0 q! R8 k  A6 H
           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then
8 [9 }4 d& t: m4 G4 n; V             har_hilo_file=$13 a- n' c$ i2 y4 h$ t
             shift
/ i  ~$ t; O6 j6 I) `           fi
) M  t4 o( z+ m1 v# r9 S           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then
# m6 k& G& i1 J( n( e% [             echo "Too many arguments to -har flag. Only one hilo file allowed."
0 s' n1 c/ i' x5 h' s             exit 1) @4 u9 b3 P4 d3 ?: }6 J
           fi+ e3 F  Z/ ^$ N5 g0 Q/ c# |4 g
           break  a2 @  {7 ?) D- C, T' z1 o
        ;;
/ C; P$ Q; Z9 E+ q' d2 }+ m      -har_setup)
/ R/ g( v7 `# w$ J* ^+ G           have_har_setup_flag=1
# t# T( z& m. ~  M           break
: L3 K5 L( N1 ^3 i5 w. t+ `8 o        ;;$ g2 R# ^/ P8 }
      *)
2 x' e3 }- G8 N. A        shift
6 |: c, M- S" c7 ?' S/ y; P        ;;4 Y& V- V! H) K5 ~6 U- {3 n
    esac- G9 s8 J, P* m$ r" H3 u; u
  done
( `, r' t" J6 T5 V' e3 j5 y}7 B5 s4 G4 F2 G, o1 b0 k! c: m
, v' N. h6 Y1 H- X! O. ?" Y
scan_for_har_args $@
- F4 |0 g( x7 S6 i+ N6 y9 [% w0 Z6 p+ Q/ b4 N' A+ L( C
for argv in $@
! a2 _+ p% ]# P8 \do# `, H. g, Z6 C: Y' ~
   ORIGINAL_COMMAND_LINE="$ORIGINAL_COMMAND_LINE $argv"0 Y8 v" V- n4 ~7 j1 j6 g- J
    if [ $argv = "-gadb" ]; then
4 u6 E9 A. a9 y3 [: f+ c) Q1 [        databaseOn="y"5 [) Z6 s7 g4 k: ~
        workDir_next=1+ I1 j8 c  o# J! M4 X$ S1 N
    elif [ $workDir_next -eq 1 ]; then: z0 b: S3 X1 P* J9 W3 [
        workDir=$argv6 V" f) f  v0 v+ [
        workDir_next=0
8 W2 E" \. w% e0 A; e* s0 L% F0 r    elif [ $argv = "-ga" ]; then
6 G3 A* t- p: W) w& J        gui="y"
7 V' R6 t6 P- E% Y3 ^; J9 v3 d4 \& W    elif [ $argv = "-f" ]; then
8 R6 Y& r/ R4 [9 R/ K        f_next=1
# \% H" c8 L+ }: d" ?    elif [ $f_next -eq 1 ]; then
# e: g! `! y; F8 J* j* o3 m, \. V0 z        f_option=$argv( n7 I% E8 x) \! b
        f_next=0" g0 q0 v. p/ R9 M1 L  k
    elif [ $argv = "-o" ]; then; m. y$ I/ u. J# k5 q
        o_next=1. q, I* I% B6 N
    elif [ $o_next -eq 1 ]; then8 _* V& s! M- l% f9 T0 H
        o_option=$argv
+ P. s' W" L( f% F" ?9 M        o_next=0* D/ u1 b7 K+ ]0 K
    fi
  b2 g8 x7 r: \, W+ V. i2 P8 c2 Ldone+ C3 v9 ^$ v- q4 A% R8 J
echo "Command line options: $ORIGINAL_COMMAND_LINE" >  $EPIC_SCRIPT_MESSAGES_FILE # F( ?- O4 m1 T/ A2 e/ \% h
* H, Q9 @* L8 e/ N! w
if [ $databaseOn = "y" -o $gui = "y" ]; then
* ?5 }0 i* x- a. t  if [ $cmdname = "pathmill" ]; then1 c; X/ e1 W# K0 ?% k  D6 l; F
    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5"  -o "$EPIC_ARCH" = "SUN4_SUNOS_5_64" ]; then
# y+ h: i' l, f) E8 G; M$ A8 `         ostore="y"
9 G% I1 M' e; i2 j0 W         postgres="n"
/ c: I6 P7 @$ @& U* H( O( P8 n     else( Z3 G( U2 \$ k% Y1 m6 Z
        echo "athmill GUI is supported on Solaris platforms only" 1>&2
5 g) ?8 }5 D+ y! A$ U5 ~- N0 [1 L0 H$ R        exit$ s7 z$ f7 r8 d/ L
     fi
0 _! D0 }- c5 v& G- Z; r4 r4 Z; E  else6 {  L9 Y7 V( `8 y9 E! O
    postgres="y"& N: Z% x/ F- b( H
         ostore="n"
' ?7 Z# N* }, p# v, M- S% B8 u  fi
' R! `' M# c* Dfi+ P0 [8 y4 t! ?2 Q

) X. w/ }; X" V$ {/ Qif [ $gui = "y" ]; then7 u) b4 T3 S3 G; P
    if [ $cmdname = "powrmill" ]; then
! E& x& v/ h3 ^: ~9 h) d7 G        pwga $@
1 y& Z# {' ~) `7 M        exit
4 s+ z$ F$ D; `. K0 B8 p    fi# ]( D. ]. s7 E6 Y/ {( y# P' N

& T+ p! A  n! `" M8 F    if [ $cmdname = "pathmill" ]; then! O* w- U) }$ {- r; G1 o8 p
        if [ $ostore = "y" ]; then
$ |8 G( n! I- [% Y0 f           ./pathfinder $@7 p8 `; `! b" T" J
           exit  [; z+ _- ?6 e( n0 R- b
        elif [ $postgres = "y" ]; then4 C0 _$ }( `/ n- W; m: c
           pmga $@
+ P* _' w: h# R2 I, P           exit
( ]) v* k- L& m7 F& N: n        fi9 w9 G2 ]9 l2 x# D0 L( ~9 \
    fi
  H6 A7 t6 h3 o+ H" f5 K9 zfi. Z4 g( s# [: [1 |6 m5 s" i# ]

0 d  I3 E$ c% j/ d0 G% J. Z3 Yif [ $databaseOn = "y" ]; then- z- |3 E) Z' w% e7 [
   if [ $ostore = "y" ]; then
, q- C6 j1 o" W9 b      if [ -z "$workDir" ]; then
) H) o2 c1 Y* g0 S/ Y, o9 L! N         echo "Error: Missing argument for -gadb option"+ f* m1 F. b- p" y5 X) C
         Exit 1
9 V) W6 p- H, C      fi2 L! j% k7 p$ e; E9 v+ G0 k
   fi
; |4 ~  t4 x6 _$ y7 R$ O5 ~1 @   if [ $postgres = "y" ]; then& Y* t+ _9 w' f' f
      if [ -z "$workDir" ]; then7 M4 d1 I+ Q/ e: m3 d3 I1 P/ T) \
         echo "Error: Missing argument for -gadb option"- H, V1 b" m0 Y, H* b
         Exit 1
/ b! E& o2 S5 {' n# t      fi
5 {- \4 P% h* J4 U7 ]9 l/ v5 H   fi
% T& a9 A4 O; V# Q/ Ufi% ^; E7 L# [0 |" h7 O$ I
: ^; @6 Y7 O4 j2 w3 ~
if [ $postgres = "y" ]; then
( N1 o. U* f7 s" f8 b/ u2 q# J. a& q) Y7 I  Y; c- r8 ]' i
    if [ -r $EPIC_BIN/scripts/gui-init ]; then7 F" u8 [5 w0 x: Q. i; U- P& f
        . $EPIC_BIN/scripts/gui-init
$ H7 A! }% A6 G  P    elif [ -r $SES_ROOT/bin/scripts/gui-init ]; then
& y8 g6 u. a6 a' G$ u# }% K8 h7 V4 ~        . $SES_ROOT/bin/scripts/gui-init4 k3 v& i0 N( q9 p9 z% v
    else( q) u( O1 y, D$ [2 ?6 T
        echo " ** Installation in \"$EPIC_HOME\" has been corrupted!" 1>&2
/ {9 c8 _. Y: |4 ?        echo " file bin/scripts/gui-init is missing." 1>&2
. t9 D" T$ t3 a4 {    fi
( k0 O1 T( x, c8 P; `  U. P4 w8 [# q, H; S( p7 ~
    workfile -tool $cmdname $@+ p0 E3 l' w. T# E) r
fi
7 O6 N3 j% s- G2 Q6 @, a$ }) e7 g1 `" V6 Q
if [ ! -z "$o_option" ]; then
* d& A1 B& H. Z2 M2 L2 |    errFile=${o_option}.err
6 u& b9 u, H' l5 N/ Y) Zelif [ ! -z "$f_option" ]; then
; j* O9 _. v( S: c    if [ -d $f_option ]; then
$ u7 e0 n6 G) ^! \, B% x        errFile=${f_option}/powrmill.err
5 ]1 {9 k7 Q/ A2 J+ {) I: |( t$ C    else errFile=${f_option}.err) p5 x, j/ |4 W* l
    fi& w# I9 E, Z0 ?) j3 P; o
fi
' P" I9 J9 b1 l2 _+ i( U9 v# H
4 k/ `: ]" ~7 v! B# V* O
* g6 w9 w# m' z( b9 D4 N; kif [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
) C$ _: O2 m6 e2 @4 I) d" E) p  rundir=.epicrun' y* ~& G$ W, u6 O
else
8 p! s; D3 ]9 j8 ?  rundir=.epicrun$$3 D  x; u7 I  ]  C
fi# k8 }- {  a9 E% B4 [5 t3 e# K; i

% N5 q; k6 d; E( Qlibpath="$rundir${EPIC_DLIM}$EPIC_DIR"( G1 @# d/ O9 T, \8 q; ]. G! t

, l2 {  D( U8 Z2 H. y) Pcwd=`pwd -P`: m8 C; m1 X, P% ~& m
if [ $cmdname = "acehdl_w" ]; then
; W% U1 \! e1 C' G9 W# p  cmd=`basename $0 .sun`  d" j/ Q, x4 l$ X4 `2 L- T: O' j
  cmd=`basename $cmd _w`
8 n& |% d( R  ~3 Z( Lelse; D5 y! M# O7 F: C9 C7 P$ h' E! y1 H
  cmd=`basename $0 .sun`4 O5 [- Y! ^6 t* q
fi, @! E. R8 ]( S6 Z' b( b

5 ]5 l/ M7 s. C3 xcommand="$EPIC_EXEC/$cmd$EPIC_EXEX"( P- o' N& f; V, e4 `( K
[ ! -x "$command" ] && echo "$cmd: not installed!" 1>&2 && exit 1
0 W* H* N* k/ z0 _" C$ D; Z; H
% _' `- A' f# S5 c6 V: V; j# buildmod extracts -u/-fm options and calls genepiclib7 D9 a+ g8 |5 W2 Q8 a
# It also set the remaining options to variable CMDLINE
) j. j: r0 Y3 s# look up in .epicrc for -fm & -FM parameters- C! Y9 r5 H2 j& e; f5 p: k
) T$ Y1 I. y  \, f' i6 j& Q! _3 Z7 ^9 ^
fmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`"2 j/ i9 Z( T  `6 x8 k+ k
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`"+ }6 g6 o: ?  \4 [, P3 W
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`"7 H  Q+ k$ [3 p' c0 K- O

& _- U8 H- j) ~4 s) L' @FMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`"3 Q" _- p# L" t8 [: @2 g! O
[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`"
( M* ~$ U/ \* @8 r+ ], T% X[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`": H5 M: u2 y! y1 X
  ?" H4 ?; J% e0 w, W6 I5 n1 M+ h
if [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then
1 n( p9 j+ t1 x; }0 ]8 Y9 v5 p    # note that the buildmod script will set the CMDLINE variable
1 Z5 _9 }. h4 G; o    . $EPIC_BIN/scripts/buildmod
! J; {6 K$ B) E! _/ L
) u: V; f0 |& U" L    #echo "This is the value of cmdline=$CMDLINE"1 k! X8 S; W* n$ v1 `  B* x* l% v
    #exit 09 d, X+ J4 k! b: B1 R" ]9 r

, D2 U3 T0 k" c) a$ Q    # if a new timemill/powrmill/pathmill built, run the new one
% B8 ~" \, T6 X. c    [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX"
$ A8 A9 B) h- y6 N0 g' G8 Cfi/ S2 x3 w  D/ `5 m
- }: O+ q( [" \3 I
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then9 i: k$ ^1 Q5 s6 d
  if [ $have_har_flag -eq 1 ]; then
* \$ n. h& {( o    is_special_har_run=1
6 e6 V+ I: k" H) x3 K    if [ "$o_option" = "" ]; then
4 _2 m, }/ {8 s% Z3 M" E# l; A      case $cmd in
* ~6 t/ q( J/ [4 J        timemill)
1 M5 J4 E, F2 ]( q# q0 i+ Y          har_ofile_prefix=timemill
- n2 ^8 p7 K- ?' f          ;;
6 u# Z- K: ]2 H+ u4 J, D        powrmill)8 m! R, Q9 T- c+ o5 p1 @7 _: [1 D
          har_ofile_prefix=powrmill
+ n% x, z' ]+ h' ?" z* E( w: C          ;;
5 V) `, g5 o  m- g, R7 C6 @        nanosim)
# A4 }% N# {% U( A1 v          har_ofile_prefix=nanosim7 I" x; L* d3 g( D
          ;;
' n) `1 h) S; }4 H      esac
" X5 b* Y- ^* A+ X7 A/ z: B' d    else  L" h3 ^3 d# k+ k5 y) j& Q7 C7 ~
      har_ofile_prefix=$o_option
1 X/ Q$ b# v" `, o7 ~( R    fi
6 S0 k/ B" n( f: h+ _/ j0 w0 Q fi
( m. \. W; T4 _3 H5 D# q5 Mfi
0 e3 Q& A- p3 I5 x) X7 B
! e; ]. B' N7 G& o9 p8 F- J# Call Double precision version of the product if -D
& S+ R8 C; l5 P! \7 X" T# or simulation time > 1,000,000 ns.- p( ^+ e: j; Y+ S$ v
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then, s& i) E. e8 z3 f$ S2 ^8 k: P+ Q
% u' S' L5 I& X# e- n0 r
  # Now the binary always has the ACE feature
; ]& D! Q; t; F  ]) e  USE_ACE=YES. \% U( o& B2 V& @3 e

- ?, y5 v! v6 Y4 u+ @( N' f  HAVE_DP=NO  O. [2 x; U8 S: x4 O+ w
  EXTRA_CAPACITY=NO
1 f4 ?& s; @; D/ n! b3 B. s1 M  DB_REAL=${FORCE_DB_REAL:-"0"}
' X. B3 u- |% v$ a0 @+ M- \! _7 P8 {4 c4 [0 g9 f& L, V/ U5 l
  # Enhance for ACE ease of use4 e" R* _- \9 H; B. B5 b8 }- K
  # If no command line option or only a -T option, do:0 O) Z* _$ ^5 Z( n; p) y0 ]5 L- u
  #   1. set -A option# O' U  R2 s4 m' z3 v( b
  #   2. assume input file to be hspice$ y! t9 m# k( V: G9 s0 D
  #   3. set -o to input file prefix2 d7 H( t% P. T2 [# z& Z2 E
  #   4. set -z to input file prefix
" _$ M2 O# w# i  #   5. set -c to default config file
4 U7 u$ H4 U3 z) {6 E" J# U9 e  netlist="", D( S2 z4 s4 a
  minusT=NO
1 f! Q( u  @4 s! p. C0 }2 @  useStdCmdOpt=0
- G! h& f2 n: V0 J& B% }! n& P  prefix=""6 V* O, s. P6 x" g$ u
  circuitType=""
3 Y9 Q) p) E& t/ I% Q$ G  for opt in $CMDLINE5 H$ c" i; F" F; }: `# d
  do
+ H, c( e7 s/ G, J" g! @* G    case "$opt" in
2 Q- F) J; F. s$ w7 x9 U5 @      -T)
3 y/ u; P* Z$ C8 _) Z        minusT=YES
! i+ q7 g0 ~' \        ;;
- e  P6 D3 _, w  n  A5 g" F% X/ C      -*)$ \" Z0 `. d3 T, N& F
        # using standard powrmill command line
- X- C9 G3 Q/ i* r3 W7 d        useStdCmdOpt=1
+ w# S4 K" H) s        break# B- Y' U0 d* {* V
        ;;
% x7 f& d4 i0 P. i      *)% r! b! y4 C, d: W  F
       if [ "$minusT" = "YES" ]; then  M6 H3 C, A9 ?" w+ u! j1 z
         circuitType=$opt7 _+ ~. W; Q8 o& f* ?
         minusT=NO  # reset flag
5 O7 B' s5 K+ l$ K5 @' \       else % a+ w# V, }& }$ W! Q8 O- M( `: m
         if [ "$netlist" = "" ]; then
7 E' V# X% `) K  e           prefix=`basename $opt`
, z- X& Z: C$ V- F" R           prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix`" O& b* F; b/ Y9 I$ v- S
         fi
* }% S6 c: g& n0 ?         netlist="$netlist $opt": r3 e) K# ^+ S$ A
       fi
! T! y  h. E% e$ `9 H       ;;) h- \& q! \3 _7 n! y
    esac# U; g% B8 ]4 U* `9 K. `
  done: a  a" I6 q* g9 W6 A5 N
* d. n) |1 u. J3 q5 N

% F& H4 }/ r# t7 Q6 s+ c( y  if [ $useStdCmdOpt -eq 1 ]; then
6 N! D8 T5 Q6 n% u    # use standard powrmill/timemill command option
) w8 D9 H$ |4 P2 T9 R    for opt in $CMDLINE
+ o& Y, K4 n4 E% q. I    do
( [9 G# t2 T+ N* S      case "$opt" in 8 @) ~. U" M( l, X  |
        -A)
' L' _1 M3 ?" S: C- S' N            DB_REAL=1+ e( A- r0 P+ K$ {* e& W3 \. o
            ;;
8 r' ]7 \8 y; o- Q  B      esac
8 H1 U8 o# g0 D$ @$ v    done* n0 L) ~' E: D6 [/ k' m: a5 n
    if [ "$netlist" != "" ]; then
" z; b& |& |! M9 z& y( b      CMDLINE="-nspice $CMDLINE"
1 F9 L& O+ e* q. R    fi
4 \2 s3 A/ G2 C6 [  else% ^/ l" n+ T/ x' p9 O5 Z
    if [ "$netlist" != "" ]; then
2 N+ |7 _& L9 N7 S2 ~' E      EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"}/ O9 p9 ?. ~6 b4 G* t
      # construct new command option+ w; q& b& ^8 ]; n
      if [ -f $cmd.ini  -a  "$circuitType" = "" ]; then3 {& J# J: u' Z9 H, N
        CMDLINE="-nspice $cmd.ini $netlist"+ k: m1 Y% Y' b2 q& [8 f$ |
      else0 B5 p/ \$ J" q! q% }
        if [ "$circuitType" = "" ]; then" w! N9 v( h; W# }% e5 L
          circuitType="msana"
4 r& E' H" p9 O# W        fi0 y6 R. K8 \5 e/ R* M( L1 B# [
        CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg"& Q& l8 I! m) P" x
      fi
0 n3 t0 s5 j* C$ U$ U      CMDLINE="$CMDLINE -A -o $prefix"
* p  V& h3 F( t& @6 E      DB_REAL=1. r+ f, x: p6 F( ?
      echo $cmd $CMDLINE
7 T8 n2 I# t; ^# q3 ]. v. H$ M    fi7 q2 r- ?1 q: n
  fi1 m: w! C" ^8 n* u" r) \
fi # cmd is timemill or powrmill or nanosim or railmill or pwarc1 R0 |# g% ]3 B, @; \$ ?

' c$ c5 a8 f9 k# W  ^* {2 q2 N[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a"+ C6 a$ H/ H; B+ v. N
[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a"
2 E- D4 i9 D& `( t% {[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v"3 |3 T6 P1 m5 q7 e, e6 G
9 h% s/ s& V: w
if [ "$__engine_wrapper_called__" != "Indeed" ]; then/ V) B" l8 Q) E, W9 r5 k/ R
    __engine_wrapper_called__=Indeed- R7 x. n$ e! o2 y& p1 U
    if [ "$cmd" != "amps" ]; then% n3 O) m! [7 G6 [
        export __engine_wrapper_called__; v4 ]( P8 x+ j; N! ?
    fi
" x  B1 Y9 ^  R5 s
  V0 o) a7 T' ~, L& p; V    trap "cleanup" 0: Q( \) C8 W/ I8 G
    trap "" 2
+ Z0 W* r1 M; e) w% l5 I: ]; C3 r: y! s
    [ -d "$rundir" ] && rm -fr $rundir. E" I0 D" \$ y' {& Q. t% t# c
    [ -d "$rundir" ] || mkdir $rundir% B  @! e/ L9 X. @4 S2 I" n
+ v) N) x% S+ Z" |4 K) \4 u
    case "$EPIC_ARCH" in
& Z& }5 p+ o9 s( n0 I    *SUN*64)   
7 d9 O) ?+ G  _/ H1 s        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"2 g" H/ o3 v: n1 [3 u; V0 @
        export LD_LIBRARY_PATH- u$ }( r" s  A, }, \8 D" T! o. t
        suffix=.so
# ]. Y8 w6 J4 i, y( v# m        ld_err_code=127
* P1 B5 L4 M$ |3 h" @2 H& c8 b7 l        ;;
$ N' W) i* B+ n8 O9 ?% K* \# ]    *SUN*4)   
: g% n6 K. I* h5 C3 Z) k        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
' c* l" }2 m/ D        export LD_LIBRARY_PATH6 c; L1 Y5 H! W: k5 U) W  H/ W/ a
        suffix=.so.1.0
7 f; a7 L' v/ Q0 W4 ?; j+ N        ld_err_code=1272 h  X0 c& t& O" \6 k- S
        ;;
/ S' x, m6 w7 h& `& I% c. o    *SUN*5)   
' f2 D  b' p8 e. M0 S3 p        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"$ ?: H# f; H( |
        export LD_LIBRARY_PATH+ J2 }9 s+ N% _5 {$ @$ j
        suffix=.so
* L6 H; y. |3 ~        ld_err_code=127
5 R# `6 r9 I9 @# n7 w9 q- m        ;;% J  J& y* D+ X& B7 s
    x86sol*)   
! ?" `+ M3 l$ w) n1 E4 \        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
$ X5 M) Z0 _9 L- }        export LD_LIBRARY_PATH; C$ [1 D5 @7 f" W" |( N8 R+ ~- ^
        suffix=.so, ]1 ]5 h; S2 c6 Z7 M
        ld_err_code=127
# b6 j; L* Y+ r- t1 y0 Q        ;;2 i) o$ T+ W' E+ y  W# H
    *AIX* | aix64)   " K2 k! J  X* _, G) g6 n
        # When genepiclib creates shared objects, it creates a import file and
2 t- F; S1 Z' ?) E  `. m        # uses timemill as program. So at exec time,program timemill is needed
) t' L, \9 \  T7 a/ x        # in LIBPATH6 L( C- ?0 @* M2 R8 v5 m" Y7 a
        $ln_default $command $rundir/foomill6 i! m. i+ R+ K# u
        LIBPATH="$libpathLIBPATH:/lib:/usr/lib". {5 O+ H7 x% P
        export LIBPATH
# k7 b6 r) {3 ?  d        suffix=.o' q" N. Z8 F5 I6 R
        ld_err_code=8
; j) f$ `& [) @) R8 p        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
3 K- A7 M, t6 ~# T' Z, T2 J9 F2 w          tdir=`echo "/tmp/d"$$`$ c& `1 L5 c+ z1 O4 t, N
          [ -d "$tdir" ] || mkdir $tdir
- L" Q8 _- ?5 _          if [ -f $EPIC_DIR/libCustom.o ]; then3 |, x0 b& i! g" T4 X  R# g
             cp $EPIC_DIR/libCustom.o $tdir/
+ L6 n6 D* u1 J# Q' r* o6 m' D             $ln_default $tdir/libCustom.o $rundir/9 q0 _4 G$ W; h3 H
          fi( d& e5 S+ S: h( n, `: W
          if [ -f $EPIC_DIR/libModel.o ]; then
4 W% L# e; `: J* Z9 f/ r9 }             cp $EPIC_DIR/libModel.o $tdir/
* ?6 @8 C( j# D" Y; A. P& E1 p             $ln_default $tdir/libModel.o $rundir/
: Z- n6 Q; E9 H" z9 G          fi2 V' l$ o. C1 C5 ~
          if [ -f $EPIC_DIR/libFuncModel.o ]; then/ Y- t7 V+ `" {1 U
             cp $EPIC_DIR/libFuncModel.o $tdir/5 H7 B9 s0 \! L: b5 z* a' z
             $ln_default $tdir/libFuncModel.o $rundir/! G9 C8 m% S* L% ^
          fi# {5 O% v1 L$ Z, S5 A! x
          if [ -f $EPIC_DIR/libFuncModel.34.o ]; then6 w4 u2 Y9 \! B' E
             cp $EPIC_DIR/libFuncModel.34.o $tdir/
+ ]; R1 {$ s- F             $ln_default $tdir/libFuncModel.34.o $rundir/$ c- |- H% G2 U$ E+ U3 I
          fi
" q' ?: w5 t. ]6 d        fi5 ~' s9 U& ]# S$ _" i  J2 x
        #Set the IBM flag to enable more shared segids
) ^' \" m9 O1 l( f0 I        EXTSHM="ON"
; o, G5 o( Q/ A1 K$ w        export EXTSHM0 |- s' s3 E, j' @. _
        ;;
2 M& Y  m  ]+ B    *LINUX*)    7 X  D7 w7 A, ]  n
        suffix=.so6 \' t9 O+ X% {0 d
        ld_err_code=1
- T; G4 k# Z; B3 Y# K        ;;0 Q2 ~" X* h+ O4 @" C  }+ Y
    *amd64*)
$ E1 t6 N/ G; \& Y        suffix=.so
6 D4 Y5 T# c# b" L( r- a! M        ld_err_code=19 a4 L7 y0 @3 |% m/ Y
        ;;/ A5 v: w+ q" h7 e- @/ m- e* @) |
    *suse64*)6 g1 I" n- r2 j" |# Q
        suffix=.so
4 x$ s6 ^  L; _+ \2 m$ E7 D. V        ld_err_code=16 ~$ ^, z; D0 @2 p# J
        ;;- g$ g' E3 r; w
    *suse32*)    * g/ R1 c6 D: g: i4 A- a! G  W
        suffix=.so
8 X/ _2 @  x3 l" b8 [        ld_err_code=1! K* i- V4 m! @. T. O, d! _$ ^
        ;;  b+ C  X7 k2 ^: f0 R
    esac9 [- Y; f0 N) E& R! W

& T7 H' h7 I; {4 h& A9 \    [ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix"% `) j( a( _( g* s+ S9 x
    [ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \
! u# u; t: N+ g0 Y. P        && [ "$cmdname" != "nanosim" ] \
) u4 W( p6 e) A5 j! B( b        && [ "$has_model" = "YES" ]  && ulib="$ulib $cwd/libModel$suffix"% ~2 H) R+ i  Z" J% e- a! g
    [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix"3 Q% H7 A" z" f- o, ^, P

) t3 O' v) h$ Y) l% q6 |; ~#Look for command line option for libFuncModel.so
: m" K8 |3 ~3 F# w#    user_library_next=0
( r2 ]# q7 @7 R. |; f/ p0 \    has_fmlib=""
( b7 s; ?; \" N& @    for opt in $CMDLINE' ?0 [. w( b$ C: D# u8 e
    do
2 ?* u( o$ N. d! B* i* B" @* p      case "$opt" in
; [; P% `- g# c$ a% I- H% n        -fm)8 n" v1 E! Y, [$ u5 {% w
            CMDLINE="$CMDLINE $cwd/libModel$suffix"
0 S! s7 x+ |& b; W2 ^            ;;
4 J& v  x  i2 y8 k+ i        -fm_user_lib)  J9 t! Z8 g, v, `9 }9 N
            has_fmlib="YES") U7 d6 R* n+ R1 i# L
#            user_library_next=1- c1 `. _  C7 Z$ E  F% W, n
            ;;
$ Z  M* t/ V( u        -xc)
+ `4 h( M5 B( r& n) H! e/ v) H7 [            if [ "$EXTRA_CAPACITY" = "NO" ]; then
" z1 J4 d8 f* K, A! H            EXTRA_CAPACITY=YES
+ U0 S; e3 Q. }, ?- {- H            fi
9 I$ M" J9 C7 m, z) S3 ^            ;;: Y3 S& ?9 o/ G
#        *)
+ Y, o$ `! Z# s! c  f7 m  Z3 f#            if [ $user_library_next -eq 1 ]; then& }( C3 f" F( M; ]# f2 ?
#                if [ -f "$opt" ]; then) R2 e& g$ i" o
#                    libfmodel=$opt" i* K, D4 I  e9 o; x' y6 i5 z
#                else( q2 C: O1 E& D
#                    echo "-fm_user_lib: Specified file not found"! L; r$ O* f7 F% X+ h* n
#                    echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages
, R+ |  L$ r0 m/ f$ s#                fi
4 Z7 R: r1 W, G  l& o1 i#                user_library_next=08 u. l4 j, J/ [. }% v, E
#            fi- y8 V. i& H2 \- ?1 e- a- i/ r
#            ;;
$ |- Z0 K$ h* ^0 U+ p        esac
) S5 j! W& i+ Q, N* P# u& C    done. Q/ P- d, P) g; E& L, ?* u' a

8 f! L0 ?, }5 j/ g) O* ~    if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then9 j( L4 D7 {3 C' J3 E! q
        flib=""! h! U7 f4 H. w/ u1 y9 t
        if [ "$has_fmlib" = "" ]; then0 M% q( Q, |6 O5 W' I; h
            flib="$flib `get_epicrc ./.epicrc user_libraries`"$ i5 R! M9 _1 b; T
            flib="$flib `get_epicrc $HOME/.epicrc user_libraries`"
; {4 @! i7 j, q            flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`"
' |8 ~7 |* u8 V' j        fi- n7 ]5 t* z& a2 K% q1 P. U
    fi% r( e- p! T$ b) T; S6 p' W; g
/ g# A' e( c  ^3 n! l
   for i in $ulib. N7 x* e( w0 l
   do
2 Y* e% D( f4 p+ Z2 Q2 Z       [ ! -f "$i" ] && continue1 A8 c" j  R& M, f; f' A9 x5 D5 @8 Y
       dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd
' K2 G1 E( S9 [# i7 I) F       i="$dir/`basename $i`"( g3 O0 G. E: @% t
       case "$i" in
0 w8 q+ L# f  [  @2 S7 N, @- R- e       *libCustom$suffix*)    [ "$libcustom" = "" ] && libcustom=$i;;! }; _2 B2 N+ B( D$ a1 s
       *libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;;5 w, ^$ U( h0 w/ u! ]
       *libModel$suffix*)     [ "$libmodel"  = "" ] && libmodel=$i;;
2 T( i5 Y6 }! V6 [& P0 v7 @       *libva$suffix)         [ "$libva"     = "" ] && libva=$i;;
: F) [$ l* W7 x3 r. K       esac
2 ^1 [7 X  ~3 ?7 A8 N       [ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \
8 v; R1 P. ]! d- E6 k        && break
9 [. _& V8 v$ S: |* i   done
  U3 T, _& ?2 i0 u9 W8 E. X1 d$ F: @; q, _" Z/ d  r
   # symbolic link shared libraries to .epicrun$$# u& l: X" U4 m" i" K
    cd $EPIC_DIR; epicdir=`pwd`; cd $cwd1 k4 p2 `1 U* h* s" A) v
    if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then
) e! u- ]/ a8 _* H6 P% @  Z        if [ "$libfmodel" != "" ]; then$ z$ a& @8 G. C4 E1 Z; U' O
             [ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \$ e& ]4 u+ s3 g8 W; N7 Y4 n
             echo "Using $libfmodel ..."  && \7 A6 w8 H9 O6 ]5 V
             echo "Using $libfmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE* R4 {& d; k( `" b+ `- g
             if [ -f $rundir/libFuncModel$suffix ]; then# f5 E# T- }% w* G4 f- f0 t) r
               rm $rundir/libFuncModel$suffix# E* M) d6 g+ O8 x! r
             fi
+ E* n8 l4 W- I4 k$ F$ ^% l4 {" V             $ln_default $libfmodel $rundir
$ x; {; t# z. t9 J7 x. Z        fi  L  ~4 _3 B7 }) f- K8 e( ~
        if [ "$libmodel" != "" ]; then
: n( R  O6 C# n- Q4 r2 n- R, d             [ "$libmodel" != "$epicdir/libModel$suffix" ] && \
  Z0 ]/ A7 M" E7 V             echo "Using $libmodel ..." && \3 o8 g, z2 B) `) @0 s
             echo "Using $libmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE
- i1 w" g0 Z8 z: o$ g             if [ -f $rundir/libModel$suffix ]; then$ o/ {& Q9 K3 m  h& ^  o
               rm $rundir/libModel$suffix: z1 C6 e% P1 g
             fi
" M9 g9 N; t* u- z/ \, X+ U             $ln_default $libmodel $rundir
2 c" @0 a! A; Y7 \& \2 y        fi8 J  @5 d( y# b+ I7 u5 k
   fi! L2 t  F* b% z# u4 X
   if [ "$libcustom" != "" ]; then
1 C5 E; i% C' P" r. B& k        [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \
7 y5 z+ v4 ?6 U$ r/ b1 Y        echo "Using $libcustom ..."
! d% t9 V; D3 M) [9 R; ]! b+ \        if [ -f $rundir/libCustom$suffix ]; then
2 q- h% V2 h3 d+ I7 C  n3 u% d6 V# s          rm $rundir/libCustom$suffix
  y% ~# }1 g3 P; ?: D) S        fi
+ M. |' ^0 O' h+ T4 k        $ln_default $libcustom $rundir
7 e1 Y7 F* a% Q% ~: q' e: M6 o/ v   fi
9 L; o+ Y- k$ T$ l$ m
  w8 l: R, u+ |0 L2 G5 p   if [ "$flib" != "" -a "$flib" != "   " ]; then
$ L& m+ i* I: g$ j# O- Z/ y        CMDLINE="$CMDLINE -fm_user_lib $flib"
9 J: Z7 C! H5 |; E, F( ~3 t1 a* t$ Y   fi
) K0 h3 O# @+ f0 W  W7 Q6 D1 b! S9 F" u! \
   if [ "$libva" != "" ]; then
1 N" B4 n3 S9 \1 Y% m. V        if [ -f $rundir/libva$suffix ]; then9 ]2 C% e$ }1 T$ e& e0 j! y1 G
          rm $rundir/libva$suffix0 a& s0 T9 i. O: j
        fi
  y) |3 P: l! K- {+ d2 w        $ln_default $libva $rundir 9 c* g4 }& l( l* T
   fi
  Y# b# l) [! @% o0 ^/ t8 z2 Q$ r# {4 _# z

3 D% s8 ^% Z. k/ ^& y    # VCORE design library
, R1 P( [6 O6 C    if [ "$vlog_design" != "" ]; then
; ]# U' o+ g# n* f+ c' H* o        $ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`
$ q+ O% ?: T7 j7 L1 O2 w# a# ?    fi) k+ {5 e/ [: H; h  f
# P4 n2 ?5 y! S# _- O: i" W
    if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then
1 {3 h- T6 x+ H# b" Z. w        EXTRA_CAPACITY=YES% S, N. {0 Z& J* K% v
    fi: u4 ^0 L# O0 X: P7 u6 D6 A2 N
* f# m  ~& e2 d, l! N; c
    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc"
5 T: b1 j- V: {    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc"
3 `7 ~& q" `4 {; T8 E    #Create temp file if dual process is on
! l0 ~- O- k! W    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then+ u( q7 h. l( V( S% ^
        if [ "$EXTRA_CAPACITY" = "YES" ]; then
4 C( R! l; |& d) I: I            touch $rundir/rpcidfile  S. p. t3 W" Y8 P
        fi
( w5 }& Q% i0 Y, B# ~# f    fi
4 X, p. }2 K- e1 |+ e& H8 o5 V( ~4 G* _fi
- u% E7 J2 ~9 ~3 l- ^$ j' o1 v9 G1 L. q+ G3 Y1 c0 Z# I
run_cmd()- h. s5 C8 S3 b, s" N- f
{
$ ^) L/ @9 b( k$ Y$ @% |& c7 U. d  command=$1
  }$ E' v3 c' \+ l  shift
8 Q- _6 W5 R% \$ C6 Y. T% R; M1 P& U# c6 j! f+ [4 V
  if [ x"$VA_FILE" != x"" ] ; then
6 M+ R0 W8 c: r& y( L+ S% z- t     cmdline=$ARGV
% T* j% ]7 |2 u- C$ s! K# q6 k  else( b0 z9 ?+ L; C* m0 I& I
     cmdline=$@/ i. X  h; Z. g8 \% d7 [+ X
  fi, M% I4 b( Q5 ?7 s

* [1 u" D9 F4 Z: ~  debug=${DEBUGGER:+"$DEBUGGER $command"};: |: ]  f- X! {1 i5 k2 L  D( u' c

1 E) V, T/ T. ~. A' ^  # To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a
; O3 c5 c4 K4 Q  # so save-restore may work.
8 H* D4 R0 x3 |9 o  setarchStr=9 o8 f/ r4 }( _2 P7 x" K. v- x
  cmd2run=`basename $command`
: ^  Y: k# |, L  if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then- H$ i. N6 b, P
    if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then
: V2 O4 l2 I8 R) f0 u6 e      setarchStr="setarch i386 -R "
. Y/ Q# i7 m; u# {2 ~    fi% H. b7 d$ S% j9 z, `% Z
    if [ "$EPIC_ARCH" = "linux" ]; then
4 m( T* `; s5 f. i. F      setarchStr="setarch i386 -R "
/ s" B3 A- h. u    fi
0 D7 I+ @+ @- E; l+ S0 b1 D9 A: g    if [ "$EPIC_ARCH" = "amd64" ]; then
; q' N% V% Q5 ?8 Z9 z      setarchStr="setarch i686 -R "
# X* v- O9 V% o  U3 a& {    fi; ~7 g  \2 Z' e8 I
    if [ "$EPIC_ARCH" = "suse32" ]; then0 z: v2 s# W6 G/ Z4 F& F" P
      setarchStr="setarch_suse i386 -R "
" l& e2 [0 ]0 i4 `( P+ k( x' |- f    fi
: L& H' c) L+ y1 l4 d: I    if [ "$EPIC_ARCH" = "suse64" ]; then; }7 S" i& h7 |
      setarchStr="setarch_suse i686 -R "" ^- A! F, c" \: T
    fi( F4 b$ L! g( F; d
  fi
' w; y) H+ [# ?8 V  N7 a
3 _3 ^, a7 _. u! R0 P  ret_stat=0. W5 v. k$ }# E7 R& S
  if [ -x "$command" ]; then$ W# q0 Y$ \2 K  u5 e6 v- E% ^
      if [ "$debug" ]; then
3 T+ B+ A: n- a' }        _debug_args_=$cmdline( I; S( m. t1 p7 `4 A4 R7 }
        . .epic-debug
& M/ T/ V3 {: V0 L8 J      else# L9 f3 C9 `7 F& h5 D0 N2 G8 F
        DEBUGGER=; export DEBUGGER
, p1 X: ^% Y8 q7 Y" `! ^0 s        $setarchStr $command $cmdline2 t% `  Y& I1 i9 [1 `
      fi
7 ~/ N7 w$ |8 P- ^      ret_stat=$?
5 F$ C3 N! A; g# S$ e2 l  else+ Y6 {7 Y$ ?' n3 p3 E3 E0 Y8 s, Z
    echo "Corrupt installation, executable \"$1\" not found!"
) K' g; T' }# T& W    ret_stat=10 L$ l) P1 q9 H: v; T8 \" k; V3 V
  fi
( B/ l4 [  g9 r* Q! K4 V+ d}/ x) I: T6 I2 P: a8 f: x# f$ V
8 N0 L0 U% P. z
# keep runing cmd if ctrl file exist
4 n# [6 U9 m4 G; p5 x$ u% Q( x' ~7 n2 `
run_loop()
" z/ w! Q! E( u7 D* N{3 @  s1 M6 Q$ n2 G% r; y% r6 b
  command=$11 G5 R+ h& ^4 n2 l* K
  shift
+ \$ v& A0 f' B* H2 u) D; h% z; f5 R8 E6 E* l# A8 Y
  if [ x"$VA_FILE" != x"" ] ; then' v4 N( Z4 {5 [8 o  O# b
     cmdline=$ARGV
, S2 z9 `  i. m7 H  else
6 u+ Y% P9 ?8 G: l     cmdline=$@6 |4 u8 c- O% ?/ v2 P
  fi
) ^* R; v& ^+ E4 f: M* R' h4 x; J% A2 \
  while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do8 @# d1 @. _) s1 q; }# \: \
    . $LOOP_CTRL_FILE$$
/ @" J3 V+ ]. Q6 G' ?    run_cmd $command $cmdline -banner 2
& b" L/ W3 T, Y- q: k, i$ d  done;  [/ @* I+ A5 o4 W( V' t& W/ y
: L! q- n7 O8 D7 P
  if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then) y# }; g3 B* [# V! w7 Q+ p
    rm -f $LOOP_CTRL_FILE$$
+ U: a9 c$ E  j6 z- P: h  fi/ Y( ~* `9 Y2 x0 B) \% y
}
2 ]  W3 ~# E  p2 @3 O, U( `
  p0 i! P0 s/ b# R& thar_check_ret_stat()
; y) p3 G+ i' E* c& _  g{
+ D5 f6 @; _0 H9 Y* c' F" r3 T  if [ $ret_stat -ne 0 ]; then
! p+ j. }+ x' z7 u- Y: v( L    echo "Simulator returned with non-zero exit status. Stopping."3 n5 ]# `5 R' h, ?# M  l
    exit 1
. u! ?) A3 b6 R" J% M  fi' E; j2 U6 Q' g
}% ?% k$ I* F2 q: ]$ W$ g7 ]
+ j4 e8 `7 m2 T& O4 r' l
#& T. j. F% j" ]* ]6 X$ {
# set stacksize and datasize limit
, u' g; D% Y7 A* a' z#2 ]0 {  q8 l/ D. [
" D+ F% o% s8 g2 T
set_data_limit
  u" }! U+ ~8 G( B/ p5 Nset_stack_limit- Y1 `. E! J6 K) h" \
1 a* w! o  m  u, h+ Y  I
#rm -f $LOOP_CTRL_FILE* d, N# a+ T+ @/ U7 B
# r: p% s8 ~# j0 j7 N
run_main(). n6 ]+ A' r: ]9 e- [4 @0 X
{
: \8 k3 m8 P: Tif [ $is_special_har_run -eq 1 ]; then
: `. S  N1 S6 H! ^$ w  if [ "$har_ofile_prefix" = "" ]; then! G$ N8 G/ r  y
    echo "Wrapper bug. Notify Synopsys technical support."& C# B" E# Q+ q* S7 V- d% x9 c( A7 |
    exit 1& B2 b( ?1 C) k, O* M
  fi
! O7 R+ y. p1 g, n  if [ "$har_hilo_file" = "" ]; then0 U* j0 G5 h+ j
    # no user specified hi lo file - do both runs
- [, B4 e% M7 i    run_cmd $command $CMDLINE -har_one -har_setup
3 j% u. [; E! C. l$ K    if [ $ret_stat -ne 126 ]; then* |* a2 \4 v( e4 s; N
      har_check_ret_stat
0 f1 B8 D, F; D0 J1 ?. R      if [ -r $LOOP_CTRL_FILE$$ ]; then
* B: s  c& }6 x        run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl
4 ~+ V. s. n# p: b/ e' i' ?        rm -f ${har_ofile_prefix}.hl
7 I4 t9 a& I$ d5 h. A# W% [& e      else
" b  y% ^7 ~/ L' C0 I3 O        run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl
+ M: I# _8 b8 g      fi
/ G( P, U3 R) x2 a' G    else% k& ~# V3 f5 V
      ret_stat=0
, ^1 x8 [, A' w5 B. y$ H    fi
7 L# b; ~+ M* d% ]( e& u  else
0 P! W3 ]1 q! P3 g* v7 {" T    # user gave a hi lo file name
% m" R* I! p1 ]# y& b3 J; D0 {    if [ -f $har_hilo_file -a -s $har_hilo_file ]; then
5 X+ x6 V% a. ?: v( a+ }0 B      # file exists - use it - only do sim run+ {: ^- L8 r" j% j0 M, s
      run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}( s: r& Z2 Z! w/ ]
      run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}
3 e8 u5 ^8 I* Y4 i' g    else
: Y" J5 w3 Q' e2 k9 u4 u" X; X$ R      # no such file - generate it - do both runs8 C* _+ y/ Q( E/ N8 ]! t# ~- g1 X3 b& Z
      run_cmd $command $CMDLINE -har_one -har_fnf -har_setup
7 {' p9 p8 s6 N: p      if [ $ret_stat -ne 126 ]; then
1 D; ^1 `1 H3 S, I1 r8 E        har_check_ret_stat% |% ~1 V& Z4 J& u- v& A
        if [ ! -f ${har_ofile_prefix}.hl ]; then. F/ a5 i8 ~, \( ~
          echo "No hi lo file generated after setup phase. "
; n- {. Z' X2 Y3 e+ B          echo "Contact Synopsys technical support."  U* {5 t( u/ X/ X
          exit 11 _2 n2 g8 _' p# F7 l
        else8 _+ Y& F, G2 y) w7 l
          if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then
8 e0 ]4 b7 ?% y3 f8 y0 z            mv ${har_ofile_prefix}.hl $har_hilo_file
- g/ h6 J* s4 i. ^% T          fi9 C" h# H- W! e' f8 T8 u: @) [, ?) u
        fi
8 i5 g' t+ r5 o/ d4 l        if [ -r $LOOP_CTRL_FILE$$ ]; then
. R, f! w. |7 o- G" X          run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file
! N% ~5 Z' @" h* ^        else
0 }  W2 w; P- _3 J5 X8 [0 _          run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file9 e, ]' X. M/ V7 W$ i
        fi
& ^! ~# Y2 V; d. T, `      else # x4 z5 o# p  B" X
        ret_stat=0
# T, O2 Z7 N1 w. b6 t, }5 [) Y& S      fi  Y. v* \& P# t/ K' {4 k; A2 k
    fi. \6 l7 L( F9 i1 n2 l- m
  fi
! i2 k  M0 E& Q# w! u3 O- qelse  0 F' ~* S+ F% I9 J; V. l
# don't loop if -har_setup
3 Z  s8 B) g% I2 f+ l( z2 k  if [ $have_har_setup_flag -eq 1 ]; then
% ?/ \7 ^, a$ u& u% K; q    run_cmd $command $CMDLINE7 j1 G5 R# K+ S* Z/ U4 d
    if [ -r $LOOP_CTRL_FILE$$ ]; then% y8 k$ r4 T5 l3 I+ _" B7 h( q
      rm -f $LOOP_CTRL_FILE$$9 E2 N( `- c) N
    fi
5 a( b5 {( w  D4 {3 W; I  else! |) P+ E$ U( S) n- H* y
    run_cmd $command $CMDLINE
* W* Z7 \- b0 |  t( l1 Q4 Y5 D3 n3 p    run_loop $command $CMDLINE
6 v4 E0 `+ U  P& E8 a  fi
: C* m" P% k- O" Efi
9 L8 |) f2 o( U0 f8 d; z( c, l
6 b7 S2 S4 l( [) m4 d- {3 Rif [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then
9 [9 `  J9 N1 S5 g7 N  pwCreateErrDB -w $workDir -e $errFile' o! S) Y6 m% _' m; H
  ret_stat=$?( }) v5 G) N  h. W
fi6 }  P' z+ @' _( s
}
+ {% A& s. h' i" B
& \2 }1 `* J9 l# z; Y0 Z4 y/ ~cleanup_alter()% E0 H2 p* U$ e5 ~3 V/ i! ^& K
{
# ]: H8 x  i" a6 R/ b; B1 {   /bin/rm -f $ALTER_COUNT_FILE 1>&2
, S" ~- {. a* G& r) e   /bin/rm -f $ALTER_HK_FILE 1>&20 s6 z( D  ?3 b7 ]7 {* b9 @2 R2 R, ?5 V
}5 }  O7 i: m0 R

3 X) i) B' H0 u' T#generate alter temp files based on pid
, I$ U1 Z7 E5 k. Q- L1 Q+ NALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$9 |$ F, R5 Y$ ]3 z. u' U
if [ -f $ALTER_COUNT_FILE ]
& B! Q3 r/ i! e, X4 mthen ) ~6 ?9 z- ^3 o* p
  until [ ! -f $ALTER_COUNT_FILE ]
( y. ^3 B$ ?% b" x  do/ e( t" f" K3 _) _6 k
    ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$
% `6 p  [) `( R* ]  done, [% R- D& u! I0 R
fi1 h; e0 s0 ]3 R& a# E9 l* _
export ALTER_COUNT_FILE
; ?- ^( V& M& i7 O5 i2 C
: p, `& j" b% u, n3 S; K' s! ZALTER_HK_FILE="$ALTER_HK_FILE"$$
, U; ^2 u9 |7 @' Z+ `/ p9 sif [ -f $ALTER_HK_FILE ]
, R" |4 ]9 _! {then 3 ~* h0 g  }* ]
  until [ ! -f $ALTER_HK_FILE ]
5 @* ?$ ?5 Z1 `" R* P: i0 x  do
( b+ t1 S/ q1 n8 v& P    ALTER_HK_FILE="$ALTER_HK_FILE"$$
0 x  _) X: K# l7 p- e6 b  done# b3 {4 h0 `& y3 H
fi
/ R; A* K  ?3 N6 g; A9 ~export ALTER_HK_FILE
8 F8 P+ O* o* O* i) B2 y9 V2 c& k* _/ V
#generate monte carlo related temp files based on pid( O) J- l5 ^" E. q
cleanup_monte(). T6 ?" J+ n  L/ P& L/ I. Q8 ?
{
3 o1 z# r# Q9 b2 r   /bin/rm -f $MONTE_IMG_FILE 1>&25 l3 E8 n9 ?! X/ p$ z3 x
   /bin/rm -f $MONTE_IMG_FILE.gz 1>&2
* C  x: ~3 q2 n8 l, o   /bin/rm -f $MONTE_COUNT_FILE 1>&2+ g- q. E# {: H5 L4 k0 N: q3 Q3 f
   /bin/rm -f $MONTE_CFG_FILE 1>&25 B$ e- n! A1 v: Z8 d
}
. ^& R- k- }& r# ?
( G. S# ^" W9 v! \% `5 ?7 K. Y& M9 @MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
1 Z/ o# b# u3 ^) h9 l8 K# yif [ -f $MONTE_COUNT_FILE ]
# j/ D# B# H' p4 C; }then
* L* F0 J4 _! h  until [ ! -f $MONTE_COUNT_FILE ]' N  G; f. d& q) |1 K. {
  do4 k% T7 T1 z1 Q! T+ e$ a  K
    MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
, V% \9 y, F+ t( d  done
# o- ?* R( {. ?' z0 d# w6 Z8 Hfi
( W0 y( ]; @9 K* Dexport MONTE_COUNT_FILE. ~" w$ u8 ~) q% w. u$ y

4 R7 K3 }1 ~0 }MONTE_IMG_FILE="$MONTE_IMG_FILE"$$: @1 W6 y6 A! M* C$ c
if [ -f $MONTE_IMG_FILE ]; I' L% l5 }( ?; J
then
) Q. u2 f3 [$ s0 I4 d$ n# Y( U3 d  until [ ! -f $MONTE_IMG_FILE ]
# k% b: D* U# b9 i" h  do/ j  k2 z: s$ _8 f( Q$ n
    MONTE_IMG_FILE="$MONTE_IMG_FILE"$$1 }% t, n; P+ b+ k
  done
% B0 @  m& i9 r% M5 M6 S( ~# O& Hfi. L. N) J% `; ]9 W7 l
export MONTE_IMG_FILE
) b% h; E1 d' D- ~, A9 }
; ]0 ~3 Y0 D3 L! Y- R6 X# DMONTE_CFG_FILE="$MONTE_CFG_FILE"$$
" e- f, T! w- }- ~+ [( ^* d3 ~% Jif [ -f $MONTE_CFG_FILE ]
7 A: `5 Y( G$ Y; [" u/ r& g% pthen
% `0 D0 D' E% ^3 ~% e. t  until [ ! -f $MONTE_CFG_FILE ]
, d& a, Y& S0 A  do7 s: P9 b& h+ @* [
    MONTE_CFG_FILE="$MONTE_CFG_FILE"$$! C2 g. {0 P- Q5 |8 O. M1 {  f
  done
8 g  j; ~9 t9 y& Ufi0 k6 V2 M4 O. u. m

5 u6 ?: n6 M* h7 u% e7 [" g# main iteration( a3 u' j; ?& r4 o: d  m
run_main
! h6 K: {  M' v; X$ h7 [) `5 X& i, _! u8 h
if [ $ret_stat -ne 0 ] 2 V  w0 ?0 P: w/ G0 \7 t* m* L4 v
then 0 m7 E2 N% M9 W  f" R
  cleanup_alter
, w3 `7 N) K* X0 ]1 t7 o  d  cleanup_monte3 T0 E  g/ e, |2 F' t8 [
  Exit $ret_stat
2 W6 T$ P3 v$ T* k1 b: o3 Tfi
) n0 h% N, ~4 V7 p1 A# T1 H7 t8 h+ j3 \& o- d" n2 L
#Alter related iterations
, |6 C. C6 y* G- `
1 k, i& [2 ~' U0 ]: }& F# Ziterations=02 @' Y9 \  S8 u) h/ q$ b# Y
count=09 }4 X2 p, t( k) U$ T
if test -s "$ALTER_COUNT_FILE"1 b6 z4 A+ F- w4 \
then
5 o( K$ x2 K  k! w# s$ w/ L1 n, g  if [ -r $ALTER_COUNT_FILE ]; then
- z. a8 `  D* M: W6 p! q   exec 7< $ALTER_COUNT_FILE
. |# y/ S( {* |$ e! v- W( _   read iterations <&7
6 k6 m- }5 ]) f- I3 _! h2 v fi8 l: [: s0 z8 x) R  p" K0 I" D6 b
fi8 q' s- Q  y5 N8 Q! s+ T+ y, K/ u
, e4 F0 j' @+ \! x# d1 [% S9 _
trap 'echo Program Interrupt; cleanup_alter; exit 1'  2
$ l0 i, F2 s1 Z  twhile [ $count -lt $iterations ]
+ {# D4 l' g" _- ]! [do. R& I& A% Q6 P7 }) x% n$ ~
count=`expr $count + 1`0 Z* r2 v& k5 L/ ?0 o5 @
ALTER_COUNT=$count2 K" A9 y2 g% |" N; X, d( e: {
export ALTER_COUNT
9 Y  L' g1 X  z$ @% l* B' V
- P$ N2 Q0 k- U run_main. G5 {+ J" b7 Z+ c: C  n

% S$ v  d. o* y9 `# U' |1 \: |done! S; n5 v' x* I+ k. F; l) P9 ]: n
6 O3 }" R, m7 Q; M" d8 w
#Monte carlo related iterations
1 S. m8 s+ W3 G  R5 g9 d# N
& ?. d1 r) q# u: amonte_runtime_summary()
: v$ ^5 t' V+ H2 Y, g; n  p& @{' H. R- t% V" E1 x) P6 W% O
  keyword_1=real
4 c! E" Y; Z$ A1 L8 s2 @6 F, [  keyword_2=user: R: ?- n- Y- L
  keyword_3=sys) k" c- V! T# ~' p" |- H) \
  ofile_prefix=nanosim9 F4 i9 L3 n) ]6 F  D( \
# ^" R  x; t% A, E/ s2 b
  if [ ! -z "$o_option" ]; then
* i# L" `; K& \" \" x    logfile=${o_option}.log
, t& K) b1 I+ P2 H  else
) Q+ y" A& l/ R& }    logfile=${ofile_prefix}.log) ^' h. R# D1 g
  fi
/ ?* q" h4 Q  l, v- d# g( E  d' F, K9 A
  if [ -f $logfile ]; then: A/ d6 ~) R1 t3 }& c- M
    echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile      
% H6 Q5 ]) J5 J9 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! S/ C8 ~# O8 m$ c- Z
  fi
2 P! z+ f' h8 X2 a; o}$ c4 T( W) i# t# q
$ ^: v! n5 o& n, z5 y* `8 C7 [
next_monte=0
8 U+ k, ]$ ^7 \7 \cur_monte=0
* h$ l2 _1 L: t- ]; W5 J
" @0 }. ^( z6 f" k; O: @6 L% Nif test -s "$MONTE_COUNT_FILE"
- V2 A8 j2 z$ x4 h  b' B9 Cthen& `* b; y% B' w
  if [ -r $MONTE_COUNT_FILE ]; then" K; n. b4 P6 T% M. Y# T$ x
   exec 8< $MONTE_COUNT_FILE" J# V- A6 O7 F/ `
   read next_monte <&8; y. l8 e& n4 v: ~  c
  fi" D7 b6 O  C1 O9 |( ?
fi
5 t% g4 O7 H) ?7 X, m
- _; [! d* w' T4 j/ Y# b3 D5 Htrap 'echo Program Interrupt; cleanup_monte; exit 1'  2& s% Z5 @$ d8 k- L5 C& R
while [ $next_monte -gt 0 -a $next_monte != $cur_monte ]
! L; \# S4 q& g$ z5 ddo6 N" N! R" ^; M
  NS_CURRENT_MONTE_COUNT=$next_monte
: f: Q0 m6 N$ m) w6 @7 C7 o# c8 N# J5 G  export NS_CURRENT_MONTE_COUNT
3 `( l' v. q8 u  m. ?9 v* d6 I: e/ r0 A) m& }! R  q: |3 \# Q; P( u
  echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE5 m: w! u5 h3 [& J$ b
  CMDLINE="$CMDLINE -c $MONTE_CFG_FILE"/ \4 f: H1 A) w! E1 z
  run_main5 g% {6 A/ X" ?7 B/ q
3 e) u7 Y+ o. Z: r2 E% o" N
  cur_monte=$next_monte
' Q2 a0 d. z" s( O  exec 8< $MONTE_COUNT_FILE
8 ?* b, L, d5 B9 F. h9 v  read next_monte <&8/ n3 }& L" J# C6 ^4 m+ [% E, i4 ?
done
% g, h  Y( A/ W3 v4 e
8 U: J9 b7 z0 K5 R2 R- Vif [ -f $MONTE_COUNT_FILE ]: w# m$ k- {$ d9 ~  S( ^) y
then
0 h, N* v; }: f0 v& v  monte_runtime_summary
7 g6 b, E. \) p, q3 u  [5 W- {- Sfi/ e) V. e0 D$ P2 g: `. O4 n  ~9 B8 l

  C, I8 g; @( R6 }( Xcleanup_alter
0 h) U. f* r/ d: q& S; }cleanup_monte1 c0 M' g" ?7 P/ B$ j  ?# \

8 }1 M: T% o4 ]Exit $ret_stat

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

使用道具 舉報

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

本版積分規則

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

GMT+8, 2024-6-4 02:01 PM , Processed in 0.150019 second(s), 16 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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