You are on page 1of 37

HSPICE

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

INTRODUCTION TO HSPICE

For simulating digital circuits we use HDL's and Simulation tools like
VCS,CVER,MODELSIM,XILINKs etc.

For Simulating simple RLC ,Diode, etc. we are using manual


analysis.
Manual analysis of that circuits may not give more accurate readings
because we have to take all diode parameters including second order
effects into account.
Computer aided simulation is necessary.
HSPICE is a circuit simulator used to simulate analog circuits
having the components R,L,C, active devices etc.

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

HISTORY

HSPICE is a analog circuit simulator from Synopsys tool.


HSPICE tool having 2 versions namely 1)HSPICE 2)HSPICE RF
HSPICE is used to simulate having the device frequencies in the
range DC to Microwave frequencies.
HSPICE RF is used to simulate the Radio Frequency devices .
HSPICE developed using Fortran Based script.
HSPICE RF developed using C++ Based script.

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

WHAT IS HSPICE?

HSPICE is a program that takes in a netlist.


HSPICE net list is simple text file having .SP extension.
The netlist contain
a)circuit description
b)analysis options
c)output the analysis
First line of HSPICE is comment.
Circuit topology tell how the nets are connected.
Analysis parts tells which analysis you want to do like AC analysis ,DC
analysis, Transient Analysis ,Transfer Function Analysis.
Output Analysis is used to print, plot the analysis results.
Last line netlist .end command.

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

MECHANICS OF WRITING A HSPICE


NETLIST

HSPICE netlist is a case insensitive


First line of a hspice netlist is always a comments
You can write the comments at any place in the netlist by using *
Last line of a hspice netlist is .end which tells hspice netlist to terminate
the program.

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

DECLARATION OF PASSIVE ELEMENTS


CAPACITOR:
C{name} {node+} {node-} [{model}] {value} [{IC=initial}]
Examples : C 1 2 10pf
CLOAD 2 2 4 CMOD 20pf IC=1.5v

INDUCTOR:
L{name} {node+} {node-} [{model}] {value} [{IC=initial}]
Examples :L 1 2 20mH
LVALUE 2 3 2uH IC=1.2mA

RESISTER:
R{name} {node+} {node-} [{model}] {value}
Example: R 2 3 10k

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

For the above R,L,C components we have a flexibility to write


-ve and +ve node interchangeable. Because they are bilateral
elements.

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

DECLARATION OF ACTIVE COMPONENTS


DIODE:
D{name} {node+} {node-} {model} [AREA]
Examples : DCLAMP 4 5 DMOD

BJT:
B{name} {collector} {base} {emitter} [{sub}] {model} [{area}]
Examples :M1 4 6 8 PNPNOM
M2 5 7 9 1 NPNSTRONG 1.5

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

JFET:
J{name} {drain} {gate} {source} {model} [{area}]
Examples :JI 2 5 0 JFAST

MOSFET:
M{name} {drain} {gate} {source} {substrate} {model} [L={}] [w={}]
Examples :M1 14 2 13 0 PNOM L=25u w=12u
M2 15 3 24 0 PSTRONG

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

DECLARATION OF SOURCES
CURRENT SOURCE:
I{name} {node+} {node-} [[dc] {value}] [ac {mag} [{phase}]]
Examples :IBIAS 13 0 2.3mA
IAC 2 3 AC .001mA
IPULSE 1 0 PULSE(-1mA 1mA 2ns 2ns 2ns 50ns 100ns)
I3 26 77 AC 1 SIN(.002 .002 1.5MEG)

VOLTAGE SOURCES:
V{name} {node+} {node-} [[dc] {value}] [ac {mag} [{phase}]]
Examples :VBIAS 13 0 2.3mV
VAC 2 3 AC .001mV
VPULSE 1 0 PULSE(-1mV 1mV 2ns 2ns 2ns 50ns 100ns)

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

DECLARATION OF DIFFERENT INPUT SOURCES LIKE


PWL,EXP,PULSE

SINWAVE:
SIN( {voffset} {vpeak} {freq} {tdelay} {damp_factor} {phase} )

PIECE WISE LINEAR:


PWL( {time1} {v1} {time2} {v2} ... {time3} {v3} )

PULSE:
PULSE( {v1} {v2} {tdelay} {trise} {tfall} {width} {period} )

EXPONENTIAL:
EXP( {v1} {v2} {trise_delay} {tau_rise} {tfall_delay} {tau_fall) )

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

DECLARATION OF ANALYSIS LIKE


AC,DC,TRANSIENT
AC ANALYSIS:
AC [LIN][OCT][DEC] {points} {start} {end}
Examples:
.AC LIN 101 10Hz 200Hz
.AC DEC 20 1MEG 100MEG

DC ANAYSIS:
DC [LIN] {varname} {start} {end} {incr}
.DC [OCT][DEC] {varname} {start} {end} {points}
Examples:
.DC VIN -.25 .25 .05
.DC LIN I2 5mA -2mA 0.1mA VCE 10V 15V 1V

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

TRANSIENT ANALYSIS:
.TRAN {print step value} {final time} [{no print time} [{step ceiling
value}]] [UIC]

Examples:

.TRAN 5NS 100NS

PLOT ANALYSIS :Plot Output.

.PLOT [DC][AC][NOISE][TRAN] [ [{output variable}*]


Examples:
.PLOT DC V(3) V(2,3) V(R1) I(VIN)

.PLOT AC VM(2) VP(2) VG(2)

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

PRINT OUTPUT:

.PRINT [DC][AC][NOISE][TRAN] [{output variable}*]


Examples:
.PRINT DC V(3) V(2,3) V(R1) IB(Q13)

.PRINT

AC VM(2) VP(2) VG(5) II(7)

PROBE :probe command is used to save the simulation output what you
specified in the statement.

.PROBE [output variable]*


Examples: .PROBE
.PROBE V(3) VM(2) I(VIN)

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

USE OF OPTION POST IN THE HSPICE NETLIST

It enable storing of simulation results for analysis


If we put POST=1 save the results in binary
POST=2 save the results in ASCII
POST=3
save the results in new wave binary format
Set the option POST and use >PROBE statement to specify which
data you want to save
Nomod option suppresses the printing of model parameters
Finally last line of a netlist is .end

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

SOME IMPORTANT NOTES FOR WRITTING HSPICE


NETLIST

Ground is a special node in the circuit. So only use gnd or 0 to


specify the ground.
Make sure that proper declaration of +Ve and Ve terminal of a
unilateral elements is like active elements and sources is necessary.
Don't care about bilateral elements whether which is +Ve and -Ve
While declaring voltage source VS
vs vs gnd 10v
we gave source name and node name sameness will not cause any
ambiguities.

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

TRANSIENT ANALYSIS OF SIMPLE RC CIRCUIT

Hspice netlist for simple RC circuit

1 EE105 SPICE Tutorial Example 1 - Simple RC Circuit


2 vs vs gnd PWL(0s 0V 5ms 0V 5.001ms 5V 10ms 5V)
3 r1 vs vo 1k
4 c1 vo gnd 1uF
5 .tran 0.01ms 10ms
6 .option post=2 nomod
7 .end

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

AC ANALYSIS OF RC CIRCUIT
1 EE105 SPICE Tutorial Example 4 - Simple RC High-Pass Filter
2 vs vs gnd ac 1V
3 c1 vs vo 1nF
4 r1 vo gnd 1k
5 .ac dec 500 100 1G
6 .option post=2
7 .end

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

DC ANALYSIS OF A DIODE
1 EE105 SPICE Tutorial Example 3 - Simple Diode Circuit
2.model tut_diode d (is=1e-14 vj=0.6 rs=10)
3 vs vs gnd 5V
4 rs vs vd 5k
5 d1 vd gnd tut_diode
6.dc vs 0V 5V 0.01V
7 .option post=2
8 .end

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

OPERATING POINT ANALYSIS OF DIODE

.op command is used to find the quiescent point of a diode.


1 EE105 SPICE Tutorial Example 3 - Simple Diode Circuit
2 .model tut_diode d (is=1e-14 vj=0.6 rs=10)
3 vs vs gnd 5V
4 rs vs vd 5k
5 d1 vd gnd tut_diode
6 .op
7 .end

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

POLE-ZERO ANALYSIS OF A HIGH PASS CIRCUIT

EE105 SPICE Tutorial Example 6 - Pole-zero analysis of a high-pass filter


vs vs gnd ac 1V
c1 vs vo 1nF
r1 vo gnd 1k
.pz v(vo) vs
.end

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

TRANSFER FUNCTION OF A CIRCUIT

For a given resistive circuit we can find the transfer function by using .tf
command.
you can hand-calculate the answer and compare it to the result you get in
HSPICE
.tf v(v0) vs

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

HOW TO RUN A HSPICE TOOL


Connect to a server by username and password.
Open a file with .sp extension by using following command.
vim filename.sp and press enter u will see a page.
Type the hspice netlist in page . after typing the netlist save the
program and exit by the following command.
Press Esc and :wq! and enter
To run the netlist type the following command.
hspice filename.sp
After running the netlist it will show the output like this
hspice job concluded
Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

From this output we can know how many active , passive ,unilateral ,
bilateral elements the circuit have and it also shows calculated outputs.
To see the outputs graphically we need to invoke COSMOSCOPE tool.
To invoke this type cscope and press enter.
After this cscope window is opened. In that window click on File
openplotfiles
It will give Voltages and Currents at all nodes..

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

THANK YOU..

Seer Akademi Pvt. Ltd., 2012

Seer Akademi Confidential

You might also like