Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

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

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

[複製鏈接]
跳轉到指定樓層
1#
發表於 2012-5-6 13:58:13 | 顯示全部樓層 回帖獎勵 |倒序瀏覽 |閱讀模式
10Chipcoin
各位大大好:
) P! m! D3 E% d                      小弟執行nanosim時,卻無法跑出視窗來,有個錯誤可是我不清楚該如何解決?問題如下
* ?& A3 Y' x* m5 R  T8 }0 |                      [: 113: 64: unexpected operator1 w  V2 J" O3 r9 U
/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim: 1: Syntax error: Unterminated quoted string
8 j4 j+ C% P" R6 X& k& A有大大遇過這方面的問題或是指導我方向去解決, 謝謝.   e( b' O3 U8 g" Q
我在猜可能是這個檔案內的文字需要修改 但不知道該如何修改?
) ]1 X, D9 j$ e2 P以下為/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim 的檔案內容:" C( |; V3 i, Z  R$ Z2 V
    #!/bin/sh
( V6 o) T8 [/ G* ]; U' b# H#6 q. w- D/ i( r5 o
# Copyright (C) 2001 Synopsys INC
1 N! ^- a; u% j- r  t6 {# EPIC Dynamic Simulation Wrapper (DSW)
7 N& g8 Z# F7 `! N#
6 X3 R  D& w/ _* \1 Q, ?$ Zeval ${DBG_EPIC_WRAPPER:+"set -x"}
/ g5 p. F5 [: k- L) W( T& l& |3 s& Y. H
if [ "$EPIC_WRAPPER_DVLP" = "" ]; then% u3 m( c3 _$ S) E; [$ X
    TEMP_ARCH="$SES_ARCH"4 p9 @7 ^5 l  O& r  A, W# S! y
else6 ]8 p! X, d$ `, q% H, ?* e. \0 N- {
    TEMP_ARCH="$EPIC_ARCH"* B. X! f' h: t4 Z( A6 g
fi$ K1 g0 @; a/ w8 }* f, y

  u- l8 i4 ~9 g) d7 N4 Fscan_for_hva_args()
7 H& a# Q% e0 |{3 s5 F+ e0 l9 i8 P
  /bin/rm -f hva.init 1>&2
/ w& `3 |3 K+ F% @9 Q. S* ~6 z  while [ $# -gt 0 ]; do
, g" M) x6 D" `" I    case "$1" in
- x! K# G! b8 C2 D* u2 t$ t      -vaf). `4 x" H1 X6 `8 U9 i5 z( n; ^
           have_vaf_flag=1$ U, t: @# d+ k4 J
           have_va_flag=08 q- w. F5 }( C/ H- d: \
           shift;
* O5 J& k5 @% O8 J3 O           continue;6 f' D- y& H, T4 T$ m
        ;;. @5 y& s( s$ V4 h; t( B0 {
      -va)
6 A% M3 t8 U' q$ M5 ?           have_va_flag=1+ Q, c7 P" g. q  ]* c
           have_vaf_flag=08 [- E) {) N' N
           shift;* X) J8 e  L6 ?' t6 x8 `
           continue;
. w4 `( }% b# W# D/ N* }  U1 K        ;;
- [0 n4 J) x) y# j2 h" G      -*)
/ l. l0 o$ B" V& u, T4 [           ARGV="$ARGV $1"
  l7 c, }8 e- p; q0 O! b9 E           have_va_flag=0$ k5 k6 e; |3 h1 n/ g- X) K
           have_vaf_flag=0
- t& i; n) O+ G( v+ P           shift;6 y$ n, [/ ?5 z9 m6 {, i7 g
           continue;1 n2 L0 g9 O% x: ^4 c3 J; l( `1 v
        ;;
. I* n1 l3 B! Q$ h3 s" T  v+ L      *)
) B# D0 ?6 Q9 X. p           if [ x"$have_va_flag" = x"1" ] ; then ; r, I$ ]- X1 L
              VA_FILE="$VA_FILE $1"# f' g* g# D8 \1 `
           elif [ x"$have_vaf_flag" = x"1" ] ; then
; d0 F6 u* N* s5 J% D! i7 |              X="`cat $1 | sed -e '/\;/d;`"
# g1 |! G& a; G              for token in ${X}; do4 H' V8 p+ {0 q4 H" f: x
                 VA_FILE="$VA_FILE $token"
8 U" E6 D/ p! |! R              done " ~1 R3 `1 }$ q5 b
           else3 e) h& z" c" p9 a& f  t6 o. {8 V4 Q
              ARGV="$ARGV $1"
. m7 ~2 y- w, E0 Q7 D5 t           fi
. |$ q$ j5 s# R( D# F% x; B, F           shift;
8 L3 _/ @2 q2 v3 \& k) F4 o        ;;# ?9 Z9 h# N' H
    esac
* m6 g4 J6 p' u5 U) \0 A  done. b* B. m1 \: T
. S1 I7 z, Q0 ~6 E% V4 v
  if [ x"$VA_FILE" != x"" ] ; then 1 p- w; R# J( B) K. {# N& b
##     /bin/echo " xxx ARGV $ARGV"
* y: Q  w! k& t( _$ L5 Y       /bin/echo "choose nanosim $ARGV ;" > hva.init
& i: Q- z, e4 W/ n       echo vcs +ad=hva.init $VA_FILE -o simv
( p# `9 Y; I4 p$ J; }       vcs +ad=hva.init $VA_FILE -o simv
7 G7 o" X3 Z# s) a7 s       exe_status=$?; a4 S3 m2 T8 [! |( k
       if [ $exe_status != 100 ]; then
" ~. @/ L' u6 w; [          /bin/echo ""0 F6 R3 `4 B0 g; |5 Y) [, ~& `& h+ e
          /bin/echo "ERROR: Execution of vcs exited with code $exe_status"" A( m2 Z& g# N% k
          /bin/echo ""
& C  I! O7 C9 p( F          exit $exe_status% O& y& b- \  @: J
       fi
6 L1 u2 }0 c$ R6 M9 R       hva_files="-n simv.daidir/amsVD.ntl simv.daidir/amsWRAP.spi"+ K$ y5 k# a- a' B% u& x& K
       ARGV="$ARGV $hva_files"0 C. u9 m) t4 d- f- M4 I
  fi
' c3 ^9 {* J4 G}* {+ a( ^# K! [
#-------------------------------------------------------------------------: k# [+ T7 I3 W
. Q: j% q+ K  r: j. [
cleanup()% o+ j$ u6 E! D& v- `
{
" d2 U' v0 y$ s6 }* V6 y# `* X    if [ -d "$rundir" ]; then# T, `* o( P# I
        # On AIX, a .nfsXXX file is created if libModel.o is removed
8 f7 E/ Y7 x! K2 v6 Z3 j4 R! ?) }# Z        # so .epicrun is not removed because directory is not empty.
4 D+ j5 I  _: A) u1 S        # Solution is to remove it again if the first rm failed8 m4 V+ ]3 S  u
        # (rm -rf $rundir || rm -rf $rundir) 1> /dev/null 2>&1
3 a) l3 q3 G. K. p        if [ "$EXTRA_CAPACITY" = "YES" ]; then
6 [' _7 Q  d7 X$ c; i9 n4 Y8 \        chmod u+x $rundir/rpcidfile
2 q) Y" h- F3 E! Q        $rundir/rpcidfile
( `4 l: H: |3 L" R+ c# Q* Q        rm $rundir/rpcidfile
2 t. d1 d* l2 L) n! k& B        fi
# _. c  v, Q* W- E        rm -rf $rundir
: r9 E' M2 b* R8 T1 Q$ T0 k
* c, l+ L8 j8 Y5 g" |        #Due to NFS problem, we have to copy files needed to) W5 x& |8 O- S8 O0 t4 W( w; W
        #/tmp/<temporary directory>, then symlink's files7 Q9 [+ {; K+ X8 Y" F
        #to the local temporary 'rundir'. This avoids the problem
9 r/ y9 M1 \; n* i  G        #to remove 'rundir'
9 Y# L! h  p5 s        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then  j( v0 D7 c# d0 J3 V2 c
          if [ -d "$tdir" ]; then
- E* F# z; t; f% T            rm -rf $tdir
' Z+ v2 n6 g6 w! K2 m          fi
- l- ~8 h  c7 y6 P+ o$ J# T0 c        fi
" Z9 E: d+ W# Z, P' G    fi# q2 \7 h/ Y3 @: ^$ E
    if [ ${exitstatus:-0} -eq $ld_err_code ]; then
7 H; Q) x" e, ^: i. p        [ "$has_model" = "YES" ] && rm -f $cwd/libModel$suffix% b( M! L5 k% z- c! y  n, E, W
        [ "$has_custom" = "YES" ] && rm -f $cwd/libCustom$suffix
) A5 {9 M; I) s7 `3 A    fi
: V8 O, j6 r& V9 _" W6 Q    [ -f "$EPIC_SCRIPT_MESSAGES_FILE" ] && rm -f $EPIC_SCRIPT_MESSAGES_FILE 1>&2. v) V! f* R1 x6 r0 }# o  u
    exit ${exitstatus:-0}6 a3 H2 s9 K' j* c# F6 e1 K
}
+ d5 `# {( y) }9 s$ q9 \9 T0 n  r9 i5 r8 c
Exit()" W# L! x& v' ^$ t1 w1 f
{0 b) T% M& M1 m/ a, x
    exitstatus=$1
7 w( Z3 \, ~/ ^4 ~% V% {7 |; @0 F8 S    exit $exitstatus
7 V9 ^! D' L! Y$ q9 I- i2 l}
& f3 U$ }  D' i: q* s1 p  O# I7 `: R! p, I8 @
# get_epicrc filename keyword
4 C9 k3 [0 @2 z! H- j7 |: g+ Aget_epicrc()
# {/ u6 E3 f! v8 c( U- t{
5 t) a& t- ^- |* L' n    [ -f $1 ] || exit 0
" `; b6 N1 b, [. S2 Y    key="/^$cmd2:/{print \$3}"1 D6 M8 i/ g+ x6 s
    awk -F":" "$key" $1  v, B5 p! B: ~$ s( N
}, Z8 H6 L+ x8 Z- A

! A' K. \. ?/ V! v& t5 q2 ~. ~! X#
! u0 L3 [2 n$ B( Q/ z+ }# g# set datasize limit to hardlimit( K! h$ F% J. p/ W; D
#
- o7 H5 C' M1 X# l% v1 p5 Cset_data_limit()
5 w& A7 R  b; w% j0 a6 I{3 [' ?! b) s; c0 t, `' [
    dbglimit=0# Z) ?1 ?: C1 n1 }& Z# k
    hardlimit=`ulimit -Hd`" Q; r7 @! q9 b  u$ j& Y' f& R
    softlimit=`ulimit -d`3 f  r# X4 q$ o: v- ?* S
    desiredlimit=35000000 a0 n$ T; G: H4 i
    hardisunlimited=0& P% y% H3 `. T% e0 X
    softisunlimited=0$ E* A: K+ `) H$ y( ~$ {
    is64=0
5 }3 B5 C( K9 E$ X, D, c0 p9 ?' ]
; E4 {8 o* s+ u  Q5 e& K7 E# c    case "$EPIC_ARCH" in
' p! W4 V/ k7 i: A/ W    *SUN*64), k2 Y/ K+ \5 u% ~7 I" O
        is64=1
- P7 f( r( t) ]; u        ;;# \/ |% m* e* _* n" K
    amd64)
4 q9 j% N) @# c. o! K$ P: V, ?        is64=1
( H3 a& o( _4 i% o6 x        ;;
( \0 i" R, l6 ?! j+ h/ b    x86sol64)4 w1 W8 N9 Q# s: \1 {( n# B1 c
        is64=1
( T3 K: }- ]) \        ;;
& t( o1 D3 n& B# f3 }( _8 B    aix64)+ q; \9 G" i6 u
        is64=1/ l- Z" h- ~! n9 h  h. ~
        ;;) D3 f9 Z) ~$ M) V: g! v/ E5 |
    suse64)
4 ]( J* Q" V+ d7 U5 B3 Q        is64=1+ ^. J, P0 S$ E; z" K& @
        ;;, b% j& L! V! @: |  e
    esac( C( c! C, n9 O

' d+ A) Z' g& H: c$ T" w. w% ^    if [ $dbglimit -eq 1 ]; then
, i  M8 a, w' a* ]) S+ c        echo hard $hardlimit soft $softlimit
) E1 A" W: X% M6 J& t; M" i    fi
8 E0 v! b. G2 z" R1 h2 h! @% j* P/ o% A. H* [  t1 U  S8 y
    if [ x$softlimit = "xunlimited" ]; then8 s8 E$ \! z2 |. {- _4 b
        softisunlimited=1
4 ~( d! ?1 |* _0 J9 `1 E    fi
/ l" e1 O$ y# P% Z" e, ]; b7 L1 \$ M& `" f+ |+ p5 n
    if [ x$hardlimit = "xunlimited" ]; then
/ Z' F5 k) v' G: @% V! c        hardisunlimited=16 z3 D& |) p! ?/ f
    fi
; \+ v2 G7 P" y* m# J& y, {7 i8 k" p* W! |; A" t+ z7 S
    # 64 bit machine should have bigger than 4G
& k+ [9 G  {" F+ m  W' U  q8 |    if [ $is64 -eq 1 ]; then
* |: z+ b. [/ N6 a* R; y4 q) S5 b( R        desiredlimit=5000000
6 s& g+ P4 r) H; y5 V    fi# p. C% u1 l- `. N) c
! B! Y$ y4 N( d! ]2 O* Y
    if [ $hardisunlimited -eq 0 ]; then# |; [1 H) ]( j: @2 N. m
        if [ $hardlimit -lt $desiredlimit ]; then
3 ]* J# U7 h/ y) d. [            echo "WARNING: datasize hard limit $hardlimit K is too small."
* \! D% j3 l( Q1 K. Z' N+ y2 o9 H* V3 P        fi
3 i' B" [3 O, {7 N9 G( D; C3 D    fi
4 H8 p# |- `3 m& D8 }  T; P" m5 G$ g% b* m
    if [ $hardlimit != $softlimit ]; then- P* f7 S6 X# }: k
        ulimit -Sd $hardlimit
- X3 J% T2 a$ B: ^#        echo "WARNING: datasize limit is set to `ulimit -Sd`"' Q% S! o' e" G7 M
    fi
8 K4 T( m+ z# K
, Q1 r; ^/ {7 C3 c3 m$ V7 ?    if [ $dbglimit -eq 1 ]; then! S6 a* b* k2 |, M3 E( D
        echo datasize hard limit: `ulimit -Hd`, U; j  B2 u8 L, x  x
        echo datasize soft limit: `ulimit -d`
% f% b( u. Q2 D9 v8 o2 S6 S    fi
! B( j8 e4 v( _5 s}
6 H; W" c7 b! @4 S* t9 U
# R* D3 u" v  L9 E4 j#$ `* w- s/ B, b- k; p
# set stacksize limit to desired limit$ D7 R' q# j. M4 @4 O) P: w) t8 t
#
1 T; v; v3 M/ N6 L- @; _8 g) O2 G4 W- h: Oset_stack_limit(); U" l# T$ P5 g% s5 C
{! m/ ]. s8 N' J2 e  J4 W
    dbglimit=0* S, |- l+ X  O: E1 j3 d
    hardlimit=`ulimit -Hs`
% t+ o9 \3 |, X) e( a    softlimit=`ulimit -s`4 @3 B8 R1 W  u8 c! ?
    desiredlimit=60000! o4 `. F' U7 n2 W7 V4 c
    hardisunlimited=0/ ~* ?: L0 z4 h0 d
    softisunlimited=09 s; K4 d, B7 K% T* ^/ {* e
    is64=0
* K! u6 D$ u" j
) d' p1 P) J8 K2 n8 v: P    case "$EPIC_ARCH" in" y, o7 A: l0 A3 w3 w- M) X4 E
    *SUN*64)
3 I0 O! \8 i1 f/ d        is64=1- O5 S$ k8 Z5 ]2 q
        ;;4 n% m) [0 b8 i
    amd64)  t- l& C4 {- C1 W1 n  H" }3 o
        is64=1% p+ V. g! U# [
        ;;) g4 U( I5 L% s/ b6 m
    x86sol64)8 d3 I2 A( h1 x5 n. @. a  b
        is64=1! x8 ^1 h- B# W4 E: m, O! A. O
        ;;
% I4 O7 g9 E, L' a7 ]    aix64)
  @; p2 g, F% ?' }" Q        is64=1/ z# G6 C9 x3 T: n# c, W& o" X
        ;;
, r' X4 c! j& |9 q: g, X5 d    suse64)" M. ~" Z2 ^6 ~4 \4 l
        is64=19 }' q; ~- S* A' E6 y9 g4 {6 {2 C( K
        ;;1 d! E! U( x5 Z6 ]: k  r% L
    esac
- \4 h# {9 \+ f, F, U" m% S
/ G$ `0 S( b" D. p2 @3 iif [ "$EPIC_WRAPPER_DVLP" = "" ]; then
8 A: c* F9 v2 C" S; U    if [ $is64 -eq 1 ]; then9 @0 z' y$ e. P
        desiredlimit=200000! ?' n% u" @+ n& X0 n; d
    fi. h) c5 i/ \# l4 G
else& B* W# U& \9 Q4 @9 p/ n+ G
    case "$EPIC_ARCH" in
9 E: T9 {) V3 B    *SUN*64)
2 p- Z0 u+ [0 o6 E+ l9 u. s) K        desiredlimit=2000004 e5 f' `' u8 i0 R7 V7 A2 d9 V
        ;;/ ^5 \% W5 F  ^! Z/ h. ^; u
    esac
* n' g7 m! r* Zfi3 c: Q0 a8 X  X
       
: y8 r% ^# @7 j& j! J    if [ $dbglimit -eq 1 ]; then
/ }, A4 v' ]+ a' T8 \7 h& A        echo hard $hardlimit soft $softlimit$ w/ f, }* m8 ]1 Z' B% Y
    fi
5 z0 v# }0 S, J5 t
! _- u0 B' M  R    #stacksize can not be unlimited, pick smaller number0 e: u- e* ?- N; c' a
# v- D% O( M# ~7 b" j
    stacklimit=$desiredlimit
/ i2 y7 p' v/ V' {
) C0 F4 G' ^. G. T2 L% E    if [ x$hardlimit = "xunlimited" ]; then. V- t1 G1 i' a! K
        hardisunlimited=1# w" c0 t& [4 G) y" e, \
    fi
# D9 A$ _; S$ V$ K9 Q
( I6 [' _8 V6 P/ T3 ^( a9 i    if [ x$softlimit = "xunlimited" ]; then+ K; Z2 v0 G0 R5 f
        softisunlimited=1
5 a3 f6 q4 W0 p2 o8 u# g- ]/ s    fi
7 w: b& k4 `5 W$ `& x! i% g5 o0 F% o' L
3 p* a6 a$ V3 p$ k% B, W1 d  M    if [ $hardisunlimited -eq 0 ]; then
0 X/ H) A% ^9 h. d        if [ $hardlimit -lt $desiredlimit ]; then
% T$ M/ M9 q% {            echo "WARNING: stacksize hard limit $hardlimit K is too small."2 M9 f4 h2 B& E+ g
            desiredlimit=$hardlimit
( V: q6 \4 i! x9 p            stacklimit=$desiredlimit
0 x1 {0 x; w" s# x! D0 B! ^- \        fi% _! {6 f- y7 Q$ s3 F3 d4 L& t0 P
    fi( H8 K. a) S8 e

  P" M3 Y# K4 U4 |* }    # desiredlimit is set to proper value (< hardlimit)
( J+ X# D5 }/ k" y' E3 d
! t* }0 Z; d$ M  b  k    if [ $softisunlimited -eq 0 ]; then- F: I# N) X5 L; z3 C
        if [ $softlimit -gt $desiredlimit ]; then
! U9 ]$ o- z5 m& H% B( G) |; _            stacklimit=$softlimit  R( s8 R/ T0 n5 k# X' }( y% O1 F
        fi: [; X, [# j7 S( X
    fi% K4 Y! ?) |. ?5 H) K7 A
; A; o7 R8 E" M7 f- X
    if [ $softlimit != $stacklimit ]; then
0 `% G5 g4 n; N3 L: T& u        ulimit -Ss $stacklimit
% a3 [' h0 s. V6 B- k$ b4 Y#        echo "WARNING: stacksize limit is set to `ulimit -Ss`"/ [3 h* G7 C, `: l3 @, H9 j4 {
    fi
5 e! U) A! b" G8 M
4 a7 G9 ~# ^9 j9 s" c    if [ $dbglimit -eq 1 ]; then
5 r3 v$ d- O! w" u$ n& D. f        echo stacksize hard limit: `ulimit -Hs`
! X, |! O2 {2 h, e* h0 d: f0 A        echo stackize soft limit: `ulimit -s`
% W2 b" M1 y0 t" t4 `    fi
7 e/ s7 z* A6 e8 r& d}; z1 D7 N2 R9 v/ [; m* K

% V2 _1 t4 X5 j' V' S0 D$ g/ @7 \open_epicscriptmessages()# [8 O' W. c8 c
{! ~7 Q3 @: j/ Z3 i1 s7 Q+ c
#generate  temp ".epicscriptmessages" file based on pid
2 N+ u+ I. J4 dEPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
. b, ~' M' J" `5 i2 ~+ {if [ -f $EPIC_SCRIPT_MESSAGES_FILE ]
9 I; d  V3 h& q  G; othen
* N! l  q) ~5 }0 J2 v5 x  ]' ]" p  until [ ! -f $EPIC_SCRIPT_MESSAGES_FILE ]
- `, ?( S0 j6 z8 k  do8 @% q' ~  C6 ^9 S0 O% U3 p
    EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
! v: u0 Z  o( M! f, t) p  done
3 {5 \, Y# y' {5 r* ifi
% e! \5 |: S7 T/ W9 r" p; n
" e6 H5 q) |& d/ R2 |* i8 X6 Nexport EPIC_SCRIPT_MESSAGES_FILE
, u8 u8 R- F% L1 M- A}
+ ]4 m  x. T/ e" ?3 P7 g1 C, [, i3 Q: B! Y* r# a+ m' @

/ `, @' z$ l7 k" [5 n* F# Wcmdname=`basename $0`) A" R- z0 \; \' H2 p. D# G
postgres="n"0 j( T8 z& `5 t# P; u
ostore="n"3 t, C2 m6 ^$ X: _
gui="n"
9 \. ^# h0 j- K$ ddatabaseOn="n", p) u/ B! \* O$ S$ m
f_next=0; V6 z, n4 z$ G
f_option=""( H- l( v+ ~  I' q( q: G! ]
o_next=02 M! K+ K- b* M6 _9 {
o_option=""
/ r$ l- G/ F" ^" V& t! c5 Q5 c6 LworkDir=""6 x& V, k+ P2 ^  ~
workDir_next=0
' F1 L1 C. F7 [# G% H+ w: M2 ZerrFile="powrmill.err"- C% K; K% m* j. g% {' }
win32flags=""
1 [4 J# K/ o" k- _: {ln_default="ln -s"
8 W1 C* O, q! y" Z$ b- n) l) u# e6 x+ M
; v0 c5 [$ T4 f: R5 @) f6 b4 Ghar_hilo_file=""
! \2 m. X& x( X' W- F2 ]% y% H1 L7 Khave_har_flag=0
/ e9 C) z8 F0 j' C" vhave_har_setup_flag=0# H3 g; d+ R2 n
is_special_har_run=0
- r2 X0 [2 @: f5 P2 ~, Uhar_ofile_prefix=""
" U( D2 ^0 r' y/ ]) S: P# b* Z& \$ N
have_va_flag=0% d; R/ k$ K4 q
have_vaf_flag=0
. x9 ?* y. A4 C, m, D# ]VAF_FILE=""
( B  _4 @/ x) _3 }& T4 vVA_FILE=""
2 K- l' x/ {# m/ NARGV=""
( s6 G& a. u* @0 w* H) y, g
# `; s2 u9 N/ d- F2 `7 l0 q3 UORIGINAL_COMMAND_LINE=5 ^' e& T1 M1 I4 I6 ?- e# `* k
LOOP_CTRL_FILE=".ns_ba_env"
; W: j3 \3 _4 S5 S3 G# S5 b1 `ALTER_HK_FILE=".alter_hkf"
4 `- y' Z1 ~8 VALTER_COUNT_FILE=".alter_count"
1 |$ q- I9 T$ G' ]$ _2 [MONTE_IMG_FILE=".monte_img_f"
8 v6 ?0 S2 ^$ n  \3 A: [MONTE_COUNT_FILE=".monte_count"
0 E2 }+ N2 a7 e0 c* G7 F' VMONTE_CFG_FILE=".monte_cfg"
% j( L: E, B  X( JEPIC_SCRIPT_MESSAGES_FILE=".epicscriptmessages"
3 O1 H7 `. v' [2 M2 _5 p9 e8 T5 {7 {) V2 I" y: V
open_epicscriptmessages $@
( F5 I* ?) h8 h" y; B* Q- u  G9 m" _* L  M6 j& G& I
scan_for_hva_args $@
5 S6 x3 b* Y' a3 V1 h1 p# Z, v- S$ D2 n9 [- Z3 K- z4 x+ d
scan_for_har_args()9 t0 N1 J: d$ e% X, m6 u5 `
{0 g7 V) z8 O4 J5 R$ g1 I+ g
  while [ $# -gt 0 ]; do
- ]( \9 g- s1 P    case "$1" in4 E& r% x4 S& ?7 v- v+ g# q( o
      -har)
; g! G. S% ?4 \           have_har_flag=1& Z$ O+ }; j7 {0 d: j
           [ $# -gt 0 ] && shift. L0 Y# V# u5 a# l5 \- F
           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then0 B) ]. i8 E7 x: w# W- Y/ \
             har_hilo_file=$1
* B$ H" j2 ]6 D) I3 a             shift
# ^+ C, c7 j1 k& t' j$ j# h           fi$ |* t3 Y" C4 i6 }. B( G
           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then
7 f  H+ l  ~3 i* v; x             echo "Too many arguments to -har flag. Only one hilo file allowed."$ X' @, i: t& v
             exit 1$ G# V$ s! z- g0 ^. r8 s
           fi) E: S. Q1 z) ]' }
           break
% p1 M8 q( P. g: ~        ;;
* e  c8 G" D$ X8 \- m& }& R      -har_setup)( W+ l  k/ |/ `" w2 {6 ?. z
           have_har_setup_flag=17 E  O& f1 W: \' `9 m
           break% W4 t/ i3 u8 s: H! n) c- ?3 O9 w
        ;;, {' Q, D' L% d( U  l# r3 v, ]6 q
      *)% }+ C$ \1 g( X* r
        shift- G, n1 y" Q8 l" v- J
        ;;
3 ]  L" M; l; G    esac# s9 ?2 a0 m  _/ K0 _; S3 ^4 p4 T
  done$ q1 ~: ]0 ~! h/ L: t( ~( e% x( Y& W; \
}  ]0 M8 F" E! A

' X; Y% o5 Z, e. B1 sscan_for_har_args $@
7 A" i! X, X- b) ]5 w7 q: A/ l8 ?- J) {* J
for argv in $@$ z; K$ k( P. I" a5 }( ^0 j( ^$ {7 S6 i$ k
do) K' l0 r+ X9 z9 K: U4 g% @. i
   ORIGINAL_COMMAND_LINE="$ORIGINAL_COMMAND_LINE $argv"
. J2 j# N, W- U% ^2 |3 P% \    if [ $argv = "-gadb" ]; then+ J0 u+ Y3 x* h
        databaseOn="y"/ C1 U# h% B+ k2 r3 x4 F5 ~: \+ a
        workDir_next=1* X& |& g' |5 }9 E. L
    elif [ $workDir_next -eq 1 ]; then  j' M- f" f, F. O' \; K/ R6 `- @
        workDir=$argv+ |, ?  U# V* I) r
        workDir_next=04 {0 e3 S( z, t  g1 H
    elif [ $argv = "-ga" ]; then
8 t6 k5 p; ?7 o: h        gui="y", \3 Y& D: U' g& l
    elif [ $argv = "-f" ]; then2 p9 [" A$ w3 z% J4 N/ ], T
        f_next=10 p( d- d  P# q6 P! U
    elif [ $f_next -eq 1 ]; then
3 Z& M& {2 X" e& V& Z        f_option=$argv
, E4 N+ A# V" p: y4 C        f_next=0- O; X2 j/ m) k  |# B
    elif [ $argv = "-o" ]; then( _$ P, h9 a, ~. s& A6 L# T  |
        o_next=1
$ ]" P" Q5 L: l    elif [ $o_next -eq 1 ]; then7 Z: k" p  k+ i6 ?2 }
        o_option=$argv
' }: W0 l5 n9 _+ z8 F4 G        o_next=0" A' @$ G2 x0 _; s8 R
    fi4 V7 m: n& p( H7 `
done
8 c1 g8 X- B& Z; a& p6 _1 s7 f6 eecho "Command line options: $ORIGINAL_COMMAND_LINE" >  $EPIC_SCRIPT_MESSAGES_FILE & ]3 l; X: p; k$ g' F2 s
3 C* t# v( Z1 r3 x& Y
if [ $databaseOn = "y" -o $gui = "y" ]; then0 a' |- N' M$ N1 C
  if [ $cmdname = "pathmill" ]; then
! K9 L! R% s" Y8 N6 N, _. \, G    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5"  -o "$EPIC_ARCH" = "SUN4_SUNOS_5_64" ]; then
+ e0 n4 V( q/ i1 c1 d1 w6 X( h6 b         ostore="y"# ~2 _' k" H7 ]
         postgres="n"/ `2 T+ K5 ]. l7 F" l, {4 H
     else
, u: _5 x" B' }5 I5 c        echo "athmill GUI is supported on Solaris platforms only" 1>&2   L. l. \$ J3 H! X5 U- n
        exit( i( C% D8 z9 e  N
     fi+ m- S/ j/ g4 R# M: c3 L; K" m
  else
( h2 O# w/ V" w$ T3 A    postgres="y"
" H% L# F  M& @1 L: d  s         ostore="n"
3 [# z+ m3 P) [  fi
9 j) @  r! z9 k) j, [fi
/ ]2 Y. U, M/ Q! v( M3 l+ n/ G/ ~
$ U( A% ~- H2 H8 Jif [ $gui = "y" ]; then
9 ]* G! d: o5 p2 [    if [ $cmdname = "powrmill" ]; then; _4 R2 Y! S; w) X) G4 ]
        pwga $@
8 {9 _0 t. U6 Z# V7 ^( U1 x        exit
3 o/ Z& d# _4 L/ V, \* K    fi
# c* @5 F. u! P; F: c; e' W) c 0 b- G, i$ r5 P# ]3 s, u) ~
    if [ $cmdname = "pathmill" ]; then
- W; p* K" d& j! J2 `( s) [        if [ $ostore = "y" ]; then1 N. B& b- O5 A
           ./pathfinder $@
) D4 j; W, b" O1 Z           exit
- j" N$ h. A3 n: e) u5 L* Q9 B        elif [ $postgres = "y" ]; then/ x6 Q. M2 @% }" p
           pmga $@
& H* ]3 E0 O4 i0 o' @           exit
. _/ [) d9 d' |5 W# b; Y  c6 ~, D        fi2 ~$ U  s) p+ E! j6 W5 o9 T
    fi
- c) r( i$ G( L( r' v7 ?7 _fi* A% T+ y: P$ ^) F

5 ]' S, b8 u" R& Q1 Cif [ $databaseOn = "y" ]; then
  p! F; e8 t0 Z) d; @( Q3 L, \   if [ $ostore = "y" ]; then
4 n# C! z/ l. g3 v      if [ -z "$workDir" ]; then
: r1 ?" M2 V; N" o% a         echo "Error: Missing argument for -gadb option"
5 E1 K8 X4 P; f         Exit 14 d; A9 h" b' e$ F6 \+ k$ ~! o/ E
      fi! L. L" e! ?. Y" J
   fi! t- E& a1 C2 [$ V
   if [ $postgres = "y" ]; then
1 u- \, a- f3 ]      if [ -z "$workDir" ]; then4 r1 ?4 F! [9 V7 N8 x) l( h' h
         echo "Error: Missing argument for -gadb option"
4 V. o6 h8 f; ?) E- O) Y         Exit 1/ V% ]+ K, l* o+ `/ Z2 X
      fi: X' o. r0 y2 Q1 D2 i$ z
   fi
& n# w+ `5 R- X" ?7 Lfi  ?4 o6 D# P; U+ G6 i* u
- K3 H  e& e+ B
if [ $postgres = "y" ]; then( h4 N4 b# o( d8 Z' F; y  @  x1 i
2 |- `6 ]/ r! E" e% R3 f
    if [ -r $EPIC_BIN/scripts/gui-init ]; then
  Y+ {! W8 M1 q. F- f' o8 U, b3 b        . $EPIC_BIN/scripts/gui-init! ^6 @" ]+ B; Q- x6 T1 v
    elif [ -r $SES_ROOT/bin/scripts/gui-init ]; then
: A& U5 h- M4 q# f$ k# Z        . $SES_ROOT/bin/scripts/gui-init+ j$ w( Y+ z, ^- X9 J" w- H. S6 h
    else
0 M$ ^5 u  i+ }6 Z% c, T9 O        echo " ** Installation in \"$EPIC_HOME\" has been corrupted!" 1>&2
% ~. O! |3 t( l" Z" F        echo " file bin/scripts/gui-init is missing." 1>&2
* O/ v8 G, ^& i; I, @  a& f    fi
3 {2 D% C- y) `3 X/ g+ k
/ W0 j# G  S4 T% w8 y4 _( ]    workfile -tool $cmdname $@" M. a& `, Q4 O2 @
fi
( C" q9 w! U  U* L
( c, V. J# {4 \% W! K8 i+ k7 Vif [ ! -z "$o_option" ]; then, N/ L: B4 X" M5 B$ \7 f, x& [2 k
    errFile=${o_option}.err4 J( U8 H+ E9 ?; b0 q& i) E0 b, g
elif [ ! -z "$f_option" ]; then, i& |6 v( v  `% {8 t& _2 ]/ M# P+ x8 m
    if [ -d $f_option ]; then
  k; M9 b8 d1 I+ m' c7 J9 [        errFile=${f_option}/powrmill.err8 t8 K& K/ g8 d4 g4 ?. q2 ?
    else errFile=${f_option}.err
7 G  I: D1 o2 F! K' t    fi  M2 L: {0 o2 u* J4 T1 Z$ J
fi
" S3 y5 B% d  l1 V% E
3 r) h& r: v% J3 I9 S7 i/ F) r) t8 j
if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
) W3 F: ?: V* Q! ]  rundir=.epicrun
2 G  X8 y1 E8 ~/ Y( uelse, \/ r  v- w. c7 g7 E3 h
  rundir=.epicrun$$
5 C( G5 f+ j; W. E+ Y, `fi+ I( [) ]- C% O( l

$ }, N$ ?) q0 m( l0 x  E" ?libpath="$rundir${EPIC_DLIM}$EPIC_DIR"
( N! {- S2 v  H6 w
/ k4 d7 T. [; [% `cwd=`pwd -P`6 a+ g, Y0 |3 R% o
if [ $cmdname = "acehdl_w" ]; then- H( J2 p7 B/ `8 a2 q5 G% g" r
  cmd=`basename $0 .sun`) |7 M4 O$ E  j. X6 I% x, b- J: \' M, A
  cmd=`basename $cmd _w`2 `  }, [3 ]7 ^4 h$ \/ [
else, F1 t% Z5 q/ q. b9 p
  cmd=`basename $0 .sun`% m1 ]+ F/ F! r3 A3 e
fi
0 D% F; @2 O  g) m* q% ~1 A( G
9 a& h7 c$ {& ~! l6 l; F8 ]7 qcommand="$EPIC_EXEC/$cmd$EPIC_EXEX"
! ]" I$ [! g0 n6 M[ ! -x "$command" ] && echo "$cmd: not installed!" 1>&2 && exit 1
* U+ C3 s: B% V/ p# W: T: K) z- A4 C& S% E9 ~) U5 R' z) K
# buildmod extracts -u/-fm options and calls genepiclib
% p1 x, ]( S2 `5 u) S$ |* S# It also set the remaining options to variable CMDLINE9 \; b& \: m: ^) o3 c% p& m6 z( l
# look up in .epicrc for -fm & -FM parameters
2 A0 J$ d4 o! q6 |
' J5 Y0 z/ c2 ~; x5 V$ y- T4 j, B' hfmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`"
1 x, @" P9 {6 h6 X- H[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`"
+ P! I8 P6 Q5 d  X[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`"
( `: ~2 x. D: p' q) e; j. C- U( I % Y) @+ p( x9 x, J- i
FMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`"
* L. |/ ^  Y/ X4 A: i* U1 q[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`". }5 N# b. _: P5 i' }. ^6 P8 @
[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`") S; d3 a' D( ~: X. @
- ]( ~$ L" N  Y9 O4 I
if [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then0 _- j, p4 y- {) j% p
    # note that the buildmod script will set the CMDLINE variable
" F4 c  ?2 Q& t! b! h+ P" W3 s    . $EPIC_BIN/scripts/buildmod  W$ B4 I6 i2 [6 E2 U1 I

, z# i& N* `# B- M' P  I6 j    #echo "This is the value of cmdline=$CMDLINE"6 R) L% A" l: q- x# I- M
    #exit 0
; v. L3 c( O( Y2 o5 ^
: Z7 f9 _6 k3 U- n    # if a new timemill/powrmill/pathmill built, run the new one6 X( A3 K0 D  f; P0 u/ g3 U
    [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX"
# A8 f) u+ @* Vfi, u  }! N, |5 w1 m3 {" N! W1 d

+ F% }0 N( o$ m3 ~if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then  q& A1 \7 B: q6 h, H
  if [ $have_har_flag -eq 1 ]; then% M7 l2 x: M. }+ g5 y2 Y
    is_special_har_run=1
5 ^; i6 a8 @# C! r5 ~" p    if [ "$o_option" = "" ]; then3 n' {6 O+ s' g! l
      case $cmd in& s) K* o" D$ p% Z  @1 \
        timemill)
9 B0 A: k4 ~2 V          har_ofile_prefix=timemill
1 ]1 J, ?! ]! P+ {+ D          ;;
' ]6 |; V/ X6 X# H; Q( N7 g        powrmill)
& d* z6 g) O" z( |0 a7 V; q4 V          har_ofile_prefix=powrmill* ]4 S5 [+ I% m, g
          ;;
, F. q& L7 p' D# X( @        nanosim)- }, m9 R' o4 n1 |
          har_ofile_prefix=nanosim
! I" ?. y, @& l( _0 F          ;;. k6 j# ~: q) n% i5 K- j
      esac# f+ _; v- E; O( T8 }- R4 A3 d
    else
3 x- S4 ~( H" W0 g      har_ofile_prefix=$o_option) ]" B& T5 q/ U7 `7 I! J
    fi
0 V' B' o5 H7 K+ S0 G8 E0 c fi
' ]; ?4 F7 Y- V7 qfi
: @, `% C) I7 v- t3 x1 B- s; }' y' h/ {% c- h0 Y+ q7 n/ _5 P
# Call Double precision version of the product if -D* O" s$ l7 D, b
# or simulation time > 1,000,000 ns.) @. m1 A; u+ Q' Q3 N2 i
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then
3 j- `, ~' A! ]) e' l4 F' x) }
9 |2 N4 Y! ^" ?% s- `4 _" O  # Now the binary always has the ACE feature  O7 m$ e& n) d& }8 R
  USE_ACE=YES& |* }2 B( ^" y& C& B2 k
) A; V0 M* L- L% b
  HAVE_DP=NO4 x' u, [1 A6 v
  EXTRA_CAPACITY=NO  ^' y, b& M  K" ~* H) u
  DB_REAL=${FORCE_DB_REAL:-"0"}
1 y( P. t; X. T- f2 b" a- F' U4 v* Z
  # Enhance for ACE ease of use
* U+ W: W6 a' z, g  # If no command line option or only a -T option, do:# R) u3 U7 k" `& Y8 c
  #   1. set -A option
; ?0 J" v( L) _0 R! o- W  #   2. assume input file to be hspice
* ^' t" x. X' D6 I, [  #   3. set -o to input file prefix* A- {0 R8 ~" C0 W" M
  #   4. set -z to input file prefix
" M3 N' N# T8 y# G  #   5. set -c to default config file6 R, j# j; F3 P% x# D
  netlist=""
+ s- K! J- B' Q; u2 S( ]  minusT=NO1 q1 l7 h7 {) L5 k' g
  useStdCmdOpt=0* k4 P& ~/ O: h
  prefix=""
' |/ Z, z" Y& I3 C0 \; b  circuitType=""; X! l4 t4 I* n3 ?- a" X. E2 M
  for opt in $CMDLINE
( V% X4 K  w; f0 K% U* W4 k  do% P5 d$ h2 y0 V4 B$ D: g" j8 s
    case "$opt" in
3 F3 r' o$ F( J' X/ U2 k" |      -T)
: c, d1 ~% O. r" a0 L        minusT=YES
5 ?1 b0 M! |# v: [# S0 m/ D        ;;% t, o8 J; j; P9 V; y. |. Z8 a
      -*)9 K6 Z, h; _2 b, M6 N4 M0 j9 M$ ?
        # using standard powrmill command line
: F, F1 v) o. q8 k: b" v        useStdCmdOpt=1
2 k3 z+ n6 d; V1 l$ k        break$ b5 x) {/ j8 v% m6 {! p8 Q
        ;;0 Z- a; O+ ?( d3 v2 E1 }# y- k+ D
      *), I! e0 h/ g- m! i$ f: \+ Z
       if [ "$minusT" = "YES" ]; then
3 |; B" K0 f, G. G' ]2 {% D8 j9 h         circuitType=$opt! ]! F4 q5 E* _6 O: Y9 S* J! }
         minusT=NO  # reset flag, Y/ W6 y0 r1 ?: x, F* C/ s
       else
4 @. T0 l; X" |, f% V- f$ P3 v         if [ "$netlist" = "" ]; then
$ t) F8 t2 \0 K+ B( m3 }' D1 k$ q           prefix=`basename $opt`
/ l' d6 T/ J( `$ a1 |, U# K           prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix`' K# q% c9 _0 B5 b/ n+ w
         fi" n' k. x8 t( H; c
         netlist="$netlist $opt"2 g. G1 o, Q4 j0 L% B
       fi
( |/ q: l0 F+ P' d3 j       ;;* U1 V- ]1 G7 O$ R) I7 f" c1 ~
    esac
5 t, L, Q2 h2 l; U8 d  done
; A' k- b- O" b# P3 M% D
: }: \1 }4 {6 s0 X4 u$ ^5 D9 C
# W- a2 e) H1 s5 f! ~$ l9 B  if [ $useStdCmdOpt -eq 1 ]; then
6 A0 `1 ~, g" \6 l6 F    # use standard powrmill/timemill command option9 @" @: p( ?8 J3 w+ {: e' y) w) s
    for opt in $CMDLINE
+ @1 U  R/ I) d% [    do" a; K% a; x) M
      case "$opt" in " `% \1 C1 M2 O- q6 Q$ w
        -A)
3 P) q5 t# k) J' C            DB_REAL=1
+ s% p. w% {: K8 }: q            ;;
$ M4 V$ L# d  a8 J! h  N      esac
/ i; m7 u+ t9 B$ R% c. a3 b    done. M1 z1 D* s- T$ f1 Z7 q
    if [ "$netlist" != "" ]; then; Q- O/ S* A; o2 ]( y$ b
      CMDLINE="-nspice $CMDLINE", \8 z, J' c1 F5 ^
    fi
5 x" i% ]" f- d7 A9 w( E- N  else
/ N7 v% q- M6 I) g    if [ "$netlist" != "" ]; then
# C8 W* l& U) F8 Y4 l) d' T$ f      EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"}! q* Q- z& P: O9 U1 c
      # construct new command option
, v; V" b0 c8 D/ l; f      if [ -f $cmd.ini  -a  "$circuitType" = "" ]; then1 ]0 N+ S  O4 n# F  u7 k& j: w
        CMDLINE="-nspice $cmd.ini $netlist"6 A) i& L" E/ ?7 X: l0 M
      else
: K1 n8 n; x! w  i' g% \        if [ "$circuitType" = "" ]; then: d4 K3 c: U8 l- J$ d3 \9 s( ~
          circuitType="msana"
* B7 p! V5 J' Y0 l( c. W7 f        fi
  T1 f$ v/ F; l2 l0 G( q( P* m: ]. j0 a        CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg"
& Y6 ]* j+ D; u: l1 T      fi# R( h/ T: O, j& d  j8 ]) P
      CMDLINE="$CMDLINE -A -o $prefix", q* M& ?, W  `1 D0 f/ f, f
      DB_REAL=1/ S9 G# A9 H3 Y2 J- D5 W( F& h
      echo $cmd $CMDLINE7 s3 r* ^4 I. N" j9 c  u
    fi3 X6 K& N2 Y. N' S
  fi
0 q! U4 }1 }5 `' afi # cmd is timemill or powrmill or nanosim or railmill or pwarc
) Q0 p7 r9 @. B% m: a! C( ^! D) H% J  l9 k6 l! j/ M  b- j7 h
[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a"
0 ~! h" \* T! J[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a"
9 S9 Y- s$ x0 k5 R; \* \0 T[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v"9 ?4 k# h  e' X1 L* [8 q5 @- }
# m- W2 D2 s: N3 ~' S  X
if [ "$__engine_wrapper_called__" != "Indeed" ]; then
- u6 U$ |/ N& S  h/ K    __engine_wrapper_called__=Indeed0 d" R) r5 ~4 L
    if [ "$cmd" != "amps" ]; then
) L* D7 [  M+ k' a) W  j        export __engine_wrapper_called__% J2 X8 B+ d- _! R+ Z2 C' p
    fi
% A5 U. _2 i2 r5 x; u* j: K: Q3 }$ ]) R' a
    trap "cleanup" 07 d9 i" S, e( @1 D' i
    trap "" 22 A1 ]4 ]/ d8 f  u7 K  x6 f% y) _- B

7 v3 k* K- X8 W    [ -d "$rundir" ] && rm -fr $rundir. c/ F+ J* v0 @: ?2 d+ N1 N2 z
    [ -d "$rundir" ] || mkdir $rundir
3 ^# p6 v& c. p: a8 j4 g, K' q$ L3 ^5 Y: C  E7 f; h# N
    case "$EPIC_ARCH" in7 Z: }6 A3 g' e
    *SUN*64)   
( [/ k! y6 P* v; X. H$ B        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
# t$ F7 c7 n' z4 P5 X8 V) q        export LD_LIBRARY_PATH
5 l( T8 r+ e( z* A- n* V        suffix=.so
, @& c  s: X( z- n! o        ld_err_code=1275 z; U# i) d& b/ g. y
        ;;
( R' ^5 G' x  T) Y: k" ^% H    *SUN*4)   7 Z8 ~1 i- n! @7 d
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"# v* L5 p9 N/ X- P, `. e& d
        export LD_LIBRARY_PATH) z* S& V/ ]4 ~( S9 b6 N# t" h
        suffix=.so.1.0! l0 {& Y  \8 G. q2 P" S
        ld_err_code=127
8 A# y1 M: G8 |1 o  ?        ;;5 x- Y% a8 W) _
    *SUN*5)   
) [: p  p5 K2 p5 j: Y        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
. @3 b9 h; ~  X, N+ d- ^        export LD_LIBRARY_PATH
6 p1 p, \4 U: |: \' q' P0 t/ Q        suffix=.so5 \! A/ n4 j9 c3 N" X
        ld_err_code=1272 z. _$ x) ~5 f3 U" y; f  j
        ;;$ N2 }2 i1 T" ~/ F& P
    x86sol*)   
4 `' e& f% w' J" i        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
9 L" A* x( ~" Q4 g+ ?3 B        export LD_LIBRARY_PATH
: x9 {, b$ Y4 [( N: t% G2 i4 J- t        suffix=.so! J1 Y' W7 ?4 ^
        ld_err_code=127
  v, ^- u& l* N9 ?2 W        ;;  o( C1 R: r7 ~2 c2 D
    *AIX* | aix64)   
+ y+ i4 l6 Z% L1 H# G( F7 v        # When genepiclib creates shared objects, it creates a import file and
2 \, V7 _( d# w; I7 `        # uses timemill as program. So at exec time,program timemill is needed
' i3 Z+ i9 e1 d7 l        # in LIBPATH
9 \% u4 b$ f3 M& c        $ln_default $command $rundir/foomill  `/ h/ F  s; J4 c. Y8 N  b
        LIBPATH="$libpathLIBPATH:/lib:/usr/lib"
3 N, O# H9 i& [8 ]% D        export LIBPATH
+ B2 J+ d( y0 N* T; n' j4 ?4 G! q        suffix=.o
9 g( N8 L$ L# q$ X' u' K        ld_err_code=8
0 C' ^: ?' F, N! k        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
0 m- a% g5 U8 ~$ d2 G          tdir=`echo "/tmp/d"$$`' |$ v2 r& R  V/ H: p7 h8 O5 U2 }
          [ -d "$tdir" ] || mkdir $tdir
0 x* Y1 }  I+ _) A          if [ -f $EPIC_DIR/libCustom.o ]; then% S3 c0 k+ n1 O# R/ V
             cp $EPIC_DIR/libCustom.o $tdir/
; x" ^7 v2 Z7 N' c! u+ M- B/ l# F             $ln_default $tdir/libCustom.o $rundir/
" |1 S/ B* z3 z$ m, R1 @          fi
' q8 _0 Z+ E, c9 T2 `          if [ -f $EPIC_DIR/libModel.o ]; then* q8 D3 W" d& j/ I
             cp $EPIC_DIR/libModel.o $tdir/& }4 X+ C' J5 U3 z  w! f
             $ln_default $tdir/libModel.o $rundir/  E$ R& F* ]5 i, i
          fi
$ t) x, T% l) R* H/ \, X          if [ -f $EPIC_DIR/libFuncModel.o ]; then, D) O- s0 Q& q1 i+ ]
             cp $EPIC_DIR/libFuncModel.o $tdir/
) l7 w: f) M% M, _7 [* a0 Y             $ln_default $tdir/libFuncModel.o $rundir/! g2 m2 D1 V. E0 X0 y
          fi; \9 E( ], k$ E
          if [ -f $EPIC_DIR/libFuncModel.34.o ]; then
, U" _7 S+ P8 E: K             cp $EPIC_DIR/libFuncModel.34.o $tdir/
+ c* p% D5 T: K' U* a' O" Q' Q             $ln_default $tdir/libFuncModel.34.o $rundir/
$ G" j2 o: Y$ z- K6 m. T          fi! @# z1 y8 n# _' y
        fi1 J, \% J5 k: x+ P
        #Set the IBM flag to enable more shared segids+ J% e4 k1 a1 `7 L7 W8 m
        EXTSHM="ON"# o" v. G! y' v( R2 T
        export EXTSHM
% t9 j4 T6 {# Z& G0 x        ;;9 p* ~, _4 E) y% k' }" J
    *LINUX*)    ! _* W1 z& ^; {3 k3 z
        suffix=.so
' \& O% x( j! n6 y' h4 c        ld_err_code=1
2 {5 r8 [' a6 N; [+ q: z        ;;% f, m  o  G9 o
    *amd64*)6 M8 X5 s! N1 y
        suffix=.so
: T, Z+ v6 j# m* z/ [/ a$ B        ld_err_code=1
" t: A) O! T' Q; F7 b$ C        ;;
, k0 s4 ^- l1 t7 T. @5 a    *suse64*)3 l4 x# @6 E$ U; u
        suffix=.so; h* ~' P) `- U: j
        ld_err_code=1
' p9 t1 U! e* C( D. m        ;;
) i7 `) A& G1 s* U: p" o    *suse32*)    / v8 p5 b: C" n: A4 |
        suffix=.so, O  f# v! a* h+ q0 [7 t: h+ c
        ld_err_code=1; I5 b- L, [% }, c- a
        ;;4 n7 {6 C* Q9 h: i
    esac
! Q' L, K4 C& h% G& ~
3 Z" H3 q) s% L* t    [ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix"' y" H6 \; p5 j1 H
    [ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \
& Q: a7 J$ ^7 V* c. Z. _        && [ "$cmdname" != "nanosim" ] \5 n* q! ^7 B- R
        && [ "$has_model" = "YES" ]  && ulib="$ulib $cwd/libModel$suffix"5 H- H* g- [  S0 C) G4 g" V2 k
    [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix"- T& |2 j/ c8 B

3 [6 e$ t. p3 n4 E# c#Look for command line option for libFuncModel.so
* ~/ {2 S* c; W4 C#    user_library_next=0
- Y; ~3 b# S- \0 k6 W/ C, X+ h    has_fmlib=""
$ K) V2 T" `: p6 s' H8 D0 v    for opt in $CMDLINE
8 X, }  L/ f! K    do
2 @3 n4 s0 P1 A  f- K      case "$opt" in
1 q8 l1 y4 @% M: m7 _        -fm)6 N* m, `3 m* R
            CMDLINE="$CMDLINE $cwd/libModel$suffix"
% `5 d1 U+ B9 |& v            ;;
. X/ `, \/ u& F  H0 \        -fm_user_lib)
! ^+ @8 a: `  D" C2 j            has_fmlib="YES"
9 k4 Z# `* p6 O7 G- b#            user_library_next=11 H) L3 W5 q+ f! f& c2 {
            ;;
( g* E. O6 D: |: e+ k/ |1 O        -xc)
1 v2 U" I. i$ }( x2 a! e9 s( K            if [ "$EXTRA_CAPACITY" = "NO" ]; then
9 v- y+ l; ^. i% z3 b            EXTRA_CAPACITY=YES9 N  |- z  i' e4 Y4 L
            fi! m3 D# a) ?8 s& E$ G: ]5 g( ^. v
            ;;# J& D4 h; M0 v
#        *)7 K$ [2 @% O7 o. J! V4 q$ _) X0 g
#            if [ $user_library_next -eq 1 ]; then
4 f( Z9 O6 f/ Y" l- `5 h#                if [ -f "$opt" ]; then1 `& W0 N0 B* |8 k/ c. k9 r8 X
#                    libfmodel=$opt1 Y( Y; Y  n- L' L. y7 P
#                else
$ m( q2 N! j9 d#                    echo "-fm_user_lib: Specified file not found"
8 p  v5 X8 `8 h8 x0 g- c8 ~1 |#                    echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages
  A9 w. P: R+ u8 l#                fi; M5 W4 l6 |3 L: |! g% s8 Y
#                user_library_next=0
* z4 j% y* z, }6 }' u5 z#            fi
1 F; B, _' x: S: I2 R- K#            ;;
/ B' j2 Z2 v  ?' k        esac
$ s3 {; `" u9 I" I" k- j/ I    done
8 [4 A. P1 b: D/ F/ [2 C5 d# g5 ~/ E( P9 U$ S6 p
    if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then/ p+ I) C/ m: R( O) @
        flib=""
: s# B! s8 w$ b* J  Y4 S, h0 W) W        if [ "$has_fmlib" = "" ]; then. h: }+ g* `6 f1 ~; ?8 Y% H
            flib="$flib `get_epicrc ./.epicrc user_libraries`"
1 F# U$ ]7 E) t, C* t            flib="$flib `get_epicrc $HOME/.epicrc user_libraries`"
! F- P) T% v8 Z) c* L5 z: {" |            flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`"
! X. P, x3 q4 Q( r( I        fi
+ U7 ^& |) _4 q, `2 s1 a) r! p    fi2 {, W+ A9 i: d: t0 b# G
" Y4 D/ h  q: _% }
   for i in $ulib5 j7 B3 ^- u! m$ J+ z8 u) K
   do& H2 N- g& B# k/ `
       [ ! -f "$i" ] && continue
* @! [% i& E9 f4 S& R% ?, v       dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd* B( q7 [$ P7 \% H) n7 |( Z! q; A% S& M
       i="$dir/`basename $i`"
) B1 k& G0 L0 k: F5 J( R       case "$i" in
7 P9 q: T& l' t# ?1 w% T- }       *libCustom$suffix*)    [ "$libcustom" = "" ] && libcustom=$i;;1 o. X9 @1 j; s/ x
       *libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;;* b/ m. [( t" Z$ h$ ?( a
       *libModel$suffix*)     [ "$libmodel"  = "" ] && libmodel=$i;;
& Z, r" a1 r" E+ t. G2 b" W3 [4 t- L       *libva$suffix)         [ "$libva"     = "" ] && libva=$i;;7 J7 ?4 e# h+ T$ n& I) t
       esac
2 L5 Y7 f; V% w- [) \% ^       [ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \
: K( }6 D" E" Y; q) @( W9 g! ?        && break
/ I2 x2 J! s3 V- C+ a5 r4 r* M   done
. k, M9 V  y' _% }8 ~  ]3 J$ Y. z& Q& W9 N
   # symbolic link shared libraries to .epicrun$$
9 i$ D1 x; G; F! j    cd $EPIC_DIR; epicdir=`pwd`; cd $cwd
" R* N, c# M- c: I& A    if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then
8 ?6 K; V! E: d9 w' O5 D        if [ "$libfmodel" != "" ]; then
2 H2 V& j# {- d7 Y             [ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \$ h3 \' p7 d, Z7 Z8 ^8 @. [! F8 O/ @
             echo "Using $libfmodel ..."  && \
3 v4 D* ~' c) E1 G             echo "Using $libfmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE- @/ p  Z! J* ^( L  V5 _
             if [ -f $rundir/libFuncModel$suffix ]; then! O" T* X2 h6 C' r0 W/ i
               rm $rundir/libFuncModel$suffix6 O! I6 @+ ]" O9 L" ^
             fi
8 n4 x* M) x0 ^( l             $ln_default $libfmodel $rundir
+ `: |" G. ?# K! W& J( g        fi
: V; f9 j0 A5 R6 R+ B        if [ "$libmodel" != "" ]; then  U' v% V+ n* i' B, P7 [" ?9 U
             [ "$libmodel" != "$epicdir/libModel$suffix" ] && \) E, R7 C9 [% r
             echo "Using $libmodel ..." && \6 E& ^/ s8 P! j7 H$ K
             echo "Using $libmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE# n/ c0 P) R- P1 i
             if [ -f $rundir/libModel$suffix ]; then* _( ~, d  L0 e  g1 Z
               rm $rundir/libModel$suffix- F& ]/ ^& K$ c1 [! r
             fi
8 ^- A1 @# [6 b: V' G1 e  H- R             $ln_default $libmodel $rundir
7 ^, A, i( D# v8 F9 C4 @        fi
) Q9 `& I6 U7 P( d: j5 y: A( }   fi
5 f9 H% I/ g& p5 ?, F4 ~3 R9 `   if [ "$libcustom" != "" ]; then
1 D& S  M  f; Q: h$ l! E        [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \
$ n' y$ U% w" O- t        echo "Using $libcustom ..."" F" R* L' W1 f0 h/ `& ?8 V
        if [ -f $rundir/libCustom$suffix ]; then' t4 ?9 [: O! ]" s
          rm $rundir/libCustom$suffix5 a5 w8 o5 s. t3 _9 A
        fi5 n+ G7 J& c, n8 f
        $ln_default $libcustom $rundir
1 Y3 c% j4 P. _- F2 a, ^. G( M9 h; a& K   fi1 z6 S* y% F# W

6 `3 p) ^! ~: B5 V/ @% T) U   if [ "$flib" != "" -a "$flib" != "   " ]; then- t# e! B5 j: S- U  K3 ^# I' z0 O
        CMDLINE="$CMDLINE -fm_user_lib $flib"- O2 d7 T2 {8 D  h
   fi  K+ a, K8 Y+ A; {8 S  Q5 A! F4 G

4 L" O+ I; W. _   if [ "$libva" != "" ]; then
( m* |; T" W0 F* m1 e# g4 H        if [ -f $rundir/libva$suffix ]; then
6 s% _6 G) E0 O  J/ g          rm $rundir/libva$suffix
( X# v/ n3 k# ^& r3 }& a# K$ ]4 \        fi
1 x% Y1 W. t* v; }: u5 t        $ln_default $libva $rundir 6 ?! R, J( Z( J6 H) x/ ]
   fi
9 s1 _/ g; v0 b; Y' C. V# M* B
* X. C) x6 R5 K/ D) ?
- C. Z2 d6 u# G$ X# l1 R8 {    # VCORE design library
! i+ M+ e( T, |1 K) h& D7 _5 Y    if [ "$vlog_design" != "" ]; then
9 ^7 t$ p- I# w- r5 k9 ~" f6 I+ V        $ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`
$ X- S" q) p5 k    fi
5 J% {9 u) M& D' Q. V- l1 y8 y7 z5 V6 q9 s
    if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then
% @, B  x+ {  q6 F; U. J9 p8 ~        EXTRA_CAPACITY=YES
4 V! B( A8 o& U    fi
" q2 i( w3 M% R% K) e$ Y" ?2 X8 }+ i
( x2 P: Q: F6 M; {2 X6 f& p    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc"+ [; n- ?* o  W
    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc"
, B  W: {' \# p3 Z    #Create temp file if dual process is on
  L3 u& K; I* K0 u& \! @  J. o    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then1 {5 M; i( h$ d% D
        if [ "$EXTRA_CAPACITY" = "YES" ]; then  v! D  x! s! {: k
            touch $rundir/rpcidfile
+ J( o) d  H- I8 R# ]; \        fi
" ^- m8 Q/ t0 l$ w+ |% i    fi" s2 |, ?0 S& `( N* C" q- R" v
fi
+ ~2 D- s/ t  t# |0 W4 x& [: a, p
, Y( k+ e& t/ trun_cmd()
; h( B" L, E3 V2 m* B{
8 i* b* m  ~& h* [, _+ a. C7 B& s: b  command=$1( R5 e) x# K2 E' ^
  shift/ h0 ^& m& a8 e, u# T$ c  @
( a+ ?# |- Z* O$ v- v8 ^2 \/ H
  if [ x"$VA_FILE" != x"" ] ; then
- x1 j" K! S9 r( K% q     cmdline=$ARGV# S  {  T% N( p, v) z
  else
' ~2 N1 I& o7 u     cmdline=$@
$ i. E0 I0 H/ a  fi: S, D8 y% c# s3 x- U/ D
$ r# g: N5 A: a/ S0 D6 ^& d7 }
  debug=${DEBUGGER:+"$DEBUGGER $command"};
! V& m0 F8 _" e# b& h. }4 p) B3 S& C  Z# k: u0 s
  # To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a
# d1 m- c' F' Q  # so save-restore may work.; U8 `* \4 V: r+ R0 t
  setarchStr=
9 Z' s( B5 A3 A3 c  cmd2run=`basename $command`8 H* }) y2 T2 W1 x2 @; U
  if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then& i3 O5 |7 Q4 z0 `2 b5 ]
    if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then
. I: P8 d4 c$ J5 J      setarchStr="setarch i386 -R "
6 J" w; u/ C7 G- Y$ T  Y( @2 g7 U8 q    fi
* {: g& _! Y! f4 @+ u7 b$ X. @8 T8 N    if [ "$EPIC_ARCH" = "linux" ]; then
/ M% ]0 C$ C2 L, @( n1 l" {      setarchStr="setarch i386 -R "
% x0 I$ c) d/ I, k% g8 L' i    fi
6 W7 V8 N- z2 P" U- t/ T+ d$ s    if [ "$EPIC_ARCH" = "amd64" ]; then' f1 G/ f+ X! e+ K" y, M
      setarchStr="setarch i686 -R "0 j9 t! m; X3 e4 W' w
    fi, z7 t) ]3 N( r7 d
    if [ "$EPIC_ARCH" = "suse32" ]; then- o, J6 e& z2 v: `2 w9 p$ G6 q
      setarchStr="setarch_suse i386 -R "
% k" r1 c, I* y5 ?    fi! m( D* h3 ]" C, H9 l. s
    if [ "$EPIC_ARCH" = "suse64" ]; then; u% j7 N/ e0 n+ ^1 h* z
      setarchStr="setarch_suse i686 -R "9 M2 y" f( k" K3 ^& [0 y
    fi& d) B# [7 i1 B8 ?. f( n5 a, T
  fi
3 I7 S& g) k9 W' u: V8 O0 Q" e; d" L9 e8 c, W0 ]
  ret_stat=0
& D: c2 p) L( {% r5 j0 q" l8 }  if [ -x "$command" ]; then3 }3 Y$ v. o$ t! Z
      if [ "$debug" ]; then
1 }1 k( y' S1 r) ~% ]: u7 p6 Y3 d        _debug_args_=$cmdline( H5 o5 Y- D5 Z% {
        . .epic-debug
: \0 M7 E3 W8 M. Z. L$ q      else
! Y  @# p% T5 n! w: [! }& s. @        DEBUGGER=; export DEBUGGER
: M, s8 c( k- [2 r) z        $setarchStr $command $cmdline
4 k4 u  C9 ]$ N( K      fi
2 m# l( ^% A' A: f- Z      ret_stat=$?2 {# @1 F3 w! g$ F- j! Y. w7 y
  else, H1 k) T9 \9 l- n9 s! F& p
    echo "Corrupt installation, executable \"$1\" not found!"2 v, j. L- V1 J0 ]( |) R+ V
    ret_stat=1
$ b# K' e, L  i2 n% a0 q: W. f  fi6 J- \; e4 G1 B/ ]
}% ~. W* S, S# A5 t9 ?

+ g1 W+ C, c( Y, X- _9 }# keep runing cmd if ctrl file exist$ ?7 R, I# _/ X6 r3 R- X
2 a: r$ o7 x: ~  [) G
run_loop()
' @# o8 b& O9 [+ J; }{$ l' h7 v( E, X5 H% l
  command=$1
+ z  L5 k' s+ }& u( M  shift
7 ]1 m: O- L0 E% w0 n" Y
" T" Q. D1 o! Z  if [ x"$VA_FILE" != x"" ] ; then: N+ p) y! P0 u" o9 |) w
     cmdline=$ARGV& v2 F" y: m/ L. y$ b6 f0 v! i  ^
  else! }4 G% c" A4 O: g
     cmdline=$@2 Z# H- V2 l% }9 t; o
  fi$ g$ p+ ?! ^  e$ D3 s
2 @8 y$ W% ]( E
  while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do
$ ^1 j8 P: \$ w, v    . $LOOP_CTRL_FILE$$$ F0 i) |3 h! Z7 m' Z
    run_cmd $command $cmdline -banner 2; j' p+ U, n8 D2 J: d) h
  done;
0 m: f# p+ r8 o' V* @
4 p" s- M: R$ h4 t  if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then
1 g, V$ @8 L. a6 J7 f+ v- Z$ u% ~    rm -f $LOOP_CTRL_FILE$$$ k: @, a! P8 H2 {" I! I0 H2 M
  fi: ^- P2 }) h) j: p
}5 a% S7 n, u. f- `* Y; S- ]5 O* J

4 v7 I8 O! U" s& M1 z% e' {har_check_ret_stat()( M1 ?  W5 c7 o9 X# O9 ~. ~
{" b& g! a% N- \; `9 q
  if [ $ret_stat -ne 0 ]; then
+ o# j- J0 a3 p' a# U' p+ h    echo "Simulator returned with non-zero exit status. Stopping.") I4 ~9 ^$ z8 p8 C& N
    exit 1
9 a6 f) ]( |5 q  O/ c( u5 ^  fi% G4 L! @3 Y/ a% L+ e! `8 D
}
5 N; g, O! L( j0 p1 U
/ A/ R, E8 X7 {* _#
8 r. d: D% U" J; `" y  @% F# set stacksize and datasize limit' ^; J8 d; c5 o1 ~0 m8 t" W
#
# |; m! Q  g/ s6 \5 ~9 a. n
  d0 i2 t6 G5 ?/ r& }1 m; d; zset_data_limit5 i3 `& _- W1 O# o5 E6 s
set_stack_limit5 e6 E1 s0 H' F) N8 x( v
- ~8 p7 j6 E5 b9 l! g, H5 z
#rm -f $LOOP_CTRL_FILE
- L$ x* \- {9 h
6 t3 r$ o0 l( u; F1 _" Brun_main()
3 D7 T/ O  l8 h- R+ w" R{
9 r, c3 \0 P/ y1 i4 ?1 Xif [ $is_special_har_run -eq 1 ]; then
# c) Y: d# J* Q$ Q  H) X  if [ "$har_ofile_prefix" = "" ]; then
8 Q% q7 d# w4 @4 ?    echo "Wrapper bug. Notify Synopsys technical support."8 `0 O( G1 l0 @5 n3 \6 Z
    exit 1
8 M* \! J  l8 Q4 G  fi1 S4 n% ^8 s" ^- W
  if [ "$har_hilo_file" = "" ]; then
1 z" X" A. k* K3 `8 v. j/ C    # no user specified hi lo file - do both runs) i0 A+ p# M1 O" |0 `- w  M* j1 ?
    run_cmd $command $CMDLINE -har_one -har_setup
/ L# t! e+ b3 \+ u4 T    if [ $ret_stat -ne 126 ]; then3 B$ Y; s; j9 h# e) a: s( W) k
      har_check_ret_stat
0 x, X# g* R" \$ H5 @$ X      if [ -r $LOOP_CTRL_FILE$$ ]; then
7 I: l+ V; x9 z. u. P5 J        run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl% }0 K4 D4 h  v: d  T
        rm -f ${har_ofile_prefix}.hl
, B; _, b. j9 @% j1 D4 [' S& x      else
2 n( ]( G: a" \" w" r  p% M) f4 M        run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl8 s- Q% c0 x$ _* F6 V. A; h( D2 x* X
      fi1 m. V" W8 T0 u7 S8 @
    else( b4 I+ G- f; v
      ret_stat=0
4 k2 b7 }# n' I5 N2 \, k, o. Z0 W! H    fi
1 X, H* I, x: X  else" G! \3 E4 B2 d4 b! b9 t0 [
    # user gave a hi lo file name6 j: h: v. t  f3 D
    if [ -f $har_hilo_file -a -s $har_hilo_file ]; then7 h. R+ L' H1 s/ k. Y" @) I
      # file exists - use it - only do sim run
! P1 E8 Q5 d. F% m      run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}
: Y5 E' _# D, B' j6 ~      run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}
9 K( H1 Z. v; B9 R+ s    else
) Z: k$ Y! i" I: L& `! e      # no such file - generate it - do both runs9 q1 r8 R$ }* w+ [7 `9 S  a2 W
      run_cmd $command $CMDLINE -har_one -har_fnf -har_setup
  x1 R/ j2 T2 P& B! x      if [ $ret_stat -ne 126 ]; then
) p$ ?8 K$ v  c9 g, C) y        har_check_ret_stat
2 |0 g& ^5 {# y) q        if [ ! -f ${har_ofile_prefix}.hl ]; then' D! Z; L0 n8 O0 B& \! |
          echo "No hi lo file generated after setup phase. "% e" E0 L+ a  y5 ~5 y
          echo "Contact Synopsys technical support."+ U  D$ ]$ L, N: c( [; e5 L
          exit 1
3 F  a+ M" X5 c9 S1 z. S        else
& ?5 }+ O- E' R          if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then
5 Y" R: `$ M6 K# h) p' t            mv ${har_ofile_prefix}.hl $har_hilo_file, ~( N  q: `& m
          fi
* m  K" F5 ^( a- M" \( L        fi
) i" e( k6 w0 ^        if [ -r $LOOP_CTRL_FILE$$ ]; then
; `6 X+ F/ c$ t; N2 _          run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file
$ H% i+ G* e" w: [% A        else# x" I- O* W  X8 ]
          run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file' O* k9 p& W/ V% ]# v" E! V5 o& Q
        fi
5 l0 T' e& [: Y      else
2 s1 Q9 j. [) h        ret_stat=0
6 ]- D, x( G8 C* F( M      fi$ m  e2 x2 T! _" C) i1 d2 c: @
    fi
, M2 M! I8 A9 G: r4 j+ j, G  fi
8 B0 ~7 l$ e6 x! J2 jelse  
6 S: S- U" H( I! N9 I/ ^8 Q# don't loop if -har_setup* U( W8 M% [1 f& g! |
  if [ $have_har_setup_flag -eq 1 ]; then5 E& Z+ j& K: H: T+ r( k4 e! H+ _
    run_cmd $command $CMDLINE
" R7 S! z5 r  v& m    if [ -r $LOOP_CTRL_FILE$$ ]; then
$ ^% O8 b& R, N- _( @      rm -f $LOOP_CTRL_FILE$$
8 _1 O  ~' V7 k: R7 f: i$ |    fi
+ c; ?* s" Y* N8 M  else/ E5 r' ^. j3 I7 d  N' d* u0 J6 H
    run_cmd $command $CMDLINE
/ `( [5 u1 q+ ?# h% D. B3 K+ b0 [    run_loop $command $CMDLINE
4 o6 H5 o2 @1 E  fi  u5 u, o1 g: K+ [5 V$ o) e
fi
" _9 u( X9 J& F  _+ s
  Z6 F1 K5 \: @2 Dif [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then; d: j  z/ _/ ]
  pwCreateErrDB -w $workDir -e $errFile
( C  {! i: }$ l( L$ W8 A7 M0 e  ret_stat=$?0 }0 P6 p# U7 I0 I$ s
fi4 p3 z9 u, r1 E  F1 ~8 }
}
0 `: B  ^9 A, E  l1 O, B
  Q4 m* Q3 y1 v1 dcleanup_alter()' _; B, v9 a% c( z% m" r( [
{
; x3 o1 m  p  t$ g   /bin/rm -f $ALTER_COUNT_FILE 1>&2% Q( F% f6 _! a
   /bin/rm -f $ALTER_HK_FILE 1>&2; x. ]4 j( C- ]# |; O( L
}
" y7 C( V6 X' D3 F: q0 y  }( ~( h' g( M( F3 w6 A! h$ L( X
#generate alter temp files based on pid
3 T. y, w$ `$ o7 @& XALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$
# B) u( t" c% C# s$ I, l* n+ dif [ -f $ALTER_COUNT_FILE ]
* ]5 `) y: g0 t3 |3 ~& Wthen 6 v) i- H* }% A$ `1 e  W
  until [ ! -f $ALTER_COUNT_FILE ]# E6 F# g9 ^+ B7 ~0 y' m7 F' g
  do
3 F. I. }/ }  d0 p    ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$
; {1 p, y2 p6 V! _0 r# D3 t- D  done
& a( o4 S4 j% Y1 r: B! Z$ G+ U# Z7 Gfi
! z; h% q$ }9 s2 R# {) Hexport ALTER_COUNT_FILE
  s* j, f$ J4 I( K4 Z. c/ c2 Z2 }* Z5 j1 \! U5 H7 U
ALTER_HK_FILE="$ALTER_HK_FILE"$$! X" o8 k1 L7 B9 _4 q/ B
if [ -f $ALTER_HK_FILE ]
5 z& W2 \8 e! i- Z  }then   K1 s( \: o( C3 |
  until [ ! -f $ALTER_HK_FILE ]2 m( N2 H! d+ m1 ]* M
  do
9 J6 k2 {" O3 _1 k, a    ALTER_HK_FILE="$ALTER_HK_FILE"$$
7 E( R/ ~3 @# S8 {' Q" f1 n1 |  done
! p" f$ ], E, g  v1 ffi
; d2 f! P) h9 Y0 ~7 Xexport ALTER_HK_FILE' @5 o" I4 @4 c2 Y
3 Z$ {  ~6 O: S3 ^' Z
#generate monte carlo related temp files based on pid
' c$ w0 g. d1 xcleanup_monte()1 g% Q1 d* p5 u3 {1 I
{
6 I, `, ]9 G+ h; B  o2 [% y/ `3 Q0 M   /bin/rm -f $MONTE_IMG_FILE 1>&2
  x0 Q: ^  ^; }  h   /bin/rm -f $MONTE_IMG_FILE.gz 1>&2
: C4 k+ |9 J, T   /bin/rm -f $MONTE_COUNT_FILE 1>&2
* A: Q1 }: {& `% E   /bin/rm -f $MONTE_CFG_FILE 1>&2
1 I! h4 L0 {: H- q# J}7 _# U& C3 V& D$ O# X

4 A8 T0 ?1 f1 G% y. J2 {% M  wMONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
) |" o6 p( K& V8 W6 n1 j2 [0 g* |if [ -f $MONTE_COUNT_FILE ]2 t' G, i+ ?$ P) _8 L( I6 W5 @% u! ^
then  O& N: D3 p; z/ ~: K3 Z! c9 _
  until [ ! -f $MONTE_COUNT_FILE ]/ p6 O7 H3 @( k4 B0 V' p& f7 g0 }
  do8 `' [5 J5 x! H: a
    MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$: j" ^4 z. @- s8 X2 g
  done
/ t& V0 J/ N! h7 Z, T7 T9 F8 Lfi# }' A6 o" y2 H/ \9 N6 U
export MONTE_COUNT_FILE3 c0 K; @: {! o4 a+ P9 j' E) c

6 f# R& E2 m3 l/ O* k4 a+ z! d5 M2 FMONTE_IMG_FILE="$MONTE_IMG_FILE"$$
6 S2 G: ?2 f2 u. B( sif [ -f $MONTE_IMG_FILE ]
( s9 m6 c: I# G0 z' zthen
! R! f3 w7 p6 S, \  until [ ! -f $MONTE_IMG_FILE ]" {3 U+ Y7 q  T  X% R+ d# v
  do6 R$ n# `& w4 x' `4 R
    MONTE_IMG_FILE="$MONTE_IMG_FILE"$$
6 P: n# ?  S: n9 |0 V( u- B  done
, y. C3 K9 M' ~# C, D8 q! Jfi4 |# G0 Q, \' m8 S! |- U( I
export MONTE_IMG_FILE+ h" X2 Y8 b4 y9 I2 C
# ~( @0 k0 c- t; m2 H7 o# Z# i- @
MONTE_CFG_FILE="$MONTE_CFG_FILE"$$
* J- r9 z0 M& Y8 y5 Xif [ -f $MONTE_CFG_FILE ]8 x+ s' z4 [- W$ v2 b
then. R1 }8 S1 }( O" g  P
  until [ ! -f $MONTE_CFG_FILE ]
; T) x$ k+ S0 a& u7 G) t+ z" d  do' @  C: C6 i0 o8 u3 }1 Y
    MONTE_CFG_FILE="$MONTE_CFG_FILE"$$# s0 v: Z- `! ?' u$ s- r' K
  done! x5 }' f2 f, q. e  n% Q, \$ v% h. o
fi
6 g) S; B0 a$ X+ ]$ x0 k% L$ `& a) o+ r) e  H3 M* l
# main iteration" \2 t8 ]( `2 K( D- O4 i, M
run_main
; f: W* T0 x4 M$ v- ?: t7 P( Z. o3 m  i" ]2 L
if [ $ret_stat -ne 0 ] # h! S' X. Q9 Z$ _/ X! \$ I
then
$ R- }8 t% ], x* F3 B: O. }  cleanup_alter
" {& }4 C9 ]: W, z. U$ C1 c  cleanup_monte
! j' G# N3 k0 |: S2 ^. Z$ a  Exit $ret_stat! R& F( E! [# Y0 T- ]' q2 g8 D; A
fi2 d% m" {5 M, ~- [

4 m+ u  m/ q& ?  |9 [4 F0 }8 f#Alter related iterations1 @* c5 }% w7 e

( r2 p# m" f. x9 }1 U! ziterations=0# T! f, N, [. s/ q
count=0
0 W* ?7 V- O0 j/ d9 e, [- kif test -s "$ALTER_COUNT_FILE"
& L& }0 |* b  h) G$ f: ithen+ V( F3 c6 @3 S$ I0 y# `; |: u
  if [ -r $ALTER_COUNT_FILE ]; then
; \5 v4 F; t& ~. [. e   exec 7< $ALTER_COUNT_FILE
6 X6 P5 o6 h/ G   read iterations <&74 n. y: C! a; r* I- O) Z# f3 q! e% p3 S
fi
' R7 \) M$ v2 c5 R3 @& v" O9 G$ bfi$ E, b5 E' Q* u- z1 o

* D% G6 t# S8 y1 [8 }- O( Gtrap 'echo Program Interrupt; cleanup_alter; exit 1'  2& A6 W6 H* C$ ^: I) j7 U
while [ $count -lt $iterations ]
+ r0 w* d: {. m* ido
. F# a9 @; A" H( i2 U( l count=`expr $count + 1`
6 c/ q& h1 H9 S; [  e. | ALTER_COUNT=$count
$ K! V- n* D  w$ a# M8 ~2 D export ALTER_COUNT# y- a( Q3 b2 G. N* c; I; s
/ V; U$ O! ~- R  t) K- O- V0 z+ g
run_main
8 y) \! j9 T& K5 K; ~7 g5 f% Y4 A$ B; }2 E
done$ g6 }2 i) `  u$ I$ G1 D: F
5 k' }4 ~" m' x3 ?7 R; f1 ]
#Monte carlo related iterations- n1 b( j+ L! I. d

9 x) M' A0 z( Tmonte_runtime_summary()6 t3 E! P, c; i3 l
{
( G0 v3 y1 X* o# l( m2 o  keyword_1=real4 a! X2 p% V5 Y" f; h
  keyword_2=user
2 \5 `: K2 B, g; g6 B  keyword_3=sys
! {% Z; |4 \1 w  ofile_prefix=nanosim
5 q5 H: e: D8 z1 ~( G3 r/ f$ e' X3 d- ?! v$ h
  if [ ! -z "$o_option" ]; then6 X( R: @5 _+ c% o
    logfile=${o_option}.log
+ }: P8 W" t, I- R  else, F0 Y$ y/ |9 R, E1 `: l9 u
    logfile=${ofile_prefix}.log
0 ]9 e  d! M* z1 f: m  fi
7 r4 `$ F0 U! ^6 k( e1 a
( ?, p% ^2 {  s! T  if [ -f $logfile ]; then
5 X, O5 [; q' w# o    echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile      
+ Q" B+ U  L+ 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; u$ O6 b' p1 j
  fi
8 v! A0 Y% w; u! Z, M. ^/ I% b}! }) z4 N. {# d  W9 l
0 B3 q3 W' h* W6 ?6 y3 w( F
next_monte=0
- p; Z7 c, g+ K9 z5 S, Scur_monte=0
3 z4 m8 \. E0 Y0 R1 x6 s
. X6 q+ A" m) o# d* Pif test -s "$MONTE_COUNT_FILE"! H* ]  i  c, K( c
then' j' c9 L' j1 [$ J7 v& z/ j, ?
  if [ -r $MONTE_COUNT_FILE ]; then2 q/ l, _# \* S) x& Y6 Q+ h5 h. j9 z
   exec 8< $MONTE_COUNT_FILE
- W4 ?/ I- Z, H  C1 ]8 j   read next_monte <&81 c; |& y2 d. {# i' t" T* Q) B
  fi5 q+ d) o3 A8 X
fi
) K; `# z" k9 n4 i$ p; M# k% C# }
. A5 Y5 I2 [! Htrap 'echo Program Interrupt; cleanup_monte; exit 1'  2
' j/ ~! n; a0 e2 B$ F+ D1 d5 Uwhile [ $next_monte -gt 0 -a $next_monte != $cur_monte ]
) D& f; Z) d& \do
% l# W: v$ b+ |0 V  NS_CURRENT_MONTE_COUNT=$next_monte
2 M3 R6 Q2 O3 j( b* }3 ?" ~0 F) ]  w  export NS_CURRENT_MONTE_COUNT6 o7 ^2 S! x( m( O% W

' C  k9 [/ \( z- X* E5 V6 y' s: X  echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE
/ s$ r2 N+ b* d6 A! @& S  CMDLINE="$CMDLINE -c $MONTE_CFG_FILE"+ P, [0 T/ O3 R' X, \8 e/ t0 O
  run_main
! Z- a  W; J( h8 K, n
' z4 N/ q: u, ?  }8 V. T  cur_monte=$next_monte% O' S7 P7 A# E3 F/ a# z
  exec 8< $MONTE_COUNT_FILE
! {$ x+ ]' G* W  read next_monte <&8
# r" s& q' I. bdone! q4 ~. g" U) C, S

% n( f: J, X2 d: eif [ -f $MONTE_COUNT_FILE ]
/ `* h) H: e- \* Othen
1 Q9 Y0 Z$ P/ t' F% U! U" x  monte_runtime_summary9 Z; L7 r  Y2 H! Y9 `1 @/ y
fi, `# c' _# P" U3 C

' R9 a. c  H& R* j: fcleanup_alter
) u* q) l1 |/ W4 l+ `' m0 lcleanup_monte2 |0 N4 {. W4 p7 E+ U% d

  P' S+ x) T) x0 j# o- x0 oExit $ret_stat

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享分享 頂 踩 分享分享
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

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

GMT+8, 2024-6-8 09:56 PM , Processed in 0.155519 second(s), 16 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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