Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

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

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

[複製鏈接]
跳轉到指定樓層
#
發表於 2012-5-6 13:58:13 | 只看該作者 回帖獎勵 |正序瀏覽 |閱讀模式
10Chipcoin
各位大大好:" q& E* v+ _: v
                      小弟執行nanosim時,卻無法跑出視窗來,有個錯誤可是我不清楚該如何解決?問題如下1 i( X2 _% N! P7 c& X2 d+ w
                      [: 113: 64: unexpected operator1 Q( z; C4 @3 c; _' M
/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim: 1: Syntax error: Unterminated quoted string
$ |% W7 \! f7 ~有大大遇過這方面的問題或是指導我方向去解決, 謝謝.
/ `7 K- b. S% j! ]: G我在猜可能是這個檔案內的文字需要修改 但不知道該如何修改?4 |* D0 b% U# R( y7 _
以下為/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim 的檔案內容:( h- |' _9 K) E& C2 R  e1 ^* [
    #!/bin/sh0 l5 t7 i# T" w! N2 M! x, j. S; M
#7 o6 l0 M4 m0 e/ W% I( ^
# Copyright (C) 2001 Synopsys INC
. A, h/ S; _0 R- N# EPIC Dynamic Simulation Wrapper (DSW)/ a7 g7 `/ }0 S
#; D8 N1 ?6 R% X  W, |2 o4 K* T
eval ${DBG_EPIC_WRAPPER:+"set -x"}9 W0 B. Y+ c, d7 n

$ x9 N# L. N/ n5 K1 Kif [ "$EPIC_WRAPPER_DVLP" = "" ]; then7 b, d5 Q2 g$ y: Q# u' o1 Q
    TEMP_ARCH="$SES_ARCH"6 Y3 M. X. u# {1 {
else0 k; l" }/ T2 S: h
    TEMP_ARCH="$EPIC_ARCH"
2 k8 x6 w% t) dfi
4 y2 f1 M0 V# O' a$ L! i  a6 J: u7 H
scan_for_hva_args()
+ U/ d, |7 P9 H# E6 g0 z{
$ ~  w* m, R/ L  /bin/rm -f hva.init 1>&2
6 R! f4 u( Z1 n: s' Z; s* K1 u  while [ $# -gt 0 ]; do
$ B+ A6 K: [+ B( _7 _! m/ E. ^    case "$1" in
* \! `1 K1 J* ~3 s" a      -vaf)4 [9 }* d( F/ Y: H
           have_vaf_flag=1/ W8 Q( P+ {8 E4 [, @$ h, b
           have_va_flag=0
! F3 J: c2 l* M; C0 m           shift;+ n  g: U8 q3 t" ^# j
           continue;4 i- o7 b! P! ~7 h* p
        ;;
- i( h9 Z6 n4 h, j, [0 _9 ?/ A      -va)
+ n' P: f& Q/ D4 k( N           have_va_flag=1, \+ d6 X+ Y) \( B5 f. e4 u
           have_vaf_flag=0
( M0 G% F- \  l' F1 \# q           shift;0 {0 O4 F& F* w' x2 M
           continue;
% m* Y4 T) U% w% H* y1 q" Y        ;;% i; F* Q9 \, J" I3 F+ S
      -*)
8 M% h; T9 ?0 C# q$ z" I           ARGV="$ARGV $1"
, ^2 \9 O# @3 Q4 }7 S           have_va_flag=0+ \8 g# N0 b- k' G" ^5 W$ m
           have_vaf_flag=0$ F- `- q& U% D
           shift;
, Z! T- e. B- D  ~% y  p           continue;( y  L! i* \3 b
        ;;
- n3 }& V9 @6 ^- ~) j% S      *). @3 Y+ D1 k$ Y" }
           if [ x"$have_va_flag" = x"1" ] ; then 4 b6 w, v* N+ w) f8 {, {
              VA_FILE="$VA_FILE $1"
8 u4 W  r2 R( j& M* x% V3 L           elif [ x"$have_vaf_flag" = x"1" ] ; then # W: B8 {3 W  {. L9 `! {+ B- w% k
              X="`cat $1 | sed -e '/\;/d;`"
; E% ^- F9 y- _4 h: M+ |" h              for token in ${X}; do
% g; s- g* Y6 Y                 VA_FILE="$VA_FILE $token"
1 j3 v% F! A5 }              done
2 H1 c9 Z0 @# [4 l$ o2 u4 G           else
% s* U6 ]4 V8 j: K' G              ARGV="$ARGV $1"1 _. z( c- S* V: `; u5 N4 w
           fi. k+ ]9 p* b4 K- E; ^
           shift;* D% Z/ ^1 Z& s! f
        ;;+ l! g, X) _& C3 c2 m4 s& p
    esac0 [7 ?. `, w) G" M! [9 y
  done
7 i3 ~" t  K- n2 I% Q
" o! W# }# n8 Y* O) S$ E  if [ x"$VA_FILE" != x"" ] ; then 4 ]" D8 {& P  s  c
##     /bin/echo " xxx ARGV $ARGV"
: x% G; o2 t. l" l       /bin/echo "choose nanosim $ARGV ;" > hva.init9 s) X' g) v4 Y' f* S
       echo vcs +ad=hva.init $VA_FILE -o simv) n) d# B& f' Q2 W/ n
       vcs +ad=hva.init $VA_FILE -o simv# G3 J/ W$ O; S' l% x8 \3 b
       exe_status=$?: n/ F. S+ B6 D7 z" n
       if [ $exe_status != 100 ]; then* |5 v) i! o: F, L! A* T
          /bin/echo ""
6 x+ v  E, v9 H. W$ N          /bin/echo "ERROR: Execution of vcs exited with code $exe_status"& r. G) t% r1 R8 z1 L, y+ W
          /bin/echo ""; q5 @  S# S' T
          exit $exe_status
( Q3 \* F; a5 M       fi
+ F/ u3 {, e, s       hva_files="-n simv.daidir/amsVD.ntl simv.daidir/amsWRAP.spi"
$ S6 e- Z3 s& r' Z       ARGV="$ARGV $hva_files"1 ~5 A0 l- Q  J6 v! |+ Z& T7 r3 h
  fi
! L. r$ }2 \* e! `+ J9 V}" [2 Y6 c3 F& ]/ x. z4 V
#-------------------------------------------------------------------------
2 n3 F! j% y& E  R( y) K: R1 N& o1 `% L0 [2 M8 {  a: G. `( ~
cleanup()) x: K( a" F! I
{8 I7 h2 Y0 g7 l+ H5 L4 `
    if [ -d "$rundir" ]; then
5 G, c; ^9 k0 V        # On AIX, a .nfsXXX file is created if libModel.o is removed, f0 y( z$ U* ^. |3 {  p
        # so .epicrun is not removed because directory is not empty.: z, o! @2 j1 z9 f
        # Solution is to remove it again if the first rm failed
/ J9 v. Z/ V+ s1 a1 ]        # (rm -rf $rundir || rm -rf $rundir) 1> /dev/null 2>&1' C: m; h) ^. G) b" v( J4 V( Z
        if [ "$EXTRA_CAPACITY" = "YES" ]; then$ Q2 E, p: l7 @. i( f5 D! B4 f
        chmod u+x $rundir/rpcidfile
* {1 L; D4 w$ y5 h        $rundir/rpcidfile, Z0 W+ y( r$ e9 v
        rm $rundir/rpcidfile
% \" B/ z1 H3 c9 @4 [: f: B        fi
2 x5 h8 P( i8 o# W2 f        rm -rf $rundir; u9 I9 o3 {4 K2 _/ |

. @+ n7 d2 J! W: t/ q) a        #Due to NFS problem, we have to copy files needed to
% O4 O7 B& Y& |        #/tmp/<temporary directory>, then symlink's files* G6 H3 z3 b$ \, H
        #to the local temporary 'rundir'. This avoids the problem
1 F, r* ]( |; X1 J0 x/ M        #to remove 'rundir'
1 N: m) D6 i& q1 y        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
2 Z7 h& r1 r- C          if [ -d "$tdir" ]; then
0 A' ~- G6 |: |  i: M8 d/ V9 R            rm -rf $tdir2 |7 r1 d. c2 T
          fi) Y( Q* p! p. V: o2 |
        fi% X* G+ B3 I' m  ~
    fi
4 {; D# i2 O; M" e" y7 _# R    if [ ${exitstatus:-0} -eq $ld_err_code ]; then: e' E$ W* t; B' b6 S5 ]$ N/ i, g8 ^
        [ "$has_model" = "YES" ] && rm -f $cwd/libModel$suffix1 @  o/ B: e8 h; e, R1 x
        [ "$has_custom" = "YES" ] && rm -f $cwd/libCustom$suffix
! ^7 g/ Z  f9 p( s5 R, t. O    fi- S7 X" K+ J# O% }
    [ -f "$EPIC_SCRIPT_MESSAGES_FILE" ] && rm -f $EPIC_SCRIPT_MESSAGES_FILE 1>&28 H, {1 X/ y$ e" k/ t$ b) b
    exit ${exitstatus:-0}- \% O- {: j+ Y& x' k7 m
}
+ G8 Y8 z0 h0 O$ N! {  W/ L; s6 Y( ~. H' V
Exit()% T* X0 F, _( X4 r1 z3 w4 a5 G
{9 E6 i6 n) e" l" X1 R
    exitstatus=$1
- |) ]% `" e$ o    exit $exitstatus0 h* T+ z" `$ }" x
}
9 X+ L" f8 S( W# o$ N5 A0 |) u$ y4 G7 ^4 @3 `
# get_epicrc filename keyword
* e9 C- q$ e# U% Uget_epicrc()
$ R3 d5 Y+ s& m# s{- X- B4 J% J/ A/ ^
    [ -f $1 ] || exit 05 h6 Z! {+ G7 ]9 W
    key="/^$cmd2:/{print \$3}"# H; w1 n9 A5 B# E2 c. x
    awk -F":" "$key" $1" ^0 c% K  d4 J9 L
}
4 i; R5 d2 t" z  [2 P9 A  }) q% S, t# B+ f" B8 V
#7 M7 H" |0 e7 Y% A9 v6 m
# set datasize limit to hardlimit) Z# w9 v3 A+ @7 ]# f
#
. R4 F4 x% B6 O4 `% \0 Iset_data_limit()
2 N+ ~  ]3 _" b' z2 m+ @4 S7 a9 o{# f/ I) Q0 g3 C$ w* m
    dbglimit=0
: N  I: R8 E% {* l    hardlimit=`ulimit -Hd`
) n& ?1 ~3 o* G; t. j1 A    softlimit=`ulimit -d`
6 N4 |7 f/ X7 Z    desiredlimit=3500000! T3 |+ }6 p+ D/ |
    hardisunlimited=00 l+ b- G! q# S7 Z& i
    softisunlimited=05 x4 n! P9 H5 n
    is64=0
9 K& D) ]0 ^6 ~: W1 z: I" S; ?' u
, z/ A* c% c) Y- h. j/ |% k    case "$EPIC_ARCH" in
5 l- }" M4 }1 I- T7 f( l* t    *SUN*64)1 M3 x, B( n7 T7 E" {0 x3 @2 c# J) l& U- B
        is64=1
" f9 V4 Z( X8 n1 _, T9 i" ]        ;;+ q  A& Q+ R6 z$ g, I' N7 Z1 N
    amd64)
4 d5 D+ B2 e$ H" A: N" ]0 N% T4 H+ c        is64=1
2 o8 g1 a4 J- X( g, p) g. i9 e- y        ;;* m, y8 ~, C3 f) D% d
    x86sol64)
- w- h" N# `2 q; P- E        is64=18 b! d/ n2 R' g! F, J
        ;;" K2 n, h, l" {8 V- t. k8 a
    aix64)
( ~  K( H2 J$ `. c        is64=16 i( D! I2 r! h2 l& r: K" `( n5 ]
        ;;( Y0 l: r6 y1 b' a
    suse64)
3 R1 z, a; [2 y6 g% s0 g        is64=1* \+ f: b2 s1 d  v3 v
        ;;6 C& b; \! v4 Y
    esac
! G3 [. r" C3 M+ W9 v' h0 E" Z8 ?% P5 U; G. Z
    if [ $dbglimit -eq 1 ]; then6 E0 f6 c9 h4 q+ M% E# ?0 W( C
        echo hard $hardlimit soft $softlimit
& h: @9 E7 F( m    fi3 g$ h+ F# K: v) B, c5 q/ B- Z

- U$ c( C' C! [% P- A" k, ~3 p2 m    if [ x$softlimit = "xunlimited" ]; then
5 N, E- J2 _. H4 w  ]        softisunlimited=1
' B2 U$ T7 U6 w9 d6 J. F' p- n6 z! ^1 a    fi
) ?/ y! P0 C) {/ E0 V
) {7 Y. k1 B3 v( i0 P+ p5 z, t, h    if [ x$hardlimit = "xunlimited" ]; then
# ]' @; y2 W# O2 ^$ f' d7 I  G. c        hardisunlimited=1. |. A' M% u4 c' t5 v3 Z
    fi
3 G  A4 \  A$ S* H' x' |- V7 h
6 q) b$ \' }- M! b7 T% c6 K  G  g    # 64 bit machine should have bigger than 4G( ]% G! M2 A$ _$ L# @' G( X
    if [ $is64 -eq 1 ]; then5 g5 P) S5 a; C! ]2 x
        desiredlimit=50000007 ^) ]! A* Q. P2 r# Y1 y
    fi
" S/ u- x' e8 V% B* u$ S' w
. Y' Z9 H6 p: |/ g" E    if [ $hardisunlimited -eq 0 ]; then
  E' N  N3 B* e        if [ $hardlimit -lt $desiredlimit ]; then- s: T5 v. R+ M/ n
            echo "WARNING: datasize hard limit $hardlimit K is too small."
( a7 E3 v* Q$ n* h' Y+ e        fi
+ H6 ]: o( D/ _& c0 @' c+ H    fi
( c3 J0 l7 m& Y9 o0 g% G: n) }0 S/ f/ f; L4 e9 b, N' @7 U' @  h
    if [ $hardlimit != $softlimit ]; then0 z1 `7 I& S' V- O
        ulimit -Sd $hardlimit, k0 Q* n) t5 C& i4 z
#        echo "WARNING: datasize limit is set to `ulimit -Sd`"& P# Z5 Q5 {: J3 X' K- p0 G
    fi
$ }0 d. R0 [* B  b1 M( [( i) ^
, ~% b9 z6 s% B% H$ M    if [ $dbglimit -eq 1 ]; then
( s& q- c( }5 K7 M$ u. o        echo datasize hard limit: `ulimit -Hd`
9 s) j, Q, T+ s, m8 Y+ K        echo datasize soft limit: `ulimit -d`6 E, S2 \9 v. _" B: X- h
    fi
* Y+ c% r/ T; m% T* R: @* D}1 w; x5 c& g# O( V5 T) I/ x
! B1 {6 J4 C+ q
#. y7 _6 ]$ I/ x9 y' ?/ s; [3 v
# set stacksize limit to desired limit! t6 D. t5 p/ K1 s, ?: D
#6 A1 |% R! `' o. \
set_stack_limit()1 A! J+ `$ P; }' W$ }3 a# ?
{# ?( O; |0 m9 V; N7 b& d
    dbglimit=00 S# `# V0 N8 ~# m5 n; s
    hardlimit=`ulimit -Hs`+ F' F' E: X4 `8 s
    softlimit=`ulimit -s`: K2 _4 k5 N+ w" a+ e, m1 ~
    desiredlimit=60000; v$ j& X. B  k2 f
    hardisunlimited=0
$ X1 o* i3 P; r! @* P5 P7 e# p    softisunlimited=0
3 x" F* |5 Y& [' k8 |9 }7 x' y3 C    is64=06 X2 l: y2 N2 d6 q! i
1 I: X9 ?. X3 i9 m' A7 X
    case "$EPIC_ARCH" in
( m, [, d/ _4 K* E7 t! L* Q$ U    *SUN*64)8 c) X5 |3 N& W) |5 w, @/ a
        is64=1; B9 `- _3 J' z5 \5 _+ r! g
        ;;( ?. D' V) d+ r) u: f
    amd64)6 `7 d/ U+ m3 Q1 f% L* h& _5 |
        is64=1
- T( ~; _7 c; X* ?) P. B        ;;2 }' ]4 k9 y3 b" X2 e* G% ^: {
    x86sol64)
# O  }# T" W( n! A        is64=1" C5 w4 l: h- v" l/ E8 i7 A
        ;;
/ O' B- T% E9 K' o    aix64)0 E, F. Y8 e* g6 D$ e
        is64=15 j3 E0 Y; o" v) P, {4 o0 }  K$ ?
        ;;
2 g* j) ?! d* S2 @8 E    suse64)
) d  j; B. z& L5 ^9 N        is64=12 J8 l# s* K6 L7 W) C! M+ Z
        ;;0 @7 L' s. W! F5 ^
    esac4 S& d* \1 d1 k' n
8 ^; Y! ?& a" d8 H( k1 U6 G1 X
if [ "$EPIC_WRAPPER_DVLP" = "" ]; then) I  p5 Y, I& a- b2 t' s8 n  `* Z
    if [ $is64 -eq 1 ]; then7 v  y  J6 Q3 i- e1 j3 b# ?
        desiredlimit=2000003 H/ O8 _6 J* D- p
    fi
& E. f9 [& R7 |8 Y( f) a% ^6 Eelse
) d) L) j; Y8 d6 \% o" {0 R  H    case "$EPIC_ARCH" in: g) k2 |1 ^5 u; A2 C
    *SUN*64)# w4 X! j1 T: m8 [: w) V
        desiredlimit=200000) E2 ]1 N* ^  M# V4 T# v; Y
        ;;
$ N& m0 |1 L  P3 h5 q    esac
, T' A$ M* X6 Q% r: z* x# ~) hfi
) k' u6 C3 R0 w$ e9 I' y        - ]7 u6 f. D6 J8 ^
    if [ $dbglimit -eq 1 ]; then
- p$ C/ V5 \0 X' \$ v2 U        echo hard $hardlimit soft $softlimit
) B9 Q% H1 j! y# A) M# ^3 V  q    fi7 x8 e% {% e! N$ I" d
) ~' N& e3 [' f. u$ Y
    #stacksize can not be unlimited, pick smaller number( s: K0 g2 ?: f; O! E' T$ _
( j( {& Q5 d7 A* ^3 f- b
    stacklimit=$desiredlimit9 P: @0 Q+ p; n8 H
3 f4 P  M) @1 u6 }. R
    if [ x$hardlimit = "xunlimited" ]; then
) D! Q* E8 c& Z& N$ g0 Y        hardisunlimited=1% Z. E' p: `7 c. c( p2 U7 N
    fi
$ A: a0 e5 I3 ?6 O+ x
6 J& L* s7 J' p& ~8 V: }) U% U9 u    if [ x$softlimit = "xunlimited" ]; then, s9 [7 l- w6 a7 y# N
        softisunlimited=1
4 g9 G( F# s7 r* }. {    fi
' B% H  o3 ~. u
8 W/ A2 ~  p9 S7 M* P2 T7 ]8 ^    if [ $hardisunlimited -eq 0 ]; then
' ]0 @- }/ c4 L4 r' o4 a7 @        if [ $hardlimit -lt $desiredlimit ]; then; t) \2 B2 j/ O  G1 h0 z7 ]2 L1 u
            echo "WARNING: stacksize hard limit $hardlimit K is too small."
, a& Y+ n0 V4 z: y+ f            desiredlimit=$hardlimit9 O9 w( l* K) ~- s/ V
            stacklimit=$desiredlimit1 Y) C5 D1 R7 W" }" _2 N$ B
        fi. b9 X7 s) r4 `( i
    fi
* A* f$ M/ W& }7 ~5 u* z- \; E* q) A5 T
    # desiredlimit is set to proper value (< hardlimit)+ Q. O/ g: }$ ^8 W* ^/ ~
0 G5 z* |+ S2 y" H" }
    if [ $softisunlimited -eq 0 ]; then' e0 S2 f& y3 h/ i1 Q4 I& T
        if [ $softlimit -gt $desiredlimit ]; then
8 q" Y5 U' W/ T" O+ ~: q: }, w9 e            stacklimit=$softlimit0 k( F& r% y: _# T4 z7 W
        fi
2 L% i3 o6 i% f8 z. |, K, [9 w    fi
9 H. |4 ?3 W5 p$ ~+ T/ {- N" e6 n( w, E
    if [ $softlimit != $stacklimit ]; then
, J3 w( ^/ E" j        ulimit -Ss $stacklimit
8 `' W3 E9 T! S#        echo "WARNING: stacksize limit is set to `ulimit -Ss`"
% s1 T2 n* I4 U1 m( r: i& S* O& ^  |- Y    fi( U  D: b! [7 V& U4 U9 N

7 U7 s2 V. J) e% S$ y+ x    if [ $dbglimit -eq 1 ]; then" n2 X; r3 ^0 @/ q! B
        echo stacksize hard limit: `ulimit -Hs`" m; i- q% B7 z
        echo stackize soft limit: `ulimit -s`  E' i; x3 j6 z- F
    fi* ]9 Z) T- f! N: v2 e& i  V
}8 ~  }0 [5 R$ w9 W. ?& i% J0 a; `
0 U+ y7 N. n: E* |; y0 A
open_epicscriptmessages()
9 Q- [( d/ y6 @0 O5 s8 E{
3 B/ K3 L) Q+ ^+ p5 d- w9 X#generate  temp ".epicscriptmessages" file based on pid3 \$ r) u/ h; }% [* ~
EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
, n% e/ c4 I9 h. l, \if [ -f $EPIC_SCRIPT_MESSAGES_FILE ]# U4 q& ~" X/ A( B+ g& s9 ~$ r
then
, s/ ^8 E! s1 q  w+ b  until [ ! -f $EPIC_SCRIPT_MESSAGES_FILE ]) s, Z6 Y/ m  I
  do" k; h) ~& ^' P; Y
    EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
& l9 m) q5 w$ l7 y" a, X  done; T. n# l+ p0 T1 A& i
fi
. A# O# I9 p0 |, M6 c6 d* ~
$ U. v- N5 o/ dexport EPIC_SCRIPT_MESSAGES_FILE
/ G5 q( z; j& X. ]}1 R% \. x0 a- @
" A% B1 i, |# \4 f& a

! R: s" k- S2 Xcmdname=`basename $0`
+ k, ]8 a9 m' U8 e0 p9 v6 u6 Rpostgres="n"/ T# d$ t3 G6 C. ~# H$ J4 T! O! @
ostore="n"3 j: l  ?+ N4 m) S$ }' }7 L
gui="n"
# t' D% I$ m* f8 f7 l. DdatabaseOn="n"  c% r5 x/ V' q3 T2 o+ Q- x! |
f_next=0
" {6 g, v! e. F9 ~) if_option=""( @- q1 u. h1 z' E
o_next=0
( i- r! u2 e: D& ~& io_option=""
$ Y4 e% x! O5 bworkDir=""
4 m5 w+ d, Q  @5 Z0 C. V, DworkDir_next=0# U: |3 O3 W. \( }7 v/ B
errFile="powrmill.err"
& W9 _5 y1 w4 g& n( z* C: Pwin32flags=""
1 d/ L. q4 B! I9 t+ oln_default="ln -s"9 ?( z3 F. @6 k6 r
5 |* X& k( r0 G7 L" f/ H
har_hilo_file=""
( o& p7 L4 B$ I1 Q8 }; X' u$ |' @& j$ u- Hhave_har_flag=0
5 G1 M9 b% n; L7 Ohave_har_setup_flag=0$ n% I9 {1 U. N; }" R; n" N, y  @$ m
is_special_har_run=06 t/ A# g* p6 W
har_ofile_prefix=""
9 d* M/ j) G8 a8 K& m- U6 I: G1 {$ ?# M/ Z& i
have_va_flag=0
! j4 Z6 B$ h* E4 w/ Uhave_vaf_flag=0
. R+ P  r  Q. J- h  L0 \VAF_FILE=""
0 z5 G) L% R5 Q/ k. l- n1 ~VA_FILE=""8 k! }$ [7 r4 E* `0 Q7 X
ARGV=""
4 F( V* U0 V" _4 z
4 D) R5 W. Z/ {1 K4 IORIGINAL_COMMAND_LINE=) Q8 d% i7 Q% a% s( [
LOOP_CTRL_FILE=".ns_ba_env"# V5 q: ^7 Y4 V) t
ALTER_HK_FILE=".alter_hkf"
7 F' \0 E5 d+ _( T/ p# lALTER_COUNT_FILE=".alter_count"; h' x1 z" g' y4 H# V
MONTE_IMG_FILE=".monte_img_f"2 P% |" s. C) N( {& s
MONTE_COUNT_FILE=".monte_count"
' o4 l3 x) b! C" V2 ^MONTE_CFG_FILE=".monte_cfg"
* V. H0 S; X7 J# g" k* vEPIC_SCRIPT_MESSAGES_FILE=".epicscriptmessages"; m; [# b6 p7 h+ r

8 c6 X  t( d& `% S% q5 oopen_epicscriptmessages $@
/ H5 b% x" {' |' t3 N& u9 N) [8 l& |# v! O
scan_for_hva_args $@
) [: x$ P. t' I: g- O/ g+ O2 r, d# B, y1 }4 ?  G
scan_for_har_args()
6 W# ^1 F6 M: v: o{
8 ^4 p( I6 l3 O; d' U( ]3 u  while [ $# -gt 0 ]; do
; j- M' \5 c  g9 X. e8 W" E0 G    case "$1" in
& b$ q. G' g2 y6 X      -har)
, I; b! g" f. S: d1 |& x( o( E           have_har_flag=1# Y6 r4 F4 ^0 s1 {( A! t% ]
           [ $# -gt 0 ] && shift
5 H+ I% F, d$ F, g           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then
; Z$ T! P0 ]' F+ R             har_hilo_file=$1
/ D2 F5 [' x% q5 {             shift7 W+ ?( R' j) k4 w
           fi
3 R% H- _# ]9 x) D6 Y1 {; I7 F) y           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then' L+ o3 E1 Y" w  Y
             echo "Too many arguments to -har flag. Only one hilo file allowed."
9 k# N9 \0 q  N             exit 1
9 v! D3 \$ h# C: Z2 d/ u# w7 g; _           fi6 d- k6 b2 ]& L5 o8 M! t( Q
           break! ~; K# q0 L6 b! i$ g( y2 E
        ;;
5 x. v: g8 O' a      -har_setup)
0 V: ^5 b& \, u( N           have_har_setup_flag=15 H9 h  r/ F! U7 l
           break
3 r. _  {, K0 s( V) I' q        ;;+ M1 y6 O9 s5 x7 v' O$ [+ m  D4 f
      *)
3 i  S8 _4 ^$ K2 }: \        shift' f% F" W3 C  C7 j0 A. E
        ;;1 w1 B1 D; `. I, f) R
    esac
$ n, R  k# ~0 W7 @5 a  done
2 C( _* U' |, j  K2 u& ?. a& {}
( s% Q* k9 ^* ?7 }+ N% _0 I5 x* N) p# Z4 e7 S) D7 _
scan_for_har_args $@
, b$ n. h) e! E5 [8 q. G4 ?
7 A  O7 `7 M; Y9 ~, @for argv in $@
2 w0 g. B- _: h  N% Mdo
/ ^" M$ x! c1 f* [   ORIGINAL_COMMAND_LINE="$ORIGINAL_COMMAND_LINE $argv"
2 Y* }, g9 m0 C" |( d4 J    if [ $argv = "-gadb" ]; then9 ?' o! z8 I; g* ~* Q9 F
        databaseOn="y"# I/ t2 K( F* D" L6 J' \
        workDir_next=1+ ^& {) A" G, N5 c6 T2 K
    elif [ $workDir_next -eq 1 ]; then
- A' y2 i# Y. i  v1 N# C5 A        workDir=$argv
9 c7 O/ ]/ L" ~2 k$ c3 V2 [* E0 F& _        workDir_next=06 @4 Q5 C! b+ K% w) ]
    elif [ $argv = "-ga" ]; then
. b: Z4 B8 i% y) ]  u4 T% k8 Z        gui="y"! K6 ]$ o& e# ]) W
    elif [ $argv = "-f" ]; then0 D% Z/ F* W$ m
        f_next=1+ U3 r3 g8 z* ~- j7 F: _0 q
    elif [ $f_next -eq 1 ]; then- N; C, A" W$ k" n, {
        f_option=$argv6 \5 z3 Y* d+ ]/ C$ h
        f_next=0
  |, [- U, ~! J8 n. f7 i    elif [ $argv = "-o" ]; then
+ @1 w# d* P% K7 O$ x/ }0 Q        o_next=1
5 \7 I7 {: K8 G/ y) B& L    elif [ $o_next -eq 1 ]; then
" N) R% a, B( [8 z/ f. y4 _; P        o_option=$argv
$ R0 V* T% K( o  S+ l. ~; v1 g        o_next=0
! a! w# ]1 m" m2 S" r( [. j# d    fi6 \6 Q4 s+ Y2 f; |$ G  t' J* C5 J
done
3 X) i# H1 ~3 C4 iecho "Command line options: $ORIGINAL_COMMAND_LINE" >  $EPIC_SCRIPT_MESSAGES_FILE 2 x7 K/ r6 j. b
: @1 Y* _2 i, J  A2 ^
if [ $databaseOn = "y" -o $gui = "y" ]; then2 f! P1 C# q- e4 B. D
  if [ $cmdname = "pathmill" ]; then
9 C1 K" j  F/ X! f9 K0 i    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5"  -o "$EPIC_ARCH" = "SUN4_SUNOS_5_64" ]; then
3 Z6 G: M( \1 k         ostore="y"" h6 p) M9 K0 z- A: e- a: Q9 `
         postgres="n"
) ~8 i, H' [, x; a     else4 F- B# I  I" j) b
        echo "athmill GUI is supported on Solaris platforms only" 1>&2 * z& C: F. x8 m/ \; l& \# m* `' }# h
        exit
7 {0 f/ }2 Z" `1 F) n3 Q     fi
; D/ U$ p# Y  ^  else
+ J( s) i8 s& t/ B4 K    postgres="y"
4 m' g& D' C' s) X* j% }         ostore="n"
/ J, J  ?$ O6 k9 i0 y  fi8 I) h2 S& W" M; b8 p6 K) s4 x
fi
) o4 w$ k6 q' k+ T3 d
$ d& p& }0 {/ M" k( e: ?2 Kif [ $gui = "y" ]; then
9 j' I* S. X* G! o: b    if [ $cmdname = "powrmill" ]; then
$ G- b. F# \5 |& Y8 ]' Y+ G        pwga $@
. c/ Z# u+ {) Q        exit. ?; j) ~6 T/ V2 S( Z4 z
    fi$ m9 z* L# {+ ^& N9 [; Y
2 @3 S# d8 V& ^. c
    if [ $cmdname = "pathmill" ]; then( c9 |' K8 d! b; N, J+ I, Y* g6 w' Y
        if [ $ostore = "y" ]; then
: C- d- E, j0 c: h           ./pathfinder $@
, S0 K7 B( \( I3 }3 d) V$ C           exit1 l% b. l1 I/ K( V7 i
        elif [ $postgres = "y" ]; then2 ]( R4 G1 z0 E; |) A6 e1 Q1 k
           pmga $@: W; k% k1 y" ~% u1 N1 m1 N7 Y
           exit
% {& s/ z& S+ H* G- _        fi" n9 j1 z: t' C" O' D5 G
    fi( L! g, @8 z: o7 h3 K
fi" t0 ?1 \2 A, z% y0 o& A5 U
* W6 C% ~/ U# c) Q: K
if [ $databaseOn = "y" ]; then5 V$ u% G& A$ l( G
   if [ $ostore = "y" ]; then0 W1 A4 q* y+ j3 }4 P( B
      if [ -z "$workDir" ]; then. `1 p" q% n( r: T7 V3 E* Y* R
         echo "Error: Missing argument for -gadb option"  Y! U% B! a: k2 M9 u
         Exit 18 S, L- \) l! o+ T8 z8 [" X
      fi. t  C6 q7 s5 R  {# i$ {
   fi; n4 F! w6 n2 g/ t2 {* f
   if [ $postgres = "y" ]; then
+ V" y! ?# A) O2 A- o; q      if [ -z "$workDir" ]; then
5 ~% Z- z# _* {) j, C         echo "Error: Missing argument for -gadb option"
1 Q7 |8 D  e1 y8 f         Exit 1& R' T* y) b+ N
      fi
$ A* k% ^' w! L8 F$ m$ p( G+ h' A   fi
: u+ Q# ^/ |$ {% X7 Y, D+ Kfi7 X2 k, Z/ i9 V% _8 s7 y# K1 D

4 H3 b: d' Q" z, _9 Hif [ $postgres = "y" ]; then$ ?& t" h$ k  F2 ?) u6 ~1 I

# S3 D$ I9 @# z    if [ -r $EPIC_BIN/scripts/gui-init ]; then
! d# ^9 Q9 H( A5 v/ U, X        . $EPIC_BIN/scripts/gui-init  `& f& _2 z3 d& r
    elif [ -r $SES_ROOT/bin/scripts/gui-init ]; then
: `; y& H) o; k0 @        . $SES_ROOT/bin/scripts/gui-init
; ~, K2 P( C6 `: S8 [    else  J  W2 L5 T5 X5 s7 G( A1 }; i' O) \2 A9 k
        echo " ** Installation in \"$EPIC_HOME\" has been corrupted!" 1>&2% @% u7 {; A3 e/ Q* B
        echo " file bin/scripts/gui-init is missing." 1>&2
; M) `' }# \; \% ~    fi/ W, r2 \5 l) ~; `* S) S% s
) Z6 p4 X, i. R0 y2 D
    workfile -tool $cmdname $@. H3 k" P) l$ Z; F
fi4 M- C1 C0 x2 l: t* J
) U% l! x  R' l4 d) E
if [ ! -z "$o_option" ]; then  f7 t  n: q8 e2 X: O
    errFile=${o_option}.err
+ ~1 I  {) v! X* N0 Zelif [ ! -z "$f_option" ]; then+ _9 ~  o4 O# m
    if [ -d $f_option ]; then" w5 X9 S; z9 @& }# k
        errFile=${f_option}/powrmill.err% M+ O5 {2 n- {
    else errFile=${f_option}.err$ V1 x$ f( {% {/ b# \
    fi
: K+ o" E5 ^1 d" o% Y, O0 N  ~fi/ l( P' z, _9 M" E

; Y( q7 V! q$ X+ P, }# `  Y" Y) l: X0 V
if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then# U& Y% C+ _9 X0 o" S! v
  rundir=.epicrun
4 x) o' y7 J. D$ _* w7 i9 A1 X* Y# ielse  r- }+ Z, V1 O9 J
  rundir=.epicrun$$) C* @9 T4 N) N; j
fi
/ P1 i2 M/ ^: ^6 ^* h! s4 c3 W+ D! m0 z1 e% ?5 [
libpath="$rundir${EPIC_DLIM}$EPIC_DIR"
# o+ J# m. t% M& M  V! y& A7 ]2 Z* [: E
cwd=`pwd -P`
% \6 S2 M5 W' x! H: q9 w; B$ jif [ $cmdname = "acehdl_w" ]; then1 @! D+ U7 d' d/ t8 K, u
  cmd=`basename $0 .sun`
8 @. M; X' S  i  cmd=`basename $cmd _w`
  R3 V; S- Y0 E3 {else
% a/ |: H$ B7 M4 W* F) G9 `  cmd=`basename $0 .sun`
% H1 ?, O: x; L2 X* F: s+ P) \fi+ b: c, g2 d; f  G) M+ X
7 o2 @- w/ R7 _- ^7 d. p) x+ N+ p& g
command="$EPIC_EXEC/$cmd$EPIC_EXEX"
5 t* ?/ ~# p& `" P7 W[ ! -x "$command" ] && echo "$cmd: not installed!" 1>&2 && exit 1' {1 M9 e% X) m

2 ~/ a: f9 X- n3 q# buildmod extracts -u/-fm options and calls genepiclib  |/ q! M& h9 ?$ A# O" Q& q7 E
# It also set the remaining options to variable CMDLINE
8 ~0 G" e7 g- e# look up in .epicrc for -fm & -FM parameters2 e( k8 b( l+ H$ {: `6 ?+ e
3 n% U; S* q# _
fmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`"+ p4 I1 V' P1 p3 E% H) X
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`"
- |  o0 B4 z' p* q' Q3 b[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`"7 D  W  ]* w4 E7 X2 A- T
4 r: K; ?# ^4 [
FMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`"
9 N* G. ?5 H( l% B7 c$ S[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`"
. _) A0 s$ d8 p  Y$ b4 B  m9 `$ n[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`"( ~% x% k2 R3 L- T7 K

. O9 u) E' j* t5 N% p8 Z( J* W. Iif [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then# E5 ]5 A" B6 {! g+ R# U
    # note that the buildmod script will set the CMDLINE variable
- }* q4 q1 T! h6 C% ~$ U    . $EPIC_BIN/scripts/buildmod. z* ~$ c* K* G+ @% j" {

* A" o: s4 P, P. f2 h$ c4 V* n    #echo "This is the value of cmdline=$CMDLINE"
! k( x/ s6 p% `) N: K/ @, T1 c    #exit 04 q" H" \$ t1 J' ]' @
. ]. H0 |+ L0 J8 b# P
    # if a new timemill/powrmill/pathmill built, run the new one
1 U6 E0 O9 u5 d* X0 O. x    [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX"
- v+ N% ?; \- d/ E/ nfi# X' n# m4 _% {) _

" t6 r9 v3 d* |( @: [if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then
, M+ t$ k; a- w0 }' v  H  if [ $have_har_flag -eq 1 ]; then
0 k1 @  D. O$ N8 _7 d    is_special_har_run=1% C$ A. ^4 d" u6 i
    if [ "$o_option" = "" ]; then
+ p; N" S" f* d/ Y- R      case $cmd in' k$ c/ P+ V: W2 O! [8 _0 D+ K
        timemill)
+ F9 H1 `4 C5 e1 X4 \) Z          har_ofile_prefix=timemill
5 |0 V5 W7 O) K' }          ;;# W  y+ P' g" P& A$ G+ g
        powrmill)
- B9 y  [( Z2 {. C7 w          har_ofile_prefix=powrmill5 v2 r# M% H8 |- ?6 ^
          ;;
$ z+ y; C& j6 s7 _7 b' d        nanosim): X  n+ G+ T! u, `  ~
          har_ofile_prefix=nanosim
. l! y8 G" t" Q5 G( e8 l# h9 y          ;;
& O6 t7 @$ a) B0 b4 ~7 y      esac
4 |8 B# y( S6 M: A" g+ {" Q6 b1 O    else
/ t3 K# D( F. ~! y      har_ofile_prefix=$o_option9 P3 N4 f5 ]6 u  S7 u/ t
    fi
" j0 b' y! Y& Y5 N% c& Z2 j' X fi
' Y1 o9 r! q6 G5 m  O6 v" qfi
# L# `- p" S2 d8 d7 G) @. s- i! t3 G+ _# g! s% Q
# Call Double precision version of the product if -D
* a+ d7 c5 {; x' t# or simulation time > 1,000,000 ns.( {$ H! Q, m3 ?3 |0 B
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then+ u# h. U7 A8 ]) @/ l6 ]- C
. z! M; f. A9 I5 R+ @
  # Now the binary always has the ACE feature/ p3 r! `) q( L2 b( M; Q7 x5 b' T0 K
  USE_ACE=YES  P' [7 h+ Z  {9 f  [% y' c

0 `3 i2 I/ V/ M  HAVE_DP=NO4 ~& f7 C  H" R
  EXTRA_CAPACITY=NO
6 y+ p5 g* Z# q) i  DB_REAL=${FORCE_DB_REAL:-"0"}1 f& h; e& c$ m' ?4 l4 [" k9 x. E) o
' g* H0 ]8 ]3 m7 `
  # Enhance for ACE ease of use4 [: x& a4 S6 M( [) j" I" t9 J) ^! V
  # If no command line option or only a -T option, do:
8 t) U- M6 ^6 `/ L  #   1. set -A option
, F, r) Z% e% W- P  #   2. assume input file to be hspice) E7 Z% o* E6 S
  #   3. set -o to input file prefix" k, R& X$ ?5 E* x' B0 T
  #   4. set -z to input file prefix
/ |3 R6 o+ K2 z% v5 G  #   5. set -c to default config file
; o/ J- K  R2 m6 e' p5 P& P5 d  netlist=""
5 I7 e' j- n2 z) q& A9 p  minusT=NO
4 l; X; L, w5 J: E. L  useStdCmdOpt=0
1 s9 I2 O5 ?- Y5 j  prefix=""
8 V1 T0 M  U: E: e  circuitType=""1 w. r' r0 ^" U5 ^4 |
  for opt in $CMDLINE6 @; z7 G& }" @
  do6 e0 R; Z( _8 {7 p' Z
    case "$opt" in
5 h  J8 m% A) q( \3 {% }! i$ |$ R      -T)
. t1 [& {  v& o6 l$ |0 T        minusT=YES
4 {' p  S1 q2 L9 |+ d, o. P        ;;: |3 J7 V1 W' F4 c. z
      -*)
8 }, ~6 y3 O, L2 {  g        # using standard powrmill command line( S1 ]  l+ G  @
        useStdCmdOpt=1
/ K/ p( X$ S+ ]        break+ a7 C; Y$ f. B% U  S
        ;;1 R5 ]  ?+ ]2 W' Q7 {& K! s( }
      *). q! y# N. B2 o# T3 y3 k
       if [ "$minusT" = "YES" ]; then. _! m3 K9 D8 C
         circuitType=$opt, s( S; L8 d  {
         minusT=NO  # reset flag
& ~5 R4 I5 X+ C3 T       else
2 r5 w$ L1 f; u; w( F6 |5 v; r( v         if [ "$netlist" = "" ]; then
( s5 i* s4 b. d5 {           prefix=`basename $opt`. n7 m( t7 ^# ^& I. g6 @
           prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix`: r  m7 s( S; y: J
         fi5 X- H( H+ A. Z2 s0 q, \1 F
         netlist="$netlist $opt"
6 G# @* @; m+ Y/ Z" D- a8 d) G       fi  k* R1 P3 D$ P/ g. j0 l
       ;;
+ S6 F  ?. W6 ^# x1 q8 V7 v. J7 ?- C    esac5 m1 R& T( ~" [  W
  done) ]! H1 T: o( K& t# @. S+ k( D
% X& J' x1 d4 b& G* u$ V2 l

+ R$ e) `8 y. R, o5 w( P, \  if [ $useStdCmdOpt -eq 1 ]; then5 w- p% a9 o7 d$ j5 [3 v
    # use standard powrmill/timemill command option
7 O1 {& ]( [2 R    for opt in $CMDLINE
$ A$ w5 w5 d1 A, K8 V8 x5 q. s    do  M2 J: f3 K8 I9 H+ d
      case "$opt" in ' y% n& Q  G5 z+ U" q
        -A)) |. o9 X. r" ~+ C
            DB_REAL=1
5 N8 q' U0 Z: T4 ?. n' g1 [" X            ;;
; B) I6 ?) X* v- {% g      esac% |2 j& d" W5 ?. Q$ q0 H
    done
, H( R4 f; v- W1 M  E' H    if [ "$netlist" != "" ]; then
0 `; q& p& B. h      CMDLINE="-nspice $CMDLINE"
4 j1 N6 ~8 s# {6 g0 u) `    fi
. y: K1 X# a" P( \; ^. h  else4 G6 u' B- i& B( X. w, x
    if [ "$netlist" != "" ]; then5 c/ `6 z- S' d: q- ?
      EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"}
' l; l" [# i( m# Z) b      # construct new command option: m* A" \" |; r9 ^
      if [ -f $cmd.ini  -a  "$circuitType" = "" ]; then& V# n7 o" [3 E! d
        CMDLINE="-nspice $cmd.ini $netlist"9 }' V% k- k  e1 P; x6 X9 A% n
      else
; ?; ~9 I. ~7 U, S- _        if [ "$circuitType" = "" ]; then' y% d* D8 u+ G. m# [1 F1 ]) k: h/ G3 n
          circuitType="msana"/ n7 Y4 u. K3 C4 `, V, U( Y
        fi: M4 e( U( M9 n
        CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg"
8 D/ O1 h; w' v$ f) G, I      fi
( o4 g  ^, S, M1 G) O+ e  c; A      CMDLINE="$CMDLINE -A -o $prefix"
1 _4 B) ]* ~+ u3 b6 H, F  k7 e      DB_REAL=1
) i' V! f! z- P, c; L3 w      echo $cmd $CMDLINE& o3 }! I( |4 |( q; [9 |& g
    fi/ j: \. t, }7 \
  fi
% T. `3 a9 I. _. Y3 n% a4 `  {fi # cmd is timemill or powrmill or nanosim or railmill or pwarc: m' g& M- e  u% a. k9 W
! {1 W& B: m" `# L
[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a"6 V+ u- W0 ]1 _
[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a"
2 w) L5 `) K& u. e4 x& F[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v"2 |( I8 K+ x& T4 B& b
% R7 F$ M  s* P- I: {: u# V
if [ "$__engine_wrapper_called__" != "Indeed" ]; then" J8 X: t; }2 [) E
    __engine_wrapper_called__=Indeed
( D1 p; H. u; b# {7 J    if [ "$cmd" != "amps" ]; then
  Q& }1 X& `! O( t7 z! ~% n& M        export __engine_wrapper_called__
9 o. B" m" F: S4 K! `3 S+ S    fi# w5 d7 P# R6 c2 S: s. }4 @0 b) r

* m* U" C7 P' u+ F' p    trap "cleanup" 0" b8 j9 W) C/ X  n, M  P3 C* e
    trap "" 2
6 P  h4 h% |* B! t6 O0 N- K9 _0 {2 f# j! X; T9 {! P
    [ -d "$rundir" ] && rm -fr $rundir9 `. ]6 l2 W' U5 |, E( }/ v
    [ -d "$rundir" ] || mkdir $rundir
' `% A- r! B- p7 Z# R; Y! |2 }. C( c4 w+ l/ c. J- `4 i
    case "$EPIC_ARCH" in9 [) t. `. }* Q; }3 r) N
    *SUN*64)   
. s* u# d5 u0 r: N4 B" Y/ a' O* H        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
1 d5 s- P, q* X* l- k7 s        export LD_LIBRARY_PATH" C  l, l; Z  ~' V8 e! G' x, w
        suffix=.so8 ?3 h7 Q2 C1 Z5 ~$ r/ _7 S+ k
        ld_err_code=127" U- E% n$ o. L1 I" p
        ;;1 x3 r% H4 o( T; J6 T
    *SUN*4)   ) _( T* o! c; ~
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
$ p+ U" r& ]' M$ u! O2 `. Y        export LD_LIBRARY_PATH
' f' Q. b6 ~: T3 N3 {" R        suffix=.so.1.00 v8 k: D2 f0 N0 I
        ld_err_code=127# t3 L- k+ D2 B
        ;;
$ B( F/ q; ?* X# o' @" g( M    *SUN*5)   
! O3 G( o. A  R2 E        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"% H4 T- V; {1 C; R5 I
        export LD_LIBRARY_PATH7 e4 N: n' D2 @0 c5 ^
        suffix=.so4 K8 I1 S. Z& n5 r7 S9 R$ q
        ld_err_code=127: s* z1 b6 @1 \  Q0 I2 a# p* p
        ;;$ G# {1 g0 P& L3 ~6 H$ \, X; a
    x86sol*)   
' u8 G) O6 R% W- y+ [        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
# h$ a6 \2 O: x        export LD_LIBRARY_PATH2 d: j5 X! E( _% {1 l* Z+ w
        suffix=.so" I# `7 y" X' z
        ld_err_code=127* V' Y) L2 ~+ k: p9 i! ~
        ;;
+ Z2 Q4 H# M" ~4 u1 o    *AIX* | aix64)   
9 N( u# p5 b  \/ M# Q        # When genepiclib creates shared objects, it creates a import file and 0 {; b: }. A& Z1 r4 u( R- A
        # uses timemill as program. So at exec time,program timemill is needed ( d$ Q0 U) K5 G% m! p# _( V' ^+ z
        # in LIBPATH  V7 z- ^0 j4 p
        $ln_default $command $rundir/foomill
! V% P' t, e; e) j5 A8 o        LIBPATH="$libpathLIBPATH:/lib:/usr/lib"# W) b/ j2 Q8 O' n( r: P
        export LIBPATH; V: T5 j) m+ x! [
        suffix=.o
8 X1 j$ |2 `% E: p* B! @, Q        ld_err_code=8
- I. N# e; H3 I" K6 |3 o; r4 K        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
7 m  y0 b$ `& N9 B. g- y          tdir=`echo "/tmp/d"$$`. g/ S' w! r$ P7 J1 x0 J" b
          [ -d "$tdir" ] || mkdir $tdir# S8 Z4 Y2 E# O7 [' Q: ?
          if [ -f $EPIC_DIR/libCustom.o ]; then% ?* p- ^6 a, y0 y
             cp $EPIC_DIR/libCustom.o $tdir/
- Z" o6 e% [3 k* Y6 S5 B             $ln_default $tdir/libCustom.o $rundir/7 o& I. h" L- Y" j! g" a, z2 l' f( O
          fi- L" ]- l& k/ |; V2 Y- v( C" q
          if [ -f $EPIC_DIR/libModel.o ]; then4 u1 J) H  A1 j+ T5 j% w# z  U7 k( d
             cp $EPIC_DIR/libModel.o $tdir/
( z2 M' Y* Z$ N  C6 V             $ln_default $tdir/libModel.o $rundir/
0 X* c$ }# E: k4 a9 z3 d- G. b          fi# {$ e" X: X8 f1 s5 B" i9 j& U
          if [ -f $EPIC_DIR/libFuncModel.o ]; then
$ R( A# ^6 @' b2 u2 P             cp $EPIC_DIR/libFuncModel.o $tdir/
/ [7 }3 z; ]% h9 f             $ln_default $tdir/libFuncModel.o $rundir/
" ?- a$ s4 z1 k. v+ t8 l5 Q          fi- `2 ~$ c5 L, {! Z: ~/ F7 \
          if [ -f $EPIC_DIR/libFuncModel.34.o ]; then/ E& i* p0 z7 A; Y
             cp $EPIC_DIR/libFuncModel.34.o $tdir/- Z/ z3 U7 x9 t) Z3 Y% T. B
             $ln_default $tdir/libFuncModel.34.o $rundir/
) V5 I0 ^! g0 k+ d8 K$ ~          fi, C  B% r9 h$ z4 I
        fi
7 h0 }. ?9 a+ R! ?9 h7 e5 {        #Set the IBM flag to enable more shared segids2 A$ P/ @7 ^7 C/ F, U
        EXTSHM="ON"; R5 l, b, v4 H( ~
        export EXTSHM
- Z+ ?2 ^" D/ A# e        ;;
5 k) z. {$ l9 Y7 v0 ]* l1 I    *LINUX*)   
% g' R( n* }) J3 y% y        suffix=.so
6 u" W4 c) t* `$ o- B( a        ld_err_code=1
$ n% \  b3 E) r0 s4 R        ;;3 l) O) V8 a3 N% @) @# ~- |: Y/ Q
    *amd64*)' [+ w9 m2 w. D) v) ]3 c
        suffix=.so
6 W8 e; T% [/ ?" |: g& I$ N! \        ld_err_code=1
+ v# a. I8 W& }9 b        ;;* b) T6 F1 ^7 e0 }# e( c
    *suse64*)
; f' ~9 C. s# w6 K7 V) f' E        suffix=.so
6 m+ X! o* x2 x. i; @        ld_err_code=18 n0 I0 Y9 ?5 e2 l
        ;;& u, @; A, Z; h/ B/ g$ \
    *suse32*)   
/ H6 R; U5 ^% @7 t) e7 U        suffix=.so
- ]% S# ?9 E9 v# C" y        ld_err_code=1& |0 m  _% F, v* f* A
        ;;3 f- D% S0 o+ L, [' k& t) z
    esac
; \0 ]  T" N- C3 n; U6 @7 E5 s: k7 v# e1 M/ A  A( C! }8 C
    [ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix"+ Q: p  p& ]: m, }5 ~, B/ f
    [ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \
/ P) L6 }, y% l+ Y        && [ "$cmdname" != "nanosim" ] \
2 c9 u; Y4 z/ B! b9 |- X3 j1 X        && [ "$has_model" = "YES" ]  && ulib="$ulib $cwd/libModel$suffix"
+ \8 {' i1 B& {+ u" I* V8 ]    [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix"
" Q  u7 d, e! Y: }  P$ q# B6 I0 t( b/ i# t* u
#Look for command line option for libFuncModel.so
0 M9 {0 B: [# A5 }& w: r#    user_library_next=0# q. K& \& ?) [% U- O
    has_fmlib=""5 O8 K2 _! W9 `" v/ b) Z+ f8 T
    for opt in $CMDLINE- G8 A( B9 n. [9 A7 ]! R( d
    do
& s& L. U% k4 c! \6 [      case "$opt" in
) X+ t* ~1 m, I& }& t" ^        -fm)- T! e$ M  h% Y& r8 W; p. ~
            CMDLINE="$CMDLINE $cwd/libModel$suffix"
3 G$ e' o$ {- K' V8 U; N            ;;
% d: L( v, ]# n, [8 L        -fm_user_lib)# t& U% i+ t1 {% r9 ?
            has_fmlib="YES"
1 v* y, I" F: c  H+ `#            user_library_next=12 x! n; z0 ^7 ?4 t1 N( o: ]' _; k; g
            ;;
3 ?( a; U. p$ ~* F+ h6 ~% R        -xc)
  ^9 E5 R' V6 e6 Q            if [ "$EXTRA_CAPACITY" = "NO" ]; then
( d% U7 c; c+ F) {            EXTRA_CAPACITY=YES  M* z) I/ q, p
            fi
) q, p3 H6 p" q  @$ R) L            ;;
1 i  o/ k9 {  s/ r4 D#        *)
5 R. g1 F( x. U6 g/ Z; P#            if [ $user_library_next -eq 1 ]; then& h/ X( u& u) Q4 h
#                if [ -f "$opt" ]; then
4 [. ?9 t* ^% P" ]0 z" h#                    libfmodel=$opt
; A0 o  }* h* n$ C; f% k#                else
4 B% r6 d" N: j6 e% k, g9 _#                    echo "-fm_user_lib: Specified file not found"
2 }0 z+ V' e3 H; |+ A% `#                    echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages
5 Z# Y+ J6 d/ F, k# \& }: s#                fi8 E8 F. ]" E- U
#                user_library_next=0
- k2 t) O( `0 T! J; \#            fi
3 H% T* H* x/ `* k$ j. o#            ;;
0 q1 @9 F" `& f  J1 ?6 t        esac0 T# E, t7 u3 n! d* ^# M
    done
+ A$ m: U" ?/ Z! y5 i+ W& n: Y5 i" o6 J0 |2 n
    if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then; ^4 `' c( `/ m/ Y
        flib=""5 o9 w  U% u& H' m' f
        if [ "$has_fmlib" = "" ]; then
! h, L& h: Q8 r8 N            flib="$flib `get_epicrc ./.epicrc user_libraries`"' t) n: r+ X# Z6 l$ v# E! W
            flib="$flib `get_epicrc $HOME/.epicrc user_libraries`"7 d- d' W3 n* G, c5 c  Y
            flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`"
/ h& [3 ~" K, i5 H* w2 ]) e9 t        fi
. T6 v8 d4 t4 _6 e    fi; ^& c9 q7 j5 K3 {, V0 ^$ T

& {; y" t  W( g( H0 T# k" t. @   for i in $ulib+ }6 i# h9 e) {& K( o" B2 o8 k
   do% O8 X5 a$ j2 b/ Q' @- {9 T
       [ ! -f "$i" ] && continue/ Q) b. z/ g, v3 @
       dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd
* }  P/ o  x0 a       i="$dir/`basename $i`"
% e3 B! s# L+ o" h* p& U( l6 i+ ^1 W       case "$i" in
6 G6 j. p7 A# G1 |. h& o       *libCustom$suffix*)    [ "$libcustom" = "" ] && libcustom=$i;;3 M3 [; B/ W% V1 |! t! `: j
       *libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;;
! f" ?/ ^  h1 U0 }       *libModel$suffix*)     [ "$libmodel"  = "" ] && libmodel=$i;;
8 J! a; x) H2 O  {9 U" y' l0 Y; ^       *libva$suffix)         [ "$libva"     = "" ] && libva=$i;;) {2 p+ r! N' C3 N$ t
       esac( n  d; L7 W1 O2 C- L0 a4 s6 F& |
       [ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \# [" X5 ?4 w' m  I: `! }
        && break/ C3 M  U+ t& g6 r8 t6 l5 K- t9 l
   done
, r0 O* g5 e8 V3 b  b  X# ~
3 Z- U$ M+ a7 D2 P   # symbolic link shared libraries to .epicrun$$$ V9 A6 y! P1 D. A) i. F2 R
    cd $EPIC_DIR; epicdir=`pwd`; cd $cwd. p# d. E( |$ j! H) Y
    if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then
+ N3 _- `" p# s4 u! Y) [3 J! y        if [ "$libfmodel" != "" ]; then3 y( N8 @6 [* u/ I/ ~, t
             [ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \
9 z# @, D0 u9 I, ]             echo "Using $libfmodel ..."  && \
- I/ q/ s; ?5 l+ J. d             echo "Using $libfmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE
3 j7 h0 y4 {/ O0 I6 {- Y0 P$ W             if [ -f $rundir/libFuncModel$suffix ]; then
3 @1 E$ y  d/ k$ t3 ~2 k               rm $rundir/libFuncModel$suffix# {! p& U( [+ u9 c2 H- F6 \
             fi% B# F+ `3 o2 V) P
             $ln_default $libfmodel $rundir 8 J  a) a3 J! o
        fi1 O. G- k- J+ r  M% N  f
        if [ "$libmodel" != "" ]; then
/ s& R% t3 x5 j) J( O$ K             [ "$libmodel" != "$epicdir/libModel$suffix" ] && \
& C% m( s8 m' m: S3 R             echo "Using $libmodel ..." && \
* @% l: H: u5 m: E: W/ V             echo "Using $libmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE, P, ]% F- T& |" s6 z
             if [ -f $rundir/libModel$suffix ]; then3 z( ^; }" _" }) y; o+ M% \7 ?( u3 Z
               rm $rundir/libModel$suffix
; i$ [7 Y7 \3 H" {" G             fi
  z+ Q+ a! g. D0 j9 `+ s; @             $ln_default $libmodel $rundir
7 _( `  i  {) l# j        fi8 Z  k' v' N( @" Y" k( E
   fi" N8 b# t' r$ p) `' }! g
   if [ "$libcustom" != "" ]; then
/ d5 U3 D, p6 R; @9 e, n+ {        [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \% v! k/ L/ ~, N  c/ Y$ M
        echo "Using $libcustom ..."
& t4 v% B6 W5 K; x# K5 V6 ^5 n9 f        if [ -f $rundir/libCustom$suffix ]; then
2 S: `, f% R" n0 E' j& W          rm $rundir/libCustom$suffix* r1 R; i+ f/ b, K  E* Q
        fi: ?: U4 j8 i  S, P# c
        $ln_default $libcustom $rundir 2 Y' W* t% L1 ]: d$ t
   fi2 {+ [" X/ u. u& J# K
, @' y! c9 t% D
   if [ "$flib" != "" -a "$flib" != "   " ]; then5 L0 d9 a2 {7 R0 i( ]- j* O- A
        CMDLINE="$CMDLINE -fm_user_lib $flib"
3 A' t; {: l0 N) {! S   fi$ t) Y9 u! Q  J/ L; i# w

- V2 A3 d7 S+ q0 Q   if [ "$libva" != "" ]; then
# F, H7 Y+ |' h0 G        if [ -f $rundir/libva$suffix ]; then7 U  u: W1 e& l) Y5 t9 D  N
          rm $rundir/libva$suffix6 `2 [" }5 G) h  e3 x
        fi
: J# k" W: C. l! k        $ln_default $libva $rundir / t( I0 W* v+ `0 Y: g3 I, p
   fi
: D6 }' L& X* T3 n6 C
( P' O6 n0 f6 E1 O# h0 {
1 g2 n( N+ |2 y  v; a3 }7 a1 b    # VCORE design library" A+ x7 d0 L9 Y$ S( }2 l( P
    if [ "$vlog_design" != "" ]; then3 {4 R1 q1 z! ~
        $ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`8 B$ W% u3 G0 l$ `% n
    fi
/ L$ s, M' X3 i1 d) ]& M5 |7 V; Z& k5 m" q8 ^
    if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then
: C, U) Z' S6 J' J$ S. g        EXTRA_CAPACITY=YES
% A) z$ b  y$ O: O+ u) r    fi
) O# P! m* Z' _' t/ b8 s( V2 U: z2 Y9 ^+ R  }" q" D  L+ f
    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc"
/ A+ k- a/ H% z) ]    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc"
0 @, [9 g1 g$ G  w) U3 K    #Create temp file if dual process is on
& w; D2 E0 u5 H7 m    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then
# e2 N5 h7 Z) f" d# V6 [. m9 |# _        if [ "$EXTRA_CAPACITY" = "YES" ]; then; |; [' Z% |: k5 n3 a% z/ j1 B3 X) m
            touch $rundir/rpcidfile5 f7 A, L8 H" c) j
        fi2 F5 M  F  H8 s6 r
    fi2 P' o; ]1 {* j0 ?
fi
; W9 ^+ ^8 k' f' v  y! N8 x5 C* U- W: y
run_cmd()2 I) E8 h- W; j& [. k6 R6 T( |
{3 e0 F4 u7 J  d) s4 f; V" p$ a# m
  command=$1
% U! T# q" F2 ~8 l# p+ {  shift6 Y% a# }: L8 v( p! g
( t# J4 Q" U, K
  if [ x"$VA_FILE" != x"" ] ; then
1 I" l, G2 J) n( Z9 }+ |     cmdline=$ARGV. [/ m/ e6 ~3 g
  else
/ {  ?5 Z$ |& ?8 D  t6 Q     cmdline=$@
5 l' a! L" D8 a  fi* m; c! U2 y' A: g- R& F

! X$ k3 Q* g& P6 V# F8 T. n9 x  debug=${DEBUGGER:+"$DEBUGGER $command"};8 H& J4 |' O) Y" e% H3 J7 e
- V# G& l. y' a3 C* Q. U6 b' {
  # To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a( @1 T* o6 L9 Y8 E
  # so save-restore may work.. |5 a3 q( i( x% E
  setarchStr=% I& A" [0 K: k" H0 F7 I4 O2 Y
  cmd2run=`basename $command`
$ D: c" t4 k. _8 D0 t" t  if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then  ?: L! P+ W9 x( r6 g8 D
    if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then
! K/ J& ?( N; Y, n/ p      setarchStr="setarch i386 -R "3 A8 D5 t3 ^3 c  ~
    fi
, \8 Y7 t6 n$ p0 B$ g    if [ "$EPIC_ARCH" = "linux" ]; then
2 F4 G9 L  M, V: G" k      setarchStr="setarch i386 -R ") N8 C4 f2 }) f$ z" S- {
    fi
8 b: X* y1 a8 u; ?# }6 i- ]- f    if [ "$EPIC_ARCH" = "amd64" ]; then( L8 G9 s5 z! N" f8 q, @+ b3 ?8 H  h% a
      setarchStr="setarch i686 -R ". m5 e6 E" ?  `( {
    fi
+ d7 Z; L( @3 n, H8 _7 b+ `( m    if [ "$EPIC_ARCH" = "suse32" ]; then. M5 {" U% ]* d+ ^
      setarchStr="setarch_suse i386 -R "
/ W' ^" F+ ^1 u. G2 x, X; H. R    fi
! u7 k- B8 G1 K' K    if [ "$EPIC_ARCH" = "suse64" ]; then
8 d" _, C- T2 S7 z      setarchStr="setarch_suse i686 -R "" g5 Y7 g9 B. K6 o' X
    fi
3 {1 `- [! b) O% P4 J' h/ y+ V, A/ l' y  fi- V1 G# k& [8 ?& \0 i) v; U

* l& w3 b0 @+ K( U" k  ret_stat=0
9 ^( f  N+ U6 H: B  b: |8 S  if [ -x "$command" ]; then
3 V# u+ m  O3 Q      if [ "$debug" ]; then
  G3 \5 ?% |' w        _debug_args_=$cmdline
( b, c, R! l. }2 I9 s5 q        . .epic-debug! b- L& j+ ]: K( }6 s4 m" g2 @+ i
      else& J3 i+ F3 p' X) ?% ?/ f
        DEBUGGER=; export DEBUGGER% w7 n& P: M2 a+ J# x! z
        $setarchStr $command $cmdline
9 a" j) B5 B5 X6 |      fi
: O$ V4 }% N2 O( r1 q      ret_stat=$?
; L+ ]" h+ X1 v) ?  else
4 g) ~. F- }8 x8 A  J    echo "Corrupt installation, executable \"$1\" not found!"
& k2 T  [9 Z0 ]- O    ret_stat=1
7 n3 l% @: g4 g2 a% b9 W1 {  fi
8 b- k4 v$ R: v, K2 p}
; {6 H, E5 m3 X: [3 P1 b$ |; D$ z" c! q, B0 h
# keep runing cmd if ctrl file exist: H7 w( n7 J/ h: x4 |/ {/ |. L

9 _5 @2 t2 V& ^1 z) S  E" N& Hrun_loop()
! z  \0 S( a# u- a4 W{
3 X3 Y" v6 L! }  command=$1
) S7 m1 X9 \" d: N, b; Z, U, b1 A- f  shift
1 ^$ U( C! s/ {1 b6 a3 p- ~& l# K3 z  k" ]& @) \. h
  if [ x"$VA_FILE" != x"" ] ; then
/ v: K8 T5 T' x8 v# p) q     cmdline=$ARGV: r, s& s4 W, R/ ~- O1 \" @
  else7 e& k. F' j; }) l6 W$ t
     cmdline=$@
8 m7 d9 q6 w( M9 I- l  fi4 }$ O& w8 s' a" y- M
8 A2 |" i. F2 v; q, q1 ]
  while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do# x& L3 }. O) y- h2 f
    . $LOOP_CTRL_FILE$$3 n. `# S/ \' m
    run_cmd $command $cmdline -banner 2
9 M6 g0 L( Z: m  done;
5 T) Y# L) |% S" ~2 A9 u! B. c+ [- I4 G1 G
  if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then
1 Y  _& q" u7 m  i8 A' d' h    rm -f $LOOP_CTRL_FILE$$
9 `3 t0 A: v/ b3 v* R$ @( o  fi
! q4 \; K9 N5 ~' U& N' P8 b" h}
- u( b$ ?- q0 I0 P7 C+ g
# p. {2 D, I; l7 M! Ehar_check_ret_stat()& M3 Y' B6 B; J( E" M! R. ], Q
{
/ S  D3 Z- h. \  if [ $ret_stat -ne 0 ]; then 6 F; t, n: ^6 Z% D7 N$ p
    echo "Simulator returned with non-zero exit status. Stopping."
* M* P6 S' [( w3 G" |8 W% f; H    exit 1
7 J* c) Z: @) c5 V  fi
  x# w, p! V5 H9 d3 j}$ Q. U6 H+ Q; d+ ^  a' v: ]% q; }" a0 w
* Y& M* u& ?( |( J2 y; V0 B
#% p# V* d% Y; `! _) F; m
# set stacksize and datasize limit
4 y! s6 l- Y  S2 ~$ U#
- }# W6 h' q7 J. C3 w* K
  |9 P4 Y) x/ E/ v6 \set_data_limit# q9 p8 \" `( `  e, [" ~! Y
set_stack_limit
& Y, p) X3 X) U+ g  v- K; b
$ n, Y' I" E; S#rm -f $LOOP_CTRL_FILE
+ C( o1 h+ R0 D- U
/ k0 ~, ~8 o* S: e+ s( U  }# v/ E/ g! k2 frun_main()
" e% M# z0 O8 ^' k, Z+ H) E{
* }' @9 \4 G! J) P+ x% @if [ $is_special_har_run -eq 1 ]; then! b$ ?, F* p; _% D. ~, e
  if [ "$har_ofile_prefix" = "" ]; then
3 b. n. _, Q5 u# H+ L: t2 p/ E" t    echo "Wrapper bug. Notify Synopsys technical support."0 K4 m( C) G" W2 D  K
    exit 14 O0 P3 I- h' b2 b: Z
  fi
0 ^( @+ V5 i7 R4 m% ~) c3 a9 A8 p  if [ "$har_hilo_file" = "" ]; then
. t" F: I/ z! r. E    # no user specified hi lo file - do both runs# O1 b' ~' }& P/ X
    run_cmd $command $CMDLINE -har_one -har_setup, n( z1 a: M: j* E
    if [ $ret_stat -ne 126 ]; then/ L+ _/ H, a% x* q/ e$ X3 z
      har_check_ret_stat
* A4 A0 \6 M0 x3 F3 u6 s5 k      if [ -r $LOOP_CTRL_FILE$$ ]; then
' b- z# n6 l; h        run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl- B- G1 M, s1 |& O3 a9 ^3 i
        rm -f ${har_ofile_prefix}.hl, _! d8 y4 g! H
      else
2 F, f% w2 y; g3 D3 v7 D        run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl# U  b" W$ b9 e- H. h
      fi. ?9 s; S, P4 Z1 G5 M
    else: s( t* Q. A7 t) e+ G4 l8 }1 @# m
      ret_stat=0# @5 }4 W0 b3 u: O1 r
    fi8 L4 G+ G/ d5 G9 D% e
  else
' N! p+ i- y: E8 Q; I    # user gave a hi lo file name+ O+ w. s+ H4 [! Y5 F, t3 T
    if [ -f $har_hilo_file -a -s $har_hilo_file ]; then1 [  a3 A2 V3 j! v3 M7 C8 l, M  |
      # file exists - use it - only do sim run6 o9 Y5 V( K) @) n. c
      run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}
- w. S9 F9 e) u      run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}  m" J( a6 |/ N) Y6 g# b
    else  Q( n9 ~9 d0 W4 |3 f, Z; c6 j# M
      # no such file - generate it - do both runs' h. b! `+ M$ o7 k  r  x$ F
      run_cmd $command $CMDLINE -har_one -har_fnf -har_setup
" F* K6 ^' M; b$ t      if [ $ret_stat -ne 126 ]; then
& M, N$ n9 R* r; \% ^        har_check_ret_stat  n. p( Z6 t9 [/ M
        if [ ! -f ${har_ofile_prefix}.hl ]; then" G* k* H( _6 U6 x1 b  r5 L5 X7 h# Z
          echo "No hi lo file generated after setup phase. "
$ {; _/ t9 M& f1 ?3 I) E          echo "Contact Synopsys technical support."
" Q" X- m3 L3 U0 Z9 Y. W5 {/ {1 c          exit 1
- o$ |, a1 z5 l& n, D        else
8 v# f/ }6 Y1 B* y          if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then
" G+ ?; I: F, g  Q$ X) f' N            mv ${har_ofile_prefix}.hl $har_hilo_file. {) X8 ?; ~. W0 a6 m# O
          fi5 d* [7 I( \% K4 K
        fi
1 T$ E) G5 v# f$ P4 f7 z        if [ -r $LOOP_CTRL_FILE$$ ]; then$ \6 k8 m# t0 ?4 W1 M6 H5 w
          run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file2 N1 _, D- ~4 H6 l
        else  Z4 R# G; H3 L
          run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file) M3 N1 o: E+ F0 V" v# I( a
        fi
, A1 s- D6 L* v: O' o      else 3 K0 U3 `& X1 f6 ]' X& K- G5 V
        ret_stat=0
- T/ Y8 T% a! I2 g( ~) R' [  G      fi6 x5 g& @5 n8 W: A3 y
    fi
0 M# T: \# h+ @  fi
% I8 u' \  P  w' Oelse  
' T- n2 v+ ~0 k& k; p: O& v& d- H# don't loop if -har_setup0 o5 {1 b& u* R2 V! s
  if [ $have_har_setup_flag -eq 1 ]; then
$ n0 f: x4 I' ]6 Q* a" B    run_cmd $command $CMDLINE
. C, F% V3 V8 L6 r% c) P* P3 ?    if [ -r $LOOP_CTRL_FILE$$ ]; then
8 A+ y9 ?1 e2 K& `1 S      rm -f $LOOP_CTRL_FILE$$
- [; O& M! ]6 c2 \$ _0 |6 c! X    fi
2 |- }# s4 y( t  else* O3 ~# w5 \' B. Y
    run_cmd $command $CMDLINE
+ l' Y$ W% i. p5 V- k* j    run_loop $command $CMDLINE
6 R( e: y7 \. P1 D1 D3 A  fi2 m& r8 T( N1 {( E. W# r
fi8 Z2 G8 l) v. k0 |! |) \2 M1 K7 h( ^0 w

# @$ I, W. C- O2 x4 Qif [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then
. a0 [- K1 a4 B, Z  pwCreateErrDB -w $workDir -e $errFile
8 U  ^; q8 r, C, G: s& m6 K& Y  ret_stat=$?
& b1 w' g5 {$ \2 V' {fi
  a. \' f7 J( y4 d+ m1 `6 f  W% ?}2 x. c4 [. q/ U: L& k) O- j/ X
5 |' Y1 {( ]- I, E( k8 N1 j; g
cleanup_alter()' I" H' Y+ ^2 r  m
{* y, C6 d3 v0 r4 q
   /bin/rm -f $ALTER_COUNT_FILE 1>&22 W- V1 X+ T0 s0 J
   /bin/rm -f $ALTER_HK_FILE 1>&2
0 L! }# W. `! D$ |3 P* Z. v! Q}( i  W$ ~' P  l9 u4 a. b/ k( i+ G7 }, ]
7 ?* o! x; U- |' k$ f  u) q
#generate alter temp files based on pid1 M. I( {8 ~8 ^1 ?
ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$
. ?3 z2 l/ M, U& \, ~if [ -f $ALTER_COUNT_FILE ]
; H& C2 p( s( E# G! l  [. Bthen
: s' g. x* Y( E6 K  until [ ! -f $ALTER_COUNT_FILE ]
) A& B2 |' @9 B  g  do+ I6 j, ?0 g/ u2 Q# ]& |
    ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$5 J# L' q2 K" |; N5 j2 b3 D
  done, Q6 {, t" ~; E, x
fi/ ?' ^! k: z6 ?8 O
export ALTER_COUNT_FILE
# S, s# Y, ^! P, j
8 M, }& u+ T* o" g8 K) \* JALTER_HK_FILE="$ALTER_HK_FILE"$$
1 a" x. L& i' V. \5 X3 V' a( xif [ -f $ALTER_HK_FILE ]- C0 K* ?4 }) c  r0 g2 t- n  M
then
8 E& u2 g; ^) F4 ?. |  until [ ! -f $ALTER_HK_FILE ]
4 b  O8 b. Y& q0 @. K8 S" Y  do. F0 k- D; D0 C- R7 E9 Y, v& u
    ALTER_HK_FILE="$ALTER_HK_FILE"$$* [0 S% Y4 L- F% t8 [
  done0 P/ W- S$ c$ ~$ A8 K
fi
' K/ o6 |6 S6 P/ `+ x. `export ALTER_HK_FILE! u' h9 P7 i2 K! P/ _" {& G

/ W* Y. {) U1 Z& I2 d; v) W; _#generate monte carlo related temp files based on pid
8 p# O1 P7 u4 hcleanup_monte()
/ m% |/ ?# X: p8 I1 K0 Q8 G{
% Q& s5 D0 W' o, q: U1 M9 m   /bin/rm -f $MONTE_IMG_FILE 1>&2% |; ~' |- G8 v3 p  g+ g
   /bin/rm -f $MONTE_IMG_FILE.gz 1>&2
" \' `- F, U/ l2 ]& A& v   /bin/rm -f $MONTE_COUNT_FILE 1>&22 i+ q1 u& F! z0 t9 f
   /bin/rm -f $MONTE_CFG_FILE 1>&2
! J- K2 E. }! B}
( V" j; V: V& e( r9 h9 g' D$ [% h0 d4 W
MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$. G3 r- P; D4 Z* w& p
if [ -f $MONTE_COUNT_FILE ]9 A: i1 {& s# v4 N: h$ m, R
then3 X- \7 W/ g( e0 Z  ]! F% }
  until [ ! -f $MONTE_COUNT_FILE ]( E" M6 P7 H* b- i) _( J
  do1 A- t! f7 D  e5 U6 t& R! [4 }
    MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
6 h* ?# R* q! R  done
) w+ d3 Z6 z* t- _. Bfi
  S0 O( ^$ _: {: S1 @3 g) k1 Jexport MONTE_COUNT_FILE" Y6 V! _" ]4 l, n8 [
' R0 u, B9 f1 |
MONTE_IMG_FILE="$MONTE_IMG_FILE"$$1 L. p1 _* a1 d8 U! p
if [ -f $MONTE_IMG_FILE ]* u# B  N" q* r+ P% k8 i
then1 N. J2 b- d9 W- [. g" ^
  until [ ! -f $MONTE_IMG_FILE ]
2 K9 ^, ~5 Y4 x, ^  do
$ J0 M8 z3 w( q. I3 f4 |    MONTE_IMG_FILE="$MONTE_IMG_FILE"$$
0 n( w6 X3 n$ i$ ?; l  done
2 J8 d( T( J  V9 H. H! Z3 ^fi
) _  c; o) n+ f, s0 P( z- Sexport MONTE_IMG_FILE
3 _+ m# S2 K$ b/ d& H+ x4 S+ |6 s% M. n1 y% F
MONTE_CFG_FILE="$MONTE_CFG_FILE"$$- G" _  T1 i) Q: s2 ~0 g+ [0 c
if [ -f $MONTE_CFG_FILE ]
4 S$ d! `. I- c+ _9 k% wthen
5 a& U. X7 L( {) \  until [ ! -f $MONTE_CFG_FILE ]+ n7 O5 W: e0 g
  do5 d; R9 m/ G2 W
    MONTE_CFG_FILE="$MONTE_CFG_FILE"$$
# b0 Y% L) A3 X% [7 B  done
  n2 M& `# I2 x2 d; |fi
7 o; Y( _# {6 Q4 s
0 W+ \4 ?+ c& L+ G' j( W# main iteration
! B5 E+ R( e0 P; h) |  c+ Grun_main
8 l  \4 M0 D- [; I: i8 l+ K0 G' u
if [ $ret_stat -ne 0 ] * s9 @9 _" X; z& G4 X$ G+ F
then / @% b) \5 x! G( _
  cleanup_alter
. k8 j+ @) g1 O% ^8 \0 ^3 }  cleanup_monte
8 Z/ \& X% K4 T/ V6 c  Exit $ret_stat
3 h1 J* C7 D+ g1 v6 l% o  E5 ufi+ }# q5 L- e* u

* O% ?! k4 @' a+ R% ]6 ^#Alter related iterations' F1 X+ q# S/ n, c, Z

0 I- Z7 [4 U6 }$ _4 }9 L8 y' ]iterations=0/ Z# b* D9 l" S8 J" i9 ]
count=0# Q+ g: P; Y# ]% t1 o& [# i
if test -s "$ALTER_COUNT_FILE"
% O$ l* Z2 v1 `then# C3 u* Z: z! J  y! i
  if [ -r $ALTER_COUNT_FILE ]; then: U- A' E6 ]5 X3 J
   exec 7< $ALTER_COUNT_FILE
$ n7 w' `" S3 A2 q6 }6 Q   read iterations <&7
, H' Q1 O8 i( W, z- i fi; ^# Z6 B/ c1 p5 p2 W
fi& d& r0 E! g2 o' p5 I* P5 R6 k
; h2 {0 D7 L9 L, A" M( S
trap 'echo Program Interrupt; cleanup_alter; exit 1'  26 `  X9 ?' C- |: G+ U  k# k
while [ $count -lt $iterations ]
* ~, W4 \$ k. Sdo' z. Y- R7 c9 \- F( [
count=`expr $count + 1`
! u( P% ]2 t+ ^6 l( u6 c% d6 O3 U ALTER_COUNT=$count
4 v) T; B/ g2 k6 i. r, b export ALTER_COUNT
0 X" Z3 H2 x8 g, N, b
3 s! J6 L$ Y$ K& i% Y) U3 h run_main2 ~. p; g; d0 q4 }6 V' u0 _

; Z, M3 P8 b, ^7 q6 \& F# Mdone
/ [6 `$ }4 W5 U/ |
$ Y. m" h+ Y3 T$ t9 p# M' g, R& Z#Monte carlo related iterations
! k3 B% K& a6 [' V. }8 m* f8 ?# b6 X, Z) y. D9 X7 }1 H5 P; w
monte_runtime_summary()
5 g& r! Y7 W" x3 C' Y+ R7 }0 @{/ y% m( I% ?, I2 H4 x, [$ X. p; S  v
  keyword_1=real
$ a; j- R7 O3 M: _  keyword_2=user- k# [/ x% Q6 G0 g
  keyword_3=sys5 A$ O1 t6 l2 T& c! z  H
  ofile_prefix=nanosim" K, T9 B+ c0 z1 O
2 Q  }8 s% @/ I8 h8 g
  if [ ! -z "$o_option" ]; then3 ]# q4 ]' g6 J5 O7 ?0 V; z
    logfile=${o_option}.log
$ n, f. L- g7 f  \) q( K" C  else
% j3 j1 t, l. H6 e4 P    logfile=${ofile_prefix}.log4 [5 E$ a7 S  P/ a
  fi
' u) I+ d+ [+ k- D4 f. @7 B! r; X" Q( T9 v2 p& t
  if [ -f $logfile ]; then* \. I# y& q6 ]1 M. M+ k' _
    echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile      
% \- Q5 y# Q, E- d" g) L0 @8 n    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 }' >> $logfile0 T8 @2 o5 r' I2 L) R4 F
  fi7 y% l2 K" i) Z# ^$ g/ Q5 f
}
9 b5 c* G- \' L* ?
% {9 S" P  p. N9 \) Rnext_monte=0
( x! J  b& h( z  K; Y5 tcur_monte=00 Y5 C$ V9 g) m. Y( A! \8 N' d
/ c8 }; I8 C" Q3 p) f7 M; V* O0 r
if test -s "$MONTE_COUNT_FILE". L$ f$ z6 L8 u+ O) I
then
1 _  m/ i4 U: N  if [ -r $MONTE_COUNT_FILE ]; then( Y$ {& Z$ c! ^4 q6 ?+ [
   exec 8< $MONTE_COUNT_FILE7 Q: r/ \( F* {; \3 Z$ d/ l
   read next_monte <&8
' z! `- C# k! O, ]8 e$ Y3 |  fi. L* x3 e. x% u7 V- o3 G
fi
+ d  K7 ]6 B4 @+ z. c" }1 H% d" p' ]% j* X3 D) ~) X' I% }
trap 'echo Program Interrupt; cleanup_monte; exit 1'  25 n/ {9 }9 q6 l& \6 t% C
while [ $next_monte -gt 0 -a $next_monte != $cur_monte ]: e% ~' T, J$ `4 u2 k- C  k
do
2 s0 [! Y- N. P  NS_CURRENT_MONTE_COUNT=$next_monte; F1 v' W( {# g; N
  export NS_CURRENT_MONTE_COUNT' R1 d7 H% y! V3 s& @" t
% m, I8 @/ K1 b; c
  echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE' e+ K- `  i6 N; D
  CMDLINE="$CMDLINE -c $MONTE_CFG_FILE"
" N, c, ~- s; h( r) b1 q5 i1 n  run_main
% A* F) i. s. @% \! _7 J  R$ h; `0 q# S! D8 m
  cur_monte=$next_monte% J# Y# m  \& |5 X# S
  exec 8< $MONTE_COUNT_FILE
5 w* A% s3 Y0 i! S7 b( B; J  read next_monte <&8
8 W; q: z. f" Ndone
) b6 Q4 C  g1 y: f1 P, X
$ o5 a" Q* D/ ?  [& p. @if [ -f $MONTE_COUNT_FILE ]# v, D" V  H8 H4 i* X( X
then
+ S2 ?2 [# o! u& e% O# R) l  monte_runtime_summary9 }$ f1 L: B7 r0 D" c, N
fi
; g; l& V/ d# U6 F$ `. J2 H
) }' _6 \" e$ j0 Z  o# ~1 ocleanup_alter6 E  u  y) l$ J7 ?) N4 k; C
cleanup_monte
/ q1 p  N8 k& n: }2 P" p0 O3 P1 ^7 m2 }
Exit $ret_stat

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

使用道具 舉報

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

本版積分規則

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

GMT+8, 2024-5-20 10:36 AM , Processed in 0.140018 second(s), 17 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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