Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

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

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

[複製鏈接]
跳轉到指定樓層
1#
發表於 2012-5-6 13:58:13 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
10Chipcoin
各位大大好:
! Q0 j# a) U- x9 z                      小弟執行nanosim時,卻無法跑出視窗來,有個錯誤可是我不清楚該如何解決?問題如下* [" l* G1 @! C9 ?0 N
                      [: 113: 64: unexpected operator
8 J) {* ?, h7 r4 D/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim: 1: Syntax error: Unterminated quoted string
- A$ d( O0 A# \' N% c有大大遇過這方面的問題或是指導我方向去解決, 謝謝.
/ `5 y0 N* X6 j: j0 c+ w7 e1 m+ o我在猜可能是這個檔案內的文字需要修改 但不知道該如何修改?! B# J* ]& \" @9 d
以下為/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim 的檔案內容:: Z9 _5 Y, G! u' K8 T8 p5 T/ p
    #!/bin/sh. i, z& }4 l4 v+ ~4 H* h: ^& r2 B5 y
#
  H! {/ V4 A& a4 v9 \% L# Copyright (C) 2001 Synopsys INC5 H* N$ ~4 \' T! Y" Y$ @# s3 u" ]
# EPIC Dynamic Simulation Wrapper (DSW)3 d! {- v. H- }2 _6 f
#( S5 C$ E2 Z+ x1 _) F& y
eval ${DBG_EPIC_WRAPPER:+"set -x"}
  ~* j7 j3 D1 m  @6 }) g+ h0 _0 l% _* l2 d9 o4 I/ [
if [ "$EPIC_WRAPPER_DVLP" = "" ]; then
$ c- i) l- S- ^! t1 F    TEMP_ARCH="$SES_ARCH"
7 C! U6 U8 ^; G9 Pelse& s" l) g: P3 v/ u& N
    TEMP_ARCH="$EPIC_ARCH"1 _! B6 Z5 C5 Y) Z+ F
fi& V# g$ w' Y; |' F+ ^; O

! f5 b1 {# d2 mscan_for_hva_args()+ x# q5 A* \& y; z$ g2 Y
{, X3 D5 G: z5 W' q
  /bin/rm -f hva.init 1>&2- t4 h; w5 [9 n( G* l0 z
  while [ $# -gt 0 ]; do
+ A! {7 e7 N5 q5 @$ c. ?    case "$1" in- F( ]; n1 W  D1 x1 S
      -vaf)8 p8 h0 l3 D' Y' F. @3 w# N
           have_vaf_flag=1* C5 w: j# H" @! l/ k5 o
           have_va_flag=0/ j7 n2 p' G% m( Y
           shift;" u7 `" a) b. u* X+ |$ u3 J6 R
           continue;
, S, b* T( P% @5 @2 {3 t        ;;
6 k% A9 {0 \. \* Y- w      -va)
! ~, S  `, z( u0 v7 Q           have_va_flag=1
7 m9 h! R6 d# E& C% B& \% I' Y           have_vaf_flag=0' H0 |/ w, f1 P( e) ?9 j0 _
           shift;
! W" ~! B! Q5 B           continue;
+ F0 s7 ~" t* \5 ~& v        ;;; i4 F, K# ?# J  q- `
      -*)$ p/ }2 e( o4 ^" F! z
           ARGV="$ARGV $1"1 y, I# {. O, Q! Q7 J: I
           have_va_flag=02 q0 t* H0 A+ @+ D1 T; C3 x
           have_vaf_flag=0, e: B! e8 [! A$ i$ i1 C
           shift;
# V% G& E7 k0 }! Z; o6 x+ ~           continue;
8 Q' q9 p9 J& B- D5 i) O& K9 p: Y        ;;
7 |2 ~# [3 B7 K0 D      *)1 y% X( [# w# d: E
           if [ x"$have_va_flag" = x"1" ] ; then
& P3 v3 d- r4 K; v0 s! F2 I              VA_FILE="$VA_FILE $1"
& A6 D( N  Y  {% s% u  U           elif [ x"$have_vaf_flag" = x"1" ] ; then
  d9 K  K( e" ~" [              X="`cat $1 | sed -e '/\;/d;`"5 B  @7 `" h3 n6 ?
              for token in ${X}; do/ }# m& w2 R. @: J
                 VA_FILE="$VA_FILE $token"
! B1 H$ _0 f# J. K! @              done
8 ^1 ?7 v: x( b$ a6 W7 {0 L- {2 P           else3 p2 r1 ^- j! K. O0 T+ _
              ARGV="$ARGV $1"* _) f& F+ f2 Y
           fi  h" c; p: A# z. R5 i9 X
           shift;
; |0 K+ S; N6 c, d/ \! T: K        ;;
( P4 F0 l% E2 ~$ }    esac4 ?% x& `5 l8 N4 M1 {6 Q; p0 b9 l
  done
2 L0 R' [! k7 ?4 V! |9 ~5 b3 ]! v7 m4 F  l+ S& i7 j# t
  if [ x"$VA_FILE" != x"" ] ; then
9 E& B8 V3 h) b0 z2 N##     /bin/echo " xxx ARGV $ARGV"
4 l7 }; m# Q/ b9 @0 i       /bin/echo "choose nanosim $ARGV ;" > hva.init4 p% p& ~/ G7 b- @' N* p
       echo vcs +ad=hva.init $VA_FILE -o simv4 h0 F  y' Y% d8 J( U3 r
       vcs +ad=hva.init $VA_FILE -o simv+ a% s! d4 B" s: c
       exe_status=$?
2 f# a8 k7 ?/ K2 |& A# y       if [ $exe_status != 100 ]; then: H6 [8 O. c* o# y- H& c
          /bin/echo ""/ r  f, p3 l# d; R( a5 r, h
          /bin/echo "ERROR: Execution of vcs exited with code $exe_status"
, y1 U4 j. Y3 d: w" ~( W          /bin/echo ""
+ }. t1 Y8 T9 Q* O1 Z          exit $exe_status6 ]  d) Z  U! l8 d! P$ r( h8 @
       fi
* n2 v, z9 l# H$ w       hva_files="-n simv.daidir/amsVD.ntl simv.daidir/amsWRAP.spi"
) J& f4 B" J# u% e/ n       ARGV="$ARGV $hva_files"6 ^' C8 |4 R% L4 J4 o3 D/ m
  fi
+ O; V4 W( z1 r: Y5 l( K- m) j}
% T: H- l# {* k/ C3 T; I#-------------------------------------------------------------------------
- y2 S1 P1 X) A: E% w0 z
: n0 ^" p" W, G0 ], M; }cleanup()) [8 v# t4 B7 x
{9 U, V. j* A! |
    if [ -d "$rundir" ]; then: P) x1 E/ L" M+ M
        # On AIX, a .nfsXXX file is created if libModel.o is removed
1 F: K- U6 p# H9 ?: B        # so .epicrun is not removed because directory is not empty.( P" [2 A( s9 d7 {8 y3 W
        # Solution is to remove it again if the first rm failed4 m, _; v# `3 l( m6 p/ ]$ \3 g
        # (rm -rf $rundir || rm -rf $rundir) 1> /dev/null 2>&1
$ ~7 c/ [1 Z$ z. h, t! B        if [ "$EXTRA_CAPACITY" = "YES" ]; then
: X$ q+ {# x/ m6 ^! i        chmod u+x $rundir/rpcidfile1 f# B, k6 p" z5 l- C) M
        $rundir/rpcidfile+ }$ I& L  {2 ]$ B3 Q: D
        rm $rundir/rpcidfile7 m2 R+ s- Q" ]* q# {! i
        fi: {/ g$ q: C5 T
        rm -rf $rundir
' ?# v4 ?$ n% j' X+ ~) ~# {# `* c- `5 }( a$ ~1 b$ P) b* c
        #Due to NFS problem, we have to copy files needed to
+ O  {  `2 t/ B8 `" O3 k6 }        #/tmp/<temporary directory>, then symlink's files+ W  @2 }1 Z* S
        #to the local temporary 'rundir'. This avoids the problem
5 Q4 Z$ x# w( ?2 k( [7 }        #to remove 'rundir'  s, [- k. I* ]& p( x
        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then2 W. p7 ?3 B2 q9 \! x
          if [ -d "$tdir" ]; then: {- t9 f; M% N# r9 q
            rm -rf $tdir
' R( h) d9 q" V- u0 {          fi
" C% c  o$ v6 [$ B) _        fi" x  w% d- w+ N( P9 ?0 A3 y5 i$ t
    fi
: q! D% @* v" h8 X6 x# N    if [ ${exitstatus:-0} -eq $ld_err_code ]; then, c0 T' h. X7 }1 [; z, a
        [ "$has_model" = "YES" ] && rm -f $cwd/libModel$suffix" ^9 f& A, U6 ], \. K
        [ "$has_custom" = "YES" ] && rm -f $cwd/libCustom$suffix
. Z/ P, z9 H5 t- O& C/ Y    fi
! C+ h8 X7 R: `: T$ \/ @5 A, |  H2 x    [ -f "$EPIC_SCRIPT_MESSAGES_FILE" ] && rm -f $EPIC_SCRIPT_MESSAGES_FILE 1>&2* k* p/ L( f' M* f1 N1 N; i% k
    exit ${exitstatus:-0}
! \- z" f& B# Z. Q! @}0 g9 ]: B2 L5 Y9 Q

* Z5 f, e& o% [Exit()
# Y1 k& \* J7 N2 F{, \0 I& G  k4 ]$ q/ I; ~+ {- ?
    exitstatus=$1' L- n6 j4 n. Y
    exit $exitstatus
8 M5 O% D1 v) T! ~}
- X/ h7 b3 M: T. a) V3 L# h2 m/ W" {6 \) w8 W( h
# get_epicrc filename keyword
2 P" B' \5 i8 V" u' j# i! Oget_epicrc(): s0 g( _& L9 ^; u( R" _
{
* d# ]6 d& Q( Q- f0 m    [ -f $1 ] || exit 0, D0 O7 }+ f9 ?6 r
    key="/^$cmd2:/{print \$3}"
4 T" u* j- J2 j  O" G    awk -F":" "$key" $1
) t( n" Y! X! r2 W6 w1 Z) D& @7 g6 I}
  q' \% Z+ ~' ]- z/ U( f
( Y' D( K- t8 H( i0 d6 w# R9 m#! _. o- h2 Y" B
# set datasize limit to hardlimit
! H" l1 D' @- }9 i" s- {#8 H  N6 H$ \5 V
set_data_limit()9 X& s1 f6 T1 g  C+ @' J) [3 v
{
% W; c( P) P' W3 `! O# i9 b8 K1 ?    dbglimit=0
3 b- N/ I3 n9 f' [( z* Q' L    hardlimit=`ulimit -Hd`
: ]8 d2 J% t* G/ K8 D6 e    softlimit=`ulimit -d`2 O9 o2 P: l7 N! W% k- }+ C& S
    desiredlimit=3500000
1 ?. L* {, p  ^) |2 S7 F3 `* [    hardisunlimited=0
" N& |( Z8 I3 d& J    softisunlimited=0, c4 w$ [2 ~1 o4 Y# ]) I% @
    is64=0' p1 E6 u2 ?3 ~$ S& @  [2 [0 V# f

: D8 p# X/ Q% `4 u# {7 Z4 |1 U    case "$EPIC_ARCH" in( o& h5 U. u! F3 V
    *SUN*64), B* H4 o$ l8 f0 G6 j" d/ r: @
        is64=18 y8 W% J+ o( k
        ;;* ?6 u) {, M' }# T6 V) W
    amd64)
9 I3 q2 e: q" t8 v3 z        is64=1
7 \3 e8 k$ C$ G        ;;
9 V  t+ x9 y& l" W2 ?1 q* b    x86sol64)0 V: J& R* g4 M/ @# @' D  X9 J
        is64=16 ^0 p+ o4 a1 L! X3 S  v5 {0 }
        ;;
; a4 H. U# L) ~: W9 N7 ?    aix64)
( q' l( O; ~+ U0 O" y" F        is64=1, G" n2 k- m  ~7 e3 u
        ;;
) I, ^* F$ U2 k3 _. b    suse64)! X8 P5 W. a( v# \
        is64=1% {5 d& ^/ S% _6 j
        ;;+ u4 j5 z3 k- s8 H' F
    esac
% B9 j3 r% l( I; `: O/ T
/ h1 K" b" L: u* O7 u# N2 V) k    if [ $dbglimit -eq 1 ]; then% H  x* Q8 i4 d
        echo hard $hardlimit soft $softlimit7 Z3 r6 q% O2 i
    fi. Y6 ~3 [% ?& M( L

  W- F5 ?% u* T0 T& h5 n    if [ x$softlimit = "xunlimited" ]; then) S' v- t/ @( G
        softisunlimited=1* [1 T/ ?# L% v( j" m) K# ^
    fi7 z# y, w* u( P4 T1 v. O

. ]  I& u3 W6 t- J) i+ k* X    if [ x$hardlimit = "xunlimited" ]; then
% g1 q& p6 N" W) \  a        hardisunlimited=1
5 H, x% l; Z/ [( `  H    fi
- A; X9 D2 P4 w$ y! I3 @+ q8 c& G2 a
    # 64 bit machine should have bigger than 4G
- E/ t9 a* X3 y9 T. v) b    if [ $is64 -eq 1 ]; then
' a$ S" j  s1 D# Q        desiredlimit=5000000& X1 b" b8 v1 X
    fi" a- J, ^, j. h
5 G. j6 [& E" C, o" f
    if [ $hardisunlimited -eq 0 ]; then
+ w) B- S7 R( E$ n3 C& t        if [ $hardlimit -lt $desiredlimit ]; then7 O; c* G( s( I0 m5 @) }. i
            echo "WARNING: datasize hard limit $hardlimit K is too small."
0 j6 D: j( J& ~' x: O        fi* U- A0 g$ L/ {7 }
    fi
4 l% t5 K( i" c! }$ P9 Q5 P' O3 C- G
    if [ $hardlimit != $softlimit ]; then" r" x8 [: O: [# N' H
        ulimit -Sd $hardlimit
* i/ {' J/ N6 f+ F#        echo "WARNING: datasize limit is set to `ulimit -Sd`"4 `" W0 L: @& ?
    fi! {; m9 r) w/ m
: o. S1 j5 A; v6 I) l% E0 w
    if [ $dbglimit -eq 1 ]; then
2 H" E( S" v6 V' |        echo datasize hard limit: `ulimit -Hd`
; |2 j  {, N: U        echo datasize soft limit: `ulimit -d`
# ?5 ?/ v4 g/ @+ v% R) q* D: {    fi
( ?! P3 `0 I4 E/ ^6 S+ U3 {& G}7 }5 l; `( Z3 b9 b( f8 C

0 U8 b/ c. ]3 \& x& M1 V## }) ?2 U) F( G1 j4 j
# set stacksize limit to desired limit* T" u: T- ^$ {
#
& y9 |" ]: W. pset_stack_limit()3 ]; @: Z( D7 o+ ^! z1 ]
{4 B0 x7 @# ^1 S+ B; Y# b2 q
    dbglimit=0- p/ ]1 f0 B  K$ \8 g& N
    hardlimit=`ulimit -Hs`
9 j1 V8 [( j7 V5 \7 P* T9 o/ ]    softlimit=`ulimit -s`
6 S& Y' A( U8 N: D) w: |    desiredlimit=60000
& R. h5 I: U& F3 G: C& ?3 r: A) t+ A    hardisunlimited=0
& y: ^! F3 V/ O    softisunlimited=00 A3 ^( t6 X. j, n6 I4 f
    is64=0  Y* ^0 u/ ?4 P* P
' I- T9 q! H4 G; `2 y5 w
    case "$EPIC_ARCH" in/ }( M: ^, b3 }. b) f0 F
    *SUN*64)8 \% d1 ~+ _/ N" L7 v
        is64=1
2 a! \8 y5 G7 |8 K        ;;
$ u& u4 i( V' D/ Z) @    amd64)
# W0 ]# e# T# Z: G9 G        is64=1( e6 E* k3 n+ i; [
        ;;) \! ?# R3 u! O9 y$ D
    x86sol64)6 `  b. F9 E" f$ Q% {2 @
        is64=1
- Y1 r1 R0 L% @! E5 r+ L1 ^        ;;
6 N  Z' b% M! b/ Y9 o    aix64)1 k8 {( c. l5 R# ^4 b; V
        is64=18 C5 M+ d6 D" J6 A$ S3 H3 a( l7 o9 @
        ;;
( t, A" y# ?# t8 t: T; U    suse64)
* e5 a0 O% U* J; H5 B        is64=1" F" w8 Y/ q: O# x9 l
        ;;4 `" v2 s7 B* H* V# w& Q2 H
    esac- p5 x# f# P' z1 ?" A) V

% U" _! P5 x) V: v. L" J6 kif [ "$EPIC_WRAPPER_DVLP" = "" ]; then- Q1 J- }/ c, n$ }8 \
    if [ $is64 -eq 1 ]; then
' J, M( d, |7 y- d3 J        desiredlimit=200000
; U) `* Y6 I/ }    fi8 A7 |9 n% e- u1 {
else
2 Q0 X( q, A" r% T% L( ]    case "$EPIC_ARCH" in% O0 f( |$ Q; @. a
    *SUN*64)
# {) X# I+ z& h- J/ O% D+ u        desiredlimit=200000
4 l1 F* m' g3 c" U        ;;
7 A- [; ^0 ?$ t. M/ N! ]    esac
+ N( Y4 T3 h+ ]5 W4 K: ?: Sfi
5 C* }2 ^9 J/ ]- i4 B" C  {        ' ~* K! a- v4 D* A3 f! W
    if [ $dbglimit -eq 1 ]; then
1 g) r$ G" @, L1 ?+ p9 L" N" N        echo hard $hardlimit soft $softlimit" |! v+ P6 m5 ?2 t+ B, G) P
    fi
5 p1 p9 |5 A; T- |7 P9 j, Z, G: ~  y6 p+ A
    #stacksize can not be unlimited, pick smaller number
+ V6 A( |+ G' _& b
3 ?/ y$ ~$ f7 P; X3 \1 X8 C    stacklimit=$desiredlimit4 q. L# x" d  X* V

0 D9 e$ Q( a( W, y% z    if [ x$hardlimit = "xunlimited" ]; then8 H( b2 ?: I% }" X
        hardisunlimited=1
, f3 y" I' X4 e! u& {0 {/ e" @: x    fi6 z- S  B: L' W4 r. M7 ^  e& y' k

1 H0 r% F! a. O' l( f  J    if [ x$softlimit = "xunlimited" ]; then
$ z  U( o( P* ~* y+ B" ]3 O        softisunlimited=16 d* U& n/ h0 z9 |7 X) Q  ]6 M
    fi5 E7 A. e: w% H
3 z4 y  J) b+ Z  T0 _2 k7 U  W
    if [ $hardisunlimited -eq 0 ]; then
% ^0 e0 D/ b! d9 [+ f8 g        if [ $hardlimit -lt $desiredlimit ]; then. M( W& I: t( L: O; Z$ W
            echo "WARNING: stacksize hard limit $hardlimit K is too small.") w8 R, M# g/ E1 F9 B; ?: v9 d
            desiredlimit=$hardlimit
0 B4 ]0 W; \( e: O            stacklimit=$desiredlimit! _- m5 c* t: p2 V  K
        fi# p. }. D% F1 h' y: h" y; k; \0 a: E
    fi
/ ?( L& ^, X  a- \! u8 B2 {. T4 [6 ?* e! c$ E; {7 K
    # desiredlimit is set to proper value (< hardlimit)
! }5 z' M, L# W% _0 ?7 Q3 }8 J* k) S) Z: r) }2 J8 X0 N
    if [ $softisunlimited -eq 0 ]; then  N2 B( M2 L$ P* [; v. N# Z
        if [ $softlimit -gt $desiredlimit ]; then
9 T; d# q) F# n6 J& _4 X' K            stacklimit=$softlimit; B! g7 ~! N5 f' @2 z; X; t2 ]' f( ~
        fi
! Y- ?4 A/ x7 Z9 D& k    fi
3 k/ D2 L5 z6 n
9 n+ ?4 ]: W: K# m: K8 x0 P* ]) ?    if [ $softlimit != $stacklimit ]; then
' L& o4 r& }$ f* @2 r3 i        ulimit -Ss $stacklimit  r$ ]6 Z( Y3 b  t
#        echo "WARNING: stacksize limit is set to `ulimit -Ss`"
4 k. |+ ]: D' T9 X; @6 s* m    fi
0 j  l% n6 e2 Z, {1 O: x! F$ j5 J3 i  V8 \
    if [ $dbglimit -eq 1 ]; then; p" I* Q: d+ |$ W
        echo stacksize hard limit: `ulimit -Hs`
* F4 I1 H. n  K$ h% l        echo stackize soft limit: `ulimit -s`  x5 D# H, F1 p2 o5 a* }
    fi1 P6 g- J, g% o' E
}
3 g- j: o& A4 J5 R) Y4 A0 Q
! {# E$ o' b3 e# f; Bopen_epicscriptmessages()/ S* _% F$ ]; m8 p; a
{
  M1 X& n$ w- ]# u" i#generate  temp ".epicscriptmessages" file based on pid
5 D7 w9 ]+ a1 o6 p" Y3 o4 HEPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$0 N# z. U2 T0 _; p) c5 g
if [ -f $EPIC_SCRIPT_MESSAGES_FILE ]! R8 S& e) @. v, [$ R) [3 _4 `) J
then
: B: c+ {1 H! M7 }+ E  until [ ! -f $EPIC_SCRIPT_MESSAGES_FILE ]; T2 Y, J/ s0 h
  do
7 e: P; R: G9 K' q    EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
( |' r) k( n7 M4 j% e4 J- |+ _9 |9 u" p* i  done
; a" Z3 g+ V2 v3 hfi
- H  d5 V, H& i# B' Z3 y4 F' Z
; N1 B% S) c# f) l% @7 B0 f; Fexport EPIC_SCRIPT_MESSAGES_FILE! F0 N' s* _3 D, V* A! ^* Y. m
}
$ n. C2 m- e* ~: Y4 u# G% ?# l7 A* Z3 h5 s; i0 Q

/ R. }9 h. ^$ ~2 acmdname=`basename $0`
( c" h! U, q# Jpostgres="n"
" [; j+ \# t0 y8 p& h' Y6 qostore="n"8 w% ~- N2 z5 K
gui="n"
# ]* s- k: l8 A3 n0 [+ j  |databaseOn="n"
7 R5 O# y! k  Y5 o! e5 Bf_next=0
# v8 u# g$ P7 V2 Yf_option=""
6 T6 g/ x+ W! w5 ?% a7 P% }o_next=0. H: Q% ]3 I/ F6 p; Y* U
o_option=""
0 S1 u2 F$ _( B( `( [& w# aworkDir=""
+ }' S# s( v% s4 N7 o  ]workDir_next=0
7 O( C. U+ a$ H* T+ ]# HerrFile="powrmill.err"" H' {2 u) L3 X% o$ U& t8 _) c( K9 g
win32flags=""3 u9 I& Z1 t: S
ln_default="ln -s"& y3 ]3 a+ G4 p, m
0 L: {0 |0 S4 l5 l9 m
har_hilo_file="": h$ ?6 g1 q8 X0 w- [( O5 l  v
have_har_flag=04 Y( s0 F( j9 [) N% p1 d
have_har_setup_flag=0
6 Y9 X; R9 f: f+ [. _is_special_har_run=0
6 `9 N( Q" {" zhar_ofile_prefix="") {2 h  u1 [3 E1 ?

) @9 m/ e( V) ?" Ghave_va_flag=0& Y8 u6 ?0 z$ [4 c2 z) F
have_vaf_flag=02 B$ M7 N3 G* g' ^; I4 @" P! e; ~- L, Q
VAF_FILE=""
4 c+ _- X) @, x3 d, d. \VA_FILE=""
& x4 A  Q  X; C6 x0 w/ t3 xARGV=""
1 \" q9 X- t9 J$ I' a3 e( m' i
* [2 z. |, e5 lORIGINAL_COMMAND_LINE=/ o$ P# s( @+ ^6 `* H
LOOP_CTRL_FILE=".ns_ba_env". W$ _0 Y' L7 n+ U- `% X
ALTER_HK_FILE=".alter_hkf"
" \4 P- @- C( I% F9 x1 gALTER_COUNT_FILE=".alter_count"
- ^' V' L( R& x6 O* T% a6 BMONTE_IMG_FILE=".monte_img_f"
- E1 b- y  h1 ~* i* R) X( \. m/ AMONTE_COUNT_FILE=".monte_count"
2 U9 v9 `: R3 r( lMONTE_CFG_FILE=".monte_cfg"! S* M+ z: K5 K' [
EPIC_SCRIPT_MESSAGES_FILE=".epicscriptmessages". I0 O& K: W# O4 ^5 }
" H/ Q+ C% I1 J; T& ?; ~/ ^
open_epicscriptmessages $@6 c$ q6 n5 Q% n

% Q3 H  z$ a- f' g- x8 y( S! f( ~scan_for_hva_args $@! U0 o& q5 _5 S

+ @( p" G8 V7 [2 A. R: vscan_for_har_args()
4 b) j; X5 o7 i- X7 E& b& i5 \{
" \& W8 }" D$ Q# i; `' ~  while [ $# -gt 0 ]; do9 i, w$ Q! i4 ?5 ~) z3 Y  O& p
    case "$1" in
" D5 s& J9 @0 b3 n9 L' A; i/ k1 y      -har), z' _5 W& f* a
           have_har_flag=1- A6 S+ `1 h+ V1 i- X' B
           [ $# -gt 0 ] && shift
+ K  U* e) j2 S9 H           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then. n  X/ I( C; f' B, z8 l
             har_hilo_file=$13 ~0 `% r  }: h+ Q4 |- r+ P8 R, R
             shift
0 p" p' b  P5 R, `7 B# W           fi, k( S+ p5 ^0 n3 M+ j
           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then) v2 o2 E+ Z( L" J- o) ^
             echo "Too many arguments to -har flag. Only one hilo file allowed."7 q/ E4 x9 \. Z7 s
             exit 18 s/ {1 n8 _/ T5 ?( }; h2 f
           fi6 d2 W" n% ?+ H  K9 g
           break0 \$ K* e3 ^4 H5 V2 U1 h' J
        ;;) d6 g4 U& d% U# r
      -har_setup)3 y1 r/ g2 y1 K8 |& X: j
           have_har_setup_flag=11 ?( E* i& ]1 M, f
           break
& L( @8 M' b! D2 t9 v        ;;# n% f/ r" Q2 H; J) {
      *)/ [, v0 R$ \% t8 K, V
        shift. Q$ ?# U4 E% s8 l
        ;;, q: Q  _: D2 H9 K) @
    esac
0 _# ?! D# {/ X5 V4 u4 v  done( i  G" w) ]- B; l- t& L
}8 t, T, N* D6 [# {; `4 \/ X  t
' F! b* N( t. s7 c$ @4 ~
scan_for_har_args $@
' H. i% u7 E! U$ k7 C
% R* o5 Z4 w* Q: u. r: {( Jfor argv in $@! e5 {4 q4 x; @# z3 X& e! d' g, f. h
do
5 N5 T+ H2 R  L( R7 i   ORIGINAL_COMMAND_LINE="$ORIGINAL_COMMAND_LINE $argv"3 ^3 ]! V( H: g# ]6 Z" T
    if [ $argv = "-gadb" ]; then! [& G/ T3 x$ r$ W; t
        databaseOn="y"* _3 r# d4 s7 d2 ?
        workDir_next=1
$ y* o+ h* \4 m& m3 m  y& K    elif [ $workDir_next -eq 1 ]; then
* D6 F0 |; @% W( j, n        workDir=$argv
9 b3 ^8 ^# d5 g. |        workDir_next=08 \" ~; S0 J/ E* X' o
    elif [ $argv = "-ga" ]; then
5 G7 E4 H. H! P' X        gui="y"
$ e% F; J9 [7 t, [, M2 L) a# F    elif [ $argv = "-f" ]; then# A! `- O7 s. C
        f_next=1
* o/ P' J+ k: i6 R$ s  [, N: X% U    elif [ $f_next -eq 1 ]; then" e; Y- Q( A* c0 L; l  j9 Y
        f_option=$argv
0 Z5 H+ r* y. B0 Q- g. K0 S, e        f_next=05 f2 Y4 b! q  P
    elif [ $argv = "-o" ]; then& X$ r% Q$ v# U- F, |$ {2 v) {& J
        o_next=1
4 u. l, H. k1 ]- f3 w/ A    elif [ $o_next -eq 1 ]; then
$ x1 F6 T& e5 t7 h. w% Y4 }  \' Y        o_option=$argv
" j0 j* S8 w- @- X7 d        o_next=02 m6 \8 z( o4 Q
    fi, l, `& F" {& C+ z+ l  A# g) T
done. b; T% j/ }+ G- ^4 P0 s
echo "Command line options: $ORIGINAL_COMMAND_LINE" >  $EPIC_SCRIPT_MESSAGES_FILE
; Y: H! P& y: L2 V
0 @  ]: \8 ?9 a& p0 I2 {$ Iif [ $databaseOn = "y" -o $gui = "y" ]; then0 A, `$ J5 o3 Y: r  S! U
  if [ $cmdname = "pathmill" ]; then
8 g* H# v$ O' r7 _4 o    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5"  -o "$EPIC_ARCH" = "SUN4_SUNOS_5_64" ]; then
. b6 l& }, n' G' a# {- R         ostore="y"
; [7 }0 h( O8 e9 l* |2 {         postgres="n"( v* m) O' O* u8 ~, c
     else
' P; P8 k$ b# H. j2 R: z5 ]& Z        echo "athmill GUI is supported on Solaris platforms only" 1>&2 ' n1 P% l4 J3 b) j
        exit' a6 K$ \) ?) B) T1 L2 y
     fi
! j: B: C1 Z: j+ d% a  else& d& |& H, I0 c, H' L
    postgres="y"
7 h. d( S, i, t+ F, _, ?+ r) h         ostore="n": W) M( y. v: }
  fi
0 {# H- t; a; _fi6 _! e1 g5 N' ^2 @" Y) U& n

& \$ d. Z1 _$ p- [8 j' c7 @6 Dif [ $gui = "y" ]; then; P, t3 h# }# R* w$ y
    if [ $cmdname = "powrmill" ]; then6 G2 _7 f9 f: I1 Y  Z2 k' c
        pwga $@8 W8 c: s) V3 R
        exit6 h# c5 _. {% e' G# n2 y! y
    fi
  Q6 \6 I1 b. M& j; o% L& K  Q - f4 C3 {7 ^% X' Z+ G8 @
    if [ $cmdname = "pathmill" ]; then
# @, _/ M' J6 o: n8 b        if [ $ostore = "y" ]; then1 t$ L" b3 b% w/ X# W1 y& r
           ./pathfinder $@3 f# X# L& r$ M; t! E
           exit  |/ M/ [9 n/ ~! l2 a
        elif [ $postgres = "y" ]; then
0 `- O' p! T# i           pmga $@4 h3 ?( a( ?: q$ a5 F" P/ ?# D
           exit
. q; n# Q( T. R) l, I' T        fi7 M7 H- M$ @/ D$ Q
    fi
- @& g$ n3 t& I/ u! ofi3 }4 h: i3 d" m* u/ j( q6 ~. k- v

; V; m" R7 i3 w. Cif [ $databaseOn = "y" ]; then
6 X7 l4 {# s5 M6 G; t: Y   if [ $ostore = "y" ]; then
9 t# m) L; @/ v9 x6 K      if [ -z "$workDir" ]; then! R% a# ~3 G3 V! F
         echo "Error: Missing argument for -gadb option"
: S" q" \8 P4 ]  ~2 x         Exit 1
+ |  S2 b6 a! g0 d) y& T7 O      fi) p7 a: l1 `5 j  T1 n5 P$ d
   fi& W( l& V( R0 [6 L: I! ^
   if [ $postgres = "y" ]; then- K6 p2 G7 o( ^
      if [ -z "$workDir" ]; then
1 R. m* U* S& u2 {: j: l         echo "Error: Missing argument for -gadb option"
' P+ L. S# G8 N' K2 A         Exit 1! P8 c0 ?  i0 u5 \: k
      fi5 H% r7 i  m! H: C/ l! ]0 @& f5 L
   fi
) `* M9 P* m& xfi
( @) Q3 X$ ]# ~
) w$ x* E% W, Q' m# |. x2 l& Nif [ $postgres = "y" ]; then! _2 B0 b  H# F2 U5 V: D

1 I8 W. _7 e7 h' \: D, p1 g    if [ -r $EPIC_BIN/scripts/gui-init ]; then
- H% d7 O6 Y7 {6 I3 X9 B/ A        . $EPIC_BIN/scripts/gui-init( I# ?6 g8 C" ~( j' V$ w! o
    elif [ -r $SES_ROOT/bin/scripts/gui-init ]; then
5 I, {5 k5 T9 X        . $SES_ROOT/bin/scripts/gui-init
, S+ R# a& b6 D! C: g( R    else
. l' {$ g; y: K/ s& m        echo " ** Installation in \"$EPIC_HOME\" has been corrupted!" 1>&27 `4 N3 b$ p. U( x
        echo " file bin/scripts/gui-init is missing." 1>&2+ k- L! m, V# w4 ]" Z) W4 `
    fi
1 V( V+ ]* c  S$ E/ R3 l# o/ f* x& T( x5 ~" ~
    workfile -tool $cmdname $@
6 A% c+ i  _4 v+ Q0 X) M7 u% ?: ^3 A3 ]fi- T4 O6 ?) {1 a# \, Q4 r: j3 W0 H- N2 E

2 U+ A% c/ D: H, }* oif [ ! -z "$o_option" ]; then
3 Y9 Z; k6 ]. A/ t! x5 \    errFile=${o_option}.err
: I4 b: e5 ]& y8 Pelif [ ! -z "$f_option" ]; then4 g" _( V  k  B
    if [ -d $f_option ]; then0 }" Q0 F: t/ A/ B. W: F
        errFile=${f_option}/powrmill.err4 _4 Q% h8 I. _
    else errFile=${f_option}.err
1 N, E. L% h" C7 K$ P: o/ h    fi8 q: e* s5 R+ ~8 z7 h6 n
fi
& T* w8 [" `+ N# [0 ~& N
0 q: b1 i% M! P/ M% X! _: m; Z+ ]; @
if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then7 _$ J) Q( N7 _7 K$ U
  rundir=.epicrun: P7 a" i2 {# z; g( A6 }' T: E
else
3 _" \" x9 s4 U6 x# |1 p- F. [, f  rundir=.epicrun$$3 r2 }9 D  T6 _
fi; j; S% z6 X* o! I0 K

, g% X) O- d! P; m+ v; M. |( Glibpath="$rundir${EPIC_DLIM}$EPIC_DIR"
: i/ U0 B/ N$ c8 m1 c( u
! I) `+ V9 U; ucwd=`pwd -P`/ ?# Y. E" X# l3 V
if [ $cmdname = "acehdl_w" ]; then
- H5 @2 l1 U! j/ ^  cmd=`basename $0 .sun`
6 d6 R9 s8 V3 q  cmd=`basename $cmd _w`7 B/ b7 i9 m/ h+ y
else9 h" C. C% A$ |6 Y
  cmd=`basename $0 .sun`$ |! f* g1 Z8 G; {
fi
7 _2 L0 `4 ]6 Q6 L9 O
0 E4 E3 P4 g! I' U- K4 u+ t, Hcommand="$EPIC_EXEC/$cmd$EPIC_EXEX"
& @% _$ n( O9 ?- ^[ ! -x "$command" ] && echo "$cmd: not installed!" 1>&2 && exit 18 \5 Z$ N+ v) g  a& _. x, [
( ?$ x% @5 P( @/ w* }
# buildmod extracts -u/-fm options and calls genepiclib
9 T4 T- V" U3 k4 _# It also set the remaining options to variable CMDLINE4 F) r* J* m% _' s) F: m/ X
# look up in .epicrc for -fm & -FM parameters
. B2 a- e& H8 X3 [4 h! B. D1 E' S7 G
fmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`"# y# l4 f( x- T
[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`"
0 }, O8 `0 R2 ?! x3 v3 u[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`"
  Y* `% u" S6 w2 u+ o' u) o' R+ z! g + G7 ]0 a" G- P9 h( ?
FMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`"
7 {" G8 y; S0 S3 e! z; ?  ^, z[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`"5 h6 U' m/ w% K% |4 H. j& j, Q( G- Z1 i) G" d
[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`"( ~  T$ c% w3 c  ~  z; I
& J1 V, H: c6 h4 s" d6 V% w
if [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then1 N1 I3 {6 f! }$ ]4 Q8 I
    # note that the buildmod script will set the CMDLINE variable
+ c# l% c% ~- _, v: _) O- D! t    . $EPIC_BIN/scripts/buildmod
- v; K1 ~$ N" ]8 M: U$ c$ G% Q/ v4 s2 x  g
    #echo "This is the value of cmdline=$CMDLINE"
; o% m3 P  x. Z( }( T: |8 K3 Q6 x0 I9 W    #exit 0. F" m/ s, \4 e9 p0 x, C

; r4 u7 d: C* ~/ Q; a    # if a new timemill/powrmill/pathmill built, run the new one) Q  ~# B9 t2 H+ Q$ U) \, e
    [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX"
- s+ R7 J8 t6 U2 u8 N; C1 k* Z0 }fi1 V; Z" r: z: q8 ]; @
" o' D% ]- `6 ?9 e. ]! o
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then
! S" e0 X7 M' [  if [ $have_har_flag -eq 1 ]; then
% \+ I( w8 p; z& y  N    is_special_har_run=1
5 L  U1 }2 q) M8 g    if [ "$o_option" = "" ]; then
2 X6 ?, `$ D( i- ]3 Q1 @2 ^  D2 M      case $cmd in
- \; I9 ]1 [2 a) @, }        timemill)
+ d% E4 ]* A; T& y  y2 q5 ?! z          har_ofile_prefix=timemill
" M+ h$ s+ O( p% U          ;;2 I- ]' E# g5 t% A
        powrmill); {& z/ w, m4 |5 K: a
          har_ofile_prefix=powrmill
5 @1 C6 c! ?: k! s) v: F: P" |          ;;" h: r/ b: \- ~" ^, _
        nanosim)& e+ }: R, Z& |" t5 w/ f
          har_ofile_prefix=nanosim# E& X) t: K1 x0 R# ?  V
          ;;
2 e6 c" g1 L, x      esac
, b. R* v( B  }    else' s0 _8 o  E4 c. l. `( ?- ]  f
      har_ofile_prefix=$o_option
" a  ^' O# ^5 w2 n9 P, c    fi
3 S. i8 Z9 Q$ ]% H0 S/ r6 N. R fi
: [' j- G3 @% hfi
1 D9 k. E4 d, u) Z7 p% b' W( T+ z. ~6 X3 ?) f2 _
# Call Double precision version of the product if -D& {2 q1 l6 G& E  |7 G
# or simulation time > 1,000,000 ns.
6 X" W' `1 Y- i( Kif [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then
3 K  j: K6 _  H* m% ^' L* W( x) x, J, S
' Y: \$ r4 N8 {2 I! F  # Now the binary always has the ACE feature
; g( J5 v9 X' k0 M+ V8 ?  USE_ACE=YES4 d# ~; s4 [  C# y/ ?7 @

9 w/ I; U: L( |0 G/ S( q  HAVE_DP=NO, q0 g2 C7 i; D$ y$ s$ }
  EXTRA_CAPACITY=NO
. L5 s3 N" F* q% c  DB_REAL=${FORCE_DB_REAL:-"0"}5 Q$ M% K% M5 A+ H' j( Q
  E8 B5 T) B3 Z8 P$ j
  # Enhance for ACE ease of use
& s; n% w, q0 W: K  # If no command line option or only a -T option, do:' B; g! Z" h: p+ O1 _
  #   1. set -A option1 \1 u0 i8 D. A2 \" v, M. ^
  #   2. assume input file to be hspice
( e- R; U5 H; T, n  #   3. set -o to input file prefix" H4 k) K* e# }& V0 ?8 x
  #   4. set -z to input file prefix
7 E& r  t- w' z  #   5. set -c to default config file: B) J9 w( x# l; [: X
  netlist=""
5 i& _9 x' z5 t2 A  I8 `. i" m4 h4 M  minusT=NO
7 f+ y/ p! {0 M1 x) w6 V' H  useStdCmdOpt=0' m0 f+ M1 }+ q. O% a/ z
  prefix=""# K) Y: }; h0 s  x) V  Z
  circuitType=""
. I; l! T6 X: Y2 h4 X  for opt in $CMDLINE% _7 s3 u! ]' s7 ?# c/ h: Z3 H
  do9 @6 A4 a" n0 N: X" C0 E0 L$ A0 E
    case "$opt" in ' r3 q& d5 p$ n! a
      -T)  W# @* g# h0 w
        minusT=YES
0 B4 v( s8 S  i5 h        ;;% v+ }$ a4 G" \7 d7 d
      -*)
8 N# {# S  a$ G) d2 f        # using standard powrmill command line
3 b- E" y. E6 I" V4 a8 l% X/ F& ~2 ?        useStdCmdOpt=1- d  ~' h2 Y/ G+ B! S
        break  @3 Y+ e+ ]3 l+ p* g# q
        ;;& D( G3 f$ i0 ]" R2 w0 [) L. L; C0 S
      *)3 W, o3 \# m+ X/ n$ ]0 D
       if [ "$minusT" = "YES" ]; then2 x. d' t3 F) a% d5 X1 s
         circuitType=$opt! T, Z. o5 P* m* A$ {0 j8 j( y" |
         minusT=NO  # reset flag1 `# G$ Y: e5 z3 L/ m7 B
       else
' `; E8 a- t, M0 m& @6 M: ^         if [ "$netlist" = "" ]; then# A* @' p: k# g/ Q( @# s; {
           prefix=`basename $opt`3 C/ S& X' ^$ r" a- t/ R
           prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix`: R3 `2 C( Z! f6 x7 }
         fi+ {- i$ L5 y$ @! _
         netlist="$netlist $opt"
2 w4 i/ r0 b. i' x' m9 A; J& s       fi
7 ~2 U6 I, l) U* a& H# |- _       ;;
8 W+ L5 Y1 I! l: `; G4 ?$ d    esac8 I) w3 n" W: J; k* k. ~  u7 W( f
  done
; q1 ~4 `' i2 @9 S# D6 [. w- w- M) F. F9 E
0 C1 I5 j( D6 [- a# e
  if [ $useStdCmdOpt -eq 1 ]; then, R8 H, z, ~+ x
    # use standard powrmill/timemill command option
; C9 F" Z/ }5 n    for opt in $CMDLINE
& U2 F4 D- m% F    do) v7 t5 n* d3 S$ j% J4 P! P
      case "$opt" in   A0 f4 I. l( x+ E+ G/ }
        -A)
% V2 C3 v8 a) j            DB_REAL=13 ?/ {/ D. `  F6 T# F
            ;;3 N$ [) u* h/ u8 R/ I4 R# n! R$ G0 W
      esac' r. X4 o, f1 N) q0 p
    done
+ ?' `+ D$ u9 x    if [ "$netlist" != "" ]; then. u1 n- k& g) P( @$ W/ M0 U
      CMDLINE="-nspice $CMDLINE"
! y7 B& W+ i. t) X$ t    fi5 G' @$ s! [" x5 S( Y! V+ E
  else; H8 X4 |2 d. B- L7 x
    if [ "$netlist" != "" ]; then
% u' y4 k# d) E4 ]5 T" `      EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"}
4 L6 v( V3 _7 K7 a! R9 B' v( m8 F' V      # construct new command option2 H% b8 S6 ~% b8 K! u4 X3 |
      if [ -f $cmd.ini  -a  "$circuitType" = "" ]; then5 M5 [' w5 Z1 c) S0 J( m
        CMDLINE="-nspice $cmd.ini $netlist"
1 F. m0 b& ~: @: j% \      else
1 r: `7 C' w$ d" R  \  }6 V2 a        if [ "$circuitType" = "" ]; then
, |8 D# u! \* Z- j! c          circuitType="msana") W. n7 L. a. m- N0 D3 \9 g
        fi
4 R+ n" }  J$ \+ o+ ^! ^5 a& `        CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg"
3 b7 f$ [, Q. o, f      fi0 l$ r" Q$ ^( n* [! h. _
      CMDLINE="$CMDLINE -A -o $prefix"; D2 F* a+ R) p0 {
      DB_REAL=18 g- q$ V3 a1 [* ?
      echo $cmd $CMDLINE/ Z  S: ^9 K" R' P2 a7 Y0 J
    fi
3 O9 D8 ~$ F& z" h  fi3 q$ }* z( I* {. `* R* Q* e
fi # cmd is timemill or powrmill or nanosim or railmill or pwarc0 Q7 p& D- y$ W1 N# @3 }

. W* o: F% y+ {/ u  \/ g- g[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a"5 U6 D3 D2 x( o2 y$ _" m
[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a"
8 ?# Y& U* k* W, B[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v"% A$ C/ T- }6 i
2 i9 l3 C8 x9 J
if [ "$__engine_wrapper_called__" != "Indeed" ]; then( O; }& ?, K, Z% A) g8 C: I
    __engine_wrapper_called__=Indeed) t* E5 B3 S6 Z& `$ K( l) u
    if [ "$cmd" != "amps" ]; then$ V, M8 g* v% w% c0 U, s6 f: _) P' ~! H* y
        export __engine_wrapper_called__
. k+ }5 \) J; W) x' Q    fi, ^* J+ {) ~4 k

5 ^' S1 C: n- G; Z- Z0 {7 p    trap "cleanup" 0
& {5 Q$ A- ~2 a2 |) s5 p    trap "" 2$ v; Y: h+ j( w* T/ y; Y

8 S6 u- E- J8 T, t    [ -d "$rundir" ] && rm -fr $rundir' C+ _# r2 A7 f1 h" J
    [ -d "$rundir" ] || mkdir $rundir( B) t8 n. v2 u- }$ D, S
0 u& ^- E% W" y" M) p7 C
    case "$EPIC_ARCH" in! G! X$ _* n6 n1 ?( O& n. w
    *SUN*64)   ( l$ g0 H* K6 b
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"$ L6 f1 p! G5 W( B0 h( F8 p  Y
        export LD_LIBRARY_PATH" w+ p* j- H, x
        suffix=.so
, z- k0 M. X$ H, y2 X. m        ld_err_code=127( E& [+ e/ U% ^9 g! W# L! q* C% m% C
        ;;
, n; s$ H/ Y' M7 \& v    *SUN*4)   . X& J* X2 L. Y2 |
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
: p3 P) v! s0 R        export LD_LIBRARY_PATH
/ k$ z0 y- `7 E& u0 w        suffix=.so.1.0, y5 A0 n9 @& c( _1 T' `
        ld_err_code=127
/ {/ V' T6 k( l. |. y2 L5 ^        ;;+ z4 ?1 @: M, {/ I2 U" [
    *SUN*5)   
* y2 P- \6 L2 N  ]6 K9 X. v+ m) ^        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
9 R7 e5 u0 c* O/ l+ a" i) o        export LD_LIBRARY_PATH: A8 R4 j  V! Q- K
        suffix=.so& ^& K$ U, [% R8 w5 E
        ld_err_code=127
9 h+ a6 \+ |6 e  i! q* M& r        ;;3 [: _% J0 T9 P- @8 x" D2 r* n
    x86sol*)     }$ S3 b  S7 B$ T$ `$ `' H2 j" G
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
/ ?4 a* b; L' q0 f" Y- I  T+ t        export LD_LIBRARY_PATH
0 I* ?: {& C" O/ P7 k        suffix=.so
# u% L/ v8 o5 l7 l$ J        ld_err_code=127% t; s: x/ s; u% a8 T* I
        ;;
6 S$ U6 g% B' {    *AIX* | aix64)   ; C/ F8 X0 y2 g3 w& v# a6 @# S
        # When genepiclib creates shared objects, it creates a import file and
1 L8 d$ N' G$ l; j! r" }* m        # uses timemill as program. So at exec time,program timemill is needed " W: }8 {( x* P# Q1 l- r% J3 D
        # in LIBPATH$ [* _! ]7 u0 O
        $ln_default $command $rundir/foomill* e# t% K+ @, z5 u8 S. h
        LIBPATH="$libpathLIBPATH:/lib:/usr/lib"
% F5 y! H7 N; }9 k! L/ L4 v        export LIBPATH+ D. D/ I- E0 O# N
        suffix=.o
$ V! T- q/ W; O1 M  ]        ld_err_code=8
5 \9 z1 Y2 K. Q7 H3 R        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
; f9 E  W3 w( [          tdir=`echo "/tmp/d"$$`
% m" \+ L, J2 T7 l2 L$ T          [ -d "$tdir" ] || mkdir $tdir$ {4 q& h% f& l) H# |- s; P
          if [ -f $EPIC_DIR/libCustom.o ]; then0 ]8 o7 {" S" V3 @
             cp $EPIC_DIR/libCustom.o $tdir/
$ x8 N& S$ |2 u0 ~) y             $ln_default $tdir/libCustom.o $rundir/
' I- G$ m$ @* y# c2 w2 ^          fi
( ~; B/ }7 j9 j/ w9 [6 R4 |6 ?3 v          if [ -f $EPIC_DIR/libModel.o ]; then
0 y$ G" X. ^1 i( F# X! u( R9 O             cp $EPIC_DIR/libModel.o $tdir/5 ~  L" G) w3 [4 g
             $ln_default $tdir/libModel.o $rundir/
; I7 S6 h2 c. M% N9 t          fi3 P, o7 w5 H1 ~
          if [ -f $EPIC_DIR/libFuncModel.o ]; then. o* v2 L6 z& @. X& S% l0 W
             cp $EPIC_DIR/libFuncModel.o $tdir/
5 ^6 X$ e( J# L& S' F8 }             $ln_default $tdir/libFuncModel.o $rundir/7 ?$ a$ e$ C, K: c
          fi% J3 G8 B( E" T" U- K# Z
          if [ -f $EPIC_DIR/libFuncModel.34.o ]; then. ^& t2 Y8 `( N8 M5 [
             cp $EPIC_DIR/libFuncModel.34.o $tdir/
7 ?$ k" n- n* b1 [- c             $ln_default $tdir/libFuncModel.34.o $rundir/# q( Y6 E5 ], a2 l" [* b) D
          fi
9 V: \7 ?; P- U! |        fi  U8 Y; E# B3 n) x
        #Set the IBM flag to enable more shared segids
' Y8 O0 y& p5 L0 E; ]3 u( [" `: m        EXTSHM="ON"+ @( \* \( d' v+ B6 H* }
        export EXTSHM9 @$ }2 y' s' B; ?# O' n% F7 B
        ;;
' b) F* f- I$ t; C, {    *LINUX*)    3 P' t1 Y# e( v' p  k0 Z
        suffix=.so
6 S1 u* s: ?8 n. t( e8 T; L# Q        ld_err_code=1
) I" ]5 o' P' ]& J) A: H        ;;  }7 Z# _; L" D2 x- S) @8 s
    *amd64*)% S9 ?+ d1 W$ L9 D6 P. {+ F& l
        suffix=.so
0 d3 n/ V5 G( G' w, Q* a/ E        ld_err_code=1
) z0 S* H2 Q! j2 A( o        ;;
2 K+ G9 `, g/ v# ^0 W2 T6 u8 W  E/ R. n    *suse64*)
4 b. f+ o/ E$ W; h5 e" i" \        suffix=.so
1 u/ k$ r2 P$ B& d, y3 L* C; K        ld_err_code=11 e0 d+ ]/ `) q, c4 I3 ?  h/ K
        ;;
5 B2 ~/ G: I, q+ n4 M( ^* v9 F    *suse32*)    & V( {9 M9 _& n& `& L; }/ W- I
        suffix=.so
3 Y: \+ z% `8 C- |        ld_err_code=1
' k* f& A: \( _: O$ D7 E        ;;' w0 B9 Y' K$ o* Z) D6 S! n
    esac! B7 n9 \8 _" V+ p
6 w8 v# Q; S' G" r
    [ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix"0 r5 H1 W2 l/ Q4 O+ R
    [ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \9 |. s6 F  s, P" @5 Y
        && [ "$cmdname" != "nanosim" ] \
2 @3 O7 G4 Z  S# v- P1 L        && [ "$has_model" = "YES" ]  && ulib="$ulib $cwd/libModel$suffix"6 G. D) M" p* F) `  @2 T
    [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix"
+ a8 v$ V6 C5 _8 K) ~, j( H3 {) q
, }, p& @9 \6 u6 ~% @#Look for command line option for libFuncModel.so* n& C% W/ h/ R  D
#    user_library_next=0, r# c. n6 H( x
    has_fmlib=""
0 y1 R4 b1 h4 K    for opt in $CMDLINE
3 @: S8 K) a/ z7 w, s( B3 H4 s    do. f5 B% b" Q+ V& J3 r) l6 _
      case "$opt" in
% p  |1 s  f7 }5 `' u0 s        -fm)
! E8 Y+ _& `; O* f) t            CMDLINE="$CMDLINE $cwd/libModel$suffix"& U/ k. m* }, @( s' F8 v5 ]4 V4 H
            ;;2 l* m# Z. M7 d7 R2 h+ x
        -fm_user_lib)
, }1 c. o2 f8 \6 K9 l/ H) x' G/ Y: T9 b            has_fmlib="YES"1 q- f: X  K7 |- z# ~5 s
#            user_library_next=1" S6 B% l7 C) ~8 B( P. M
            ;;: _7 l7 J4 o+ V
        -xc) 6 Q& Z! v0 g) z$ B, l6 G3 V0 J
            if [ "$EXTRA_CAPACITY" = "NO" ]; then$ F5 L! k* i3 {, j+ |, n
            EXTRA_CAPACITY=YES
! |" U# t# y# B  h2 a9 y8 m            fi
$ a1 d9 _* t) m  c3 p- ]            ;;' q! K% l, c2 q4 ~' {
#        *)# G1 i% R5 N8 |' |2 @8 p  ]
#            if [ $user_library_next -eq 1 ]; then- ^6 }8 o, U; F# |
#                if [ -f "$opt" ]; then
9 I% @. T& X$ k  R9 ^( {#                    libfmodel=$opt9 K* O) T6 b8 y# ]- U
#                else* Y& a* ^* d% i* a! K2 i) T
#                    echo "-fm_user_lib: Specified file not found"+ O3 \% Y! ^4 i4 m7 U4 m
#                    echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages  W2 s8 s! F) Q3 e9 |* T5 o
#                fi
0 b% C! e1 {" {, v#                user_library_next=0) n% M$ }9 B4 V& d- {6 [+ Y# x
#            fi8 o, m( Q7 |2 e+ _
#            ;;3 F6 y. L  |3 e2 ~
        esac0 y1 S5 }. K7 W  u5 f9 L" d
    done0 \6 k' B; ?# }# q: T, ?
0 z9 L& o- e2 r; ^  B4 D% S
    if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then# q) i- J% q" Y* n, ?: @
        flib=""- Z# S1 \; x2 W  c; T" p( x7 t' p( o
        if [ "$has_fmlib" = "" ]; then
+ m( @* T& y) l/ g6 m- R: V* `- M            flib="$flib `get_epicrc ./.epicrc user_libraries`"( ]  Y  O1 t: a% V4 U
            flib="$flib `get_epicrc $HOME/.epicrc user_libraries`"& f+ e* m) f; q" k4 e+ P9 f
            flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`"
9 ^: ^( p/ ?5 E0 ^        fi. s- t( I, N7 p" q8 v* u8 c- R5 p
    fi
/ L: k( n% `0 t. ?4 r' _5 T8 s- S' p$ p4 F
   for i in $ulib0 ^- f4 M7 ?) c2 U
   do
" O6 [, p* t% D" E       [ ! -f "$i" ] && continue
0 ^7 Q7 o/ O( Y2 m* N+ z" u       dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd: Q1 @+ ]1 g  w) j8 i
       i="$dir/`basename $i`"
; l* V6 _- o; _( D8 N6 w       case "$i" in' o7 @6 }- X% x) V' N1 X0 p
       *libCustom$suffix*)    [ "$libcustom" = "" ] && libcustom=$i;;1 b5 e* P9 O. q# g$ a& |, {7 B  J
       *libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;;3 F. x8 i# m- L7 F3 q
       *libModel$suffix*)     [ "$libmodel"  = "" ] && libmodel=$i;;0 |9 H) |! P; c1 o+ r6 B
       *libva$suffix)         [ "$libva"     = "" ] && libva=$i;;
6 N5 Y9 m8 x& [       esac0 A0 r. M( I) @  K% m. H' u0 A
       [ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \
# l+ `5 l8 o' `! j% N        && break9 M6 g, c2 p' k* H$ I2 L8 Y
   done
, r( |' G( H/ _
! h  I% F. ]0 j# p; t3 R! I. W   # symbolic link shared libraries to .epicrun$$, v* y) q6 P6 D/ Z+ b& o
    cd $EPIC_DIR; epicdir=`pwd`; cd $cwd
& j9 z9 ~. [0 S* }: f  ?    if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then7 t; H# ~" F* q9 C+ r  y6 g
        if [ "$libfmodel" != "" ]; then0 _. B/ l7 q8 t: w- y
             [ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \# t$ S$ z1 \  o" s) s! M- h6 R
             echo "Using $libfmodel ..."  && \2 {# B' @5 n+ e
             echo "Using $libfmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE
1 r; `! u- x) a: q  ^$ ]             if [ -f $rundir/libFuncModel$suffix ]; then
: q: j! H( p& B3 w# f( W3 A6 ]               rm $rundir/libFuncModel$suffix
2 }* b& y$ r) P  T" i6 X$ Z3 G' x             fi1 c  l* m! @0 U/ w3 Y& z/ |
             $ln_default $libfmodel $rundir
. ^3 j1 U1 J9 n; ]0 x/ U$ f$ U% ^        fi
8 H5 H  Q8 {: R% q1 ]" B2 w        if [ "$libmodel" != "" ]; then
- P) ~6 O1 h, R+ g9 l8 s( i0 N             [ "$libmodel" != "$epicdir/libModel$suffix" ] && \# N& |2 \4 z% H0 J( _
             echo "Using $libmodel ..." && \
. L# D/ {  E/ B( B             echo "Using $libmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE7 C. Q" e: i+ M7 m
             if [ -f $rundir/libModel$suffix ]; then
5 a* y& I% m3 j. z               rm $rundir/libModel$suffix! S5 Z; f/ a+ l
             fi3 x. h# W7 |9 L- I* t
             $ln_default $libmodel $rundir
% h( r* @( ~/ ?# x' t4 E; ?        fi
: F3 P% G3 d! k6 h% h6 s6 a9 G   fi
! g# Z; z( L2 k' y" z$ k1 Z   if [ "$libcustom" != "" ]; then
, }% U% B- G# c5 o. d" @* j        [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \
0 ?; w* }. I0 n% z$ r. _) G  Q! D        echo "Using $libcustom ..."3 ]+ _! I+ c6 Z9 p
        if [ -f $rundir/libCustom$suffix ]; then
9 U$ l8 K- Z' l) q: a. G          rm $rundir/libCustom$suffix9 {, _, M9 q$ L+ W
        fi
7 e# R& t5 R7 R        $ln_default $libcustom $rundir 3 F6 V  {* {$ n, N# v$ s
   fi
1 h+ w: _) Q+ |0 v* M) E" P' b
2 @5 z$ q/ k0 C6 l% A4 K4 j   if [ "$flib" != "" -a "$flib" != "   " ]; then! L- i1 Q, |) M5 c
        CMDLINE="$CMDLINE -fm_user_lib $flib"+ y' n  u5 F: p1 ~# p! E
   fi
: z9 K8 u! r7 d, s1 k' G; u
, Z/ r' o5 p. N$ ?/ D$ G3 M   if [ "$libva" != "" ]; then& k: l; v( @; Z/ y& K3 h
        if [ -f $rundir/libva$suffix ]; then6 B" c7 q: l7 X) e% |
          rm $rundir/libva$suffix
& C) w5 J( m7 A& I4 X4 C% }4 w        fi
7 O: h& X5 j* [        $ln_default $libva $rundir 8 v0 c1 @+ ^6 D8 m
   fi
* T/ ^4 W$ n( z7 B8 s6 o
% U% Q9 j2 ]0 p( O- B$ a- w
$ _7 t6 w# T  o# s; B8 T    # VCORE design library
9 Z6 V2 P: O" {3 A' l. T& D    if [ "$vlog_design" != "" ]; then  ]$ @: L1 E9 Q
        $ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`0 ^; g5 k9 Z( x( O7 n
    fi, I4 F4 ?5 V- N/ C2 S  O  L

: m  Z1 ]$ z3 _& r( M! k9 h2 R0 C    if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then
* W! y( m" f- b8 K        EXTRA_CAPACITY=YES8 k2 h$ z  m& G9 _+ K+ f( x
    fi( z" G3 S+ |4 u: g  R5 r! p0 h4 T

7 {" E; Y1 M0 u2 i    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc"# g3 t# e$ e4 |4 ?' J* F
    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc"7 p8 d9 o9 E5 Z
    #Create temp file if dual process is on, n4 ^, w$ M/ L7 x8 _$ }: V8 F
    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then
/ w3 h) O- B2 }+ |" P3 y" W& k        if [ "$EXTRA_CAPACITY" = "YES" ]; then
' k' _9 M) W2 _" c  R: \8 @            touch $rundir/rpcidfile
( s4 [  }; X) t! k6 |3 F- r. U8 s        fi5 `4 g) q) R. {# t
    fi% G2 M" q: J; `8 H' Y
fi5 w( u' D9 \  [2 K' D

3 X/ R! G! r7 h7 |6 arun_cmd()0 {" N* [( A# ~) w
{$ l. ]* j, e/ A
  command=$1
) N+ V/ W/ Q/ p! i- Q& g  shift$ a1 E; s3 I  a, h& o" E
8 u. u2 o& m  Y+ S" q+ C
  if [ x"$VA_FILE" != x"" ] ; then
. W7 r% M# B! G/ M7 z     cmdline=$ARGV
9 C/ _- ~: x4 X0 i0 Z5 i# c- ^  else! n1 i/ C+ M$ P$ b6 ]9 {: R
     cmdline=$@
& D3 x0 X' o3 O- t; T  fi4 |8 Y% _- X" z9 F/ [/ ^; J4 K  _

! s$ F2 b: C  ?" u, l  debug=${DEBUGGER:+"$DEBUGGER $command"};
" B9 @/ x4 r2 p9 W3 [! r7 B7 b' G5 Y- ~0 Q/ R9 W  n% ]
  # To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a7 o2 a) t9 c5 W  X- d( y9 j
  # so save-restore may work.
. Y: Y1 ^$ g" }' k; k/ Z  setarchStr=
" I3 B, y$ E  ^- s0 `/ b  cmd2run=`basename $command`* D1 u5 a; p( w( z. |, F+ X  }
  if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then3 u: w+ W9 W. i* n1 l/ f% F1 M
    if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then
/ r- m; }1 \& h7 B+ t      setarchStr="setarch i386 -R "# ^6 {, y' x6 |# M1 S; S4 [
    fi5 z3 l) T7 J+ o7 e
    if [ "$EPIC_ARCH" = "linux" ]; then# y1 Q( N7 }" i; G7 c, y
      setarchStr="setarch i386 -R "
, g4 y7 A% j) }3 Z0 n% c    fi
; P! k3 a/ j. s8 j3 v# U, X    if [ "$EPIC_ARCH" = "amd64" ]; then
  L9 Q$ w. s# ?9 x! w3 b1 [$ @      setarchStr="setarch i686 -R "
4 s6 L; s- n; V0 N3 D9 {' w    fi, Y- V. {& c4 v8 A
    if [ "$EPIC_ARCH" = "suse32" ]; then( r: }: k. V+ p7 A3 ~
      setarchStr="setarch_suse i386 -R "% \8 \2 _1 a: [7 z0 k3 p
    fi
- C: @& i+ E( u    if [ "$EPIC_ARCH" = "suse64" ]; then
" [( v5 P1 ]5 B2 u# g3 f# y3 D      setarchStr="setarch_suse i686 -R "$ D5 Z9 _' Q# u- M! R0 H% A
    fi) u( M9 D" \2 C) P
  fi
+ y/ ]) c, Y+ j, p, F$ o+ o. Q* k; P& i3 K; N7 L! {+ h: H
  ret_stat=07 ~# e+ H+ l$ E, s5 g
  if [ -x "$command" ]; then- @) h: P0 i( U1 u9 g
      if [ "$debug" ]; then
# t- L: x4 \  R5 Z; G2 v1 K  N% J        _debug_args_=$cmdline& T, _4 U' X) [6 E9 C' F
        . .epic-debug3 u: L6 E1 f$ N4 l0 B( ?8 |& N1 y, W
      else6 i/ T+ {2 G7 S, a5 |& t
        DEBUGGER=; export DEBUGGER
4 r- r  C' U! X/ ~        $setarchStr $command $cmdline2 n6 g7 C- H, v4 ]- A4 J% l
      fi2 c$ x9 [4 @3 b, |3 F- G) M
      ret_stat=$?
; z2 y8 P; O8 X; _  else8 k! w. [1 e( C# a  D; l: Z/ }/ r
    echo "Corrupt installation, executable \"$1\" not found!"  v* @# E. l8 c8 Y5 T5 Z
    ret_stat=1+ w/ v- \& F% I5 S' b" C; u
  fi
8 f) m- d# x2 \0 }& M" k}
  o8 ]8 I, M/ j* Z, n  Q1 Q0 }9 N+ U2 M; F# \
# keep runing cmd if ctrl file exist
& y2 C0 Y6 Y* o1 y7 e" n! J+ ^0 e$ D9 J  p
run_loop()
6 U  Z  D. ~- @. V2 i. o7 ~{
/ l0 x/ m# @9 W  command=$1
  Y; I% d# y2 ]  shift* h8 }3 w; T3 G0 \% V. @0 P

' a' F! T8 w5 l  if [ x"$VA_FILE" != x"" ] ; then
% s4 }$ e8 z0 Y5 W" t7 _5 _' J     cmdline=$ARGV
+ ]4 @  ^2 h" U  else
( U8 v( ?2 q% }' m     cmdline=$@% Z& D0 a  N7 W4 K! F3 U
  fi4 q7 u! O1 n5 Q' O; ^4 F
. N' S2 J* R0 i
  while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do; f) r' s$ Q! A: ]' W: d
    . $LOOP_CTRL_FILE$$
( L3 `/ l7 v* N8 G5 y    run_cmd $command $cmdline -banner 2+ j: s- D* Z$ k( c+ |- h
  done;
) l+ o. O, m$ ]. Z7 q( \. A2 v0 ^6 i8 z" {$ h+ Q# u
  if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then% X- h3 w, j1 _
    rm -f $LOOP_CTRL_FILE$$% q+ n, I) q* R7 R9 P
  fi
% K' S1 L- q1 b* w5 e( q}- F* X; B8 J2 ^+ Y" p  e6 H

: e& Q  A1 t# v  K) T9 _2 }6 h' [) Rhar_check_ret_stat()9 M! k% Q- D" q4 z4 ~
{; v7 H0 |, P' m( S6 x$ e5 H( O
  if [ $ret_stat -ne 0 ]; then % C; K! q. j! e) b* D: h$ G: d  D
    echo "Simulator returned with non-zero exit status. Stopping.") D$ V4 N5 C% O0 y0 \
    exit 1
, b6 l. J; v$ |  fi* M. }% [' Q; k, p0 _) s+ c; @2 b
}
* e) I) h* _3 c2 J
6 j9 f& y1 x+ |+ t+ q% |9 _#4 F0 d& E4 Z, B# K, H
# set stacksize and datasize limit. w( k0 w# j8 F8 k1 e
#
6 R( Z  Y  y' T( L1 R  x9 k$ [! Y3 C3 k, I  R5 _, ]( D
set_data_limit# v2 H+ _. d9 x' W( P1 K+ r3 B
set_stack_limit( r0 `7 X/ Q# {5 n! y6 i

6 `: ~, p# e4 i" v  p! s6 X#rm -f $LOOP_CTRL_FILE7 l9 w$ Q; I8 ?6 c# g
7 A7 n8 o. F# R3 s; z' c: ?. M
run_main()9 ^1 G& |1 e! h' R* E5 \' _
{
0 F  V5 M$ Z; E" q8 i) Oif [ $is_special_har_run -eq 1 ]; then
  T$ ?  F$ C- y8 g. z  if [ "$har_ofile_prefix" = "" ]; then# \( d# K0 E" d# E5 A0 J
    echo "Wrapper bug. Notify Synopsys technical support."
8 a9 {5 i$ {' e1 ^    exit 1- o" Q) n% W: |: r* G# Z3 m
  fi8 t* V5 e) V& m" v: A
  if [ "$har_hilo_file" = "" ]; then6 |5 y  c1 W  d1 a) r- H% K$ `
    # no user specified hi lo file - do both runs
/ o1 U# T  e8 j5 I$ d9 F+ d% o; w    run_cmd $command $CMDLINE -har_one -har_setup
5 S; f, T5 d6 `- i, F    if [ $ret_stat -ne 126 ]; then# C: F; Q# r  J  B! N$ c
      har_check_ret_stat
# \9 b6 l9 ~7 h' o, `      if [ -r $LOOP_CTRL_FILE$$ ]; then# {/ j5 F9 r2 Z1 ^: s$ r' P
        run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl
8 O* e; X, {0 P' A' ^        rm -f ${har_ofile_prefix}.hl
4 l7 K6 J' x& x      else
' M; ^/ _  u7 i        run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl3 I5 V, x* [' I% u. K+ z# x
      fi
, p6 ^1 {, O9 n- A7 r2 n5 v8 }- y: i    else
& S7 K- Z4 V! ^* T8 h2 g      ret_stat=0& P$ V; ^( X5 G0 O
    fi
1 _# O1 _$ k1 R* G% S& V  else
) S  o& `. k3 H! B/ @7 Z6 {/ C' y    # user gave a hi lo file name9 w) X- C/ [, W" t% [8 V# v: Q1 h* Y
    if [ -f $har_hilo_file -a -s $har_hilo_file ]; then
3 Q# o% ~  T5 k1 e4 b  R      # file exists - use it - only do sim run
6 j% z- I3 l$ M2 g1 g' H+ P6 S4 b7 ?      run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}
: y! `( z$ i( }& y$ t; H8 `- f      run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}
, H  P4 g5 I. a" u- x0 X9 p    else* d3 n' O( s, o% R2 T1 I( t
      # no such file - generate it - do both runs& O+ M8 F* I& L! k  {  f# {
      run_cmd $command $CMDLINE -har_one -har_fnf -har_setup
1 l6 {0 k2 y" L7 p      if [ $ret_stat -ne 126 ]; then
( x) C0 v1 _5 f8 ]3 J        har_check_ret_stat
0 ^; ^% e) r# j& _; \& u2 X6 u        if [ ! -f ${har_ofile_prefix}.hl ]; then
- d, O* D7 t5 h# ^1 D3 S9 M6 Y" C$ i          echo "No hi lo file generated after setup phase. "
; N, t8 p* w7 P) P" [- X- n, {4 }$ w          echo "Contact Synopsys technical support."
" x' u( Y/ L- [  C2 b/ W2 Y          exit 1) E4 u& z2 @, m% F( B# f
        else
9 c; l7 _  h1 @3 ~& `! Q3 |. R5 P          if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then, ]: H. y: F% W% `$ _
            mv ${har_ofile_prefix}.hl $har_hilo_file& ~. N, b* h, {1 y4 |
          fi7 H0 f* x% @( N  `9 H4 T1 I
        fi
" ^. m: u0 S5 o3 G* _3 D        if [ -r $LOOP_CTRL_FILE$$ ]; then
2 W! f* e6 f: g: u" w9 W8 O          run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file( J9 {6 [- y& m
        else
* |- s6 t! |  X' w7 T; k          run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file9 o( b% ?, q0 t. E
        fi
6 h6 _/ Y8 f2 Y3 R1 Q9 j      else
7 U! p" ^! ^! \) {2 B        ret_stat=0
9 R- i, X9 y1 p  T      fi2 S, M  {9 Z4 J( m
    fi5 N3 d( Y2 A; a5 e# ?9 M
  fi
4 D+ U* X/ Z9 H8 l1 [" ?else  
, q- A  K/ S& j: M# don't loop if -har_setup
  n6 }$ r: ?( Y  if [ $have_har_setup_flag -eq 1 ]; then5 o6 A# O8 c2 M' {6 A
    run_cmd $command $CMDLINE
, e5 Y: Q6 B, G2 G3 n    if [ -r $LOOP_CTRL_FILE$$ ]; then
0 U: D# }! k# s% ]. X3 b      rm -f $LOOP_CTRL_FILE$$( X" S- c" X" |2 w/ B
    fi$ s" B1 P: s9 t1 U, L  E# n
  else( E0 m: k7 `. B6 q) p
    run_cmd $command $CMDLINE
# N: P  o3 d5 x  S" q3 C7 @    run_loop $command $CMDLINE" e- i6 q3 h9 T$ ]6 Z
  fi
! G- @2 I5 {4 K2 K2 H% c9 ufi( C2 h5 i/ M2 R

: i( _, f3 s( d; F. H+ ^* t; B" iif [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then- h; L! R9 x  U7 I% s8 _
  pwCreateErrDB -w $workDir -e $errFile* t# S6 p5 O, N. E+ I
  ret_stat=$?
9 f! A; l" o  e* ]& {fi
! j' S. w, n6 f- n7 x. d}5 x6 P; W! Y6 Q" w$ x7 z

0 N, \8 K& d( ?7 x- acleanup_alter()
6 v7 B- I3 T' z- `8 h{
& X5 V# }* S+ G( D% K* w   /bin/rm -f $ALTER_COUNT_FILE 1>&22 P1 h$ z- j' B
   /bin/rm -f $ALTER_HK_FILE 1>&26 h% S. M0 A) t8 D' I! L# q
}
2 L5 i. A. A+ a' e  G8 z; H
$ V. ]4 U4 x7 }& o: w8 g, @$ d#generate alter temp files based on pid' m6 W% i9 v0 n" p# A
ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$- _$ g7 |" n+ S) p$ Q
if [ -f $ALTER_COUNT_FILE ]% i" ^2 h: ]" H5 A
then " g4 S0 [' }' f7 L6 [& O* y1 K
  until [ ! -f $ALTER_COUNT_FILE ]
/ `* X! t' |; Q" |+ c8 u# c9 [  do
' k& x! Y  y2 P" b% H    ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$$ s0 j, B* M! C3 k3 Y4 n
  done4 E3 L7 v/ d8 s
fi
* D; [$ t0 X  _: Oexport ALTER_COUNT_FILE  T' o* D4 X! i$ l. W. e

/ U8 w6 ^' R4 e- j6 e5 ?ALTER_HK_FILE="$ALTER_HK_FILE"$$& g9 i- ~+ N1 }4 ?8 H
if [ -f $ALTER_HK_FILE ]  u9 o. X* L* n* p' \2 m' W
then 3 v( z: H- @! z2 {6 u9 D- E, K! V
  until [ ! -f $ALTER_HK_FILE ]
3 M# I! q) r: Q+ _" G  do
" \$ G) s/ j# G    ALTER_HK_FILE="$ALTER_HK_FILE"$$
! V1 M/ H: G7 L$ q6 U6 d) p  done- q3 x9 @! f, T- l% J: `+ @
fi
) p! I" g  f+ l6 v, p# p( Iexport ALTER_HK_FILE
9 E( ^. r' h% ~% V* U# e
: q$ ~6 A7 K1 x; M#generate monte carlo related temp files based on pid
* i0 S: H5 s8 r, u% x: acleanup_monte()+ _: d5 I2 v/ Z( h9 C
{; B# V& J. r) A: `  [7 I6 S3 s8 E
   /bin/rm -f $MONTE_IMG_FILE 1>&25 b* c' q+ T& d$ i+ Q) f
   /bin/rm -f $MONTE_IMG_FILE.gz 1>&2
. D' e8 q- V+ u   /bin/rm -f $MONTE_COUNT_FILE 1>&2
# ?) E, `3 ~) C7 p2 H6 n   /bin/rm -f $MONTE_CFG_FILE 1>&2( G: E1 U/ I$ A& w& \" l1 X4 i
}7 L9 y- k8 \$ u( X1 }2 V# F8 H
' E" T& E  ]) [. }! m; d
MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
2 v( m! Z& e" X( k# Sif [ -f $MONTE_COUNT_FILE ]2 G/ b, v* v/ g* V
then4 P+ K% i' S' f' W
  until [ ! -f $MONTE_COUNT_FILE ]- D3 I% I7 G, q0 A; t8 L0 l! [
  do
' {7 t% b$ x4 G% e$ G    MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
( M" g/ Z* l8 N8 ~) @. {  done( K- M2 [, _' N; a& C8 n" R
fi
, Q# ?6 Y# A' U& [7 J0 Vexport MONTE_COUNT_FILE
/ q& O# m0 l! H3 g  p/ U& M( z5 x
MONTE_IMG_FILE="$MONTE_IMG_FILE"$$! @, M( b; T6 `
if [ -f $MONTE_IMG_FILE ]4 {" q' F9 b9 S) s
then9 a" l7 e' z0 I( e: }7 f
  until [ ! -f $MONTE_IMG_FILE ]
3 f' m3 Q( ~) ?8 z& }/ k$ w  do' z3 o( d1 |: e* G* G
    MONTE_IMG_FILE="$MONTE_IMG_FILE"$$3 a/ l" \7 q. Z
  done5 x9 O; P1 B$ T4 R( h" j/ Z9 n
fi
3 u' D) |3 o4 l& z, fexport MONTE_IMG_FILE0 t1 N% |3 r* t* a3 {2 c5 V
# k9 C! w8 P& x" y
MONTE_CFG_FILE="$MONTE_CFG_FILE"$$( v3 e, Q/ u) X, w
if [ -f $MONTE_CFG_FILE ]
: F, m4 X/ v% F9 t' q0 Cthen
3 N% F( R. k  v- B; q  until [ ! -f $MONTE_CFG_FILE ], \8 P5 @2 y% R6 m- i5 f# `5 t
  do
/ c" ~2 Q6 ?1 ~! V  ]    MONTE_CFG_FILE="$MONTE_CFG_FILE"$$- e: Q/ O* ^& e5 Q
  done) ]* z2 Y7 R+ D4 t% u" C- |, \3 s
fi
, m( I9 ?/ @: ?3 ~* x5 p& }$ q' V1 r
# main iteration
1 X& y$ T" a& T; S; Y* M& wrun_main8 O' q$ ^& Z' `8 u4 d

# j2 I5 x; n! Y/ H# i4 |if [ $ret_stat -ne 0 ] 6 s8 I  V& B+ `3 |. d' j% O! _
then - V. [4 u: m. q
  cleanup_alter
% W3 Q3 k* m0 O. S  m  cleanup_monte9 e/ |, @& q( e; x4 Z. @3 C
  Exit $ret_stat
8 E& _7 M: o9 v- c! k( l" gfi
6 z, O  W: V% `. o* f0 Q1 m# v
7 D5 l; T- M: X/ e" i3 ?#Alter related iterations4 |- p: k( p2 a
+ E+ k$ V& O* |
iterations=0
3 E  l$ `9 ^$ j7 ^  R$ vcount=0
3 o+ R# B# n  h8 L5 N6 x7 [if test -s "$ALTER_COUNT_FILE"
1 V7 f, _+ ]& Mthen
) D# i' n  {1 Y/ e; M& j  if [ -r $ALTER_COUNT_FILE ]; then
9 C7 z& c( e# K. W2 y2 I/ U8 U4 @   exec 7< $ALTER_COUNT_FILE& t- H( C4 [$ z$ ]0 m* M, k
   read iterations <&78 e2 B* k4 o3 U1 Z
fi5 x6 b4 M7 O( u4 @  u; _( _' y& f
fi/ ?$ }& X/ b" k3 t) n+ s
; J& C  Y, ~" J/ P- y
trap 'echo Program Interrupt; cleanup_alter; exit 1'  26 s! h3 t* v9 ^8 H) Q. b
while [ $count -lt $iterations ]/ z- v; [' y  J) d( ~
do! T5 c) @* X. A% m3 n5 s
count=`expr $count + 1`  N  D+ d. d, y0 H) `# S/ f- b8 i
ALTER_COUNT=$count
" x9 ~! ~9 k. | export ALTER_COUNT4 L3 M0 R$ s4 o* B
& V- T5 s: `- `2 y8 k
run_main8 m! y$ y: j8 ?0 }6 ^1 @

# S% V9 L% ^8 J, sdone
- {! \7 K' J8 p* b6 c3 K$ S5 {0 [3 J& {1 X3 w3 T# W& ]  j* z
#Monte carlo related iterations
" z; [9 A( K: U' ]  D
  {1 y( p' c4 o8 w/ Y3 ]) Z8 imonte_runtime_summary()6 ]6 G, h! H# l7 r
{
. A$ X( L. A% I  keyword_1=real& C, m# Q6 _+ G/ s+ J  `' d. D
  keyword_2=user2 `8 p* ?, P& {! O  o
  keyword_3=sys
7 h# H+ l5 h1 a, [. T- r% Z" u  ofile_prefix=nanosim
) G* m9 K2 J  B( L, p! R, z7 v" {5 w+ y# |' [
  if [ ! -z "$o_option" ]; then6 ^8 {# \* w- l  P
    logfile=${o_option}.log
* B; _! I0 p8 b) T1 v  else
/ l- C3 V' z# C! w    logfile=${ofile_prefix}.log+ l! F/ J$ t& `. W' L) x' d, m% q
  fi
5 k/ G! Z3 Y/ Y: ?0 \
1 h1 m2 t- {: n4 d/ d$ x4 C" Y. a  if [ -f $logfile ]; then
, y) _' f6 @* X# [! m  V    echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile      ' T! y4 O  o( Q1 c. V
    cat $logfile | grep ${keyword_1} | grep ${keyword_2} | grep ${keyword_3} | awk 'BEGIN{ t_real=0; t_user=0; t_sys=0; } NF==6 { t_real=t_real+$1; t_user=t_user+$3; t_sys=t_sys+$5 } END{ print "\t", t_real, $2, t_user, $4, t_sys, $6 }' >> $logfile0 {0 f$ Y# E& O3 m. a( ]
  fi. x3 s& ]& ]5 C7 z' h* d5 r
}) C7 y5 Z. ^8 ^1 B. q; v5 X* l3 g
7 w- c9 h4 j5 u' t
next_monte=0
& I9 H' U2 n( k' w" l! Q  pcur_monte=0
: ?, i# x* B4 v! H: u8 L- l0 Z5 d4 K5 v/ c6 e
if test -s "$MONTE_COUNT_FILE"
7 U" `2 a# {6 `) }+ G2 |then% u% p- n2 B1 N0 U+ s# |7 x
  if [ -r $MONTE_COUNT_FILE ]; then
. i, U6 ]* g. }0 K- X, m$ W   exec 8< $MONTE_COUNT_FILE
3 E# k" ?+ l) {& _7 _   read next_monte <&8" o# b3 o0 l% l
  fi
7 A4 r$ X6 D! ^) ifi) ^) W, K+ I" _4 F: }7 K9 Q$ M

4 \8 w$ o, G6 O+ o& S, x3 ytrap 'echo Program Interrupt; cleanup_monte; exit 1'  2) O5 e( J3 _( z. `8 t9 l
while [ $next_monte -gt 0 -a $next_monte != $cur_monte ]
' R- G7 y, t) }$ R) y8 Qdo) p4 l; P1 C1 H2 q; W: B/ Q9 U
  NS_CURRENT_MONTE_COUNT=$next_monte3 C- t6 f" g% Z) `# A
  export NS_CURRENT_MONTE_COUNT8 `: S# N! s; K, g2 A  j

8 j# Y2 E1 Q  _+ }0 k/ r  echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE
9 t& l/ s( }" r7 ]* W  CMDLINE="$CMDLINE -c $MONTE_CFG_FILE"5 o5 d/ {, ^. P
  run_main4 B6 \+ q* @8 r. o) s
) O" e/ L1 V+ W; B( F+ q
  cur_monte=$next_monte1 X5 g; l* w% P
  exec 8< $MONTE_COUNT_FILE
3 n2 D# {2 i& ^5 V  read next_monte <&8
4 b5 o* T% Q+ ~- U2 i7 Ndone
/ t, Q5 ]6 j, g/ Z/ U5 S  \( h: |6 E6 V& b
if [ -f $MONTE_COUNT_FILE ]- I1 R/ @4 {* K5 }+ e& C
then2 W& j% x3 S' k5 E  L* N( @7 X
  monte_runtime_summary
/ c# U7 C9 R$ A& W* m4 N- k9 sfi% ~. R& d& V# Z0 `8 E3 q/ |, \
; Z6 w, w" A8 F/ x& l* ?  P! ?0 @) `
cleanup_alter
- h, q# k% _$ N4 Gcleanup_monte
" s# Z8 x- T; k- c" c! n1 Y( E1 N0 Q( m% x9 q8 ^
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-15 07:16 PM , Processed in 0.134517 second(s), 15 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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