Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

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

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

[複製鏈接]
跳轉到指定樓層
1#
發表於 2012-5-6 13:58:13 | 顯示全部樓層 回帖獎勵 |倒序瀏覽 |閱讀模式
10Chipcoin
各位大大好:7 T- j$ c5 [, ?0 {: g; x
                      小弟執行nanosim時,卻無法跑出視窗來,有個錯誤可是我不清楚該如何解決?問題如下
/ l0 X! J$ Y, a6 ]' @3 a! \                      [: 113: 64: unexpected operator+ Y4 q$ ~. p6 h* u* o: c
/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim: 1: Syntax error: Unterminated quoted string& ?4 X: r; N  z
有大大遇過這方面的問題或是指導我方向去解決, 謝謝.
/ h, }/ g( n7 l: Z0 h+ p我在猜可能是這個檔案內的文字需要修改 但不知道該如何修改?# m. k  n' X. g3 E0 Q6 O
以下為/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim 的檔案內容:
1 o7 R# {7 \, |+ A  V: r2 S$ W/ L    #!/bin/sh
) l: s- I' X( n! I#
; H3 |' Y* z% E# Copyright (C) 2001 Synopsys INC$ f6 j* x% P8 b. i& Q7 Q* z2 n0 Z
# EPIC Dynamic Simulation Wrapper (DSW)2 i+ d7 j8 k; K* m
#
* t" W% R( M8 G/ a9 b# Veval ${DBG_EPIC_WRAPPER:+"set -x"}; @1 I3 m1 F, E8 |0 a7 f
6 \- G  G* y7 L7 m6 M  V  _
if [ "$EPIC_WRAPPER_DVLP" = "" ]; then6 c9 k8 ?9 m& j* s: T, V2 j
    TEMP_ARCH="$SES_ARCH"4 s. z, j; ]4 B1 o
else) @+ n9 t6 b1 U+ L
    TEMP_ARCH="$EPIC_ARCH"
) Q* I5 o+ U6 K) S6 ^: \fi3 Q' S$ g4 d3 @. }8 V6 u4 L  @

- L2 O. ?* K( Qscan_for_hva_args()- w/ {% U9 n3 C
{
# b" [  \  _" o" w2 k! }* w% A# U  /bin/rm -f hva.init 1>&2
! r) \9 T9 E, H  while [ $# -gt 0 ]; do# l# h' o- r% q8 k
    case "$1" in
3 z; Y, m/ K4 n# L. Y6 V- @      -vaf)
3 k/ {  A/ L# z. Y8 {" M( h& j* X           have_vaf_flag=1  I* x7 P: T/ T6 w/ q4 D0 J7 h
           have_va_flag=0
  r6 N2 u: r1 b2 K* ]8 P5 c           shift;/ ?/ V4 }. v% j
           continue;
. t. b; o1 L' H        ;;' m* @9 M: {% y4 f8 G5 {
      -va)
( o6 |9 \: q% K           have_va_flag=12 H7 k( w! a5 I' i) p6 N7 _/ n
           have_vaf_flag=0) v( H  p# C1 d  z
           shift;8 h# c& k! f" K1 a9 S( W2 R5 b( m
           continue;
1 }) e; }+ G; j1 a7 y        ;;
/ \  w+ D& ?0 ~4 V' K      -*)  t! _: k$ a9 k3 ~, o6 F
           ARGV="$ARGV $1"3 V5 [, n/ o. M$ P
           have_va_flag=0
' ?! ^' K7 m9 ?8 k+ V           have_vaf_flag=0' T7 K9 q  q+ D; q
           shift;* E4 @  _$ h6 B6 C0 H4 A
           continue;$ S8 x, `  H3 R4 T: Z/ K
        ;;
+ e7 H* h9 e; p' z7 \& E      *)
+ ]1 F, Y( N' z) Y0 b4 o           if [ x"$have_va_flag" = x"1" ] ; then
+ r+ L! [8 T: o$ @              VA_FILE="$VA_FILE $1"
4 H: V! {" ~5 i1 U           elif [ x"$have_vaf_flag" = x"1" ] ; then
6 `: P& \: s8 F% n  X( E! J, o              X="`cat $1 | sed -e '/\;/d;`", C. g2 c, x- `( j
              for token in ${X}; do
% n, r: I: T% s$ t/ y                 VA_FILE="$VA_FILE $token"* s7 |% W+ ]0 {7 x# A2 k
              done & ], @7 F+ U( d; f+ _2 t, i5 X
           else
: e# t. G, }9 H8 w( T. q# A& ]8 V: N$ |              ARGV="$ARGV $1"
7 _3 P" n  }- F9 p; z, T           fi
# ~) V" t3 y: }. ?: \           shift;
" T& L6 u/ |4 ^        ;;
6 O! x' K8 Z5 T0 G' c    esac
' [+ T: W2 u4 {# P! ~( N  done9 p$ x* e% z# x6 n
- S6 J" \1 E! ~" M$ ^
  if [ x"$VA_FILE" != x"" ] ; then
. m- V3 v9 G5 S" I3 \) [##     /bin/echo " xxx ARGV $ARGV"
0 J" @& s+ I  Z. o       /bin/echo "choose nanosim $ARGV ;" > hva.init
* V: |3 R# g0 u- u* a       echo vcs +ad=hva.init $VA_FILE -o simv
$ h7 h1 ^0 K; N: ^- L/ F7 [       vcs +ad=hva.init $VA_FILE -o simv
/ \5 I8 Z$ J1 ^8 D       exe_status=$?
& _: Z7 w! Q3 y4 u       if [ $exe_status != 100 ]; then
; G9 I* B/ J; @  ?! `) Z          /bin/echo ""
. b( `$ x# q9 U6 t) _3 E1 ~+ y7 a          /bin/echo "ERROR: Execution of vcs exited with code $exe_status") ]& ~. V3 h: e. L8 t$ @! r, \
          /bin/echo ""
. P/ R8 j: o. F          exit $exe_status
4 }/ V+ Q( E6 e4 L; N       fi6 @9 R4 ~& M3 N" ~+ \! A5 w
       hva_files="-n simv.daidir/amsVD.ntl simv.daidir/amsWRAP.spi"4 r9 Y4 f& R% L. b/ E( ?
       ARGV="$ARGV $hva_files", V/ `/ Y( G! R/ @2 G" Q
  fi( i& s/ G4 t6 i3 q
}3 A* J6 ]0 @0 E( j9 ~' L% T7 P* y% F8 t
#-------------------------------------------------------------------------
# l1 g" k' h$ z: ~9 v  ^# W4 ?! z$ Q+ \( I1 Z. k
cleanup()
9 w" ]; O1 H4 T" o/ f5 i{
% b9 }4 Q+ g; c- {. y    if [ -d "$rundir" ]; then
' K2 k+ }# N. x3 G: B        # On AIX, a .nfsXXX file is created if libModel.o is removed  d# p% v0 K! n5 K. s
        # so .epicrun is not removed because directory is not empty.. i  R2 o2 x8 K
        # Solution is to remove it again if the first rm failed
3 z% |; i+ K' `7 }) P! }7 P# C        # (rm -rf $rundir || rm -rf $rundir) 1> /dev/null 2>&1
3 m4 w. X2 S2 m# v# a        if [ "$EXTRA_CAPACITY" = "YES" ]; then- A3 e! x% L" \) x7 C1 L3 Y
        chmod u+x $rundir/rpcidfile- F; o( E; b4 O) H3 Z6 [1 r, H3 ^
        $rundir/rpcidfile! z* ^! B% N/ L, j, P' E+ n
        rm $rundir/rpcidfile/ y8 z4 x, N& v# s1 {. Y/ `
        fi
3 j6 y3 J- s# g  E+ d        rm -rf $rundir+ ^1 R/ ]5 R( D) p2 [2 K4 u

* I, Z+ v  @7 a8 _$ j( b8 E$ {9 p2 k" @        #Due to NFS problem, we have to copy files needed to  \$ y' j4 h8 @4 U: v: H& }7 j
        #/tmp/<temporary directory>, then symlink's files; U" Q+ O  E' X* a2 g  g2 ?
        #to the local temporary 'rundir'. This avoids the problem
! N; V/ l# `5 O2 ^; Y" t3 p        #to remove 'rundir'  A/ Y9 j. @8 b' S* Y  S% k  B
        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
2 f5 f- L' v) D1 u. ?$ ]6 _          if [ -d "$tdir" ]; then) a2 P, U1 U& A* X
            rm -rf $tdir
' D7 B5 y, f' h          fi& z7 z/ H8 s: C" }2 n8 _5 [, F
        fi/ I! D! f1 P  G* r3 Z' J
    fi% V2 Y  z( y. ]; K9 D
    if [ ${exitstatus:-0} -eq $ld_err_code ]; then
: l' H* R2 l$ V# B3 G$ D( D# D        [ "$has_model" = "YES" ] && rm -f $cwd/libModel$suffix& \- I  g/ c6 S& `
        [ "$has_custom" = "YES" ] && rm -f $cwd/libCustom$suffix
5 B6 U6 V- |9 s1 b    fi
8 ]  D2 `3 h. v/ T  H    [ -f "$EPIC_SCRIPT_MESSAGES_FILE" ] && rm -f $EPIC_SCRIPT_MESSAGES_FILE 1>&2% G5 p; D( o8 L9 O) \/ M
    exit ${exitstatus:-0}' w$ ^  {2 @9 ]1 K9 M7 }$ L; c; P6 x
}3 i& V8 G7 @' c) |; M% l
8 I6 c$ m/ T* j# c* g* Z- y
Exit()6 V9 X5 G9 j9 a5 O1 x  w5 b* E
{
0 N* u, p1 Q( h! n- K    exitstatus=$1
8 B0 Z2 o/ s5 ^/ b    exit $exitstatus5 z+ H+ x. k9 d8 `. g; q( L6 l" q
}0 K$ T$ j8 u8 r
* i- q0 u" j  b8 S) X
# get_epicrc filename keyword
: o; p5 G& }, E) D  w! q+ Qget_epicrc()8 r6 a: |& Q2 T' y$ L2 O% g
{/ D' o1 W+ k; M; t# `! s
    [ -f $1 ] || exit 0
: q/ L, W# ~6 K7 X, Q/ @; `! e+ u    key="/^$cmd2:/{print \$3}"/ C, V: ?9 m( w& c. n
    awk -F":" "$key" $1: T- ^, F! Q/ f- ~9 i2 U* ~# T
}  s* R' _, l0 a
9 d0 k  _0 y6 y
#! D1 Q% M) o) S' P( Z4 j+ R; \
# set datasize limit to hardlimit6 f2 X" M; G: e# l! F
#
& X8 ~+ f2 U/ D$ j7 Bset_data_limit()
) ?1 R2 ?  c5 N+ X; q{
- m( i3 ?" w7 ~0 n  T! W' e* \    dbglimit=0& R+ m( P# Q( ]) o
    hardlimit=`ulimit -Hd`$ Y  ]0 H! O! v6 W: B( R( S5 a" k
    softlimit=`ulimit -d`( ~, G0 A: i# Q/ e3 n7 _% R
    desiredlimit=35000007 u* D9 j* f& @
    hardisunlimited=0
' P9 {1 I  Z3 w" E: X' M2 c- D$ V0 Q    softisunlimited=08 X* d5 y9 V+ C% K+ X7 b: G
    is64=05 F  ^7 s$ E& z. G0 _

2 R8 ~. g- L" S    case "$EPIC_ARCH" in
( A6 Y4 F$ k$ p# j, E* u" [    *SUN*64): v( D* ^' a; ?; L: R4 j  i8 \
        is64=1$ [7 \% ^# i, U+ V! a1 k
        ;;9 |6 b4 C! _/ ~! Z5 X
    amd64)
% B" J! b2 c! M* e: i% }- T! c        is64=1) w& Z6 P6 K# t0 z( h
        ;;
8 P5 Z2 }* ^$ J$ v* E6 Q    x86sol64)* s  U3 {$ A$ k1 Z" r, b& x
        is64=1
$ c/ X( d: k$ E  a        ;;
4 ~0 P5 l. P6 O0 T( c. S( w    aix64)
! U  O5 M+ ~0 Z* L# r        is64=1
, \! x# p& {* J% L2 P        ;;2 u- q1 Q4 S/ Q
    suse64)
4 q' m3 A" o8 x/ w1 A* |9 M        is64=1% E; q$ y5 S& [& W$ b
        ;;
- U5 p7 g5 W5 [1 t$ ~9 d    esac
" @4 m& L$ [) S' g
$ e# J7 q+ p8 Y- r+ L    if [ $dbglimit -eq 1 ]; then4 \  s$ D7 v2 D) K7 _  Y/ F; `
        echo hard $hardlimit soft $softlimit$ g! n* c" E8 y! m
    fi
8 s! q$ K: N/ x+ K0 e7 ]3 s& s! K3 z5 P
    if [ x$softlimit = "xunlimited" ]; then
$ ^+ I1 Q5 p3 ^' a6 E        softisunlimited=1$ _( Q% L( c/ _( t9 I7 ~) K$ c
    fi
% ]3 c. {2 P! M/ h9 n  \. D: S: ^
9 _$ ]6 J& e$ s5 j6 z3 D1 y0 A" T    if [ x$hardlimit = "xunlimited" ]; then
/ }/ C4 z+ [$ D' \0 V        hardisunlimited=1
, V6 a0 M# q- m1 g7 x: w    fi1 {% K1 s. Q) L& G" |6 }+ j5 b
0 H1 ~! ^) k4 W: C0 d# s) ~
    # 64 bit machine should have bigger than 4G
( M( o& |+ Y' L+ T/ K3 ?( m    if [ $is64 -eq 1 ]; then
8 Z/ Q  W+ i5 Y; x" s        desiredlimit=5000000
. U4 d" k% e  Y2 C. N: @# h    fi- t" ?/ }, k9 `. ?

: f0 n( U$ v6 e/ m8 }6 Z2 B2 g5 r    if [ $hardisunlimited -eq 0 ]; then
6 g* {! M8 e7 ~" @% a6 \  n        if [ $hardlimit -lt $desiredlimit ]; then
! G0 N# C% ~' m            echo "WARNING: datasize hard limit $hardlimit K is too small."& [1 e! q" a3 q* t- a9 l
        fi
7 k9 h3 i" p, ]6 V) v# s    fi) O" u5 q2 A9 U/ J2 }$ c2 S

& `& F$ A' \6 q  M& n    if [ $hardlimit != $softlimit ]; then
" E) u2 `7 V) e% n        ulimit -Sd $hardlimit
6 }* n2 e* f' u1 q  A2 T#        echo "WARNING: datasize limit is set to `ulimit -Sd`"
. o/ }  U4 w  I& M$ g$ D* G    fi
3 }' c; j, A; s7 u6 S: [, q. V# n0 w. c* A
    if [ $dbglimit -eq 1 ]; then: R5 b! m' S$ G+ ~: g0 u1 H; M$ K
        echo datasize hard limit: `ulimit -Hd`
' }) p) C5 ]2 w) b; t) C3 I        echo datasize soft limit: `ulimit -d`( }# u) m9 A# ]. O% [
    fi
* c$ V! y' L' U% h; Y2 P5 `. `8 z0 r}
! p9 l8 l- B( Y" a4 T1 B( X
4 w9 H# k* m9 L# o* B( t# U4 [#: B. ]9 E: F. `' n7 s% n
# set stacksize limit to desired limit. ]# ]4 z' _+ g0 i9 }1 H5 E2 o- C
#9 y7 V7 F0 \4 I) n
set_stack_limit()- K" s+ ^$ t9 [$ i3 e
{
) {( P1 v' }  F& O    dbglimit=03 R3 z+ l/ r, U: i9 g4 \2 P
    hardlimit=`ulimit -Hs`% u. ~" p( r; ]
    softlimit=`ulimit -s`% k! B% [( r0 R8 N
    desiredlimit=60000
( l8 p# p+ P9 ]* X) o7 R8 ~/ G% q    hardisunlimited=0
0 @. ~3 d+ |" A9 B7 S* T    softisunlimited=0' ^: k& y  Z! D- J6 R/ C1 _
    is64=0
% `: v' D9 q9 ?4 k2 C# I+ m' _4 q' x9 J6 o2 Q
    case "$EPIC_ARCH" in" G' X  A, a1 ^& r+ V# a* M1 S
    *SUN*64)5 G8 ?# u3 o- J) p! X- b1 P* |
        is64=1
6 O( y3 t6 M* u  F  s; Y8 g        ;;
) a% G- B# j/ Y) U( W    amd64): W& ]. `6 n/ ^/ Z: Y# L2 x4 Q; [
        is64=1- Q) V: E' i2 c, _& u# E
        ;;  I/ c  C0 X& ?, W+ ~- v
    x86sol64)
% ]+ e3 o3 w' Q4 q/ @% O7 K        is64=19 L" Z! D" N, \3 m: d$ g
        ;;
/ A" P- I2 Y. d+ a# a; X7 x    aix64)
8 }) W# J, x% E4 d        is64=1
7 I, Y  D; s% X        ;;& x0 k4 t$ u7 b2 i; r9 E8 \  I
    suse64); Y. Z. J7 b9 o6 \3 l1 Y
        is64=13 ?3 e& Q) N& P
        ;;$ z' e7 V" H  A+ D  h8 ]6 d& G
    esac
6 Q6 k. Y4 M3 ?5 X: X: _' c6 p
6 l9 Y4 m9 A! k0 ]; Wif [ "$EPIC_WRAPPER_DVLP" = "" ]; then9 V$ w5 J0 b3 _) U' m( d
    if [ $is64 -eq 1 ]; then
2 _+ @6 P0 n7 V$ g# {9 |        desiredlimit=200000' z, y2 R! N5 K5 J+ j
    fi
" `) d3 Z; j1 T" e$ Felse/ p- b; C0 m6 K1 W. e  a9 W
    case "$EPIC_ARCH" in  X0 ^" o! b) ^; A! O
    *SUN*64)
! i- l. S, B9 A. ]        desiredlimit=200000; H: h3 ]! L: p; O0 Z8 n
        ;;
( @4 V/ u3 n; S    esac
; i; Q: O8 R, C3 g; N' ~2 Mfi7 o  J+ R# S+ j1 L8 q
       
: }- b* Y' c; M    if [ $dbglimit -eq 1 ]; then
- w" \/ P5 I! V        echo hard $hardlimit soft $softlimit% K! h8 K  ]" Z3 a$ R( ~* [
    fi, v2 Q$ y1 O  x5 K6 ~( A
7 {$ L: c; d8 f- ^
    #stacksize can not be unlimited, pick smaller number
+ v. `7 j! d# m5 U, g
+ a* Q! d1 l- q6 ^% F& Q, c    stacklimit=$desiredlimit
/ \0 _2 M0 q) B4 y" N) B& A" i4 n, m% S6 j% z
    if [ x$hardlimit = "xunlimited" ]; then
$ g( L0 ]; ?" v* ?* D        hardisunlimited=13 L. {6 y4 N4 ?3 v# m. `3 _& Q
    fi# N* m( b  D8 K& P
- X# \( H" c+ ?4 m, e$ C/ S
    if [ x$softlimit = "xunlimited" ]; then4 s" V2 k4 h# A" W0 B* C
        softisunlimited=1
  j7 ~: A" |# L( e    fi+ z* J9 N2 S( n2 g2 r

5 Y; S8 l5 _" k9 R1 e6 Y0 y9 j    if [ $hardisunlimited -eq 0 ]; then
/ l! D1 v/ k6 Z* ~5 `  t9 S) B        if [ $hardlimit -lt $desiredlimit ]; then; N; k' g! O+ |4 ]7 A. X: x
            echo "WARNING: stacksize hard limit $hardlimit K is too small."
4 z! y- z) m$ E( v9 K1 C1 T            desiredlimit=$hardlimit: g" U" L5 A6 Z6 S. e; U4 \5 t
            stacklimit=$desiredlimit
) t/ x# P: N. ~        fi
2 R! E! y# e9 |) r  {3 G    fi# P; v9 v! u! T. b" U

5 s4 P# a6 [7 w    # desiredlimit is set to proper value (< hardlimit)
) x# ^1 W& g7 _! g+ s$ d/ ?; o
; v- p8 r2 Z, D    if [ $softisunlimited -eq 0 ]; then
% H$ t, z$ x( K- D9 x2 R        if [ $softlimit -gt $desiredlimit ]; then# V" J$ Q+ h( D( y' j0 r" N
            stacklimit=$softlimit
: e$ s1 g! e1 o. U        fi
4 P7 n. A2 [& e, \    fi9 o2 B! u. c" v* A+ W
8 ^: H8 B9 N) x8 a' @
    if [ $softlimit != $stacklimit ]; then
( c& r. \1 A; v$ j6 N        ulimit -Ss $stacklimit
% X5 i4 d* q- q. |' |#        echo "WARNING: stacksize limit is set to `ulimit -Ss`"# f4 m4 o: Q6 ]; ]8 k
    fi6 a) w1 H: D& R1 X7 b* h  A4 ^* r
1 |: q* O3 }8 N5 |8 s2 T. T
    if [ $dbglimit -eq 1 ]; then
$ I4 r- o, |. F& r; y- I( f        echo stacksize hard limit: `ulimit -Hs`
9 Z3 T) A& E# t% }) i# @        echo stackize soft limit: `ulimit -s`
# r1 H2 ?9 d0 x. T    fi
( W8 b2 N! J3 g* |8 w' G" F}
+ a) W2 k3 e5 W4 i% C6 d4 ^/ P
3 Q6 E7 s7 `5 s' z0 g7 G4 w  m" Iopen_epicscriptmessages()0 g, V# t- O8 K: @( v
{
: i3 G/ ~: Z% g, C; `; m- E#generate  temp ".epicscriptmessages" file based on pid9 P. Z7 S& _. E) v* s
EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$# V& Y% Q& {% Z( [' y
if [ -f $EPIC_SCRIPT_MESSAGES_FILE ]
8 e& b# j1 S9 J3 i: Nthen
% \2 y& {: o0 ^$ y! P8 b  until [ ! -f $EPIC_SCRIPT_MESSAGES_FILE ]! d$ e: Y8 s  Y
  do8 R) o1 ]5 G7 m7 y9 w& v7 d- h7 D
    EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
/ b; S! r0 h8 i. h: J, A- e# x  done  Y: F$ ^/ `9 b/ h. s
fi- l& o. U( @9 a% `: r, m! e
5 w$ R1 O  p& ?: l& X
export EPIC_SCRIPT_MESSAGES_FILE
& l+ v* V* i; P( f3 J1 F}. t! W/ I0 r% y: @
0 }" t. k% x" y( b

; v; v0 [. E7 r* b, o, u) [! }cmdname=`basename $0`. e4 |- p  D* w$ }/ b( ~
postgres="n"* A7 J5 n: L$ m2 M3 V$ @) j: ]
ostore="n"( V8 L0 _: o) h$ }3 l; B1 d* Z
gui="n"7 D3 N4 i) n8 |3 ~9 }+ e7 C
databaseOn="n"
( x' e# V  n8 c0 X. mf_next=0
. k2 e, O- Z% u$ L: wf_option=""7 }+ G% r2 t# K
o_next=0
9 K0 d; c( m. }% M, J" Qo_option=""
5 H% B) H" i/ ~2 @0 {workDir="") O* ?0 W& p* T4 O' s$ p3 ^
workDir_next=0
; Y6 _" y/ L9 L2 `# {5 @0 zerrFile="powrmill.err"
4 _: u  Q8 l& \6 [win32flags=""+ Q  Z8 c9 y# z0 i6 B% J) O1 z
ln_default="ln -s", Y1 L% j6 `7 t3 A- }
6 j9 g- ]0 ?) {$ `/ H/ o' z
har_hilo_file=""- }% ^0 m0 `' {: |/ g& D
have_har_flag=06 o1 b1 f/ N# n! k" |; f# h
have_har_setup_flag=0
5 @3 H! l$ M( `/ q. n- fis_special_har_run=09 f* j& e1 x' P4 t6 I
har_ofile_prefix=""8 D3 W, j. D$ D/ Y! l* ^5 d1 f
4 _0 }' E% f" i" c6 f' [
have_va_flag=0
$ L' V; s/ \; \0 @6 |have_vaf_flag=0
2 M0 Z4 z) b8 p8 B1 w  _! c) G0 jVAF_FILE=""
' b' q. {5 ]8 `. P+ qVA_FILE=""
6 a" t4 v& u! y' u$ d, [  D# W7 P. NARGV=""
% h4 [5 Q& t" l& W; x; P, T
) F/ a' `/ l' K5 }, x. ~ORIGINAL_COMMAND_LINE=/ C8 O  c$ r6 @. ~$ H' k% w
LOOP_CTRL_FILE=".ns_ba_env"* Z5 |) H% @5 G! U% x$ G
ALTER_HK_FILE=".alter_hkf"
+ }3 m) u7 s3 HALTER_COUNT_FILE=".alter_count". b% Q. ^( Z7 X+ l( e
MONTE_IMG_FILE=".monte_img_f"
+ z0 r! v& M# a  m/ eMONTE_COUNT_FILE=".monte_count"/ t% f4 v. G4 m, f& r" D$ j. A; Z
MONTE_CFG_FILE=".monte_cfg". @( l8 L0 [5 c. E# b
EPIC_SCRIPT_MESSAGES_FILE=".epicscriptmessages"3 ?: x+ j( W& v4 n

  b7 \. v- }1 S1 Oopen_epicscriptmessages $@( ^  z- x; c* o' `) x( `

& k' ^' n; T0 y3 ?+ c; [% Lscan_for_hva_args $@
8 h! T7 [; \1 r3 w
; K! f- T4 k9 Iscan_for_har_args()
; F' L4 T  t% \' @{
5 w1 S: i  A; P  while [ $# -gt 0 ]; do# y9 m' U1 u, g9 h. E' A
    case "$1" in
/ i! S7 g) G6 ^0 @      -har)
! d( N% b2 @9 L& q8 C           have_har_flag=1
) N3 M3 o- _8 l( o  z3 O           [ $# -gt 0 ] && shift
# i1 }$ J. e4 f4 |. m           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then8 g: b& q% ^0 t; y) r& S$ Q
             har_hilo_file=$1
: [! z8 E4 Z! r             shift! ]7 G: x- V* N/ U
           fi2 |' E9 Y# d! z, i" E8 z( t
           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then3 C7 z0 q0 S* `6 w# v
             echo "Too many arguments to -har flag. Only one hilo file allowed."4 V1 ^, L* z0 M9 |- G* F# h
             exit 1
4 T0 S  h4 g# [           fi
: s( m- Y/ x+ q7 D9 e           break
! U7 L! h! y2 o        ;;
7 C% P& a' J" ^. P5 x+ ^4 I. r8 B0 ~3 K      -har_setup)# g6 p  F& X8 u
           have_har_setup_flag=1
: N6 P2 \+ B0 }3 P+ d5 m1 U           break* s) P/ ~7 M# s
        ;;
1 U2 Y( O0 L9 i3 y, f5 ^  B5 N( U- u      *)
* o0 G4 X9 L  H9 w) e        shift
$ e1 d. k& x: I# {3 _  @* c: i        ;;
( v% I1 w" @. @    esac
  Q! ]) O7 j  d" N. m  done) A) N1 n/ ?  `  \- o% M) K: q
}# y7 F$ ^8 L# H3 R+ ^" N2 O; D' r3 b

$ @; k1 L3 Z( }/ D0 Y  [# g" Nscan_for_har_args $@3 d+ v' i+ o4 @8 B1 @  w5 G9 b/ C* D
3 V6 P8 x" z$ V* C
for argv in $@) U6 W, w7 {. W* U" r% _
do
; s* f" {( {7 d( A( N   ORIGINAL_COMMAND_LINE="$ORIGINAL_COMMAND_LINE $argv"
1 Q8 E4 A) i; I/ [' e7 o# l    if [ $argv = "-gadb" ]; then
4 g8 x- o$ W6 t2 C7 M4 S- w        databaseOn="y"
& U" t3 I. r% u$ K0 l        workDir_next=1
: S! C  S% V; e: Z( V6 |% O: k    elif [ $workDir_next -eq 1 ]; then4 r6 D5 z# h' ]. e7 [' J0 s
        workDir=$argv, ?3 d: u7 r1 J# a0 ~3 J6 S
        workDir_next=0
# D) P( Q7 y  h% L    elif [ $argv = "-ga" ]; then6 Y/ i/ D# @* K+ I
        gui="y"2 }8 M" r# m$ |3 k! j% |4 f, s
    elif [ $argv = "-f" ]; then
8 d2 Z% J& a4 O( g% h5 ^4 y1 C0 j        f_next=1( e7 ^' r; o0 s  t
    elif [ $f_next -eq 1 ]; then+ D# q  m+ w, c2 u- N) S4 D
        f_option=$argv' n' q/ w; D. O: M( c# u8 Q
        f_next=0
- e1 K. L, O$ h! g. ?  G    elif [ $argv = "-o" ]; then
7 a7 P' o, }; E# Y        o_next=1# E" S3 R' d5 J4 q
    elif [ $o_next -eq 1 ]; then& L3 {" S, x  ~) c! h' E
        o_option=$argv
4 B2 ~/ t+ v9 `0 u5 x4 h        o_next=02 }: @5 U- l; c% K. k* Y3 V$ R
    fi
1 B( H( B  x7 s5 u  ?* n8 ndone
+ ^8 {: }; K; lecho "Command line options: $ORIGINAL_COMMAND_LINE" >  $EPIC_SCRIPT_MESSAGES_FILE
8 d" \% T( [* I0 q( x+ b! I+ P, ]# X+ r! n! A$ Q
if [ $databaseOn = "y" -o $gui = "y" ]; then% z4 I9 x7 N* ?& q5 \" m- ^
  if [ $cmdname = "pathmill" ]; then1 R- O: M+ K) m  _1 H0 L# e
    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5"  -o "$EPIC_ARCH" = "SUN4_SUNOS_5_64" ]; then% H8 R# f7 [+ @0 m& ^# r0 `- t
         ostore="y"
6 Y/ c' I6 J/ A( Y         postgres="n"
; P% q% R6 p' @& A1 `) u     else
7 U. a0 d2 J+ v& z5 C# g# ^; V6 t' y        echo "athmill GUI is supported on Solaris platforms only" 1>&2
+ y) e1 g( l' _        exit
: ^1 [  s0 m: X% f     fi- t& e9 N1 j$ g0 T. |+ }, s
  else
# f6 s& |: U6 ^4 M, y    postgres="y"
& E. y. K4 W! d2 S         ostore="n"5 t" q& I( e+ ~: B
  fi
, p" ]/ @* x6 x2 P7 K8 ~( w* B% qfi; T+ Q/ c( y# l* Y

/ l4 r4 k0 @5 L2 _/ I4 hif [ $gui = "y" ]; then7 H. b. p% s: Q, R3 ]
    if [ $cmdname = "powrmill" ]; then
7 C) Q9 c% w3 T3 `5 J. M        pwga $@' i3 A4 U4 x* `4 R" A8 @
        exit8 \  f% }, X. [8 y
    fi" V( C9 |9 U+ N2 m8 `  c' B" r. t# v( [

( _- {& N* X5 ?' y, O    if [ $cmdname = "pathmill" ]; then/ ^6 U! n  h7 C/ F2 c4 x
        if [ $ostore = "y" ]; then3 m# }  _/ m+ ]8 v: u4 k
           ./pathfinder $@  M6 o8 I! ]$ d! u- I+ a
           exit* c# U+ b. \! w. h) r, f& r, d
        elif [ $postgres = "y" ]; then
) P3 {) q: I4 c4 k) L) C, o           pmga $@6 e% _. J5 t- I8 {8 ^/ n
           exit' I2 I0 r; B' `& \
        fi
! M' ?9 z3 I+ l$ l3 {% a    fi/ `6 D" E  Y$ n" f2 S0 o1 j
fi- o1 m  L& s: W2 b
3 X% a# n3 Q2 w6 D+ p! [6 L! O
if [ $databaseOn = "y" ]; then
: z3 V9 A# A: ^5 a6 e   if [ $ostore = "y" ]; then
' I1 A3 ^3 g4 o! \4 M      if [ -z "$workDir" ]; then3 k0 I1 m+ E) Q/ g% d
         echo "Error: Missing argument for -gadb option"; q3 q# [1 e. ^  J" r( |& [& K
         Exit 1! l, K5 c% \* t7 ^
      fi- {/ |* `5 y( S1 N( ~
   fi
- b5 S/ |3 C4 F% e  o# T* ]7 h  W( }7 H   if [ $postgres = "y" ]; then; |3 f% L5 t) `- F
      if [ -z "$workDir" ]; then
& f/ D0 i5 r2 ^3 A! p4 [         echo "Error: Missing argument for -gadb option"
) ^. t$ S. l3 u$ V% G         Exit 1
; z/ V, p2 O1 i3 t0 A* J% D/ O# d      fi! ^' L$ T' g6 j& D, V; V7 l; _
   fi
( m  `2 L1 t/ w! H% N8 {" rfi
' J" K0 [: S; E5 l; p
, U9 D* X3 F; B' dif [ $postgres = "y" ]; then+ O, t( F+ ]3 n2 G
8 C/ D) j( N! G* h5 k* y8 ?: }# V
    if [ -r $EPIC_BIN/scripts/gui-init ]; then
$ B4 n# ]8 M3 t$ Q9 W0 c9 n3 |$ r7 }        . $EPIC_BIN/scripts/gui-init
* p, o' l0 R( N6 p    elif [ -r $SES_ROOT/bin/scripts/gui-init ]; then
: \: y5 D* R) V5 T$ G% E/ b( B; d        . $SES_ROOT/bin/scripts/gui-init
, L' n# G7 G4 O8 B# g$ c) G    else( U7 J$ d- e+ I/ m
        echo " ** Installation in \"$EPIC_HOME\" has been corrupted!" 1>&2
% F: P( y0 v8 w6 r% c( T        echo " file bin/scripts/gui-init is missing." 1>&2
8 c- {2 ]3 v' r' \# a! q+ t# f    fi5 |: a- S/ {' `! x8 d2 i8 @; H
* R- N5 l4 C/ v6 ^) ]9 r( @
    workfile -tool $cmdname $@
: a) T, Z/ m4 r% x6 mfi
$ S. i- W9 R- v" ~& f" t  y0 @  M9 K
' b1 f( v- }" \1 n( Fif [ ! -z "$o_option" ]; then( l1 z  R& ^, |
    errFile=${o_option}.err6 |' G% S/ D; f; g) j! L4 N
elif [ ! -z "$f_option" ]; then3 @8 _6 `5 k* K3 A" {  G
    if [ -d $f_option ]; then# t, h6 g+ C" n+ u8 k0 F) N
        errFile=${f_option}/powrmill.err
; {2 _" M; V! r$ I. _+ K) B( J    else errFile=${f_option}.err) h/ Q& e4 P0 B; C
    fi
1 S" g0 x; S% d' W% }- j+ |fi& }+ U% |/ A% B) j4 d9 P; i( x
) z! u8 `; E8 {/ b9 S

+ g2 D9 D2 H' {& |6 j' N( oif [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then2 q) w* t& G8 r
  rundir=.epicrun7 A" d  U. C7 F# D& O" f& x
else
. p% Y7 u( l  c  v  rundir=.epicrun$$
0 x! N# e( O6 [  {4 `fi
( j: s) S: }$ E* M5 g! u) G
( K! Y  B3 X! f+ Vlibpath="$rundir${EPIC_DLIM}$EPIC_DIR"( H5 g% N9 e: `. Z, s  m
' {4 r) \( }5 f5 t% |
cwd=`pwd -P`; X; I% I+ |# F. |+ ^4 J
if [ $cmdname = "acehdl_w" ]; then
- }4 e' L+ s8 x$ U1 {4 [6 C  cmd=`basename $0 .sun`
5 ~' N7 B! X& n1 X& {; e" c' X  cmd=`basename $cmd _w`
, M# e7 x9 j1 e1 E7 H+ V& velse. E; U; E, C. }8 W. r/ p! W! D- [7 M
  cmd=`basename $0 .sun`
  u; F2 r% z. H; rfi
# {$ Y  v+ T- ~* M* l2 r  w# d9 W+ K( o2 V5 e8 }
command="$EPIC_EXEC/$cmd$EPIC_EXEX"
  X% \+ D% d+ D6 F[ ! -x "$command" ] && echo "$cmd: not installed!" 1>&2 && exit 1/ f: u0 C) \$ u( y: x

8 b+ _& p. I4 Y* Y# buildmod extracts -u/-fm options and calls genepiclib
: d: w! ~: {' k  ~' `# It also set the remaining options to variable CMDLINE
5 D6 ]& o  W" G2 i" U0 o. ]# look up in .epicrc for -fm & -FM parameters
% H7 ~# ~. [# Q: _& S0 J7 Z, k# m5 G  E6 B3 ?  R5 |2 Z, m
fmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`"
1 z* h. v' x% j) L8 ^[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`"
8 ^# q7 _6 O9 P% v' J4 p[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`"
  L. w+ G. z' ]( Z 9 \- h6 \' `! a1 I( ?6 C
FMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`"
5 o" s( Q* M, C+ P[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`"
% Y0 z  u8 b8 L' y0 S[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`"7 e6 C' R0 X! D) K# \1 a
0 I8 J! D. ^, y
if [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then. p# t0 x4 v0 e7 s7 {+ \
    # note that the buildmod script will set the CMDLINE variable
. W1 x9 z( @3 {+ M# L3 ]' i    . $EPIC_BIN/scripts/buildmod
, e0 N0 J) s4 ]# R6 F
! J3 j& o4 z( ~0 _" ~# G- w- h    #echo "This is the value of cmdline=$CMDLINE"
5 w8 K2 _6 ~% p) s) k    #exit 06 p0 D3 ?' D2 |# E7 t' J- Q

. t/ G, V  `" p    # if a new timemill/powrmill/pathmill built, run the new one: j' f+ g1 ?/ B& N' u. X
    [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX"
  x; y' X" U6 Q" F' Ufi
6 _* O' Y9 x$ v- {2 [& B) {1 O4 _3 a. m
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then
! [8 n& o' [' N, C5 f# V% I  if [ $have_har_flag -eq 1 ]; then
' e1 B. ^0 [6 F' u* v    is_special_har_run=1) W* b' q1 ]! c2 c& W! }/ s
    if [ "$o_option" = "" ]; then
2 n2 p2 x1 X' ~6 \      case $cmd in
; P- e; _# u# D1 s$ T) n7 X3 X+ h        timemill)5 M  I  p2 T. c- f. ]" ~; g
          har_ofile_prefix=timemill
7 a+ S' q; g2 @8 T- ?6 d. f          ;;
* V  E$ Q5 L- E; D/ J. v$ _$ @        powrmill)
5 L4 l/ M& }8 t  V# v          har_ofile_prefix=powrmill
% Z! p; U% y0 W# Z2 K8 r4 O( Y          ;;
/ J% N3 x" J7 v3 g6 E        nanosim)" u" `$ ~" p6 I( w; R2 D3 D' Q
          har_ofile_prefix=nanosim0 w* o: D* m- U: e6 R
          ;;
3 L3 z% E* ~: x% _      esac
7 Y4 S, F5 X5 q* ?    else9 \/ _# G  E2 g- R4 f: ~' U
      har_ofile_prefix=$o_option5 ?; C+ T! w9 p" J! a1 `
    fi
( Z' h3 Y3 O! U fi0 }: B; k: A. ^
fi1 Q, b8 L% j. j% @3 w# c2 d
1 L7 C/ T# R( }
# Call Double precision version of the product if -D
( @) F0 k/ Y+ z( ?6 ]- i) x( p# or simulation time > 1,000,000 ns.
2 D2 f) X1 t+ E5 o: t2 u5 Iif [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then
4 b4 {+ o7 A6 A. j' u0 s* t1 y* m+ V+ u8 T! L- {0 k  G
  # Now the binary always has the ACE feature
. J$ N% n7 p/ Z  USE_ACE=YES; @" r) N7 A& y. U9 A- @/ s: u8 [; W

3 R: I; r* E! u. v6 l' ]3 s  HAVE_DP=NO0 O7 X: f, s$ E8 I. V6 C$ |( q
  EXTRA_CAPACITY=NO
$ m2 N/ ?, ]9 w$ n' s  DB_REAL=${FORCE_DB_REAL:-"0"}
2 D3 e9 s# [9 \8 T3 g" s6 d7 ?1 ^
, U0 l0 w1 o5 k0 P  # Enhance for ACE ease of use
1 U1 w6 D0 q( a; O4 K  V& f$ f$ H: {  # If no command line option or only a -T option, do:3 x7 N3 q! r# n0 }' n
  #   1. set -A option& F% t; a% P, @& O& \
  #   2. assume input file to be hspice5 j+ V% K' U& o0 c0 D; N
  #   3. set -o to input file prefix0 T% n! N3 \. F
  #   4. set -z to input file prefix
8 C( j9 I7 F, S+ `* }  #   5. set -c to default config file$ k9 }2 x" E9 m/ D
  netlist="") S6 x$ @7 L2 g( V, s* c2 k9 j
  minusT=NO
$ O+ q3 d4 h! U' ]  useStdCmdOpt=0& M5 U1 O. v8 ?* @  C
  prefix=""
5 N3 J4 i/ Y0 n/ k: F$ F0 e' t6 u- `# s  circuitType="") L4 E/ y; h6 f4 i
  for opt in $CMDLINE9 t" O/ o# C9 h5 T; W
  do
. W' h0 U" G% {5 Z% ~3 r+ N: F" L    case "$opt" in 1 ^3 E& H- `1 B( Y, A( \/ p7 h1 @
      -T)' g) i; u  ]8 F( F( l4 K
        minusT=YES
- ]- q7 b2 \( A8 l3 }' C        ;;: T+ n$ A  Q$ E  e" i. F( x
      -*)9 r# G. K4 W) t: _% G
        # using standard powrmill command line4 _9 a+ |* V1 k' r5 I
        useStdCmdOpt=1
) I8 ~- M3 K) o1 p! s: ?: C, f; Q- q        break/ J5 ~0 y8 u9 b; E9 L; F. P
        ;;9 ?% U  o  O! S1 Q
      *)9 H% c6 l! M' J7 o2 ?0 N# T! ^
       if [ "$minusT" = "YES" ]; then, K. F9 m) l/ Q" k0 O
         circuitType=$opt
# V5 ?/ R  T- D$ x3 g; c* }3 K         minusT=NO  # reset flag  ]* N/ ?0 c# A% Q0 \9 _; \) Z  R
       else 0 b$ B# u6 R$ P- v- ^: c# g
         if [ "$netlist" = "" ]; then
# G* v  a7 O. \7 l           prefix=`basename $opt`
* f& g: j& v0 i9 G8 w" b' V1 o           prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix`- y( T3 ]2 d" e4 b4 {6 v
         fi; l. j/ ~+ a* g6 v! V
         netlist="$netlist $opt"
6 x$ c. A& v. Z1 z  b4 q       fi: B  b) }1 N" N
       ;;) K/ \5 i) d3 i% A- S  N, c
    esac3 ^0 Q$ Y) t0 B' N
  done3 e" z( J5 ~3 M5 t7 v9 ^1 Z
3 P+ E$ H; V/ S" X. l' a
" A8 K7 I& T5 x  x6 a
  if [ $useStdCmdOpt -eq 1 ]; then
9 X, H; e0 D' i1 ^0 W    # use standard powrmill/timemill command option
) W0 ]# G9 C) ]7 [" g- i    for opt in $CMDLINE# f) f8 T7 n1 L2 R
    do" e3 C* `* {5 \
      case "$opt" in / k: a- F  Z+ d1 y
        -A)2 F' _, L: g/ F3 J( r
            DB_REAL=1
- |) Y4 P/ S, L6 o3 J( ~9 ]" K            ;;
+ R# B: S  H5 m0 P  `3 a1 [      esac+ t) t! n2 D9 N/ D7 ?1 I9 w3 D
    done
; b3 q4 R2 M$ M4 M+ E    if [ "$netlist" != "" ]; then
/ Z6 ^$ o3 B2 ]  I7 V" U      CMDLINE="-nspice $CMDLINE"0 T2 w; ^; e4 s# H  o
    fi
0 t1 v! g& S- v3 Z  else
7 L3 _( a6 V  M) b0 I. L7 L  J% D    if [ "$netlist" != "" ]; then
) }3 d7 _+ y! O, z  Z3 _      EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"}
$ y7 Y3 f( K4 A( c      # construct new command option! ?  T6 l# \& l3 n
      if [ -f $cmd.ini  -a  "$circuitType" = "" ]; then- P) a+ f7 L  J* i
        CMDLINE="-nspice $cmd.ini $netlist"- @% m+ E3 J% y3 k+ y* H
      else
5 A! t3 N2 B  f9 o) i        if [ "$circuitType" = "" ]; then$ {: f) u  w  Q  _% M
          circuitType="msana"
4 G; Z# @. O8 a& t        fi
$ I) j& K* b+ V0 u( i4 s# L' k        CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg"6 A: W8 W/ ~% y. j
      fi
- p. q9 [4 ^# P      CMDLINE="$CMDLINE -A -o $prefix"
0 [0 v5 X3 m& m3 b) s/ U- \      DB_REAL=1
  |! N$ M; c( \( D      echo $cmd $CMDLINE% Z- i- j- @* H+ _
    fi
" w( L8 L" `6 R9 Q  fi
2 U6 ?  ~5 v3 a5 Z1 g6 Q" p* }fi # cmd is timemill or powrmill or nanosim or railmill or pwarc, t; d5 D% s9 z0 L
3 l* q" T5 L5 U
[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a"
, G! d& Z$ E+ i0 n0 Y. H  W+ K[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a"2 h( I6 \/ y# x/ d% a9 W" G; V, Y
[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v"
8 j7 l$ s) ^" y% F( _0 V: c/ S# P! ^! b  T- d; a6 j
if [ "$__engine_wrapper_called__" != "Indeed" ]; then4 H) G1 k, W/ h% a1 T0 I
    __engine_wrapper_called__=Indeed
8 U, m/ n) i& a' a/ C; W    if [ "$cmd" != "amps" ]; then
7 L4 T* g9 v* s! ~3 W; a        export __engine_wrapper_called__/ D1 V/ y: z$ s* D& O2 U
    fi
7 Q- S+ Y- F* h0 A, I2 b- W" ?0 H
- z; E* P. G7 ?  t. I/ v) N; c+ D( J    trap "cleanup" 00 n3 L. f9 D- v" n, d9 Q
    trap "" 2& s; A1 ^8 D1 G

6 @* ^  Q; M1 v' d) W* r; Q    [ -d "$rundir" ] && rm -fr $rundir) ]- S4 J0 ]3 c( j! A6 }# E
    [ -d "$rundir" ] || mkdir $rundir- r. W* j$ F7 S: O' h- ^/ l2 U

5 h! h  f  Q( V    case "$EPIC_ARCH" in* Y% e8 Q, y  }$ I7 m7 ^
    *SUN*64)   ( f1 P# G8 r' g5 ^3 |9 m+ M$ H, S
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
. X/ |6 \9 ~* g2 J$ Z+ u$ x        export LD_LIBRARY_PATH  P- e2 V7 p( O2 ~1 j
        suffix=.so. {( f+ o% ]2 y& r! s
        ld_err_code=127& x( {" n2 \& T. n
        ;;
5 y8 g$ l3 c7 |+ B" {    *SUN*4)   3 Y6 C' a4 `2 m$ V9 B. f3 t6 _3 G
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"8 r, P3 A# i+ x7 V) m1 X- G9 d
        export LD_LIBRARY_PATH
3 i. A7 n4 Z! ~: z6 w  k        suffix=.so.1.0, A; l) i' L6 x5 i, q' ?; {
        ld_err_code=127+ h# T. L' V8 c9 T
        ;;
5 d! F$ p5 H% H! D% X# o3 o. F6 a5 f    *SUN*5)   ( ], V7 a! H3 {; `
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
/ t3 S. f0 X8 T0 [' ~        export LD_LIBRARY_PATH
( p8 Q' E9 f; n9 Y        suffix=.so6 F+ b0 h3 [) {" T) x7 j/ S
        ld_err_code=1270 X1 W4 Z6 _& J1 c4 Y
        ;;
) P9 d3 T( w2 k7 A( s9 |    x86sol*)   
9 Z9 ^9 u  y; G        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"9 G1 z8 z: T+ n; t) Q
        export LD_LIBRARY_PATH
" |0 f) @4 @; |: q' t( U        suffix=.so. J' ]; J+ p2 w. f$ y6 b1 {- c# o
        ld_err_code=127( @5 E! t, g; }/ L! n
        ;;
6 f$ I; t- K0 b7 E6 {    *AIX* | aix64)   
  |& L+ H+ C, u; I6 d        # When genepiclib creates shared objects, it creates a import file and
( }3 M$ l' ], n; d3 |) `, A        # uses timemill as program. So at exec time,program timemill is needed 0 W* F& I( A1 z+ T! q9 H2 c! Q( \
        # in LIBPATH
0 L9 A  ?4 p  t) E        $ln_default $command $rundir/foomill
" {* ~7 n& r, c        LIBPATH="$libpathLIBPATH:/lib:/usr/lib"
1 w5 j+ E% C$ r1 @        export LIBPATH* U8 x! `" m9 h( ?9 L
        suffix=.o0 N) {, ]. @( X0 Z. M3 E; V; F
        ld_err_code=8
2 Q: e  @3 K( P! ^  u5 A& _  C        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
$ C4 m$ D) J+ l          tdir=`echo "/tmp/d"$$`/ I9 C  J* X* i* F
          [ -d "$tdir" ] || mkdir $tdir: W" C' S) {* [( Y5 X! \
          if [ -f $EPIC_DIR/libCustom.o ]; then
9 r( |& D2 N% O; K             cp $EPIC_DIR/libCustom.o $tdir/1 s* S; y: m! H% F: n7 y! w
             $ln_default $tdir/libCustom.o $rundir/
* T4 J/ S7 E' s) x% W# E; O5 l( f          fi
. F4 R1 {; H9 l  y1 d0 V8 w          if [ -f $EPIC_DIR/libModel.o ]; then0 C- ]9 n7 p! c5 n  k
             cp $EPIC_DIR/libModel.o $tdir/
6 g2 K) E8 H7 Y" ?             $ln_default $tdir/libModel.o $rundir/
0 q6 `, E* \  ?( M4 {          fi
$ T- C) @: z' R          if [ -f $EPIC_DIR/libFuncModel.o ]; then
8 o7 W& O# s8 D* k  g$ ~3 Y& h             cp $EPIC_DIR/libFuncModel.o $tdir/
' K* r2 S9 j/ j0 t0 |             $ln_default $tdir/libFuncModel.o $rundir/) j0 a5 G+ t0 l* H
          fi: E. O4 t* ]/ ^* Y6 N
          if [ -f $EPIC_DIR/libFuncModel.34.o ]; then
; _" x& L* c5 B+ _9 \             cp $EPIC_DIR/libFuncModel.34.o $tdir/% S, ~3 }1 @  b
             $ln_default $tdir/libFuncModel.34.o $rundir/
+ g  k8 P: Q- P          fi. K* `9 ~3 k8 ]. j* \- D3 H, ~
        fi
& B0 G# \# g! r6 i, j6 v7 U1 F: ?8 ]/ e0 |        #Set the IBM flag to enable more shared segids
9 ?5 r! F$ a( z: }2 f! ^        EXTSHM="ON"
8 R6 A2 }6 D2 O$ s+ i9 j; W( Y; z        export EXTSHM
- ^- g0 L& p9 X        ;;
8 b1 e9 Y! O; W6 f- J& e! `- A    *LINUX*)   
3 `; h4 E2 F# E' Z: H0 G& ]        suffix=.so) Q% X) x, Z- V4 p' K
        ld_err_code=1
* `2 H) r! \. }* q( S2 B% A        ;;
+ B* H! ^: o4 H0 k- `# J$ I; `( q    *amd64*)
3 R- }1 a! N! z        suffix=.so
5 W$ y4 N. N2 ]2 B8 W        ld_err_code=1
! ^- p0 s6 _" w0 b+ u6 C        ;;, n0 H# E  b% j" r
    *suse64*)
' n1 I+ `! c5 m" e9 ]' ?        suffix=.so3 @! q  H+ ~' T' J) F9 g" _
        ld_err_code=1
! [4 l& e, T& Y& H& _: w        ;;
2 Y1 ]" a& [; P    *suse32*)    8 ?9 o% L: B2 d
        suffix=.so
! s$ s  z/ q$ q4 w' ^        ld_err_code=1
! {4 G! A: _" Y/ g        ;;% y/ q3 L' a# [% ^9 n
    esac$ a* z4 g7 P2 ?: ^& F# `5 M6 q* `
7 `% b, T- I- {  K7 L
    [ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix": m5 e3 Z, f/ D, M6 p& x
    [ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \8 N  g0 V9 s7 A! d; Z
        && [ "$cmdname" != "nanosim" ] \
- n# U. |7 t3 l4 Y5 ]        && [ "$has_model" = "YES" ]  && ulib="$ulib $cwd/libModel$suffix"
# p, o, e: B; q% ~3 n0 p    [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix"
) X( X9 m, Y" e8 }: M( g7 @4 K
. T! f8 Y& y  E) Y9 g& @- f#Look for command line option for libFuncModel.so: l9 f" C2 G4 S. I" ?" p
#    user_library_next=0
7 [' d$ \8 K% O6 y6 }    has_fmlib=""2 n% u! Y1 A# u: c2 y
    for opt in $CMDLINE
, L7 Z6 `' I0 ]6 A    do
. c; I7 B/ v* Y5 w% {3 q      case "$opt" in
- m0 O5 F1 d' ?+ s& b        -fm)
: q7 f1 H" ?" K' b7 Z& P& R            CMDLINE="$CMDLINE $cwd/libModel$suffix"4 a7 _) h2 ~- x" k
            ;;
; ?7 q' x: _1 y. L! B        -fm_user_lib)5 G, w; R3 P* |  Q; P) r, \
            has_fmlib="YES"
9 C! ^, P5 B9 p#            user_library_next=13 P$ M7 c- y2 a  h& j/ ~
            ;;9 l8 m( A9 @; @. Q7 o* ]
        -xc) " _' ^' _3 t( v/ ^( e/ ~" k
            if [ "$EXTRA_CAPACITY" = "NO" ]; then$ r3 o1 f4 p# U' [8 F$ ]& Y' C
            EXTRA_CAPACITY=YES
  u, n- W9 }- w. d; M5 e- H2 j; J            fi
) j! r1 p- Z) |! M4 K            ;;9 N5 X  O+ F+ ^+ g$ R5 A. V
#        *)
% W, R5 z/ [# @( l+ F$ I& @#            if [ $user_library_next -eq 1 ]; then
; i1 ], g- a! |/ f# H#                if [ -f "$opt" ]; then9 \' c$ X; c: d( [7 R  K9 ~' r
#                    libfmodel=$opt8 G3 x# V7 G# [' U: g4 r% ~
#                else% O$ e' z; K; c: y- C4 |  y
#                    echo "-fm_user_lib: Specified file not found"
- {9 D  l# M8 O& ]: w# ~0 A#                    echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages1 z8 j. X2 K* `9 Q' a! ^8 W
#                fi2 J# D! {7 W' }2 d# G/ ?* J
#                user_library_next=0
* p2 E$ p6 I. ?& u7 E$ R#            fi0 B3 ]$ r& o* G/ C. S* i- b
#            ;;3 ~9 @! Q' M1 Y# n) k7 ~4 X
        esac
: z$ g# e- r0 N5 s' u) Z    done. ^, k# g0 Y6 q3 H: m$ A
3 W5 R: {- j. ~- g/ i5 y4 {
    if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then8 N( ~8 U4 z! i, H% u
        flib="": Q( }& ]& @* n0 ^# J: u
        if [ "$has_fmlib" = "" ]; then7 g0 ~$ V( ^: U" E, Y, ~; W
            flib="$flib `get_epicrc ./.epicrc user_libraries`"
* n0 F8 V1 ^; v% i7 T- i2 g8 Y            flib="$flib `get_epicrc $HOME/.epicrc user_libraries`"/ x; w2 Z9 ?' ~% v2 u. T
            flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`"- p, M+ Z- R4 {' v
        fi
$ o1 c7 k, E: Z% }( H. @, v0 T( f6 I    fi
9 l8 [+ j  z  m, i; A) M3 r/ x# C" ]
   for i in $ulib
2 V, Z3 S# Z( G+ i   do
! ~4 S3 X0 U- h       [ ! -f "$i" ] && continue
9 g$ Y# C! Q# _       dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd
( b1 u2 Z$ c, p9 M6 J) d       i="$dir/`basename $i`"  Y  N5 e7 ?' c1 J8 c
       case "$i" in
2 F; O( a0 \5 E9 D9 s       *libCustom$suffix*)    [ "$libcustom" = "" ] && libcustom=$i;;, ]0 U2 a/ Q" Z2 a# a" {9 z( v
       *libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;;
/ z8 |: N" E  N; b       *libModel$suffix*)     [ "$libmodel"  = "" ] && libmodel=$i;;
1 u6 D) Q3 Z* g6 N  x       *libva$suffix)         [ "$libva"     = "" ] && libva=$i;;, Q4 R! d5 U  c0 x% S/ g  G+ u
       esac5 b9 v1 ?; [( i( C) v! Z8 C$ F$ c  i
       [ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \
9 e$ t8 r/ M; A) _. x        && break2 s: O: v! I0 x9 d4 S" E0 t
   done5 ]! W5 Q3 ^3 p/ y% }
, v7 B& X  x2 f: B& S
   # symbolic link shared libraries to .epicrun$$
9 i5 B. l6 T7 ~  r    cd $EPIC_DIR; epicdir=`pwd`; cd $cwd% |5 o/ T8 e0 k$ ~: j9 n
    if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then) n3 I" q2 A2 }: w6 C1 H1 A2 Y
        if [ "$libfmodel" != "" ]; then4 T4 j' z* o2 x1 s
             [ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \7 @  k6 ?* y7 }+ |6 ~- o1 M
             echo "Using $libfmodel ..."  && \
  U. S) I) V' C0 |# ]. t             echo "Using $libfmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE8 ~, u3 t/ \' }% p* w$ K
             if [ -f $rundir/libFuncModel$suffix ]; then* ~3 B# i0 j4 L1 ?5 Z- _
               rm $rundir/libFuncModel$suffix$ k/ D9 D: l! I8 o1 m0 C; H7 R
             fi( w1 T+ d! I. ~7 P
             $ln_default $libfmodel $rundir ' }1 g7 X% g+ ]2 _3 n
        fi
% q# |% u  f0 z' p1 z1 v        if [ "$libmodel" != "" ]; then
6 R- a9 X# E) Q9 Z             [ "$libmodel" != "$epicdir/libModel$suffix" ] && \
' d! z& U& ]: B4 T             echo "Using $libmodel ..." && \1 i- e3 o7 A# F
             echo "Using $libmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE
9 E7 D6 {  Z' [) k4 a             if [ -f $rundir/libModel$suffix ]; then6 M7 w5 V5 M, S8 \
               rm $rundir/libModel$suffix
3 W+ a+ T* S( z             fi
* N, j& L/ C2 Y) W' H. R) q& u             $ln_default $libmodel $rundir
3 Z( a  l- q- ]3 [        fi) r/ E/ b. k7 i/ k! S( ^
   fi
, l; D. s  U& ^$ C   if [ "$libcustom" != "" ]; then0 o% o! x, o& _- G7 m
        [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \
+ `: W) Z0 W6 D9 T/ K: w/ A' \# o: G        echo "Using $libcustom ..."5 c8 j8 k" P  u# ?  ~5 X% X* I
        if [ -f $rundir/libCustom$suffix ]; then
& q& H' b+ H% Q' a) N2 k5 t          rm $rundir/libCustom$suffix4 }  l( @/ ]9 b' R$ M
        fi$ M# m3 B2 I5 r+ o# V+ O9 e: a
        $ln_default $libcustom $rundir : w2 {: V  Y. F* j4 w  K# s9 o" R
   fi& }1 g" I& \! I8 f

* N9 B2 S" v- I) K/ y6 o   if [ "$flib" != "" -a "$flib" != "   " ]; then+ L& A9 Y4 E' N4 Q% ~
        CMDLINE="$CMDLINE -fm_user_lib $flib"
6 O3 R: |- P+ {& y: `3 B   fi
9 y* J  b) N6 O3 c( l
4 i. G2 Q) e  a; n) J" K   if [ "$libva" != "" ]; then; g, W, I$ Q5 j, @* H) d
        if [ -f $rundir/libva$suffix ]; then! l9 s0 G* O/ m+ `) l. ], r
          rm $rundir/libva$suffix
" o& c2 g8 Q3 t. m& G        fi
! }. v+ M' p' o8 }( A$ {        $ln_default $libva $rundir 3 E+ Z6 v" N: ]$ i" |
   fi; g% T3 e  W- w- p* e3 Z

1 [; b* q8 _0 O% X- ]. V; w: D- K- |* m) ~& s) q2 `
    # VCORE design library% k$ \) }8 F+ W; j
    if [ "$vlog_design" != "" ]; then
" z. O7 G0 W; S& L& x        $ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`
; K" l& T8 p- ?2 n# [0 c    fi8 K* f1 r9 \# g0 H# @
0 f! `% |2 `# Q; a
    if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then& v% F  e# o* ~. n/ n  P
        EXTRA_CAPACITY=YES
3 j1 n4 R# d2 k* E( S( X    fi
3 N& m$ u  v* B( @. p& r' k3 _) P( ^& K$ S  o; M# e
    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc"/ t9 [, N3 R: l4 O
    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc"" a# w- {8 Y7 A& v1 [
    #Create temp file if dual process is on! v& N) {. D5 j% L0 @7 u: n
    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then- x# e% }: I3 O( _2 R) T9 _
        if [ "$EXTRA_CAPACITY" = "YES" ]; then
9 _9 j: q: y% \+ Z9 W            touch $rundir/rpcidfile
% a& M9 g7 C% s! t7 s        fi- `  {+ s) R% j% l0 T! l
    fi
, y# l* x, V6 ?& v% a/ x) ufi  G9 v6 b+ j& l5 c

$ N4 j! }" R* J# Hrun_cmd()
. N- K3 r9 p8 p3 {8 }7 I  [{" S4 x% O, F# i( N% l% }
  command=$19 {* P& X8 V5 H
  shift
( u* E2 T! e( @7 n! L9 W" v8 c/ d1 a- c& Q2 n
  if [ x"$VA_FILE" != x"" ] ; then) p) f) L" x% Q' ?; M1 @
     cmdline=$ARGV4 Z; \4 p% L$ c4 M6 ]5 x
  else
& q+ {! t( [  h$ Y     cmdline=$@+ L( V( Z" a, S6 g/ d; k- J6 n
  fi
2 Z0 F/ W2 Y( F/ [0 d/ a$ s5 X5 C# N, [$ M0 Q( g/ e% U
  debug=${DEBUGGER:+"$DEBUGGER $command"};5 [0 |+ G5 x% [0 D7 Y; K  Z
! i6 O7 e8 @5 E/ s, E
  # To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a# ~, h8 S* W$ S$ R6 a  Z
  # so save-restore may work.
- @7 Q7 l( X! p' |! V: O$ x& p/ j  setarchStr=4 {$ p5 F4 O0 `2 c, n' w
  cmd2run=`basename $command`
4 @* D8 q0 a9 j  if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then% {7 P3 e" |5 f' \- W" f& ?: B1 Z" o
    if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then
' B( a2 x( ?, t* I$ p      setarchStr="setarch i386 -R "
6 m1 S, n/ l5 D4 b8 j    fi( Y) h3 h$ _. g2 j
    if [ "$EPIC_ARCH" = "linux" ]; then
- W2 B: e* j1 x, ]      setarchStr="setarch i386 -R "
+ v' g* K) _/ q7 m2 j    fi
: P6 F  E* |& `$ u5 X  U& j: }    if [ "$EPIC_ARCH" = "amd64" ]; then
5 r3 ~8 x1 b. J      setarchStr="setarch i686 -R ") ]! R; o& u& t) K+ f
    fi
. f0 w7 b6 b. N- P    if [ "$EPIC_ARCH" = "suse32" ]; then
3 T  _5 W( X! a$ }1 F      setarchStr="setarch_suse i386 -R "  v' G; G% ]8 n7 W5 p6 A
    fi
# b3 R$ w$ p3 S) x    if [ "$EPIC_ARCH" = "suse64" ]; then4 z, z* {8 r, l# ?3 m
      setarchStr="setarch_suse i686 -R ". e/ K: V$ H6 ^2 ~
    fi5 n( n) D; G+ m6 A' n2 c
  fi2 y* V' s: a: y% q4 i" Z! N4 Z9 O
: O8 w* f& D4 J6 n' i! z
  ret_stat=08 g# |: ~* q. z- L; \8 Y
  if [ -x "$command" ]; then
& C9 s1 ~3 o8 J4 N+ S- Z      if [ "$debug" ]; then
' q& M- N8 ]: }- N1 j0 H5 t+ ^        _debug_args_=$cmdline; C+ f1 \& {- Y6 K' H. R
        . .epic-debug
' x( Y- v( V7 U# f8 b# h      else
" m5 _/ E5 R/ }, ~" d: c, ~        DEBUGGER=; export DEBUGGER$ S0 ?" k8 ~: |: K0 H
        $setarchStr $command $cmdline1 b; a9 ]1 @- K7 T8 O3 P" q
      fi) r4 v& Q) X$ N$ U! I* ~
      ret_stat=$?& ^7 x" N1 \; i& w3 @
  else
- k" M/ x1 S9 W8 M- y5 w    echo "Corrupt installation, executable \"$1\" not found!"" O6 N; G! e" Y* y1 H3 e
    ret_stat=1
' E6 L8 h, P: Q  fi1 v( R1 ^4 B! ]8 r
}
6 Z, V+ g( `4 o9 N- U: _4 Q9 d
4 f! Q& q5 D8 Q1 L% m( m+ |# keep runing cmd if ctrl file exist
; D4 @, O$ n6 r8 v! f: q' {3 O, Y1 F# n
* j& Y2 ~/ e  W7 A' L* E) X& Yrun_loop()7 n2 u# D; J& l* l- B/ a2 r
{
1 B" P  C) ?' u$ G2 s" h' F$ q/ H4 w+ f  command=$1* v$ B% t9 t( ?: d
  shift; k% u; _5 p! H; X" ~- U

0 T3 j# u1 c" \/ c  if [ x"$VA_FILE" != x"" ] ; then' R  Y. b7 A2 K" |) @
     cmdline=$ARGV' s! ]& h5 b0 A# f* }
  else
) A! M9 g1 j5 F2 d     cmdline=$@$ r( }2 `. K9 d1 O3 s- W
  fi
1 j3 Z8 I! a. ^/ S' ]/ ~$ v6 E6 J1 \  y
  while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do
1 u$ B  C$ j+ z4 A    . $LOOP_CTRL_FILE$$- `1 w2 a9 i/ C7 z
    run_cmd $command $cmdline -banner 2: O+ y) ^. d* C! {# E9 u. q5 C
  done;- z" {8 E6 w/ O1 c' N0 j) [
$ v4 d$ z3 t4 q2 B3 _* d2 x, h3 z7 O, S
  if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then* r& x& ?* R, \6 y. K( ]3 H! ~0 x
    rm -f $LOOP_CTRL_FILE$$
5 E" L2 L7 r  |  W  fi
6 S! e7 B. l0 c% x}# K- B2 K( V$ C6 `5 I1 u: l
- C& S! ~1 p+ W$ I1 n( @( t0 A) O7 b
har_check_ret_stat()& E' u* a0 i) s8 M2 N
{; ~- _. S. W1 C
  if [ $ret_stat -ne 0 ]; then
# J+ J: p0 @# o7 S8 C1 q    echo "Simulator returned with non-zero exit status. Stopping."0 W4 H! h( U& g# k' p2 _3 Q
    exit 12 M9 b. d# Q7 t0 K' k
  fi" [7 R- Q; |8 P" v" D' N) t- |, v# [7 L
}& C- h  G6 c/ K
5 Q/ F% b9 r( y( Y+ {* ?( R. i6 B) z
#
8 W6 ]$ T& z# ?8 h( t: |# set stacksize and datasize limit" L: i- V! {8 H$ G# O2 n
#
' S$ U6 ^! h: j; I6 t4 ~/ G" @
! c3 @( m6 g' ~" f5 qset_data_limit
( r* v- e* U* p8 f. e; a% H- \set_stack_limit
2 R% ?9 v$ a* D$ f  k) H
5 {( Y0 B2 E# m( A#rm -f $LOOP_CTRL_FILE
1 p, Q* K" q- ^* j  a/ v: q
: \% e* y, x  w% h: s% Krun_main()
+ y+ t# w6 m" c. O6 p: ?; @1 t7 v+ f{# M1 a# N. N" p! A
if [ $is_special_har_run -eq 1 ]; then+ W& P5 m& ^" P
  if [ "$har_ofile_prefix" = "" ]; then# s+ u" T) y) E0 b/ L: o, b
    echo "Wrapper bug. Notify Synopsys technical support."
, `7 G. F: h4 H/ S8 _6 W6 \    exit 1
9 c5 E* g9 S+ k: z/ O7 d  fi' l  ~$ \: y! M; F
  if [ "$har_hilo_file" = "" ]; then
( I' H( ^( S& G% P) V8 H    # no user specified hi lo file - do both runs
; e8 a: o) A  c! w" F    run_cmd $command $CMDLINE -har_one -har_setup2 z) I2 `4 ]8 @  {9 i1 ]) B/ s
    if [ $ret_stat -ne 126 ]; then  e4 D8 F* X6 C/ t( G
      har_check_ret_stat/ s, E% Y$ X* Q: f+ o8 H" Q; f$ z
      if [ -r $LOOP_CTRL_FILE$$ ]; then
: t% l0 L; v3 l% T2 P0 m! D        run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl
- m* \: Y8 o4 @* t        rm -f ${har_ofile_prefix}.hl
! P% H9 R- m7 O! `, }! Y& W      else" i; h' F* \8 B
        run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl
/ L1 L5 L# n( n2 O/ X      fi# C- Q: O/ f( }7 f1 A3 `
    else
* j9 u( Y. N% g  i( Y      ret_stat=0
! t4 E- ?" h. `    fi9 l; x8 x: N& b9 T( D% P/ p0 ?
  else3 }5 z2 P/ i' q& G2 ~6 P$ l
    # user gave a hi lo file name, v! K* F; N  R  l, k4 G
    if [ -f $har_hilo_file -a -s $har_hilo_file ]; then! d% i4 h5 \- ]" U% ~' g
      # file exists - use it - only do sim run
! a! e/ X3 C0 F0 U      run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}0 \' D+ M) j+ V, A" u) q
      run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}  Q4 r$ t9 V& u% O$ R6 w8 c% }
    else
( ^7 \# h; {: B; p! q4 o; @      # no such file - generate it - do both runs
! L0 X. f8 ?% W& F' c      run_cmd $command $CMDLINE -har_one -har_fnf -har_setup, Y5 D0 Q" Y' T- ~* J2 h
      if [ $ret_stat -ne 126 ]; then$ t0 {0 O5 c+ p  Q! g  u% i
        har_check_ret_stat& J9 O5 @" ?5 G" l; K6 d
        if [ ! -f ${har_ofile_prefix}.hl ]; then
% a) Q4 G5 t# T, ?# q          echo "No hi lo file generated after setup phase. "
9 P% t( v: b) i6 w          echo "Contact Synopsys technical support."
9 |* B6 f! N" M5 X4 }0 T          exit 1
+ ^3 l8 y6 g% Y5 }; V) ^" `0 ~        else
* f' A5 M9 ?, S# Q1 E          if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then/ j0 m4 B* O, {' e9 j
            mv ${har_ofile_prefix}.hl $har_hilo_file7 ^& L; s9 G! U! H2 J
          fi' R/ {' ]% q3 p/ ~( A$ u, H
        fi
. B' C+ P8 v& g. {" E" _  H$ a        if [ -r $LOOP_CTRL_FILE$$ ]; then
8 J- Y8 _8 i% \7 m. O/ i          run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file
% a: S% \! O/ A/ j  @        else
9 E  n" Q1 N2 }& h: F          run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file
3 {) w9 G  P% g& b7 n4 y% [+ t        fi
# n, _- G- V& T) d. u5 _, Z# G      else 8 k/ c, ^+ ^' c0 d( o0 V
        ret_stat=0+ O# Q' d; Z2 |+ B  m
      fi( o( f+ k, X& f3 @+ D
    fi. ], S( }4 c* `) I- b
  fi: S" {, s0 B. l# U$ S& j3 h) }
else  
- s" K4 C* U6 l# don't loop if -har_setup: B# W% L: M. M: G
  if [ $have_har_setup_flag -eq 1 ]; then
: F1 k/ b6 E$ ?8 F' ]    run_cmd $command $CMDLINE
; ^. D+ d- g4 w9 c; K% K    if [ -r $LOOP_CTRL_FILE$$ ]; then, _9 o% _* H: ^0 l7 Q+ v/ k: H
      rm -f $LOOP_CTRL_FILE$$
/ Q; s# m* @( P. u    fi
; O+ |3 l) |* `; `+ r3 f  else
) }( {" F$ O( I4 T) H3 b    run_cmd $command $CMDLINE
4 O- p3 K; W7 W    run_loop $command $CMDLINE
% M6 e" Y: v- _: Q& A* x  fi9 d5 ]0 p% Y6 z
fi
- j. P  n" P' U" ^& u4 z" }8 @  G. ^, ^# }9 e
if [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then
5 D7 m& G1 }5 O* u3 `2 Z  pwCreateErrDB -w $workDir -e $errFile, ]/ J6 }* _! ?% H/ _; P' t- z: k& z6 _
  ret_stat=$?8 |4 q; q3 \; e3 Q. h8 W: Y5 _# S
fi& E1 m5 c* R6 d' O: k3 j, @" _5 h* p
}
2 h+ ]- \' I* H0 a. U/ W2 I
5 k+ B2 b0 C4 j4 f. ~cleanup_alter()
7 q; d) F# t. Y- L; @( \9 D{
" C4 \$ ^  B7 B/ R( O   /bin/rm -f $ALTER_COUNT_FILE 1>&2
, e* E! Q1 ]% V1 a   /bin/rm -f $ALTER_HK_FILE 1>&2- Q1 L& }# Y) v# o$ z! v5 k# F
}
' Z: q8 u9 p8 e: t3 G; N
! {/ N1 n/ _2 z/ F: p#generate alter temp files based on pid
' B! x' U' S2 D3 k( ]4 X$ eALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$0 |; v: j& j- C$ X7 z. D
if [ -f $ALTER_COUNT_FILE ]; U% y) T* M* V' d$ t6 [/ l1 r% I
then
; m& m( [' O* |$ P' a  until [ ! -f $ALTER_COUNT_FILE ]
3 v, v9 W0 ?( |8 T+ c( e* a  do
3 Y$ p/ R- y: B! |6 X, I    ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$; j% [) T: ^$ W2 D" D" Q- J  n) ~8 T
  done3 Y$ Q& L' @2 A/ L7 Q
fi/ q# b9 X" F) V' Y
export ALTER_COUNT_FILE' F. i, s7 N9 y1 j" b8 K6 |# ^
0 l  s( G% v0 A0 ~! F
ALTER_HK_FILE="$ALTER_HK_FILE"$$4 ?$ @: o; a. f4 K/ D
if [ -f $ALTER_HK_FILE ]3 r' \* t2 o) v5 H5 w6 Q: j
then
% U+ B' Q/ _- p; o$ j" C6 D0 Z  until [ ! -f $ALTER_HK_FILE ]
) P: o3 B- e; x" N7 m! P9 o8 t; o  do
0 D- ?: w) [: t/ m    ALTER_HK_FILE="$ALTER_HK_FILE"$$6 q$ {7 M! B4 [  i
  done
  R3 w! F; y* n& Q% f2 ?' yfi
2 h8 q* G* {- H2 z+ rexport ALTER_HK_FILE! V8 }6 @. ]: }  O6 o% {$ j5 v
2 u+ P: i5 S" i  p1 M  c  }
#generate monte carlo related temp files based on pid
) C- T0 G( R' Wcleanup_monte()2 e( G" m6 V3 f: R4 a7 j+ d8 f
{9 r/ Y9 W; ]/ Y7 {- q
   /bin/rm -f $MONTE_IMG_FILE 1>&2* w# |8 `6 p& S& |; _4 a8 o
   /bin/rm -f $MONTE_IMG_FILE.gz 1>&2
- U; q& `$ n( F6 e- u   /bin/rm -f $MONTE_COUNT_FILE 1>&2
% F, u3 Q1 B, m% {9 g   /bin/rm -f $MONTE_CFG_FILE 1>&2
0 e/ b+ c6 ]; C+ H' `4 k5 p6 c& M}( O; ?% t$ u* v9 J# x

$ _' h' ~; J3 m# e% |MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
: g3 C% ~. ~. @7 M* Hif [ -f $MONTE_COUNT_FILE ]8 E" [1 \$ c& U8 z$ M
then# l2 @) V3 x% y) P# L' q! O
  until [ ! -f $MONTE_COUNT_FILE ]
1 V8 Y- Y% Q) @- w- H  do
0 D, E# b; h$ j( w6 o    MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$$ {. Z1 h3 R2 D* F$ Y7 P, P
  done
" x5 j" ]: A& e. C. R3 ~, v  jfi6 T! N- \: M" [! Z
export MONTE_COUNT_FILE4 m# b) z$ c- D, p0 M
: F6 o$ v& {4 t: L" e
MONTE_IMG_FILE="$MONTE_IMG_FILE"$$4 |$ F2 r6 A) A& U
if [ -f $MONTE_IMG_FILE ]0 B2 A6 n; m1 L1 \; Q6 ~3 c/ v
then. E. {) T9 v  c6 N
  until [ ! -f $MONTE_IMG_FILE ]# J+ X( d# v' c( s/ G. {6 H
  do  W* A0 Q* D% e
    MONTE_IMG_FILE="$MONTE_IMG_FILE"$$
' ^" s1 p* X! `$ {% K( n  done
, I) A% \8 ~- h* ]% M. Rfi
$ x. [5 A6 G: Mexport MONTE_IMG_FILE, k1 V/ h* d, [; \1 r2 k9 J

& D6 V& c& X% x9 ]  l0 JMONTE_CFG_FILE="$MONTE_CFG_FILE"$$3 O1 C3 G1 n2 u  {& k
if [ -f $MONTE_CFG_FILE ]
7 d) f; L* Q0 ~7 ethen  e( B0 c0 v/ F; c' j& }9 d
  until [ ! -f $MONTE_CFG_FILE ]! R3 j* N  X9 W9 }  r
  do) L! h+ f$ r/ i4 v" j
    MONTE_CFG_FILE="$MONTE_CFG_FILE"$$; K# f& j, @: S0 b) L% O
  done$ F+ W/ `) L/ ], A' O" R- `
fi
: G. X1 v3 h# u1 K) S1 D. j) D( }) i- {  F7 ^6 \8 p3 J
# main iteration
: i1 n! X& T  _7 l: Grun_main$ A: K6 H* W$ ^9 J# F
5 K8 W3 p" b) T. M1 s# T* d. u
if [ $ret_stat -ne 0 ]
: d% Q: a. q1 e. w) Rthen + m/ q  Q; {  h, J) q9 ]
  cleanup_alter
. Q9 S9 T( ^9 m* n! B3 q  cleanup_monte0 A; _- n) U, m. D2 S2 {
  Exit $ret_stat. t  Y9 k& U# v7 O0 ]5 S1 R
fi9 M# e; B1 m! Y3 z( @& q/ _

8 }$ H0 U7 m/ @' Y#Alter related iterations; M. B& Z0 c$ q) C

: \4 K; ?# |  \6 m! X  e& K& aiterations=0
7 w' A6 _4 W0 g0 V& _# [count=09 h$ [4 f" R" S% C
if test -s "$ALTER_COUNT_FILE"; n# h/ X/ \: G' u: V4 q  K: v
then
1 w' ]5 N4 \: d; R0 i9 s6 Y9 N  if [ -r $ALTER_COUNT_FILE ]; then$ M, ]; ]+ s' ^* J6 M5 d
   exec 7< $ALTER_COUNT_FILE. j5 X, H0 N: c9 c
   read iterations <&7& I3 V/ M; B4 j5 G- f) X6 n
fi: g# s$ x! _9 B8 a& d$ z  s
fi
8 ?$ Z7 a) R( {- g- E1 C
- Q$ i4 a; H: E& z  ytrap 'echo Program Interrupt; cleanup_alter; exit 1'  2
/ g0 z! j+ Q0 Uwhile [ $count -lt $iterations ]4 A( i# m+ K5 x, }/ Q. g
do. o; L; j" J+ B1 X; `6 R8 p( U( n
count=`expr $count + 1`* U& p) H! D) S; k' [
ALTER_COUNT=$count. x% A8 P2 s; o- E0 Z
export ALTER_COUNT
& S5 e' R5 h3 s  @$ V, L: d; f7 c/ V. z; d" ^) a/ U& x% }/ ]
run_main
3 X" U$ Q; H6 ?! x+ u, a* Q
2 B# P2 {0 ]+ E2 X2 y4 E. T9 X  Ldone
. o1 E3 t  d( g& Y- Y& U5 _! M* U9 f. V4 T) W, L
#Monte carlo related iterations7 f: E% e3 L2 y! M6 {* Q
8 ^7 N+ k  a+ C! V: y' S  h
monte_runtime_summary(): d5 G7 P! @# }% o! b
{7 F, l9 R! i& l& b
  keyword_1=real
4 O5 N8 |& b3 K; S  keyword_2=user1 ?0 Z; z; i8 T" `3 @8 s7 ~' q
  keyword_3=sys
' A. J. {0 u( d- H  ofile_prefix=nanosim' p5 L# [; o0 n
3 R' [7 H: V( K! U5 c
  if [ ! -z "$o_option" ]; then2 j, }6 C9 f) h/ j4 q
    logfile=${o_option}.log- |0 c# G7 P3 ~4 h
  else
! V3 z4 c+ S+ e; m    logfile=${ofile_prefix}.log7 l8 o  [# Q3 A. v7 G9 b3 L; X
  fi  i+ G7 j6 n3 e; t
, G" h/ O+ B! U1 ?
  if [ -f $logfile ]; then
' G' p3 t4 y" \' r    echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile      ) g7 K% v; T) W( s
    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
' Q3 B  ?# Y' U( }  fi) Z9 B, P) f4 S' P: |4 X; \
}
, p$ p7 K3 v4 ^# y) L
0 c: ]: U  c0 M6 _( J+ x! ?% Snext_monte=0
5 h" a) F  }" ~2 qcur_monte=0. T2 M* f- o9 a8 ^0 e1 g1 n
/ l+ {9 ?" l, f* g7 V
if test -s "$MONTE_COUNT_FILE"' A( M1 [5 v( t  e9 ?
then
& f( w4 H- B6 e+ r0 H: o  if [ -r $MONTE_COUNT_FILE ]; then7 K: H1 x' K4 i6 J% X9 X3 o; M/ e8 R4 j
   exec 8< $MONTE_COUNT_FILE: B# g9 [6 L9 L1 W( a
   read next_monte <&83 k" e0 c* y. ^1 A7 y
  fi
& U4 W$ r! H( w/ r0 gfi
0 q2 u5 H3 {$ X' u: ]; Q1 e; q  G) w! b9 F% [' B. H
trap 'echo Program Interrupt; cleanup_monte; exit 1'  2( Z5 l, Z, ]" |: B: `- R
while [ $next_monte -gt 0 -a $next_monte != $cur_monte ]
9 G7 U- Z: J9 s( Z- [do) u" X) t, O5 c/ h3 |# X
  NS_CURRENT_MONTE_COUNT=$next_monte$ x8 H  X) x4 T; D
  export NS_CURRENT_MONTE_COUNT: D' R5 u2 E0 @- o! `; w% f
' _, k9 ^* |* h7 l; U+ y
  echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE
' Z3 v7 y' P& [/ m5 z  CMDLINE="$CMDLINE -c $MONTE_CFG_FILE"; {- S; D0 r" L# P9 \
  run_main
8 t1 Q- n6 V/ E( c- y  s  F! r" }8 G. h) V' I3 G8 D7 }3 L9 z
  cur_monte=$next_monte
4 C+ W% ]) @) T  exec 8< $MONTE_COUNT_FILE- a+ `# Y6 @; x9 Q; m4 n3 A2 y
  read next_monte <&8
0 F0 T' \/ k! \- X2 Z/ s" qdone) W4 F8 f/ p! X
1 Z; v1 a* a1 n
if [ -f $MONTE_COUNT_FILE ]
/ u* u* t# A) m+ D4 S1 hthen0 m" H6 g* e  g8 J1 ^8 ?) |3 {' f
  monte_runtime_summary
- x# y9 [2 m% ?2 t6 T, S0 y1 Mfi
& g9 }$ T0 X, ]" U  p$ C  m
4 R, P6 {( P% I/ y7 D  C3 mcleanup_alter2 K% |2 A  E% h1 C+ d4 s. d1 x2 @
cleanup_monte; O3 r6 N/ d+ D: h

' ^2 Y% \" L, sExit $ret_stat

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

本版積分規則

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

GMT+8, 2024-5-17 12:24 PM , Processed in 0.147519 second(s), 16 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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