Chip123 科技應用創新平台

標題: 版本ubuntu 11.10 軟體nanosim 無法執行錯誤? [打印本頁]

作者: leaf1989    時間: 2012-5-6 01:58 PM
標題: 版本ubuntu 11.10 軟體nanosim 無法執行錯誤?
各位大大好:6 F# @$ L) f7 @9 Q
                      小弟執行nanosim時,卻無法跑出視窗來,有個錯誤可是我不清楚該如何解決?問題如下3 `( X8 A. A7 E" ~, r7 d
                      [: 113: 64: unexpected operator
( D$ I: u9 O$ A5 Q. d/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim: 1: Syntax error: Unterminated quoted string9 A6 u; R. X2 r/ _5 r
有大大遇過這方面的問題或是指導我方向去解決, 謝謝. , C' x& w6 B% W9 z  N6 n
我在猜可能是這個檔案內的文字需要修改 但不知道該如何修改?& {, _; U. [, P, m
以下為/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim 的檔案內容:
( X- L9 Z5 e# [4 k0 G* S    #!/bin/sh3 G$ \4 M8 G' `7 v+ t0 o3 v$ k
#
  T  g7 D$ ], q% I* b% W# Copyright (C) 2001 Synopsys INC; ?( \9 j/ y& ?1 S. n, ~4 \; T
# EPIC Dynamic Simulation Wrapper (DSW); Q' Z/ @# u1 w
#
' I+ Y% T. _8 a/ l( A$ o/ T4 ~4 j5 Seval ${DBG_EPIC_WRAPPER:+"set -x"}
1 N! n/ d# @& \8 H
1 |3 s& o, m4 K; c6 Gif [ "$EPIC_WRAPPER_DVLP" = "" ]; then
/ i7 s$ C. G& C# Z    TEMP_ARCH="$SES_ARCH"
5 `; G! I3 h  b& g+ z2 Kelse, |8 C- a- R2 O$ }% q& l8 M; |
    TEMP_ARCH="$EPIC_ARCH"
; C- W* j# K  y: n" Jfi; y, h: p6 V; [8 u
6 o& T# |8 h& t
scan_for_hva_args()) ]- u" i7 l: f, l" Y6 x% v
{
- @( s" L2 ~9 l% |$ i  /bin/rm -f hva.init 1>&2
- \" i7 ~1 q, A6 s  @4 j  while [ $# -gt 0 ]; do* t& V5 x9 {2 F: Y$ {" W3 {3 D! Y) @9 f
    case "$1" in1 Q; c/ v1 {3 ~
      -vaf)
* x  @3 g7 S7 o+ i5 y           have_vaf_flag=1* b- l: f( c5 a0 d+ P* r* e' e
           have_va_flag=0" G. d8 d( \+ ]+ l* v$ p  ^
           shift;
; e) C* J: k9 K           continue;
- k% W, v# T6 w3 x+ o        ;;
% C9 A0 a7 E7 H9 K0 e7 B      -va)
& }  }  }$ g, N1 `$ D* V           have_va_flag=1
: n6 h& a4 `" B           have_vaf_flag=0
; U+ m' s; W, ^  h" }7 D           shift;
: P+ O1 x: x1 [" \* r           continue;
  s- r- N+ B) d. W/ n+ }: \' P        ;;; p( T$ L% i8 l% n) e
      -*)
$ Z( F. n2 j' n% k3 ?           ARGV="$ARGV $1"7 U6 p6 d  K0 P
           have_va_flag=0
% \: P8 S, v5 k3 g, b4 m, a           have_vaf_flag=0
# y0 Q4 b. D+ H2 H           shift;
* {! y  ~4 o8 Y: X* n           continue;
; B* |1 o' p* O4 Q; ^/ U        ;;% e1 }1 b' d3 n) i. {  ?# S
      *)9 y. [/ M# w) |! \8 v1 J
           if [ x"$have_va_flag" = x"1" ] ; then " H7 P, q$ Q2 L+ L% S/ B) y% X
              VA_FILE="$VA_FILE $1"
$ r' q6 y! M2 X" }7 c           elif [ x"$have_vaf_flag" = x"1" ] ; then ( m4 _1 c( h4 g( z/ I
              X="`cat $1 | sed -e '/\;/d;`"
: f# |; D1 K+ e              for token in ${X}; do% W6 l8 d! m7 S* n. w( N
                 VA_FILE="$VA_FILE $token"- r% y6 U/ M0 J% m$ N
              done 4 X# ~6 j1 z3 t% R
           else
2 Z5 Z# t; c* H8 c* n! K$ [) q( M& R9 t              ARGV="$ARGV $1"/ L# \! J+ S/ G- x
           fi
) d9 }% W5 @8 x; p3 A' Y           shift;
0 p% L, t0 ~* v        ;;& ~0 t8 L5 i: r" \; _' c% d
    esac
$ V' D$ \' _$ }$ G  done
" m; Y; x+ m- U7 r1 a4 P! V7 f, F% r/ s* M
  if [ x"$VA_FILE" != x"" ] ; then % U  z( s) L9 K' B% \$ f3 N
##     /bin/echo " xxx ARGV $ARGV"
8 P, O3 c7 L* I9 j$ m5 |% S3 s       /bin/echo "choose nanosim $ARGV ;" > hva.init
; N' a' n8 \" [( D+ C+ q6 r       echo vcs +ad=hva.init $VA_FILE -o simv% ~+ i2 u2 N9 t4 s
       vcs +ad=hva.init $VA_FILE -o simv, W2 q, `* h1 `( e1 z0 x+ u
       exe_status=$?7 r6 t* T8 Q5 A0 i, \
       if [ $exe_status != 100 ]; then
7 [! x, B* Q4 I" ]) J! c          /bin/echo ""
$ s( {2 D3 B8 }5 c$ X1 n          /bin/echo "ERROR: Execution of vcs exited with code $exe_status"; `* K, K& B7 o- J  g; s/ O2 Y' @
          /bin/echo ""* I% \# A8 m# P) B& X& N4 I: Z3 z
          exit $exe_status
, H0 u4 X+ N  n. C3 c0 c* X       fi
0 O) F2 W" C- U7 e: b       hva_files="-n simv.daidir/amsVD.ntl simv.daidir/amsWRAP.spi": z. m, d; e: k
       ARGV="$ARGV $hva_files"
: W7 t1 I9 q" T( ^- G  fi
3 P9 @( V2 p8 X% D6 r5 v) X; V}; _+ J$ ?& h! |+ _6 A2 p
#-------------------------------------------------------------------------4 Y9 p# a: j3 A+ a$ R. E- d
8 j! D2 Y1 R1 G) o( V
cleanup()$ e- I' |  d: _- K& |& B6 g1 N. a
{
+ t6 r# h0 Y4 V! v8 p; L- w    if [ -d "$rundir" ]; then/ z' E' v5 x' M4 |
        # On AIX, a .nfsXXX file is created if libModel.o is removed
. t2 K" S3 T: v2 V  C. Y7 U        # so .epicrun is not removed because directory is not empty.& G4 P8 q0 d7 o& D8 M5 L
        # Solution is to remove it again if the first rm failed
, z7 K# N, E9 T( ]6 _- [) e! G* |        # (rm -rf $rundir || rm -rf $rundir) 1> /dev/null 2>&13 n$ V  @! B" b* Q
        if [ "$EXTRA_CAPACITY" = "YES" ]; then  c+ _: Q) Q- X
        chmod u+x $rundir/rpcidfile
# ^2 {9 S& [- m  \; Y& ]        $rundir/rpcidfile+ s8 a3 v3 `, S8 C! ~
        rm $rundir/rpcidfile  o; L% a& d, u+ }
        fi
* n$ `0 l2 G# w; L3 o        rm -rf $rundir
" F8 S" [" _' V. ^' m. u& `, \0 N0 M
0 y5 D8 `) o- A$ Z        #Due to NFS problem, we have to copy files needed to
, g2 J1 v" c- M( f6 D        #/tmp/<temporary directory>, then symlink's files
, _8 o2 E8 f( U        #to the local temporary 'rundir'. This avoids the problem
% W; w9 ]8 N* B+ X        #to remove 'rundir'
9 O7 r- r1 c- d4 s6 I" }4 g        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then7 |! s3 r) ~9 [( v8 r4 @
          if [ -d "$tdir" ]; then% n* N1 a$ D) Q, B
            rm -rf $tdir
2 }/ Q1 l4 W- o' {' k          fi
# O+ Y. C0 e. N, N( ^% f        fi1 r! C& R+ p, j( Q# m% _" g* H0 |
    fi
" {+ S/ \, N& {$ O5 I    if [ ${exitstatus:-0} -eq $ld_err_code ]; then
% N. }) i: S5 b6 r. f- y        [ "$has_model" = "YES" ] && rm -f $cwd/libModel$suffix
4 z( Y% I% f5 @/ I' W        [ "$has_custom" = "YES" ] && rm -f $cwd/libCustom$suffix
  d4 T0 h! Y# V9 E  m( |8 x+ v" E    fi
" t5 g$ K! U9 a+ N9 i7 y& p7 K6 L. ?    [ -f "$EPIC_SCRIPT_MESSAGES_FILE" ] && rm -f $EPIC_SCRIPT_MESSAGES_FILE 1>&2
/ E4 f# K; x4 ?, o, m  w    exit ${exitstatus:-0}$ q9 s6 H8 C' I0 H! e+ r: b
}! _% h) X: l+ s

6 W4 v+ E$ c- i" d3 hExit()# g; d$ H8 y; @
{5 \9 h3 @" J% I& o- M
    exitstatus=$1+ @7 G( P1 h) @+ `7 N( g
    exit $exitstatus+ d+ k- K. s. V: e) v9 H1 M' O
}6 R8 G$ x, f" ^+ Y

% b1 X! E" {" H$ j  \. ]# get_epicrc filename keyword
& O+ B8 m2 ?1 n1 f6 L8 X: gget_epicrc(), O  [8 q; I1 W6 D
{8 S( b3 A$ d" H
    [ -f $1 ] || exit 0' j9 U' e6 L8 x! c: k# H
    key="/^$cmd2:/{print \$3}"
7 m( T. k/ J$ P. C    awk -F":" "$key" $1! C( g( v; q% N* g  I
}
5 _. D8 A8 s  Y! X; s" _, D- K0 J; {! ?. W5 w
#
) \& c4 g$ \' j1 C# set datasize limit to hardlimit+ y2 S; l- A2 k; ~. b* e
#
; q' ^+ Z1 N6 l7 oset_data_limit()
# j, a; u& u" z' l{& s0 K- y+ s  }
    dbglimit=0& {; W( V  r/ @6 S) i0 k1 H
    hardlimit=`ulimit -Hd`
; l( ?* i! d6 n    softlimit=`ulimit -d`9 L& s: d! D, T+ @, _0 _7 X
    desiredlimit=3500000% s, ^: _8 H; [2 V+ g, p( @
    hardisunlimited=03 p# C2 }* a' p8 K
    softisunlimited=0# X& t, \! C3 h6 _( `$ q% i
    is64=08 G; Z6 E; O) T' u$ a& j. M

, @: l' n* p/ L3 S' P    case "$EPIC_ARCH" in
8 x: o' n% t8 X$ o7 \% q    *SUN*64)
7 Z" m# d. {" Y) J2 L& ~        is64=1
  [' f8 u+ W4 s3 ?7 q( v        ;;
" E; L2 Q8 I& h7 L: E. ?    amd64)
, \6 C" w+ L$ b0 k2 c! b        is64=1! H* i+ O4 C  A9 d6 k0 h: f
        ;;
& I9 w7 h: Y/ q1 w5 ~    x86sol64)
" W2 L0 C* e) D7 @        is64=1! d5 J' O6 C# p) I8 d
        ;;5 i" u8 j7 m# v
    aix64)$ H. C$ K/ M/ o# ?* A/ U8 X, H
        is64=17 X  F! |' s3 \7 v. f- K
        ;;
9 ?# J7 G5 |% A& R# E% Z    suse64)
8 P+ J" |# i- E; u% s; h        is64=1
' \- G; K1 I; n! \* p  y        ;;
$ m, x* i: B2 l. i4 q8 L+ I* d    esac
( |1 U" [( O8 q# h7 d" _& }0 X7 d: l4 i7 t: t; T
    if [ $dbglimit -eq 1 ]; then, E9 z% Z+ z+ V  i7 p, ]0 {  j
        echo hard $hardlimit soft $softlimit
4 i' j+ x4 o, Q5 _4 Q    fi
0 }1 @9 G& v7 l; r4 _2 N2 L3 c' B! V* r1 ?5 P$ Z& y9 E- @; H4 b
    if [ x$softlimit = "xunlimited" ]; then$ b$ ]0 I9 a. y5 t6 K
        softisunlimited=11 q8 O7 Q5 W* H5 U- c2 y+ _3 L
    fi
5 i0 i* ?  T' n. d# A6 f0 B
  U- X" G4 }1 W9 Q) Q    if [ x$hardlimit = "xunlimited" ]; then: f  \6 j" U% f% b  H/ ^
        hardisunlimited=16 \& |  e% O; G5 e) V: l
    fi5 K/ h+ A" `2 r+ y

& s5 z5 o7 w3 |5 N: G    # 64 bit machine should have bigger than 4G3 O5 e* ~$ e& d
    if [ $is64 -eq 1 ]; then6 w! f, O2 a2 i, W, u3 p
        desiredlimit=5000000
$ M3 A9 Z, c- W. r, J( ~    fi
: D6 J& `( S: \2 {. V+ [  p7 _4 e% }* ]: W
    if [ $hardisunlimited -eq 0 ]; then
6 [% R. L6 A# T' Q        if [ $hardlimit -lt $desiredlimit ]; then
' i: \6 v; J# B; j5 }6 k            echo "WARNING: datasize hard limit $hardlimit K is too small.". z( i' C+ {9 d  H6 L
        fi
) I1 Q- Y6 a+ Y# F1 ~) H: s, K7 L6 N    fi
* n8 G) F9 ?! k$ T. f0 b+ M- U; v  ~2 A4 ~/ m
    if [ $hardlimit != $softlimit ]; then
- z: G( B$ }! Z+ w# m        ulimit -Sd $hardlimit
4 G9 j  F; b9 f" ?#        echo "WARNING: datasize limit is set to `ulimit -Sd`"
' @& l+ j5 ~* r+ q    fi  [9 K  \0 V: B, F* T
2 }7 W# G: T; ?2 V* c  h
    if [ $dbglimit -eq 1 ]; then/ ?+ p8 n6 i4 R! i/ r) h/ O5 C; ^
        echo datasize hard limit: `ulimit -Hd`9 _5 ]1 a) ?3 w/ G1 t: s6 h" F+ _! R7 [
        echo datasize soft limit: `ulimit -d`' k. v6 h! m; }9 O) i3 L4 e+ O
    fi
% w" d& k0 W' Q" N}
2 ~6 b  m' n3 s9 x! W( \3 ~0 l
#
# l% Z; [5 R& _0 Q" v# set stacksize limit to desired limit
3 L( S! y5 m! K! [  Q3 u#
6 r# i2 N/ i+ C* u  z" kset_stack_limit()9 J. j, Z( `1 K! S7 [/ ]. F2 S. }- ~3 x
{/ I% {1 H7 t  S! G/ x6 q
    dbglimit=0* X1 H* W8 W8 q$ g2 p7 T/ H
    hardlimit=`ulimit -Hs`! l8 _7 ]! O8 J+ t  V8 j1 t
    softlimit=`ulimit -s`' h+ d' f( S, h( d- ~4 L
    desiredlimit=600003 i, L' {3 ~: y* H
    hardisunlimited=0/ y3 T& C/ H: Z# Q$ E3 L9 W5 f* k
    softisunlimited=0
; R6 f6 X5 O/ x1 d6 f    is64=0
- b3 _$ a. `" q- J( r  c9 B' G. ^2 A* B! r) S% B
    case "$EPIC_ARCH" in
! b1 _7 N4 ~2 b9 ^9 [- x    *SUN*64)
5 u4 k' R5 s+ Q; ?        is64=1
; o* i. ~. q2 J1 n' o$ Q, m+ u        ;;' p8 [4 U6 M5 z4 u
    amd64)
2 W1 D1 ^4 p; ^. v8 ~$ }1 C        is64=1
4 r( D; {5 e6 p4 q        ;;, q6 W# R. x9 U. O2 ?, X& Y2 l
    x86sol64)# }* e8 y$ T1 j
        is64=1
6 u: _( E; O. {* W" {9 v        ;;
" J4 l6 h0 B) {& T! ?1 g8 |    aix64)
7 \! C& b$ N1 x        is64=1# x4 m  M9 }' Z3 F7 `* u
        ;;3 \7 z+ L3 z+ t1 ~! E9 M9 T
    suse64)
2 N, }1 c/ }3 ]4 b! l- S        is64=1
' ?8 O5 K8 M+ z$ h0 `/ z        ;;9 I! G5 I- Z0 f. L
    esac, R7 e2 @3 i" L9 n# }

0 ~; G& r1 @5 A2 S1 J; Iif [ "$EPIC_WRAPPER_DVLP" = "" ]; then
4 R4 |+ R$ f2 g    if [ $is64 -eq 1 ]; then3 g& c, L8 f: L( @/ {1 j
        desiredlimit=200000" Q1 N& x, f2 [
    fi
4 c- I' f% A; ]3 N0 celse  L- o5 ]8 R$ i: t) s9 ^
    case "$EPIC_ARCH" in3 n8 d4 d/ B5 V9 g
    *SUN*64)
9 b" `' M$ F# P; }" E0 l0 r; ~        desiredlimit=200000
8 s" j  l! w" y& P% a( ^; b& h% e        ;;% S$ V7 m% l. a( Y
    esac0 k& O* o( |2 s7 R2 Z- B5 d
fi/ c5 j4 }' @; t; h! I
       
% ?! }/ t" W6 V5 K1 [    if [ $dbglimit -eq 1 ]; then
& b5 C1 t7 V6 ]7 q        echo hard $hardlimit soft $softlimit/ o5 D- a4 s0 n/ B7 B# {4 U
    fi6 r; ~2 O6 A- B5 o

3 G9 e7 D8 N$ @( j& U# g& h9 U  D    #stacksize can not be unlimited, pick smaller number
$ o. c3 v, Y( `! W
5 j& n2 q. c! J+ O# d    stacklimit=$desiredlimit
2 H3 [5 l) |2 F' H( z) F- B# N# w! t; O! _
    if [ x$hardlimit = "xunlimited" ]; then. q' u. e( `; }
        hardisunlimited=1
0 s2 [$ y8 P/ @) ~  C+ K+ _    fi
! p9 }1 g2 P: n+ c' e  w5 s$ \: E) ~( n6 w: w, G2 w6 c, ?
    if [ x$softlimit = "xunlimited" ]; then" y. s' C. _7 r; A& @; ]; d4 g
        softisunlimited=1
6 C/ E- z, |/ @3 I    fi
4 j, e8 ]" b1 I2 M: H% R! T5 E: s$ A8 H1 R
    if [ $hardisunlimited -eq 0 ]; then9 _8 D" D9 M5 c( o6 a
        if [ $hardlimit -lt $desiredlimit ]; then
9 z/ T' b1 a5 R; b            echo "WARNING: stacksize hard limit $hardlimit K is too small."
+ e; {  U- X1 n' v  x$ s) n            desiredlimit=$hardlimit
+ }+ R5 w9 v; ]6 n            stacklimit=$desiredlimit) l$ W% D! K  N
        fi1 T* D! ~& Y, u2 f6 ^1 W
    fi% U0 r- y; a8 T; G3 [  Y
/ ^5 D3 E; t/ t2 g
    # desiredlimit is set to proper value (< hardlimit)1 [4 e9 Q' F/ S9 M9 T
+ _' [/ J! }$ ^& n
    if [ $softisunlimited -eq 0 ]; then
* U( y+ j) U1 Z! L! \+ d5 P( g        if [ $softlimit -gt $desiredlimit ]; then: J1 n4 I8 D3 p% a( d  C
            stacklimit=$softlimit5 D! K& r: G$ R" A; u2 K0 N
        fi) j) A3 \* C( p* d4 S9 i! G
    fi
6 z; A; @1 G$ i1 r- m+ d
0 M- q' x: `2 f    if [ $softlimit != $stacklimit ]; then' M6 ?6 h5 O4 q' M
        ulimit -Ss $stacklimit
2 y1 d& d) B$ n#        echo "WARNING: stacksize limit is set to `ulimit -Ss`"4 ]  A$ R  r) h! L6 h( o0 ^, Y4 `, h
    fi
; T5 _0 s0 |" M3 a' a; x2 \
6 a. o' C+ r& f# c# G& h    if [ $dbglimit -eq 1 ]; then
) ^- N8 y: H: H; E6 P- p+ Y8 e        echo stacksize hard limit: `ulimit -Hs`; E! ?5 h* C% x; h4 W
        echo stackize soft limit: `ulimit -s`2 e# K* ^4 u( n6 L1 Q; f& ?
    fi
+ s, g1 {  X  q* {8 Z( k! {+ W}! f9 o9 U; ]+ k; {& n
2 s$ A0 y2 ^3 V! Z2 `% @
open_epicscriptmessages()
! D5 Y9 f5 W7 Y; o{8 z5 o. I; I& S
#generate  temp ".epicscriptmessages" file based on pid
4 a' u4 q- m" Z: v$ i, H* \% k* UEPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
3 K. ]1 J1 e5 L+ [if [ -f $EPIC_SCRIPT_MESSAGES_FILE ], O4 A6 e( I- J6 h6 A! Y1 s
then
& a, z0 T5 M$ X4 j' j% X9 e4 X  until [ ! -f $EPIC_SCRIPT_MESSAGES_FILE ]
; v. x8 ]5 L3 f% K' r. }- h  J  do" W- I. J. W0 m9 y2 Q( N  x
    EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$6 H; G8 l! N5 B% w- Q0 N
  done
' \2 d2 L) Z3 }( Y% Wfi0 u+ P( ^6 _1 c6 q- H6 Y
( v3 Q2 Z+ F2 P" ]4 h
export EPIC_SCRIPT_MESSAGES_FILE, Y8 r: x! G8 `% h; K/ Q
}
1 n6 ~4 b8 l/ F0 O( e4 Y8 v' l3 \' r) [

, ^; Y6 x0 f* d, f4 P6 Pcmdname=`basename $0`  @8 w% p  n, n- C: D. f& U3 l: O2 [
postgres="n"
: D* d$ S2 {6 U) L5 l& F) ^9 Yostore="n"
2 V7 x8 ~& W7 q- igui="n"8 |( o2 l' m% b2 n; b
databaseOn="n"! k7 Z# d1 l3 E
f_next=0
) W; g# Z3 W$ r2 n! v% z* Yf_option=""7 \7 e" L9 Y/ K. j. X+ h
o_next=0
( X: _6 ]$ q$ c- y: `2 b! p+ {o_option=""
: W; W( e- ~7 w3 y, ^3 IworkDir=""% x& _1 J( f5 W- }$ _1 r4 f+ \
workDir_next=0
2 w4 U! P0 W. @8 JerrFile="powrmill.err"
5 p0 A7 M. g6 g8 n! k! l6 Kwin32flags=""5 N* p$ `* Z4 N; Q
ln_default="ln -s"
6 R8 Y8 @: x9 ^( r0 N- t+ z: z7 ]! m  `; s% v
har_hilo_file=""
( V! G5 @1 K: y& ]+ F- J& J; Xhave_har_flag=0. @7 X% t, C  X/ f
have_har_setup_flag=0
1 ^; ]9 V, |) I0 a6 his_special_har_run=0/ N; t% K7 H; {, @; m% ^. F# O
har_ofile_prefix=""1 r- }3 w+ B& Z# T

$ G# O) U4 o, A* Z# Jhave_va_flag=0
3 ]! C. J0 Z3 m% q% {1 H" l# Mhave_vaf_flag=0/ B: x% \! i( R9 T/ o6 t
VAF_FILE=""
4 o/ g8 K0 _; LVA_FILE=""
- l$ q6 i1 m0 CARGV=""
/ _, {& y. g$ U1 l1 E0 x5 t7 o) ?4 l3 ~* O/ |/ @1 H
ORIGINAL_COMMAND_LINE=" o. Y& G! j! F0 X, t, |
LOOP_CTRL_FILE=".ns_ba_env"2 z/ u( C/ {: c. B/ r; ~
ALTER_HK_FILE=".alter_hkf"/ g3 e; h$ c7 K7 G- E0 b
ALTER_COUNT_FILE=".alter_count", P- b: t5 }9 ?$ R% e
MONTE_IMG_FILE=".monte_img_f"
; ]% ~2 \- U% s7 N! k1 DMONTE_COUNT_FILE=".monte_count"# r4 v) k  j4 F+ p7 N
MONTE_CFG_FILE=".monte_cfg"/ I+ C6 t. D8 B& T) Y6 J5 j
EPIC_SCRIPT_MESSAGES_FILE=".epicscriptmessages"1 e( e1 b- S0 `

$ I" q8 k8 \& w1 v& p3 Q+ K9 Iopen_epicscriptmessages $@* l) Q+ w" a4 C' p8 P
* H! D2 Q$ r0 M
scan_for_hva_args $@
4 [/ M% B, t8 e+ h& h3 O4 k, f/ c. m" z2 q) ]
scan_for_har_args()' i3 T% G4 U; ]
{* k  Z+ l; B+ t/ B, @
  while [ $# -gt 0 ]; do
: b: L) Z1 [$ J  |' z% t, B, P    case "$1" in
. ]: c* X, x4 V! T( Z4 f" a      -har)* M- v6 U+ N; `3 `
           have_har_flag=1
5 w! \9 v4 g$ L+ Y) K           [ $# -gt 0 ] && shift
  t; v0 G1 t# C" y0 M+ v           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then
' x* r( R+ p* @$ n7 t6 `) t             har_hilo_file=$1, t% G6 r- h0 @- x3 M* T9 D$ o
             shift- S2 T7 [+ U8 i" R6 g1 e
           fi
* c8 g5 w! \! \  T! x           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then& ^5 _9 x6 G, w2 s
             echo "Too many arguments to -har flag. Only one hilo file allowed."
2 d( E! C0 n9 p             exit 1
4 `; Q6 W. a- k/ ?           fi
* M' l$ J& K: {; ?           break) x% }. j' x5 J% V0 {
        ;;% j# G$ L' V- s* z4 J
      -har_setup)
* C/ A/ D9 C( X0 D           have_har_setup_flag=12 x  l, L9 k5 m0 Z7 J: f# T
           break
. @* h" B( ^6 J+ `        ;;
# y0 K, l: O7 [8 `2 T2 @/ Q1 n+ O      *)
8 d2 _" ^. I, P; l9 _0 o4 }; K        shift
0 f: P8 b, ~* }0 [) r        ;;( x# J  l9 v; R9 y& G& p% {; H
    esac
) D; @& w5 t& {  ]  done
6 g, K4 u" J' q* h}. v& T2 H9 E- b5 n* J# ~( c

  e( B% d: d( i! S# f, Gscan_for_har_args $@2 e: k* r: s' |& Q9 D, ]! V

! g+ \$ q0 G& Z8 j$ o% v% Bfor argv in $@, ]3 Y! \3 N7 h. [- f
do. o6 a/ S5 p$ I2 q9 ^
   ORIGINAL_COMMAND_LINE="$ORIGINAL_COMMAND_LINE $argv"9 R) A3 z' T8 B* P& H/ Y
    if [ $argv = "-gadb" ]; then
5 g' e) e' x$ R8 K5 E3 _        databaseOn="y"1 }; f; A. O0 C  q8 l. U" q, r8 r( y
        workDir_next=1
# G: l1 ^6 ]# e. z* N    elif [ $workDir_next -eq 1 ]; then
; v8 b  i' U0 a5 F' G6 g9 S        workDir=$argv' _6 v2 R# s- d1 {) s
        workDir_next=0
0 M( \8 l' q6 `& R4 b- {    elif [ $argv = "-ga" ]; then
) O" v. K0 _  X! V( ^2 z8 L- M        gui="y"0 {+ P. x- X: d" d9 U; ]# s# L
    elif [ $argv = "-f" ]; then
6 O+ G. c( h+ b, t' j        f_next=1! h. {1 o& H4 i' j% }4 U' X
    elif [ $f_next -eq 1 ]; then) l3 R. A# V, p/ l5 o
        f_option=$argv0 b; ^" P/ N9 |7 e  M
        f_next=0) t$ v' n# U4 l
    elif [ $argv = "-o" ]; then! `* h9 \9 l* c: C; g; t  F
        o_next=1% A% A- M7 {6 v' g
    elif [ $o_next -eq 1 ]; then  c: X4 i! r2 \
        o_option=$argv4 f6 ~6 `5 z, a# f$ ~7 `
        o_next=0. A6 i) A7 d% |
    fi
% j& A0 ]7 j1 S: G2 t% b- Udone+ E8 f+ J. |3 H1 P3 q/ f' ~; J
echo "Command line options: $ORIGINAL_COMMAND_LINE" >  $EPIC_SCRIPT_MESSAGES_FILE 7 ]& T. h% u% J0 Q

. w) d4 C* Q, v; Oif [ $databaseOn = "y" -o $gui = "y" ]; then
+ r( H6 t: W9 v- o4 o4 n  if [ $cmdname = "pathmill" ]; then
; c! N0 Q. c2 Z2 r; i    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5"  -o "$EPIC_ARCH" = "SUN4_SUNOS_5_64" ]; then
8 p# P4 d, }, E& N& r' P         ostore="y"
1 J3 [1 R& I$ A( ?- ?: i         postgres="n"
+ r# v/ z  I& _6 `8 N7 Z     else  F1 S0 U" t% i3 C6 l# N
        echo "athmill GUI is supported on Solaris platforms only" 1>&2
* _/ ~$ K9 P0 O7 j* e4 _7 N5 y        exit2 w; M# B) ~3 C: P8 w9 p( F
     fi" y4 f/ p# o9 n/ h% _8 N+ g
  else
6 f4 N. }2 J' A  r  @; u    postgres="y"
0 X1 b5 W, x# |% o         ostore="n"
& F% L: a* s% C5 d$ l% p2 ]7 o  fi. H( H! ~1 g, h+ ?, y, j% y
fi) K6 x; e! Z& B' u7 r

  p" l8 o4 D) M6 t, y- ?( l5 Hif [ $gui = "y" ]; then
) V! _. N# f& T. V    if [ $cmdname = "powrmill" ]; then
( \8 s+ U9 Q  @. f# R        pwga $@/ J. }+ v/ X1 Q# v' O: G( c
        exit. Z3 B# s6 U# r6 n* k/ Q' S7 t
    fi+ @6 G& [# z- [, ^/ B+ L. N

3 ~4 o" A; T9 i0 I/ L& O    if [ $cmdname = "pathmill" ]; then: s5 @& w  Z7 z# w- Z& S4 r
        if [ $ostore = "y" ]; then% j7 m" w9 @  S  d8 V% I+ T
           ./pathfinder $@7 ?  u5 d8 m8 F+ `" L
           exit
4 P* W% @% w$ j0 L# x7 @9 B& R5 o        elif [ $postgres = "y" ]; then- ~/ A' l3 n- g/ Y1 ^2 G7 a1 a( |
           pmga $@
* D8 n2 O( X& |5 _/ n           exit
1 G  I% O* h* d- I        fi5 a0 c- |' T" m! J: w0 J) N# p& O
    fi8 Y- {; p) U6 \1 K( s; m2 ^. |' _
fi5 n* ]" d2 `( j4 U: D
/ L0 d- L! {6 C2 ]; E, d
if [ $databaseOn = "y" ]; then
  k& B+ m( o: W   if [ $ostore = "y" ]; then
  e  B+ T/ A) c) \8 r      if [ -z "$workDir" ]; then
* {/ Z/ h$ \6 x! J$ b( K2 s  [7 P         echo "Error: Missing argument for -gadb option"
5 M6 w) l3 w6 _         Exit 1
& C4 V/ P, C4 x& {2 O      fi
/ z1 w+ V/ D, M" Z   fi! Q, S5 T5 N0 ~2 V. I$ A
   if [ $postgres = "y" ]; then
  E* L" z, d/ m8 T# k      if [ -z "$workDir" ]; then  z! f8 q2 p" s6 t
         echo "Error: Missing argument for -gadb option"1 E/ Z' E! Q. x# j+ ~1 m
         Exit 14 ]8 s( s1 A8 t9 h
      fi
  E6 `& L* D; b   fi$ B4 x4 L( h7 }, `" z! p" C/ Y; o4 h
fi+ ^7 k6 C- ^' \/ O: _
  ^3 ~3 c  x: K" a9 Z" E1 x. n
if [ $postgres = "y" ]; then, V5 C* g1 V, I+ R

. p% x0 U) [) ^* R2 P! l    if [ -r $EPIC_BIN/scripts/gui-init ]; then" q  ]1 j0 _5 w# K! e4 `
        . $EPIC_BIN/scripts/gui-init
/ G4 X* D% R# `) Y    elif [ -r $SES_ROOT/bin/scripts/gui-init ]; then
3 S% P0 ]5 c6 D9 v# I) X! l. E0 k        . $SES_ROOT/bin/scripts/gui-init, t6 B+ X" \5 T9 s- c9 A6 ?
    else4 E1 L7 [$ ^9 b- ^) _# c: ?( ]- w
        echo " ** Installation in \"$EPIC_HOME\" has been corrupted!" 1>&2
' m! k0 C5 s* E        echo " file bin/scripts/gui-init is missing." 1>&2
. y4 k4 u  |& e% U4 V, H: n* X' p: S1 Q    fi
5 O! O  \! K% U. y/ C5 A" S. Z" L- f( w5 [5 q8 F
    workfile -tool $cmdname $@
; ]$ R# w2 B- Lfi
6 S1 x! y+ }6 n6 a! O6 X0 ?: v7 W* ?* S3 O; E. u
if [ ! -z "$o_option" ]; then
0 F8 P* K: }. m    errFile=${o_option}.err
' [' f# e1 w4 _1 M6 helif [ ! -z "$f_option" ]; then; w" |# i  {/ m: g/ S) J
    if [ -d $f_option ]; then
* r$ y5 R; U0 n1 K5 h        errFile=${f_option}/powrmill.err
8 ~$ h) ]2 p9 k( w" A    else errFile=${f_option}.err8 @6 Y! o: Q0 ^0 o! R
    fi6 n7 ?+ T) g+ u7 x& w
fi& @5 a* Q6 O, c$ Y/ ?( U1 t  L

9 ]7 ?, f. E9 O/ E3 a' F/ c. O* O0 N/ d5 j! _
if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
/ w$ a8 h) s  ]/ O5 m7 f" X  rundir=.epicrun
2 n+ c3 E$ c* {8 b* |else
4 U3 {2 b( C" T  Y  rundir=.epicrun$$
4 K+ ]: j3 S$ |$ A! |. B( ]fi( C, M, W/ a5 y4 o* e

6 }0 y3 ]2 n" o$ R( V# u/ blibpath="$rundir${EPIC_DLIM}$EPIC_DIR"
$ L$ Z# E9 U+ G) E  K% w1 S; ?
! j' V! R- M5 ?1 V; ^* Kcwd=`pwd -P`! Z& K0 Z! L: b3 G. p) K
if [ $cmdname = "acehdl_w" ]; then/ ?! w9 @: C9 G4 Z$ R
  cmd=`basename $0 .sun`
6 x; z$ \5 z+ L6 N# y7 K! a- H  cmd=`basename $cmd _w`
& j0 }; _* D! k1 h( eelse
- O5 L* x7 A4 c  cmd=`basename $0 .sun`
/ y1 G1 ~3 P1 X$ V( ifi
. q/ L' E: h( d' t
4 L# H: A* h* K) lcommand="$EPIC_EXEC/$cmd$EPIC_EXEX"5 K8 ?5 K- z2 }- b
[ ! -x "$command" ] && echo "$cmd: not installed!" 1>&2 && exit 1
( r) {3 z5 y" S! E$ Q+ P0 m- ~0 A' ~0 F' @5 }; l, X
# buildmod extracts -u/-fm options and calls genepiclib
( n/ V  t! Q0 [9 I2 q- k# It also set the remaining options to variable CMDLINE
# l2 i$ b, J# J# look up in .epicrc for -fm & -FM parameters
6 w9 b+ h' v% U; Q- j+ O$ z# s% `) [; H7 P
fmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`"4 A$ w2 c! h2 i  f# s/ v+ |
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`"
/ r; l' w' o3 C  o( X[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`"
/ w# p; t$ i) x7 d( M; f2 k
5 |2 ^8 ?; Y1 K' [/ E! `: H. l: dFMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`"
2 Z  ^) F9 D) g" K[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`"
( q% M' A5 o( e1 z3 J[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`"
  f& X* [% P0 W2 T* F; R6 _8 ?. i1 H& `$ t! N$ w% U) t. r5 a
if [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then
3 t" k% u0 E2 f; H  n    # note that the buildmod script will set the CMDLINE variable% z$ H; I. W& D) q* W9 ]
    . $EPIC_BIN/scripts/buildmod- ~) I2 v8 o% }
* [: D7 Q( O: l$ d$ u8 r$ \8 x
    #echo "This is the value of cmdline=$CMDLINE"6 X% \* @$ \# c) R8 X9 L3 \
    #exit 08 Y! @9 p; R, [! |. o

* }( ]+ z- F5 m    # if a new timemill/powrmill/pathmill built, run the new one
8 U3 r- J* O: y) J! d    [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX"# A% T' o5 W* ~9 I- O; u
fi2 B/ c* a& I5 d  i' F! q3 U( _

0 b+ M6 t8 p4 p$ c* N( D0 Bif [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then
& l+ b+ [! u6 Q5 U3 g8 t) n" j  if [ $have_har_flag -eq 1 ]; then3 p3 |! i; P8 x0 y
    is_special_har_run=1
8 q1 t- x' y# H& y: o1 v    if [ "$o_option" = "" ]; then
4 y9 ^7 Y4 c$ J3 g# y5 v      case $cmd in
1 i" l" L4 m9 k) r6 a        timemill)2 O: K3 H- j( J1 j8 S% [* v7 Z
          har_ofile_prefix=timemill/ x# Y& Y) q. S6 l" Q$ G$ k! ~
          ;;. r" P  b8 r4 I0 ~+ M' X8 [
        powrmill)
) @& U6 v/ T: b+ I1 G, o          har_ofile_prefix=powrmill
, Z- T# e6 J& r/ s          ;;4 q" _" ^) S( y4 r+ V4 K
        nanosim)* x/ z; I+ {' x
          har_ofile_prefix=nanosim9 E1 L) `" p& u% H1 d: V0 |2 o
          ;;7 @/ H; o/ }0 q  j5 A/ G* E( i. |
      esac$ s) w" T' a; w$ f  B" ?& C  u$ J. e7 _
    else
' G! @1 L# {" b# `$ [7 r: ^  B3 W      har_ofile_prefix=$o_option1 l* Y$ }! F/ r/ ]
    fi
+ Q; g) t* _2 {' o  j6 a6 z+ j fi
4 `* I8 Z! P! i: o7 efi. i, G2 K- [. Q& y6 A. a9 d. i

5 H7 Y$ R, F1 z& h# Call Double precision version of the product if -D0 {% e4 L0 L% J
# or simulation time > 1,000,000 ns., |6 }" d7 b) h5 h
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then
5 z3 E) y+ P  i- o9 x- S; l; W2 P8 [- }5 @  W
  # Now the binary always has the ACE feature
- z+ s$ p( t5 e: K4 Z  USE_ACE=YES
  _' z" n6 k: G+ `; n* |
5 w% y; U3 j4 E2 @; m" T5 L& a  HAVE_DP=NO
/ O$ [3 \' W! m  EXTRA_CAPACITY=NO
& l6 v! ^4 e. c/ b  @  DB_REAL=${FORCE_DB_REAL:-"0"}# m0 u$ v6 Z$ e. t# p  l0 \6 b6 c

& W7 t( V( P1 k* Z7 |8 S7 M  # Enhance for ACE ease of use6 m, P' {5 |. z( p, p7 @$ T7 [% j
  # If no command line option or only a -T option, do:
+ k. T* E% |, _, v# h/ O. k; v  #   1. set -A option& j  s' f, b( K8 }
  #   2. assume input file to be hspice+ j* c( X1 ~0 T3 @
  #   3. set -o to input file prefix
" a/ v9 A& g6 @- E  #   4. set -z to input file prefix
7 W6 d6 f' }6 Z  #   5. set -c to default config file) X( n- g1 N+ O) M
  netlist=""
  T) ^: l1 g3 ^8 F0 s6 C0 K  minusT=NO
$ J2 V% h- Y8 P* c- d  useStdCmdOpt=0" u3 l% |* H& I* m" f2 k
  prefix=""
. f1 n2 }* H6 S: h  circuitType=""
" R% a3 E4 b( x7 g' [& ?! C  for opt in $CMDLINE
& {. W, ~1 L" k6 ]  do
" P3 g" W1 y+ S' ~) |    case "$opt" in
* m# R( y4 K7 r" A& i      -T)! a8 ], }. R/ E( a
        minusT=YES; S- L. r& I- S) `
        ;;+ Q/ O* R+ G, n" k" @7 }
      -*); U) I6 j2 G9 A( O: g
        # using standard powrmill command line8 z  Z% P7 A6 n3 C
        useStdCmdOpt=1& H% l7 p& |1 k  o
        break
% n  P4 e1 ?/ \" ^# V2 V        ;;
* r" ]2 m0 L" v7 J! @      *)# G6 |) ^. o2 K, m) b' l
       if [ "$minusT" = "YES" ]; then2 y  L. R+ T, V) W
         circuitType=$opt
2 P6 V- a7 g4 E3 D8 D         minusT=NO  # reset flag9 ~3 d- u* ]  ~, f7 Z
       else 2 k  g& N1 N, T0 f* F; t& e) T; H
         if [ "$netlist" = "" ]; then3 n& z; \4 L$ }" f  M+ }7 e+ a. q) u- x
           prefix=`basename $opt`& s. b1 S; C2 K* l" V' B! u" _" e
           prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix`- b8 W. r7 K, u+ t  \
         fi
% G* [, m5 F+ X' p         netlist="$netlist $opt"
8 Z3 p+ s9 [( a       fi) D! i1 N$ t& s0 i5 X+ A% y0 X6 q
       ;;# S6 n( B6 B- }$ \7 o8 C) I
    esac: I% P9 k! w$ W" S6 F
  done
! y  {) g# U9 i2 R: g
1 E: E1 L8 I! O, i+ D
+ ^/ @% B+ ~. W  if [ $useStdCmdOpt -eq 1 ]; then
3 w- M9 k4 R1 Z    # use standard powrmill/timemill command option! S, Y! B" T4 y0 Y0 q) E+ u
    for opt in $CMDLINE
2 }$ Z7 h  o% O" r5 I" z7 e) [5 T    do
* M4 F0 e( o! \0 f! v( l9 M( i7 f: U; M      case "$opt" in
7 b8 M8 e0 {1 \; s! X        -A)0 A& \% }- Z3 _
            DB_REAL=1
- @+ F8 S4 L' p            ;;
& j6 O2 n/ H5 h+ x2 o/ O      esac. J- J! d! K3 H. H. i, j7 o$ w
    done
! N! {  F8 _4 t    if [ "$netlist" != "" ]; then
1 L9 Q3 h% ?$ i      CMDLINE="-nspice $CMDLINE"0 J& b+ y0 C/ X. ~
    fi  }4 e2 q2 G; h) W+ c5 u: |
  else
$ ^* n# k7 S9 x4 r$ C    if [ "$netlist" != "" ]; then7 \  Y* R, P) y. m4 x; t- }% [: K) o
      EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"}
4 ?! z( Z5 k" w/ Q8 h      # construct new command option) B/ c* [$ l& k( k  k
      if [ -f $cmd.ini  -a  "$circuitType" = "" ]; then
- v. x: y- Q3 M3 R        CMDLINE="-nspice $cmd.ini $netlist"
2 l& S. d! K7 r/ F      else
# O1 _. ~2 m4 r: _# p5 m' c# A        if [ "$circuitType" = "" ]; then
* \& Y; r" F9 U5 {+ A% V8 p& ^          circuitType="msana"
- s5 y. ]( D8 C2 z+ g. l% s        fi
2 \. W3 K  f7 e        CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg"2 f7 }- E5 k) r
      fi
% U2 r, a1 B. q) _, @! F7 g      CMDLINE="$CMDLINE -A -o $prefix"
! J2 S0 r+ }- o- p8 C+ \% u      DB_REAL=16 D& J% y  |+ s2 Z
      echo $cmd $CMDLINE
( u+ b, S+ l: h, k    fi% S$ O6 W5 f( t1 G, I; P
  fi
, x5 }0 j: q, E4 d( Rfi # cmd is timemill or powrmill or nanosim or railmill or pwarc) w# `) [- d; m' ^# c
, T* @  P; g( f, c9 P5 y
[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a"6 E8 M3 I3 v& I3 b5 R7 x
[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a"" h4 e6 I* y. `& E6 u+ V7 m9 o1 Y
[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v": x- H% i- n1 Y
+ O; {/ r/ a* e5 j2 Q  v# D
if [ "$__engine_wrapper_called__" != "Indeed" ]; then
. _$ K+ t  ?3 a7 [8 ^    __engine_wrapper_called__=Indeed7 l4 `4 W2 w/ u( y8 V
    if [ "$cmd" != "amps" ]; then! U) w1 C9 f( P6 L+ q3 }0 k( Z
        export __engine_wrapper_called__2 w$ `% ^* x6 R2 f6 L
    fi& j/ [0 B1 n3 X8 A/ N+ M# Y5 N% ?
6 [0 y! ^0 @+ K% r  d6 T5 {
    trap "cleanup" 0% M5 E* U# i$ F; m: k1 e
    trap "" 2  V1 p1 z: F8 G3 T, G+ o

% k& t" z" Q. ]+ m, L& U: B4 k) S+ j0 n    [ -d "$rundir" ] && rm -fr $rundir
& t  ?% {" ^# N    [ -d "$rundir" ] || mkdir $rundir
8 t& P: W0 w/ J5 {& f5 K- }: }
4 N) w3 I$ w) O/ c2 G. A    case "$EPIC_ARCH" in& Z0 c# }! b/ A6 e* b
    *SUN*64)   
8 p, V7 h, C; k        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
! p- p: I0 u7 j: U        export LD_LIBRARY_PATH0 {" d- `$ i* }. j* I6 `9 P8 c
        suffix=.so1 P4 Q1 U4 z5 `; y+ U9 b) r7 H* D* `
        ld_err_code=1276 t9 s2 E! B2 Q
        ;;+ g- v$ [) a1 ^  s) k' A, }
    *SUN*4)   
1 F. P' [; D5 b; G% E        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
. u  Y2 S* R& T4 Z, z2 H        export LD_LIBRARY_PATH
) B( i1 ?/ G: R, x$ Z        suffix=.so.1.04 v; m0 \9 J$ s1 \6 {* S0 |
        ld_err_code=127
( u' L" ?$ R( v& d' W* _! ~        ;;9 O" q4 B9 c% S' y  J
    *SUN*5)   6 e4 u5 B! T! e- u4 l3 ]
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"  C5 D" j0 V1 `! [
        export LD_LIBRARY_PATH
8 X$ _1 [( ~& I: @        suffix=.so! Q% j. V# o4 A. P" V' u1 K
        ld_err_code=1278 j; r$ U" g: Z3 H2 |7 }
        ;;; i$ l0 \" i& c# t7 u( ?* q
    x86sol*)   
8 G) C6 Q2 u4 ^5 Q% @7 \        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"2 E1 t! j* ], g) ?6 K- X- A, }
        export LD_LIBRARY_PATH
( Y4 L7 ~6 M" x        suffix=.so5 W9 z0 x# Q2 }+ D4 w
        ld_err_code=1278 w3 Z, I6 [+ N% [' ?# ]# r
        ;;
9 i' t8 o/ ^' B: n0 r% ?/ i    *AIX* | aix64)   3 Z( l, t! ?! G
        # When genepiclib creates shared objects, it creates a import file and ) c, i) j- w3 N- ]
        # uses timemill as program. So at exec time,program timemill is needed 1 y: `- l7 @, r, F+ \! ^" u
        # in LIBPATH
# w2 r8 H8 A% I        $ln_default $command $rundir/foomill
  ?7 b; p& o- k1 ]        LIBPATH="$libpathLIBPATH:/lib:/usr/lib". T' s/ c2 r0 u# ~; D1 v
        export LIBPATH. w$ g! t: a5 [, R. k" I+ @- @
        suffix=.o
% v9 t# u* e% A% Y3 B% n  m        ld_err_code=8) b; L8 I7 {4 g' r- Q% d) G
        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
+ Z- ?. f6 t: i) B( P          tdir=`echo "/tmp/d"$$`
, q( n' @  y8 A  @3 A9 ]8 v1 R          [ -d "$tdir" ] || mkdir $tdir
6 O; W  [0 x% i+ m9 T. O          if [ -f $EPIC_DIR/libCustom.o ]; then
3 n: i1 S! [" q5 {) u" d6 V4 Y             cp $EPIC_DIR/libCustom.o $tdir/" v% y* F7 l! y7 s0 L7 @
             $ln_default $tdir/libCustom.o $rundir/. X7 Y2 E0 J. L/ V. _( Q
          fi, P& \4 t- p. M. u2 {
          if [ -f $EPIC_DIR/libModel.o ]; then
0 P0 g* d9 a4 d4 @8 R0 @             cp $EPIC_DIR/libModel.o $tdir/1 t) y/ A! d& @  d& x
             $ln_default $tdir/libModel.o $rundir/
# y/ O  V& Q/ l2 _6 F) b' p: e          fi
) V0 P$ Q, n! [3 O0 b1 L; o! s          if [ -f $EPIC_DIR/libFuncModel.o ]; then
' \1 X) z" M$ o             cp $EPIC_DIR/libFuncModel.o $tdir/
: z7 O& H) b5 G9 I* M1 b4 A9 ^$ P             $ln_default $tdir/libFuncModel.o $rundir/
' p% b" V4 B" \! X3 W- W2 M          fi7 e3 J5 @3 e- P7 ?5 P
          if [ -f $EPIC_DIR/libFuncModel.34.o ]; then1 r# V5 h0 F* B4 K' u# {
             cp $EPIC_DIR/libFuncModel.34.o $tdir/
( `; H0 `4 a% F  A1 x" W+ K. _& k9 _             $ln_default $tdir/libFuncModel.34.o $rundir/4 l# o4 i% N1 k2 h! ~
          fi/ E1 c6 V+ M& {" j% u: s+ t5 Z
        fi
/ t0 {& c2 p, G7 j; [        #Set the IBM flag to enable more shared segids
. V  \7 p1 H# L7 C! L        EXTSHM="ON"
6 G+ R7 A7 ~" K        export EXTSHM
- g4 r" ]7 w7 b! m; Z        ;;
: {4 B/ _) o3 z# k1 }* Y    *LINUX*)   
- J' W, ~& j- \# E5 ]        suffix=.so- E0 L' R4 l+ u1 Q+ D
        ld_err_code=1
- H- ^3 l: q4 Y! K" o0 R        ;;8 P& O+ I8 c) ^. y
    *amd64*)
) N  @$ n/ x: |2 T. B        suffix=.so" F6 y* [1 O# }" u* H  `, `% v
        ld_err_code=17 e# f1 P2 n, K: W# r6 S& e; C
        ;;
5 E; `- P, S4 L5 I0 b" r    *suse64*)0 ]/ ?6 C  }$ D0 S- F
        suffix=.so0 U, E& ^$ u3 ]& [
        ld_err_code=1
; u  G# w3 c( f. G2 I        ;;) C6 U1 e% h$ V3 B
    *suse32*)    + ~) u6 b, [  ]6 ]8 S' e# I
        suffix=.so7 F% A( {# \' _/ Y, {
        ld_err_code=1
$ N: n. q1 ]3 l        ;;6 I/ R: O* v) \: h2 n  K' i
    esac
5 _( H1 F7 g+ I3 f! a
5 R/ k! H- N( l: _6 k& R5 P    [ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix"
1 T0 Z$ M# S. `# p( g' _- D    [ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \( ^, q( p* G. |2 [
        && [ "$cmdname" != "nanosim" ] \
" \5 y& o! @$ Q5 v7 C        && [ "$has_model" = "YES" ]  && ulib="$ulib $cwd/libModel$suffix"
( b. m( h* |4 n% C; f+ J6 ?+ m    [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix"
1 z: X1 O: X4 l$ y8 y
: l+ `/ x5 }7 W2 D7 j#Look for command line option for libFuncModel.so# F8 V1 q  e5 x* F1 A; p# K
#    user_library_next=0" ~; _* L% j; G6 w, l( ^6 s
    has_fmlib=""
& ~5 W5 ]6 _! K7 z) K8 a    for opt in $CMDLINE
/ K4 D( f  [6 f. J  q' N    do0 o$ i: D' h" t' _. [% q" L; e
      case "$opt" in 8 [! W8 k3 L1 E0 k
        -fm)% y6 `( l) D- g# j; f" c. e$ ~
            CMDLINE="$CMDLINE $cwd/libModel$suffix"
  e' Q2 E4 N# K5 k0 k0 b            ;;  t& k  L9 j: L- D: r
        -fm_user_lib)
" C  B5 u8 X7 K) D            has_fmlib="YES"# {! i2 N  ?: q+ K$ ~, Y2 L6 b5 j# u
#            user_library_next=1  T- Q0 o  G8 h, D5 J" J
            ;;
. ^6 p, F& R0 A- t% i* C8 j0 Z. z0 v, e        -xc)
1 {3 t$ g/ H: Y4 D0 T) D2 f            if [ "$EXTRA_CAPACITY" = "NO" ]; then
; j3 o; ^/ P; j# w0 g6 {% e            EXTRA_CAPACITY=YES
$ h" R2 f, Y1 U- O: d            fi& T3 r  J( f9 d2 d
            ;;) U. P: g- b# P4 @; a& I
#        *)
$ m" p& R3 V& O) Y#            if [ $user_library_next -eq 1 ]; then
0 |- d+ j1 D. E7 d6 i8 Q6 w#                if [ -f "$opt" ]; then& [2 Z2 T/ N, U9 E" F3 w0 C
#                    libfmodel=$opt
- i- Q- L, M) Y2 |* D; O#                else
7 j( j- g, w/ V. h' G9 s#                    echo "-fm_user_lib: Specified file not found") K% l! l. G* ?
#                    echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages
: L7 @$ A6 a" u$ W, ~/ t#                fi; H+ L- n+ ]- a: F/ _; I1 C
#                user_library_next=0
4 |3 J, G: y7 A/ t#            fi4 q, R6 x/ c6 ^+ E; L" l# b
#            ;;; |( e. S$ y: t
        esac
1 r0 Y/ O0 [+ n$ i    done
  o$ ~; h! ], |! r
: R3 Y$ x# L: T/ {    if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then! D+ T. B! e5 H# }
        flib=""
; N; i: H! I# U) T7 C        if [ "$has_fmlib" = "" ]; then6 l, e( P. [) N3 f
            flib="$flib `get_epicrc ./.epicrc user_libraries`"
) ]5 L& v' U& P, X9 c            flib="$flib `get_epicrc $HOME/.epicrc user_libraries`"" j" z* m1 T) X, U( ?
            flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`"
+ H, S) V1 [8 c        fi( l5 C9 w  `6 B
    fi* \; T, K. P4 j! G* T8 x1 P7 Y: F9 k

8 I; A+ u, }8 n' B$ ~   for i in $ulib! E- L% n( O! r" ~
   do4 l; G, z  t+ X( E- n2 ]
       [ ! -f "$i" ] && continue! d: o: O# E8 |0 k" a4 I
       dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd* [. H% k4 i! [7 g
       i="$dir/`basename $i`"+ `/ g1 J2 {# h% a6 m
       case "$i" in
3 ]$ c7 S6 b5 O( _. c       *libCustom$suffix*)    [ "$libcustom" = "" ] && libcustom=$i;;
2 T* n$ e8 ^/ W       *libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;;
* T% m9 A1 i# `0 A& f; {- N       *libModel$suffix*)     [ "$libmodel"  = "" ] && libmodel=$i;;
0 J! P" y/ ?0 P; B- x       *libva$suffix)         [ "$libva"     = "" ] && libva=$i;;  Z* @7 U6 Q3 k3 _1 k4 D
       esac: ^) u" U0 d2 D3 z9 A0 t) y5 j- N
       [ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \
: X/ P2 }4 h( Y! N0 @" B8 J! t7 M        && break2 L4 _3 ^' p4 S3 ^2 c
   done" m: A" z/ W/ @' q1 _8 O0 W
4 E3 W6 R' Z! }2 w) y( Q& h- S- E+ H
   # symbolic link shared libraries to .epicrun$$
5 Q( V# H( V4 k" j& v    cd $EPIC_DIR; epicdir=`pwd`; cd $cwd
6 H) ~" t, \0 A6 Q  z5 C6 ]    if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then
, f) Q& ^3 N# S: @9 _" |        if [ "$libfmodel" != "" ]; then
; t! W) o# R5 p% I! a% U. O             [ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \
; S& m& E/ m+ y: [7 f2 z: Q             echo "Using $libfmodel ..."  && \2 R3 {9 @3 _1 a8 J0 c% X" H
             echo "Using $libfmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE
! n! o  _' ]0 r  ^% L, d             if [ -f $rundir/libFuncModel$suffix ]; then
" B7 L" I5 ~; w  ^/ S1 j: O: K6 q2 `               rm $rundir/libFuncModel$suffix0 a6 J: C, o$ |, e9 q' c2 {
             fi
, d* ?6 O- }7 K+ v: r0 o& h$ r             $ln_default $libfmodel $rundir 9 [) r% Q* T9 J; p; X1 C
        fi
; D5 o9 `5 }& f& r) N7 a3 G" G        if [ "$libmodel" != "" ]; then
2 J! h3 R8 [. ~' V             [ "$libmodel" != "$epicdir/libModel$suffix" ] && \* E3 |' b$ ?! b3 t5 [
             echo "Using $libmodel ..." && \$ s# F* ?2 G  `
             echo "Using $libmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE6 U2 J. q% I1 r) b) @0 \- @
             if [ -f $rundir/libModel$suffix ]; then
1 h8 G) Q+ H! n7 ~, b               rm $rundir/libModel$suffix9 F' v2 u- g; H3 \
             fi
2 y) g6 y7 T1 [8 g2 _; A1 F, q             $ln_default $libmodel $rundir 8 P6 _7 u3 W; j& h: z
        fi, p# C$ l- Y/ B! {
   fi7 h6 w  f) g8 N& l
   if [ "$libcustom" != "" ]; then
9 K/ d! t! K) M+ N7 R1 u        [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \: Y  f/ i6 _9 Q% e$ n
        echo "Using $libcustom ..."& H5 ?9 K( B2 Q  K
        if [ -f $rundir/libCustom$suffix ]; then! V, f+ `6 s; O- u! c- ~: o; y
          rm $rundir/libCustom$suffix
2 V1 R$ I) g7 g9 u        fi& D! n$ i" ?8 X" g2 P; p
        $ln_default $libcustom $rundir
( Y& [' I( x3 |* W  K   fi
* [5 O; W- T' I1 M& C& p0 q. ]; R/ M+ r8 h, d  N* r' Q3 y6 P7 b
   if [ "$flib" != "" -a "$flib" != "   " ]; then" |/ B$ e6 \. w4 P  {. F
        CMDLINE="$CMDLINE -fm_user_lib $flib"
# S, r) l) [# r. ]: z   fi
4 C9 S  l+ T  X7 W8 i
; V7 y: [2 d& y. G* ^   if [ "$libva" != "" ]; then
1 `( A0 A; n" ?7 @& P        if [ -f $rundir/libva$suffix ]; then
8 |8 X3 G4 R# l2 ~  [& C& \          rm $rundir/libva$suffix! Y5 x% Z, i. c) K( `+ ?; r3 h
        fi
) P0 o3 [% c$ B7 U8 `7 X        $ln_default $libva $rundir
4 K: R! V( \) T   fi# |  J. [; K# x& Z' D2 w

, i$ h2 F5 i0 `- s/ A
3 u. v( U$ A& d7 g2 I2 D    # VCORE design library. k3 P- O& j4 b' @  }
    if [ "$vlog_design" != "" ]; then5 m7 Y" \' y* p/ p* [# N6 v
        $ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`0 R; R! i/ z$ v/ w( R# m6 P
    fi2 A1 Z9 z& P( p7 n4 |& r& Y
) S1 O6 _8 t+ }' ?
    if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then
, x( }; [2 W8 y- i5 J  B0 W& }        EXTRA_CAPACITY=YES$ M" l; J# @( X; m& z$ q7 b7 h
    fi: m& k* u! p0 T: f9 }
, [, b4 ]) D' X0 m+ e8 ]3 f3 D3 ~
    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc"$ q, M9 j- Z# x4 l
    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc": k" U! S- v/ G( U* C5 \- c' Z
    #Create temp file if dual process is on
" y5 k0 A9 `4 f- ?    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then
  R7 O, O( r3 `, [( Q8 C        if [ "$EXTRA_CAPACITY" = "YES" ]; then2 x! t. D9 @. |4 Z$ M: M$ u7 C
            touch $rundir/rpcidfile! \' D3 |4 `' Y1 ~' S1 D1 S
        fi- M: ~, E% D) g* {& J$ \+ \  e! R
    fi5 h, Y7 x! G8 H
fi
$ x: K0 e. H) D$ B9 K5 Q! W6 h/ z/ w; p# P+ Z0 M  u4 X/ ]
run_cmd()8 l) h% g2 ~( I+ S6 i+ _
{
# g" ?4 {& U. w3 W  command=$1
4 S+ J) N7 F) v! R$ S# P  shift6 H, S# D# x* [" [( v& Q

; L6 X# M+ y8 T  if [ x"$VA_FILE" != x"" ] ; then8 W* K+ P! k0 v2 }+ N! i
     cmdline=$ARGV
3 g+ X7 w, \1 g5 O; V) ]9 F  else
% K; p, x! r% R$ x7 S     cmdline=$@1 I* l$ j" I; T; P; d- m
  fi
; `3 B1 e: R5 Z( X% n2 `& s: U# p$ M2 P3 y7 }  x1 b
  debug=${DEBUGGER:+"$DEBUGGER $command"};* S( \3 x' I" F; a3 d

2 a3 x) E" d: z& m  # To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a! D, t# a8 y2 n3 s3 [, N; E
  # so save-restore may work./ p' K  \$ m9 ]$ b& m, r
  setarchStr=
. E& [3 {0 z* `( Q  cmd2run=`basename $command`" _* d( z3 u: Z
  if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then
, M# g4 L4 P2 G! E  b    if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then1 U, @: ?! i! D3 A
      setarchStr="setarch i386 -R "0 j; P2 U% o! M  q2 Q6 F
    fi
3 Z( S/ j. z: k1 e8 ]/ w% q& S6 N    if [ "$EPIC_ARCH" = "linux" ]; then' ~1 h& j1 [$ m, ]2 P# b* v/ G- Q
      setarchStr="setarch i386 -R "
5 L  z$ L8 x, t, V: x    fi
5 v& K# ~% j+ Y3 r    if [ "$EPIC_ARCH" = "amd64" ]; then' B: z4 K( V  y, L  R* K
      setarchStr="setarch i686 -R ": K* o/ @6 p- @1 v
    fi
) i8 S( W5 a+ R" z    if [ "$EPIC_ARCH" = "suse32" ]; then
% b* y/ y2 F& }$ O3 I2 M      setarchStr="setarch_suse i386 -R "
2 }) U" F" I' h& Q, ?    fi! {6 x/ G6 i0 r0 A2 d
    if [ "$EPIC_ARCH" = "suse64" ]; then6 V1 i" B) I8 b" w0 a
      setarchStr="setarch_suse i686 -R "% t: L# m% y$ I
    fi  @+ \  ^# |2 f0 Y
  fi) u1 g. _; ~) K% B+ x& w
" T2 O- I* }) @5 _5 @' t8 ?: v
  ret_stat=06 t( t0 l7 y$ ]" w% l3 ?: Q
  if [ -x "$command" ]; then
6 Y& w+ \8 Z$ J      if [ "$debug" ]; then
- L! {$ A5 L! v, a: T        _debug_args_=$cmdline
+ a5 v6 K$ g. R  q4 ]( @        . .epic-debug$ h5 V( |6 x6 C; d
      else
9 |/ L* }0 D9 j        DEBUGGER=; export DEBUGGER
3 Q/ e- A# k% S5 n        $setarchStr $command $cmdline& k+ {7 F; B. r7 n
      fi
* p2 n7 O" s- k! u      ret_stat=$?0 l- V4 ]% I/ @" W: E
  else
! B# h7 L6 n7 k! _- J    echo "Corrupt installation, executable \"$1\" not found!"
" @% I- d6 S! o6 I5 F' {    ret_stat=1% `5 _, y: v& ^# ]0 o+ Q! z* Z
  fi
! n/ n4 D0 g' g' W1 w5 X8 i. m}8 t1 m/ B+ ~  n. l+ F& v  R/ a7 H
+ m$ E5 n0 \6 _3 A2 r# S3 Q
# keep runing cmd if ctrl file exist
3 r% [5 S& X$ r# w: [
; J% F" Z) k' krun_loop()
7 K9 D5 v5 u7 I% |{
% A  G! _& K% V& K8 b  command=$13 K% j! ]( W/ S( o" R3 h' _
  shift& D( h: }: `! v1 J

3 \' U. m; F& Y- P* ^  if [ x"$VA_FILE" != x"" ] ; then. t1 q" t6 j5 S7 w/ @( `& N& e2 o( z
     cmdline=$ARGV" y9 p0 U! a. N1 Y
  else) e' D/ Z0 _9 k" S8 P1 f
     cmdline=$@
# c# l& N2 f% v  fi: }* p+ f$ R9 ^0 V; P

6 _: P- Y' b0 q/ ~  G  while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do3 n4 }. p( U, O! ?5 s/ z2 j  @4 q0 n
    . $LOOP_CTRL_FILE$$
( r. f6 d/ V% u9 W: q: G    run_cmd $command $cmdline -banner 2
% t8 A  W1 G: Q  done;' E8 ^, r! M4 `; u6 E6 s" Z. P! R
/ g  r, k, H& s6 ]
  if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then
& D  f: k- c8 Y% e, @3 e( I+ l# V    rm -f $LOOP_CTRL_FILE$$
" s& }5 {8 S! a" G9 {/ U  fi
* L: {1 I8 S6 Z# U% |5 B8 _}
5 ]( Y( b; x4 O  @! S
- a( G8 T. o; z; n  Z; W& _har_check_ret_stat(), S& {- q6 A5 x  f6 y/ d
{; r6 }9 l' H4 X
  if [ $ret_stat -ne 0 ]; then ( ~6 E2 _7 }6 s# q' m6 ?) ~
    echo "Simulator returned with non-zero exit status. Stopping."
3 Y$ ~. P  H+ h  X7 Y3 Z  N    exit 1
" y) I5 N& x8 V1 p, l# d  fi# [( [. L( p6 O! b3 H
}
' T1 G9 k' R" W6 [' M6 j
) u8 r/ p! q+ r& U9 y. c, L#* o' `( c* @, s# c3 E- E
# set stacksize and datasize limit
/ ~( x) q6 G* Q$ A/ \9 f#/ }, s4 _$ k, V( A6 g0 v
2 b( H( y/ `5 Y3 I3 D( k. F
set_data_limit
+ s4 w8 F- V& J+ p7 l2 U1 d3 P+ [# @set_stack_limit7 Y0 }. G) m( X; V
( v  ^: m2 l* d; F, s
#rm -f $LOOP_CTRL_FILE! _) D8 ]) o; |$ K
0 q- r7 k- {0 M- d9 m6 Y
run_main()0 U  B5 c4 P; ~2 j' _' e1 x
{
2 c) n( W' I) {; ?' gif [ $is_special_har_run -eq 1 ]; then3 p5 Z8 O2 R+ U& ]& a
  if [ "$har_ofile_prefix" = "" ]; then( A2 Y' I1 g3 j" c
    echo "Wrapper bug. Notify Synopsys technical support."+ _3 e( O* _) H. l4 u* @
    exit 17 i& H. S% _3 J$ z7 d
  fi
" `0 _9 `1 Z) N. M4 H6 x  x9 q+ u  if [ "$har_hilo_file" = "" ]; then
2 A0 T' K. Q; S5 S9 {    # no user specified hi lo file - do both runs
9 T2 O8 Y- N4 B7 O) |$ U    run_cmd $command $CMDLINE -har_one -har_setup
: c8 n( G, b* ?  V/ b    if [ $ret_stat -ne 126 ]; then) y+ O/ }9 Q5 ~: g' Z: ]
      har_check_ret_stat5 w4 G+ K# t1 V& P4 t; g. z
      if [ -r $LOOP_CTRL_FILE$$ ]; then; L* D5 c! h, Q
        run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl4 T: n+ M0 s  a: _- p: {
        rm -f ${har_ofile_prefix}.hl& R* U  ?; l. i" w
      else- g  s* |5 d  d" \) _3 E
        run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl
: N+ F! v. K& |      fi
  y& l4 z! M. V: ]5 i1 e    else, Q% ]' g; Q1 Y! @- k
      ret_stat=0, d% q: a: Z) E
    fi% b" P  P: X" m, N1 O; |
  else
1 z9 z& G" {# Q! x0 `9 N    # user gave a hi lo file name
0 B* H: {- v1 K* m# R    if [ -f $har_hilo_file -a -s $har_hilo_file ]; then( e3 P+ o( ]. g6 j) ?: O4 a
      # file exists - use it - only do sim run
* O4 _' G" y( g2 P0 e! X      run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}
: g6 e9 Q' a: {. j      run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}& `2 F, _9 w( R& X
    else
; a$ p0 ]) v8 I" K' ~      # no such file - generate it - do both runs
! w; L6 o2 G. M0 n/ V8 S. ~7 q% r" H      run_cmd $command $CMDLINE -har_one -har_fnf -har_setup
8 x1 Y; \* x; C+ T( B9 V      if [ $ret_stat -ne 126 ]; then9 H* l/ k( R/ L  s8 U4 ?
        har_check_ret_stat9 n9 K8 A8 q& a- H
        if [ ! -f ${har_ofile_prefix}.hl ]; then
$ T; C( f; J* i' G  v9 _          echo "No hi lo file generated after setup phase. "
' e/ B# i3 c% u) O+ Z9 h          echo "Contact Synopsys technical support."/ X. g, [$ i/ u5 p: _- M
          exit 15 N4 \$ O4 K6 e8 A+ W+ P7 K$ A" A
        else( s! r8 }' x2 B  Y5 v) t2 B
          if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then
# J6 ?) u! S! F' _. ^- T  c            mv ${har_ofile_prefix}.hl $har_hilo_file  X+ j4 X6 m& T
          fi
2 S: t  P) H  Z8 p- \! c5 G        fi
! O, e* A! c6 H. Q: n; D        if [ -r $LOOP_CTRL_FILE$$ ]; then2 w8 K; W. d/ [, Y- u
          run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file
8 l) O- ?9 r4 Y' q' W1 [        else+ N3 c- d" M1 }) [9 w
          run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file
* W8 A2 @: \/ A# B- ]0 D        fi
. U+ p0 H+ N7 `( B      else . Z; c) O5 ^( U3 z* T" B$ I) H
        ret_stat=0
7 @6 F' E/ j  K% {/ y      fi, c) T' L2 E1 ]6 ?7 z8 o
    fi
6 q* e' ?& m, V) u8 z/ P  fi
/ |( Y- Z0 y* u7 t3 r$ J3 nelse  * A& c- }# m4 L1 j- O2 H! q
# don't loop if -har_setup
% `( H" l" g0 c% `  if [ $have_har_setup_flag -eq 1 ]; then! J8 R7 w% h/ Y- T' s$ t6 @
    run_cmd $command $CMDLINE/ l  @2 z  o% y; r5 k
    if [ -r $LOOP_CTRL_FILE$$ ]; then
+ n' [& j4 b- S      rm -f $LOOP_CTRL_FILE$$
! |8 N% i" V& k0 `. x) p6 r6 p    fi
/ H$ I4 W/ r* }) e4 w0 f; ~  else
* x" y$ Q5 L+ ?" Y' q$ C    run_cmd $command $CMDLINE, w) X7 M% m8 ~% ~' i
    run_loop $command $CMDLINE7 \+ \% O8 A! I- k( S/ _  g
  fi$ `* A# q# {9 [; p
fi4 b7 r3 U1 v2 l

0 y' l& m  `. I3 T. n$ f0 o3 Wif [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then
6 p: Q& @  N2 @0 o$ j* f% U9 @; T  pwCreateErrDB -w $workDir -e $errFile
4 Q8 h$ p! h4 [$ l- ], ?0 Y  ret_stat=$?
8 x& p% F% _; R+ n7 t+ ^" `fi/ A' {" a& q. X- d
}
: c1 |+ m$ H; J2 i8 r7 q2 \' Y& g
cleanup_alter()  n2 _4 a, F2 p. K
{
  |. \8 G+ B- N# U: n" ?' J   /bin/rm -f $ALTER_COUNT_FILE 1>&2
& h0 ~& a' N2 X   /bin/rm -f $ALTER_HK_FILE 1>&2+ f& ^& S! k1 j3 r" f+ O
}
/ x  x0 n( D1 W8 ]: x) O0 ]' k' H
" F8 G( x  k. a5 k3 M$ ~  c#generate alter temp files based on pid
# a+ d1 H( f$ c) {$ GALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$2 }2 ?5 K+ i0 Y# w( u# k- N7 N
if [ -f $ALTER_COUNT_FILE ]
) h7 s# F* k9 j; E3 Qthen % e3 h4 O8 |  p
  until [ ! -f $ALTER_COUNT_FILE ]3 x. Q7 E3 {+ R- O, F/ l$ ^- M( e1 t
  do
7 \, ?9 @* s& z- m2 i$ s2 p    ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$$ e1 y& N  G# h0 U
  done
! K2 E- O/ F$ q) }* Y: jfi: p, R+ R5 c  o5 j1 k! B7 {
export ALTER_COUNT_FILE
# _; r; D8 ?- g& i- _
& k1 F7 G  R  G; u. u. W% Q0 Q. N8 VALTER_HK_FILE="$ALTER_HK_FILE"$$* D% W( a* ~8 p9 K6 ^$ \: Z
if [ -f $ALTER_HK_FILE ]
6 T5 ]0 M0 |8 Uthen ' O2 C. y& Y5 U. M6 x6 J* m/ N
  until [ ! -f $ALTER_HK_FILE ]
# H1 J* o8 r: s; y  do
: D! [# o3 V- b' a) r$ @    ALTER_HK_FILE="$ALTER_HK_FILE"$$
4 O8 J% O" a; N. ]9 j7 \  done
; r; a* p/ E1 T) d7 kfi
. z, a7 o! ?0 w) u, @4 u! nexport ALTER_HK_FILE) I6 c3 C$ c, h3 J6 s

5 \/ L9 W1 ?9 ?  d5 A#generate monte carlo related temp files based on pid
) Z: y4 O& |. K- m" J% K- ^# `cleanup_monte()
6 |* _  D4 u4 ?! w" Q{0 w/ X6 L; ?& q; }7 h9 A
   /bin/rm -f $MONTE_IMG_FILE 1>&2! s& ^- f# L8 ?# f9 q- r5 `* @5 s
   /bin/rm -f $MONTE_IMG_FILE.gz 1>&2' y, z+ d6 @3 N1 ~; x
   /bin/rm -f $MONTE_COUNT_FILE 1>&2% i; m( c/ d8 R. U
   /bin/rm -f $MONTE_CFG_FILE 1>&2
  i0 X  f! S: C& {; l}
% f# o# z1 h9 }8 e% D" N2 M6 h- V* d  |# [6 r/ Z
MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$% B9 W/ e. \: Q3 ?
if [ -f $MONTE_COUNT_FILE ]
8 l7 ]# C; {6 }9 fthen) [1 s, O! f, ^7 B! |4 L
  until [ ! -f $MONTE_COUNT_FILE ]
0 r8 S4 |' W2 t* R' E  do
2 N& L; I) ?& z5 M5 R& p    MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
9 L6 ~' t0 H+ `9 y7 I& t6 U+ ^  done1 ?: v$ X; j# l+ A, D
fi
( V: I6 k+ l7 i: d) k; Xexport MONTE_COUNT_FILE
5 R+ N& i" K  C3 ]0 c. z' v# C
* v* o3 j/ i- {MONTE_IMG_FILE="$MONTE_IMG_FILE"$$
; c" d0 q# e6 yif [ -f $MONTE_IMG_FILE ]' Y( C$ J" U, z: x& m5 |6 I- n
then
7 f  P+ s' N. T  K9 _' Y  until [ ! -f $MONTE_IMG_FILE ]" f0 Z2 p* U& j& p# {9 A4 c
  do
" @' V- R6 s: t$ D+ p  |, ?    MONTE_IMG_FILE="$MONTE_IMG_FILE"$$
6 X! V; z' N7 H$ z# b" l& Q; U& ~9 K  done; L& Y6 \2 c# C( G0 a4 y5 `/ n  W4 ]
fi5 M3 Y/ s8 T+ N. v/ S
export MONTE_IMG_FILE: R4 z: }* [$ i3 v' S: d

5 N3 C& K5 \" R, J  ?MONTE_CFG_FILE="$MONTE_CFG_FILE"$$
  [% k" F/ k' B4 ?1 Uif [ -f $MONTE_CFG_FILE ]
& p% Q' |, @0 j3 ^3 }  N! rthen
6 ?) G8 O/ {' C0 o  until [ ! -f $MONTE_CFG_FILE ]7 j- k. i+ w# @2 D% F7 C" ]
  do: y# O0 ^. U# D" ?4 o: }
    MONTE_CFG_FILE="$MONTE_CFG_FILE"$$5 N+ l6 y3 D" T9 p3 t- d
  done
, t  U5 A1 R4 |$ R' B! x( Qfi  U# x1 n7 P- n9 j/ [, W! f* ~

& D$ a1 ^2 y& c  Y' s, q* S# main iteration
4 o# E( y' I$ \) @2 Z  Crun_main
& i- s1 g0 _# K) X  c1 d; Z. A1 o2 P& ?
if [ $ret_stat -ne 0 ] ( e: I2 g- F, T, y) s1 z% n
then
) V$ m! {9 z0 ?6 O3 R" H  cleanup_alter
7 I  D+ u6 l0 {- t% M, T" x  cleanup_monte
! l' j& `9 L# f4 ?) u6 l  Exit $ret_stat
/ [& s' r) i8 g1 Z" x; E1 Y' u9 V, zfi
$ n8 Q" M- a" V, Q1 v
2 @  n% L# N9 O! X) N( k, y+ @#Alter related iterations- U; G" L" ~+ p# s1 r! w1 m
, K1 U- E% ]$ Y  O! I* {2 m" m6 @& _
iterations=0
6 P0 g$ d9 N+ j( ~count=0
1 Z9 s3 D- B/ g% bif test -s "$ALTER_COUNT_FILE"
* S2 ~, U) C& r$ cthen
8 W+ U) H( }1 A; K6 z  if [ -r $ALTER_COUNT_FILE ]; then
1 M6 z5 A. R$ ^2 B2 k( P& c) [   exec 7< $ALTER_COUNT_FILE
2 ]* d8 l: O# _- ^6 _1 n   read iterations <&7+ W/ s* y) N  ?* h
fi
$ g4 f$ f  f$ U( U! n/ Bfi1 v6 d, M$ D9 ^3 V% q" H3 ^
  }$ R% t$ n2 Z' K7 e
trap 'echo Program Interrupt; cleanup_alter; exit 1'  2
3 F) X& b2 _: Kwhile [ $count -lt $iterations ]0 T/ W" w3 ^' Q$ p5 Y
do
2 A1 K; ^3 K. j" B$ @ count=`expr $count + 1`0 H. [$ h1 x2 b+ \
ALTER_COUNT=$count
" o( Y0 Y) x* b3 `" V export ALTER_COUNT
( O2 |+ q8 W8 {8 ]- t7 ~
/ G# s6 x+ b* d4 j& h run_main
' p$ X9 _' {5 l* a- b7 }* _& X; K6 K" M4 r% b2 ?
done& M% l) k# e( d% b; `& O
( U) Z3 B6 F" f
#Monte carlo related iterations
, t! e& i' r# h7 i0 g( x4 i0 Y+ K! J+ N3 L7 z
monte_runtime_summary()
: G8 P; S  }3 `. k. L{  a4 E* n: V! X
  keyword_1=real
7 V( ?- _3 P2 e1 m; Z/ Y& Y# B  keyword_2=user4 }$ y! [. d+ ~) S+ i' n& z4 x% O
  keyword_3=sys9 o% b/ ?# f9 v7 S. U# _4 n, V
  ofile_prefix=nanosim$ k/ k2 |5 C  o1 N9 p

0 I, K& C, S7 a! F; e5 K  if [ ! -z "$o_option" ]; then
' U9 P1 H' n# p; u& f, L) i, ?    logfile=${o_option}.log
: @' X* w6 J* a# t7 ]# d- ?/ j0 j, r( H  else8 c4 Q( |- o2 D; f( e% m
    logfile=${ofile_prefix}.log' B( s& ]' M4 r9 I# Y
  fi
" x: a! F8 k+ k& Y4 T$ i7 v' w6 |4 ]
  if [ -f $logfile ]; then
7 x  Z6 m1 \# I! H    echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile      $ \! K" L) Y& a5 q
    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
# e2 w/ P7 W( a5 b# y0 k7 m  fi
; Y5 C7 o) W  N% G( u0 t}
/ F0 F; J& {4 c7 L3 H. O" g4 l, L+ E! u4 }5 C/ O+ o0 V0 Q  \) O" g
next_monte=0
5 o& v$ I5 o% ]4 a$ jcur_monte=0
% p1 Z( |7 i! J7 n5 j: G. }
- v1 P- f4 j8 b8 j  Cif test -s "$MONTE_COUNT_FILE"
/ ^+ e: g. J- y! }% P" j- ]0 _- Nthen: S0 u4 z7 s# H+ c* a
  if [ -r $MONTE_COUNT_FILE ]; then
" X% J% S- D0 D" ~2 `   exec 8< $MONTE_COUNT_FILE
! ^9 T% x# W$ C9 E5 r- ^# y  `   read next_monte <&8+ k/ V4 ]# g' D
  fi
: j) ?- J! y: K! F5 vfi
1 B4 L, K. c: [. f
  ~' c, O2 i# P0 p' C6 ttrap 'echo Program Interrupt; cleanup_monte; exit 1'  2
4 j/ [; j% y  {( Zwhile [ $next_monte -gt 0 -a $next_monte != $cur_monte ]
! o  R# T) C! L% j3 v" qdo
! F/ m- J5 n0 C8 b, a  NS_CURRENT_MONTE_COUNT=$next_monte
, E4 R2 Y( J; j& j; \  export NS_CURRENT_MONTE_COUNT
% p$ A& D3 S7 ?! J$ q; Y" d6 a5 @2 Z2 `  D8 z
  echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE& ~# J& d; j6 x& q4 x3 c, G
  CMDLINE="$CMDLINE -c $MONTE_CFG_FILE"
: y8 V0 ?% Y& _: Q! }) V  run_main
; X3 r) P, R: j5 k& R
$ r5 O6 E' F' d/ x" l0 U  s  cur_monte=$next_monte
  f$ S7 h6 D5 f% W# F  exec 8< $MONTE_COUNT_FILE; G1 @. k6 |' H2 |9 ?
  read next_monte <&8( K6 O6 m' v  s2 f' @
done/ h' i6 U- _+ _( _5 n* S
6 D7 ]: H  V* ]  w& U; R: _
if [ -f $MONTE_COUNT_FILE ]
2 K8 |" Q3 S4 Z  wthen; _; G8 N( c5 X
  monte_runtime_summary
) u. i* g( x" ?4 Efi7 I/ U5 \6 Q4 P! d, Z2 D7 t5 u+ s/ i
# Y# K+ J+ K3 L- b  h
cleanup_alter
% E* b' T& S; h0 z; h  ?cleanup_monte! I' W1 f4 a4 @/ N, l1 B
( \5 T" |. r8 l  f
Exit $ret_stat
作者: jerryyau    時間: 2012-5-24 09:22 AM
nanosim有說支援ubuntu 11.10?為何不用RHEL5,這才是EDA的主流linux os




歡迎光臨 Chip123 科技應用創新平台 (http://free.vireal.world/chip123_website/innoingbbs/) Powered by Discuz! X3.2