Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

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

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

[複製鏈接]
跳轉到指定樓層
1#
發表於 2012-5-6 13:58:13 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
10Chipcoin
各位大大好:
# l8 r+ [; p' d# j* ~# r. @+ O                      小弟執行nanosim時,卻無法跑出視窗來,有個錯誤可是我不清楚該如何解決?問題如下
' c/ r& e/ q+ W3 [5 R$ o( [: _% ?. t                      [: 113: 64: unexpected operator
* R5 |2 I( f$ J" D* e: {" c6 w/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim: 1: Syntax error: Unterminated quoted string* H# y  f; H9 ^- a7 F8 q
有大大遇過這方面的問題或是指導我方向去解決, 謝謝.
( i) X, `2 f' d& J3 |3 i* r5 u9 e我在猜可能是這個檔案內的文字需要修改 但不知道該如何修改?
) S# U# g5 q; X- `+ S0 u以下為/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim 的檔案內容:) h9 {5 s2 \; f6 ^
    #!/bin/sh
; n  v# w3 a8 V+ S; G; \#7 t# O; ~, _) F
# Copyright (C) 2001 Synopsys INC
, N1 g9 ~2 x( `& j# Z( q1 Y1 t# EPIC Dynamic Simulation Wrapper (DSW)
+ L2 ^8 t$ i1 M% T0 u7 A#% I9 O, P$ L9 `& E) d
eval ${DBG_EPIC_WRAPPER:+"set -x"}# [: S$ H; K# @2 }, o
$ P' \" `6 q9 F6 i) t
if [ "$EPIC_WRAPPER_DVLP" = "" ]; then
& ?  k3 T# z) s6 ^4 {    TEMP_ARCH="$SES_ARCH"
% A5 k* R0 x+ [. c+ jelse# l2 p- P0 u; G) @& i
    TEMP_ARCH="$EPIC_ARCH"
( S; ]$ y+ Z$ b" N2 n8 c6 gfi9 Q' q  y3 U3 X
. g; J0 z/ O$ G1 b3 i0 j/ s& C6 T3 b
scan_for_hva_args()1 |$ |( }; b, W. M9 s
{0 I, d, R0 U# d5 B2 @) I, K
  /bin/rm -f hva.init 1>&24 G7 I$ p# {# Y- X! C
  while [ $# -gt 0 ]; do
7 T3 w. M. a- Z7 d' o) t( _+ X    case "$1" in
5 n0 d0 i# U' Y      -vaf)  M! N! ?' j" R# x
           have_vaf_flag=1
1 q+ \& F, H% V5 |           have_va_flag=0& @  T+ D+ _4 `4 _* [" P
           shift;, G+ f* t- w. Q1 J
           continue;# q' h0 z9 U& r+ N8 v3 E& M
        ;;
% f1 w9 v$ K% `$ e; r% N      -va)) L: X: ~% E6 O/ Z: e$ M
           have_va_flag=1  n! \2 N$ @8 ]$ @$ ~
           have_vaf_flag=09 }8 M  m0 k9 u" h, H; ~- Q  q9 ]+ f
           shift;' x/ G8 l& }' ?9 Z, Q4 u( `9 S
           continue;0 Z" y2 k* r- J+ e& K5 G
        ;;1 Y, j, {1 p8 i6 r" G: G/ w
      -*)
. `( A3 Z+ C$ K" H           ARGV="$ARGV $1"
9 w! w, o/ p( f+ x/ v           have_va_flag=0
1 ^! S2 F+ \& U9 B* V: y           have_vaf_flag=0' Q3 j" Q* ~- {  E0 A
           shift;
; g( g+ l# Q- N" ^8 L# r* X           continue;
1 o" w; p: ]4 V# D5 `        ;;
3 I4 L( \+ B- [; {) ~% W* S+ {( i      *)
  L% J/ j. v, @+ D- e9 P" q           if [ x"$have_va_flag" = x"1" ] ; then
+ R* Y# N* E' |; c              VA_FILE="$VA_FILE $1"
* f! J$ D# v- S* ?" j$ Y           elif [ x"$have_vaf_flag" = x"1" ] ; then % a; w5 ]4 ]1 g% i: X( d: m
              X="`cat $1 | sed -e '/\;/d;`"# t" k( z& h9 Y1 B% K
              for token in ${X}; do( S- P3 a. g/ o% n0 v' l
                 VA_FILE="$VA_FILE $token"- J+ C0 t8 @  }' u$ g
              done   Q1 h" [0 X; J, V
           else
, t/ q7 f+ x3 w2 {9 Z              ARGV="$ARGV $1"& i0 m5 E) A0 N2 ~( C1 ]5 d8 u
           fi0 P$ K4 e1 o5 _5 T/ N
           shift;7 I$ O, G" m8 [- c0 A. d7 u
        ;;9 y6 [. R0 Z! v, V4 e
    esac/ r. a1 J) w( Z' b5 `9 d1 p
  done
+ F& G% V* R# M' a, X
" a* n+ [) y6 g. _9 {  if [ x"$VA_FILE" != x"" ] ; then - a6 X. L' J* P8 k) {/ e
##     /bin/echo " xxx ARGV $ARGV"
+ G5 ]) e1 F. ^; g4 |. h7 \       /bin/echo "choose nanosim $ARGV ;" > hva.init
. T& q2 ?* G0 r- h% L       echo vcs +ad=hva.init $VA_FILE -o simv
7 Z( w# [" a! C% ]9 W. [+ S2 B9 t       vcs +ad=hva.init $VA_FILE -o simv
9 H: P; o$ a9 E) v' u! n6 X6 `       exe_status=$?
7 {& k  E; z3 X1 \6 r7 ?, _, c4 D       if [ $exe_status != 100 ]; then
6 J) r/ [- L0 f; g" P, A          /bin/echo ""
& I4 _' [0 h9 S: d          /bin/echo "ERROR: Execution of vcs exited with code $exe_status"
) r+ G* Q7 m/ q  u          /bin/echo ""1 k" R" S9 ]: B6 q" ]
          exit $exe_status- V: z* B2 @- j1 d4 h
       fi. V5 A6 l% c& {8 g
       hva_files="-n simv.daidir/amsVD.ntl simv.daidir/amsWRAP.spi"2 L  h6 d& f- K* [% \' i
       ARGV="$ARGV $hva_files"4 \- T( {. \8 |" u8 r" [' `
  fi
7 t( I$ r1 M+ U% ]- W/ M6 P}4 w+ S5 H5 b5 |) z1 n' s
#-------------------------------------------------------------------------
' U% l, Y8 e8 L$ l5 ~+ W
- u+ W( j, a: W0 y' L/ _cleanup()
% S& c* {/ j+ y/ D{6 [  l- E) v) N0 z
    if [ -d "$rundir" ]; then
! y5 r7 q) i  ?$ B. y        # On AIX, a .nfsXXX file is created if libModel.o is removed
# t- `; j4 O, ]% t! h& ]# R, B        # so .epicrun is not removed because directory is not empty.
8 H% |( I! o7 p# k% V2 S        # Solution is to remove it again if the first rm failed
% F' _! h) W" T        # (rm -rf $rundir || rm -rf $rundir) 1> /dev/null 2>&15 C. K6 R3 r; x9 W! G- X3 d" d* V1 B
        if [ "$EXTRA_CAPACITY" = "YES" ]; then! N1 A$ b% b; x/ G# F) L
        chmod u+x $rundir/rpcidfile0 U: ]$ O# a. G1 H
        $rundir/rpcidfile
; Q6 N) K! \' a, l! Z2 o        rm $rundir/rpcidfile
: R' g, e: w+ E        fi) _4 a2 d3 U5 L
        rm -rf $rundir
6 v) c' A- n0 U  D7 @9 e
  {2 ?% u6 x  P; @        #Due to NFS problem, we have to copy files needed to8 O; m7 G; @& h) u1 P0 g6 s
        #/tmp/<temporary directory>, then symlink's files
( M) J& S! L. y, W0 ]        #to the local temporary 'rundir'. This avoids the problem/ x- D- ?8 s* \9 R$ `
        #to remove 'rundir'. X; a1 l! S  Z; i2 n; t; r
        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then# G7 R* a2 E! |# E1 l% e
          if [ -d "$tdir" ]; then
! R0 z8 S$ @: z: ?            rm -rf $tdir2 H2 S' M9 u, X/ Y8 E- L
          fi
! |5 W# i& W& H& a3 X( e        fi
( t, V1 ?7 ?" y4 ^% h8 Z5 x! `    fi
& W: |) o2 f4 W3 Z7 c    if [ ${exitstatus:-0} -eq $ld_err_code ]; then
# l2 E* L# Q! {. q        [ "$has_model" = "YES" ] && rm -f $cwd/libModel$suffix) e+ K5 n' W* Y9 l+ g1 D" w
        [ "$has_custom" = "YES" ] && rm -f $cwd/libCustom$suffix
+ h9 E! O9 ^+ _! Z4 j8 t    fi2 l7 l- F1 N5 ?
    [ -f "$EPIC_SCRIPT_MESSAGES_FILE" ] && rm -f $EPIC_SCRIPT_MESSAGES_FILE 1>&2
. ?. D; Q! H; r# S    exit ${exitstatus:-0}5 T" y9 ]8 Z" D8 a/ `0 A' D6 o% o
}
4 M+ ~8 l- B. f% W5 d# n
* ]( _: K! ]* M5 _Exit()
% u$ l0 k% v- s: G+ a$ b& x% s' F{
* D5 e0 @8 F5 O) ]! E& |    exitstatus=$1" X3 n! G' U. [( _% N9 P/ |+ R1 K
    exit $exitstatus( p+ C6 v" Q5 n
}
0 u! K8 h! C" Z0 o1 V! J. Y  ?/ B% R/ E- }8 Z
# get_epicrc filename keyword
8 e. K; C0 S4 Tget_epicrc()* [- r+ v& u, v1 z- B4 a
{
" a' n+ t, ]; z: ~; w' y0 s5 W9 f    [ -f $1 ] || exit 0
; G- D0 N5 i0 P    key="/^$cmd2:/{print \$3}"
" u" \. ?" B$ s! ^6 J    awk -F":" "$key" $1
7 ]( b# L6 {0 y/ A}' l' m; r% o3 D5 ~" v- q
9 P. G/ M3 k' ?& r' y" ^8 h
#5 s1 A# c; j; j% Y, b: i. G5 }
# set datasize limit to hardlimit: t) P+ V; s0 g4 p
#
: p: j1 i9 A: J$ a2 Uset_data_limit()
/ h  A0 D; u, e$ C  p) R{
: `2 s, _5 [0 t! M    dbglimit=0
. {- R, R' J: H/ V7 p& X    hardlimit=`ulimit -Hd`
3 M4 U+ L9 R" K( r5 B    softlimit=`ulimit -d`( n2 K6 z, m/ @: t) `+ [
    desiredlimit=3500000
' i7 R8 k, z5 @% M- K6 I$ N$ ]" Q1 k    hardisunlimited=07 w% f2 ?' {# ?+ m6 D: p8 m
    softisunlimited=0$ g) E- i" x9 I) M: d& ~
    is64=0
* l( u" r, F" e# F7 P) j! h) d2 z$ E1 R( j% u& L8 s
    case "$EPIC_ARCH" in
; n0 H' y. j" z6 h    *SUN*64)0 T3 N9 P. ?2 {- |. Q) \3 S8 Y
        is64=1
3 L7 ^. ^6 {8 B4 y: i        ;;
) S% s( G6 \1 l) n    amd64)) g+ ]1 u9 v2 o! N# y, v
        is64=1
) _+ }: B' _$ I9 h' \        ;;- V$ d9 D8 s% k+ a0 k. t( [
    x86sol64)/ I- ?1 Y' e& \6 G
        is64=1# a3 l! Q2 z6 V9 o1 G& S4 t
        ;;
, b! L" v% s4 v4 n    aix64), s, y+ F$ D6 f2 _  v3 w, c" E( @
        is64=1: X- l- x2 l7 v' I5 ~
        ;;$ d6 ?$ F8 s. X! ~" n
    suse64)* _% f, Y& m( }
        is64=1
2 ~$ g% _4 [) n( Q+ Z        ;;( F9 o1 t. _3 s6 g& h( X/ m" W1 F. d. w
    esac7 ]. x! |( {: |: P- J2 m
! q9 Y+ R# C% K9 @3 u. \
    if [ $dbglimit -eq 1 ]; then
$ K0 I0 g; U: w6 u% f        echo hard $hardlimit soft $softlimit
+ D/ w/ Z" v& C4 q. [7 [3 s7 V" T    fi: G' }0 `0 L' j" \  O- T% h: z

# _6 c+ c' x8 Q# a& _. q6 L    if [ x$softlimit = "xunlimited" ]; then3 X6 e! w" v8 j& h
        softisunlimited=1
) ], {+ {) N% T, {6 l. `! p3 t% y3 q1 q    fi
& a+ F* O# R& V. V+ S" [. t# t; e9 d% ?" I0 ?% I# I9 m0 @* J( c
    if [ x$hardlimit = "xunlimited" ]; then/ b$ X! T" X% b
        hardisunlimited=1& N$ L5 s0 q3 x- {% ~
    fi  P5 N( G; X/ o; {

6 i. f5 {( i6 _7 [    # 64 bit machine should have bigger than 4G- E' \- {, _. E2 b+ H0 ^: P
    if [ $is64 -eq 1 ]; then' t2 I9 y, l' T0 s6 a- w" ?
        desiredlimit=50000003 O/ ?: {( r0 A0 l8 X' v
    fi1 F. `' \" M+ ]+ \. P2 \$ N

: i2 b, E2 y/ ]: P1 V% y$ l& v1 y    if [ $hardisunlimited -eq 0 ]; then1 H0 c5 \6 I. S; n
        if [ $hardlimit -lt $desiredlimit ]; then: S  U& R1 N0 ~; A" J  h+ F; }% L
            echo "WARNING: datasize hard limit $hardlimit K is too small."$ x( L6 {5 C/ M' Y
        fi
( ?2 ~8 G% s7 R. I) [, I: N    fi! p  b. r  A. ?9 K7 x, v
# r/ d& ]5 m  }) g# ]- ~
    if [ $hardlimit != $softlimit ]; then5 A4 p1 n& k2 v
        ulimit -Sd $hardlimit
& R. f, N; W6 ]' U#        echo "WARNING: datasize limit is set to `ulimit -Sd`"+ U  |9 P7 g" O$ ]5 ?
    fi
4 `# ]8 ?7 ], j. O
" C. R9 n" {/ _$ c% B9 G    if [ $dbglimit -eq 1 ]; then
% R8 O* @- ?4 Y7 B1 \        echo datasize hard limit: `ulimit -Hd`' u7 h0 I3 j! z3 q9 H  U+ ?
        echo datasize soft limit: `ulimit -d`# e) R1 v6 t+ ]4 T
    fi  v7 P3 P& N( |9 u
}: b9 I4 A- Q% ?$ T) S, P, m

- b" Z: {, R$ |/ O5 w! P) m#* D! [2 k* P8 g% J2 [
# set stacksize limit to desired limit
# G+ h5 z; Y, }3 N6 B/ ]#3 U, \6 \9 C8 f8 _- G
set_stack_limit(), z2 w# K1 G6 `4 P
{1 l& x6 o7 j+ ?2 H
    dbglimit=0
6 T5 J8 \0 Y8 E- P7 U5 m- Z3 q9 ?    hardlimit=`ulimit -Hs`
+ S) q* ^" s9 {4 u9 ?5 q4 w    softlimit=`ulimit -s`
& G! h& C$ ]+ W+ D- {/ O    desiredlimit=60000
+ f8 u* Z) L5 \8 A& k" \1 u1 o    hardisunlimited=0
6 W- A$ C, J& V* @4 K    softisunlimited=0! p3 r! Z! |; u9 ^. b
    is64=0
, S' C8 S  o6 J. O+ V
: v3 r% W' E$ v7 k8 J8 }( I( B    case "$EPIC_ARCH" in2 @1 E0 n& z+ X+ |, c6 p
    *SUN*64)
. n: s! T5 R3 W: |7 ^        is64=1% _9 s. E! ^8 @0 m4 J/ I; o1 E
        ;;5 w, C: x1 R5 Q- h7 y
    amd64)" o! `& p+ S3 I: G' b: O2 W; o
        is64=1
8 H6 q7 \! n7 ^7 I' ~' b- S/ T( r        ;;
& K9 b) ~7 j3 \& a    x86sol64): i6 D( L. \6 O0 \( A' J, q
        is64=1
, Z5 O& k8 V; }        ;;/ B8 S- ]! v6 x  v; G% A& Y
    aix64)
5 }' y: l) ~5 Y4 U9 I' i' t9 M        is64=1: }  Z+ M5 N4 Y8 G
        ;;7 ]6 U2 M% l# y* j
    suse64)
! e' \% e! O# c        is64=1$ Z/ }3 K8 E: W$ g* J3 o) F: I
        ;;) g4 E' @+ {; Z5 N& i3 b  [
    esac" q+ N- t2 a% `+ f
  n  h, e5 b& v9 V5 k
if [ "$EPIC_WRAPPER_DVLP" = "" ]; then
0 p8 O& A5 N' F/ k0 \! ^( w9 w    if [ $is64 -eq 1 ]; then
- _* {- U, k; Z( r0 L        desiredlimit=200000% V* B) Z3 b. I* @
    fi
9 w) B  K9 q1 c5 F% \$ helse) e) [0 u* E4 h2 K0 r
    case "$EPIC_ARCH" in9 A  U  h/ Z1 B* |! A9 m1 R! U; Y
    *SUN*64)
4 _) m" Y% `3 ]. @- l5 g! b2 Z        desiredlimit=2000008 `* y6 z& H' M/ f6 |
        ;;
$ n" q! x- Z  ]6 x- D# N! Y! a5 S    esac
5 H8 B/ g. M3 v, D, r% efi
+ s  y2 \; D* C3 Z8 H       
, }, o* k2 x( y) _) _# R    if [ $dbglimit -eq 1 ]; then
( a: A! q% j9 e+ c+ s( M        echo hard $hardlimit soft $softlimit' H2 W8 S  W) K) V* C# P, S& {: H
    fi
7 S3 l9 u, x3 e* f! [: T5 H# k: [8 l1 L" W3 ]
    #stacksize can not be unlimited, pick smaller number6 K$ {; t4 Z4 J* l- [% T
+ Z: Y5 G8 F  P$ v* d7 d6 y
    stacklimit=$desiredlimit
% l4 l8 a% R# `2 t7 g2 A
" o! m- T6 a# N7 x8 R9 V    if [ x$hardlimit = "xunlimited" ]; then5 d% D+ L8 }* P' w( I
        hardisunlimited=17 k! S- }6 a' R$ ~
    fi
4 N5 k7 E/ b/ M# k5 o3 K2 u. p% P+ I. P; |2 I* P
    if [ x$softlimit = "xunlimited" ]; then- e; [& m% G5 f
        softisunlimited=1
7 d" |1 P+ U' R) N; k9 ]( J0 S    fi
7 w. m% I  V0 b3 k) Y# I! L  \4 s
    if [ $hardisunlimited -eq 0 ]; then9 }, A# L2 [+ q! x
        if [ $hardlimit -lt $desiredlimit ]; then1 F( j6 i% q8 g& m. M+ O9 u
            echo "WARNING: stacksize hard limit $hardlimit K is too small."9 |) \7 P" ]8 w5 u$ h& ~
            desiredlimit=$hardlimit
0 Z$ V1 A' C3 m8 O            stacklimit=$desiredlimit5 E) D4 i0 H& w  a0 }0 D
        fi
( T; f6 O  S( \1 O2 U0 c    fi( I. g, u0 d1 A( _

- C( p1 `0 C7 F: l2 |# t! d1 M    # desiredlimit is set to proper value (< hardlimit)
6 M. Q5 `1 @+ [- w; P8 B3 b* W) B6 d
    if [ $softisunlimited -eq 0 ]; then
4 C" P, ^0 K& |: l        if [ $softlimit -gt $desiredlimit ]; then  \, R7 T6 E0 @
            stacklimit=$softlimit; o% H, V* b; E+ }
        fi; Q6 q! O: D5 O! v) y$ O
    fi5 O- P; z8 N" F- o3 ^$ {

- f- K* a  N( t7 a+ U* e' Y4 {& X    if [ $softlimit != $stacklimit ]; then
5 W1 H+ K) Y8 g7 C/ b6 r) g        ulimit -Ss $stacklimit
% H. H; p. R8 w" o#        echo "WARNING: stacksize limit is set to `ulimit -Ss`"7 v" h  K& e3 |( q8 L4 d( p: d
    fi) Q# i, U# I% [% Z$ Y: k$ {3 B  K
2 @) k% Q. K. }  j2 e# N7 V
    if [ $dbglimit -eq 1 ]; then/ K4 g! v5 h, K
        echo stacksize hard limit: `ulimit -Hs`5 y) r5 {8 z0 K8 {3 l
        echo stackize soft limit: `ulimit -s`8 [- a& @' U: ]5 ]/ f& W: r
    fi, D3 D( e8 X, t. G; \- j& \
}
8 N- \9 T' g7 N9 F# T5 F) ~( ]) r+ e
  w; `( p2 s. R/ ]1 S6 H  b3 Dopen_epicscriptmessages()/ G1 n/ H" p' A" |- I6 y6 v0 i
{
$ p! f" V4 Y5 @) W#generate  temp ".epicscriptmessages" file based on pid
' v, q# I" X& o( I" j4 Y+ {! P( EEPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
# C6 X2 {6 g( i) L% Fif [ -f $EPIC_SCRIPT_MESSAGES_FILE ]
9 `$ x9 y& n1 ~) ~5 E% jthen
+ X. r) m3 G$ I  until [ ! -f $EPIC_SCRIPT_MESSAGES_FILE ]
8 T1 J! c3 S; M& m' Y4 ~" C  do* X8 v) E. l0 v" |' [7 s  S8 e
    EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
8 `; {! j+ |6 u6 a" u- \- L  done5 o5 M* ^: p* n" a
fi1 k1 Q$ [6 P8 \7 {

: \) v3 z/ v* ^% ?! b6 Oexport EPIC_SCRIPT_MESSAGES_FILE
  B7 q- U5 D" ?7 q# {}' i; u: B6 n/ B! {
$ z: }2 l" ^$ H9 T
2 x2 U9 R- a3 s
cmdname=`basename $0`& G, p) d- |+ m& c! w; ^7 p! S
postgres="n"
# T& E$ E% y7 |7 Q. j$ }. |ostore="n"
/ v) R" ]# b9 Q9 i' r+ D. ^gui="n"  h: h4 c( r5 R6 }, O
databaseOn="n"
+ W5 h* t3 c# ?" x0 _f_next=0
* Z# F4 }# w( Y+ }# k9 p3 jf_option=""
$ l8 G; @7 E( d7 {o_next=0
1 H( v$ R: g+ E% ho_option=""
+ [# y; @3 r& ^( UworkDir="". G3 o. [: x* ]: D" R) s( h* Y
workDir_next=0
: B" E# X' \& J3 m: jerrFile="powrmill.err"
$ I$ x' j8 n& u1 d+ v' \win32flags=""9 p5 `0 q! A) ]7 T
ln_default="ln -s"! k& E' q' H" p  z+ p+ B+ Z
2 z  p3 ?# v' V6 Y, m- Q$ q6 M
har_hilo_file="". E. P; y% `$ x( h$ \* u% B) N; a; |
have_har_flag=0
! q: A9 E& t. b& I9 p- j4 vhave_har_setup_flag=08 J1 ~- A3 Q) j) t5 n
is_special_har_run=0
, b! L7 K0 G; O. Shar_ofile_prefix=""
1 I2 W* ?( T9 B9 A
# l+ g' ^. T5 |( ghave_va_flag=07 L4 x3 `: L7 _& C, ^. _0 H, ~5 A+ L, S# q
have_vaf_flag=0
$ a" M, j; W  \. ZVAF_FILE=""+ ^" h3 U; L( T! s1 U8 O8 s
VA_FILE=""- x, r5 u, i) `
ARGV=""
* X6 d; o# L% n7 M' D: p6 M* I; Z8 j! M1 T3 e. ]5 M# y
ORIGINAL_COMMAND_LINE=
6 V9 d! n$ b) U( w6 a6 \  yLOOP_CTRL_FILE=".ns_ba_env"! h  V; o" j; I& \% q
ALTER_HK_FILE=".alter_hkf"6 g  Y+ N8 _: r5 C8 [  b
ALTER_COUNT_FILE=".alter_count"( M9 c2 Q$ h, `. U: Y$ ^2 u8 r4 b/ A
MONTE_IMG_FILE=".monte_img_f", F- S) O1 l. N! p+ H
MONTE_COUNT_FILE=".monte_count"4 i2 q1 `2 v7 o8 m% @
MONTE_CFG_FILE=".monte_cfg"" \7 O$ r, \1 k7 ~
EPIC_SCRIPT_MESSAGES_FILE=".epicscriptmessages"5 d! A# W- ?- k# W# J2 Z
  u  w9 z: P! y" ]& Y6 X
open_epicscriptmessages $@/ e2 ~- Q2 K& H  e0 A; B
0 A7 v4 W: a% d( s' }
scan_for_hva_args $@
: f* }  r4 J+ E6 s+ P4 B; q8 n$ Q1 U
/ o  C& {, V( @# H6 |scan_for_har_args()
$ L1 n1 ~; h  Q2 F6 q; d8 i{
9 q; w% \) L& K. `3 L! E8 D6 C  while [ $# -gt 0 ]; do
9 g0 @$ O% q# g    case "$1" in
! c8 G9 |. F! _+ y. Z! _1 s      -har)( X; ~' c  n/ _
           have_har_flag=1
3 F) s9 T! Y* h% ^2 j% M           [ $# -gt 0 ] && shift
* e- c& \2 Q- m* @" E6 _2 T           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then
" ]$ K6 {: @4 ~7 x) P7 Z             har_hilo_file=$1
- _/ P4 A$ v2 B6 e) B4 i             shift7 Q; C1 W9 h5 W* B5 S
           fi
% F+ U: M& ^& |2 G           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then
) B# p0 u* ]/ T# b             echo "Too many arguments to -har flag. Only one hilo file allowed."
7 Q3 F/ i6 R2 U- T             exit 1
9 x* s3 |+ ^( l/ ?5 G3 O           fi
0 ]6 m& @6 a( e( L0 r- b( L- d& n           break+ F' @7 Z9 G$ r0 u- D
        ;;% y& O/ Y8 H' M! A0 S
      -har_setup)! d. `& _% A3 r
           have_har_setup_flag=14 F+ m; J6 I8 K: D. W
           break7 |, u% }4 j" T* r
        ;;
& Z4 c% w% I( G      *)
3 O5 \9 t5 m" ~; M# a        shift
+ Y3 C  N9 }3 a5 `0 \  `        ;;' F) P' r1 x* T; q9 z) D- U' t
    esac
) i7 }! A  g4 ]$ V: c3 n1 ~  done6 s% c  I+ k! m: N) c* j( E! a7 m
}
0 |8 W" u2 j1 ]4 Q4 p" t% S! O0 }
8 O! N. @4 c/ |; X4 z8 bscan_for_har_args $@7 ?! {; h. W' I7 d( t
5 i2 S' G  h1 i9 V8 F/ S# d1 y/ Z
for argv in $@
& f  \% m4 T7 S9 R2 Wdo
8 Q; M6 H! Z) X3 A5 F! O   ORIGINAL_COMMAND_LINE="$ORIGINAL_COMMAND_LINE $argv"
; o. w0 g& H6 J6 n    if [ $argv = "-gadb" ]; then
9 \/ y; B, y* h( f        databaseOn="y"
  g% {) z3 J/ a2 f2 T2 v' Z4 y        workDir_next=1
" T2 E$ x! M1 Q. n+ _8 _4 f7 N    elif [ $workDir_next -eq 1 ]; then* Q9 W) a1 |- G4 g  c2 y
        workDir=$argv
, G+ A7 ~+ F  @$ U9 [        workDir_next=0& ]9 q6 p, k# t: z+ s5 R
    elif [ $argv = "-ga" ]; then( h0 m* {! ^+ [) A
        gui="y"9 I, f+ _- _, j! x
    elif [ $argv = "-f" ]; then* G5 ^' v6 O2 C) w9 \3 r, G
        f_next=1- `+ b+ L" H% b0 I. C+ _0 ]/ ~5 b: q
    elif [ $f_next -eq 1 ]; then
- D" b9 I) T  v9 K* V7 }        f_option=$argv
; I, f4 g2 F) B2 U, v+ K5 C        f_next=0
6 e1 a- @0 H/ c    elif [ $argv = "-o" ]; then
) F3 ^" ~# A0 o1 h        o_next=1
4 k8 C: V& s7 y    elif [ $o_next -eq 1 ]; then
4 G3 p# k' F2 o6 I: p9 E        o_option=$argv
0 Z( U  f4 i3 S1 K0 U+ M        o_next=02 }1 D1 D5 g6 k$ ?- p
    fi" Y/ |8 [: G5 m! M" L8 E7 M
done; v0 z3 N" U; c) G7 H# B
echo "Command line options: $ORIGINAL_COMMAND_LINE" >  $EPIC_SCRIPT_MESSAGES_FILE " Z! u/ V# K6 F; y$ B+ M
: l1 N# i' p) v
if [ $databaseOn = "y" -o $gui = "y" ]; then( Y9 o2 Y& Y' g$ a3 l
  if [ $cmdname = "pathmill" ]; then
: t+ i9 h, u' Q1 a0 D' @/ D0 M    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5"  -o "$EPIC_ARCH" = "SUN4_SUNOS_5_64" ]; then+ ~" |+ i3 X) H9 B1 \
         ostore="y"1 h' r, ^" M5 v1 q
         postgres="n"# c" c: {$ I+ X5 ]
     else$ l5 @* C, a. u, x9 O1 ?
        echo "athmill GUI is supported on Solaris platforms only" 1>&2
" n- G% \$ m' a9 U! a        exit
# O/ W1 e& G* ?4 f     fi
% W0 g1 S2 ^: w7 Y; J/ U  else9 b2 n4 n8 t" q/ p6 U& P
    postgres="y"
. f! Y. s2 m4 f+ X% I, s         ostore="n", m4 G" C$ n# I7 S' u9 ~7 v3 I
  fi
& C& j& V  S6 n% r. ~4 lfi
& n8 }! s  d& i8 l/ f* b3 v, D2 }% N# I/ R
if [ $gui = "y" ]; then2 j- |3 Q* H, [
    if [ $cmdname = "powrmill" ]; then
! [" l. B5 S' E/ g) d        pwga $@
9 q2 s# k9 [- C: k9 y* w1 C        exit
) C0 f, A2 |5 c    fi
0 x4 W2 T# X2 g6 q7 b5 a   Z* ^% Z5 U" x. L" A
    if [ $cmdname = "pathmill" ]; then
/ S4 a4 ]& H+ U" e8 z8 ?! i        if [ $ostore = "y" ]; then
: z: e& N1 N  I* a( W6 e9 A           ./pathfinder $@
4 M* o  q7 O- w' P+ I           exit$ N2 d8 o6 \) N1 Z4 o2 ^
        elif [ $postgres = "y" ]; then
  x" w4 G" [' I. Y% \+ H6 U+ k: W           pmga $@
% ?. x3 U" Q4 [: I           exit4 q: Q" X& P- A9 t. }& @4 P
        fi7 P+ I! Q3 ^0 C  H+ f2 ~
    fi
# ], ]' O: e7 D  _( p4 _fi9 V; t2 u& |9 u  s: G* {9 n8 n  z

1 b4 ~0 Y3 u6 F" e) oif [ $databaseOn = "y" ]; then/ S$ F2 \8 P0 D  }- E' q
   if [ $ostore = "y" ]; then& m3 j& |2 T) d  _7 e, W
      if [ -z "$workDir" ]; then
: X' l, f4 z' g! h1 I/ x         echo "Error: Missing argument for -gadb option"- }: v+ M. H- o5 ]; f
         Exit 1! Z# H- Y+ ]( R' f8 a
      fi/ H( o% d* N$ d7 ~# m
   fi
( |: i3 G4 X+ O+ C/ b5 \   if [ $postgres = "y" ]; then
# [; f6 Z" c5 ]& {' B0 h      if [ -z "$workDir" ]; then  E0 H1 Y% Y5 c$ [/ @# y: R
         echo "Error: Missing argument for -gadb option"
; X# H, R$ _9 b% a( r9 N! j         Exit 1
, d: j4 u6 M1 O( j& M      fi
8 Z# G9 }( j  h5 X5 ?   fi: L! p4 ~% V9 I3 ~6 g$ a
fi! G7 s! Z) Q3 w7 ~5 N' C/ P
7 u! S2 T: D- a& ^3 y4 |
if [ $postgres = "y" ]; then
' n7 m' |* l/ r0 h7 k
2 P0 ?6 x" {5 E, N; g3 e    if [ -r $EPIC_BIN/scripts/gui-init ]; then
8 n/ w$ h7 o/ [. s; d        . $EPIC_BIN/scripts/gui-init9 [- r) [. Y+ O: H3 B' o
    elif [ -r $SES_ROOT/bin/scripts/gui-init ]; then
* w9 g9 H& C9 b        . $SES_ROOT/bin/scripts/gui-init/ X  H% R! C. F; V
    else
5 F9 X  e8 J6 D) u7 ?9 S8 {        echo " ** Installation in \"$EPIC_HOME\" has been corrupted!" 1>&2
6 g$ R! S) H9 a0 V        echo " file bin/scripts/gui-init is missing." 1>&25 G+ r, x3 s" K( m% o( }+ T
    fi
9 i" X# g$ M- |# k! x, y1 s: _% w7 }. g% T, m0 r# o* I# T5 V: h
    workfile -tool $cmdname $@! v4 P1 D+ r# t4 R
fi
0 ]$ D/ B. p5 l$ {3 S+ ]
: ]& _5 T5 e; Y$ F, Y" [, }, i* eif [ ! -z "$o_option" ]; then
4 C; Z, o7 C8 s! E) I* p2 r    errFile=${o_option}.err) h  e1 Y, M4 M8 y
elif [ ! -z "$f_option" ]; then# z* o# h# b' u
    if [ -d $f_option ]; then3 l; y. J$ M& U$ {. x
        errFile=${f_option}/powrmill.err2 W8 M2 {% c. @" o& E( ]  |# I/ G
    else errFile=${f_option}.err2 d- u) g4 i* z" s: F
    fi% Z( ?& i; _& [
fi+ l5 Y+ S7 g5 O7 t8 A! ]/ f2 S

' w. f! H/ Y% h! J7 r
4 z; \; y! w  d! `if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
. h* m8 ^! {( j: K0 Z  rundir=.epicrun+ f1 Z. X; k+ t, V
else3 U9 ^9 x4 o! k. e: J5 j$ K
  rundir=.epicrun$$
( ?/ c; k7 q7 Q0 u+ N+ b( ]fi4 V; X, \* R8 T1 E9 \
: b7 \: t7 p7 o0 P, o
libpath="$rundir${EPIC_DLIM}$EPIC_DIR"
% f) d/ V) S# u' Z/ E* s) C0 Q
* a5 X- _% T7 e# Z2 Ucwd=`pwd -P`
3 W$ Y- T/ p' m% _if [ $cmdname = "acehdl_w" ]; then
! D2 f8 L. Z. e* n7 s* |  cmd=`basename $0 .sun`: B7 r4 |3 Q7 L  J& x) q: x
  cmd=`basename $cmd _w`
) W9 q- k$ E% Zelse
" J/ C% f4 c2 p; L8 h% Y7 W  _  cmd=`basename $0 .sun`1 K( c, s7 \1 z1 X6 w! K2 g) W
fi1 e8 x1 E" e  V9 f8 `+ A- {
% ~( F* y  F7 W! p, W# S. ]9 ]2 ^
command="$EPIC_EXEC/$cmd$EPIC_EXEX"
/ Z* f- }9 i* F2 A, Z[ ! -x "$command" ] && echo "$cmd: not installed!" 1>&2 && exit 1+ s. ?' L+ ^; @3 M2 o

0 W7 ]* a# C$ q8 h' ~- d# buildmod extracts -u/-fm options and calls genepiclib# |3 x  T# w% k1 {$ P" @
# It also set the remaining options to variable CMDLINE
* t( C7 p0 d! r* {6 P5 f# look up in .epicrc for -fm & -FM parameters
# j% T" P) N. I: S! p) A8 q* B4 N  [
fmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`". X" Y% N) F, j3 j( \9 D& {
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`"
' I# k8 r6 c% L( w4 h[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`"
8 J( F! ?6 i/ j- I
. I; m* l- `3 s# e% y$ D4 ^) GFMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`"
1 N, g+ c4 p+ l% {[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`"3 s; w7 m0 P. c5 s5 z* P5 F: ?
[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`"
4 T( b/ O" h+ f/ i$ ^; b% ^
$ ?$ Q9 f0 d/ @if [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then! D7 S1 [! P$ Q7 b' U
    # note that the buildmod script will set the CMDLINE variable
  p* v5 s& F% }6 k& c8 E5 j0 N    . $EPIC_BIN/scripts/buildmod
, S! g" z7 N8 L, P
5 G/ }- w9 o$ H& l. D; G' n' u+ i    #echo "This is the value of cmdline=$CMDLINE"
5 B3 n. }2 i( w8 e2 P    #exit 0, @$ f( u! z9 F7 q

/ t" r' Z; t1 c: R, [2 k    # if a new timemill/powrmill/pathmill built, run the new one
+ ^5 d" n' N( ~9 Y) r& W    [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX"4 Y: v' E4 a  z9 S! x  c% s: J2 {
fi, o9 L- l. @" X, l

$ W# O3 M7 n2 h2 d7 oif [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then
, _4 J& |! D4 O3 f) |" a! _' r  if [ $have_har_flag -eq 1 ]; then9 H: B( ]0 G2 e9 @6 u3 o0 E
    is_special_har_run=1
& @% B$ J2 m2 k' W$ \$ N/ L    if [ "$o_option" = "" ]; then. @5 n& ?: |  U7 K2 r. B( \6 ?  j
      case $cmd in
- X/ h+ [; j. B$ A! w2 O* d+ L        timemill)* {# L/ @+ m$ g" L( ]1 M. g
          har_ofile_prefix=timemill( G2 i! f& w, q  T  Z! T
          ;;: Z+ u4 d' J1 S' F- Z
        powrmill); |7 n* P7 _+ D# t  ]+ P
          har_ofile_prefix=powrmill
' Y2 K' x/ x- F% j; T: Z! Y* Z          ;;, g. ^! g6 M4 a0 u
        nanosim)8 E% n% c" ]& P; J! X' C
          har_ofile_prefix=nanosim
' N7 o" B* x( g8 k* f          ;;
; B4 z' M& a1 h      esac
( Z# o7 l8 s/ P! Y6 [; d    else
0 q' a. p2 v& i: P      har_ofile_prefix=$o_option
8 ]( s8 ^; r& r, a    fi
# q) c7 J0 f5 X* g* a8 a" x fi/ H. z. h, d- y) D2 d) m
fi& _$ o( j- b: W* V% u0 y. ~
( s) E& M& T/ p9 Q
# Call Double precision version of the product if -D
5 Q" M2 G1 Z, _5 K6 E# or simulation time > 1,000,000 ns.
& t1 C1 I8 h* P- Z7 x0 K. Nif [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then; v+ l! z) L' z" t7 G

; q9 x1 Z8 a- J& k  h% S# i  # Now the binary always has the ACE feature& ]% Q6 l( g7 |7 q" J9 ~
  USE_ACE=YES
+ j. y" y5 x' ?0 D; f$ a1 \; d5 {/ T4 N+ \! i# P' i' V4 m
  HAVE_DP=NO
+ s" d3 j8 [0 j3 P  EXTRA_CAPACITY=NO
! F6 P! y, R% Q& V- ]+ A  DB_REAL=${FORCE_DB_REAL:-"0"}+ r. A  _' P2 {" y1 Y+ i

& r1 j9 e. J) r" s  # Enhance for ACE ease of use
( E8 j/ u' z3 t- P7 V' L" d8 y. _  # If no command line option or only a -T option, do:
1 K+ O8 E$ }0 {7 b3 S0 R  #   1. set -A option
2 ~$ `0 `: B  v1 w$ D0 ^  #   2. assume input file to be hspice3 D' x: W! \* y5 R- L
  #   3. set -o to input file prefix2 D% N5 b+ y7 H, E. `
  #   4. set -z to input file prefix+ ]; ~3 p) h- ~; l: p2 Q
  #   5. set -c to default config file
( D+ L+ _+ `! ?0 K' h! Q: Z& l  netlist=""* ~- e! E- Y* t1 R5 e
  minusT=NO
. G3 ^3 g: A+ Y; \4 v  useStdCmdOpt=0# n( u6 D. l* N) P2 H( C
  prefix=""# \% a5 w: @7 F: P/ t6 N
  circuitType=""% N4 ^6 {& u8 \  k+ u
  for opt in $CMDLINE8 v+ \! ^, k+ `$ Q
  do' R/ b6 Z: @3 W: z% w' T
    case "$opt" in
( g% j, [7 }! {7 |      -T)
. ^- M( O+ \0 E7 x  R5 ^        minusT=YES7 l% D4 ~0 w+ _3 y) \
        ;;
! d. m( ~2 Z+ v! Q# F. v      -*)0 b4 Q+ M7 ]$ o9 b) ], g+ S
        # using standard powrmill command line
' u) i# ~7 v. `; v# S; ^" |        useStdCmdOpt=1
2 A! e3 r& |3 B" T2 I, H        break" `8 Y" W! u# m  k2 h
        ;;& N  y+ d6 s5 m$ A
      *)
$ I" l; v+ l' W6 O       if [ "$minusT" = "YES" ]; then
; O' w" g( ?0 @* ~- Q         circuitType=$opt5 e% Y" {: Y+ h! X; |1 g
         minusT=NO  # reset flag
4 y7 j- X/ g: z7 Q( T, F2 P" m: D1 }       else ( O. F/ G8 r, h) _3 T# R6 U
         if [ "$netlist" = "" ]; then
7 z1 Y/ f+ I8 ^/ R. d           prefix=`basename $opt`1 r! C/ v4 L; I! F; i: n
           prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix`0 A4 u" x4 E2 m/ A7 d
         fi; n4 |1 e9 S8 g. _- q; F
         netlist="$netlist $opt"% Z. z! U1 H0 M" N( e7 `
       fi
* m  R/ S; |8 x/ R8 h; C0 i& c0 I$ H- x1 c       ;;
$ c' c, E. s. E& Z- F" }; T    esac
7 D' o: W5 N! b  done
9 C/ O. }# T* ]6 {- ]3 d8 O
* C$ i: x" h" _4 ?7 a" O0 H9 E
$ h: A8 ?' ^: f  x8 k6 w' J) ?" F  if [ $useStdCmdOpt -eq 1 ]; then
: C! v: T9 m- M( v( g2 j; R& H    # use standard powrmill/timemill command option7 n" r3 U% Z& i; x" n
    for opt in $CMDLINE0 ~  W, P. ^0 E/ D, ^5 e# Q* u
    do
- I& y. l  ~$ x7 ^      case "$opt" in 0 {# j) F, E% |2 `
        -A)0 E: q/ {* X( L+ p8 }  f0 R9 N
            DB_REAL=1: @4 G2 f7 m& w& c; ]: I
            ;;
# v' F# g2 A4 @! f8 f1 ]% p( ^      esac
% c* \5 {3 X- P    done
" o  D5 ^1 _7 @8 o  _) e, y& S    if [ "$netlist" != "" ]; then: b4 o- a, N4 K1 R- d7 \- [0 u% ^2 h2 {" Q
      CMDLINE="-nspice $CMDLINE"3 U9 Y$ D! w5 h6 ?, L6 l3 k
    fi
+ _0 u# i0 |& n5 u1 W6 m  else1 D+ Q; Q. G1 ]; ?; c5 h9 {
    if [ "$netlist" != "" ]; then
1 K! a; ^0 H7 ?; U2 ~      EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"}
5 F# {( l6 [+ `0 Q+ g      # construct new command option3 S" M' p$ p' g' N1 R
      if [ -f $cmd.ini  -a  "$circuitType" = "" ]; then- u& ~/ B+ ~6 k7 Q
        CMDLINE="-nspice $cmd.ini $netlist", Z( b" V1 x3 V4 p& G
      else+ w; K8 I2 I2 I! \6 v
        if [ "$circuitType" = "" ]; then' s7 Y5 r# v) A1 ]9 i: Y9 {
          circuitType="msana"3 T# d2 S& P- C; U8 U7 r
        fi! g- A! R& p% v) z. K3 s
        CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg"+ {% E$ U' n- Q
      fi
  U5 i$ m  g8 P( I4 [8 T      CMDLINE="$CMDLINE -A -o $prefix"
2 a0 U. G) L1 J, e5 n# }7 T      DB_REAL=1
0 @& {/ }% X- B      echo $cmd $CMDLINE7 @+ P& y" K5 n$ L7 w1 u$ ~" w8 _
    fi, O' q/ k( ]1 E7 n3 d% w, b4 e$ Z9 j
  fi
3 }: I' b( u: _$ M8 \/ z( h; {fi # cmd is timemill or powrmill or nanosim or railmill or pwarc  f+ X4 r& u$ t

  x/ Y9 ?4 O9 {9 f' P7 h* W[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a"; G- y+ `  k) X- ~8 b
[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a"5 j, U, o/ y7 a7 Q. O
[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v"/ |* a9 E1 j8 U0 E' j; y

& z6 d" r. d3 v9 z/ N; C& jif [ "$__engine_wrapper_called__" != "Indeed" ]; then3 O: ^7 G7 l/ D% Y7 r3 X
    __engine_wrapper_called__=Indeed
) a6 E1 B9 K. g& R0 Z" b    if [ "$cmd" != "amps" ]; then. u; V- t& N6 N$ b. H
        export __engine_wrapper_called__- f" a" H: _7 M, u% l) i( s
    fi
+ u3 l+ L4 F" P
/ X! C  L7 R6 I& y5 \1 t2 _    trap "cleanup" 0
3 P$ l) Y% O$ \2 `; b( \6 |4 I# }$ b# i    trap "" 2
" l' ^( e/ Q  ^" `4 n
! H4 A6 |7 b. o3 [& g    [ -d "$rundir" ] && rm -fr $rundir; {2 P+ H2 w# J- o7 K
    [ -d "$rundir" ] || mkdir $rundir
" n- n' ?5 w' X0 A5 A2 Q% u7 y" R" l0 S
    case "$EPIC_ARCH" in+ l( V7 R; u+ b  V0 r: A, t, M
    *SUN*64)   , @# P) L# U2 B- z" M
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"% Z* b0 X) D. p5 Q. `: i: a
        export LD_LIBRARY_PATH2 ~+ i$ H: S0 W/ `7 C( Q  P
        suffix=.so
* _1 S4 K8 K8 Z) a        ld_err_code=127
7 k. f0 ]* o$ v7 c/ l9 i. k        ;;2 C0 @- x( j; H( u2 _
    *SUN*4)   
, H: N( C8 E  d# r        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
1 d- [1 t% d7 C" h6 P  X        export LD_LIBRARY_PATH
- {: h7 |0 p# _1 e        suffix=.so.1.0& o/ n. A3 g; f* J
        ld_err_code=127: ]( d& ]) A9 C5 V/ b
        ;;
* [. h. y* `- {    *SUN*5)   
# M$ @( o6 K: H9 q        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
: ]3 `. A3 {% @; d( k        export LD_LIBRARY_PATH+ Q, R8 N& V8 B0 O
        suffix=.so
5 L8 c* r/ u, o" D  ?; F/ {        ld_err_code=1275 w! ?( e7 {2 D
        ;;
' f* [2 \+ x# R. b' N    x86sol*)   6 G0 k: d( A- N) a4 K
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"* R$ R% K7 P' j: E( s* n
        export LD_LIBRARY_PATH  J! {0 ^3 b# T9 K& n' V4 [
        suffix=.so$ b0 p- d' C/ X8 d
        ld_err_code=127
/ D5 I( T0 R6 E& ]$ ?% x        ;;7 F5 M! ?9 O6 L8 S* k: R& V
    *AIX* | aix64)   
" Q" h. t( b" M5 A, q  |, j6 {        # When genepiclib creates shared objects, it creates a import file and
" B8 w9 D1 u* v% E6 N. s        # uses timemill as program. So at exec time,program timemill is needed 0 N3 ]0 x- ?& @3 A" o5 l
        # in LIBPATH* V. c9 }3 ]4 v0 l5 P: C
        $ln_default $command $rundir/foomill2 @  E: k: @  K( B5 j' R2 J
        LIBPATH="$libpathLIBPATH:/lib:/usr/lib"- S4 n. i) m. K+ q/ ^- E. {- Q6 B
        export LIBPATH
( O9 d( e9 y+ C7 ~+ R+ `/ z        suffix=.o8 x3 U+ E- l. Q- X
        ld_err_code=8
9 j8 F/ H$ F7 {1 {        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then' w  D9 n( M0 L# ^7 {8 U
          tdir=`echo "/tmp/d"$$`) G" c4 F2 O2 K4 f1 B5 I  y
          [ -d "$tdir" ] || mkdir $tdir2 \/ M& Q: P4 ]& a
          if [ -f $EPIC_DIR/libCustom.o ]; then! X( v, }0 b9 s: S4 n( B6 @. i5 n
             cp $EPIC_DIR/libCustom.o $tdir/
& t+ B% F; \) v7 I, w             $ln_default $tdir/libCustom.o $rundir/% g( v* ~/ j1 u* S7 p4 t8 [
          fi
2 _' p' G. _/ P0 ^, E" w/ i( m          if [ -f $EPIC_DIR/libModel.o ]; then
8 h8 _6 T* j  T+ T$ ?4 S/ r             cp $EPIC_DIR/libModel.o $tdir/  t' T! I( F) T& r# s- U- G# f
             $ln_default $tdir/libModel.o $rundir/7 T7 F. Z" O9 c* U  k
          fi" f6 w' {0 J# A
          if [ -f $EPIC_DIR/libFuncModel.o ]; then& J+ ~/ w+ S* s
             cp $EPIC_DIR/libFuncModel.o $tdir/0 H* G0 D' k2 m" h
             $ln_default $tdir/libFuncModel.o $rundir/# K& f* e/ Y. f; _
          fi9 y3 n+ N0 K" P' R( a
          if [ -f $EPIC_DIR/libFuncModel.34.o ]; then1 n; E- Q' C4 j  E0 R/ v
             cp $EPIC_DIR/libFuncModel.34.o $tdir/8 w$ m9 C) [( t% b; v  R
             $ln_default $tdir/libFuncModel.34.o $rundir/
" F9 n0 |2 i3 {7 l9 g0 b) o& E4 G% r          fi
- `1 x- s% A; S9 C/ ^        fi
% L8 M1 h, k8 d8 b9 C$ Y; G        #Set the IBM flag to enable more shared segids
4 O$ |1 Q, y  i! c5 z, Z% |        EXTSHM="ON"
6 L" [; b% L! c& ~% ]3 d        export EXTSHM
! d3 x5 V; D! o1 L2 W: a        ;;) `+ @2 d9 u5 }
    *LINUX*)   
4 [# M, @+ m, q! H3 z/ s  K        suffix=.so* E3 U$ p; G; ]8 A8 V* L
        ld_err_code=1, O# o+ h9 [7 ~  z7 F
        ;;
' ?) G: y& G, U6 T; A    *amd64*)% W! t( r3 H: R! \# x) Y! A9 @
        suffix=.so
# y  X3 n5 a5 A; c- h        ld_err_code=1
5 g% w: ?1 _6 r( x        ;;
9 p; @# m  a2 @: I, A    *suse64*)4 M1 ]( G3 ~% f( O1 f2 n
        suffix=.so4 i/ ~: r( c0 y: ~6 g
        ld_err_code=1
, O6 ?8 w2 n& V3 c5 ]& A" v% O2 X        ;;% U. \* J% g8 E2 i3 f) C
    *suse32*)    + d. Y0 b1 K$ A, r9 \
        suffix=.so! a1 [( w. ?- t+ V
        ld_err_code=1
; W$ [" A5 p( U, k* f        ;;; P1 Z( m* G* H  y7 U$ K
    esac# C% v+ _0 K$ {% y
  V# w: t9 b2 K8 ]- E9 y
    [ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix"
" T; w2 L+ ?' B    [ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \
: ~# n% G. i3 ]/ [9 l        && [ "$cmdname" != "nanosim" ] \
0 S/ u& _9 }" g        && [ "$has_model" = "YES" ]  && ulib="$ulib $cwd/libModel$suffix"8 x- ]( b( E; g
    [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix"
7 E% m3 }. s+ l3 |; {+ p
* E7 `4 V- E1 C#Look for command line option for libFuncModel.so
8 V; [* |$ `% N#    user_library_next=04 q; Q: o/ \4 _. Y3 g
    has_fmlib=""
( Q* j( J! c, n- {7 t9 m    for opt in $CMDLINE$ L: \: U, \  E' o  W
    do
1 T! Y# }1 h& T  N& q      case "$opt" in - z1 ~* g3 y2 P8 G. i. r/ F
        -fm)
6 E0 H. x$ A7 w) _7 S            CMDLINE="$CMDLINE $cwd/libModel$suffix"
% H  {, ^2 f& r            ;;
; t) R, I) p0 s* f- k) i        -fm_user_lib); m- _" j+ `3 O
            has_fmlib="YES"2 h* V) M' @/ N1 G! _- b5 e
#            user_library_next=19 I  g1 ]7 e$ s) P% i6 d
            ;;$ j7 x8 I8 u2 z2 n) V7 Y! J
        -xc)
: s1 `2 p2 H8 y1 \            if [ "$EXTRA_CAPACITY" = "NO" ]; then
/ @# A, z" X6 R' A9 _            EXTRA_CAPACITY=YES, c' l! N2 A; ^. {
            fi2 V0 c9 u! U/ o# l
            ;;
& r4 Y  p3 r) F0 |#        *)7 O2 e2 T) G0 s+ ~/ a4 T! P- ]; l
#            if [ $user_library_next -eq 1 ]; then1 p6 I* M' ^) [9 c
#                if [ -f "$opt" ]; then* `* ?0 U% Z* w
#                    libfmodel=$opt8 m" S2 m5 R8 G! j% B1 ~
#                else
( a4 Q6 x. T# }#                    echo "-fm_user_lib: Specified file not found"8 {0 G( d# [+ L  `" B* g2 Z
#                    echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages* v. }' J( H. v: q( G
#                fi
- f' G/ [# ~. g2 Q* P#                user_library_next=0
- {( z' p2 v  ~7 R#            fi# D  k5 Q' m" w! C
#            ;;0 B" g; E0 y7 P' u
        esac. M( @0 }. N2 f5 Y
    done
+ I# A6 G6 y) B
1 p  t" T+ s& o; ^+ g. s. F- W& \    if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then) x& _8 g* L# H3 N. @0 d
        flib=""
' v, k+ q# c, H$ N        if [ "$has_fmlib" = "" ]; then0 I8 y) G5 M3 }: e
            flib="$flib `get_epicrc ./.epicrc user_libraries`"
' l$ b0 x; D; {6 c            flib="$flib `get_epicrc $HOME/.epicrc user_libraries`"3 h! S; S& |6 i  N6 u
            flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`"
# ^4 x/ B( W6 k, d6 i        fi) I- h2 T1 r: y; T/ Y
    fi" j& f9 I# z: r6 l; H, r3 E# ]0 @

# \, @! g- q! U: ^# x   for i in $ulib
$ A$ D! J9 h% K/ K. ]$ @) r+ H3 |   do7 l5 Y* \: p, {# v8 \/ d. k
       [ ! -f "$i" ] && continue
9 `/ A0 E3 l) m$ u3 t" _  p) s       dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd$ ^' k3 u4 {" G. r3 E& Q
       i="$dir/`basename $i`"
+ `/ y. Z" {3 E" y2 B: W) B; L       case "$i" in$ z% q, o% b% i3 J. ]- C7 H& a* W* `
       *libCustom$suffix*)    [ "$libcustom" = "" ] && libcustom=$i;;
2 L2 [5 H8 P2 v1 }       *libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;;: {, V5 I) V& W7 [( U- u5 ?
       *libModel$suffix*)     [ "$libmodel"  = "" ] && libmodel=$i;;1 P1 d! ^5 i8 _7 x  C( n: J3 N2 m
       *libva$suffix)         [ "$libva"     = "" ] && libva=$i;;
' _4 E: Q0 c$ K       esac
+ ?$ E: p  A2 O  i, u       [ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \" ]; X/ \/ r7 t; X0 n
        && break4 y$ I! a. R% L' K1 m
   done+ D5 ]9 E- `) u$ Z7 u4 W

* e% o1 ]/ o2 R& T   # symbolic link shared libraries to .epicrun$$" P: |! [6 t! |- b, ]
    cd $EPIC_DIR; epicdir=`pwd`; cd $cwd1 \1 I, P; l7 w2 v
    if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then+ S  m, d; Z* W# @* N
        if [ "$libfmodel" != "" ]; then7 v+ W; N; o* A! n
             [ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \- e( ^) d5 Y3 @  w. `3 u- v2 T$ K
             echo "Using $libfmodel ..."  && \1 a5 N+ d; m, @/ w: f: T& @
             echo "Using $libfmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE
9 ~7 [, X. r: g, j, \. i& {             if [ -f $rundir/libFuncModel$suffix ]; then2 Y# j5 k; r$ L% g+ {) K+ j
               rm $rundir/libFuncModel$suffix
) `9 `- s1 v1 [; U  ?6 p1 W             fi% U( D& U, t% r5 |
             $ln_default $libfmodel $rundir
  n# F  E1 z: {7 u        fi
5 E5 d, _, q& r$ Y2 r1 e7 I        if [ "$libmodel" != "" ]; then
8 K1 S* W9 a( {( Z5 ^  Q0 d             [ "$libmodel" != "$epicdir/libModel$suffix" ] && \1 h* I+ g  U& e: N! Y
             echo "Using $libmodel ..." && \5 Y( E  E5 h: ^9 z; U
             echo "Using $libmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE. ^$ T) G8 p! J3 N: h
             if [ -f $rundir/libModel$suffix ]; then
  k7 {8 {" ?4 G  W. i0 [2 U               rm $rundir/libModel$suffix: I, x/ a) X( e4 P0 s$ ^6 S
             fi
7 `+ n1 E  ~7 G( z3 I" a6 k3 \- D             $ln_default $libmodel $rundir
8 d; c/ U# d. W        fi& _) g7 H4 v* M4 d( m
   fi
' v- Z& `# l+ B$ y" K# U   if [ "$libcustom" != "" ]; then0 G+ h  G! W, k- {+ \, a, Z0 k: E
        [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \
5 E  \1 V7 o8 s  e        echo "Using $libcustom ..."9 d# M3 H+ S+ z- M& B) B1 E1 T6 M
        if [ -f $rundir/libCustom$suffix ]; then, {: Q9 `: b+ Z3 B8 L  U7 ^% |# e
          rm $rundir/libCustom$suffix8 U7 h* l, B2 L2 ]" o& _* o. k' @
        fi
+ z1 I4 r5 ~" q* ?# z        $ln_default $libcustom $rundir
" H$ ^2 x$ X; Y. L   fi
$ j7 c. X! }' l, }6 e% h4 g0 H4 Q0 p2 a0 x$ W$ z
   if [ "$flib" != "" -a "$flib" != "   " ]; then+ y0 V' \! D3 v" Y3 ^
        CMDLINE="$CMDLINE -fm_user_lib $flib"
" r2 A0 P, q* \$ j! J0 [& ]   fi: Q3 G: i& H  V* F; b. U! X( Y

' d4 C: |' {5 b; P  |& Y   if [ "$libva" != "" ]; then4 t; H! Y6 z+ S0 ^$ O* [
        if [ -f $rundir/libva$suffix ]; then
8 p- G3 h. \; y! H          rm $rundir/libva$suffix
7 d* b8 ^' S- U  E        fi
$ f2 V# `3 s3 Q! v& ^$ i        $ln_default $libva $rundir
& X- n. u3 ^& v& d1 r$ s: M: x   fi% a5 w7 H/ x# v$ d' O

3 e% t) R5 c5 G* m$ F
/ X  A5 u, j# P1 \    # VCORE design library
5 m) ]1 e- x: W, C6 V* V: A    if [ "$vlog_design" != "" ]; then1 k+ z" x& W( J- \9 ?8 {$ k
        $ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`
, m) _) q0 ^4 N9 F    fi8 {' @! k" a! y- N* r
) i5 F2 f# f# m9 ^! n
    if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then" b3 |5 x$ H8 O& W6 V
        EXTRA_CAPACITY=YES
! K$ C' d2 t7 N' y    fi7 O2 q" i! ~; N. A  F! i

) D; c3 z) w: c" w) ?9 ?    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc"
, a; B4 e0 A& `" O    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc"" Y2 r, ~/ h; |6 M2 P9 ?
    #Create temp file if dual process is on
% ?6 v+ ^; [- l    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then
, X( l  V; Q# ]: `. |        if [ "$EXTRA_CAPACITY" = "YES" ]; then
$ S6 n0 U& R% W- X+ _% T" g$ C6 M            touch $rundir/rpcidfile% g; c; T! c1 E  h" p
        fi
+ q3 i* t. O; Q) x9 j5 u7 n    fi
7 b8 P/ v, R: z" q, \fi5 B! u+ `2 J4 h. T  }/ b

- M6 v4 G8 f2 @run_cmd()
5 ~& \; n% \/ `1 [7 K{
. ^6 [, \0 G9 Y0 N) M9 q  command=$1
; A9 {# q; l) h; ]' D0 |" T% B  shift
3 }, W8 t0 u2 o8 i' S5 J( b
" c- U  U6 l( J' G  if [ x"$VA_FILE" != x"" ] ; then
: @) q3 |: T% }$ j- I& j$ f& b+ p     cmdline=$ARGV
* w9 h1 X* a  y, C* K4 H  else
- [; K5 Z3 {3 `$ ]) y3 O     cmdline=$@, e  I6 H8 w& Z* D; ~( |
  fi$ z  i: Z3 p* Y1 a

8 r2 p- o' ~7 C( _  P. p6 v9 A& ?  debug=${DEBUGGER:+"$DEBUGGER $command"};6 Z1 o0 \# W8 }5 O

* q: W9 e- L; e6 m3 y  # To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a2 [8 S0 y: l) f. J# b' m/ v5 z! h
  # so save-restore may work.: L6 {& W: i: U& W% k  K5 l
  setarchStr=
: z- a6 L! `1 d. l/ `  cmd2run=`basename $command`
. C2 J- V  z0 y& V, |; i. k! }  if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then) o: R' ~) k5 I7 o7 ]* _
    if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then
! `7 H" V" C1 C3 ]; z      setarchStr="setarch i386 -R "6 W7 `/ d4 s3 S- ?. C
    fi
" U' O7 }. w, d" o4 D3 y) r6 a    if [ "$EPIC_ARCH" = "linux" ]; then
4 ?! K* A  t& ?: M9 v6 a, P      setarchStr="setarch i386 -R "
$ u% S+ v$ {; ~  k( Y, M! S    fi' Q3 q' x# }7 L/ l) H; v
    if [ "$EPIC_ARCH" = "amd64" ]; then" Y7 ~' `4 P1 t: ]8 f" z
      setarchStr="setarch i686 -R "
- w8 X0 `! b! e& L# g& j" |    fi5 A9 m/ Q6 b, k; B
    if [ "$EPIC_ARCH" = "suse32" ]; then7 r7 Z6 K) P$ E8 B% c. o4 u# q
      setarchStr="setarch_suse i386 -R "# y1 m6 T7 q& K9 R
    fi1 x" G0 H8 \% [. w* ?0 \
    if [ "$EPIC_ARCH" = "suse64" ]; then$ g# c1 s5 ~( m/ g# ^) w
      setarchStr="setarch_suse i686 -R ". o8 o- a8 u. q* ~/ F9 ?' K
    fi: B5 B8 Z" f. u6 c8 X. J
  fi
6 C$ `" n' ]6 L  j
7 C+ t  r0 c9 I2 R5 l  ret_stat=03 @! t& t. A/ D( i$ B7 ^
  if [ -x "$command" ]; then. m- ^9 |0 q5 [7 n% V
      if [ "$debug" ]; then" q- I# \, M: H+ j
        _debug_args_=$cmdline# K2 r# z4 }1 {9 X; @) I
        . .epic-debug: J* l. x+ d, p  J) w
      else
# X7 M1 v! E, a0 V5 Y        DEBUGGER=; export DEBUGGER5 J5 g" \. F0 T! }
        $setarchStr $command $cmdline/ z! m" U/ k' Y5 n' {
      fi1 E' v* ^8 y  t
      ret_stat=$?5 E! t' F% A& b* q7 B* \. U
  else1 S1 }9 y& D6 c3 N
    echo "Corrupt installation, executable \"$1\" not found!"
: J" q, m7 e6 C0 N. b    ret_stat=1
8 G) Z. t/ i# A: a  fi
# v" O3 K" v2 u: R}
7 A  f* s) c6 P% a: C* x) m
% Z/ X8 x$ S1 _+ |0 g# keep runing cmd if ctrl file exist% ^5 I- _  n3 j4 _7 S
5 G) K/ t' j! }' z7 j
run_loop()
. I4 }' B% r2 M# G5 b1 e. D$ T9 u{
% W9 o, C& t$ n, N8 K  command=$1! A% J6 S! q5 y$ C
  shift
# r8 t1 q5 m  T" ^# \0 P5 D: H3 B7 L, v! ~* @( x* i
  if [ x"$VA_FILE" != x"" ] ; then
0 l: d" L- g6 n0 m) ]     cmdline=$ARGV
7 d, l" D* Y0 k( i2 Q7 H  else( W( }& m; j& i& @0 b
     cmdline=$@
$ `9 {# ?' m+ }! j  ^! M8 z  fi4 w: N* v7 \5 E, C/ M

. d# j0 D8 ~: e" W$ H3 n* \  while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do
4 E$ y, |3 C: r. T9 ?7 ?    . $LOOP_CTRL_FILE$$' E' i0 j  y* r( f/ Y( x# E
    run_cmd $command $cmdline -banner 2
4 i+ `- \3 l% J" L2 H  C3 r2 q/ \& [  done;
) b. j6 }) ~) Z3 w  W# t% W) r) M, ~/ R/ d2 y. A( J+ V
  if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then
. Y* ^. V2 E( U/ x" Y    rm -f $LOOP_CTRL_FILE$$9 m' ]: O% U% ^) u- F; M; d
  fi2 X1 @' c' I+ s! r9 R) j: ?& n# W* j# u2 z9 r
}
+ k4 a; z7 r1 s, N+ W
4 D' n2 i1 a0 Mhar_check_ret_stat()! s( d  ]* b* S! z& I
{4 x% d2 N3 u2 I& {, \4 E
  if [ $ret_stat -ne 0 ]; then
/ J3 {0 k* u7 t0 `& A' K* ]2 k    echo "Simulator returned with non-zero exit status. Stopping."; |- \3 {. V7 @, g3 r
    exit 14 y$ A* G2 y4 G- a
  fi
. f. [+ {, b& c% `) |}. |( I9 I2 v) Q/ Z" J/ \7 j

9 o7 _7 ~; X- J7 ]#* y0 Q7 h8 f6 U: x' X3 j" q, j$ L, x/ o
# set stacksize and datasize limit' ~8 m1 ?) V$ n; I/ _" k4 g* N: \
#
: D9 Z% T- D- B$ e& }4 R
+ X( E" k" M. L9 ?' c0 R4 B  xset_data_limit
8 G) L8 B0 y% Aset_stack_limit
1 @  L/ z# i& D7 d2 j5 Z. V
! \- k4 d7 R  H" _#rm -f $LOOP_CTRL_FILE
9 h4 B; z' q. q$ d6 \8 U) F
( Y! a2 M  @$ d6 v. a3 lrun_main(). ~7 s: V& x  L0 H( m
{
3 r" H  M. z* i0 D" _if [ $is_special_har_run -eq 1 ]; then
( ?$ v) q4 }2 S0 ~( o/ v& g  if [ "$har_ofile_prefix" = "" ]; then
5 E/ B0 a5 y' a" B- L8 c    echo "Wrapper bug. Notify Synopsys technical support."
( V0 {" G  s0 |+ u, r    exit 1" z% S+ I  h  [+ F
  fi: ]. e0 T. h  B. E* B+ T
  if [ "$har_hilo_file" = "" ]; then& c. a- `0 Q7 b3 A, b0 U
    # no user specified hi lo file - do both runs
- I" d+ U, |' |    run_cmd $command $CMDLINE -har_one -har_setup" t# d% Z* y/ X8 q2 v
    if [ $ret_stat -ne 126 ]; then
. Y. t" I9 @' }      har_check_ret_stat
- p2 {6 Z7 u; W7 }- ?$ i      if [ -r $LOOP_CTRL_FILE$$ ]; then, H& V8 Y. `" E( N' Y6 @
        run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl
/ w8 m; f1 G" l8 r" e0 v6 C* Y( H5 D        rm -f ${har_ofile_prefix}.hl! i; j! G0 \. Y. i3 m& a/ k
      else3 a/ E( s& ]/ b. [0 X: |
        run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl
& D& W$ x7 G, N3 P. {+ {2 m* P      fi. [4 m$ Q3 ~+ E2 F5 t/ \: y
    else; X0 E+ n" U, s' P
      ret_stat=0
" [5 U" N" \& k* ^- b    fi* J  `, ~  k7 y
  else  ]* X* ?" i. k# A4 K
    # user gave a hi lo file name  [  u1 p) D9 `% P; {3 J( k
    if [ -f $har_hilo_file -a -s $har_hilo_file ]; then: z$ h' v( e# H" ], {
      # file exists - use it - only do sim run
  f+ B/ }+ H. Z( n0 q& U$ A+ N& A! c      run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}* E  T* u/ E$ n
      run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}+ C! f3 K: X  B$ M$ l* |% H
    else8 W9 U2 _1 n- `3 P( k) {2 w
      # no such file - generate it - do both runs
" J, X" g' y- {2 U* l" R- c      run_cmd $command $CMDLINE -har_one -har_fnf -har_setup3 n9 I) X# M3 I+ a2 o
      if [ $ret_stat -ne 126 ]; then1 J# s" t0 f8 v, h6 L
        har_check_ret_stat
5 @$ c5 S& O( m" \8 A+ C! ~        if [ ! -f ${har_ofile_prefix}.hl ]; then
& r' k* p5 a9 l& z) k' Z$ l          echo "No hi lo file generated after setup phase. "
  d& i9 Z9 X% y2 E5 S) j          echo "Contact Synopsys technical support."
( a/ J$ y* |4 W0 N! O2 Q          exit 1
. T) e9 `" x5 z  n* U2 h5 y3 |        else2 d0 J$ A9 e6 v& p# W/ w- t
          if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then$ m. R7 _6 Q1 e
            mv ${har_ofile_prefix}.hl $har_hilo_file+ j' m  g+ D3 O1 C- T; ~
          fi
7 a8 U9 `9 g. t: z, H  a        fi& r$ V  l# E) o) E8 P: w) g
        if [ -r $LOOP_CTRL_FILE$$ ]; then* ^6 G2 e& n# g" Y6 q
          run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file5 F( |; U' G' p; {
        else
4 M7 [9 Q- ^% P) U, n3 R          run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file
' R0 n3 s: K7 t( [7 k8 {  P; L        fi. }% T( w+ u# U( _) ^. m
      else & u) H% C) O9 X0 ^0 ?
        ret_stat=06 e7 K; F8 w/ b
      fi
8 r$ Z8 w4 ^% o5 N& g( F% y! B    fi6 y8 y, {/ W7 F& @$ T5 f) e
  fi( f, s% d1 q6 t# Y) L" i) y' L5 ?
else  4 t* D. \' h& B3 r2 L. P3 H6 d1 _4 p) g) t
# don't loop if -har_setup7 S& B9 \4 O) A# R- }
  if [ $have_har_setup_flag -eq 1 ]; then
) S6 d, q( O, I0 A; ]' Q7 ?7 w! u    run_cmd $command $CMDLINE
+ f& O) d3 J; O* B* W5 ~2 V: L$ H6 Q    if [ -r $LOOP_CTRL_FILE$$ ]; then. D, Q2 m5 g. M; z; R" U5 \( }- {
      rm -f $LOOP_CTRL_FILE$$
, v5 P/ F2 I8 Y$ v) x    fi: B- Q8 k$ u/ d3 b3 O& ?
  else  C; d1 I4 }! F, K; Q
    run_cmd $command $CMDLINE( ]. v* ]% s1 H, y1 S$ v  i
    run_loop $command $CMDLINE- u' z, [' f8 R! m
  fi
9 q8 ~7 \; F6 l* Cfi5 x7 Z* z+ k0 i' o0 f" J  o* k

+ M8 }. z/ U( ?if [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then
3 k, l/ t: N! k  pwCreateErrDB -w $workDir -e $errFile
; W. {- W! c( [. a% n  ret_stat=$?. R- w  B. P& |7 z; V
fi9 u% m* O- {- n9 G, n  f! U
}; a9 p% d/ A6 s$ D  c, Y8 b; p

; K  `' c; d6 K5 Ncleanup_alter()( _" d3 [7 f  R
{
. L7 B: ^1 _- ~' K% z( I5 y; k   /bin/rm -f $ALTER_COUNT_FILE 1>&2
4 t) i$ N1 A4 F. `   /bin/rm -f $ALTER_HK_FILE 1>&2$ @8 K8 g# H6 d, `
}1 v7 \! @0 H, k6 }
, H  J9 J6 K  J/ h: M
#generate alter temp files based on pid
6 k* v  Q3 A* h0 o' m3 yALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$
0 W8 k) ]4 i! P* Gif [ -f $ALTER_COUNT_FILE ]# O: w+ b4 O8 i
then 5 `' r- S$ G) b0 V
  until [ ! -f $ALTER_COUNT_FILE ]
  K. S  S1 d) n/ H, `1 T/ w3 E5 e; @  do
1 |3 _. O% O- l& m* U    ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$
7 ]; u( Q4 C  I3 P0 J$ n  done
; y( C3 Y5 K7 [4 W8 R) _" l1 W7 jfi% |# L) P& S6 F5 M5 l8 x
export ALTER_COUNT_FILE5 b+ n1 D  {  }0 U/ P# e! J$ c
2 Z9 e+ d/ c" v8 u+ u# v4 U
ALTER_HK_FILE="$ALTER_HK_FILE"$$
8 |# h9 {& b( H$ C/ W/ Uif [ -f $ALTER_HK_FILE ]
5 }' L0 z* f1 q9 _8 rthen . |5 I+ ^* R2 H0 ~2 |/ r
  until [ ! -f $ALTER_HK_FILE ]1 V1 K. {  t, V- v
  do1 u# X9 ]8 V* w% d! u
    ALTER_HK_FILE="$ALTER_HK_FILE"$$) D: g- ~% M1 b% o
  done) h- D( W# Y3 @8 k8 ^$ Y& I
fi& {* b: @0 n, [5 \
export ALTER_HK_FILE
; Z9 v: `( D# v( a( F5 ?
+ n  a, ~. D& E% J#generate monte carlo related temp files based on pid0 T" e$ a8 d1 o- y6 x; w/ m
cleanup_monte()
3 E" x. Y  \2 Q8 w) c" f{
3 I  h  Z4 F: }9 l1 P6 E   /bin/rm -f $MONTE_IMG_FILE 1>&24 g' @4 Y1 W% a& m# d* H% L
   /bin/rm -f $MONTE_IMG_FILE.gz 1>&2
6 f! }4 g& \7 e" O/ N& Z) y% W& g   /bin/rm -f $MONTE_COUNT_FILE 1>&2* r7 o% R6 f1 @& o/ \. N
   /bin/rm -f $MONTE_CFG_FILE 1>&2
2 L* b$ t2 G+ `" m) k: h0 d4 h}0 _3 k, Z9 ~% {
/ f2 |; R+ U, C- O1 Z6 s7 H
MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
4 v* b! Y2 @6 S, dif [ -f $MONTE_COUNT_FILE ]" P# p* z4 m& F) s
then9 B' {2 u8 G8 H& H* o
  until [ ! -f $MONTE_COUNT_FILE ]; X, W( A' r6 v3 c
  do
  b1 y3 G8 U$ I6 ^) N    MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
+ p  H) ^# {- F  X  done
9 b4 s. b9 W) H+ W# o7 n& p3 wfi# ?2 T: ?7 j$ k: @% R
export MONTE_COUNT_FILE* f$ l* \  F$ ?6 L' D  G; B$ n

2 |) M- R" i- v- ~7 XMONTE_IMG_FILE="$MONTE_IMG_FILE"$$1 Z8 r7 h: Y+ H" \! u% i+ S8 o) g. D
if [ -f $MONTE_IMG_FILE ]8 r$ W* ]5 k7 E: {6 J( o& Y" J
then
: M$ H& B# x" J% o% i, m  until [ ! -f $MONTE_IMG_FILE ]; X$ b8 L5 |' G
  do4 b- W/ V% O: p$ a2 ]5 u; ?( }7 n
    MONTE_IMG_FILE="$MONTE_IMG_FILE"$$
0 l$ h9 T, L3 Z" Q8 Q  done% K% ?; Y" k. J1 S- Q9 x/ n/ i
fi
* u" j& M3 B0 x( p; k8 Xexport MONTE_IMG_FILE9 Y, C, ^" n+ k  b

: L" ]  t7 I. A& A; n, NMONTE_CFG_FILE="$MONTE_CFG_FILE"$$+ }: v9 H& [  E3 t7 L: w: J
if [ -f $MONTE_CFG_FILE ]
4 a" `% x* H4 L7 g' D5 m- I4 ithen
0 `, o( x2 z! ]  until [ ! -f $MONTE_CFG_FILE ]8 J9 t! E( R) [/ c" G/ ]! W
  do  L9 U% q+ _' J# |& f5 L
    MONTE_CFG_FILE="$MONTE_CFG_FILE"$$
) o% g; R: o4 i. u; V  done
, d% Q; h( ?5 Kfi
9 d5 G, h) v( ]6 b; [, l5 I5 Q7 d( c5 B& L8 @2 {
# main iteration
5 p3 w5 J" h) J, I, Z1 W2 l. M. ]run_main  V% y5 g3 k( L5 W

) J; ?7 H8 |6 v* ~& X! f% k# n4 f& Rif [ $ret_stat -ne 0 ] , Q( V5 _' ?) P4 I  C7 }
then
# T. I* B4 ]# y" R1 @; T2 D3 @  cleanup_alter1 w$ v7 {$ W) S$ [# n2 ^
  cleanup_monte
: G1 V: k1 m% Z7 h  P0 L  Exit $ret_stat
! C( y: P2 l) y8 ^1 O. qfi
8 a6 W. H. d* L2 A
/ |  c- H1 L0 U' R. i' a#Alter related iterations# i" f! [% a( }- `6 Y

( h( V2 ]2 c: L0 fiterations=0
) C! O% z4 y. g) acount=0/ o* Q  _$ x  b. `
if test -s "$ALTER_COUNT_FILE"4 S  j+ X4 D4 m8 z
then
2 r0 z/ K" ?9 i. P5 }  if [ -r $ALTER_COUNT_FILE ]; then! W  Q; k5 T( m6 h8 b$ V0 ^  H7 X
   exec 7< $ALTER_COUNT_FILE, ?6 {) ~2 J$ I2 E  Y
   read iterations <&7; k5 A% ~0 ~4 N
fi
) S; z, S" D  x" \fi4 ?& A9 ^6 _6 D: E. S
, }1 k! ^7 y: c, n0 F- W6 C
trap 'echo Program Interrupt; cleanup_alter; exit 1'  2
3 I8 z6 {7 j4 z+ Bwhile [ $count -lt $iterations ]
5 s: T2 w. M8 P  F2 l% W: j9 L" fdo! }8 n9 x7 l# l4 ^1 g2 f9 ~9 S, i. m
count=`expr $count + 1`
- J9 O# y( q2 g' L  f6 ?4 G ALTER_COUNT=$count
, ]: Z' T1 v# o. o0 ? export ALTER_COUNT% I& ?7 M+ H  H' @1 \6 I2 j

  L' H+ j: y7 {( C7 N run_main0 U; J8 `, `& r8 z. Z% y

1 U" y0 p, T6 S4 T. ^. W  rdone( j1 X4 z. M& l9 N$ K8 B
/ R; a  h+ k- P- [$ }7 C) J
#Monte carlo related iterations
; z# w/ r* Q* c! Z4 [. o
- I3 s8 K) Z6 W& c  l6 _0 i1 r% w+ umonte_runtime_summary()
' q) g9 c  Z( |  w{7 i3 Y$ N7 W( P9 c/ }7 e
  keyword_1=real* E* G2 b4 [( a' P/ p
  keyword_2=user, K! Q" K- s2 v8 Q9 ]) ]
  keyword_3=sys
+ |  [9 R9 A3 a" d! x9 d. @) }5 r  ofile_prefix=nanosim6 c7 R7 @. i+ F6 w# Y

5 R2 r# i/ y6 U) A7 G  if [ ! -z "$o_option" ]; then
8 |/ Y8 J" b; Z* r    logfile=${o_option}.log9 r$ x  l/ U* \3 s2 ^, e
  else
: O  F6 L- p( x+ p& N* r. J    logfile=${ofile_prefix}.log$ u. N$ M7 K  t
  fi
! @  ~4 x. f- F+ r, u+ I
, D- q$ }! z# N4 H  if [ -f $logfile ]; then6 J9 ~/ H' S  l- ^3 }1 `
    echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile      3 y7 u1 M8 I5 i6 l
    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
9 v4 B. ]# `) _* _6 H  fi
5 h) S  J! d( ]) X1 c+ R}/ G- B6 I9 z7 B7 |1 Q( ]8 c% e

7 e5 d7 d3 V( n& y. ?* S& Knext_monte=0
, \# V" m  j. ^9 n& o3 X% d8 F; bcur_monte=0: W! B: W# R5 ~( B  m! Z9 j3 y
% y8 v* k/ \& B  g
if test -s "$MONTE_COUNT_FILE"& Q" }* |2 i8 _' y- O" H0 T( k
then  e; C5 Z7 @! ~0 o
  if [ -r $MONTE_COUNT_FILE ]; then
% e4 u# v. n' ~   exec 8< $MONTE_COUNT_FILE
5 E. H" U+ f: K3 F+ M   read next_monte <&8) Q  a  E' R* o" y: C4 @; i
  fi2 h1 f3 |% W6 T' H  ]
fi& e- f5 ~! E1 ?" g: D4 K. q1 {

: q6 Q4 O; N4 i( X4 [trap 'echo Program Interrupt; cleanup_monte; exit 1'  2- L* \4 r6 W- ]& T! O
while [ $next_monte -gt 0 -a $next_monte != $cur_monte ]
8 }- z7 F1 M2 k; o* U" \do4 b% G5 S4 \4 `+ S: N: m
  NS_CURRENT_MONTE_COUNT=$next_monte, r3 R" o2 H' j# i/ G0 `0 _
  export NS_CURRENT_MONTE_COUNT4 Q7 E- v  O* v* N- q3 \: V3 n: E, B
# V% f) I: ~" ^8 j7 r1 x; e* i
  echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE
! X: {6 a6 B7 [9 v5 R6 q; a0 ~  CMDLINE="$CMDLINE -c $MONTE_CFG_FILE"! D; W! U: M: h% _/ U& M; P
  run_main
& U  b3 Y$ f! N. f! g5 P! S( x/ B( D/ g
  cur_monte=$next_monte
, h* H. d! A2 C/ k! r  exec 8< $MONTE_COUNT_FILE
, n0 Q0 b4 z9 t( C7 _  read next_monte <&86 ]: c$ j! n5 j$ R3 d3 g/ E
done
, T' J% H; [" S/ {. X9 j8 E) k
if [ -f $MONTE_COUNT_FILE ]1 p$ T, x8 R2 ^( U  u' g
then
" G5 o( @% A$ ~8 h' t5 q0 d/ H  s  I8 t  monte_runtime_summary
. G5 F- ~- r  \2 rfi
; y4 w# U$ K/ j0 F% P- Y* P! z
" }& g7 H+ @0 n2 q! y  ~+ Ucleanup_alter6 l) B) i. u5 H1 n/ ^, ]
cleanup_monte  u' X7 W$ A. |
$ Q: O# ]) s0 v. J: ~$ c
Exit $ret_stat

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

使用道具 舉報

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

本版積分規則

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

GMT+8, 2024-6-15 07:24 AM , Processed in 0.149019 second(s), 15 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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