您的当前位置:首页正文

hspice万用网表及活用技巧

2021-12-01 来源:小奈知识网
hspice万⽤⽹表及活⽤技巧

1,测试MOS基本参数

.lib 'D:\\project\\hspicelib\\cmos035\\CMOS_035_Spice_Model33v.lib' TT .inc 'D:\\project\\hspicelib\\switchmodel\\myswitch.cir'.op

.option node list post.option node list post

MN1 outn NMOSIN 0 0 N_33 L=kl W='2*kl' M=1

MP1 OUTP PMOSIN VDD VDD P_33 L=kl W='2*kl' M=1 IDCN VDD outn kidnIDCP OUTP 0 kidpVDD VDD 0 3.3LN NMOSIN outn 10GCINN IN NMOSIN 10GVIN IN 0 AC=1CINP IN PMOSIN 10GLP OUTP PMOSIN 10G* DICTIONARY 1* GND = 0.GLOBAL VDD

.ac dec 100 1 1g * sweep kl 0.5u 2u 0.1u**.print vdb(outn) vdb(oup).param kidn=7.5U kidp=2.7u kl=1u****meas ve_n of nmos

.meas ac dc_gain_n max vm(outn).meas ac w_n find w(mn1) at 5.meas ac l_n find l(mn1) at 5.meas ac s_n param='w_n/l_n'

.meas ac vth_n find lv9(mn1) at 5 *vth alias.meas ac vgs_n find lx2(mn1) at 5.meas ac vod_n param='vgs_n-vth_n'

.meas ac ve_n param='dc_gain_n*vod_n*0.5/l_n'.meas ac kn param='2*kidn/vod_n/vod_n/s_n'***mesure ve_p of pmos

.meas ac dc_gain_p max vm(outp).meas ac vth_p find lv9(mp1) at 5.meas ac vgs_p find lx2(mp1) at 5

.meas ac w_p find w(mp1) at 5.meas ac l_p find l(mp1) at 5.meas ac s_p param='w_p/l_p'.meas ac vod_p param='vgs_p-vth_p'

.meas ac ve_p param='dc_gain_p*vod_p*0.5/l_p'.meas ac kp param='2*kidp/vod_p/vod_p/s_p'//其它

.meas ac dc_gain_n find vm(outn) at 5.meas ac rds_n find rds(mn1) at 5.meas ac gds_n find gdso(mn1) at 5.meas ac gm_n find gmo(mn1) at 5.meas ac a0_rds_n param 'gm_n*rds_n'.meas ac a0_gds_n param 'gm_n/gds_n'.meas ac rout_ac_n param '1/gds_n'.meas ac c_gsub_n find cggbo(mn1).meas ac c_gs_n find cgsbo(mn1).meas ac w_n find w(mn1).meas ac l_n find l(mn1)

.meas ac cox_n param 'c_gsub_n/w_n/l_n'****meas ve_n of nmos

.meas ac dc_gain_p find vm(outp) at 5.meas ac rds_p find rds(mp1) at 5.meas ac gds_p find gdso(mp1) at 5.meas ac gm_p find gmo(mp1) at 5.meas ac a0_rds_p param 'gm_p*rds_p'.meas ac a0_gds_p param 'gm_p/gds_p'.meas ac rout_ac_p param '1/gds_p'.meas ac c_gsub_p find cggbo(mp1).meas ac c_gs_p find cgsbo(mp1).meas ac w_p find w(mp1).meas ac l_p find l(mp1)

.meas ac cox_p param 'c_gsub_n/w_n/l_n'0.40.60.811.2 1.4 1.6 1.82

2.2 2.4x 10-60.80.9

11.11.21.31.41.51.61.71.8x 107

channel lenghv e n a n d v e p

ve of nmos & pmos ve_n=16.4e6 ve_p=8.92e6

x 10-6

0.60.811.21.41.61.822.2x 10-4

channel lenghk n a n d k p

kn= 1.9396e-004 kp= 7.9971e-005 @mean

x 10-6050100150200250300350

channel lenghd c g a i n

dc gain vs L at vod=0.2v2,MOS 常见参数及函数调⽤//for umc 0.35um 3.3v twin_well0ξ=8.85 aF/um a=10-182

_i r s o ξ=3.97

k= 1.38*10-23J/K q=1.6*10-19CV T =kT/q=16mv@300Ktox=5nm cox=6.9fF/um 2

tox=7nm 时cox= Cgdoverlap=Cgsoverlap=1.5e-10 tox=12nm cox=2.88fF/um 2vthn=0.63vkn= 1.9396e-004

ve_n=16.4e6vthp=0.86vkp= 7.9971e-005ve_p=8.92e6函数L()W()

vth() 阈值电压,pmos为正值vdsat() 饱和电压即vgs-vthrds() 电阻,不知是怎么来的vgs()

cdo() dc drain current

gmo() gm operational 静态时gm

gdso() dc D-S conductance 导数为输出电阻gmo/gdso为直流增益covlgs() gs overlapcovlgd() gd overlapcovlge() Gsub overlap

3, option 选项及VCVS VCCS param

若要导⼊到MATLAB中需要bin进制⽂件时需要设置好option并只使⽤.probe打印.option post=1 //⼆进制.probe tran V(out1) v(node1).option reltol

.option reltol=1e-5 abstol=1e-9.option reli=XXX.option methode=gear

.option post=-0,1,2 // 打印科学进制和其它形式1,binary 2,ascii 3,减⼩⽂件空间⼤⼩。

.option post acct accurate // acct仿真结果写⼊ list ⽂件中。default=1, accurate仿真精度很⾼。.option node list post

.option GSHUNT=1e-11 CSHUNT=1e-11 method=gear.option fast

.option ingold=2 //list中打印的数字为科学制度如10e8

evcvs outp outn inp inn MAX= 5 MIN= -5 A0(如1000)

evccs outp outn cn1 cn2 max=5 min=0 gm(如200u)//sybolPrefix=G

PINODER= outp outn inp inngm //设置⼀个变量ORDER= MAX= MIN= gm$

.subckt NAND2 vin vss x1 x2 y wn1=Wn11 //wn1等可省去不⽤,M3 X1 VSS VSS N_33 W=wn1.ends需导出⽹表为

Xaaa vin vss x1 x2 y NAND2 WN1=0.7U //或WN11=0.7U也可以在symbol中由symb中ORDER控制.subckt

.inc ‘…\\myswitch.cir’Xswitch in out cont switchdai//myswitch.cir

.subckt switchdai in out cont⼦电路名端⼝排序

Gswitch in out VCR pwl(1) cont 0 0, 10g 1v,0.1v //1v时对应于0欧姆,0.1v .ends对应于10G欧姆//myswitch.cir//sybol

MODEL=switchdaiPinorder=in out contPrefix=X

ORDER=MODEL$ //只显⽰MODEL值.param Kcu=2.0

.param kv=unif(nomina_val,rel_variation,multiplier)Aunif(…)

Gauss(nominal_val,rel_variation,sigma,multiplier)2σ(sigma),

.ac dec 100 1 1g sweep monte=n_time // n_time为取样次数。Ex outp outn POLY(3) inp1, inn1, inp2, inn2, inp3, inn3, 0, 1, 1, 1+IC=1.5, 2.0, 17.25

其中0,1,1,1为p0,p1,p2多项式

(,)01*(1,1)2*(2,2)3*(3,300,11,21,31V outp outn P P V inp inp P V inp inn P V inp inn p p p p =+++??====?)

零延时反相器 Einv outp outn pwl(1) inp, inn, 0.7v, 5v, 1v , 0 v输出电压0.7v 对应输⼊电压1v ,输出5v 对输⼊0v4,激励源和print probsin (vo va f t_dθ ?)

sin (偏置电压 振幅 频率 延时 衰减因⼦ 初始相位)0*exp[()]sin 2[()]360V Va t td f t td ?θπ?++

pulse (v1 v2 td tr tf pw per R t)

pulse (初始值 ⾼值 延时 上升时间 下降时间 ⾼占⽐例 周期 repeat 重复时间) pwl( t1 v1 t2 v2 R Trepeat).print ac(*)

.print ac vdb(node1,node2)

.print ac par('(v(node1)-v(node2))/v(node3)') .print ac par(‘DB(V(dop)-V(don))’) .print noise inoise onoise.print ac v(node1,node2) .print dc par ('sqrt(I1(m1))').probe tran V(in1) v(nod1) v(nod2)5, ac dc 仿真及meas sweepac .ac dec 100 1 1g

.ac 每⼗倍频程100 频率1⾄1g Hz .ac dec 100 1 1G sweep Kcp POI 3 1p 2p 3p //变量Kcp 有三个点扫描1p,2p,3p .ac dec 1001 1G sweep Kcp LIN 5 25 125 //从25度到125度有5个点扫描 .ac dec 100 1 1G sweep Kcp DEC 10 1K 100K //从1k 到100k 每⼗倍频程有10个点 .ac dec 100 1 1G sweep data=ac.data ac Temp K1 25 1p 26 2p275p……

也可将上⾯写在⼀个⽂件中如sweep.txt再在⽹表中添加.inc ‘….\\sweep.txt’dc

.dc v2 0.1v 5v 0.01v

.dc vds 0 5v 0.001v seeep vgs 0 5v 1v//都是步长从0.1v到5v,0.001v间距递增v1 vin 0 dc 0.9 ac 1meas

.meas tran t_cycle1 trig v(compout) val=2.5v fall=1 targ v(compout) val=2.5v fall=2//compout第⼀次下降时间到第⼆次下降时间间隔值存在变量t_cycle1中

.meas dc Rout DERIV I1(M1) from=0v to=5v //等号都可以⽤空格代替.meas tran Avgdai A VG V(compout) from=10u to=400u.meas tran Cycle_dai PARAM=’(Rout/2)’

.meas tran id1 find i1(m24) at= 4m //在4ms处m24的电流值.meas ac dcgain_db max vdb(don).meas ac dcgai_m max vm(don)

.meas ac phsmagin find vp(don) when vdb(don)=0 fall=1

.meas ac gbw when vdb(dop=0) fall=1 //此时when是指ac变量频率.meas tran Slew_Rate DERIV V(out) at=25nstran

.tran 1u 5m sweep vdd 1v 5v 1v 从1v到5v 中每1v取⼀个点

.tran 1u 20u swee temp -15 75 10 //从-15 到 75度,每10度取⼀个点.tran 0.1n 10u 1ns 40us start=10ns //10u 40us 10ns都是时刻

0~10us的时间内精度为0.1n 10u~40u的时间内精度为1ns,开始打印时刻为10ns。.tran 10n 1us UIC sweep temp -55 75 10 //温度从-55 到75,每10度⼀个点。.op at=10u or at 10u 10u时的静态⼯作状态.tf V(outp) VINP

.noise V(outp) Vinp 10 //10为每⼗倍频程打印⼗个点结果。输出电压输⼊AC激励源

.fft V(1) np=1024 start=0.3m stop=2m freq=5.0k window=kaiswe alfa=0.5.temp -20 25 50 //分别取三个温度点都仿真.pz v(node_out) vin.IC v(node1)=5v.alter.del .lib '.....' tt.protect.lib '.....' ss.unprotect.prot.lib.unprot.alter

.del .lib ‘…’ //原句复制下来.prot.lib ‘….’ tt.unprot

6,常见仿真电路图Input common range

⼀看尾电流⼆看输出是否跟随输⼊变化⽽变化Input common reject ration

因篇幅问题不能全部显示,请点此查看更多更全内容