Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

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

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

[複製鏈接]
跳轉到指定樓層
1#
發表於 2012-5-6 13:58:13 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
10Chipcoin
各位大大好:6 I/ X3 @/ a4 k( ~
                      小弟執行nanosim時,卻無法跑出視窗來,有個錯誤可是我不清楚該如何解決?問題如下
6 I8 X" W( |9 Q4 Y/ [                      [: 113: 64: unexpected operator
+ W) V) F8 {* \+ B" p' g/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim: 1: Syntax error: Unterminated quoted string. ]9 k" t% `* e  f+ @- p
有大大遇過這方面的問題或是指導我方向去解決, 謝謝.
' g# U1 \. w$ a; Z# q我在猜可能是這個檔案內的文字需要修改 但不知道該如何修改?% `  R' D2 a$ ]; N7 Z, O
以下為/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim 的檔案內容:
8 m. [" f) @1 ?0 F( `    #!/bin/sh
& D" a# ^5 B% h#
6 H$ j+ O" z+ x4 ~# Copyright (C) 2001 Synopsys INC7 _: j9 _9 X0 m4 }7 b8 C
# EPIC Dynamic Simulation Wrapper (DSW). J, [0 ?6 S2 Y" v1 \9 t3 E; B  x
#
) ~/ y1 L, a) r$ P: \/ e$ geval ${DBG_EPIC_WRAPPER:+"set -x"}9 W3 k1 I8 A: l  c7 ^

' U; j- {" J+ j2 Xif [ "$EPIC_WRAPPER_DVLP" = "" ]; then+ y' g1 I8 I0 m% C7 Z/ y
    TEMP_ARCH="$SES_ARCH"5 M* L2 t; S. K2 {' z# h6 ~& B
else, K+ |" d! w) I8 R  u
    TEMP_ARCH="$EPIC_ARCH"
( U3 }" ~% {0 r- R1 @4 U3 yfi: ^" t% }  N& ?3 d' k! N

1 ]" C' k6 S  t4 oscan_for_hva_args()/ q4 R6 p; [0 I3 y; v+ W
{
8 {9 }' K) s* p# e- b/ a# z& F% l  /bin/rm -f hva.init 1>&28 E( [; S6 b" a8 M7 Z/ V
  while [ $# -gt 0 ]; do
" ~0 g0 u; z& A) z1 x    case "$1" in
6 w9 @9 g# n4 m% }$ K) g      -vaf)/ O1 @+ t. @% T$ f) x; W
           have_vaf_flag=1
$ m' l) E$ D' f, ^           have_va_flag=0
, u$ T% V1 h+ T6 O  F           shift;& p! ^; p! r1 A) U" B' D( I
           continue;
! R7 Q! I) X* D  ~9 }0 F5 H0 F        ;;
% [! ~8 D5 U: n; h& }. b9 h+ ~      -va). D  K1 H. @" P- P9 b& D, k
           have_va_flag=1
5 G7 D7 }$ y2 G! C9 a           have_vaf_flag=0) f9 X4 C- t. ]# l5 H; m
           shift;
- y# l6 o' }* o. }4 [, \, `1 r5 i) c           continue;* j) ]( t9 m! `! p# U' i  M5 s5 C/ U9 u
        ;;6 D* p) E5 h! C
      -*)
1 [6 R$ H3 r, Y/ R% ?           ARGV="$ARGV $1"% Q" Z9 M8 Y/ H- j  u: ]( X: Z
           have_va_flag=0
4 {' O7 G+ u) p" c! d6 ~* X  y           have_vaf_flag=0
; f! J' r) _% J0 i; |4 n           shift;( ?/ Z+ n- z! d! D: C
           continue;( O( {( `: s8 i  F5 F; e! z
        ;;) a" a- h$ v8 U# t
      *)/ X3 l& v* w" G4 I$ K5 b( C
           if [ x"$have_va_flag" = x"1" ] ; then : x" D7 ^- Q3 l) Q; ?
              VA_FILE="$VA_FILE $1"
# r% _( n* n7 ^2 R) p" E& G  L           elif [ x"$have_vaf_flag" = x"1" ] ; then
. V3 \& u# B% `3 F6 X9 ?              X="`cat $1 | sed -e '/\;/d;`"/ u( U* `; D% a& f
              for token in ${X}; do
- k8 Q% h" D. g5 s                 VA_FILE="$VA_FILE $token"
) _6 |- |+ w1 O  d8 s4 ?              done % I7 C2 f' v2 q8 Q. O$ D. G0 Z
           else
6 G8 {9 Q  w0 F4 V" h" R8 X              ARGV="$ARGV $1"
! T# L( a$ r* S5 m/ ^, T; G: u           fi  I' j0 I+ ?. E" ]
           shift;
% P- _4 b4 n0 M1 _0 @: ^        ;;8 ^. B( K( x* O) v& s4 s7 H6 q
    esac. w/ d  t$ I6 p2 ^1 e! x6 \
  done
. S  a. _; J7 l, u" z& ?
& p: Z: K% M  M2 r  if [ x"$VA_FILE" != x"" ] ; then 7 n+ I& T1 l3 H6 U1 q
##     /bin/echo " xxx ARGV $ARGV"& d4 S( E- \0 p% D8 a0 i! K
       /bin/echo "choose nanosim $ARGV ;" > hva.init
7 ~' l* {; z5 c' ~       echo vcs +ad=hva.init $VA_FILE -o simv
# J, e  g  A7 [- e/ X; k5 w$ P       vcs +ad=hva.init $VA_FILE -o simv  [& l( d' Z9 z! w/ U* a' f
       exe_status=$?0 [- Z/ R/ t; D0 \) \% D2 K
       if [ $exe_status != 100 ]; then  V: b$ ~0 F3 }) X7 Q
          /bin/echo ""' R7 t5 l  q. V3 o3 H
          /bin/echo "ERROR: Execution of vcs exited with code $exe_status"
8 X+ U9 i) s% F" S8 n1 U1 X  a* K          /bin/echo ""- A) C/ v4 J# C  z- \4 i( J% z! N% v
          exit $exe_status
. M1 G# G9 o! A3 H       fi. ]- P$ A1 |/ X
       hva_files="-n simv.daidir/amsVD.ntl simv.daidir/amsWRAP.spi"& q: R' b/ u: i. k. j; w# U
       ARGV="$ARGV $hva_files"$ p8 X: j1 V: j% }# t7 J
  fi- f3 Y5 h. y8 {) `+ R6 S8 Z
}
, q% ]. l2 w7 d$ _( a#-------------------------------------------------------------------------
! ~( L. ]% }/ C' F1 p
  ~% s$ x8 K0 ccleanup()
2 N6 O3 g; U, s5 y- y; @2 _+ b{& y6 @( Z& d0 Z) o6 G6 q
    if [ -d "$rundir" ]; then: X) J& n  ~& ^+ m
        # On AIX, a .nfsXXX file is created if libModel.o is removed
. `; `6 k. b' [        # so .epicrun is not removed because directory is not empty.
& Z& T8 u, _+ D* n1 ^& G" n& ~        # Solution is to remove it again if the first rm failed1 a" v* E, r5 |/ ]) `: R. E
        # (rm -rf $rundir || rm -rf $rundir) 1> /dev/null 2>&1
; ?) I# _: {  f! @        if [ "$EXTRA_CAPACITY" = "YES" ]; then  Q' C3 `2 Z' m3 [5 l3 K
        chmod u+x $rundir/rpcidfile+ G# E) ]1 D: b! B! O" P# ^
        $rundir/rpcidfile
3 f6 f9 D; ^( b' z* m        rm $rundir/rpcidfile  V3 c; s3 z$ K$ }2 [& o
        fi9 P0 T; U) N: Y+ u
        rm -rf $rundir
9 ?" _* J0 y7 a1 ~; x$ H' f' A+ v0 s; ?& Z
        #Due to NFS problem, we have to copy files needed to
+ `5 L) L. a6 v; P" Z        #/tmp/<temporary directory>, then symlink's files4 j, ]1 b7 K& G; O1 F8 P
        #to the local temporary 'rundir'. This avoids the problem; u6 k3 i, f( E. h6 m% j
        #to remove 'rundir'
* O( B" T9 l$ v- Y# q9 w3 L        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
; e6 g* E2 ^9 f& p. N+ O          if [ -d "$tdir" ]; then7 Q) }7 S: S( m
            rm -rf $tdir
0 |( i/ M% ^8 g7 i5 u, U* |, ?          fi
+ Y" b) N; c/ ^: p        fi0 a6 G2 M! o/ }7 G% I: D9 t& Q
    fi
8 c, i# Y/ }2 w: V* e9 _7 \7 p    if [ ${exitstatus:-0} -eq $ld_err_code ]; then& b' j5 o$ ~) f7 h
        [ "$has_model" = "YES" ] && rm -f $cwd/libModel$suffix- S8 K5 r( j/ h+ i
        [ "$has_custom" = "YES" ] && rm -f $cwd/libCustom$suffix
0 y5 }; q* J" a0 r    fi! f- W5 \) u7 E: p) p
    [ -f "$EPIC_SCRIPT_MESSAGES_FILE" ] && rm -f $EPIC_SCRIPT_MESSAGES_FILE 1>&2
0 _5 x6 O' D9 w  g" u    exit ${exitstatus:-0}
8 _' K, m; g: B; L  b}
9 K7 y3 m; P2 T, {3 }$ |) f9 g
7 R3 M: F* f/ }8 R1 jExit()8 |' {/ J5 z. }- e# I3 |6 P3 U  U
{3 q2 ^6 Y; u1 e2 S  G& d0 X
    exitstatus=$1" h. n; c0 Y: H8 N5 n2 J
    exit $exitstatus
) w9 q& W) S0 g, ^}
; G0 D: X* g# D: I/ L- O0 L' h% I0 _7 }/ z" [+ O
# get_epicrc filename keyword
% D3 D1 R! ^6 ?2 nget_epicrc()
' R8 I- b2 s0 h: n- X{* h1 l& q* _& a1 T5 Y
    [ -f $1 ] || exit 07 m0 a' r" A  h) X5 U
    key="/^$cmd2:/{print \$3}"
! U- c1 K( a" Z4 I* g    awk -F":" "$key" $1
1 j  z7 D. ^1 q- k}
0 o, {8 M  G1 b9 \8 ~8 |4 ~6 Y. B, d) p# z5 s# R1 H
#6 Q( r* w( W! w( l/ V' ~/ A
# set datasize limit to hardlimit8 l' i# P2 u5 ^6 U& T" p5 @
#( K( l( m8 H( r! T9 z6 q: Y( V
set_data_limit()
& E' e( O2 K. L" h0 x' k{
6 j5 O9 z$ a- o8 K    dbglimit=05 w; z- v( X1 K" B$ ]9 A8 Y8 U
    hardlimit=`ulimit -Hd`
7 ]; J: }% M+ @$ g    softlimit=`ulimit -d`
( s  g$ L) r/ t    desiredlimit=35000007 ^, X4 G2 j& N
    hardisunlimited=0! X4 }& E" h! s+ ]1 c' m
    softisunlimited=0
* D5 p0 j. Y! `' {+ S# v    is64=0
/ K: h4 U! g6 {4 ~- z4 [6 ^# m3 t; q5 M) T
    case "$EPIC_ARCH" in1 T; Q! h. M. T) b0 h0 @" n
    *SUN*64)) U, K6 N( `  Z, S3 n5 ~9 q4 W
        is64=1
* O4 \$ w/ R- ]! V4 U        ;;
/ |0 y# K! A+ _* e7 H    amd64)
9 k% t0 Q% d* P5 ]. t        is64=1; a6 _- T: c6 U& Y% H; |; D
        ;;" h$ j7 s9 Z+ d
    x86sol64)3 Q% j! r! S, N* G& S+ @: Z2 T: b
        is64=1
0 ^7 J9 `3 P3 X1 h1 o9 ~, y0 v" u        ;;
; h: b! w  o* B/ N6 `- M6 o6 @; S  p    aix64); n9 z' P4 L, P" {
        is64=1
3 E0 F7 p6 `. Z! [1 S8 _! a' K8 H        ;;
& ^% W: H/ t8 I4 ?    suse64)
+ E' O/ s. R5 f/ n* C- ]! f        is64=1: T$ P* d  i+ v
        ;;8 z$ U9 D- W- q7 i
    esac
6 u- K: n/ l6 \9 s' f. A. m) P  h7 @- i; P+ W( x  r
    if [ $dbglimit -eq 1 ]; then
8 k7 J! X6 J, q' a# m1 g        echo hard $hardlimit soft $softlimit  S+ @5 {+ h, D7 u2 q
    fi. b: `* \1 f& t4 N2 G
1 M( D" Y1 x. W" k. D# G
    if [ x$softlimit = "xunlimited" ]; then) S  s1 R; l; _( B) }
        softisunlimited=18 I& l- x" W6 l$ Z
    fi" w6 Y- H+ |  M( W( c  M  `2 L/ I3 Q

. W' ?/ _' K4 H; F    if [ x$hardlimit = "xunlimited" ]; then
$ ]- ^: L( @4 v& l* v9 d  Y: V% E0 o        hardisunlimited=1
% s  y! H- d. Y0 g    fi
; v3 e% t6 Z: [% s  k
$ }8 L7 E0 X: \0 A  @    # 64 bit machine should have bigger than 4G
& X' W4 K. M( P4 N+ n, q5 s4 a    if [ $is64 -eq 1 ]; then1 }& w/ ^0 }# x; l% Z
        desiredlimit=50000005 O2 O( i! }& |* C2 m8 Y, a
    fi4 B4 @( @% J: e5 t3 _+ H

5 P+ U) c# n& R- F. p0 p4 N  n& ]2 W    if [ $hardisunlimited -eq 0 ]; then, z0 ]" G% l- u- [' W  E
        if [ $hardlimit -lt $desiredlimit ]; then
: b! A3 n, E" A2 _/ `( j/ f! n# R            echo "WARNING: datasize hard limit $hardlimit K is too small."
5 r4 J6 d/ ^  p4 F% c4 R        fi
7 v4 M" e7 x0 k2 J. O2 f    fi
. K6 T( e. ]9 {/ A; P) z$ [
. }" V% S2 s, ]- f9 Z' o    if [ $hardlimit != $softlimit ]; then) l2 L. S5 f- D6 M1 l; u. @
        ulimit -Sd $hardlimit" M1 X# ~- ~: E( i' v% D& O6 u
#        echo "WARNING: datasize limit is set to `ulimit -Sd`"# p! f' L4 L1 F& H
    fi8 d& p+ m) G& p- @+ U. ?4 S

/ D: |$ e0 }3 E1 I    if [ $dbglimit -eq 1 ]; then( H, C; z6 w* n' @9 s* a3 p; E* c
        echo datasize hard limit: `ulimit -Hd`4 c" p! Y; [2 a9 Q6 U
        echo datasize soft limit: `ulimit -d`
3 p% @# b0 D2 g* Q, _    fi
" S' X; t0 a: S- q  ]2 M$ w& w}
* E2 P1 g1 N0 n) o/ U) Y" s9 k# \1 r* J( ?3 D4 E" J7 D
#  ~% E4 \  P0 G( x8 w4 v! A" y- @
# set stacksize limit to desired limit
1 H9 ~( o0 y. t6 _, s7 F8 L4 I#
7 u9 w2 ^9 H8 i& [! ^set_stack_limit()4 q/ l2 f$ g, X' n9 ^+ A. n0 Y. h
{
* D( Q. t4 _0 M    dbglimit=06 X* h# u7 w) V6 O
    hardlimit=`ulimit -Hs`
$ [* j: H9 `% i3 c' W    softlimit=`ulimit -s`
! S, s$ K9 W) i- o& a1 n, g9 s7 Y    desiredlimit=60000
# y3 R! A/ z" ^% U- Z% f. t% C    hardisunlimited=0
$ n8 ^% w/ g  d, a7 `    softisunlimited=0
! {% i" \7 E) I3 m    is64=0
4 y. ^% U8 L" n9 }9 I8 U
# L- n3 K1 \  T$ t1 I7 T    case "$EPIC_ARCH" in9 r( u8 |7 g5 q3 a4 {. h+ e
    *SUN*64)
* p3 V3 _7 q" n. Z4 n        is64=1
2 A# g3 S9 ^- N9 R) G        ;;
4 Q* u- {( D5 V. X; ]  p3 ~/ A    amd64)
4 v3 X- s! u( R        is64=18 T- R' F  V# |' c0 ?
        ;;( x$ N5 [# V* G; W, v: |1 F' a4 e6 ^
    x86sol64)
8 u/ l  a: D1 P, H        is64=1
! I, @: P2 r4 v% O% b& B) q        ;;
8 @& h, y5 f, \& Y4 h    aix64)& g0 y6 X- h6 n+ y
        is64=1$ ^+ D! [) f0 a% D
        ;;
1 o/ K" Z! s3 H' `) W2 J9 o$ y    suse64)7 j0 M5 E% O% g
        is64=1/ q4 T) P% W! H
        ;;2 C$ z+ }( @0 x
    esac1 B& [; D# m& v- X( }

  A+ u4 Y( ?. |( r, Eif [ "$EPIC_WRAPPER_DVLP" = "" ]; then- J( r' I' @3 q) p7 n& ]
    if [ $is64 -eq 1 ]; then
6 G' c% ~, a8 v7 u2 d" L        desiredlimit=200000
3 s* C0 D7 E/ q: p7 \1 n    fi
) K# v# U6 }) Q& ]else+ c4 t  ]1 \+ }$ c! q
    case "$EPIC_ARCH" in
/ Q( E, ^1 Y$ N7 U    *SUN*64)0 [; q& ~0 e! |! x. V) |
        desiredlimit=200000
2 M9 W" K9 z  i# h3 E( Y2 @        ;;0 `: S3 I; t( n: d6 w6 C0 [% U$ V
    esac
5 r. C$ [5 K$ o* A" T) ^5 Hfi5 b; T+ z: }* |7 ~2 \
       
; ]: v$ ]3 z$ z- }    if [ $dbglimit -eq 1 ]; then. h9 i1 g) c" I) m0 t) K
        echo hard $hardlimit soft $softlimit
9 O% c# _7 N# W8 o7 K# M( N& J    fi
- f3 e, |4 V/ [/ [% U( m! |" e" ~# d7 X
    #stacksize can not be unlimited, pick smaller number
4 y/ @. p4 A- B* b" V0 A* H9 z  R. K1 E' S- `; X4 E
    stacklimit=$desiredlimit3 A6 s- `0 V' [% ]2 q
, q2 M7 G6 S: {8 J
    if [ x$hardlimit = "xunlimited" ]; then# e+ W4 F& Z2 H+ u, z
        hardisunlimited=12 d9 x5 ?  b* V0 l( g$ z  b" i
    fi
  \, J7 \7 X1 s4 }& K
( k& D# r4 q2 z1 P1 W2 |    if [ x$softlimit = "xunlimited" ]; then
% F6 }& J8 M, O        softisunlimited=1
: ~) n! H+ S! e3 Y9 ]    fi
$ G. c3 {! `6 g9 G+ m  v. [! P6 `- w+ w$ ~0 n( ?
    if [ $hardisunlimited -eq 0 ]; then5 D. y5 v8 a8 A4 n) b; U! p
        if [ $hardlimit -lt $desiredlimit ]; then) t( p: p4 Q2 n+ }- g
            echo "WARNING: stacksize hard limit $hardlimit K is too small."
. C% h* G3 ^- I" W+ ]% k% _4 p5 ]% y            desiredlimit=$hardlimit
( ^. k& h5 b" U- D) I            stacklimit=$desiredlimit
. _, O6 f: O* j7 O% Z+ S' l        fi
! ~5 H+ b/ M/ Z4 F    fi
; f+ [/ J' Q2 N/ h; D. i8 u( U9 i" g; p5 w# S
    # desiredlimit is set to proper value (< hardlimit)
' z6 E" }( G/ v9 `
5 M. G4 R! n( K7 c. L1 f8 b9 E% k9 D    if [ $softisunlimited -eq 0 ]; then
5 M5 m+ G( m& L9 d/ p7 S7 r        if [ $softlimit -gt $desiredlimit ]; then  J4 @* h# t" k/ v2 e+ H7 R: [' J" G
            stacklimit=$softlimit
( H! V4 P) u+ `7 `/ n* v        fi
0 D/ l8 I% K7 F, {    fi
  j6 M$ H9 N/ d4 [  w' L% q1 y2 q4 s5 q/ C+ h
    if [ $softlimit != $stacklimit ]; then
/ g& o1 F' W' h- z# `        ulimit -Ss $stacklimit8 g* _! G" D: ^0 n
#        echo "WARNING: stacksize limit is set to `ulimit -Ss`"" d- {6 y! v# @9 F
    fi
5 d2 a" ^6 h) Z; [) e: a- t$ y( M, m6 c
    if [ $dbglimit -eq 1 ]; then
0 n. j; H% v0 v: t% i) V' |" n        echo stacksize hard limit: `ulimit -Hs`
% L, u0 V  _8 C# |* g        echo stackize soft limit: `ulimit -s`7 O5 q1 g8 b' f* _& h- [1 Q% \' S
    fi$ Y* l, _1 l* h' h9 i; Q6 v; N
}
- |# a3 r1 `9 P# G/ a6 E
" Q1 T! A: V7 U6 i2 P* Popen_epicscriptmessages()
3 Q/ H5 F: m. o2 _" B{- ~+ A5 U) O/ g) a' V0 b" i
#generate  temp ".epicscriptmessages" file based on pid
: Z3 R# y5 a  K6 _2 z  e9 d& @EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$- D6 @4 f" y4 R! t5 c7 y' a
if [ -f $EPIC_SCRIPT_MESSAGES_FILE ]/ w9 k  M; f# L4 l
then 1 n+ O, {( k  o7 k
  until [ ! -f $EPIC_SCRIPT_MESSAGES_FILE ]
7 }) I4 l. a( `  do
( _9 v4 {1 K# S  Q1 B% C    EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
; z7 f4 \1 {0 b8 ~' K% E9 B  done
7 ]' A" G( d. S  Sfi  }. ]$ J0 `2 q7 |% x
, O: K* _) f0 Q, p) O5 \9 M
export EPIC_SCRIPT_MESSAGES_FILE6 o/ ^( A& K/ d% A* [: w
}
9 _) l+ [5 t4 U3 p" X; e: V1 z/ ]$ t2 D' _% E6 _; y
' ]+ i, t0 s. w: ~6 @
cmdname=`basename $0`3 A. @# v& L5 H6 M' m
postgres="n"
, D! I8 J) k# E2 {. }. ~ostore="n"
0 Q+ @* r  U2 {gui="n"
' Z) o2 e! ?5 g# \7 }0 K. edatabaseOn="n"
3 c- T; ]+ o; ~3 Of_next=07 G1 X3 T9 x" T+ {( i/ V4 r
f_option=""& E. Z# z- J, _$ ?# s2 }& W
o_next=02 q/ C8 P5 v- p0 g
o_option=""! `: l5 ?  f  G+ @
workDir=""" C8 N0 m" V! G% B2 ]& c) j# k7 E4 z
workDir_next=0
! U2 e) _% T- d. KerrFile="powrmill.err"
  v. G' \9 ^6 P' gwin32flags=""
; C' V# {) d9 hln_default="ln -s"
. o: W$ l* |# w, k
' V/ Q: T$ R9 rhar_hilo_file=""; o# K7 q6 W3 h- b  V! c
have_har_flag=04 T, i1 {6 {! g* g, X
have_har_setup_flag=0+ e4 ]8 p7 e3 f0 p) B+ k* V
is_special_har_run=04 s6 ^1 s' z) h- t( g; k
har_ofile_prefix=""5 Z( A8 w; ]+ Q( L, @3 |4 K

6 ^) f# X; h& ?, e8 F0 g$ Ahave_va_flag=0
% z, E3 R% Q- F/ ~/ s8 Q3 Whave_vaf_flag=0
1 u! A/ y0 z# Z  N3 `% \VAF_FILE=""
: `" P! c2 m  h' @VA_FILE=""1 \2 Z7 G. V1 X, g/ @3 A
ARGV=""' ?0 j) S! _# ^
1 `0 Y6 R2 A# G0 Y4 a
ORIGINAL_COMMAND_LINE=: ]% @( H/ ?) H
LOOP_CTRL_FILE=".ns_ba_env". c9 R8 Z- A' @, r$ r
ALTER_HK_FILE=".alter_hkf"3 e" x- s2 c- u, m
ALTER_COUNT_FILE=".alter_count"' M. x" R  ]; f$ j
MONTE_IMG_FILE=".monte_img_f"
: n( n, i7 K, w" c' pMONTE_COUNT_FILE=".monte_count"' I& o+ P6 L7 w  T/ b3 l% h  }# h, `
MONTE_CFG_FILE=".monte_cfg"
2 ~% m/ D8 z8 N1 |2 KEPIC_SCRIPT_MESSAGES_FILE=".epicscriptmessages"
' B: ^2 L) t2 \" J, ?0 y8 d
6 }9 A& f4 i( {' Popen_epicscriptmessages $@8 J( z) c" Z- H- t- J+ G$ Q7 X
/ @2 V0 t, C* Z9 t
scan_for_hva_args $@1 |, H7 a/ N; @

% o' n! a3 p" d* o9 W. ?" nscan_for_har_args()7 v3 z9 V' \/ h2 a2 c- \
{4 v: p# U1 e8 i6 }
  while [ $# -gt 0 ]; do
2 k% {) y' G1 j; j' }+ U    case "$1" in: H; J# L6 Y% k+ L( l
      -har)
3 J5 K, j1 @- t/ r% `% J           have_har_flag=1
9 E+ l! j% n" P- a1 M           [ $# -gt 0 ] && shift/ \8 T. R9 Y! {; T1 V# e
           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then/ q8 p) N1 k+ L
             har_hilo_file=$1, t" U/ j, E( I- P5 L
             shift- t$ g& h8 ~5 w- M; g* r! _, `& {
           fi' X+ q7 m/ ^( y1 v0 c: ~: w3 i
           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then
) r" P0 u# O9 ^3 u+ o             echo "Too many arguments to -har flag. Only one hilo file allowed."
+ @* G5 Z  O) h1 B5 y/ c             exit 1/ N$ ^6 ], N5 D% ?+ b
           fi
7 a7 N+ J! d" ^) e% A5 R           break
# |; D* i* g2 A; V6 O        ;;( a# d7 X2 s( [* a3 l2 b
      -har_setup)
( @' V: _" ]8 T' r           have_har_setup_flag=1
5 d- N; x% h/ e" z6 v+ e           break3 j7 N- k) c$ D$ c% {; Y
        ;;
( P9 g% @6 `3 m$ G      *)
  q5 @  B4 h3 @6 p6 _  b8 E        shift
* ^% j, X8 W4 p( t& |: g        ;;
. |7 o3 i) S7 S    esac. H) E2 L/ k2 [+ B
  done: |4 [" H, {) E* ^
}' u. Z) D. @0 y2 Y2 Z* N* T( |

9 w9 e! d, R7 L6 b& I, bscan_for_har_args $@/ f9 c3 }2 S0 k! u4 `
- M- y4 L" E+ Y! T  k3 L; K1 h& z
for argv in $@
  A' o0 `' M$ e: Gdo
9 M; o& C' k  f  ]$ R   ORIGINAL_COMMAND_LINE="$ORIGINAL_COMMAND_LINE $argv"2 f# L0 V* t) V4 T. G/ E
    if [ $argv = "-gadb" ]; then% h. q% k. j7 T) X" Z5 F
        databaseOn="y"3 R2 H: E+ F# `3 l) X
        workDir_next=1
# C2 T+ p' ?! y; l' F! b5 j2 S- S    elif [ $workDir_next -eq 1 ]; then
4 h% w9 `9 S$ r; v        workDir=$argv
" x* v/ N  O& M        workDir_next=0$ P* P, t1 V" b9 ]
    elif [ $argv = "-ga" ]; then! ]) ?7 ?# ]) R# S! q) C! h( G- X
        gui="y"
# f9 i* v1 V3 H' B" B. L    elif [ $argv = "-f" ]; then
: J' z0 y( C. \4 G        f_next=1' {$ M8 T3 D% G
    elif [ $f_next -eq 1 ]; then
4 ^/ g- J# _' \5 Q. y        f_option=$argv
  q0 f7 r: g; D        f_next=0
/ s3 [, \& ^: R, Q' N0 u+ H/ j0 ]    elif [ $argv = "-o" ]; then. T5 ^0 I0 T" w* T, W
        o_next=1- d/ K7 _8 I" J4 }
    elif [ $o_next -eq 1 ]; then" B  F2 s1 ~! j+ s: q( V
        o_option=$argv
* z' O! n# E' u! s7 g        o_next=07 D# j/ O. Q& ^7 X" Y/ w! ]# p
    fi
# @1 k  R8 S: ]0 W, {done
; V3 X0 i, N, F+ S3 }echo "Command line options: $ORIGINAL_COMMAND_LINE" >  $EPIC_SCRIPT_MESSAGES_FILE
$ Q! m, q1 x% M; _. U/ P, r
3 {0 s" n% G. m& |! oif [ $databaseOn = "y" -o $gui = "y" ]; then
2 }2 W3 g7 C7 ?# d! j- |9 ^. l  if [ $cmdname = "pathmill" ]; then
  N  b: B/ M' n% o    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5"  -o "$EPIC_ARCH" = "SUN4_SUNOS_5_64" ]; then! V2 B5 Y; U( P2 ~( r& F
         ostore="y", K# U6 W  M+ M6 F% h: l
         postgres="n"# d- e2 f7 T; l/ W& Y7 G9 s
     else0 {1 c9 A2 i# b( z' O+ u
        echo "athmill GUI is supported on Solaris platforms only" 1>&2 ! b+ ?  q( b* N4 k! X: g8 q4 k- J
        exit
: I2 y- t: Y4 j3 A8 W     fi
- l* r8 Y9 W4 B. v; K6 N2 a  else
5 X& a4 S2 l" _) k    postgres="y"
1 h# K5 y$ f. ]) [0 s5 Q         ostore="n"7 _. R& c) q3 f- U
  fi; [( N9 P: f1 d9 k) W
fi& {+ |2 g, A& k/ E% t, h

/ ~; g! m+ C$ e9 Pif [ $gui = "y" ]; then
1 j, S. q' f9 w9 [+ f9 I8 N1 O4 o, H    if [ $cmdname = "powrmill" ]; then. H0 e2 g1 w- N1 o5 R
        pwga $@
1 z' k+ `* ]! G2 W% e        exit
; M8 O3 {' N! _) b) Z4 q    fi6 N/ Z! n9 N2 Q# |

* X/ S( v6 C9 m  Q% x    if [ $cmdname = "pathmill" ]; then
  B1 R( @9 Z3 ~3 d- z* n4 W) }        if [ $ostore = "y" ]; then
6 _% z5 _1 c; s4 a           ./pathfinder $@
% a# Q0 n% G8 t" ~: x; {9 ~2 B           exit4 @6 R/ K9 t0 ?
        elif [ $postgres = "y" ]; then
" ?# z8 g7 _# f7 M           pmga $@
4 k' X" V1 O) w: z$ R           exit+ l/ R2 _; j4 I- Z9 x0 X
        fi% M9 ^; i4 `  m! Y/ C
    fi3 {- `( `6 ^2 A. v9 K+ Z7 d
fi% s3 V9 K6 M3 r7 O* q6 Y* A
' s- P, J# @3 `" Z+ X+ ?, u# o, Y  q
if [ $databaseOn = "y" ]; then
, |& k8 d& H. `   if [ $ostore = "y" ]; then  s+ [& t: V6 i' b8 A$ @; Y1 c. \
      if [ -z "$workDir" ]; then2 X0 L" ]- x. i5 `; C- u1 D3 L4 C
         echo "Error: Missing argument for -gadb option"
4 G2 @* J/ k* P, {1 R0 V0 M" D         Exit 1
  h9 K# F' M) s( ~2 [7 l      fi/ `4 Z! ?/ c4 `$ d9 P
   fi" H7 \5 W" \2 g$ }) y* x/ k+ n
   if [ $postgres = "y" ]; then
1 O/ P) x( D" i" u& W) a- f' [- h      if [ -z "$workDir" ]; then
, ]' C0 j  I* M         echo "Error: Missing argument for -gadb option": S' i  P& x2 m! w/ `9 \7 J% m7 J
         Exit 1; @' `! ?) C$ k* ]" |, \1 s( v/ N
      fi
/ q( z/ t, A. ]3 b   fi, f/ A9 @& V# {+ N. {3 [/ q
fi
5 r  y9 [* u6 R# _
$ q2 i! X9 O( H" q9 B: }0 V- O# rif [ $postgres = "y" ]; then) t4 P% L. x# G/ h
# b+ M9 E) m* K# t$ j$ D1 M
    if [ -r $EPIC_BIN/scripts/gui-init ]; then
. ^& R" G5 ?" L  g        . $EPIC_BIN/scripts/gui-init0 |- X; E6 z& X* i! }1 d
    elif [ -r $SES_ROOT/bin/scripts/gui-init ]; then
& d* }* U+ _4 p: E- B8 a* e' k* \        . $SES_ROOT/bin/scripts/gui-init
  `2 a* L9 k4 n+ X9 q4 r( z    else  S; T9 r" a) W. v: g, x1 u0 P. L$ W
        echo " ** Installation in \"$EPIC_HOME\" has been corrupted!" 1>&2
, ~, `& S; f0 W7 x% P        echo " file bin/scripts/gui-init is missing." 1>&2# a3 K! v/ ?; Y: |7 l7 S! i
    fi4 G  b6 i  I2 f
3 ]$ W. `  S3 l1 o* w! j$ M
    workfile -tool $cmdname $@
, P  q$ }: v9 T. H3 i) Z9 kfi
# q  t. |8 |& Q. j/ B% Q! ]
9 C1 ~- i( ~0 W* ^6 vif [ ! -z "$o_option" ]; then) @/ h# [% N, H8 f' E
    errFile=${o_option}.err
9 [/ ?% v6 L3 ielif [ ! -z "$f_option" ]; then5 r  S% [5 x& f1 o/ M7 K
    if [ -d $f_option ]; then8 w# {; e+ p! u' e7 F: D3 R
        errFile=${f_option}/powrmill.err, a6 H' A! H1 w4 l$ k
    else errFile=${f_option}.err! }. o6 @$ h: ]& t
    fi
' B4 R  [9 C3 Z$ c" }fi4 q$ P, Q4 Q  l! G2 O* a
4 c) a9 T0 o" K, E/ j- x

& C- K% P" u  ?3 o3 V: dif [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
- d( O* a: g! T  rundir=.epicrun$ E( d- ?  b0 ~
else+ @, y$ W$ O. n4 W' U
  rundir=.epicrun$$
( e9 ]* w$ E' M7 _6 ^6 X  }, E. Cfi
3 B/ O% Y/ E" X0 K# b
7 z. k6 U* D% o, z9 llibpath="$rundir${EPIC_DLIM}$EPIC_DIR"9 I: ?. W  g( j9 s$ h- f! Y( [4 ]

( Y" A$ J  y* Ucwd=`pwd -P`
* G3 x4 V( |6 U: aif [ $cmdname = "acehdl_w" ]; then
3 G5 F9 S' U7 [- k  cmd=`basename $0 .sun`
" x, s8 N/ H$ r8 G, W3 y+ Y  cmd=`basename $cmd _w`
8 ~& |7 @4 u, D* T  s: Pelse
& F) ~' c: U1 f  h  cmd=`basename $0 .sun`0 F1 ~. O0 {( ^' J
fi7 I" [( W1 h. W, R! ?5 |6 q

3 ^" b9 z- _$ O7 J0 f+ Tcommand="$EPIC_EXEC/$cmd$EPIC_EXEX") p. @" B& w% _4 x2 W0 B0 T
[ ! -x "$command" ] && echo "$cmd: not installed!" 1>&2 && exit 1& V# r8 o' `( ?* J
7 C  g4 Y9 `/ t3 U0 t3 D
# buildmod extracts -u/-fm options and calls genepiclib" @' w. O) p. i4 @$ T
# It also set the remaining options to variable CMDLINE4 O  C7 R) A5 I: l# Y# l0 F
# look up in .epicrc for -fm & -FM parameters
4 x. R& U  P6 {8 p# K
0 d( F. N' R! K$ t' Q; T! cfmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`"# a* J- L( ~& K
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`"
+ e$ G8 }) M' x$ e7 b+ z[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`") D6 W) B0 }' }) N; x

- [3 o: R. ?0 [& W, n0 iFMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`"9 @  @" \( q  ]! ]
[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`"
$ k( C  P' B% G: h6 B[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`", s& y; C+ E# v0 K

$ U6 t. R; E$ w# F0 g! Vif [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then
4 E9 ~) h3 C+ c0 F, g0 G: k% e& F    # note that the buildmod script will set the CMDLINE variable# b+ L, ]3 I7 ~
    . $EPIC_BIN/scripts/buildmod
5 M* t$ M- E1 _0 U: O9 H
9 P# s/ C: a. B! G2 p! D    #echo "This is the value of cmdline=$CMDLINE"
' ^& P5 e& z  Y% T! A    #exit 0& ?9 X. D0 E1 k  C
  i0 E# D7 f  ]0 a
    # if a new timemill/powrmill/pathmill built, run the new one
2 e2 _" Y$ Y! ]    [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX"
, [9 p6 l+ c/ Dfi
- J4 B- z( P" \1 |& f+ ?, ^9 M( @$ H7 z+ W6 l) o9 d5 n
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then6 X( `8 v* ~; Z+ O& ]" G# O
  if [ $have_har_flag -eq 1 ]; then' K- N! z$ z" G% k+ c, [. u2 Z) ?
    is_special_har_run=1
' [& h, L) \8 J% q    if [ "$o_option" = "" ]; then* A8 N% U/ Z/ L1 }! v- m0 [* [
      case $cmd in
' Z9 I! g, T6 n: n9 D! W% u' E: q        timemill)) c. l3 O8 ~& d' f+ Q- A+ ~
          har_ofile_prefix=timemill0 Q9 K/ @& J" O* w
          ;;
# f4 G1 Z8 _! C9 @8 p        powrmill)# N/ \6 w' R! u9 D+ ~
          har_ofile_prefix=powrmill
& o' f+ M) n" F9 |/ O8 x! w( Z* O) S          ;;* ^7 K3 j( ]* R! C
        nanosim)
7 B( Y, G% W, I4 y% \* D          har_ofile_prefix=nanosim8 ?/ Y; @/ [( f/ _3 X7 |
          ;;
( k1 d2 c* K7 @: e/ W3 A      esac
5 p/ I& j( @& N& Z    else
; K2 R) B' f, t# M9 s0 ^* ]& v0 ]) J  P& Z      har_ofile_prefix=$o_option
& g7 q6 o5 {# C0 |# ?; W8 W+ b' Q1 n" f    fi
* g$ @- n1 q# L$ g* Q9 S: K fi5 |& \' i8 X$ X/ ^9 m4 @- D
fi9 W4 s8 A5 {: T' D- N( T8 w

" l8 k: v# U+ J5 {" F' L# Call Double precision version of the product if -D
4 o1 s* i' j: q0 c) B$ w! c# or simulation time > 1,000,000 ns.$ Y" S# Z3 X% }9 K1 p& y
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then( `) E( p- R9 _2 e
$ d( E; M2 b  _8 d) O% f" {
  # Now the binary always has the ACE feature
  n8 o# K& o. [$ X  USE_ACE=YES! P, c: Y2 ~5 J: D8 f! [) d
% [; Y8 W- [) J" ^/ |
  HAVE_DP=NO
, T+ T- z: @1 ?, y  EXTRA_CAPACITY=NO
3 E' {- ?2 w( Q% ~) ]% p0 O. a  DB_REAL=${FORCE_DB_REAL:-"0"}5 k9 Y" o, Q, t5 a: L
5 X/ t" b; J$ t1 o# i3 x; I. a. h
  # Enhance for ACE ease of use4 {+ I/ V6 t. l- k: C8 f
  # If no command line option or only a -T option, do:
& e; {* V3 c/ [2 J' b! ~  #   1. set -A option- |7 V" r! U8 [4 R( @
  #   2. assume input file to be hspice' m# l; F/ a. L6 ^: T; `
  #   3. set -o to input file prefix; G3 o9 P5 f) P# i5 z, N
  #   4. set -z to input file prefix
+ _3 ^5 u! ^7 {; S, M0 U4 ~' J  #   5. set -c to default config file# X1 F+ d3 q. E0 v; D; h
  netlist=""
! E; @' w" T0 Q1 A% D6 j  minusT=NO( M4 L5 @( X# k5 G9 b2 t
  useStdCmdOpt=0" o* l* {# W3 Q+ ]
  prefix=""
7 t4 O% E4 w& M3 m' w/ X" t, Y  circuitType=""( T) J: l/ |" o! N, @' a% U
  for opt in $CMDLINE
" B& `6 A8 D7 S% K& U: R  do
2 ^4 `9 Q6 A% x; B! Z: x# d* M. w    case "$opt" in 6 I$ ^1 b7 R2 k  l0 Y
      -T)
# t8 I4 o' i, O; ]. c        minusT=YES9 N; I) q$ }3 i! ^1 m
        ;;: ~, A% q" }7 s7 e$ D
      -*)
, g+ {( m) e' I' `* T* I' ^" L8 f6 o        # using standard powrmill command line1 P) Z& ~7 I/ e4 X+ o
        useStdCmdOpt=1
% P+ L% q3 r7 c        break
% J. M& R1 k' E5 s, z( N        ;;2 g% W  A0 b, Q- c
      *)
& Q1 a* N$ A3 ?2 p4 e9 A       if [ "$minusT" = "YES" ]; then
; p( Y8 }8 m/ i+ P. W# _9 n         circuitType=$opt/ R6 ^5 C, x, `2 e0 |
         minusT=NO  # reset flag
: s- h8 N1 M6 H$ ?  w  @8 t       else 5 ?7 w  v4 o! l1 O
         if [ "$netlist" = "" ]; then6 b2 ^7 _2 W6 P- e# V0 z4 Z8 P" G
           prefix=`basename $opt`
2 t: n- A; A4 `. a! g. W           prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix`! y! G$ D7 Q! q- Y
         fi
  n4 ^6 N" I/ J4 E$ P8 [8 r         netlist="$netlist $opt"
/ ^0 u; y- g, \( G/ X       fi
  y) L& s2 Z6 `! D       ;;- Q$ Q5 l# F# q, U2 k1 }0 C
    esac0 @! q4 d6 p5 ^, W! o8 p& ?
  done
( y" V* y% D6 R% W
# d, [) j, f: K1 o- D2 j9 ?# D3 F2 \0 U" S' b. B- X1 U
  if [ $useStdCmdOpt -eq 1 ]; then! K# d' L7 _# c# E, w
    # use standard powrmill/timemill command option: i+ ?( @) n" B
    for opt in $CMDLINE1 \1 M8 X% F) F8 p. Q& i
    do* [3 d7 e1 l, t8 z( U( C! s' u( p
      case "$opt" in % t% Z8 |6 Q1 w' ?& u/ T
        -A)
* k% ]+ [- ?& r! M- \7 T            DB_REAL=17 {; T3 q7 q; w
            ;;. ^9 o- }- X) a0 x  Y/ ?$ @
      esac$ l5 S/ Q" l! B% v/ q: W# [
    done" Y& H+ G4 m2 h( g- I& q* R
    if [ "$netlist" != "" ]; then, b- T+ P" S/ E+ ~% o* E# [
      CMDLINE="-nspice $CMDLINE"" j( E" L3 e& h9 D0 B4 T  ]) @$ i& E
    fi
8 F5 o9 g, i! g4 Y  else
8 D" \. u$ \( T7 [5 j2 k/ q+ f& K    if [ "$netlist" != "" ]; then
8 f+ n5 f  ~2 k) @" O8 o      EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"}
. n2 k+ S. ?; Y3 |6 }0 x' z      # construct new command option1 |* |& K1 Y8 P" F0 r
      if [ -f $cmd.ini  -a  "$circuitType" = "" ]; then
2 R7 ?! |9 a; v4 k& Y        CMDLINE="-nspice $cmd.ini $netlist"3 B  T4 F7 |# B$ U% [9 H
      else) }9 L& F6 i7 ]/ A+ ^8 ^
        if [ "$circuitType" = "" ]; then
  S1 u9 X# u" H& S$ C0 H9 q. e          circuitType="msana"
) e: Y2 T! m6 I3 A, g        fi" |2 X. J  a7 X, W6 h, @
        CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg"
5 K7 d; v' K: ~3 ^4 J% W      fi
. O% x! z5 A" B; E      CMDLINE="$CMDLINE -A -o $prefix"
- W& ^' d- H# D( T! w9 g) x      DB_REAL=1
% j9 }) \" d; Q3 j      echo $cmd $CMDLINE6 r: o9 O% t9 w' F: m8 G0 J
    fi+ M* U& i4 A& j- k/ y5 O0 a7 x3 n& C
  fi
( J9 U4 I: y( u2 h/ u# Q8 Jfi # cmd is timemill or powrmill or nanosim or railmill or pwarc! A0 T. |. n6 ~# \! h' c0 w

4 E/ C+ R0 K( F" X[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a"  k7 F! H. F. N' c+ o- ]2 E# ^$ w
[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a"
1 z: M. a! s; t9 G" p[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v"! {" i1 Q0 j; G! z2 M/ [6 [$ M

+ L* g$ f6 e% ^1 s5 P' T( E+ kif [ "$__engine_wrapper_called__" != "Indeed" ]; then0 f4 ?( u2 {7 T0 S; q
    __engine_wrapper_called__=Indeed
# R8 a7 S" F* @. ]    if [ "$cmd" != "amps" ]; then2 w" R, \/ i& Q8 h
        export __engine_wrapper_called__7 H( z+ _9 k+ J( \
    fi1 r! F* w0 ^  g1 _* Z/ J

( W5 T% b$ A8 I9 k% |# F5 A0 {    trap "cleanup" 07 _& ~2 z. ?7 ], p6 W2 x3 M
    trap "" 2. d* S- N# [" n: b* w1 Y

; o$ V( m1 \4 I, U" @    [ -d "$rundir" ] && rm -fr $rundir6 H9 e9 }! E6 a/ X$ ~1 D
    [ -d "$rundir" ] || mkdir $rundir
+ W, C0 H& R8 j, ]% j! S# G% P" m" T8 |0 c
    case "$EPIC_ARCH" in
3 R4 n. w% ]; p9 z    *SUN*64)   - N/ c+ C( p! p" Y" Q/ u% r7 j+ ?; V
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
$ H6 y" C' B2 [9 @        export LD_LIBRARY_PATH
2 V6 x/ w/ T2 u5 y! c+ v3 P* _5 f( Z        suffix=.so
* D/ n% n6 Q+ a4 y        ld_err_code=127
' b& J7 ?5 i8 h. v6 I) p  L        ;;5 w( k8 x5 \6 T4 W- s
    *SUN*4)   
1 V8 A7 K! d" W$ N  ?' }- w        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
7 |5 l/ ~7 I8 @' V# ~        export LD_LIBRARY_PATH& k. Z7 e# h: Y: u9 y- f
        suffix=.so.1.0% j. P  G& r' g& {
        ld_err_code=127
, B9 M7 u9 S, {7 r( M; p, d2 {        ;;
( d# U: }) A) C8 S8 I! x1 i    *SUN*5)   ) P+ l, P  d2 [2 z+ X& e
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
6 H% F& @9 P9 L& U- S# b& ~        export LD_LIBRARY_PATH. |& L9 l9 N) R4 |8 v2 k- ]* N/ J
        suffix=.so
8 }' g8 _' X5 ~0 U6 }        ld_err_code=127
3 ~% o5 `6 N7 ]. N# w        ;;! `3 N% V9 N. b' g+ u6 G
    x86sol*)   
: e1 \$ Y. T) C+ ~- ?2 n# N; V, Y        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"8 H) `3 @6 }0 J2 P. t
        export LD_LIBRARY_PATH
: Q6 X" ?% q' C+ v        suffix=.so/ R. ]% T& M( }
        ld_err_code=127' r1 j7 u/ A2 V  V: p
        ;;% p8 E4 {! j6 p0 d0 T) X: Z
    *AIX* | aix64)   9 G, b0 _: _" m9 N4 C$ m3 c
        # When genepiclib creates shared objects, it creates a import file and % H& v5 H1 E  ^/ n% d
        # uses timemill as program. So at exec time,program timemill is needed
. B" U. Y: h3 G' R( g$ N+ s        # in LIBPATH- J3 c* D! u* W$ i) u0 ?
        $ln_default $command $rundir/foomill
& d2 F) a- d! E& {  N8 P7 b5 Z3 l        LIBPATH="$libpathLIBPATH:/lib:/usr/lib"
3 E. S* E% G% n" g- ]        export LIBPATH  e% a4 @- h4 M
        suffix=.o
% ^0 x# e% T$ B& J2 N- l9 H$ H        ld_err_code=8* M5 `% V8 Z9 S: [2 G
        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then4 g* A8 d. }3 F& @( U
          tdir=`echo "/tmp/d"$$`0 T& Y* }7 d  D: o; b9 _7 k
          [ -d "$tdir" ] || mkdir $tdir
; \& y7 a0 g! y. U+ ?; U! O5 x2 V          if [ -f $EPIC_DIR/libCustom.o ]; then) B: S3 F, s9 ?) K! v6 M6 L( g
             cp $EPIC_DIR/libCustom.o $tdir/
4 u* w0 F7 _- t- N             $ln_default $tdir/libCustom.o $rundir/
& a0 C4 g9 k0 }5 a4 M% B          fi2 I7 }) \. H2 z7 c9 Z
          if [ -f $EPIC_DIR/libModel.o ]; then
( R! `4 x5 c/ K  G# s( P1 @             cp $EPIC_DIR/libModel.o $tdir/
4 _+ B) i' g+ O$ B; `* r7 ^             $ln_default $tdir/libModel.o $rundir/
8 l4 O& K  T& W5 W! [          fi5 r8 S3 c! X- T# Y  K- e$ B& J
          if [ -f $EPIC_DIR/libFuncModel.o ]; then9 {( _* N3 E  V7 W/ R+ [3 ^
             cp $EPIC_DIR/libFuncModel.o $tdir/7 k& z5 U$ v( p
             $ln_default $tdir/libFuncModel.o $rundir/' ^+ F8 R$ H8 p8 ?' c9 [! J* D
          fi5 _4 N: }; L, n7 J2 w8 F
          if [ -f $EPIC_DIR/libFuncModel.34.o ]; then
# r1 b& S" p* f9 \* w             cp $EPIC_DIR/libFuncModel.34.o $tdir/
' r% {! d& U- a$ \& N             $ln_default $tdir/libFuncModel.34.o $rundir/( T+ C4 U' V5 e
          fi7 U8 |% f3 R5 y% O
        fi
) `, a" ^) n2 ]        #Set the IBM flag to enable more shared segids
% s! Y- C( h5 m/ s) }4 R/ G+ j* N+ v+ q/ n        EXTSHM="ON"
+ s' ?. c; e* U, R        export EXTSHM( z$ D5 W8 C" `9 E# r+ V
        ;;/ v+ q8 C9 @, g" Z3 g
    *LINUX*)    ' _2 |7 ]8 v. K0 l1 E4 C& V& t" r  W
        suffix=.so/ b0 G# |. y1 z+ N8 a
        ld_err_code=18 @1 e  _+ L) U' {
        ;;; }& j7 l" f9 l: i9 {: ~
    *amd64*)
+ [7 a$ d! c. d, B, Q: v        suffix=.so
, _; d7 h! u8 W* i+ N! h        ld_err_code=13 Y$ P! R4 z$ u6 P5 E9 y4 w7 n
        ;;4 @2 W2 m+ `6 q# B
    *suse64*)  B: P) d, ?3 o- L: p6 K4 }) P
        suffix=.so
0 }: R/ f% |; `( d- Y3 Z        ld_err_code=1
% N3 L0 b$ C( _" f0 T        ;;7 g$ a1 K- m- @! u
    *suse32*)   
6 t8 [1 a# x+ C, |8 B0 \        suffix=.so! {$ g5 T, N  G4 q6 c
        ld_err_code=1
5 x. l( g. G$ f# A# s        ;;
" h/ X& m+ K9 A3 u! h# T3 ]2 X1 z) x6 Z: x    esac
4 k- B" S' g& X! p, d4 Q+ W9 x' Y! i3 }+ d8 `/ U% Y$ [" ]4 K3 x
    [ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix"
3 A$ }7 \$ ]! Z$ T( g* L9 V4 r    [ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \
; Q/ \: r$ a( L3 c# k5 P        && [ "$cmdname" != "nanosim" ] \. Q1 I( E$ h$ A( I3 v
        && [ "$has_model" = "YES" ]  && ulib="$ulib $cwd/libModel$suffix"$ m. L# {: y6 \/ P0 F* i, a
    [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix"  X; H4 d; d) g; y
: y  e' @; S6 |7 ?
#Look for command line option for libFuncModel.so
+ C/ ]+ t- p; }( E#    user_library_next=0
8 C4 T6 S8 i- c  G/ o    has_fmlib=""
# u* h/ }/ _; d' C( V: S    for opt in $CMDLINE$ t8 I& ^- j% R8 K0 J4 A  v
    do& ?. E6 f% r6 @& I
      case "$opt" in % |: I; G4 c- T) d& n# f
        -fm)
5 g! t8 ~5 h% N2 j2 x- W            CMDLINE="$CMDLINE $cwd/libModel$suffix"9 o6 {8 z4 \: x  O2 X4 q
            ;;# W, o0 b  e! u0 b( i$ H
        -fm_user_lib)' c- c& r/ ?$ C, g# }: e
            has_fmlib="YES"
5 i7 {6 |) ]( P2 m0 J, Y#            user_library_next=1
7 e; A# P  P; {, h8 ]9 V            ;;: V: H6 I- b) C& _/ r
        -xc)
# c1 @# d* D+ k( V' c8 v! I            if [ "$EXTRA_CAPACITY" = "NO" ]; then/ q7 ~0 ]  O! c) i9 O/ n6 r0 K7 I
            EXTRA_CAPACITY=YES
5 [$ A3 z1 g7 ?5 _' h! A            fi# S$ A2 z  o& L7 D+ p0 D3 G
            ;;
8 Q! t7 o* a# }+ f+ E#        *)2 f7 V% z- x6 R2 r7 R$ O! q+ D
#            if [ $user_library_next -eq 1 ]; then. l) g8 L; B. H, |$ z
#                if [ -f "$opt" ]; then& w; b+ c$ |1 X* Y/ H
#                    libfmodel=$opt! X& z8 X1 f- H$ d* k$ {0 X
#                else' i& b( v8 z, e% Y( I5 Y
#                    echo "-fm_user_lib: Specified file not found"
; V4 P3 U5 m% o5 N: c4 p#                    echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages
. _* W1 g, @( W; P/ V6 y#                fi
2 x) q9 m/ `9 E4 L# X/ k& a  N2 {#                user_library_next=0/ S+ e# |$ }8 Q4 L; v( W0 x
#            fi
5 F& e9 G! k1 U5 v, {#            ;;
9 D0 ?: U. V. v  v        esac9 q' F& U8 \1 y+ a
    done
3 E. i9 W* L: ?( O; z1 K" m% ~. u% ]/ h6 ]* Y+ P
    if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then5 ?: Q4 f% c3 l: Z0 _* ~
        flib=""( q: `( i/ G' P( D; Q. ^
        if [ "$has_fmlib" = "" ]; then
+ G+ w. ~2 {' M$ v, N$ g: W* E            flib="$flib `get_epicrc ./.epicrc user_libraries`"; q$ C1 Y6 @5 N3 k
            flib="$flib `get_epicrc $HOME/.epicrc user_libraries`"
9 i1 z+ Z  q2 \' F3 w            flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`"8 G7 }  I3 d- N
        fi
8 G3 W+ J" s0 _1 f    fi+ l7 r2 \" i- g4 j. M7 t

) `$ j( b5 m( h( t0 c% F& K7 O2 n   for i in $ulib4 Y2 q+ M) x$ \- J( W
   do6 R; D. ?. U% j/ V4 ^
       [ ! -f "$i" ] && continue" b; t" R6 }) ^) T9 y- k' o
       dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd
" w3 l7 c5 Y, w" ^7 m! l- j       i="$dir/`basename $i`"
! V3 d- K% ]9 _, B       case "$i" in
0 o4 A% t: t, W       *libCustom$suffix*)    [ "$libcustom" = "" ] && libcustom=$i;;* k/ E9 w- {# A. e+ A( f
       *libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;;
& @; k# o3 h" X, t  }+ N+ f       *libModel$suffix*)     [ "$libmodel"  = "" ] && libmodel=$i;;2 X$ j1 f/ O& W1 ~6 O3 f
       *libva$suffix)         [ "$libva"     = "" ] && libva=$i;;
9 M* A1 b, F* e8 ^+ m% a       esac
% J0 G2 b' y1 M! i       [ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \  ^* ~4 k/ Q  B; U
        && break$ S5 _" y0 ^: J! Y$ F5 m
   done
5 u$ O: F) Z3 J* v2 r
# C1 V# Y% ]6 G   # symbolic link shared libraries to .epicrun$$
8 B( O& e2 Z5 H1 |3 ^    cd $EPIC_DIR; epicdir=`pwd`; cd $cwd+ `; r- b" M, ^% \
    if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then
/ x2 d- k/ v* |9 K9 a% \+ Y        if [ "$libfmodel" != "" ]; then) |3 [$ t% w) N0 b$ A% @
             [ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \
# {' N3 [4 X/ }( ^' t/ ?             echo "Using $libfmodel ..."  && \
* b% A( s7 O; b) U8 ^' m3 q             echo "Using $libfmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE
/ ~" ]# n! r( H5 A0 [; d+ @$ n             if [ -f $rundir/libFuncModel$suffix ]; then
) u6 F8 V1 h: L+ M* a               rm $rundir/libFuncModel$suffix
) Y0 ~& S' p. u! P% O             fi
+ C( p; k; |! \  N             $ln_default $libfmodel $rundir 7 m, K% k0 F4 F0 L6 S  ?
        fi
% S: E) d/ C4 L) u: }        if [ "$libmodel" != "" ]; then
: g8 g3 u3 G; Y% ^0 R             [ "$libmodel" != "$epicdir/libModel$suffix" ] && \  ^: h  s( j: [! I  {& ?
             echo "Using $libmodel ..." && \- v7 Q  H$ ^1 w, X
             echo "Using $libmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE
4 v* ^2 T: a3 }             if [ -f $rundir/libModel$suffix ]; then
* ?6 r; k/ x+ }5 D               rm $rundir/libModel$suffix6 a: }7 ]3 A  p! S9 U' M
             fi
% F1 j, g5 I; R& X& B' \             $ln_default $libmodel $rundir
" X7 ~; c9 Z+ q- Z8 z9 W8 L        fi
' ]2 }# M" F1 |  k   fi: H  u' e7 ]$ {1 v/ U' L: l
   if [ "$libcustom" != "" ]; then6 t$ L; r/ t1 R, R( c  _* V
        [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \% }6 R2 p5 ^& i4 `( T- q* V% D$ |
        echo "Using $libcustom ..."
6 T! O# Y4 A8 @$ |# c. V        if [ -f $rundir/libCustom$suffix ]; then
+ e# T- r. d# C! P8 t; T2 K% W          rm $rundir/libCustom$suffix9 f! k6 [. H/ B) H
        fi
( p. q  V# e- H7 D+ \        $ln_default $libcustom $rundir
. f& M# q0 R# _8 B! w7 U% ^. u   fi8 k  R. ]( J9 i) l4 `6 |

$ Z1 v: X. @0 P" G   if [ "$flib" != "" -a "$flib" != "   " ]; then* J6 z9 ^$ v; g, O  K: ^9 a
        CMDLINE="$CMDLINE -fm_user_lib $flib"
; \8 |7 A, p/ |9 d) K# V4 H   fi
/ c; s% T( B$ W+ b* ?1 s. j& S$ N- O& x$ e; e0 Z% k9 l) R: u3 w- B; k
   if [ "$libva" != "" ]; then6 ?% o9 k, Q3 ]; U: n. a6 L
        if [ -f $rundir/libva$suffix ]; then
; f* v3 `6 M) |$ M3 h          rm $rundir/libva$suffix, O) N+ b# g/ n/ x) i
        fi
  M* j- s: |: \+ D4 j        $ln_default $libva $rundir # H8 K. K8 f, c
   fi- g0 e) y) Q0 b0 g
& R! F$ }8 Q' h6 b6 l
5 s4 L7 ], o0 Y8 {- `
    # VCORE design library# Z: m: X* O$ L; s& o
    if [ "$vlog_design" != "" ]; then
  R! i3 C3 Z- z5 K! \0 L- \# u        $ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`
- O1 m8 w* u1 j& c    fi: T6 L9 ^# h: A. X

. f, C& ~9 n+ ]. e5 e    if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then
, N, b4 _7 \' w* R( `        EXTRA_CAPACITY=YES" d4 c- O8 h4 |4 u8 U
    fi
% r$ ^6 L- `2 F/ E/ Y: g! D8 |8 R* Q+ D
    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc"
. U( H3 b6 Z! e/ y) `& D2 b9 }    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc". t. ?3 M+ L8 _2 p: Y
    #Create temp file if dual process is on
* n& e! @2 R# `& s    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then
7 I- ]  G+ u+ ^# `        if [ "$EXTRA_CAPACITY" = "YES" ]; then% |3 \& m6 C. s1 F" m0 e) |: W) p
            touch $rundir/rpcidfile6 Q/ n1 v9 R3 G  k9 @
        fi+ p: z& p/ ]& I" [
    fi6 n" j" ?- u2 v3 [& D. c$ j
fi
- H  A- M# ~1 r% J; h# C7 I" f1 w: D" _' T
run_cmd()8 c0 q1 U  Y( N* k- _2 [$ D' H3 J
{
5 Z# u- m7 P$ t5 i, S; W  command=$1
& P2 g0 L+ J$ ]& U! Y, X  shift
% u8 J& D2 {6 W% O7 v/ i; t3 j0 ~- B5 l; N: }# {/ O! N# V6 e5 O2 R; W; X
  if [ x"$VA_FILE" != x"" ] ; then: I- R3 O5 P; x3 h% ^
     cmdline=$ARGV$ o$ C6 [$ ]) P
  else
" {) U2 t& ?' R1 p/ q     cmdline=$@% g, i0 t  E1 U0 A  T/ N" D: E8 Q
  fi0 D: J( R" F: V4 n
7 f6 n! M7 L8 \
  debug=${DEBUGGER:+"$DEBUGGER $command"};' b2 B' Q& D2 Q: w

0 J0 b' O9 t( O* W- [  # To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a, Y, S* L* a- i! V/ w% ~
  # so save-restore may work.
/ d2 u# y  ?9 c: @2 L7 y9 E4 e  setarchStr=
& j0 o+ Z7 x' z. P. Z  cmd2run=`basename $command`
" k- N# D/ ?% a& R  if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then/ _3 r8 s% S' T/ `1 g* Q* q2 v
    if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then
" w: w8 F5 ~( U      setarchStr="setarch i386 -R "4 h3 I" s; `  W. V
    fi
6 X- @! X! O1 w    if [ "$EPIC_ARCH" = "linux" ]; then
/ U- m" p% K  U' g      setarchStr="setarch i386 -R "
" N3 O2 ^0 v8 F9 t2 Z3 D/ k    fi
+ N2 m5 K$ j/ L- Y( \9 s    if [ "$EPIC_ARCH" = "amd64" ]; then9 e  V. z# S* [% C2 l) u
      setarchStr="setarch i686 -R "
2 q  ^% y. m" k' I, b% x! \" N    fi
2 o3 w% n5 ]3 q6 w8 |. }    if [ "$EPIC_ARCH" = "suse32" ]; then6 S) Q2 @# I! T" ~/ n' y
      setarchStr="setarch_suse i386 -R "
" x1 r5 I# J( \  x% c0 N- q8 q    fi# |' T( T, F% O- O* X# j
    if [ "$EPIC_ARCH" = "suse64" ]; then
1 X6 _2 V$ C" c" C      setarchStr="setarch_suse i686 -R "
' g* z% I/ f( |) L. g. r# m    fi
- c2 `8 z6 J. F% k# M  fi3 R: J1 c9 _: D! I" j+ D1 i9 f
8 R8 |$ M6 h/ f& [5 F% q( h, P. m4 R
  ret_stat=0  A  @; t# \1 H
  if [ -x "$command" ]; then
4 y) ~- G* V. N) W( {' p/ B      if [ "$debug" ]; then0 X4 H* b- _0 t) `$ [# g5 g& B
        _debug_args_=$cmdline
  L" }  d! A9 @. _* l        . .epic-debug6 Y  O. V0 n' r2 H8 W. F! I
      else: W1 ]: V# f1 R& O  A5 z
        DEBUGGER=; export DEBUGGER
6 T! \! L0 B$ _; }$ Z2 d+ u        $setarchStr $command $cmdline
/ V1 G1 Y8 {/ A! w! s      fi
4 l+ r) l1 b4 ?2 D$ e      ret_stat=$?
2 c* K( ?7 j8 |$ l6 P4 D# C4 A5 C) D! r  else
6 k! O2 O: H8 c6 z) t/ b8 z9 P2 y    echo "Corrupt installation, executable \"$1\" not found!"$ i9 b+ q4 W' g6 P$ h
    ret_stat=1
1 t0 ?* y9 w& c* ~  fi, V& K$ E0 D6 O6 W0 Y+ \
}3 S3 [# `) v- c/ W" [1 W

3 b* S# V' x* R6 B! b8 h# keep runing cmd if ctrl file exist" G! ^: r. Y6 H6 k# ^. p

" A. {3 S& o' W* |: Frun_loop()
+ ]; Z  u8 ~9 m7 [  `5 m& T' C+ Y- @{
1 T, E3 h% _8 a+ K* V& w6 }( }  command=$1
& \) r; ?. {+ c" ?! r0 g0 \6 d! y- d  shift
4 R: u4 Q. x2 y+ e; T& s+ G. C/ [7 U3 b
  if [ x"$VA_FILE" != x"" ] ; then
5 v4 X+ a# Y+ Z7 B+ m' k8 x9 P     cmdline=$ARGV5 t) n1 Z$ C4 [  y6 d* q
  else
" K$ D5 d( |6 E3 G4 H2 u7 v" E     cmdline=$@4 ?* E$ K3 f/ ?( n- M
  fi6 e5 v$ U) F. P8 L5 M
0 \" h! I  p9 T
  while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do" b+ j7 R6 r, ^# M& y! ?
    . $LOOP_CTRL_FILE$$
0 E# O( w. d5 U# n+ n+ k    run_cmd $command $cmdline -banner 2
! O: t0 C" U& a$ r+ S! O9 f7 V: Q9 C  done;
' w9 k( q' e! H8 n) j1 X# a& {4 z, i  H: |  `
  if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then
1 i- R: ^4 v% Y, l. P    rm -f $LOOP_CTRL_FILE$$' P  S, U! w  Q$ |' B4 Z) f1 ]- E
  fi
8 c" s# S: S/ p$ \}$ B5 g+ s$ X0 Q
! B: p" o3 a6 L; [% g, k$ w
har_check_ret_stat()
* g% j1 t7 \# s% [: L- V{0 _0 p5 O8 l$ h7 O# u& }: e
  if [ $ret_stat -ne 0 ]; then ; P5 H/ ~: K# `
    echo "Simulator returned with non-zero exit status. Stopping."
5 `) W4 z- f; M+ h5 F    exit 1
; N! K" v3 {! L6 `: s  fi
: n$ `' n( D5 @3 {}: J- w% W( |8 Z
% D4 |* n! t1 U  d8 O
#: A0 p7 [9 o1 h$ p
# set stacksize and datasize limit
' x" B. w6 ~+ L. v: Q#
' P" d2 f- K% w- U9 P
7 c$ F# q, p9 z9 eset_data_limit9 H, v0 Q9 q1 l
set_stack_limit
' v" P2 s0 V% m! L# |$ w+ W% o3 |  o2 u
#rm -f $LOOP_CTRL_FILE
* S4 e& p6 s! G9 ^6 D8 j. ]  {' v/ W8 r6 u6 [$ p5 ?: i
run_main()5 c" x) j% u( M& m7 {5 @3 ^
{6 R/ n2 Z" X3 q& _% m
if [ $is_special_har_run -eq 1 ]; then  Z4 l/ Y6 X$ {1 q
  if [ "$har_ofile_prefix" = "" ]; then
$ e6 X- Z- P( @( q. k' z    echo "Wrapper bug. Notify Synopsys technical support."4 i' m4 P1 Q% t
    exit 1
( S: e# ?4 j2 m9 f$ H  fi3 o+ J/ ], P! W. A1 y' a
  if [ "$har_hilo_file" = "" ]; then0 [. C- w/ `0 S! u) ~" i' w  Q* t
    # no user specified hi lo file - do both runs
, P7 L* _% g* [  s) C& N' C    run_cmd $command $CMDLINE -har_one -har_setup% d8 e8 a; k0 _6 g& b" r
    if [ $ret_stat -ne 126 ]; then5 a  X/ X! `, P+ y
      har_check_ret_stat. b& m+ A7 p% V- X( k6 B# S* O
      if [ -r $LOOP_CTRL_FILE$$ ]; then
+ y; t1 ]! |. V# V0 G        run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl
& O2 m8 Y) n1 z1 H0 ]" D. @: C        rm -f ${har_ofile_prefix}.hl
) Z# G3 I. {' B2 F7 T- W      else
5 N# j, e  ]  u7 W% Q* U        run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl1 l( I% T8 v, _. A+ \3 P1 Q  K+ t1 a
      fi8 e0 M, T' k. E) Z7 U
    else+ c( Z/ v! i6 E/ {. l
      ret_stat=0& Y, x( ~3 {+ H1 x& F% t
    fi: c/ y2 b7 j, D6 _6 C
  else; N0 b6 ~& P. v/ b3 H" }' W
    # user gave a hi lo file name2 |* B/ E' {; D" p( ^! X; u
    if [ -f $har_hilo_file -a -s $har_hilo_file ]; then6 s1 v) L* m# z3 ~
      # file exists - use it - only do sim run' Q2 t3 i8 w7 r2 g
      run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}
: C1 u' r' X" Q' f% p, S      run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}
/ g$ q2 o  `! @' h8 r; y    else
9 [1 C  T4 ?$ o. Q3 f& l$ \, u      # no such file - generate it - do both runs
& e* S7 s- l2 b1 P. y' A      run_cmd $command $CMDLINE -har_one -har_fnf -har_setup! G" F; Q' \) v  ?  c
      if [ $ret_stat -ne 126 ]; then9 V) L; @" Z* X1 v/ l, Q7 J9 F; i
        har_check_ret_stat
0 |9 ]. F* I" T5 Q6 N$ L        if [ ! -f ${har_ofile_prefix}.hl ]; then
/ f2 I: y" V) R7 v) X          echo "No hi lo file generated after setup phase. "2 m; r- J2 q& U! u6 Z5 U9 ]7 L
          echo "Contact Synopsys technical support."  P$ g8 l$ E+ x  q7 ?8 U: }2 g$ s' C
          exit 1& l; {) R' _' g$ q3 A
        else
: {- x$ W+ H, t  n% X* T          if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then: D1 i2 O, w& e9 n$ D, l
            mv ${har_ofile_prefix}.hl $har_hilo_file1 C5 y3 y# |9 E8 @. x
          fi4 w' |! M4 u3 |0 a5 x6 l: h+ L
        fi% Y2 Y# t. V1 V* `% R8 D
        if [ -r $LOOP_CTRL_FILE$$ ]; then
/ X4 l& y9 J( P+ Z          run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file
2 Z' Z( H6 v& H4 a9 L8 @: F" z        else- E; c+ V% O. G
          run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file- h* H$ X1 o% A7 \& O
        fi4 l4 H4 w5 L$ E! O3 `, N' l# r7 b
      else 0 i% h6 F# I! q( K8 `) t) a: ]( R
        ret_stat=0! h: f0 ]6 D; d& u
      fi$ c, k( i7 C, e" ~2 B
    fi% k0 V9 d4 C8 e8 v( p; t* @. i# ~
  fi
% V& v' o: O& T3 `) n* H8 ?else  
. z7 z3 L3 R0 g; L& o# don't loop if -har_setup, e/ o- j' t2 _& F9 o
  if [ $have_har_setup_flag -eq 1 ]; then
7 Z! D2 d. l/ @+ S- C    run_cmd $command $CMDLINE- w6 P% S5 h2 L% n, T
    if [ -r $LOOP_CTRL_FILE$$ ]; then
* [$ O0 \$ ~% z* S( p      rm -f $LOOP_CTRL_FILE$$3 f# O$ |" h2 Y( P. z( X
    fi
* N4 \0 c: f. g- }7 m0 f  else7 h, A1 P- S( f9 J, o
    run_cmd $command $CMDLINE
' l& l1 @7 y" y$ _8 D6 C    run_loop $command $CMDLINE
, {9 f& r+ t8 H  fi* q  P0 A; H* w/ n( Q5 q
fi
5 H) r) k, \8 g. f4 u& c7 V1 M* A; w& w
: ^! t1 w1 L  s7 [5 k; H4 [if [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then9 E7 t" @- l2 z  P. U
  pwCreateErrDB -w $workDir -e $errFile, ?& G7 @% W% w* f3 X! @
  ret_stat=$?- M8 b. Q2 H5 \1 \- b! i( I
fi* |8 r% i0 g" o( l* D
}9 w2 F  l& e' P' H) o

+ K$ m8 N4 e% ocleanup_alter()
3 Y, Z9 p0 W# Y: k{
8 y6 f# M  B! h" v* S( v   /bin/rm -f $ALTER_COUNT_FILE 1>&2
5 V: ?( j9 Y: s   /bin/rm -f $ALTER_HK_FILE 1>&2+ i. }1 e; }6 O) c
}
: s. J( e& J7 B1 u( N
- c" \6 a0 P& W. U; \% _#generate alter temp files based on pid& Z" Y, J: Z: ]  T! s+ m; C
ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$; u, o, F3 @9 E- d: z& F
if [ -f $ALTER_COUNT_FILE ]$ F- G2 p  @# G2 s+ h0 K" \( J
then
# K: T4 O, L* d  until [ ! -f $ALTER_COUNT_FILE ]
, |% X+ ]) }$ @9 V2 ^$ j  do6 j, S% J  E7 r
    ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$
" h( }3 {- g* T7 ]1 y  done! D6 \2 Q) B7 |
fi
- t# j0 _/ D6 z2 q7 }2 mexport ALTER_COUNT_FILE3 j7 O- w% ^, w: y' B. J

- x( W, c' U& ~% V9 a+ LALTER_HK_FILE="$ALTER_HK_FILE"$$$ D8 S* A' S4 N$ A  X+ E; x1 d2 Q
if [ -f $ALTER_HK_FILE ]" V7 h) E' L# ^" e  x. @6 ~1 e) b
then 1 U& Y/ F: w9 k1 D+ e1 N
  until [ ! -f $ALTER_HK_FILE ]0 x9 K/ P- U+ i7 D0 w) `
  do
  r8 e# x/ L. z9 s- |' ?/ r6 h9 S    ALTER_HK_FILE="$ALTER_HK_FILE"$$
7 r- s: A: M, R) i) d0 Q  done& p, P3 I- a" K
fi; r7 H  t) U: r! [% P  c. p
export ALTER_HK_FILE
. T, p: c; t4 {% W4 U/ T
+ A# U- {' X" b' x+ e#generate monte carlo related temp files based on pid
% ]) }1 n( w& `( U$ x. X* X. E8 Ocleanup_monte()
$ v$ ]* q: t6 M; z4 E: i5 _5 D# g{
- A* K* N- g# ~) r& a6 s. S. Z+ t* H   /bin/rm -f $MONTE_IMG_FILE 1>&2
1 h4 X% p1 X& t5 |9 d- E   /bin/rm -f $MONTE_IMG_FILE.gz 1>&2
2 ^$ d8 H! r! }/ O0 `8 c7 l   /bin/rm -f $MONTE_COUNT_FILE 1>&2
# l/ L0 \; a6 x  o  A+ b& j   /bin/rm -f $MONTE_CFG_FILE 1>&2+ T% G3 Q/ d# ^5 t% X1 `/ Z
}
) w, j+ V$ w4 x0 f% X: @) z1 |. q# W& B
MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
( Z! h% {6 p2 ^; a1 zif [ -f $MONTE_COUNT_FILE ]
! M( Z5 w+ r" y9 |. Vthen
8 J: z# d8 v  G! o9 q  H  until [ ! -f $MONTE_COUNT_FILE ]
* Q: X  \4 M  ]8 Q7 \  do9 q! J! l- ]% ]1 L' Y/ h% p
    MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
* y( N0 `' X( f4 k. Z) L  done* P4 m5 ^2 T3 i, \' T
fi; N, d2 V& x; P4 Q1 ]6 {
export MONTE_COUNT_FILE0 M- t8 q9 S9 V# z1 V4 k
$ n% T& n% a+ P0 C* t
MONTE_IMG_FILE="$MONTE_IMG_FILE"$$
& s1 ]! ^1 h- I& n" O+ M" uif [ -f $MONTE_IMG_FILE ]3 M" X- k* f$ _) w" E  p+ o
then
9 X8 L, U1 v5 T" H- [7 r  until [ ! -f $MONTE_IMG_FILE ]+ f3 S( ^& f- T, o
  do
' O* r. y7 @- M1 v    MONTE_IMG_FILE="$MONTE_IMG_FILE"$$5 a; q$ _% _- F
  done
6 s: y6 v( c! r. ?( v/ z0 F& Dfi6 V1 N: U8 K, e, _! Z" {) g, |
export MONTE_IMG_FILE% K5 s( r! i' x5 E6 C

2 j3 l, C4 `4 y. {3 b2 }5 YMONTE_CFG_FILE="$MONTE_CFG_FILE"$$2 b9 r" x' _9 T1 L. ]+ |
if [ -f $MONTE_CFG_FILE ]) \; m# b8 d6 v2 z& l8 P8 F
then
3 t9 v% j5 \. j  until [ ! -f $MONTE_CFG_FILE ]
  ?1 {$ S! F) W- E! z  l4 J9 t2 ~# ?  do  d% u- i6 u- _# n; L
    MONTE_CFG_FILE="$MONTE_CFG_FILE"$$
( d+ `! f, n" w1 Q5 u  done+ @  k& F' {1 A# S  n! }
fi; }  W& X. n9 b8 i/ Q$ V$ n
% z" e" o# M& i( Z$ D
# main iteration& i- q) `# o( V: H) O- e$ T3 C
run_main
/ q8 |7 j* w% b0 W" h
% V9 n+ K  s( c( [if [ $ret_stat -ne 0 ]
; F% P7 P7 e, z  R# \/ Wthen : g6 C( }: g8 C8 ~9 [, Q
  cleanup_alter
  ?* l- O" x5 t# _5 I- {  cleanup_monte
9 ^4 S( i  ~& K8 y  Exit $ret_stat, d' d7 m, o; Y( V1 S" j( f
fi
* I; ~5 w3 A! C
- o( Z3 }5 {$ \( ^0 v+ _% N6 t7 }#Alter related iterations
) X; _: Z% E! D! O4 e
# \( k3 Q0 ^5 K2 M* U' B8 siterations=0$ ]/ I# v) d+ M8 p0 [  L4 @! W4 S
count=0
1 c  P7 g$ d0 jif test -s "$ALTER_COUNT_FILE"' e& k# H0 }1 H3 N2 b5 J
then2 {+ r3 l' o6 q5 X* O( x" c8 S6 e
  if [ -r $ALTER_COUNT_FILE ]; then
: g7 z: C  w+ H) E0 H9 P   exec 7< $ALTER_COUNT_FILE4 R) n& c6 I' `" l4 ~7 m
   read iterations <&7
6 Z1 d& a' {0 f fi
+ `7 y4 ^; B* ?* s! i. `2 I! [1 l% ~fi
# Z) w" v) V- g4 j* i1 R/ }
# I9 @& x' M/ A& i4 G+ s; Q6 {trap 'echo Program Interrupt; cleanup_alter; exit 1'  2/ t: n/ f' k" H; d6 G* \! z# c$ j
while [ $count -lt $iterations ]
5 t9 B" A6 f  f+ }  H3 K* wdo
8 W' Z5 h, c" _8 R: E+ H% Z# \ count=`expr $count + 1`
, U; C. V0 {8 i7 } ALTER_COUNT=$count3 M' _  L; G/ U  W1 ]7 c
export ALTER_COUNT" N5 ~% A  S' ?! I7 d3 O/ t

; }  p( r) f, I8 P5 w) O run_main
2 x. {* Z0 j, Y7 m/ `
) G" P$ q% @/ O. W0 O' ^! ddone$ n* b9 a$ X# ]9 ^1 E( {

, z# H) n8 J5 h% M, W#Monte carlo related iterations
3 `; r/ y4 y8 U/ g' R! c% F2 V4 {$ g$ I8 _
monte_runtime_summary()
8 N0 d" y/ b- w8 h# p{5 F' }) ^' X- `: o& O( }
  keyword_1=real. {* U6 u6 `* d4 F; v( b: |
  keyword_2=user" A0 Z$ G* t6 r; Y: m
  keyword_3=sys: R# a' _/ Q! x* ~' d/ U
  ofile_prefix=nanosim2 ]% o1 w6 t! I

( b. m" C$ F! n  `! ]$ L* T  F  if [ ! -z "$o_option" ]; then
- F8 [* e0 ]# e; r" P    logfile=${o_option}.log
; f2 B$ t' R# Z' `6 S- [) F# F  else
7 s7 g' Y. }0 g7 M3 `$ }    logfile=${ofile_prefix}.log
3 p6 j, `! V) Q4 a  fi
! s1 a- Z, }6 I( X7 O0 ?" Y) U7 j0 Y) H& i+ S( G- O& t* y
  if [ -f $logfile ]; then
* v  J4 F+ Z9 [3 ^' P    echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile      
/ ?2 B" U( a$ m( H8 a6 c    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
! L* n/ n1 x% N# j' Q) @$ G5 |  fi
0 ~# K# k' N, j! ?}+ `# N$ P, \% e5 M' L% S

0 w# w% z- j* Z1 S! K# Snext_monte=0
- E  h# t' u" I" [' ~+ v) B' C) ccur_monte=0: n1 T9 k  ^+ k9 E; N
- N% h( l+ q+ J% q
if test -s "$MONTE_COUNT_FILE") p, {: k$ i0 v+ t5 X5 F
then1 i$ X: S- G) o7 g. L% h0 W
  if [ -r $MONTE_COUNT_FILE ]; then
- R% v* i+ T3 ]6 G+ o! P   exec 8< $MONTE_COUNT_FILE
$ D1 p3 `8 h- L7 [& b   read next_monte <&80 G1 z, }! R9 i! K- x+ V4 F
  fi; l" i: ]8 R7 e# C8 K# Q  B
fi
; O9 S9 E; W! y0 y
- {& P, h+ O8 E) Dtrap 'echo Program Interrupt; cleanup_monte; exit 1'  2! \0 p$ {& A; z
while [ $next_monte -gt 0 -a $next_monte != $cur_monte ]
  h+ q7 U- f* J! o$ o. }5 \0 zdo$ U  _0 f/ X( J8 Q
  NS_CURRENT_MONTE_COUNT=$next_monte
% O6 h7 r7 v, z0 v. d; |6 N  export NS_CURRENT_MONTE_COUNT
4 c3 c# H) U: n2 s; |& y, `5 g: C) c5 i
  echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE
' O2 n. I3 J. _  W% I* O  CMDLINE="$CMDLINE -c $MONTE_CFG_FILE"9 x# p2 `5 ~& h' i% K
  run_main$ s2 h( k6 w# c/ F+ D% F2 ?: L

4 y6 s- p- e3 n' j  cur_monte=$next_monte5 |+ A6 O6 U( w1 F- h2 K
  exec 8< $MONTE_COUNT_FILE6 C- E3 R& ?8 ]$ Z5 [
  read next_monte <&8
% i' `; e' L+ W% ydone
0 c3 K! d5 k( c6 v9 p' s5 y: w9 E' n: ^
if [ -f $MONTE_COUNT_FILE ]
. h! w1 @8 a: q  p; [; _then0 |9 c+ M) L/ H/ \# f
  monte_runtime_summary
7 ~/ j0 _: ?- z" n  ]* w  p# o6 ^fi
* w0 p, S- k! ~, g* O- i5 X$ @( E4 z. f2 @6 \
cleanup_alter
. j2 _7 o5 M: K9 N. J# Bcleanup_monte/ ]3 W0 H1 I# W
3 A; G" {# V9 ]& r
Exit $ret_stat

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

使用道具 舉報

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

本版積分規則

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

GMT+8, 2024-5-8 07:17 PM , Processed in 0.133007 second(s), 15 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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