You are on page 1of 62

1.

1 HSPICE

EDA1972
SPICE
Simulation Program with ICEmphasis
HSPICEMetaSoftware

SPICE1972MicroSimPSPICE1984

HSPICEEDACandence,Workview
HSPICE100MHz
HSPICE
HSPICE

1.2 HSPICE
HSPICESPICE

Foundry

ACDC
Monte Carloworst-case

PCBIC
HSPICE1.2.11.2.2

1.2.1HSPICE

1.2.2 HSPICE

.DC
.AC.TRANHSPICE1.2.3

1.2.3 HSPICE
HSPICE
1.2.4HSPICE

1.2.4 HSPICE

1.3 HSPICE
HSPICEnetlist

HSPICE

1.HSPICE

meta.cfg

hspice.ini

<design>.ic

<design>.sp

<library_name>

<design>.d2a

2.HSPICE

.lis

.tr#+

.mt#

.sw#+

.ms#

.ac#+

.ma#

.gr#++

.a2d

FFT

.ft#++

.pa#

.st#

.ic

# 0
+.POST
++.GRAPHmeta.cfg
HSPICEPC
+++.FFT

1.
.END

.ALTER.END

2.
(a)HSPICETab
/
(b)UNIX
(c)80
(d)+

(e)
(f)

.lisnetlist.sp,
netlist.lis
.PLOT.PRINT
.ALTER.INCLUDE.DATA

HSPICE
1e-14,2.65e3,1e-3pf:
MI=25.4E-6

FT=.305

DB=20lg10

P=1e-12

N=1e-9

G=1e9

MEG=X=1e6

U=1e-6

F=1e-15
M=1e-3

T=1e12

K=1e3

1.3.1HSPICE

1.3.1 HSPICE

HSPICE

2.1

. .TITLE
.TITLE<string of up to 72 characters>

<string of up 72 characters>

POWER AMPLIFIER CIRCUIT TEST


HSPICE

. .END
.END <comment>
.HSPICEHSPICE
HSPICE.END
MOS OUTPUT
.OPTIONS
NODE NOPAGE
VDS 3
0
VGS2
0
M1
1
2 0 0 MOD1 L=4U W=6U AD=10P AS=10P
.MODEL MOD1 NMOS VTO=-2 NSUB=1.0E15 TOX=1000 UO=550
VIDS 3 1
.DC VDS 0 10 0.5
VGS 0 5 1
.PRINT DC I(M1) V(2)
.END MOS OUTPUT
MOS CAPS
.OPTION SCALE=1U SCALM=1U WL ACCT
.OP
.TRAN .1 6
V1 1 0 PWL 0 -1.5V 6 4.5V
V2 2 0 1.5VOLTS
MODN1 2 1 0 0 M 10 3
M2 .MODEL M NOS VTO=1 NSUB=1E15 TOX=1000
+ UO=800 LEVEL=1 CAPOP=2
.PLOT TRAN V(1) (0,5) LX18(M1) LX19(M1)
+ LX20(M1) (0,6E-13)
.END MOS CAPS
.

.GLOBAL
.GLOBAL
node1

node1 node2 node3


Global nodes, such as supply and clock names, override local
subcircuit definitions
7

.GLOBAL.GLOBAL
.GLOBAL
.

* <comment on a line by itself>

<HSPICE statement>$<comment on the same line as and following HSPICE


input>

2.2

.
elname <node1 node2...nodeN> <pnamel=val1>
<pname2=val2> <M=val>
elname <node1 node2...nodeN> <mname> <val1 val2...valn>

elname: 15
HSPICE
C
K
L
R
T
U
node1...
16.
[ ]
mname:

pname1...
val1...

M=val

.
RXXX n1 n2 <mname> Rval<TC=TC1<,TC2>>
+ <SCAL=val> <M=val> <AC=val> <DTEMP=val>
+ <L=val> <W=val> <C=val>

RXXX n1 n2 <manme> R=val <TC1=val>


+ <TC2=val> <SCAL=val> <M=val> <AC=val>
+ <DTEMP=val> <L=val> <W=val> <C=val>

RXXX n1 n2 R=equation

R1 1 2 100k
RC1 12 17 1k TC=0.001, 0 1.2
R4 5 54 RMOD 12k
TC1TC2

.
(1)
CXXX n1 n2 <mname> capval <TC=TC1<,TC2>>
+
<SCALE=val> <IC=val> <M=val> <w=val>

<L=val> <DTEMP=val>
CXXX n1 n2 <mname> C=val <TC1=val>
+
<TC2=val> <IC=val> <M=val> <W=val>
<DTEMP>
CXXX n1 n2 C=equation CTYPE=0 or 1

<L=val>

C1

3 2 10U IC=3V
CBYP 13 0 1UF
C2 1 2 CMOD 6PF

CXXX n1 n2 POLY C0 C1 C2 ... <IC=val>


C0C1*VC2*V**2
(2)
LXXX n1 n2 <mname> Lval <TC=TC1<,TC2>>
+ <SCALE> <IC=val> <M=val> <DTEMP=val>

LXXX n1 n2 <mname> L=val <TC1=val>


+ <TC2=val> <SCALE=val> <IC=val> <M=val> <DTEMP>

LXXX n1 n2 L=equation LTYPE=0 or 1

LLINK 42 69 1UH
LSHUNT 23 51 10U 0.001 0 15 IC=15.7MA
LH8
5 80 LMOD 2MH
:
LXXX n1 n2 POLY L0 L1 L2 ... <IC=val>
L0L1*iL2*i**2
POLYC0,C1,C2L0,L1,L2
Vi

C0C1*VC2*V**2
L0L1*iL2*i**2

.
KXXX LYYY LZZZ Kvalue

KXXX LYYY LZZZ K=val


LYYYLZZZK1

K34 LAA LBB 0.9999


KXFTR L1 L4 K=0.87
.
(1)
TXXX in refin out refout Z0=val TD=val
+ <L=val> <IC=v1, i1, V2, i2>

TXXX in refin out refout Z0=val F=val <NL=val>


+ <IC=V1, i1, V2, i2>

TXXX in refin out refout mname L=val


inrefin1
out refout2Z0
TDTD10NSFNL
NLFFNL
NL0.25(1/4F)
IC
9

T1

1 0 2 0 Z050 TD10NS
T2 1 2 3 4 Z0120 F1.5MHZ
T3 1 3 4 6 Z0200 F4.5MHZ

NL0.5

(2) RC
UXXX N1 N2 N3 MNAME L=LEN <N=LUMPS>
N1N2RCN3MNAMELEN
RCLUMPSRC
the number of lumped segments
U1

1 5 0 URCMOD L50U
URC2 1 10 4 UMOPL L=100U

N=4

2.3
HSPICE

V:
I:
E:
F:
G:
H:
. VI
VXXX n+ n DC=dcval tranfun
+ AC=acmag,acphase

IYYY
n+
n DC=dcval tranfun
+ AC= acmag,acphase

VXXX: V15

IYYY:
I15

n+/n: n+
n-n+
n-

DC:

tranfun:
AC:

acmag:

acphase: 0.0
M:
1.0
HSPICE
1.
VXXX n+
IXXX

V1

n- <<DC=>dcval>
n+ n- <<DC=>dcval>
DC=5v
10

V1
I1
I2

2
3
3

0
0
0

5v
DC=3mA
3mA

2.
VXXX n+ n- <AC=acmag,<acphase>>
IXXX n+ n- <AC=acmag,<acphase>>
V1 1 0 AC10V 90
VIN 1 0 AC 10V 90
ISRC 23 21 AC 0.333 45.0
ACacmag1acphase0
3.
PULSE <(> V1 V2 <td<tr<tf<pw<per>>>> <)>

PU <(> <V1 V2 <td<tr<tf<pw<per>>>> <)>

V1:
V2:
td: 0.0
tr:
TSTEP
tf:
TSTEP
pw:
TSTEP
per:
TSTEP

2.3.1
VIN 3 0 PULSE (-1 1 2ns 2ns 2ns 50ns
100ns)
V1 99 0 PU lv hv tdlay tris tfall tpw tper
.PARAM
4.
SIN <(> vo va <freq<td<<>>>>

vo:

va:

<)>

11

freq:

1TSTOPHz

td:

0.0

10.0

0.0

VIN

SIN(0

100MEG

1NS

1e10)

2.3.2
5.
EXP<(> v1 v2 <td1 <1<td2<2>>>> <)>

v1:

v2:

td1:

0.0

td2:

td1+TSTEP

1:

TSTEP

2:

TSTEP

12

2.3.3
VIN

EXP(-4

-1

2NS

30NS

60NS

40NS)

6.
PWL <(> t1 v1 <t2 v2 t3 v3...> <R<=repeat>> <TD=delay> <)>

v1...
t1...

repeat

TD

delay

*FILE: PWL.SP THE REPEATED PIECEWISE LINEAR SOURCE


*ILLUSTRATION OF THE USE OF THE REPEAT FUNCTION R
.file pwl.sp REPEATED PIECEWISE LINEAR SOURCE
.OPTION POST
.TRAN 5N 500N
V1 1 0 PWL 60N 0V, 120N 0V, 130N 5V, 170N 5V, 180N 0V, R 0N
R1 1 0 1
V2 2 0 PL 0V 60N, 0V 120N, 5V 130N, 5V 170N, 0V 180N, R 60N
R2 2 0 1
.END

13

2.3.4
PWL(tivi)TIME=tivi

7.
SFFM <(> vo va <fc <mdi <fs>>> <)>

vo

va

fc

1TSTOPHz

mdi

0.0

fs

1/TSTOPHz

sourcevalue=vo+va*SIN[2**fc*Time+mdi*SIN(2**fs*Time)]

14

2.3.5
VIN

SFFM(0.01

0.4

100MEG

0.3

20k)

8.
AM(sa oc fm fc td)

sa

0.0

oc

0.0

fm

1TSTOPHz

fc

0.0Hz

td

0.0

sourcevalue=sa*{oc+SIN[2**fm*(Time-td)]} *SIN[2**fc*(Time-td)]

2.3.6
15

V3

AM (10

100

1k

1M)

(1) E

EXXX
+

n+

n-

<VCVS>

<SCALE=val>

in+

in-

<TC1=val>

gain

<MAX=val>

<TC2=val>

<MIN=val>

<ABS=1>

<IC=val>
EXXX
+

n+

n-

inndim+

<VCVS>

inndim-

<SCALE=val>

<MIN=val>

EXXX
+

n+

<ABS=1>
n-

in1-

...

<TC2=val>

P0

<VCVS>

<P1...>

PWL(1)

<IC=vals>

in+

in-

<DELTA=val>
<SCALE=val>

x100, y100

EXXX

n+

ink-

<TC1=val>

in1+

<MAX=val>

POLY(NDIM)

ink+

<TC1=val>

n-

<VCVS>

gatetype(k)

<TC1=val>

<TC2=val>

x1, y1,... x100, y100


n+

+ <SCALE=val>

x1, y1, x2, y2...

<IC=val>

<DELTA=val>

EXXX

<TC2=val>

n-

in1-...

<SCALE=val>

<IC=val>

<VCVS>

<TC1=val>

in1+

DELAY

in+

<TC2=val>

in-

TD=val

<NPDELY=val>

(2) F

FXXX
+

n+

n-

<MIN=val>

+ <M=val>
FXXX

n+

+ <MAX=val>

<TC1=val>
+ <M=val>
: FXXX
+

vn1

<SCALE=val>

<M=val>
n-

n+

<CCCS>

<MAX=val>

<TC1=val>

<TC1=val>
<ABS=1>

<CCCS>

<TC2=val>

<IC=val>

POLY(NDIM)

<M=val>
n-

gain

<ABS=1>

<MIN=val>

+ <SCALE=vals>
FXXX

<CCCS>

vn1

<...vnndin>

<TC2=val>
P0

PWL(1)

<P1...> <IC=val>
Vn1

<DELTA=val>

<SCALE=val>

<TC2=val>
x1, y1,... x100, y100
n+

<DELTA=val>

n-

<CCCS>

<IC=val>

gatetype(k)

<SCALE=val>

<TC1=val>

vn1, ..., vnk


<TC2=val>

16

+ <M=val>

<ABS=1>

: FXXX
+

n+

x1, y1, ..., x100, y100

n-

<SCALE=val>

<CCCS>

DELAY

<TC1=val>

vn1

<IC=val>

TD=val

<TC2=val>

NPDELY=val

(3) G

GXXX
+

n+

n-

<VCCS>

<MAX=val>

<MIN=val>

<TC1=val>

GXXX

n+

<VCCS>

<inndim+

+
+

<ABS=1>

POLY(NDIM)

<M=val>

<IC=val>
in1+

in1-

...

<MIN=val>

<SCALE=val>

<M=val>

<TC1=val>

<TC2=val>

<ABS=1>

<P1>

P0

n+

n-

<DELTA=val>

<TC2=val>

<IC=vals>

<VCCS>

PWL(1)

<SCALE=val>

in+

<M=val>

in<TC1=val>

x1, y1, x2, y2 ... x100, y100

<IC=val>

<SMOOTH=val>
n+

n-

<VCCS>

<DELTA=val>

<TC2=val>

<SMOOTH=val >

GXXX

n+

n-

<SCALE=val>

<VCCS>

<DELTA=val>

<TC2=val>

<SMOOTH=val>

GXXX

NPWL(1)

in+

in-

<M=val>

<TC1=val>

x1, y1, x2, y2 ... x100, y100

PPWL(1)

<SCALE=val>

in+

n+

n-

<VCCS>

<IC=val>

in-

<M=val>

<TC1=val>

x1, y1, x2, y2... x100, y100

gatetype(k)

<IC=val>

in1+

in1- ...

ink+ ink-

+ <DELTA=val>

<TC1=val>

<TC2=val>

<M=val> x1, y1, ..., x100, y100

GXXX
+

<SCALE=val>

<MAX=val>

GXXX

transconductance

inndim->

GXXX

in-

<TC2=val>

n-

in+

n+

n-

<SCALE=val>

<VCCS>

DELAY

<TC1=val>

<SCALE=val>
<IC=val>

in+

<TC2=val>

in-

TD=val

NPDELY=val

(4) H

HXXX

n+

<MAX=val>

+ <TC2=val>
:

HXXX

n+

n-

<CCVS>

<MIN=val>
<ABS=1>
n-

vn1

transresistance

<SCALE=val>

<TC1=val>

<IC=val>

<CCVS>

POLY (NDIM)

vn1

17

<...vnndim>

+ <TC2=val>

<MAX=val>

<SCALE=val>

<MIN=val>
<ABS=1>

<TC1=val>

P0

<P1...>

+ <IC=vals>
HXXX
+

n+

n-

<DELTA=val>

<CCVS>

PWL(1)

<SCALE=val>

vn1

<TC1=val>

+ x1, y1, x2, y2 ... , x100, y100


HXXX
+

n+

y100

gatetype(k)

vn1, ..., vnk

<TC1=val>

<TC2=val>

x1, y1, ..., x100,

<IC=val>

HXXX
+

<CCVS>

<IC=val>

<DELTA=val>

+ <SCALE=val>
+

n-

<TC2=val>

n+

n-

<SCALE=val>

<CCVS>

DELAY

<TC1=val>

vn1

<TC2=val>

TD=val
<NPDELY=val>

HSPICEEFGHHSPICE
MOS

HSPICEPOLY(NDIM)
POLY(1)

POLY(2)

POLY(3)

(P0,P1,...,Pn)
POLY(1)
FV=P0+(P1FA)+(P2FA2)+(P3FA3)+(P4FA4)+(P5FA5)+....
POLY(2)
FV=P0+(P1FA)+(P2FB)+(P3FA2)+(P4FAFB)+(P5FB2)+(P6FA3)
+(P7FA2FB)+(P8FAFB2)+(P9FB3)+...
POLY(3)
FV=P0+(P1FA)+(P2FB)+(P3FC)+(P4FA2)+(P5FAFB)+(P6FAFC) +
(P7FB2) +(P8FBFC)+(P9FC2)+(P10FA3)+(P11FA2FB) + (P12FA2FC)
+(P13FAFB2) +(P14FAFBFC)+(P15FAFC2)+(P16FB3) +(P17FB2FC)
+(P18FBFC2) +(P19FC3)+(P20FA4)+...

18

FV:

P0...PN:
FA, FB, FC:

()

DELTA

ABS

ABS=1

DELAY

HPSPICEDELAY

DELTA

DELTA1/4
1/2

HXXX

H15

)
k
(

E15
R
O
N

EXXX

R
O

F15

D
N
A
N

FXXX

D
N
A y
,
x

G15

)
k
(
e
p
y
t
e
t
a
g

GXXX


0
.
0

C
I

S
C
C
V

X
/
A
+
C i
n
M M
I

S
V
C
C

S
V
C
V

S
C
C
C

S
C
C
V

N
I
M

S
V
C
C

S
V
C
V

S
C
C
C

E
C
I
P
S
H

M
I
D
N

M
I
D
N

Y
A
L
M E
I D
- D
/
P
+
N N
n

NPDELAYdefault = max[
S
O
M
N

0
.
0

E
C
I
P
S
H

0
P
1
P
.
.
.
2
P
,
1
P
,
0
P

E
C
I
P
S
H

.
.
.
1
P
,
0
P

N
A
R
T
.

p
o
t
s
e
t
p
e
t
s
t

L
W
P
N

min < TD, tstop >


,10]
tstep

19

.
.
.
1
n
v

S
C
C
V

.
.
.
1
x

S
V
C
V

S
V
C
C

S
C
C
V

S
C
C
C

S
V
C
V

S
V
C
C

E
C
I
P
S
H
S
V
C
C

4
.
2

S
E
M

S
Q O
M

D J

S
C
C
C

.
.
.
1
y

S
V
C
V
n
n
i
i
S
+
+
C
n
n
i
i
C
C
1
1
n
n
v
v
S
x x x x C
C
: : : : : : : : V

E
L
A
C
S

e
c
n
a
t
c
u
d
n
o
c
s
n
D r
a
T t

S
O
M
P

H 2
T C
E O
L L
T
Y
,
L L W A O 1
O W P C M C
P P P S S T

SCALEeff = SCALE (1 + TC1 t + TC2 t 2 )

>
>
>
>
F
l
a
F
F
> F
v
l
O
_
a
O
> <
v
y
l
r
= <
a
e
J
v
h
P
>
= l
p
< >
i
a
L v
l
r
a
e
< =
v
p
> =
<
M
l
l
a
> L
M
a
v
l
v
a
<
= L
_
v
a
A <
=
>
e
l
E
r
>
W
a
a
l
R
>
v
a
<
l
A a
= <
v
P
< v
=
= M e
e
m M
m
e M E a
a W
m W T n
> n
<
l
D
a
<
m
m
a
n
<
v
m
=
>
l
> > s M s a
l
u
u
v
l
a
<
s v
n
n
a
=
i
u
= v i
P
m
n
i
P = m
L
m
L M n > n <
d
n <
v
<
s
s
=
u
>
C u l
l
l
s > > p
I
p
a
u
l
<
n
n
d
l
v
a
p
v
=
v
n
= =
P
> X W
P C X F
I
X F X <
X W <
X
X O
X <
D < D +
X
D + +
:
+

20

>
l
a
v
=
P
M
E
T
D
<

>
l
a
v
=
M
<

>
d
v
=
C
I
<

L
E
V
1 E
L
L
E
V
E
L 0
.
1

:
A
R
E
A

0
J
C

S
J
R
K
I
K
I

A
E S
R R
A

E
L
A
C
S

AREA eff = AREA * M * SCALE 2 * SHRINK 2


L


0
.
0

:
P
M
E
T
D

A
E
R
A

AREA eff = Weff * L eff * M


d
v

:
d
v
=
C
I

C
5 I
1

:
X
X
X
D

0
.
0

3
l
e
v
e
l

3
l
e
v
e
l

:
M
: L
L

d
v
=
C
I

C
I
.

C
I
U

N
A
R
T
.

C
I

0
.
0

3
l
e
v
e
l

:
P
L

LM eff = LM * SCALE * SHRINK

:
M

LPeff = LP * SCALE * SHRINK


1

6
1

:
e
m
a
n
m

6
1

:
s
u
n
i
m
n
/
s
u
l
p
n


N
O

0
.
0

1
=
L
E
V
E
L

P
J
C

W
S
J

N
P

:
F
:
F J
O P

PJ eff = PJ * M
PJ eff = PJ * SCALE * M * SHRINK
PJ eff = (2 * Weff + 2L eff ) * M

2
=
L
E
V
E
L

3
l
e
v
e
l

:
W

0
.
0

3
l
e
v
e
l

:
M
W

Weff = W * SCALE * SHRINK + XWeff

0
.
0

3
l
e
v
e
l

:
P
W

WM eff = WM * SCALE * SHRINK

E
C
I
P
S
H

WPeff = WP * SCALE * SHRINK


N
P

21

P
M
M
M
L
C
D

1
.
4
.
2

5
1

=
K
L
U
B

A
E
R
A

C
N I
O U

N
A
R
T
.

Vc

C
I
.

0
.
0

:
A
E
R
A

Vb

:
M

:
P
M
E
T
D

: :
l
F
a
v
F
:
a
l
O a
v
e
c
v
,
l
a
v
e
b
v
=
C
I

>
l
a
v
=
E
C
V
<

: : : :
b
e
c
s
:
n
n
n
n
e
m
a
n
m

>
l
a
v
=
E
B
V
<
>
F
F >
O a
l
< v
=
P
M
E
T
D
<
>
l
a
v
=
C
A
E
R
A
<

>
l
a
v
=
M
<
+ +

:
X
X
X
Q

>
l
> > a
F l
v
F a
=
v
O =
A
< P
E
M R
E A
> T <
l
D
a
v
<
a
e
<
m
> a
l
n
a
e v m
m = >
a M s
n
n
m < <
> l
>
s
a e
n
< v n
e
c
v
,
>
b l
e l
a
n
n
a
v
v
e
=
b b c B
v
n
= n A
C
E
I
c < X R
n
X A
X
X <
X
X + Q +
Q

2
.
0
=
C
I
3
1
D
E O
D M
O D
I
D
e
t
a
r
t
s
b
7 u
s
6 3
E
G
D
I
R
B
D

:
B
E
R
A

:
C
E
R
A

22

2
.
4
.
2

0
.
5

>
l
a
v
s
d
v
=
S
D
V
<

5
1

A
T
E
B

D
R

S
G
C
f
f
Le
S
I
f
S
R Wef

D
G
C

A
E
R
A

5
.
2
=
B
A
E
R
A
5
.
1
=
A
E
R
A

>
l
a
v
=
P
M
E
T
D
<

T
E
F
S
E
M

T
E
F
J

:
A
E
R
A

ACM = 0

L eff

Weff

AREA =

,
6
.
D
0
= O
C M
I

T
E
F
S
E
M
T
E
F
J

: : : :
g
d
b
s
:
n
n
n
n
e
m
a
n
m

P
N
P
Q

>
F
F >
O l
a
< v
s
g
v
=
S
G
V
<
>
l
a
v
=
M
<

+ +

:
X
X
X
J

X
E

T
E
F
S
E
M

>
l
a
v
=
L
>
l
l
a
a
v
v
=
=
L
W
|
l > >
a
l
l
a
v
a
v
= =
v
=
W P
A
| M
A
E
E E R
R T A
A D <
< < <
> e
e l
a m
m v
a
a =
n
n
m M m
> <
b
n
> s
< l
n
a
v
s
g
g
s v
n
n
,
l
a
v
d
g s
n
d n
v
=
d I
C X
n
X
X < X
X > J
X F
J F
O
<

X
B .
0
3
=
C
A
X E
C R
A

0
D 2
O
M 4
Q
5
6
2 2
1
1
8 1
1
0
1
A
0
6 5
2
Q Q

8
0
1
Q
:

AREA = Weff * L eff ACM = 1

AREA eff = M * AREA

23

0
.
1

0
.
0

l
e
d
o
m
j
n
o
m
m
o
c
e
v
i
r
d
g

s
n

>
b
n
<

.
.
.
l
a
v
w
l
a
v
l
e
m
a
n
m

s
n
g
n

>
b
n
<

l
a
v
l
l
a
v
w
e
m
a
n
m

5
1

K
L
U
B

T
E
F
S
O
M

:
b
: n
d
n
,
s
n
,
g
n

N
O

C
I
U

N
A
R
T
.

1
M
J

T
E
F
S
O
T M
E
F
S
O
M

Vg
s

3
.
4
.
2

d
n

X
X
X
M

:
X
X
X
M

Vd
T
E
F
J

2 d
a
o
l
4 x

g
n
L
d W
n
N
O
I
T
P
O
.
X
X
X
M

T
E
F

>
>
l
l
a
a
v
v
=
=
D
O
> R
E
l
N
a
G
v
= < > <
W
F >
>
F l
< a
l
a
O v
v
= < =
S
P
> P
M
l
< > E
l
a
a
v
v
T
= > =
D
L l
C <
< v
a S
= R
e D <
>
m P
l
>
a < l
a
n
v
a
m l
=
v
> =
M
> v
a C
b
n
= D <
< S
R
>
A <
> a
l
s
v
b
s <
v
=
n
> s
,
O
> l
a
g
l
T
g a v v V
,
v
=
s
n
= S
L
d
D R v
E
= D
A N C
d <
<
< I
n
<
X
X
X + + + +
M

7
s
e
6 m
J
j

Weff = W * SCALE + WDELeff

:
l
a
v
=
L
,
l
a
v
=
W

S
O
M
.

L eff = L * SCALE + LDELeff


:
: :
l
F
a
P
F : v
M
l
O a
=
E
v
M
s
T
g
D
v
,
l
a
v
s
d
v
=
C
I

T
E
F
S
O
M

:
e
m
a
n
m

24

L
F
E
D

T
E
F
S
O
M

W
F
E
D

T
E
F
S
O
M

:
:
:
: : D
:
: : C
S
D
L
S
W
D
S :
A
A
P
P
R R D
N N R

:
C
S
R

N
O

:
F
F
O

T
E
F
S
O
M

: : :
s
s
s
:
g
d
b
P
v
v
v
M
E
T
D

0
.
1

T
E
F
S
O
M

T
E
F
S
O
M

:
M

T
E
F
S
O
M

T
E
F
S
O
M

0
.
0

3
=
M
C
A

:
O
E
G

0
.
0

:
O
T
V
L
E
T
D E
F
S
O
M

24

M1

T
E
F
S
O
M
4
.
4
.
2

20

TYPE1

M31

17

10

MODM

L=0.5U

M31

17

10

MODM

0.5U

.OPTION

W=2U
2U

WL

25

M31

17

M1

AS=100P

M1

10

MODM

MOD1

L=10U

PD=40P
3

0.8U
w=5U

5U
AD=100P

PS=40U
MOD1

10U

5U

2P

2P

2.5 .SUBCKT.MACRO
HSPICEHSPICE
.SUBCKT .MACRO
.ENDSX
.
:

.SUBCKT
.MACRO

subnam
subnam

n1 <n22
n1

<n2

n3 . . . >
n3 . . . >

<parnam=val . . . >
<parnam=val . . . >

subnam

n1

:
1

( 0 )

MOSFET BJT BLUK

3 .GLOBAL
MODEL
parnam

.
.ENDS

.EOM

< SUBNAM >


< SUBNAM >

SUBNAM
.ENDS .EOM
.ENDS .EOM
.
:

Xyyy

n1 < n2

n3 . . . >

subnam

< parnam=val . . . >


26

<M=val>

:
XYYY

X15

n1...

subnam

parnam

SUBCKT
:
*FILE SUB2.SP TEST OF SUBCIRCUITS
.OPTIONS LIST ACCT
*
.PARAM p5=5 p2=10
*
.SUBCKT SUB1 1 2 p4=4
R1 1 0 p4
R2 2 0 p5
X1 1 2 SUB2 p6=7
X2 1 2 SUB2
.ENDS
*
.MACRO SUB2 1 2 p6=11
R1 1 2 p6
R2 2 0 p2
.EOM
*
X1 1 2 SUB1 p4=6
X2 3 4 SUB1 p6=15
X3 3 4 SUB2
.MODEL DA D CJA=CAJA CJP=CAJP VRB=-20 IS=7.62E-18
+ PHI= .5 EXA= .5 EXP= .33
*
.PARAM CAJA=2.535E-16 CAJP=2.53E-16
.END

2.6

(.MODEL)

HSPICE

.MODEL
mname type < prame1=val1 pname2=val2 . . . >

mname

27

type

AMP:

C:

CORE:

D:

L:

NJF:
nJFET
NMOS:
nMOSFET
NPN:
npn
OPT:

PJF:
pJFET
PLOT :
.GRAPH
PMOS:
pMOSFET
PNP:
pnp
R :

pname1

+
.MODEL MOD1 NPN BF = 50 IS = 1E-13 VBF = 50 AREA = 2
+ PJ = 3 N = 1.05

2.7

(.LIB)

HSPICE
HSPICE(.MODEL)(.ENDS)
(.LIB)
HSPICE
.ENDL
.
:

.LIB
.LIB

<

filepath

libnumber

>

f ilename

entryname

entryname

:
filepath

HSPICE
../

filename

256

entryname

libnumber
1189
UNIXUNIX914
:

.LIB MODELS cmos1


.LIB ../sum/MODELS
.LIB
14
lm 101

cmos1

28

.:
1. .ALTER
2.
3.
4. END
5. .INCLUDE .LIB .ALTER
.LIB.MODE L
.LIB entyname .ENDL entyname

29

Monte CarloWAST CASE


HSPICEHSPICE
.

3.1

.
1. .OP
.OPHSPECE.OP

HSPICE
.OP
.OP < format > < time > < forme > < time >

format

ALL
ALL

BRIEF

mA mw
CURRENT

DEBUG

NOTE


VOLTAGE

time
AllVoltageCurrentDEBUG

1.OP .5NS CUR 10NS VOL 17.5NS 20NS 25NS


10.5ns10 ns
17.5 ns20ns25 ns
2
.OP

Example Output
***** OPERATING POINT INFORMATION TNOM= 25.000 TEMP=

30

25.000
***** OPERATING POINT STATUS IS ALL SIMULATION TIME IS 0.
NODE VOLTAGE NODE VOLTAGE NODE VOLTAGE
+ 0:2 = 0. 0:3 = 437.3258M 0:4 = 455.1343M
+ 0:5 = 478.6763M 0:6 = 496.4858M 0:7 = 537.8452M
+ 0:8 = 555.6659M 0:10 = 5.0000 0:11 = 234.3306M
**** VOLTAGE SOURCES
SUBCKT
ELEMENT 0:VNCE 0:VN7 0:VPCE 0:VP7
VOLTS 0. 5.00000 0. -5.00000
AMPS -2.07407U -405.41294P 2.07407U 405.41294P
POWER 0. 2.02706N 0. 2.02706N
TOTAL VOLTAGE SOURCE POWER DISSIPATION = 4.0541 N WATTS
**** BIPOLAR JUNCTION TRANSISTORS
SUBCKT
ELEMENT 0:QN1 0:QN2 0:QN3 0:QN4
MODEL 0:N1 0:N1 0:N1 0:N1
IB 999.99912N 2.00000U 5.00000U 10.00000U
IC -987.65345N -1.97530U -4.93827U -9.87654U
VBE 437.32588M 455.13437M 478.67632M 496.48580M
VCE 437.32588M 17.80849M 23.54195M 17.80948M
VBC 437.32588M 455.13437M 478.67632M 496.48580M
VS 0. 0. 0. 0.
POWER 5.39908N 875.09107N 2.27712U 4.78896U
BETAD-987.65432M -987.65432M -987.65432M - 987.65432M
GM 0. 0. 0. 0.
RPI 2.0810E+06 1.0405E+06 416.20796K 208.10396K
RX 250.00000M 250.00000M 250.00000M 250.00000M
RO 2.0810E+06 1.0405E+06 416.20796K 208.10396K
CPI 1.43092N 1.44033N 1.45279N 1.46225N
CMU 954.16927P 960.66843P 969.64689P 977.06866P
CBX 0. 0. 0. 0.
CCS 800.00000P 800.00000P 800.00000P 800.00000P
BETAAC 0. 0. 0. 0.
FT 0. 0. 0. 0.
2..DC
.DC

a.
b.
31

c.
d.
e.
f.
.DC
(1)
.DC var1 START=start1 STOP=stop1 STEP=incr1
.DC var1 START=<param-expr1>
STOP =<param-expr2>
+ STEP=< param-expr3>
.DC var1 start1 stop1 incr1 <SWEEP var2 type np
start2 stop2>
.DC var1 start1 stop1 incr1 < var2 start2 stop2 incr2>
(2)
.DC var1 type np start1 stop1
<SWEEP DATA=datanm>
.DC DATA=datanm <SWEEP var2 start2 stop2 incr2>
.DC DATA=datanm
(3)
.DC var1 type
.DC MONTE=val

np

start1

stop1

<SWEEP

MONTE=val>

(4)
.DC DATA=datannm OPTIMIZE=opt_par_fun
+ RESULTS=measnames MODEL=optmod

.DC var1 start1 stop1 SWEEP OPTIMIZE=OPT


+ RESULTS=measnames MODEL=optmod

DATA=datanm
incr1
MODEL

.DATA

.MODEL OPT

MODEL=val

np

OPTIMIZE
.PARAM
RESULTS
.MEASURE
start1

stop1

typePOIstartstop
SWEEP
DECOCTLIN
POIDATAMONTE=val

TEMP

type

DEC

OCT

LIN
32

var1

POI

TEMP

The following example causes the value of the voltage source VIN to be swept
from 0.25 volts to 5.0 volts in increments of 0.25 volts.
.DC VIN 0.25 5.0 0.25
The following example invokes a sweep of the drain to source voltage from 0 to
10 V in 0.5 V increments at VGS values of 0, 1, 2, 3, 4, and 5 V.
.DC VDS 0 10 0.5 VGS 0 5 1
The following example asks for a DC analysis of the circuit from -55 to 125
in 10 increments.
.DC TEMP -55 125 10
8-6 Star-Hspice Manual, Release 1998.2

As a result of the following script, a DC analysis is conducted at five


temperatures: 0, 30, 50, 100 and 125.
.DC TEMP POI 5 0 30 50 100 125
In the following example, a DC analysis is performed on the circuit at each
temperature value, which results from a linear temperature sweep from 25 to
125 (five points), sweeping a resistor value called xval from 1 k to 10 k in
0.5 k increments.
.DC xval 1k 10k .5k SWEEP TEMP LIN 5 25 125
The example below specifies a sweep of the value par1 from 1 k to 100 k by 10
points per decade.
.DC DATA=datanm SWEEP par1 DEC 10 1k 100k
The next example also requests a DC analysis at specified parameters in the
.DATA statement referenced by the .DATA statement reference name datanm.
Parameter par1 also is swept from 1k to 100k by 10 points per decade.
.DC par1 DEC 10 1k 100k SWEEP DATA=datanm
The final example invokes a DC sweep of the parameter par1 from 1k to 100k
by 10 points per decade, using 30 randomly generated (Monte Carlo) values.
.DC par1 DEC 10 1k 100k SWEEP MONTE=30

33

Schmitt Trigger Example


*file: bjtschmt.sp bipolar schmitt trigger
.options post=2
vcc 6 0 dc 12
vin 1 0 dc 0 pwl(0,0 2.5u,12 5u,0)
cb1 2 4 .1pf
rc1 6 2 1k
rc2 6 5 1k
rb1 2 4 5.6k
rb2 4 0 4.7k
re 3 0 .47k
*
diode 0 1 dmod
q1 2 1 3 bmod 1 ic=0,8
q2 5 4 3 bmod 1 ic=.5,0.2
*
.dc vin 0,12,.1
*
.model dmod d is=1e-15 rs=10
.model bmod npn is=1e-15 bf=80 tf=1n
+ cjc=2pf cje=1pf rc=50 rb=100 vaf=200
.plot v(1) v(5)
.graph dc model=schmittplot input=v(1) output=v(5) 4.0 5.0
.model schmittplot plot xscal=1 yscal=1 xmin=.5u xmax=1.2u
.end

3..SENS
.SENSHSPICE

100HSPICE

.SENS.SENSHSPICE
.SENS
.SENS ov1 <ov2...>

ov1 ov2
SENS

V(9)

V(4,3)

V(17)

I(Vcc)

4..TF
.TF
.TF.TFHSPICE
.TF
34

.TF V(5,3)
VIN
.TF I(VLOAD) IN
HSPICEV(5,3)VINVIN5
3
5..PZ
HSPICEpole/zero

N ( s ) a 0 s m + a1 s ( m 1 ) + ... + a m
H (S ) =
=
D (s)
b0 s n + b1 s ( n 1 ) + ... + bn
n(s)N(s)d(x)D(s)H(s)
Pj(j=1,2,...,m)H(s)
Zi(i=1,2,...,m)

H ( s) =

a 0 ( s + z1 )( s + z 2 )...( s + zi )...( s + z m )

b0 ( s + p1 )( s + p2 )...( s + p j )...( s + pm )

.PZ.PZ output input

PZ
/
input
output V(n)I(element name)

.PZ V(10) VIN


.PZ I(RL) ISORC
.PZ L1(M1) VSRC

.
1..AC
HSPICE
HSPICEHSPICE
YC=jwCYL=1/jwL
HSPICEAC=<value>

a
b
c
d
e
f
35

.AC
1/
.AC type np fstart fstop
.AC type np fstart fstop <SWEEP var start stop incr>
.AC type np fstart fstop <SWEEP var type np start stop>
.AC var1 START=<param_expr1> STOP=<param_expr2>
+
STEP=<param_expr3>
.AC var1 START=start1 STOP=stop1 STEP=incr1
2
.AC type np fstart
.AC DATA=datanm

fstop

<SWEEP DATA=datanm>

3
.AC DATA=datanm OPTIMIZE=opt_par_fun
+ RESULTS=measnames MODEL=optmod
4/
.AC type np fstart

fstop

<SWEEP MONTE=val>

DATA=datanm
.AC
incr

typenpincr
fstart

fstop

POIfstart
stop
MONTE=val

np

start

stop

SWEEP .AC
TEMP
type

DEC
OCT
LIN
POI
var

TEMP

The following example performs a frequency sweep by 10 points per decade from 1 kHz to
100 Mhz.
.AC DEC 10 1K 100MEG
The next line calls for a 100 point frequency sweep from 1Hz to 100 Hz.
.AC LIN 100 1 100HZ
36

The following example performs an AC analysis for each value of cload,which results from
a linear sweep of cload between 1 pF and 10 pF(20 points),sweeping frequency by 10 points
per decade from 1Hz to 10 kHz.
.AC DEC 10 1
10K SWEEP cload LIN 20 1pf
10pf
The following example performs an AC analysis for each value of rx,5 k and 15 k,sweeping
frequency by 10 points per decade from 1Hz to 10 kHz.
.AC DEC 10 1 10K SWEEP rx POI 2 5k 15k
The next example uses the DATA statement to perform a series of AC analyses modifying
more than one parameter.The parameters are contained in the file datanm.
.AC DEC 10 1 10K SWEEP DATA=datanm
The following example illustrates a frequency sweep along with a Monte Carlo analysis
with 30 trials.
.AC DEC 10 1 10K SWEEP MONTE=30

VI INPUT GND AC 1VHSPICE


HSPICE
2..DISTO
.DISTOHSPICE
DIM2DIM3HD2
HD3SIM2F1
.AC
F2skw2skw2=F2/F1
.DISTO
1DIM2

F1F2

2DIM3

2*F1F2
3HD2
F22*F1

4HD3
F23*F1

5SIM2
F1+F2

.DISTO Rload <inter<skw2<refpwr<spwf>>>>

Rload

nter

.PRINT.PLOT
11

inter .AC

inter.AC
skw2 F2F1
1e-3<skw2<0.999skw20.9(F2=0.9*F1)
37

refpwr ,1mw
spwf F21e-31.0
.DISTO

RL

0.95

1.0E-3

0.75

.DISTOHSPICE .DISTO
3..NOISE
AC

RMS(root-mean-square)
n

onoise = Z n I n

n =1

:
onoise
I

n
MOSFETJFETBJT

()
V/ Hz
A/ Hz KFAF
.NOISEinter
.PRINT.PLOT
.NOISE.NOISEHSPISE
.NOISE.NOISE.AC
.NOISE ovv srcnam inter
:
ovv

srcnam
inter

11

.NOISE

V(5)

VIN

10

3..SAMPLE
HSPISE.SAMPLE
.AC.SAMPLEHSPISE

.SAMPLE FS=freg<TOL=val> <NUMF=val> <MAXFLD=val>


+ <BETA=val>
:
FS=freg
Hz
TOL

1.0e-3
NUMF

10
100
38

MAXFLD

FMAX=MAXFLD.FS
BETA

100

BETA=0BETA=1

4..NET
.NETHSPICE(Z)(Y)
(H)(S)
.NET.AC

.NET input <RIN=val>


.NET input <val>

.NET output input <ROUT=val> <RIN=val>

input

output V(n1,n2),
I(source) I(element)
RIN
RIN
RIN1
ROUT ROUT
ROUT
1

.NET VINAC RIN=50


.NET IIN
RIN=50

.NET V(10,30) VINAC ROUT=75 RIN=50


.NET I(RX) VINAC ROUT=75 RIN=50
.
1..TRAN
HSPICE
.TRANUIC.TRAN
.IC

.TRAN 1ns 100ns UIC


.op 20ns
.TRANUIC.IC
.OP
t=0t=20ns.OP
internal timestep too small

.TRAN TSTEP TSTOP <TSTART> <UIC>


TSTEPTSTOP
TSTARTTSTARTHSPICE0.0
39

TSTART()
TSTARTTSTOP
HSPICE
(1)
.TRAN var1 START=start1 STOP=stop1 STEP=incr1
.TRAN var1 START=<param_expr1> STOP=<param_expr2>
+ STEP=<param_expr3>
(2)
.TRAN var1 START=start1 STOP=stop1 STEP=incr1
+ <SWEEP var2 type np start2 stop2>
.TRAN tincr1 tstop1 <tincr2 tstop2tincrN tstopN>
+ <START=val> <UIC> <SWEEP var pstart pstop pincr>
(3)
.TRAN tincr1 tstop1
+ <START=val> <UIC>

<tincr2

tstop2tincrN

tstopN>

(4)
.TRAN DATA=datanm
.TRAN var1 START=start1 STOP=stop1 STEP=incr1

+ <SWEEP DATA=datanm>
.TRAN DATA=datanm <SWEEP var pstart pstop pincr>
(5)
.TRAN tincr1 tstop1 <tincr2 tstop2tincrN
+ <START=val> <UIC> <SWEEP MONTE=val>

tstopN>

(6)
.TRAN DATA=datanm OPTIMIZE=opt_par_fun RESULTS=measnames
+ MODEL=optmode

DATA=datanm .TRAN
MONTE=val

np

param_exp...
param_exp1... param_expN
pincr

typenp
pincr
pstart

pstop

POI
pstartpstop
START
.TRAN
.MEASURESTART
0.MEASURE

SWEEP
.TRAN
tincr1...

40

tstop1...
type

UIC

var

DEC (
)
OCT ()
LIN ()
POI ()
.TRANUICHSPICE
.ICIC=
,

TEMP

The following example performs and prints the transient analysis every 1ns for 100ns.
.TRAN 1NS 100NS
The following example performs the calculation every 0.1ns for the first 25ns, and then
every 1ns until 40ns; the printing and plotting begin at 10ns.
.TRAN .1NS 25NS 1NS 40NS START=10NS
The following example performas the calculation every 10ns for 1us; the initial DC
operating point calculation is bypassed, and the nodal voltages specified in the .IC
statement (or by IC parameters in element statements) are used to calculate initial
conditions.
.TRAN 10NS 1US UIC
The following example increases the temperature by 10C through the range -55C to 75C
and performs transient analysis for each temperature.
.TRAN 10NS 1US UIC SWEEP TEMP -55 75 10
The following performs an analysis for each load parameter value at 1pF,5pF, and 10pF.
.TRAN 10NS 1US SWEEP load POI 3 1pF 5pF 10pF
2. (Fourier) .FOUR
HSPICEtstopfperiod tstop
tstop .TRANfperiod
TSTOP
TSTOP(TSTOP1/fperiod)=1/fperiod 1 /
fperiodDC29
.OPTION DELMAX period / 100
Q DELMAX period /100

.FOUR freq ov1 <ov2 ov3 >



freq

ov1 (
.FOUR

100K

V(5)

3.2

()

41

IC= .IC .DCVOLT


.NODESET
..IC.DCVOLT
.IC.DCVOLT.TRAN
UIC
1..TRANUICHSPICE .IC
IC
IC=IC=.IC
.IC

2..TRANUICHSPICE.IC

.IC V(node1) = val1 V(node2)= val2 ...

.DCVOLT V(node1) = val1 V(node2) = val2...



val1...
.TRAN
UIC
node1...

.IC V(11) = 5
.DCVOLT 11 5

v(4) = -5 V(2) = 2.2


4 -5 2 2.2

..NODESET
.NODESET
HSPICE
.NODESET

NODESET

.NODESET V(node1) = val1 <V(node2) = val2...>


.NODESET node1 val1 <node2 val2...>

node1:
.NODESET
.NODESET
.NODESET

V (5: SETX) = 3.5v V(X1.X2.VINT) = 1v


V (12) = 4.5 V(4) = 2.23
12 4.5 4 2.33 1 1

IC = ....IC.NODESET
HSPICE(1) IC = ... (2) .IC
(3) .NODESET.IC.NODESET.IC.NODESET

3.3

42

(worst case)
HSPICE
MONTE CARLO.MC

(1)
(2)
(3)
.DC.AC.TRANMONTE

1
.DC MONTE=val
2
.DC vin 15
.25 SWEEP MONTE=val
3
.AC dec 10 100 10meg
SWEEP MONTE=val
4
.TRAN 1n 10n SWEEP MONTE=val
val3030
80
99
.
MOS
/-2 /-3
FastSlowFFSSFS

. .TEMP
.TEMPHSPICE
1.MODELTREF
2.TEMPTEMP
DTEMPTNOM

3DTEMP
HSPICE.TEMP.DC.AC.TRANTEMP
.TEMPTEMPTNOMTNOM.OPTION
0

25 C

43

.TEMP t1 < t 2 < t 3 ... >>

t1 , t 2 ...

HSPICE

.TEMP 55.0 25.0 125.0


The .TEMP statement sets the circuit temperatures for entire circuit simulation.HSPICE
uses the temperature set in the .TEMP statement along with the TNOM option setting (or
theTREE model parameter) and the DTEMP element temperature,and simulates the circuit
with with individual elements or model temperature.
.TEMP 100
D1 N1 N2 DMOD DTEMP=30
D2 NA NC DMOD
R1 NP NN 100 DTEMP =-30
.MODEL DMOD D IS=1E-1.5

VJ=0.6

CJA=1.2E-13

CJP=1.3E-14

TREF=60.0
0

From the .TEMP statement ,the circuit simulation temperature is given as 100 C.Since
o

TNOM is not specified,it defaults to 25 C .the temperature of the diode is given as

30 0 C above the circuit temperature by the DTEMP parameter.That is,


0
0
0
0
D1temp= 100 C + 30 C = 130 C .the diode,D2,is simulated at 100 C .R1 is simulated at
70 0 C .Since TREE is specified at 60 0 C in the diode model statement,the diode model
0
0
0
parameters given are derated by 70 C ( 130 C - 60 C ) fordiode D1 and by
40 0 C ( 100 0 C - 60 0 C ) for diode D2. The value of R1 is derated by 45 0 C ( 70 0 C
-TNOM).
..PARAM
.PARAMHSPICE
.PARAM

.PARAM xx=UNIF(nominal_val , rel_variation <,multiplier>)

.PARAM xx=AUNIF(nominal_val , abs_variation <,multiplier>)

.PARAM xx=GAUSS(nominal_val , rel_variation , sigma


+ <,multiplier>)

.PARAM xx=AGAUSS(nominal_val , abs_variation , sigma


<,multiplier>)

.PARAM xx=AUNIF(nominal_val , abs_variation)

xx

UNIF

AUNIF

GAUSS

AGAUSS

LIMIT
01
1
nominal_val

abs_variation AUNIFAGAUSS+/-

rel_variation UNIFGAUSS+/44

sigma
multiplier

(nominal_val.rel_variation)

1
3.4

HSPICE
HSPICE
.
1. ALTER
.ALTER
.ALTER.PRINT.PLOT.GRAPHI/O
.DC.AC.OP.TRAN.FOUR.DISTO.PZ.TF .ALTER
.DATA.DEL LIB.INCLUDE.IC
.NODESET.LIB.MODEL.OPTION.PARAM.TEMP

.ALTER < title_string >


title_string 72
.ALTER

Example 1
FILE1: ALTER1 TEST CMOS INVERTER
.OPTIONS ACCT LIST
.TEMP 125
.PARAM WVAL=15U VDD=5
*
.OP
.DC VIN 0 5 0.1
.PLOT DC V(3) V(2)
*
VDD 1 0 VDD
VIN 2 0
*
M1 3 2 1 1 P 6U 15U
M2 3 2 0 0 N 6U W=WVAL
*
.LIB 'MOS.LIB' NORMAL
.ALTER
.DEL LIB 'MOS.LIB' NORMAL $removes LIB from memory
$PROTECTION

45

.PROT $protect statements below .PROT


.LIB 'MOS.LIB' FAST $get fast model library
.UNPROT
.ALTER
.OPTIONS NOMOD OPTS $suppress model parameters printing
* and print the option summary
.TEMP -50 0 50 $run with different temperatures
.PARAM WVAL=100U VDD=5.5 $change the parameters
VDD 1 0 5.5 $using VDD 1 0 5.5 to change the
$power supply VDD value doesn't
$work
VIN 2 0 PWL 0NS 0 2NS 5 4NS 0 5NS 5
$change the input source
.OP VOL $node voltage table of operating
$points
.TRAN 1NS 5NS $run with transient also
M2 3 2 0 0 N 6U WVAL $change channel width
.MEAS SW2 TRIG V(3) VAL=2.5 RISE=1 TARG V(3)
+ VAL=VDD CROSS=2 $measure output
*
.END
Example 1 calculates a DC transfer function for a CMOS inverter. The device is
first simulated using the inverter model NORMAL from the MOS.LIB library.
By using the .ALTER block and the .LIB command, a faster CMOS inverter,
FAST, is substituted for NORMAL and the circuit is resimulated. With the
second .ALTER block, DC transfer analysis simulations are executed at three
different temperatures and with an n-channel width of 100 m instead of 15 m.
A transient analysis also is conducted in the second .ALTER block, so that the
rise time of the inverter can be measured (using the .MEASURE statement).

Example 2
FILE2: ALTER2.SP CMOS INVERTER USING SUBCIRCUIT
.OPTIONS LIST ACCT
.MACRO INV 1 2 3
M1 3 2 1 1 P 6U 15U
M2 3 2 0 0 N 6U 8U
.LIB 'MOS.LIB' NORMAL
.EOM INV
XINV 1 2 3 INV
46

VDD 1 0 5
VIN 2 0
.DC VIN 0 5 0. 1
.PLOT V(3) V(2)
.ALTER
.DEL LIB 'MOS.LIB' NORMAL
.TF V(3) VIN $DC small-signal transfer function
*
.MACRO INV 1 2 3 $change data within subcircuit def
M1 4 2 1 1 P 100U 100U $change channel length,width,also
$topology
M2 4 2 0 0 N 6U 8U $change topology
R4 4 3 100 $add the new element
C3 3 0 10P $add the new element
.LIB 'MOS.LIB' SLOW $set slow model library
$.INC 'MOS2.DAT' $not allowed to be used inside
$subcircuit allowed outside
$subcircuit
.EOM INV
*
.END
In Example 2, the .ALTER block adds a resistor and capacitor network to the
circuit. The network is connected to the output of the inverter and a DC small-signal
transfer function is simulated.
2.

.DATA
.DATA

.DATA
. DATA
.DATA
1inline .DATA
inline .DATA .DATA
.DATA datanm pnam1 <pnam2 pnam3pnamxxx>
+ pval1 < pval2 pval3 pval>
+ pval1<pval2 pval3pvalxxx>
.ENDDATA

datanm .TRAN .DC .AC


pnami
.PARAM
pvali

.ALTER

47

.TRAN 1n 100n SWEEP DATA=devinf


.AC DEC 10 1hz 10khz SWEEP DATA=devinf
.DC TEMP -55 125 10 SWEEP DATA=devinf
.DATA devinf width length thresh cap
+ 50u 30u 1.2v 1.2pf
+ 25u 15u 1.0v 0.8pf
+ 5u 2u 0.7v 0.6pf
+ ... ... ... ...
.ENDDATA
Hspice performs the above analyses for each set of parameter values
defined in the .DATA statement. For example, the program first takes the
width=50u, length=30u, thresh=1.2v, and cap=1.2pf parameters and performs
.TRAN, .AC and .DC analyses. The analyses are then repeated for width=25u,
length=15u, thresh=1.0v, and cap=0.8pf, and again for the values on each
subsequent line in the .DATA block.
2Concatenated .DATA File
Concatenated .DATA File
A, B, C
A
B
C
a a a
b b b
c c c
a a a
b b b
c c c
a a a

a a a
a a a
a a a
b b b
b b b
c c c
c c c
: .DATA dataname MER
FILE=file1 p1=1 p2=3 p3=4 p4=4
<FILE=lile2> p1=1
<FILE=lile3>
<FILE=fileout>
<OUT=fileout>
.END DATA
dataname .DC.AC .TRANMERHSPICE
Concatenated .DATA
3Column Laminated .DATA
Column Laminated .DATA
D E F
D
E
F
d1 d2 d3
e4 e5
f6
d1 d2 d3
e4 e5
f6
d1 d2 d3
e4 e5
f6
48


d1 d2 d3 e4 e5 f6
d1 d2 d3 e4 e5 f6
d1 d2 d3 e4 e5 f6
.DATA dataname LAM
FILE=file p1=1 p2=2 p3=3
<FILE=file> p4=1 p5=2
<FILE=file3> p6=1
<OUT=fileout>
.ENDDATA
LAMHSPICEColum Laminated .DATA
10
3. .OPTIONS
/

.OPTIONS opt1 <opt2 opt3>


: opt1<opt>=x,<opt>,
x
.OPTIONS

. OPTIONS RELTOL=0.05 NOPAGE NOECHO DEFL=12U


+ DEFW=5U DEFAD=150P DEFAS=150P
.OPTIONS

ACCT

LIST

ITL1=60

.OPTIONS

DISTRIBUTION=GAUSS

.
HSPICE
1..PRINT
.PRINT

.PRINT antype ov1 <ov2ov32>


:
antype: : DC ACTRAN
NOISEDISTO
ov1

.PRINT32

.PRINT TRAN V(4) I(VIN) PAR(`V(OUT)/V(IN)')


This example prints out the results of a transient analysis for the nodal voltage
named 4 and the current through the voltage source named VIN. The ratio of the
nodal voltage at node OUT and node IN is also printed.
.PRINT AC VM(4,2) VR(7) VP(8,3) II(R1)
VM(4,2) specifies that the AC magnitude of the voltage difference (or the
49

difference of the voltage magnitudes, depending on the value of the ACOUT


option) between nodes 4 and 2 is printed. VR(7) specifies that the real part of the
AC voltage between nodes 7 and ground is printed. VP(8,3) specifies that the
phase of the voltage difference between nodes 8 and 3 (or the difference of the
phase of voltage at node 8 and voltage at node 3 depending on the value of
ACOUT options) is printed. II(R1) specifies that the imaginary part of the
current through R1 is printed.
.PRINT AC ZIN YOUT(P) S11(DB) S12(M) Z11(R)
The above example specifies that the magnitude of the input impedance, the
phase of the output admittance, and several S and Z parameters are to be printed.
This statement would accompany a network analysis using the .AC and .NET
analysis statements.
.PRINT DC V(2) I(VSRC) V(23,17) I1(R1) I1(M1)
This example specifies that the DC analysis results are tprinted for several
different nodal voltages and currents through the resistor named R1, the voltage
source named VSRC, and the drain- to-source current of the MOSFET
named M1.
.PRINT NOISE INOISE
In this example the equivalent input noise is printed.
.PRINT DISTO HD3 SIM2(DB)
This example prints the magnitude of the third-order harmonic distortion and the
decibel value of the intermodulation distortion sum through the load resistor
specified in the .DISTO statement.
.PRINT AC INOISE ONOISE VM(OUT) HD3
In this statement, specifications of NOISE, DISTO, and AC output variables are
included on the same .PRINT statements.
.PRINT pj1=par(p(rd) +p(rs))
This statement prints the value of pj1 with the specified function.

2. .WIDTH
.WIDTH
.WIDTH OUT={80|132}
OUT80132.OPTION
CO
.WIDTH OUT=132
$SPICE compatible style
.OPTION CO=132
$preferred style
3. .PLOT
.PLOT32
.PLOT antype ov1 <(plo1,phi1)> <ov32> <(plo32,phi32)>

50

antype

DCACTRAN
NOISE DISTO
ov1

plo1, phi1
.PLOTHSPICE

,
.PRINT
.OPTION,CO=80,50
CO=132100

In the following example, PAR invokes the plot of the ratio of the collector
current and the base current of the transistor Q1.
.PLOT DC V(4) V(5) V(1) PAR(`I1(Q1)/I2(Q1)')
.PLOT TRAN V(17,5) (2,5) I(VIN) V(17) (1,9)
.PLOT AC VM(5) VM(31,24) VDB(5) VP(5) INOISE
The second of the two examples above uses the VDB output variable to plot the
AC analysis results of the node named 5 in decibels. Also, NOISE results may
be requested along with the other variables in the AC plot.
.PLOT AC ZIN YOUT(P) S11(DB) S12(M) Z11(R)
.PLOT DISTO HD2 HD3(R) SIM2
.PLOT TRAN V(5,3) V(4) (0,5) V(7) (0,10)
.PLOT DC V(1) V(2) (0,0) V(3) V(4) (0,5)
In the last example above, Hspice sets the plot limits for V(1) and V(2),
while 0 and 5 volts are specified as the plot limits for V(3) and V(4).
4..PROBE
.PROBE

.OPTION PROBE.PROBE
: .PROBE antype ov1<ov32>
:
antype DCAC
TRANNOISEDISTO
ov1 .PROBE32

: .PROBE DC V(4) V(5) V(1) beta=PAR(I1(Q1)/I2(Q1))


5. .GRAPH
.GRAPH
.PLOT.GRAPH.gr#
meta.cfgPRTDEFAULT.gr##
.GRAPH.gr#36.GRAPHHSPICEPC
: .GRAPH antype <MODEL=mname> <unam1=>
+ ov1,<uman2=> ov2,<unam32=> ov32 (plo,phi)

antype
DCAC
51

TRANNOISEDISTO
.GRAPH.GRAPH
HSPICE
unam1
ov1ov32(
unam1unam32)

ov1ov2 32

PARAM

mname

plo,phi

.GRAPH

6..OPTION POST
.OPTION POSTPOST

7..OPTION ACCT
.OPTION ACCTACCT
:
(1) .OPTION ACCT

(2) .OPTION ACCT=1


(1)ACCT=1
(3) .OPTION ACCT=2

The following output appears at the end of the output listing.


****** job statistics summary tnom= 25.000 temp= 25.000
# nodes = 15 # elements= 29 # real*8 mem avail/used=
333333/ 13454
# diodes= 0 # bjts = 0 # jfets = 0 # mosfets = 24
analysis time # points tot. iter conv.iter
op point 0.24 1 11
transient 5.45 161 265 103
rev= 1
pass1 0.08
readin 0.12
errchk 0.05
setup 0.04
output 0.00
the following time statistics are already included in the
analysis time
load 5.22
solver 0.16
# external nodes = 15 # internal nodes = 0
52

# branch currents= 5 total matrix size= 20


pivot based and non pivotting solution times
non pivotting: ---- decompose 0.08 solve 0.08
matrix size( 109) = initial size( 105) + fill( 4)
words copied= 111124
total cpu time 6.02 seconds
job started at 11:54:11 21-sep92
job ended at 11:54:36 21-sep92
The definitions for the items in the above listing follow:

# BJTS Number of bipolar transistors in the circuit


# ELEMENTS Total number of elements
# JFETS Number of JFETs in the circuit
# MOSFETS Number of MOSFETs in the circuit
# NODES Total number of nodes
# POINTS Number of transient points specified by the user on the
.TRAN statement. JTRFLG is usually at least 50 unless the
option DELMAX is set.

CONV.ITER Number of points that the simulator needed to take in order


to preserve the accuracy specified by the tolerances

DC DC operating point analysis time and number of iterations


required. The option ITL1 sets the maximum number of
iterations.

ERRCHK Part of the input processing


MEM + Amount of workspace available and used for the simulation
AVAILUSED Measured in 64-bit (8-byte) words
OUTPUT Time required to process all prints and plots
LOAD Constructs the matrix equation
SOLVER Solves equations

PASS1 Part of the input processing


READIN Specifies the input reader that takes the user data file and any
additional library files, and generates an internal
representation of the information

REV Number of times the simulator had to cut time (reversals).


This is a measure of difficulty.

SETUP Constructs a sparse matrix pointer system


TOTAL JOB TIME Total amount of CPU time required to process the
simulation. This is not the length of actual (clock) time that
was taken, and may differ slightly from run to run, even if the
runs are identical.
53

The ratio of TOT.ITER to CONV.ITER is the best measure of simulator


efficiency. The theoretical ratio is 2:1. In this example the ratio was 2.57:1.
SPICE generally has a ratio of 3:1 to 7:1.
In transient, the ratio of CONV.ITER to # POINTS is the measure of the number
of points evaluated to the number of points printed. If this ratio is greater than
about 4, the convergence and timestep control tolerances might be too tight for
the simulation.

54

HSIPCE

HSPICE
HSPICEEDACadenceMentorValidWork View
HSPICEWork ViewWorkViewHSPICE
4.1
Viewtrace

CSDF

Schematic

Netlist

H S P IC E

Workview

4.1 Work ViewHSPICE

4.1

HSPICEWorkview.OPTIONCSDF
.END.ALTER
HSPICE.ALTER

HSPICE
1. vi
2. Workview(Schematic) Workview Export
Netlist HSPICE SchematicHSPICE
(xxx.cir)
HSPICExxx.cir
WorkviewNMOS

Workview MODULE SYMBOL


Schematic4.1.1MOS
SYMBOL
ND

NG

NB

NS

4.1.1 MOS SYMBOL


SYMBOLSYMBOLCATTR4.1.1

55

MODEL
ORDER
PINORDER
PREFIX
REFDES
W
L

?
MODEL$
ND NG
M
M ?
?
?

W=
NS

L=
NB

4.1.1
HSPICEMOS
Schematicnetlist
MODEL;
ORDER Mxxx
ND NG
NS
NB MNAME W=VAL L=VALORDER
MNAME W=VAL L=VAL
MODEL$MODEL,W=L=WLPINORDER
MOSNDNG
NSNBPREFIXMOSM
REFDESMxxxWLMOS
?

NMOS,MOS
CATTR 4.1.2
MOS4.1.2

MODEL
ORDER
PINORDER
PREFIX
REFDES
W
L

?
MODEL$
ND NG
M
M ?
?
?

W=
NS

L=
NB
M21
10U
1U

4.1.2

4.2

HSPICE

HS- PICE
HSPICE:
hspice filename (demo.sp)
GSIgsi&Meta WindowGraph
WindowFile Selection DialogMeta Window HspiceFile Selection
DialogHspiceRunRunHSPICE
MetaWindowHspiceHspiceRunInputFile
HspiceRun
HSPICEHSPICE
56

(demo.list)
4.2.1

.DC
.AC
.TRAN

(demo)
demo.SW#
demo.AC#
demo.TR#

4.2.1
HSPICE(hardcopy)(demo.CR#)
#
# 0; .ALTER
#

4.3

HSICE

HSPICE
HSPLOTGSIWorkView CadenceHSPLOT
WorkView GSI
. HSPLOT
HSPLOT
HSPLOT
filename ( demo.TROdemo.SW1 demo.ACO)
p(p
6)n
g

. WorkView
WorkViewViewtraceWindow
OptionViewtrace

.GSI
gsi&Meta WindowGraph WindowFile
Selection Dialog HspiceMetaWindow
CurvesCurvesDraw Graph Window
GraphWindowPanels6
Measurement
Turn Measure On

HSPICE

HSPICE

57

1)

SPICE Pspice
1994

2)

SPICE
1983

3)

HSPICE Users ManualMeta-SoftwareInc1996

4)

Star-Hspice ManualAvant1998

5)


1996

6)

1987

7)

HSPICE

58

HSPICE

.
1.LEVEL1LEVEL3

2.. LEVEL1LEVEL3

59

60

3.

4.LEVEL1LEVEL3

61

4.LEVEL1LEVEL3

62

You might also like