作者CL2NE1 (CL)
看板Electronics
标题[问题] HSpice if-else 问题
时间Wed Oct 31 14:23:02 2012
大家好
我想问关於 HSpice的 if-else应用问题
我想设计一个电晶体的大讯号等效电路模型
直接以大讯号电路去模拟出 Ids-Vds的I-V特性
以下是sp code部份
**** for simulation
.option post
.param Wn=20u Ln=1u kn=2u vt=0.025 $ Wn Ln为电晶体width/length
$ kn 为NMOS的unCox、 vt=vth
.subckt large_signal drain gate source
rds drain i_drain 10
.if (v(drain,source) <= (v(gate,source)-vt))
$ vds<=(vgs-vt) 判断为triode区 gds=kn*(W/L)*(Vgs-Vt-(Vds/2))
gds i_drain source cur='kn*(Wn/Ln)*(v(gate,source)-vt-(vds/2))'
[ .else (v(drain,source) > (v(gate,source)-vt))
$ vds>(vgs-vt) 判断为饱和区 gds=(1/2)*kn*(W/L)*((Vgs-Vt)^2)
gds i_drain source cur='0.5*kn*(Wn/Ln)*(pwr(max(v(gate,source),0)-vt),2)'
]
.endif
.ends
xt drain gate source large_signal
Vgs gate 0 dc
Vds drain 0 dc
Vss source 0 dc 0v
.dc vds 0v 3.3v 0.01v vgs 0v 3v 1v
.probe i(xt.gds)
.print i(xt.gds)
.end
但却出现以下错误
**error** unrecognizable data card
**error** .ends card missing at readin
>error ***difficulty in reading input
参考了HSpice Manual以及HSpice Simulation and Analysis User Guide
仍不得头绪
想请问if else的判定式内,该怎麽设定才正确
倘若这方式不正确,即不能以变动dc去给定if判断式的条件
又该以什麽方式呢?
我有想过用for while之类的
但HSpice内好像没有这类的回圈 ... Orz
感谢大家
--
1F:推 mindezi:西螺站 到了02/17 15:48
2F:→ ChannelV5566:西罗沾 兜勒02/17 15:49
3F:→ urdie:塞雷站 告阿02/17 15:50
4F:推 wlsh:we are now at C罗 station02/17 15:54
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 163.17.10.169
5F:推 jacobliu:if else应该不支援电压。你可以用switch+比较器来试试看 10/31 16:43
HSpice内有这功能吗? 感觉大大提及的比较像是Verilog的写法...
6F:推 pow:if else的condition里面只能用变数(parameter) 10/31 21:57
7F:→ pow:simulator看到你的condition就会选符合的那个 当成最终netlist 10/31 21:58
你的意思是设定 vds vgs vss 都设成 .param 吗?
8F:推 overthesea:原来hspice可以这样用喔 @@ 10/31 22:13
※ 编辑: CL2NE1 来自: 163.17.10.169 (11/01 16:44)
※ 编辑: CL2NE1 来自: 163.17.10.169 (11/01 16:45)
9F:推 juc:...spice用了这麽多年也没听过有这招@@ 11/07 01:19