Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

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

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

[複製鏈接]
跳轉到指定樓層
1#
發表於 2012-5-6 13:58:13 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
10Chipcoin
各位大大好:  X& i1 t: R8 Y+ C; E
                      小弟執行nanosim時,卻無法跑出視窗來,有個錯誤可是我不清楚該如何解決?問題如下& Q, [- B' W6 ?, Q' l- D& [- ~/ A* z
                      [: 113: 64: unexpected operator6 j3 Y9 `. K. l
/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim: 1: Syntax error: Unterminated quoted string2 X6 m; T2 v1 o) ~- V
有大大遇過這方面的問題或是指導我方向去解決, 謝謝. 3 S8 f3 j0 @5 n! q
我在猜可能是這個檔案內的文字需要修改 但不知道該如何修改?, s: F9 o: Y# y6 \& M+ j! X3 D
以下為/opt/EDA/nanosim/cur/linux/ns/bin//scripts/nanosim 的檔案內容:
0 s: b4 Y6 ~6 W4 G* S7 C/ o    #!/bin/sh! h3 b( D5 P9 I. C
#
1 Y% D% o0 T7 k, M" Y# Copyright (C) 2001 Synopsys INC
6 B: r' s: b! G$ V5 m; s. A" e3 o# EPIC Dynamic Simulation Wrapper (DSW): h: ~3 u1 F# m& d" ~3 J' ?: Q
#
1 R8 w9 @8 C/ u2 k+ J" Reval ${DBG_EPIC_WRAPPER:+"set -x"}
# \. {/ X6 t  M4 i" a  o0 U# Q1 Q( [* N/ M  c
if [ "$EPIC_WRAPPER_DVLP" = "" ]; then2 N- z: z2 d* o& e4 r' C' O
    TEMP_ARCH="$SES_ARCH": u9 b2 ^; Q1 S% d& f! Y/ l7 }: d
else
) L, M; c! b  M  Y) G    TEMP_ARCH="$EPIC_ARCH"
: W. `( S+ f$ f9 U0 r, Z& b' Pfi
1 ~, {" ]6 x& k3 X$ ?4 M, c6 u3 Z- N
1 B7 P6 g7 q# l! ~0 w! C5 ]scan_for_hva_args()
2 K* e6 J& x( N& v+ s{9 x2 H  t: l  F' o: }4 r" q
  /bin/rm -f hva.init 1>&25 \" P' P, G7 q
  while [ $# -gt 0 ]; do& W8 c0 J% {1 r5 }& |
    case "$1" in
" z5 ]& A0 s  t" f5 T# l, o: n6 a      -vaf)- \/ s/ ^% {2 B7 i! ?5 P- S; I
           have_vaf_flag=1+ h6 ^( z5 Z* J" V; N
           have_va_flag=06 l0 O) L3 {( j2 d1 K) s$ V
           shift;/ Q( m3 H' O8 d$ X
           continue;
; J. O0 c& h5 d        ;;
2 G/ n; ]) f. h) T$ i* ^      -va)
3 ^! L( m' g- l' Q- R# v           have_va_flag=1$ f' J" W3 ?0 ]* y
           have_vaf_flag=0- S2 Q3 _6 s6 ^8 R8 x/ W, J
           shift;# Q8 @1 F  z' ?1 U+ _5 y/ |7 q
           continue;+ _2 s- s  m, _( E! z/ a% s; ~0 v
        ;;0 g/ c4 d* T9 I  d8 h& p  C9 ~- @
      -*)/ D3 u  r* S" d* m  s/ {0 z( r
           ARGV="$ARGV $1"8 A. s1 s+ o7 ]# Z+ v
           have_va_flag=0  x% z2 f6 u& _/ A! V
           have_vaf_flag=0
# s# Q) `, M3 i( \% U. u           shift;' c& [( p( Z9 O% D# [
           continue;; f+ [9 q" n2 }: O! H3 |
        ;;
3 C2 I- e4 t4 M% c9 V" Y) }      *)
$ `1 |) n- _* h. [4 D% [           if [ x"$have_va_flag" = x"1" ] ; then
5 g4 A4 I. v, V3 c6 q              VA_FILE="$VA_FILE $1"+ p# K1 Y+ C, N
           elif [ x"$have_vaf_flag" = x"1" ] ; then 1 v; g3 n+ I# I! Y
              X="`cat $1 | sed -e '/\;/d;`"
1 {2 ~) o1 \1 R3 a+ v8 z/ E2 n              for token in ${X}; do
: m7 Z, e. o( y, ~! u$ g8 ?                 VA_FILE="$VA_FILE $token"% N& Q6 D6 \3 p+ x
              done
' n1 r5 B# M0 |* f8 F( P           else* @& X: u. l- z$ O9 A8 h8 M, Q
              ARGV="$ARGV $1"
( m: c' j0 j# k" W/ \/ ]           fi6 u0 J. ~. T/ Q3 L: E5 B7 k' R
           shift;1 X% r; E% Y$ L+ f
        ;;! _+ _1 o& j7 f6 e2 ~
    esac
) h, ?$ E" }" F0 U5 L+ Y$ G/ V  done
" H% U" j) K& X* }/ }# K. e$ u  O4 y: f; b& @" ^% V; C, F
  if [ x"$VA_FILE" != x"" ] ; then
- m+ n: |$ `; q( k( ]##     /bin/echo " xxx ARGV $ARGV"
- K2 ?+ n' o- S- o  P6 l       /bin/echo "choose nanosim $ARGV ;" > hva.init# }* O: N* R& a. R3 l+ j& m
       echo vcs +ad=hva.init $VA_FILE -o simv
  L" X7 h% c. y, j& e: h% \3 K. v       vcs +ad=hva.init $VA_FILE -o simv& t2 p! o; a7 \) K
       exe_status=$?7 _3 w. G& W+ p/ ^  ^$ F( V* V+ V
       if [ $exe_status != 100 ]; then
3 V7 [% a1 o, i+ @" j( n          /bin/echo ""
" j! Q- Z6 i8 e3 G& S6 P$ v          /bin/echo "ERROR: Execution of vcs exited with code $exe_status"
) a( T8 c, {' @# b' }          /bin/echo ""
" D! d% O7 e! P) q' z5 C" w& b' m          exit $exe_status
& f  e0 c# }  O6 g/ O2 A       fi( z! H6 q0 a+ w. I+ o7 g( G
       hva_files="-n simv.daidir/amsVD.ntl simv.daidir/amsWRAP.spi"
+ b$ F+ {6 [: \; C       ARGV="$ARGV $hva_files"$ U, L+ B) n6 f' U$ v) f# o" j
  fi
& b! I) r5 ^% c7 l* n) V}# i  F7 R; H7 B+ [& U9 C" R
#-------------------------------------------------------------------------2 a& {: R5 C% Z* u2 P& H

' Z: ~; b5 F* V6 j7 P$ Wcleanup()
% g  Q; N( K% h- o{* I2 b( A, c  T# O- A) M
    if [ -d "$rundir" ]; then* O: M/ ^  C# I* Q
        # On AIX, a .nfsXXX file is created if libModel.o is removed4 v* Q5 R  U' x% p5 C* ^
        # so .epicrun is not removed because directory is not empty.% F; R5 E" i$ D  q
        # Solution is to remove it again if the first rm failed
4 w9 R; C* I, J3 z1 Z$ f. l, u+ U        # (rm -rf $rundir || rm -rf $rundir) 1> /dev/null 2>&1
( @0 o. v9 B0 V        if [ "$EXTRA_CAPACITY" = "YES" ]; then& c4 |% k+ g) y6 o5 d5 J
        chmod u+x $rundir/rpcidfile
9 Z+ n0 x8 ~' l: q: J: M        $rundir/rpcidfile
' V; E2 c# p  _& ^" J  L4 y* G7 c        rm $rundir/rpcidfile
5 K2 u8 `) f" y% D! G, ?; k: V# Z        fi! M7 _+ c. H, f% p  H; W
        rm -rf $rundir' U* S, x+ x2 i% `8 M6 E6 R! q

6 {3 `" t" e+ @! T* f( }1 c; M        #Due to NFS problem, we have to copy files needed to
/ z) R; U6 n9 y1 u: O7 ^! f7 c        #/tmp/<temporary directory>, then symlink's files
2 h7 N9 d4 X& e0 \2 R" Y- C3 m4 n/ U        #to the local temporary 'rundir'. This avoids the problem0 U( g1 p6 [3 ]1 m; i! p
        #to remove 'rundir'
, I6 G0 o" x* e/ p% L! e& {        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then9 c+ F( v+ {4 F1 e; o0 v
          if [ -d "$tdir" ]; then
* a! q: f7 x+ x' W( [8 s, ]            rm -rf $tdir
' T; ^4 ~" n7 x" S0 M+ ~          fi
" A- A$ T3 B2 z/ u& w5 v2 e        fi$ g- h* Q2 [& ^
    fi6 w2 u( q+ g" b& z% Y/ C
    if [ ${exitstatus:-0} -eq $ld_err_code ]; then& {! D5 `6 N2 `% u  }5 `: [
        [ "$has_model" = "YES" ] && rm -f $cwd/libModel$suffix
( `) K; Y; ]% Z8 J$ V% B        [ "$has_custom" = "YES" ] && rm -f $cwd/libCustom$suffix  [1 C$ d  J6 b& n( d- H5 o5 g
    fi
8 A/ a# }2 V4 @& C3 Z$ U    [ -f "$EPIC_SCRIPT_MESSAGES_FILE" ] && rm -f $EPIC_SCRIPT_MESSAGES_FILE 1>&2
  Y) y1 @) x8 u+ _# N, Z9 g8 J3 s    exit ${exitstatus:-0}" t0 c4 K: I2 l5 l0 G: A
}
7 Z* B; N. X6 C$ [
& B, v9 _! s$ D+ W: HExit()4 i) y" ]7 H) m" h2 ?( q
{: O, L' M% ?' Y0 D# J8 `6 d
    exitstatus=$1
" M& I0 B' @! {; T& Q* h3 [    exit $exitstatus9 I* g  \  u$ U# ~# J
}5 T' l, h# Y0 a/ @7 I: }8 g
4 s2 d9 R2 i5 r
# get_epicrc filename keyword( b9 K) J- S: I% M
get_epicrc()7 w9 |% ?) z3 |: t
{
1 r8 P/ n1 Y, T' i  B8 v, A    [ -f $1 ] || exit 0
# w5 p, e3 P6 \: ~- J    key="/^$cmd2:/{print \$3}"
. J% e: U( V0 D1 p    awk -F":" "$key" $1' R. a1 c: I+ X0 P; c! ~
}; p4 e3 d8 T1 S. L% Q! x- M

' W# ?3 b! h2 V1 y( b#
* W+ s: f1 D; Z4 t) X6 i# set datasize limit to hardlimit
9 L0 Q7 ]- T: e1 i#
* }% Z' y, ~0 T! u0 Y. R# Z$ X  @set_data_limit()* H& L& p  d; J& ~" m
{: G) I7 @1 L% G/ F; u4 F- x+ @
    dbglimit=0
: Q$ G& a" w, U    hardlimit=`ulimit -Hd`2 A" [& n7 X, ^: s' M
    softlimit=`ulimit -d`
8 O" r1 b4 f5 y2 j) u    desiredlimit=3500000
+ j2 M7 ]9 N! n) x. @    hardisunlimited=0
( |7 U: F* I: U+ E4 E    softisunlimited=0- m4 k" ?* W4 ^3 V
    is64=0
' E! Y" m' p3 k, n' W- m' i
; \: M& W; `$ ?; u( [    case "$EPIC_ARCH" in
$ z% [9 k  T/ W0 t: B! r- ~" Z    *SUN*64)! h  |( L. c# X8 _& n! q2 d
        is64=1. G- p: u& L: j' {- u+ E
        ;;3 T& O# h4 k) c( `
    amd64); Q# j2 b/ {5 g. [& {$ _& }
        is64=1
; ]/ W& T# b* M) M- e0 Z$ H        ;;/ [, f, w% j. o3 f8 X0 ~& X7 x
    x86sol64)- P2 U9 Y& l3 W2 w& ]
        is64=1
! U( E1 S6 v: u* B% l/ k: O        ;;  Z7 W3 T; ?% n8 f$ ~1 y  z8 z; r
    aix64)1 \2 i) `/ l( I) R( r7 A
        is64=1, N  Q. T: j6 d% W+ D
        ;;
! h9 D( ~+ I5 z' U6 \  [4 }: M    suse64)& I: D8 p7 `# l4 j, u! q
        is64=18 U' U. ~1 Q) g
        ;;) X5 p5 v2 J, c% ^
    esac7 r! u+ C* L( U5 B$ @! f# P
5 }7 ^% r8 m5 j  `4 j( K
    if [ $dbglimit -eq 1 ]; then
' F7 h8 Q; A4 t! a! d$ f        echo hard $hardlimit soft $softlimit" r1 H' F, F$ [1 W9 s/ D2 t
    fi  P. Q) m& ~4 J, l9 V+ P

1 r5 u: D* W  x" {2 K    if [ x$softlimit = "xunlimited" ]; then4 C* Y$ Y1 ~4 @
        softisunlimited=1
2 k8 ?% T0 R+ N9 i  E    fi( I9 q, ]0 C5 H6 N, f7 M9 x9 |3 O( v

+ Q) p2 e, [3 o& O    if [ x$hardlimit = "xunlimited" ]; then2 t6 T" c' V( k/ P, P6 n
        hardisunlimited=1
  N# _1 D1 e& D; W    fi
8 U0 }' j0 `* b( Y# X! }
( l* f7 h5 n4 l$ a    # 64 bit machine should have bigger than 4G, p& {. i$ S! b, A0 R3 N8 n
    if [ $is64 -eq 1 ]; then
1 a/ T; W; O% O" N$ z: ?- n+ s        desiredlimit=5000000
% W2 x3 o: h0 M8 E. v: ^- ^: J    fi
8 n- C& S8 R  X4 I
; Z! S- b! \) x" z) R7 Q    if [ $hardisunlimited -eq 0 ]; then
! d% \6 K4 c6 b& @& L1 f        if [ $hardlimit -lt $desiredlimit ]; then
4 c* P, w& e# h            echo "WARNING: datasize hard limit $hardlimit K is too small."
* \! |6 K1 c  o" M5 [6 P* u        fi
: D5 }& x- h) U4 O    fi. L  f7 x; C/ J! H% K7 B' t

7 R5 K7 \8 B$ b8 R6 j  I    if [ $hardlimit != $softlimit ]; then
& `2 g$ r* B8 O, g* f) a        ulimit -Sd $hardlimit
( `3 j6 D, A8 B5 |5 M- [#        echo "WARNING: datasize limit is set to `ulimit -Sd`"( M3 g3 ~) F& u. P9 Q8 A
    fi/ s. L. G; b* B( x

$ h3 Q$ J" P# k$ z9 D( a) K8 L! y    if [ $dbglimit -eq 1 ]; then
7 M, Q" `6 d3 C9 \6 E        echo datasize hard limit: `ulimit -Hd`7 j; @. a4 d$ Z
        echo datasize soft limit: `ulimit -d`
6 `  u. w  x/ ]6 `6 {0 u. I% V    fi* i; S6 M% s# W9 n1 w5 I/ m* [
}
$ L8 V* {9 y, H4 y
% J8 `" S2 i4 S/ I5 B3 ^#  p  S9 F4 _4 ]
# set stacksize limit to desired limit5 E) X" _3 @6 |# M& l: J% ~
#
- q7 f, b3 F% D; _set_stack_limit()
  |. A5 i. L! W# R! F4 \+ N{
+ [) o* [4 O, E/ H$ D5 v' Q4 h& o    dbglimit=0
5 x! S) \9 ~, I/ _    hardlimit=`ulimit -Hs`
! r+ ?% T! c* M6 @, Q    softlimit=`ulimit -s`4 P0 p7 N* K0 Y4 e
    desiredlimit=60000
% ~! f, p' [$ N; U7 ~; ]( R( n0 C    hardisunlimited=09 ?* O, Y- m, [$ C
    softisunlimited=0
& N( \8 I, ?0 T& u. T    is64=0! d5 _) a$ m7 d/ r+ }$ b. E5 T

( h% I' y5 z/ F    case "$EPIC_ARCH" in
7 m9 R; a7 a: m" R3 y+ }* ~    *SUN*64)
6 }3 B' ~& ^- r9 i. W        is64=1% ?. d1 T5 ?8 _) Q* [* h7 o" p
        ;;+ t" ^! z6 g8 C: V9 N) C! I, f
    amd64)" v+ r, U& g0 {9 t( f. g/ }
        is64=17 I6 x( a9 Y% ^1 _
        ;;+ g& J$ Q7 K1 z# |; v2 j5 U( ^; r
    x86sol64)4 E# r# r. B8 L8 y% L* m/ ^# D: v
        is64=1
+ ]( e8 z% l1 `9 `        ;;4 h  Q& e$ b7 ~- I
    aix64)
4 }" b+ @8 a) @8 L5 P$ L        is64=1, D5 [: Q" a- ~! A* e2 o; F/ [- s
        ;;- J4 @. W6 P$ \, x5 |5 w
    suse64)
6 O8 o9 j+ Q4 _, t( R% ^        is64=1
1 X# p0 v' S1 y% l$ Q( J        ;;
6 r1 Z) d. z0 ~( S8 u. w8 S4 b  c5 c    esac( }9 _4 Z" c- z
- Z' }/ ], X. l! ^& o+ n
if [ "$EPIC_WRAPPER_DVLP" = "" ]; then
( R9 _6 y# N$ I/ Y+ A! V% d    if [ $is64 -eq 1 ]; then3 H2 q# Y( ]" k
        desiredlimit=200000+ C1 [; j: J2 Y( j
    fi0 w7 n+ X0 r+ _  |8 N
else( G( i2 E0 F+ c5 W8 ?1 z1 C5 m
    case "$EPIC_ARCH" in
+ y9 \& W! d8 k3 _# c    *SUN*64)0 L8 ~6 N7 R. s6 Y% u
        desiredlimit=200000
% v; U# @9 E/ O' k0 C        ;;8 I( V, F0 D! X! n/ J
    esac
$ ?+ [3 J7 y9 i7 ufi
9 B+ ?/ S9 e) I# k! X       
% O" \- \* w) w5 m    if [ $dbglimit -eq 1 ]; then
) b2 v  ?8 G8 U. J* ~4 N        echo hard $hardlimit soft $softlimit
/ |+ r$ Y- ^1 w- Y5 q; Z    fi
* \" h8 e, m3 I6 V0 e5 |; b6 i5 _, k8 r! u  o' h; F
    #stacksize can not be unlimited, pick smaller number
4 I1 l+ J( S. r! Y
! I; A. _& n; E, E; K1 i; X    stacklimit=$desiredlimit" i$ R" N3 x/ e  y

6 A" \/ M: t+ ~# w    if [ x$hardlimit = "xunlimited" ]; then# M8 a1 P; I1 o) C3 {; W
        hardisunlimited=1
+ |" y4 M+ {0 D% \& ~" {    fi, I5 @% z) ?: ]( U% z
, L( a: _5 _, s3 _
    if [ x$softlimit = "xunlimited" ]; then. F; I; S1 @& [
        softisunlimited=1" f$ a" E  W3 M; e0 Q$ R  @
    fi7 b2 p, [* B% y. ^1 |
. c9 T. s& x4 b1 ]
    if [ $hardisunlimited -eq 0 ]; then
! V) J3 d6 J2 }3 M' I/ X$ m8 p) [        if [ $hardlimit -lt $desiredlimit ]; then
8 ]2 y) ^+ [9 ~            echo "WARNING: stacksize hard limit $hardlimit K is too small."& A. U$ R1 i5 q' `" v
            desiredlimit=$hardlimit9 V7 L' N: @' D: ?7 ^' v
            stacklimit=$desiredlimit, C; I$ A8 j% ^* }% `6 o" M; ~  k4 n
        fi
# B5 |  n4 p: |5 `- ]    fi
9 v+ ]/ l5 C, a5 L1 q" j5 X; z
3 r2 v3 }9 f: q  H  E& @) z0 M3 ~    # desiredlimit is set to proper value (< hardlimit)1 K# P6 w& U: _' L; f

- w2 y9 l6 k8 v; _) }3 B+ g( `' Q    if [ $softisunlimited -eq 0 ]; then1 v$ G' k* V' K1 F! y
        if [ $softlimit -gt $desiredlimit ]; then3 X$ ~+ h( `9 `$ b3 d& `2 o
            stacklimit=$softlimit
# T/ B7 R: a$ Q* M& J8 l  L        fi$ ?3 Y0 b( J6 }3 N3 N
    fi& _# d1 ?2 n! G6 D

0 y" J6 U& |8 K6 b    if [ $softlimit != $stacklimit ]; then
! h% g4 d7 q, I. }( B        ulimit -Ss $stacklimit# @# h) q7 J" e+ w8 v
#        echo "WARNING: stacksize limit is set to `ulimit -Ss`"+ m3 F2 u  h  j# h
    fi
" ], I' c' M7 t9 j6 ^7 N8 x
1 F  z  I4 L/ l! V    if [ $dbglimit -eq 1 ]; then9 P& i7 e/ r  Y$ y; {. y
        echo stacksize hard limit: `ulimit -Hs`
; K1 }/ ?, B4 }9 x        echo stackize soft limit: `ulimit -s`0 Z. b2 ]3 P; w9 S, R' B
    fi+ _0 X6 E* U' e. P1 G, p9 Q
}
, U5 M" b4 v* C4 Y6 m" I6 Z6 X9 B" Z. {: n# D. E2 _7 a3 \4 I/ E
open_epicscriptmessages()
0 X: U/ l% o3 s{
! X# K2 C& b' f/ h1 U1 X#generate  temp ".epicscriptmessages" file based on pid! |& o& {* `5 G+ K0 C; I  L7 n
EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$
2 t3 m& Q  p% K  pif [ -f $EPIC_SCRIPT_MESSAGES_FILE ]
6 _" o! }- i! Z0 W! Z& fthen
3 P( V! d8 i" n, L  until [ ! -f $EPIC_SCRIPT_MESSAGES_FILE ]. t6 V) k; t/ q
  do" t  G. l7 \' n- h; m
    EPIC_SCRIPT_MESSAGES_FILE="$EPIC_SCRIPT_MESSAGES_FILE"$$# h! z5 k) N3 g, y" }
  done5 L- Y6 _* B5 d$ O  y( ]' ~. u
fi
% h& t9 R+ W( }# |% w! Y& v1 i
, S; G  T5 e' s5 v- ~' B* ~export EPIC_SCRIPT_MESSAGES_FILE& o% v' R1 Y5 m/ n
}
7 G% ^6 b* g7 c& Q
: Q/ {+ ^7 [" v2 E/ [
7 U5 g' v- d9 w* Icmdname=`basename $0`6 O! [( D9 `7 H' S. N* Q
postgres="n"
' z" K. `, C6 s" Z, t1 Hostore="n"
1 R* s% M2 ^8 L' bgui="n"
( u8 H7 v5 G2 i1 L0 kdatabaseOn="n", b6 O1 O$ a9 Q6 ?
f_next=0
3 h# c- f4 V2 b" w, }9 Gf_option=""9 P3 I! A! n% [9 B
o_next=04 \# d; g8 C2 U4 H
o_option=""
  ~  o% k8 g( {. JworkDir=""
/ f) i$ N; |0 C3 n8 k: |. mworkDir_next=0
" q, F: U# _1 O# E# l4 ?4 qerrFile="powrmill.err"' I: b* n3 @) q& ]
win32flags=""
* Z) z  d2 n+ z( k5 pln_default="ln -s"  T" R' M% N+ e% [

1 f: O& B; ~& [3 }) V/ Ehar_hilo_file=""
3 y" H' t7 r5 w7 }- y6 ]have_har_flag=0
' U7 [8 B( N) g4 d' G5 i2 d& `have_har_setup_flag=0
* j4 |2 H9 t( k& zis_special_har_run=0
* P5 z% U3 x; M: vhar_ofile_prefix=""
  M: z: l0 j- S( _* z& p6 X$ B/ D1 l6 L, L1 W/ t
have_va_flag=0; U8 v! c$ f( R
have_vaf_flag=0
' z  V. p1 U1 L4 T4 OVAF_FILE="", ~) N. }  E  a* f
VA_FILE=""
! ]" W; w0 d  T3 tARGV=""
, i6 Q( h7 h" f
# q' x) Z& k/ u. s1 v% @ORIGINAL_COMMAND_LINE=
5 l! f2 O' b/ p. lLOOP_CTRL_FILE=".ns_ba_env"/ X  \! F" \7 `, S% _. o
ALTER_HK_FILE=".alter_hkf"$ t" N; N+ G+ q- b
ALTER_COUNT_FILE=".alter_count"
) x& }8 d7 a+ B  l& fMONTE_IMG_FILE=".monte_img_f"1 k% e) C" O  K
MONTE_COUNT_FILE=".monte_count"/ [6 w) n" E& X7 G
MONTE_CFG_FILE=".monte_cfg"7 v8 A; n  G( _0 t2 J* I
EPIC_SCRIPT_MESSAGES_FILE=".epicscriptmessages"
/ n$ b9 n6 \: b- j7 m3 E, C: d3 j" O- z" u5 g
open_epicscriptmessages $@! B, J$ G: h. q4 R) \5 \4 B: p
1 Z+ }; ~% b) C- s, U* v
scan_for_hva_args $@( V1 d, i8 G' o2 S( p
: K, z0 \: f; ], m3 ~( J
scan_for_har_args()
- }& d" R1 K. f{, A9 b: H4 J1 b& ^/ z+ T4 `
  while [ $# -gt 0 ]; do
' |; l: M) U/ K/ @, q    case "$1" in
0 ]; K: r8 g+ S# Z- v$ p      -har)
% n8 e) Z* W( A$ A9 l) R) j* X           have_har_flag=14 G* C5 m' P+ u- i$ S, X- Y5 A1 _
           [ $# -gt 0 ] && shift# C3 k9 D- U# Z7 ]5 F
           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then
4 ]1 T+ h0 B( D4 [8 p) k             har_hilo_file=$1
: l/ ^/ N, ]) j# @8 w1 p             shift, ?( D, o( r, C7 O/ i. u" C, t- V/ j
           fi7 X6 p' X% N' @
           if [ $# -gt 0 -a `expr "$1" : '-.*'` -eq 0 ]; then" _3 E1 S. f4 e: q5 ]( J+ D
             echo "Too many arguments to -har flag. Only one hilo file allowed."$ e% p6 Q7 Y5 @2 w  g
             exit 10 U- s/ R& Z& L  c2 I) A0 _  p4 I  D
           fi) l4 [! u# r- f, M5 _
           break- v" g, L" t' ?( c7 d
        ;;2 I$ ^0 s, |1 X- c- D8 V) d
      -har_setup)
& i# M1 ^& f& r) I9 H7 j5 `( s, u) y4 [           have_har_setup_flag=1
0 R1 h5 c) L" l8 m* l9 K/ ?           break
# e2 k( G! U9 w        ;;
8 h# p& Q/ @- V7 H      *)
+ c# g' [& W+ U* X7 \8 b" k1 V1 X        shift
. o, ^6 d$ `( [" [4 l: J        ;;- q: @/ L: D1 [, w! [, s
    esac& X1 z. J6 C! h0 W% a* [: A
  done
6 Z7 K2 H6 |8 O0 Q( l  L}" Z' J2 f$ b& r( ?

& C! R$ q, n8 X" i4 ?0 P  Wscan_for_har_args $@
# X1 p5 ]) D1 ]  ^5 e, I
% I, N4 p. _7 N1 Afor argv in $@
9 P5 `* B! I& P$ J+ jdo$ b5 c2 i/ ]# C5 |" v! W
   ORIGINAL_COMMAND_LINE="$ORIGINAL_COMMAND_LINE $argv"
0 ~( @- m: P# c% x    if [ $argv = "-gadb" ]; then
2 ?$ ?1 B/ o' S) Q! H$ G' R/ P8 n        databaseOn="y"
# K# R* S& N0 l) H, ^* ]0 }        workDir_next=1
$ B- y! \. o/ i! y. x5 o& y2 U* |* {1 h    elif [ $workDir_next -eq 1 ]; then
) x- j$ N# W& U  s8 s9 z" j        workDir=$argv0 o; K! W5 J( D9 G* r. v
        workDir_next=0/ E' M% G3 E7 d3 F7 a+ W$ m' B) t
    elif [ $argv = "-ga" ]; then
. {$ M% d9 m  u3 k        gui="y"0 W1 d7 g5 `* E5 \
    elif [ $argv = "-f" ]; then  y( ^' W( ~  {, q
        f_next=1
4 v$ h$ W2 u3 r+ b9 r    elif [ $f_next -eq 1 ]; then
' o. q5 f. L& Y" @. d8 a# N' o$ t        f_option=$argv
1 }# b& O0 S6 t2 [8 A" X        f_next=0
3 S' k9 h7 d: [& v6 O. V, K" t$ S    elif [ $argv = "-o" ]; then
3 v1 W) {, T5 i7 u3 y1 W        o_next=1
2 |  }5 m6 I* @) L$ ], B    elif [ $o_next -eq 1 ]; then0 r: @3 N0 Z' a9 w0 q+ n" q$ `
        o_option=$argv
, B& y6 Z0 n* x* Y        o_next=0+ N; l) [- @- b) Y
    fi
8 ]. D* H" A( n; `0 V! Cdone' p  G. F4 g' w& ^( U8 D/ ?
echo "Command line options: $ORIGINAL_COMMAND_LINE" >  $EPIC_SCRIPT_MESSAGES_FILE 6 q  _/ B/ ^) p8 t$ O5 W6 L

9 r: ~: L0 I7 g7 c. [if [ $databaseOn = "y" -o $gui = "y" ]; then1 F# }+ K& G3 z" o& F3 w
  if [ $cmdname = "pathmill" ]; then
6 s2 F* m& L" o9 ^. K( L    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5"  -o "$EPIC_ARCH" = "SUN4_SUNOS_5_64" ]; then
  F$ r) k; n% f( s$ o         ostore="y"
; L6 y2 Z4 |3 \! M         postgres="n"
4 S2 p+ M0 m3 j, N7 H# y" A1 V     else8 f  {/ @% H2 O  K4 G; J
        echo "athmill GUI is supported on Solaris platforms only" 1>&2 " y  x9 Z1 T; s5 V5 d4 D
        exit
, D+ |% D2 k8 C     fi& z8 S! V+ i6 p& b4 U
  else
4 E9 ?& A3 m: o6 u$ N    postgres="y"' L# h0 q/ [) X# W" {# y
         ostore="n"4 {; k" p1 I. M- a- H
  fi. v) {$ Q7 y/ T* `; l  n+ e! Z: `' {
fi5 u/ P3 H( T6 q9 H) n' w: K' g

" |& _% ?) w# F4 o8 M0 z+ g/ Uif [ $gui = "y" ]; then" k! i2 q4 u. \9 s2 x, \
    if [ $cmdname = "powrmill" ]; then) g9 S3 ~! Q6 |2 a6 |9 J+ P
        pwga $@
) [- c3 |( J9 q4 [7 K        exit
/ k0 h1 e! s. P, e, Y& ^    fi
4 o4 v- c" z' ]2 H2 C, q+ [
% c$ p/ s& D, G; z5 D) l3 D& }    if [ $cmdname = "pathmill" ]; then
! G& L. X, _. v9 O0 F- r        if [ $ostore = "y" ]; then
! |8 m( {6 a9 g2 L' v           ./pathfinder $@% Q4 ~' P; d0 E+ G! F
           exit7 ~/ T! v6 |  n' Q# K' j
        elif [ $postgres = "y" ]; then
7 |0 u$ z3 q: D- t: a/ n3 X3 `           pmga $@( p% \; [7 n% {
           exit1 m  v; _  u+ s2 ]1 c6 n
        fi8 M% E' k" T5 D! W, O% Z1 c) l+ ~
    fi
% C4 o1 [* }/ {7 J: S1 M0 n6 mfi
/ P4 t4 F5 u# I1 `
' u5 S9 N. _( u9 u# \& A7 eif [ $databaseOn = "y" ]; then
: Q6 H5 Y' B" o- g. Z   if [ $ostore = "y" ]; then
( k3 Y* t2 I0 n) h- f2 @$ S* Z! l      if [ -z "$workDir" ]; then
" k9 @$ M3 X+ y% E$ q         echo "Error: Missing argument for -gadb option"
/ Y6 n3 n$ T7 f7 e% c, y         Exit 1
6 a1 C+ v% X0 u( a4 t      fi
6 \# ]: j# P' `! D   fi/ N) u+ r& @$ G
   if [ $postgres = "y" ]; then
9 a% r0 R! m; p, @' h* u. z      if [ -z "$workDir" ]; then
0 ]: b3 J8 ~- q# M& ]         echo "Error: Missing argument for -gadb option"+ N. E9 r( i3 _/ }# v7 M
         Exit 10 {- G- c$ S, K; O* G0 f
      fi
# p& X7 J2 y4 j" K. ]   fi
* l1 Y0 b: ~$ m5 j4 F3 k: D4 r' pfi
# N* c$ L* @/ x/ }5 M5 i( p* O" `  X' o/ E$ {
if [ $postgres = "y" ]; then4 L: ?  n4 ?7 W7 \+ d8 f7 a
+ |. M( p8 S# _1 _7 _
    if [ -r $EPIC_BIN/scripts/gui-init ]; then( W/ D: A. z9 r# w
        . $EPIC_BIN/scripts/gui-init% M9 E/ u1 J; [. b( w1 l% x
    elif [ -r $SES_ROOT/bin/scripts/gui-init ]; then- {# m3 V$ O; A! H
        . $SES_ROOT/bin/scripts/gui-init( X2 Z* n& l& f9 a9 @
    else
- m8 R) l  e' |* j- W1 }  f0 Q        echo " ** Installation in \"$EPIC_HOME\" has been corrupted!" 1>&2
  x1 L8 L2 z: W9 c. p+ T        echo " file bin/scripts/gui-init is missing." 1>&22 h* H! g7 @& N. `4 ~1 j
    fi: H+ H. ?6 Y; t9 ?8 v

" W2 y" v( B( I, }; r- f    workfile -tool $cmdname $@
9 z; S! h2 z7 E; Ufi7 u1 x& ~! E: u% ^3 J, t: C# I
  x1 ]0 ]: a4 \- N+ w4 b- t6 k
if [ ! -z "$o_option" ]; then
8 c0 o; L* E7 W5 q, L9 u    errFile=${o_option}.err3 A9 Q% o6 C6 G) P' H9 M1 h
elif [ ! -z "$f_option" ]; then
0 E# }" s: b6 \" |: H/ D    if [ -d $f_option ]; then
* o) j' n& ]& @2 Q) k: N        errFile=${f_option}/powrmill.err
% S: v& x3 I; Q    else errFile=${f_option}.err6 }; I5 E- k* f* `6 `4 w' o8 [
    fi
' a4 |8 `3 d* [1 C# @fi
( _/ J, L' w3 q7 y1 @' f2 e" ?7 M% ], r0 n7 m

' S7 c) m! F5 }  }7 Kif [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
( f& c- {( A, [2 j. o/ z$ Z  rundir=.epicrun
# R. B; q5 N6 pelse8 ?  [: \# G: z, X( T6 p2 x/ W/ J
  rundir=.epicrun$$( ]+ r7 ?8 B' T" s0 \5 S+ I
fi
0 T* k, C2 E" k# k3 i! K" Q( l  G# |( `2 T' \8 M" ~- J+ c
libpath="$rundir${EPIC_DLIM}$EPIC_DIR"6 q( D* I4 e  d

- A- M# n/ U4 `7 I% [" zcwd=`pwd -P`' ~. T1 E9 Z8 K1 W8 A
if [ $cmdname = "acehdl_w" ]; then
! Y8 S( a9 n/ U: ~  cmd=`basename $0 .sun`
( _! t. M, x; S' G- O  cmd=`basename $cmd _w`6 b9 s) g1 q( _- f1 S. f
else
4 T, a% q4 C/ r8 l9 M8 x  cmd=`basename $0 .sun`
+ g- u8 Z7 {( w1 efi4 m+ |4 B4 v, m$ J
1 y7 M* a; E# I3 @6 H; O
command="$EPIC_EXEC/$cmd$EPIC_EXEX"& \0 _  h  B" F. P8 K' `: h
[ ! -x "$command" ] && echo "$cmd: not installed!" 1>&2 && exit 1
( `/ n5 I9 K/ _0 _0 B  E! U; i# e7 x) g3 x
# buildmod extracts -u/-fm options and calls genepiclib
- @# w5 |# b( q  Y# L) K. N6 t) {: B# It also set the remaining options to variable CMDLINE( d7 f, i  z- r4 q! P! t& r
# look up in .epicrc for -fm & -FM parameters8 c( }& ^1 G+ o$ k

* h, m, n$ e( `" N4 pfmlist1="`get_epicrc ./.epicrc user_adfm_obj_modules`"
# |2 g* _6 {; O. n5 j8 n[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules`"
* o, s- d" k5 t8 r( H; `  o) p[ "$fmlist1" = "" ] && fmlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules`"$ I2 _, j# b3 |+ Z7 s% S' g' J

6 j  N" P* U7 _* ^3 F" p$ W; dFMlist1="`get_epicrc ./.epicrc user_adfm_obj_modules_force`"" d: F. r  p3 ^4 S$ H
[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $HOME/.epicrc user_adfm_obj_modules_force`"/ A& c, e! u8 \$ G
[ "$FMlist1" = "" ] && FMlist1="`get_epicrc $EPIC_DIR/.epicrc user_adfm_obj_modules_force`"* X. l; O- Z8 I8 C; x

  C: y! X8 p) g, ^5 |if [ $# -gt 0 -o "$FMlist1" != "" -o "$fmlist1" != "" ]; then
0 V( v7 i% J8 Z' ]; j+ K5 Y3 g    # note that the buildmod script will set the CMDLINE variable2 N7 O! d0 F" L4 B) [# i
    . $EPIC_BIN/scripts/buildmod
# Y- Y! H4 c2 w% L  d7 @' Z0 h4 d7 V  Y# F- d
    #echo "This is the value of cmdline=$CMDLINE"
7 f+ u2 f6 t) Y/ m5 ~! A    #exit 08 c3 h# n, v  K( K( A3 Q) P
7 u" L2 G/ Z" o! z1 B( Z5 U& Y- Z
    # if a new timemill/powrmill/pathmill built, run the new one, O, [8 F3 r; f% L; \' K  j/ o
    [ -x "$rundir/$cmd$EPIC_EXEX" ] && command="$rundir/$cmd$EPIC_EXEX"
5 ]+ H; ]; j  ]! ^9 C3 Y5 ifi3 q1 g- v3 O9 f. `
3 V! u& @! U0 ?: a6 _7 u9 P
if [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" ]; then3 A/ O, x8 z& q: T% L8 H5 J( j( l7 y
  if [ $have_har_flag -eq 1 ]; then
! S' n& h! g4 u( T+ {' Q    is_special_har_run=1. D& L+ N/ d$ y! f3 d& q8 W' p
    if [ "$o_option" = "" ]; then8 h& k6 |0 W: Z# U; k+ m* Y
      case $cmd in2 a1 V+ t& C; l- e$ N/ p  H
        timemill)5 c5 v7 G+ {( h3 L
          har_ofile_prefix=timemill
, s9 k5 B7 B+ N2 U$ `6 m          ;;$ }: [7 S' ?! u1 G
        powrmill)
3 `5 w# M# ^! _3 H! e. J  G          har_ofile_prefix=powrmill: m8 l4 l/ E4 T) Y* i/ C* B
          ;;
5 K1 s; M; f% b        nanosim)
( E% V4 Z) G  @/ @          har_ofile_prefix=nanosim
  _# Z* a& O& ~- s6 A8 c          ;;
4 O: r7 v% f- O# u! r) a      esac
- p5 {, K+ i! _( _- a/ f# ^    else7 A8 m% h6 h: E4 N
      har_ofile_prefix=$o_option$ Q7 D/ ]1 Q- Z5 X
    fi
# l" Z) ~' P$ r2 }" K1 L  O fi0 E1 d; t  E0 A+ _5 x9 n
fi
2 w7 F' E1 {& l8 Q. i$ `( \: ?6 w
+ u* `6 x3 c" C* F3 X' t8 i# Call Double precision version of the product if -D3 x( u: [# X$ X  P
# or simulation time > 1,000,000 ns.
* z  @' P) \3 V, Iif [ "$cmd" = "timemill" -o "$cmd" = "powrmill" -o "$cmd" = "nanosim" -o "$cmd" = "railmill" -o "$cmd" = "pwarc" ]; then- E9 f! L1 ^  ?; w/ R5 m# [* H

. ^9 n/ A7 Y, P* \5 G, B  # Now the binary always has the ACE feature8 y% t4 T! T" J5 |( O
  USE_ACE=YES
: G; P& C, g+ y( e: I* t% @
# }8 W, B: S" U2 j  HAVE_DP=NO! P( ^# p9 N4 s* \+ D2 w% X: y2 {
  EXTRA_CAPACITY=NO
% n! }) b; G9 k' t+ i  DB_REAL=${FORCE_DB_REAL:-"0"}8 D0 q  u, }1 @3 l- d/ M/ d

7 s! }$ y' L0 Q3 j. G  # Enhance for ACE ease of use7 i4 ]7 R5 v2 T& n. J) }; R
  # If no command line option or only a -T option, do:, G! m7 l3 T0 n4 P6 D. `  v
  #   1. set -A option- b- ~5 Y% z7 [3 x
  #   2. assume input file to be hspice# N# x9 h* N; O( @7 Q; ]5 g+ o
  #   3. set -o to input file prefix( M' O; f; g0 J) w0 v
  #   4. set -z to input file prefix6 N4 G( K4 N2 e5 V; ]1 T" J
  #   5. set -c to default config file
$ j' K7 E2 I  ]- J1 F4 b  netlist=""! h/ Q' _9 \1 g% Y
  minusT=NO
8 Y' ]& R, K! N% o7 y  useStdCmdOpt=0
, l3 Q" W  {# L; v4 i  prefix=""
4 Q/ Y$ P) {5 e+ @  circuitType=""
3 q& X3 B! k5 [  for opt in $CMDLINE) F: S2 P5 n- h$ y+ w3 q" P; W7 m. c
  do* c+ s, _4 j, U! u+ P
    case "$opt" in
2 q  `. N; k/ ^: F1 m  P1 |      -T)
5 u$ A& {& ~% `/ T" a        minusT=YES& ?& t3 b' n6 E% h* h6 z6 v
        ;;( f) T, I( `0 N- P9 H
      -*)
3 m3 c8 C! k# o  r& _0 f# t) L        # using standard powrmill command line
( K3 D1 G$ Q. x8 y        useStdCmdOpt=1% y* s' Z( r% j& m( Z% ]+ ?' m
        break# O# n% J$ u: O" J  r% `
        ;;
& [: x8 r# P( f( d9 Y      *)
$ b2 J9 {; s: \0 A0 G: S1 m! l       if [ "$minusT" = "YES" ]; then2 C9 T. [" E- p$ Z& H; o
         circuitType=$opt
0 z6 T$ Z* e0 {' G7 v& ^         minusT=NO  # reset flag
6 a+ r& D/ Z" s- ~/ j( y       else . D" J& @1 t1 l0 i
         if [ "$netlist" = "" ]; then
3 m  W+ ?- \( ~/ T9 J: F- y2 |           prefix=`basename $opt`
. e8 a- y4 z$ y           prefix=`expr $prefix : '\([^.]*\)\..*' \| $prefix`9 Y' C+ G. q2 i4 c: _& j
         fi; f: ^2 k( a" t# }# f) n# Y
         netlist="$netlist $opt"
! N( X6 G2 d  }, b+ j       fi
; ^  K# \8 G+ ~. @; U       ;;/ Z) |% S8 b' }7 k/ e3 N
    esac# L" W% Z/ C# K$ i# w+ I9 h) F
  done6 J6 J3 c' o4 T, R1 _
0 H+ W$ O3 w8 _" \" o' k& p, ~
8 v! P% Y! L$ E! X3 U/ H2 ]" @
  if [ $useStdCmdOpt -eq 1 ]; then
5 e' x+ P1 g! V; n2 `4 j- T! l    # use standard powrmill/timemill command option
$ T% k4 f+ z" m2 L5 A% ]    for opt in $CMDLINE
, \0 L5 f! \' j; M, ?$ c; M    do
' M$ a3 p" C% I9 i3 y8 S      case "$opt" in
( M6 t: {5 `( c/ }        -A)/ |7 S  n2 r! Q9 V2 F/ o
            DB_REAL=1# A0 U& _  l$ G9 d
            ;;% b+ O. s# d" n  d
      esac
. P* s3 X: k: `: |9 s+ l4 B, K8 t    done; F$ {9 w% Q4 t# E+ ?; T, r- s7 b+ i
    if [ "$netlist" != "" ]; then
" d/ S7 C* A' B      CMDLINE="-nspice $CMDLINE"0 K/ e" I. V3 @$ |
    fi" x1 ], F' G0 b' v' e6 T2 P/ u6 B+ H
  else' S4 |9 E2 m4 I
    if [ "$netlist" != "" ]; then
! [' h2 G4 H- [( H  h      EPIC_DEFAULT_CFG_DIR=${EPIC_DEFAULT_CFG_DIR:-"$EPIC_AUXX/etc/$cmd"}7 d4 [; l* _! i+ \5 C) P6 ~! O  D
      # construct new command option
) o* F0 x) _0 [# m; b      if [ -f $cmd.ini  -a  "$circuitType" = "" ]; then
0 }3 T3 a6 k( C& l        CMDLINE="-nspice $cmd.ini $netlist": i* ?- S; t; Q1 E( _
      else
. G8 t1 F; s( u$ h        if [ "$circuitType" = "" ]; then* b4 I- W5 x' A- k
          circuitType="msana"5 w" Z/ {" f* Y4 C
        fi
2 D( S& j5 A) }0 r  G        CMDLINE="-nspice $netlist -c $EPIC_DEFAULT_CFG_DIR/$circuitType.cfg"
1 E/ n0 t: t& C7 `4 B      fi+ l3 N" `& i- I* e, {
      CMDLINE="$CMDLINE -A -o $prefix"
* ~. f( ]3 f. o7 {' b0 o  F      DB_REAL=1
4 e* ]0 g; U0 ^+ W  A      echo $cmd $CMDLINE
5 c3 R' ^* ^; P% B) q    fi
: @7 `0 Z$ `6 w" \0 q* A  X0 _4 T  fi
$ L6 }  L  `7 ?2 {. m' F& }" [8 o; xfi # cmd is timemill or powrmill or nanosim or railmill or pwarc& x2 A0 a: ~" d! Y9 ~
5 W  n$ `: V4 z( R
[ "$HAVE_DP" = "YES" ] && [ -x "${command}_a" ] && command=$command"_a"0 t( \% z9 t' Q1 Q0 }# _' Q* w) L
[ "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a" ] && command=$command"_a"
8 z% c. S# _6 k6 Q[ "$USE_ACE" = "YES" -a "$vlog_design" != "" -a -x "${command}_v" ] && command=$command"_v"
6 u5 ~6 A& ?% J7 N+ m6 E; L9 V6 R, J' i
if [ "$__engine_wrapper_called__" != "Indeed" ]; then! v5 D$ W# N; Y
    __engine_wrapper_called__=Indeed
- i' n6 ]! P1 `- [    if [ "$cmd" != "amps" ]; then
% g: D2 v5 A% p( Q9 k7 j7 X+ J" j        export __engine_wrapper_called__% F* }9 {3 M' B8 O; X2 g6 D: K
    fi/ E6 B: F3 C$ m) ?6 ^! L1 f7 O( P- C

, T$ L7 t% J/ q/ B$ k    trap "cleanup" 00 _" J5 g( Z) F8 k  o
    trap "" 22 \: R3 k6 @- h5 F8 z

! t" C  _3 X$ q. Q    [ -d "$rundir" ] && rm -fr $rundir5 j' J  o7 J: J. g, Y
    [ -d "$rundir" ] || mkdir $rundir
3 j# o2 G* h' ?1 f2 q5 S/ E1 h$ L7 I  r0 W& \
    case "$EPIC_ARCH" in9 s* D7 H! f* O
    *SUN*64)   
3 n# j, ?; K8 ^4 M        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
) Z: ]' h9 W! ]        export LD_LIBRARY_PATH
7 g3 O/ Z. \9 e" c        suffix=.so6 x1 N& |& \4 x6 X# A
        ld_err_code=127$ O4 ~  \! [: s' `4 V$ S, \
        ;;" j8 o( d3 u: g# N
    *SUN*4)   : ~* }, s6 N. n8 v- _% g5 F0 Z6 N9 N
        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
' O0 |" v( H1 [8 o) v$ j        export LD_LIBRARY_PATH5 A5 e- ?. D, u2 i. e
        suffix=.so.1.0) U) D  B6 [' B! J
        ld_err_code=1279 h- m# V+ F9 F# t
        ;;5 t* z4 z$ d. x% S0 e
    *SUN*5)   
4 q% v9 A) |6 q" f        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"
8 B$ `3 Z$ l* |9 Q, \  z        export LD_LIBRARY_PATH, a* p! t' q7 E. m" d6 W
        suffix=.so7 B0 d, H6 o7 L- S! q, v8 j1 N' h
        ld_err_code=1270 i! u9 A+ N* I4 D  ^! x1 _
        ;;! s" p9 o  \# h$ G6 u8 H: k
    x86sol*)   
3 a* \! H8 U$ ?" i9 @        LD_LIBRARY_PATH="$libpathLD_LIBRARY_PATH"7 x- |4 Z# N( G+ I' q8 o. C7 z
        export LD_LIBRARY_PATH( ~. ~! F1 |$ D4 d) b$ V% B! G5 q+ i! h
        suffix=.so
; L' W: j2 x2 L$ g+ l        ld_err_code=127
* k- ^2 O, E% ]6 l4 C* L, T        ;;8 o9 x6 X( `( Q  q
    *AIX* | aix64)   
% J9 C: d! c9 ^1 f        # When genepiclib creates shared objects, it creates a import file and 6 h# @7 @! L0 k; X
        # uses timemill as program. So at exec time,program timemill is needed 0 h/ h" d# q, U2 I, p& H
        # in LIBPATH
; I! J6 e5 z7 `- ^1 N7 A0 p        $ln_default $command $rundir/foomill
+ g( G* y* x* q' K$ s        LIBPATH="$libpathLIBPATH:/lib:/usr/lib"
. }1 j$ H4 K9 {" y' T% P6 y        export LIBPATH) Q% ~" c6 ?7 q* P6 D
        suffix=.o
) P, o5 e6 x% d* V; p        ld_err_code=8  o# @; [2 m! E% V) P! m
        if [ "$EPIC_ARCH" = "RS6000_AIX_4" -o "$EPIC_ARCH" = "RS6000_AIX_5" -o "$EPIC_ARCH" = "aix64" ]; then
+ z+ d( ?& \9 ^: D; ^7 l          tdir=`echo "/tmp/d"$$`
- A5 O' r$ g  {; G6 ~! r          [ -d "$tdir" ] || mkdir $tdir' \) T3 o# O; P; Y6 s, X4 S
          if [ -f $EPIC_DIR/libCustom.o ]; then. ^2 t% F' ~2 S
             cp $EPIC_DIR/libCustom.o $tdir/9 V9 v0 p4 H7 J. u% l! `5 D
             $ln_default $tdir/libCustom.o $rundir/0 w: P/ _* u$ h9 q, J5 A  M' t8 Z
          fi
9 i  T7 h# O; ]5 m4 X# j& @          if [ -f $EPIC_DIR/libModel.o ]; then
" S$ {4 S  q: ^+ p             cp $EPIC_DIR/libModel.o $tdir/) x  _# {# }8 j2 k$ y6 k2 q
             $ln_default $tdir/libModel.o $rundir/
" P7 I1 ^7 d0 U( W+ u: Z* p# ?+ a) B          fi# K; f: @: T$ B% M2 n; J$ E
          if [ -f $EPIC_DIR/libFuncModel.o ]; then$ |7 O# p; U* I% J5 X1 U
             cp $EPIC_DIR/libFuncModel.o $tdir/9 K& [, S+ x4 ^* o
             $ln_default $tdir/libFuncModel.o $rundir/- G4 Q6 i6 Y* N+ o9 x
          fi0 Q) z( s" y0 x, ~* ]) z
          if [ -f $EPIC_DIR/libFuncModel.34.o ]; then5 v5 x6 _0 w5 x5 y3 r6 n; Q- h
             cp $EPIC_DIR/libFuncModel.34.o $tdir/, N' X3 V: L. g( l. R
             $ln_default $tdir/libFuncModel.34.o $rundir/
+ {% y; n3 {' {; @          fi
  B) G/ R) w& _' d# ]        fi
, v5 S6 J' N/ Z+ Z        #Set the IBM flag to enable more shared segids
; g+ m: K1 X# a7 a2 {; o3 N        EXTSHM="ON"3 n, K% K) _) b' F9 X
        export EXTSHM
% C+ C' H" W1 N+ I% E        ;;
5 ]4 W0 Y) a" f  c    *LINUX*)   
5 l  M, w3 f6 O1 g        suffix=.so
3 @6 [- H, N& Z* y/ J7 K        ld_err_code=1
* T$ u$ e  w( O9 k2 y        ;;, p, V7 A- b) ~7 ~# k
    *amd64*)7 [# o" y+ S, L1 Y& Z2 H4 I  @
        suffix=.so4 ~8 L9 s  I+ A! e7 y4 X  b
        ld_err_code=1
) X* U; E2 x; a1 z        ;;
! o* G# N3 o! ~3 b0 |0 T1 w# K    *suse64*)7 e! m; l9 I2 n' x0 i& k0 R1 G- z
        suffix=.so# z. J, B& q8 ]' A, p9 g
        ld_err_code=1
& f$ t) I& G6 @4 h- y        ;;
5 T; M, O0 e) O: R    *suse32*)   
0 d) _1 S- @4 m0 s        suffix=.so9 K# Y$ ?1 F! e" S% K  y
        ld_err_code=1
( m$ l$ `# i$ N- J        ;;
. c' e1 Q+ C2 D  }* ~1 p, s    esac
+ k* E% f* \7 k) x
6 ~0 ], Z  m& s- M9 @# _8 |$ ]    [ "$has_custom" = "YES" ] && ulib="$ulib $cwd/libCustom$suffix"1 [3 k# D) A4 L( u* E# N. t
    [ "$cmdname" != "timemill" ] && [ "$cmdname" != "powrmill" ] \$ u( C2 f- P- s' I! J5 x6 `. E$ A
        && [ "$cmdname" != "nanosim" ] \6 b8 c9 F5 o0 D: D6 H
        && [ "$has_model" = "YES" ]  && ulib="$ulib $cwd/libModel$suffix"
  X; L8 J* X! u8 F    [ "$_VA_" = "YES" ] && ulib="$ulib $cwd/libva$suffix"1 C* \, ?! l$ N" z; r, c

* Q. _. J( `8 R5 v4 Z) \#Look for command line option for libFuncModel.so
( E  U; j4 E; a. o. B& R#    user_library_next=0
) y+ a8 B$ U  H( c    has_fmlib=""
8 c5 Y% w2 V/ p! H% \7 C1 X    for opt in $CMDLINE
% \/ `7 ?+ k: J5 z- m# N    do0 H  G8 a" I7 W; i0 x7 Q& `
      case "$opt" in
/ a6 @9 ?& j. J8 I, r- @        -fm)3 y+ [4 F1 S" m" X
            CMDLINE="$CMDLINE $cwd/libModel$suffix"
/ {  _5 o# H! K3 n+ V( W            ;;& C& Z* W# `' B4 k/ j
        -fm_user_lib)- k+ P7 q8 l4 y
            has_fmlib="YES"
8 A# I& B. i  q6 m$ N0 P- h#            user_library_next=1
' V& L+ |6 ^- V  V; s3 @            ;;3 i$ f! E0 S' o' P4 o4 H
        -xc)
( N! W4 M1 f5 z6 w+ z  N  L; h/ m            if [ "$EXTRA_CAPACITY" = "NO" ]; then! V+ I6 E$ r) u) r2 v
            EXTRA_CAPACITY=YES
* u' O! ?8 x8 n1 D, v" V0 w            fi8 C3 i  q" p0 Q' a& h5 ?( r# |1 H
            ;;5 R$ o# k# U2 c9 S% ]( C6 D. E7 X
#        *)
! F# K& t5 n/ F2 B. m+ z" T#            if [ $user_library_next -eq 1 ]; then% Q6 j; D! c* Z) }
#                if [ -f "$opt" ]; then
" X9 K, p. s& _) Y# B#                    libfmodel=$opt
' @# O+ x6 K3 Z6 t$ i% ~5 p+ n#                else
, Y9 P5 s% C  o/ C8 I; _#                    echo "-fm_user_lib: Specified file not found"+ g6 u/ i! Z. K4 H% Q
#                    echo "-fm_user_lib: Specified file not found" >> .epicscriptmessages  x' T  \7 f( v( t2 d& P
#                fi
+ `: C" G  m5 Y+ q) q#                user_library_next=0
/ y. Q2 \, ^+ q#            fi6 B# r5 ]: H! O" [- W5 L& s( y
#            ;;2 A% x3 Z) p$ `3 o- t- I
        esac$ }. C  s; Y: o0 k3 H8 @
    done
: f) X8 J) T) y0 f) g6 P- a
; ?- C- o/ g% N% S% G6 g    if [ $cmdname = "timemill" -o $cmdname = "powrmill" -o $cmdname = "nanosim" ]; then" H% P+ C# J) ~9 H! X! D- ^* y
        flib="") J0 M+ O& E5 u; v
        if [ "$has_fmlib" = "" ]; then
, `9 Q3 \8 ^/ v7 c- S, k. k, w' J            flib="$flib `get_epicrc ./.epicrc user_libraries`"8 g/ P; S5 a5 Y; }0 |; W
            flib="$flib `get_epicrc $HOME/.epicrc user_libraries`"
; G  T& @, x! ^0 `! N            flib="$flib `get_epicrc $EPIC_DIR/.epicrc user_libraries`"1 Y: I. z" a, p- F- |/ ]6 F
        fi) ?0 A6 }8 i; _7 f
    fi
4 s8 m5 j" k* C$ }0 Q) C
+ p! G6 k' ~% |% T2 N8 L   for i in $ulib
$ j& Z7 U3 t* b   do. Q" m, g1 F1 k( Z$ c7 g1 M
       [ ! -f "$i" ] && continue
% c  F! r1 J) D3 d       dir=`dirname $i`; cd $dir; dir=`pwd`; cd $cwd1 r" ~: F8 |) ]( I
       i="$dir/`basename $i`"
8 f% ?% n* p4 p3 W7 ^       case "$i" in
8 y& u2 `9 g, o0 S  W: s       *libCustom$suffix*)    [ "$libcustom" = "" ] && libcustom=$i;;
6 ?) y' r7 B# ^$ y+ w       *libFuncModel$suffix*) [ "$libfmodel" = "" ] && libfmodel=$i;;5 T& z. b* P# b0 D* ]
       *libModel$suffix*)     [ "$libmodel"  = "" ] && libmodel=$i;;6 o$ ?8 |" u9 L' V. z4 Z
       *libva$suffix)         [ "$libva"     = "" ] && libva=$i;;
+ @5 R$ G2 M( p+ r       esac
* {- R0 L' m) P& X6 W& i" v       [ "$libcustom" != "" -a "$libfmodel" != "" -a "$libmodel" != "" ] \* j# z7 b8 R' q
        && break  ?/ {( J( Z7 p0 N: i! [
   done0 t& \2 }* S" j& X, t# c4 Z

- f% E) Y- d* F( K; x# P# b' C   # symbolic link shared libraries to .epicrun$$
" d6 H! N3 o) x  Z* Q5 D    cd $EPIC_DIR; epicdir=`pwd`; cd $cwd3 i; j+ R" f& j4 M* W4 C8 L
    if [ $cmdname != "timemill" -a $cmdname != "powrmill" -a $cmdname != "nanosim" ]; then3 Z: Q1 f# j" c) x; M
        if [ "$libfmodel" != "" ]; then
0 W0 p5 I9 @/ G- a( f             [ "$libfmodel" != "$epicdir/libFuncModel$suffix" ] && \
; u+ K: Y- _6 O" K# P8 H5 }             echo "Using $libfmodel ..."  && \
$ \/ b/ T/ c5 G5 Q             echo "Using $libfmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE7 `( W; a7 B5 m
             if [ -f $rundir/libFuncModel$suffix ]; then
0 o+ x: H; O2 }6 [5 a               rm $rundir/libFuncModel$suffix7 U) j% M+ o! v2 a6 X; K" i
             fi: I  ~; h8 {% u& q) |
             $ln_default $libfmodel $rundir
; m/ K3 H  k" q0 p6 E  g, i        fi
1 K' d  e& e" J( x' g8 g0 F        if [ "$libmodel" != "" ]; then0 D: u* k2 F( M* w, L- c' G( F
             [ "$libmodel" != "$epicdir/libModel$suffix" ] && \8 g/ C4 \. n0 V! r$ w
             echo "Using $libmodel ..." && \/ p+ _) h4 @0 S8 ~- g3 o# W6 u
             echo "Using $libmodel ..." >>  $EPIC_SCRIPT_MESSAGES_FILE; A% ]- W. P; z$ s/ G. u
             if [ -f $rundir/libModel$suffix ]; then  V: X0 }0 ~: C3 }' f
               rm $rundir/libModel$suffix! b& z- W! B  G& G9 f& ?- ~0 \2 Y, M
             fi
5 p. ^! }. n5 t1 p             $ln_default $libmodel $rundir + d0 O7 P' J3 ?
        fi0 l, ?7 E, U' W' t( [0 _
   fi
0 \0 J+ z# q: x2 r7 T# S' s   if [ "$libcustom" != "" ]; then
  Z/ l  {* Z" |6 |6 X: _: G        [ "$libcustom" != "$epicdir/libCustom$suffix" ] && \* l: \+ E, t- R- k% B, f+ D
        echo "Using $libcustom ..."
. Y! ]* p$ ]# D5 }        if [ -f $rundir/libCustom$suffix ]; then
0 |6 f$ O: S2 h          rm $rundir/libCustom$suffix
( u: l: j! x* D$ N        fi
! p) d1 p' r4 W$ V' @9 N* S* r        $ln_default $libcustom $rundir
: n( _# O, x6 |7 J2 G1 L3 D   fi
4 Y; O/ H/ R$ ]5 G. ~
3 N1 m6 J2 i( K, k   if [ "$flib" != "" -a "$flib" != "   " ]; then9 d5 t) V$ t) t2 d: [/ c* V
        CMDLINE="$CMDLINE -fm_user_lib $flib"
& t; I* _% _. Y5 _% K0 Z; I   fi
2 r! [6 o3 {/ P: V* h# y+ \/ k& S- w7 F- E. _6 `4 W2 N; ~& i
   if [ "$libva" != "" ]; then
& D3 ?! [2 O& X  q6 a. K        if [ -f $rundir/libva$suffix ]; then
6 V& l0 r5 D" ?4 s2 q# t) d6 f2 f          rm $rundir/libva$suffix
# Z/ r- u( s7 C5 e" r) T        fi
' F7 e* ~% a, w        $ln_default $libva $rundir 3 r0 P6 o  ]9 `# x4 g6 Q
   fi/ A( y/ x, [5 a' u1 k

9 }0 R' j' O, v9 T0 n3 g. Y6 ^% U$ L. z* C8 Z
    # VCORE design library! S8 e1 @) f# A& y; _0 m
    if [ "$vlog_design" != "" ]; then6 I" {. p5 h1 p% k; _
        $ln_default $cwd/$vlog_design $rundir/`basename $vlog_design`
& [' ?. X* J9 X8 a* Z, y% u    fi/ \* q# ?# B( u: l
2 g9 @$ c' v7 @6 v4 I4 S5 _
    if [ "$EPIC_EXTRA_CAPACITY" = "1" ]; then3 m: [2 i& |  `2 H( [* v1 q% [5 G5 O
        EXTRA_CAPACITY=YES
$ I; X" H* V- ~' |, k0 `    fi1 Q. N# [+ d0 k% _
0 u' V; H9 i9 f# y7 w6 K
    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "0" -a -x "${command}_xc" ] && command=$command"_xc"
$ Z; _: t0 d, s$ ^# D    [ "$EXTRA_CAPACITY" = "YES" -a "$USE_ACE" = "YES" -a "$DB_REAL" = "1" -a -x "${command}_a_xc" ] && command=$command"_a_xc"
  J* q& w+ w+ ?. D; d    #Create temp file if dual process is on
  J; l2 a% k, Q9 O    if [ "$EPIC_ARCH" = "SUN4_SUNOS_5" ]; then, A0 e( a3 l* p/ w: O: L: T3 ~
        if [ "$EXTRA_CAPACITY" = "YES" ]; then
1 w/ M% q3 t3 `3 y1 q            touch $rundir/rpcidfile7 r9 l& V: U' [+ m
        fi# ?% S+ S1 F" M" }4 }  \
    fi
9 ~+ A- ?" T* L+ G" vfi4 C6 k6 B2 C3 S* ]* `1 j

8 R1 Y4 B/ K( ~$ }+ ]" P) t6 }run_cmd()4 m( l% S. h* d* i) Z8 ^: K5 Y
{
5 N& P; }/ M. P% k1 M% V* x& o  command=$1( {1 q; v, P, n+ `0 h0 V; i% z
  shift
1 z) ?! L( N/ y7 ]" x, A0 C; r; n5 p, ?9 T) D" B  `$ Q: U
  if [ x"$VA_FILE" != x"" ] ; then' h  t: i8 S" l$ `8 h
     cmdline=$ARGV
9 A  T) A& B/ t7 V5 z. c6 ?  else: C3 \$ ?0 i6 q+ P; ~' M0 C- e
     cmdline=$@0 i: I) @# b7 W( x+ U' j+ e
  fi& M' ^3 h# q. M) ^
4 x5 [4 f+ F& ]6 S2 l- B$ t
  debug=${DEBUGGER:+"$DEBUGGER $command"};' K$ I: M1 Z. K' j

2 s+ A9 N6 ?0 F, E: E0 b0 w0 M  # To disable Exec-shield-randomize in RHEL3 U3+ when running nanosim and nanosim_a1 z$ c) s" a* a
  # so save-restore may work.
/ B" _& E; s4 s2 Q  setarchStr=
/ E9 Q2 t2 C0 @+ M+ G  cmd2run=`basename $command`
. [% l% {1 F) Z. g+ O) c+ V  if [ ${cmd2run} = 'nanosim' -o ${cmd2run} = 'nanosim_a' -o ${cmd2run} = 'powrmill' -o ${cmd2run} = 'timemill' ]; then  s, W5 M# [$ ?
    if [ "$EPIC_ARCH" = "IBMPC_LINUX_LINUX" ]; then  M& Y, T0 x5 V+ G9 `+ ^
      setarchStr="setarch i386 -R "3 m+ ]6 p% x) F: s0 Z$ p( ^
    fi' k1 f) M" ~( E/ h, p2 u
    if [ "$EPIC_ARCH" = "linux" ]; then
2 Q5 s; Y7 d$ i* q- s      setarchStr="setarch i386 -R "
+ C. I! ]0 M: \  C) f    fi
9 a, H/ x0 _# T& M& ^& @    if [ "$EPIC_ARCH" = "amd64" ]; then; O2 {, V: d1 K. l4 J) m6 }
      setarchStr="setarch i686 -R "4 D4 B4 O- w" S  _5 T
    fi  X; B" K6 I. a6 [6 a* }( x
    if [ "$EPIC_ARCH" = "suse32" ]; then
9 z7 Z6 M, }- }      setarchStr="setarch_suse i386 -R "
0 Z$ U& t( D/ E1 h) W. Y3 c+ S    fi
4 e! o7 p4 P* r8 h& c    if [ "$EPIC_ARCH" = "suse64" ]; then0 ~$ P/ i8 Z% _
      setarchStr="setarch_suse i686 -R "
( J1 `2 r6 ]+ S/ t- _' c3 J    fi
4 ~4 L  }0 N, {  j# j  fi
' {9 k( ]0 |# A$ R0 K' Q- X
3 {  Z7 S  X# I0 Y  ret_stat=0
: e: x1 {! z% R  if [ -x "$command" ]; then# ?2 j4 @0 ^0 r0 M" X: m1 n  {( G
      if [ "$debug" ]; then/ j$ C2 T, _* W  k* y" U
        _debug_args_=$cmdline
" _/ C7 R3 j8 |! r$ k        . .epic-debug% b) O$ U& N" K$ P
      else+ Q4 f+ @9 ~8 x+ @5 V1 U" Z; x
        DEBUGGER=; export DEBUGGER
1 C. r1 g# O' T! C' x, f        $setarchStr $command $cmdline
3 W, w5 V1 n4 M, l8 T5 q      fi
$ q( E: Z# ?0 S! v" s/ R' O  b      ret_stat=$?& J0 o6 Q% d. B; x. i8 l0 X
  else$ p1 A6 L0 j/ q. u( \! b/ m6 @) W+ Z9 i
    echo "Corrupt installation, executable \"$1\" not found!"
, F% m. R; ]4 Y: K" a    ret_stat=1$ u, k2 ]& @9 I& s$ A+ N
  fi( ]3 G: t3 f5 I8 q$ o/ N
}* t+ T2 |3 n) _7 u
: q2 N% d+ F" Q; c+ ]* W
# keep runing cmd if ctrl file exist1 s6 `5 n5 Q/ F& a; h

, l  v% I" T  n. G" i; A9 l8 Drun_loop()/ Z7 l3 g6 S; \& y+ M& c
{( w4 s; k  a+ U
  command=$1
7 t1 p8 I1 ^5 W1 l: {  shift
1 U2 z3 Q# w2 w2 {, j& [" S9 J0 m: A. A# {, P+ z, n) y
  if [ x"$VA_FILE" != x"" ] ; then
# q+ E5 s8 r; C+ H* Y6 P     cmdline=$ARGV
' Q- Z* G5 [- G- g- g  else
% V) Q: A5 Z1 I     cmdline=$@
7 b' D# h* v  m: r6 i# A2 b  fi  O$ E- d2 ]. W
  c9 }$ Q6 _& j/ a* A
  while [ $ret_stat -eq 0 -a -r $LOOP_CTRL_FILE$$ ]; do
( Y' W& N6 s1 p) @4 a: r. t    . $LOOP_CTRL_FILE$$; U5 p4 K' S9 {
    run_cmd $command $cmdline -banner 2
& n1 |6 ~" X) n* I  done;" L$ T6 T. {# Y& Q2 v: @. J2 V* t

+ s" M9 U9 S: a  J5 C- t: E  if [ $ret_stat -ne 0 -a -r $LOOP_CTRL_FILE$$ ]; then$ d, r" D- u6 O" F( b4 y
    rm -f $LOOP_CTRL_FILE$$# g5 U7 }/ N: C9 [8 \4 w/ i
  fi
- T; L- O0 K/ _" s) m}
  x0 y) v8 v5 O" Y& m  H+ [# {$ G" v. A& F/ R6 S8 E: _( B7 Y: B
har_check_ret_stat()
2 l0 [8 Y# b. ]! D; S. r1 o4 B9 f. Y{
4 ], |. ~) e3 y' {2 v  if [ $ret_stat -ne 0 ]; then 9 m! {# r) j* c( n9 M
    echo "Simulator returned with non-zero exit status. Stopping."
6 z) `# s* }$ a% J5 [    exit 1
- `2 H8 t7 B( l* `  fi# c/ X1 V. }- z( E: v
}6 \. ^0 v2 l5 }* s2 r; S$ P; T
4 F7 m) H# }: h
#
) f! {0 l, t" }5 d& F# set stacksize and datasize limit( N0 V- A! v- g/ `$ T6 j
#
5 ]3 M# _. R  c* Q# ~: D" X2 ]1 s
. B9 e8 v4 W5 B/ J, Y$ n* I# Lset_data_limit8 c  V2 _2 X+ e6 M$ j
set_stack_limit  O( B1 w9 O# X) F
+ }( ?+ y# n) V
#rm -f $LOOP_CTRL_FILE* S! m9 Z. @' t0 i

8 Q, V6 e1 K8 arun_main()
( x# R  g4 d0 G, D$ l7 a{6 c* a1 a$ d  d& x3 g
if [ $is_special_har_run -eq 1 ]; then" R8 q' \$ c" ], @% ?
  if [ "$har_ofile_prefix" = "" ]; then
% M7 q, P3 |# s: R' n7 D7 ]6 J    echo "Wrapper bug. Notify Synopsys technical support."
: t) V" a6 z* @" ^& i  R+ V6 h, {5 Z. D    exit 1
* c: ^8 ~. ]+ I. d6 _: M+ l  fi' @" t  c( F0 G) ]: w" f4 f# X
  if [ "$har_hilo_file" = "" ]; then
' a) I. k0 b; e/ ^) i/ E    # no user specified hi lo file - do both runs# S% k( @3 A9 b9 b
    run_cmd $command $CMDLINE -har_one -har_setup
* O0 |- B1 `1 J( d3 O- u# M- v    if [ $ret_stat -ne 126 ]; then
% R1 e4 P; v, ]; K      har_check_ret_stat1 S! ^' O  Z& \( Y2 |, L
      if [ -r $LOOP_CTRL_FILE$$ ]; then+ s  W) g2 d, m- Q) D+ X4 v# K
        run_loop $command $CMDLINE -har_one -har_sim ${har_ofile_prefix}.hl
0 q0 a- i4 p" S) c& I: w9 _        rm -f ${har_ofile_prefix}.hl
& ?3 B0 r2 N+ x% ^# \1 Q. t3 S; F      else8 o5 c0 C+ o1 s9 X# ~, l
        run_cmd $command $CMDLINE -har_one -har_rmhilo -har_sim ${har_ofile_prefix}.hl! Z" ?3 Y( T8 a- M  {
      fi0 a! G) u: _/ E+ N) K
    else
/ w; [+ e# E( K  o4 F      ret_stat=03 N, X4 J* s* F( w4 G$ N
    fi
9 J; T2 f' T% S8 B& s1 t, [. B6 E  else
3 V% U  |3 b# \    # user gave a hi lo file name, K: |& ~# E; U
    if [ -f $har_hilo_file -a -s $har_hilo_file ]; then, |4 k$ S/ ]2 g
      # file exists - use it - only do sim run" b" E0 N+ u% f  [( n/ v" h
      run_cmd $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}- Y& J4 X# J6 u9 l
      run_loop $command $CMDLINE -har_one -har_ff -har_sim ${har_hilo_file}
9 V  z% j1 j( A0 u0 o1 J    else  U' H* t, ?# D/ x6 i+ e8 ]% x& ]
      # no such file - generate it - do both runs' s) \' w* ]* r
      run_cmd $command $CMDLINE -har_one -har_fnf -har_setup
6 \9 ^: Z- I' g      if [ $ret_stat -ne 126 ]; then) L$ y3 [0 S& C8 a/ @4 Z
        har_check_ret_stat$ U1 h+ p7 ~( S) D- H- G
        if [ ! -f ${har_ofile_prefix}.hl ]; then
) A2 J3 g( T1 m% ]          echo "No hi lo file generated after setup phase. ". m2 {3 a6 {- l* J3 [
          echo "Contact Synopsys technical support."2 \$ R! I. }: K& S& k
          exit 1
# D$ w9 [8 ], z  W! d        else8 y3 w- S4 t3 W' C7 @
          if [ ${har_ofile_prefix}.hl != $har_hilo_file ]; then# D. [' M" J( M3 n  X6 l9 b7 }, I- ?5 _
            mv ${har_ofile_prefix}.hl $har_hilo_file
! z  v8 J! P# f          fi
" a5 B2 w0 i1 P; g. ^        fi
% T7 l: s+ m: w1 J  `        if [ -r $LOOP_CTRL_FILE$$ ]; then
' f1 d8 P6 O' R! W& L          run_loop $command $CMDLINE -har_one -har_sim $har_hilo_file" e& p! a; V; K# y* i5 P% I
        else
' X' R- X! }( [; B% Y          run_cmd $command $CMDLINE -har_one -har_sim $har_hilo_file; M7 c: g9 w9 [
        fi
) [: ~: _( Q+ ?/ ^) u0 q      else
! w) ^; i* R6 p3 y: g( b        ret_stat=07 Q. L2 O% B4 u; V8 U) [' @
      fi1 L/ Q# G: z- R9 ]( r( K$ G1 Y
    fi) k% \7 `0 ^) r% w
  fi
; w6 C) o3 v  W( G6 Uelse  . E1 e* m5 p2 ^) I; X4 U* C7 L
# don't loop if -har_setup
9 }6 G! f8 u$ X8 G2 J" P. u+ j6 p& y  if [ $have_har_setup_flag -eq 1 ]; then* v5 O' x5 H0 |+ ^( z
    run_cmd $command $CMDLINE
$ x- U' P! x' V) G    if [ -r $LOOP_CTRL_FILE$$ ]; then
5 J+ i: N* t7 a4 Q9 j      rm -f $LOOP_CTRL_FILE$$& H5 K  r2 Y: V) \; R  X6 ~! l
    fi$ a. {% Y# ~; m8 c  I% _& @
  else
% v! c9 K* [7 Z) d7 X8 \! q. ~    run_cmd $command $CMDLINE
% K- K2 ~( n0 ~' S, F8 n; u9 V    run_loop $command $CMDLINE
2 P9 @/ w& s4 w1 J; _! e8 B7 d" }  fi
0 ]1 s4 P! H6 N6 ~fi
% E- h8 h( K, U8 L9 R: D+ p
$ N7 N' E9 j& C' k4 `- Q3 W4 z% @if [ $ret_stat -eq 0 -a $cmdname = "powrmill" -a $postgres = "y" -a ! -z "$workDir" ]; then+ B/ S6 H+ a% d2 k( s' f/ c& s. ]
  pwCreateErrDB -w $workDir -e $errFile: r& F4 ^5 u: `$ p
  ret_stat=$?$ l7 U+ q: W1 i% U4 P" _2 ?
fi+ j1 z. w* C# n" H& ~  X+ k! w
}
9 u- c( S  W2 P) C' [& R8 w3 u" ~3 Z
. ~# X5 S" w; c! r0 a% Ycleanup_alter()
, e+ m% m7 I9 h+ U  F- A' [{6 S2 D4 x( Q! ?# _6 E
   /bin/rm -f $ALTER_COUNT_FILE 1>&2
6 o! `0 d2 e* J   /bin/rm -f $ALTER_HK_FILE 1>&2
1 D6 X; e) z! j* q- f}! G' x6 h3 k# I6 y. a
6 O2 x0 m% X1 k' ?' `8 R9 p- g) w' ]
#generate alter temp files based on pid) _% n. f. `- _* Y2 Y
ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$5 `+ f, N# }& Y$ S) R
if [ -f $ALTER_COUNT_FILE ]5 R/ `/ b" |1 V
then ) J9 J* ^9 I/ _* U- _
  until [ ! -f $ALTER_COUNT_FILE ]3 G/ R- O: S) j+ i/ m7 Y
  do' m# [3 v2 j# X; x1 K6 F. q
    ALTER_COUNT_FILE="$ALTER_COUNT_FILE"$$
5 l" Y  n6 c: A. y/ Z  done( a2 k, U+ T# d1 o) z
fi
6 X) h1 {1 ^7 z3 u  X2 yexport ALTER_COUNT_FILE
- E7 T  K* y9 M  o
& s; K6 z2 \  X. O' w" I' f. tALTER_HK_FILE="$ALTER_HK_FILE"$$
& C! t2 m% D. F9 xif [ -f $ALTER_HK_FILE ]
0 L7 N. X$ I& ^# u, jthen 5 w* ~( |# {  t. v: i5 [6 y
  until [ ! -f $ALTER_HK_FILE ]6 q, A0 @5 c( X/ s6 y
  do6 Z' M0 A& Y; ^, p
    ALTER_HK_FILE="$ALTER_HK_FILE"$$
: ]: R8 E7 v8 f% L! j. Y  done5 V0 `: @4 o! T" Q  e% A
fi
; A  f8 q* j$ Kexport ALTER_HK_FILE# {' D" I3 v3 }0 c* \- ?
3 F, K1 L; A" i: y/ Q! B
#generate monte carlo related temp files based on pid) w% m, B( c' c: C+ z1 Q
cleanup_monte()
( b  C$ ~' @; R7 B2 ]  w3 ^$ l' J{& ]1 o6 J. l2 M
   /bin/rm -f $MONTE_IMG_FILE 1>&2
1 r" L. M& m) s& M3 _' ?) G   /bin/rm -f $MONTE_IMG_FILE.gz 1>&2
+ }- Y* Z& ]; b( Z# P; ]4 o   /bin/rm -f $MONTE_COUNT_FILE 1>&2
* Y) Y% w! b3 M% n# n   /bin/rm -f $MONTE_CFG_FILE 1>&22 |# b' u* x- Z% v+ E' U5 U
}
- G) |5 F1 v* x
! J, ]" o# s9 ]8 u1 z) OMONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$, n1 k! u% e4 k5 P+ Z/ q1 W" W
if [ -f $MONTE_COUNT_FILE ]. ^0 t3 J6 P! q& H+ i
then
6 @+ u8 h5 ~/ s+ u# g( t  until [ ! -f $MONTE_COUNT_FILE ]" ^' r3 @' r# V. o0 w
  do
8 {) a) s4 w: p+ y# R* G6 o7 }    MONTE_COUNT_FILE="$MONTE_COUNT_FILE"$$
) l/ u3 H  q/ [* V1 `& u  done
4 S2 t0 U- x4 n% u/ zfi* E: W5 a5 S9 D7 {: {
export MONTE_COUNT_FILE
1 f9 U0 S2 x6 A6 G
' d# W/ G8 h6 e! T6 wMONTE_IMG_FILE="$MONTE_IMG_FILE"$$' k) g  u. E% b( G1 U6 i
if [ -f $MONTE_IMG_FILE ]' f: H# _* x" N  I- A
then
* I+ u# F/ \* L- Z  K: W0 D  until [ ! -f $MONTE_IMG_FILE ]
6 p# E1 x3 W% y( u: w  do! d4 M. h/ ^$ q" g
    MONTE_IMG_FILE="$MONTE_IMG_FILE"$$9 J% W; ^* p* [/ ]7 _7 \; j
  done  N9 d8 h; T$ L6 i! o, @
fi- k3 i0 |1 k# x
export MONTE_IMG_FILE. ~" T3 m) B# x  r1 L

( I3 o3 P5 }, n+ {MONTE_CFG_FILE="$MONTE_CFG_FILE"$$
. s9 u8 ]6 S) T7 @if [ -f $MONTE_CFG_FILE ]6 R. [% e  \+ N  M
then
5 @" t6 j% P7 n1 F' a0 J  until [ ! -f $MONTE_CFG_FILE ]1 a& K$ U+ Y7 c1 e0 P
  do* p6 L# C( x6 O: [
    MONTE_CFG_FILE="$MONTE_CFG_FILE"$$
2 s- J2 w6 o7 W, T2 o  done
; \$ a5 K$ c+ o4 p& S, ?fi
1 i! G  R$ Y; C2 a3 u; w
+ N: `! M% p8 F. k# main iteration( D& W+ y3 C1 w: _1 G1 T4 A1 f
run_main
7 ]: }+ t; b3 ~  z+ b0 T" M6 l6 W; [9 _/ ~2 N# R' j) X& [
if [ $ret_stat -ne 0 ]
* D! Y' M& `* |, O' D; `; Pthen
9 W; [! a, ~9 |2 T  cleanup_alter. d  a+ [3 v3 l( g7 S
  cleanup_monte
$ i7 m  I4 }8 @) p5 ?  Exit $ret_stat6 O2 S: @- N, L' p5 c" R  I- I0 M
fi- N2 D6 k4 D$ ?8 Q; m6 i
; G' Z- v$ f5 K& ?8 X' h
#Alter related iterations3 \$ w, Z. q& G1 g% D
( ^) `$ d) u. r( r# v
iterations=0
1 _& f% i" F( w/ w1 j. S( b6 Pcount=0
1 V& M: D1 u; [if test -s "$ALTER_COUNT_FILE"
) |2 [" a  W" ^- Zthen
. h% D. S# l! w: r! ^9 i1 y  if [ -r $ALTER_COUNT_FILE ]; then7 `# g5 b8 X. C! m6 r
   exec 7< $ALTER_COUNT_FILE
, F# [# N4 |( Z4 H2 ?& J   read iterations <&7
) d8 g& c) x: x) T  R& m fi
: b9 }. Z! _* ?fi1 j, Z) \$ X! s: `8 t$ b! x
' u# `1 ~5 n+ S, D% o- t; D, R
trap 'echo Program Interrupt; cleanup_alter; exit 1'  2, V2 _0 U3 c! C9 [
while [ $count -lt $iterations ]: N& ^$ q- r$ v! F- J
do9 ^# A' r* T8 N% z$ x4 S" l
count=`expr $count + 1`% M) F6 t# R! Z. ]9 K3 g
ALTER_COUNT=$count+ N! K; z6 |) J0 h
export ALTER_COUNT
, P9 X( A# f7 k- k7 s# e+ m6 n7 Z3 l  Z5 J) M) J9 d
run_main. t) H- z+ _. I6 I, k9 l9 L

' p1 m4 ~- Q0 I/ d' L1 |# Edone: m1 O) s- V1 B( g7 F
7 Q! Z5 y/ Z# c6 @9 Z8 ]
#Monte carlo related iterations
! d. d5 Z' o$ }* [
/ X  _! L, x2 i8 f( s) ^monte_runtime_summary()
3 P" }2 N, s, }4 y2 O{6 O- F% i) B9 h! L4 Q
  keyword_1=real4 W+ z& \9 h( M5 c/ H0 ~' i# }
  keyword_2=user3 n) p- y/ }: z* v
  keyword_3=sys
$ U; i  t; c2 M6 N' o3 E7 C  ofile_prefix=nanosim
! I: _5 U! U$ \3 }, v5 ^4 W
: [4 [/ O( c+ r  if [ ! -z "$o_option" ]; then
3 f" \+ J3 k3 G. ~5 G# H    logfile=${o_option}.log1 M  X) t; ]: R! B& c1 ?& `( j
  else
$ K' ^( y' u/ b8 _4 ~    logfile=${ofile_prefix}.log4 l! P5 i, o) m
  fi/ u) D% y/ {5 v1 [) `

& }% f; Y' L, u2 ^2 m  if [ -f $logfile ]; then, K2 e. v8 Z: n5 O6 i, T! U2 m
    echo "*** Monte Carlo Total Run Time Summary ***" >> $logfile      
# `3 G" \7 N# _! q    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- u9 d* C, j& B: v
  fi
/ T. O/ H: r+ b+ H& e}, G$ q$ s$ X, e' q- e
. Q8 [& Y% I' H- [" r- i
next_monte=0
5 {+ j& E% w5 y; v7 U: ^8 ucur_monte=0
8 H0 Y/ c/ v2 S: |
6 r% a, ^/ b/ L: \; K. P2 K( Jif test -s "$MONTE_COUNT_FILE". s  K) s2 c0 H& o
then6 Y( {1 w: M6 ]9 m! @/ ~" e- l7 m7 y
  if [ -r $MONTE_COUNT_FILE ]; then* E' l3 ]- w8 b# J  m
   exec 8< $MONTE_COUNT_FILE
& _: K8 e- X3 b# {6 a6 e   read next_monte <&8
! F& R2 d# }- q6 C( M% z3 G  fi0 e% o+ C+ i" a& J) ^. g& A
fi8 G: P- M3 w% q, X/ R& S7 o: q

2 |4 M. @# P5 l, n0 \3 }trap 'echo Program Interrupt; cleanup_monte; exit 1'  20 X, l( D8 [" V$ X- q
while [ $next_monte -gt 0 -a $next_monte != $cur_monte ]
3 Y8 B5 `- {! t! @$ |* Mdo
; w% t) y1 ^- g" c4 f" {0 e8 D  NS_CURRENT_MONTE_COUNT=$next_monte
' e. C# x5 }. r: M/ ?# Q8 w& p  export NS_CURRENT_MONTE_COUNT
9 m8 [' A& s2 [4 ]# {
( z% F1 f! H, ]$ ^1 L7 u9 T  echo "restore_ckt_state save_file=$MONTE_IMG_FILE" > $MONTE_CFG_FILE9 X; _6 o1 W4 m, C- l# U
  CMDLINE="$CMDLINE -c $MONTE_CFG_FILE"
/ Z& [, O# Q! |' ?6 x) h2 `  run_main
) G2 e3 O  v6 Q/ y' Q5 K% s
" G. g& K7 u4 J2 u9 y  cur_monte=$next_monte6 ?: U3 @. P. A# u* A
  exec 8< $MONTE_COUNT_FILE
7 V, Y7 l  T0 m( d: Z/ f. N  read next_monte <&8' k" k8 w# X4 g: t. w/ q# v6 V) f
done4 R8 I3 j; s2 Z) m: e
$ U* i; H- M; z
if [ -f $MONTE_COUNT_FILE ]
+ C1 e$ n- j3 P8 |$ z/ L. jthen: p' U' R. g: \3 j8 |
  monte_runtime_summary
$ i: w% E/ J' u" jfi
; i, x, e& a* J( g  Q9 k
0 c9 L, [' g8 Z6 ^. C  e7 Kcleanup_alter
7 U: r1 A" ^1 Z0 S; {cleanup_monte
8 O; K7 f, V3 ?* {5 V) t" E% C
" h. X/ O- p; _( w4 Y- b( z) ?& nExit $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 06:52 AM , Processed in 0.143018 second(s), 15 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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