Tutor
Tutor
Tutor
指導老師:鄭桂忠 老師
NTHU - NBME 0
Contents
Introduction
Simulation inputs and controls
- build the main part
- input sources
- analysis
Waveform observation
NTHU - NBME 1
What is SPICE
Simulation Program with Integrated Circuit Emphasis
NTHU - NBME 2
Basic flow for hspice
NTHU - NBME 3
Contents
Introduction
Simulation inputs and controls
- build the main part
- input sources
- analysis
Waveform observation
NTHU - NBME 4
Prepare File
• Library file
cic018.l (it’s “L”) (CIC virtual 0.18um CMOS technology)
NTHU - NBME 5
How to run hspice
• Make sure all files are in the same folder
You can type ls to check
NTHU - NBME 6
Text Editor
• joe xxx.sp(檔名)
• vi
• vim
• gvim
• gedit
NTHU - NBME 7
Syntax Overview
**** inverter example **** 模擬時第一行會被忽略
.protect
.lib "cic018.l" TT 吃進本file的library檔,並設
.unprotect 定corner
.inc "inv.spi"
用*作為 .option post=1 accurate=1 增加/修改 模擬條件
整行註解 + CAPTAB
一行寫不完可用”+”在下一行繼續寫
**** NETLIST ****
大小寫沒 xinv IN OUT VDD VSS inv 呼叫”inv” 這個sub circuit
有區分
**** SOURCES ****
V1 VDD VSS DC=1.8 Net 0 代表global ground (或 gnd)
V2 VSS 0 DC=0
V3 IN VSS DC=0
分析電路偏壓點
**** ANALYSIS ****
.OP 可在waveview觀察節點電壓變化
.DC V3 0 1.8 0.01
.PROBE V(IN) V(OUT) 結束一定要有.end
.end
NTHU - NBME 8
CIC 0.18um Model
NTHU - NBME 9
Elements and Device Models
• Passive Devices
- Resistor R Ex: R1 v1 v2 100
- Inductor L Ex: L2 v3 v4 1n
- Capacitor C Ex: C3 v5 v6 2p
• Active Devices
- MOSFET M Mxxx D G S B mname w=val l=val n=val
- BJT Q D: Drain G: Gate S: Source B: Body
Mname: model name, please refer to the library file
- Diode D w: width, l: length, m: 並聯個數(只有整數)
• Other Devices
- Sub-Circuit X
- Behavioral E, G, H, F, B
10
Scale Factor
f: 1e-15 k: 1e3
p: 1e-12 meg/x: 1e6
n: 1e-9 g: 1e9
u: 1e-6 t: 1e12
m: 1e-3 db: 20log10
NTHU - NBME 11
Elements and Device Models -- MOSFET
• Ex: Inverter
MP Z A VDD VDD p_18 w=1u l=0.18u m=2
MN Z A GND GND n_18 w=1u l=0.18u m=1
NTHU - NBME 12
Elements and Device Models – Subcircuit
NTHU - NBME 14
Independent Source Elements – DC/AC
• Voltage sources
Vxxx net1 net2 <DC=val> <AC=val>
Ex: V4 4 0 DC=5V AC=1 180
• Current sources
Ixxx net1 net2 <DC=val> <AC=val>
Ex: I1 1 0 DC=100u
NTHU - NBME 15
Independent Source Elements – Transient
NTHU - NBME 16
Independent Source Elements – PULSE
NTHU - NBME 17
Independent Source Elements – SIN
NTHU - NBME 18
Independent Source Elements – PWL
NTHU - NBME 19
Contents
Introduction
Simulation inputs and controls
- build the main part
- input sources
- analysis
Waveform observation
NTHU - NBME 20
Analysis (1)
• .OP : Analyze operation point of nodes in circuit.
NTHU - NBME 21
Analysis (2)
• .TRAN : Transient analysis to sweep time.
syntax: .TRAN <Tstep> <Tstop>
Ex: .TRAN 1ns 100us
NTHU - NBME 22
Optional Analysis (1)
• SWEEP : Sweep parameter, source or temperature
values but not model parameters.
syntax: <Analysis> SWEEP <var> <start> <stop> <step>
<Analysis> SWEEP <DEC/OCT/LIN> <np> <fstart> <fstop>
Ex: .DC Vds 0 5 0.1 SWEEP Vgs 2 5 1
.AC DEC 10 1k 10Meg SWEEP RL 10k 30k 1k
• .ALTER : Alter condition and repeat analysis (usually with
.param)
Ex: .ALTER
.param w=5.5u
.ALTER
.param w=6.5u
.end
NTHU - NBME 23
Optional Analysis (2)
NTHU - NBME 24
Simulation Outputs -- .MEAS (1)
NTHU - NBME 25
Simulation Outputs -- .MEAS (2)
NTHU - NBME 26
Simulation Outputs -- .MEAS (3)
NTHU - NBME 27
Simulation Outputs -- .MEAS example
NTHU - NBME 28
Simulation Outputs – waveform observation
NTHU - NBME 29
Temperature & Control Options
NTHU - NBME 30
Analysis result file table
NTHU - NBME 31
Contents
Introduction
Simulation inputs and controls
- build the main part
- input sources
- analysis
Waveform observation
NTHU - NBME 32
Viewing Result Waveform
NTHU - NBME 33
Viewing Result Waveform
NTHU - NBME 34
Viewing Result Waveform
NTHU - NBME 35
Practice
NTHU - NBME 14