1 ## Copyright (C) 2006-2009 Carlo de Falco, Massimiliano Culpo
3 ## This file is part of:
4 ## OCS - A Circuit Simulator for Octave
6 ## OCS is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation.
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program (see the file LICENSE); if not,
17 ## see <http://www.gnu.org/licenses/>.
19 ## author: Carlo de Falco <cdf _AT_ users.sourceforge.net>, culpo@math.uni-wuppertal.de
23 ## @deftypefn{Function File} @
24 ## {[@var{a},@var{b},@var{c}]=} Mshichmanhodgesmosfet(@var{string},@var{parameters},@
25 ## @var{parameternames},@var{extvar},@var{intvar},@var{t})
27 ## SBN file implementing Schichman-Hodges MOSFETs model.
29 ## @var{string} is used to select among models. Possible models are:
32 ## @item @var{string} = "NMOS" (Schichman-Hodges n-MOSFET)
33 ## @item @var{string} = "PMOS" (Schichman-Hodges p-MOSFET)
36 ## Parameters for all the above models are:
38 ## @item rd -> parasitic resistance between drain and source
39 ## @item W -> MOSFET width
40 ## @item L -> channel length
41 ## @item mu0 -> reference value for mobility
42 ## @item Vth -> threshold voltage
43 ## @item Cox -> oxide capacitance
44 ## @item Cgs -> gate-source capacitance
45 ## @item Cgd -> gate-drain capacitance
46 ## @item Cgb -> gate-bulk capacitance
47 ## @item Csb -> source-bulk capacitance
48 ## @item Cdb -> drain-bulk capacitance
49 ## @item Tshift -> shift for reference temperature on MOSFETs (default 0)
52 ## See the @cite{IFF file format specifications} for details about
53 ## the output structures.
55 ## @seealso{prs_iff,asm_initialize_system,asm_build_system}
58 function [a,b,c]= Mshichmanhodgesmosfet (string,parameters,parameternames,extvar,intvar,t)
61 ## If intvar is empty, then we are initializing the system
62 ## and there is no need of a matrix evaluation
67 ## If intvar is NOT empty, then we are evaluating the
79 Cgs=Cgd=Csb=Cdb=.1*Cox;
82 for ii=1:length(parameternames)
83 eval([parameternames{ii} "=",...
84 num2str(parameters(ii)) " ;"])
87 [gm,gd,ids,didT,P,dPdT,dPdvgs,dPdvds] = \
88 nmos(extvar,mu0,Cox,W,L,Vth,rd,Tshift);
106 a11 = a21 = a22 = zeros(5,5);
113 a = [a11 a12; a21 a22];
116 -gm (gm+gd) -gd 0 -didT; \
117 gm -(gm+gd) gd 0 didT; \
119 dPdvgs -(dPdvgs+dPdvds) dPdvds 0 dPdT];
123 b21 = [Cgb 0 0 -Cgb 0; \
130 b = [b11 b12; b21 b22];
133 c1 = [0; -ids; ids; 0; P];
135 c2 = [Cgb*(vg - vb) - Qgb;\
136 Cgs*(vg - vs) - Qgs;\
137 Cgd*(vg - vd) - Qgd;\
138 Csb*(vs - vb) - Qsb;\
139 Cdb*(vd - vb) - Qdb];
155 Cgs=Cgd=Csb=Cdb=.1*Cox;
158 for ii=1:length(parameternames)
159 eval([parameternames{ii} "=",...
160 num2str(parameters(ii)) " ;"])
163 [gm,gd,ids,didT,P,dPdT,dPdvgs,dPdvds] = \
164 pmos(extvar,mu0,Cox,W,L,Vth,rd,Tshift);
183 a11 = a21 = a22 = zeros(5,5);
190 a = [a11 a12; a21 a22];
193 -gm (gm+gd) -gd 0 -didT; \
194 gm -(gm+gd) gd 0 didT; \
196 dPdvgs -(dPdvgs+dPdvds) dPdvds 0 dPdT];
200 b21 = [Cgb 0 0 -Cgb 0; \
208 b = [b11 b12; b21 b22];
211 c1 = [0; -ids; ids; 0; P];
213 c2 = [Cgb*(vg - vb) - Qgb;\
214 Cgs*(vg - vs) - Qgs;\
215 Cgd*(vg - vd) - Qgd;\
216 Csb*(vs - vb) - Qsb;\
217 Cdb*(vd - vb) - Qdb];
224 error(["unknown option:" string]);
230 function [gm,gd,ids,didT,P,dPdT,dPdvgs,dPdvds] = nmos(extvar,mu0,Cox,W,L,Vth,rd,Tshift)
231 ##Computes values for nmos case
237 T = max(extvar(5),0);
239 k = mu0*Cox*((T + Tshift)/300)^(-3/2)*W/L;
240 dkdT = mu0*Cox*W*(-3/2)*((T + Tshift)/300)^(-5/2)*(1/300)/L;
252 elseif (((vgs-Vth) >= (vds)) && (vds >= 0))
254 ids = k*((vgs-Vth)*vds-(vds^2)/2)+vds/rd;
256 gd = k*(vgs-Vth-vds) + 1/rd;
257 didT= dkdT*((vgs-Vth)*vds-(vds^2)/2);
259 elseif (((vgs-Vth) >= (vds)) && (vds < 0))
266 else # (i.e. if 0 <= vgs-vth <= vds)
268 ids = (k/2)*(vgs-Vth)^2+vds/rd;
271 didT= (dkdT/(2))*(vgs-Vth)^2;
278 dPdvds = -(gd*vds + ids);
282 function [gm,gd,ids,didT,P,dPdT,dPdvgs,dPdvds] = pmos(extvar,mu0,Cox,W,L,Vth,rd,Tshift)
283 ##Computes values for pmos case
291 k = - mu0 * Cox * ((T + Tshift)/300)^(-3/2) *W/L;
292 dkdT = - mu0 * Cox * W *(-3/2)*((T + Tshift)/300)^(-5/2)*(1/300)/L;
304 elseif (((vgs-Vth) <= (vds)) && (vds <= 0))
306 ids = k*((vgs-Vth)*vds-(vds^2)/2)+vds/rd;
308 gd = k*(vgs-Vth-vds)+1/rd;
309 didT= dkdT*((vgs-Vth)*vds-(vds^2)/2);
311 elseif (((vgs-Vth) <= (vds)) && (vds > 0))
320 ids = (k/2)*(vgs-Vth)^2+vds/rd;
323 didT= (dkdT/(2))*(vgs-Vth)^2;
330 dPdvds = -(gd*vds + ids);