作者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