Skip to main content

dune_core/bsim3/
params.rs

1//! The BSIM3v3.3.0 model-parameter table (`b3.c` `BSIM3mPTable`,
2//! `b3mpar.c`) and the model-level defaulting of `BSIM3setup`
3//! (`b3set.c`). Generated from the ngspice-47 sources: one entry per
4//! real-valued model field, its deck keywords (aliases share the
5//! field, like the C's shared `BSIM3_MOD_*` codes) and the constant
6//! default `b3set.c` assigns when the parameter is not given
7//! (`None`: no default, or one computed in [`Bsim3Model::setup`]).
8
9/// Declares [`Bsim3Model`]'s real parameters, the given-flags and
10/// the keyword setter/getter from one table.
11macro_rules! bsim3_params {
12    ($( $(#[$doc:meta])* $field:ident : $($kw:literal)|+ = $def:expr ; )*) => {
13        /// `.model … nmos/pmos(level=8|49 …)`: a BSIM3v3.3.0 model
14        /// card, ngspice-47's (`bsim3def.h` `sBSIM3model`). Parameters
15        /// are set by deck keyword through [`Bsim3Model::set`]; like
16        /// the C, every parameter remembers whether it was given,
17        /// since `b3set.c`/`b3temp.c` branch on that.
18        #[derive(Clone, Debug, Default, PartialEq)]
19        pub struct Bsim3Model {
20            pub(crate) nmos: bool,
21            pub(crate) cap_mod: i32,
22            pub(crate) mob_mod: i32,
23            pub(crate) noi_mod: i32,
24            pub(crate) nqs_mod: i32,
25            pub(crate) acnqs_mod: i32,
26            pub(crate) acm_mod: i32,
27            pub(crate) calcacm: i32,
28            pub(crate) param_chk: i32,
29            pub(crate) bin_unit: i32,
30            pub(crate) version: Option<String>,
31            /// `BSIM3cox = EPSOX / tox` (set up by `b3set.c`).
32            pub(crate) cox: f64,
33            $( $(#[$doc])* pub(crate) $field: f64, )*
34            pub(crate) given: Bsim3Given,
35        }
36
37        /// The C's `BSIM3xxxGiven` flags.
38        #[derive(Clone, Debug, Default, PartialEq)]
39        pub(crate) struct Bsim3Given {
40            pub cap_mod: bool,
41            pub mob_mod: bool,
42            pub noi_mod: bool,
43            pub nqs_mod: bool,
44            pub acnqs_mod: bool,
45            pub acm_mod: bool,
46            pub calcacm: bool,
47            pub param_chk: bool,
48            pub bin_unit: bool,
49            $( pub $field: bool, )*
50        }
51
52        impl Bsim3Model {
53            /// `BSIM3mParam` for the `IF_REAL` codes.
54            fn set_real(&mut self, kw: &str, v: f64) -> bool {
55                match kw {
56                    $( $($kw)|+ => {
57                        self.$field = v;
58                        self.given.$field = true;
59                    } )*
60                    _ => return false,
61                }
62                true
63            }
64
65            /// `BSIM3mAsk` for the `IF_REAL` codes.
66            fn get_real(&self, kw: &str) -> Option<f64> {
67                match kw {
68                    $( $($kw)|+ => Some(self.$field), )*
69                    _ => None,
70                }
71            }
72
73            /// The constant `if (!given) x = default;` lines of
74            /// `BSIM3setup`.
75            fn constant_defaults(&mut self) {
76                $( {
77                    let d: Option<f64> = $def;
78                    if let Some(d) = d && !self.given.$field {
79                        self.$field = d;
80                    }
81                } )*
82            }
83        }
84    };
85}
86
87bsim3_params! {
88    /// Gate oxide thickness in meters (`BSIM3tox`)
89    tox: "tox" = Some(150.0e-10);
90    /// Gate oxide thickness used in extraction (`BSIM3toxm`)
91    toxm: "toxm" = None;
92    /// Drain/Source and channel coupling capacitance (`BSIM3cdsc`)
93    cdsc: "cdsc" = Some(2.4e-4);
94    /// Body-bias dependence of cdsc (`BSIM3cdscb`)
95    cdscb: "cdscb" = Some(0.0);
96    /// Drain-bias dependence of cdsc (`BSIM3cdscd`)
97    cdscd: "cdscd" = Some(0.0);
98    /// Interface state capacitance (`BSIM3cit`)
99    cit: "cit" = Some(0.0);
100    /// Subthreshold swing Coefficient (`BSIM3nfactor`)
101    nfactor: "nfactor" = Some(1.0);
102    /// Junction depth in meters (`BSIM3xj`)
103    xj: "xj" = Some(0.15e-6);
104    /// Saturation velocity at tnom (`BSIM3vsat`)
105    vsat: "vsat" = Some(8.0e4);
106    /// Temperature coefficient of vsat (`BSIM3at`)
107    at: "at" = Some(3.3e4);
108    /// Non-uniform depletion width effect coefficient. (`BSIM3a0`)
109    a0: "a0" = Some(1.0);
110    /// Gate bias  coefficient of Abulk. (`BSIM3ags`)
111    ags: "ags" = Some(0.0);
112    /// Non-saturation effect coefficient (`BSIM3a1`)
113    a1: "a1" = Some(0.0);
114    /// Non-saturation effect coefficient (`BSIM3a2`)
115    a2: "a2" = Some(1.0);
116    /// Body-bias coefficient of non-uniform depletion width effect. (`BSIM3keta`)
117    keta: "keta" = Some(-0.047);
118    /// Substrate doping concentration (`BSIM3nsub`)
119    nsub: "nsub" = Some(6.0e16);
120    /// Channel doping concentration (`BSIM3npeak`)
121    npeak: "nch" = Some(1.7e17);
122    /// Poly-gate doping concentration (`BSIM3ngate`)
123    ngate: "ngate" = Some(0.0);
124    /// Vth body coefficient (`BSIM3gamma1`)
125    gamma1: "gamma1" = None;
126    /// Vth body coefficient (`BSIM3gamma2`)
127    gamma2: "gamma2" = None;
128    /// Vth transition body Voltage (`BSIM3vbx`)
129    vbx: "vbx" = None;
130    /// Maximum body voltage (`BSIM3vbm`)
131    vbm: "vbm" = Some(-3.0);
132    /// Doping depth (`BSIM3xt`)
133    xt: "xt" = Some(1.55e-7);
134    /// Bulk effect coefficient 1 (`BSIM3k1`)
135    k1: "k1" = None;
136    /// Temperature coefficient of Vth (`BSIM3kt1`)
137    kt1: "kt1" = Some(-0.11);
138    /// Temperature coefficient of Vth (`BSIM3kt1l`)
139    kt1l: "kt1l" = Some(0.0);
140    /// Body-coefficient of kt1 (`BSIM3kt2`)
141    kt2: "kt2" = Some(0.022);
142    /// Bulk effect coefficient 2 (`BSIM3k2`)
143    k2: "k2" = None;
144    /// Narrow width effect coefficient (`BSIM3k3`)
145    k3: "k3" = Some(80.0);
146    /// Body effect coefficient of k3 (`BSIM3k3b`)
147    k3b: "k3b" = Some(0.0);
148    /// Narrow width effect parameter (`BSIM3w0`)
149    w0: "w0" = Some(2.5e-6);
150    /// Lateral non-uniform doping effect (`BSIM3nlx`)
151    nlx: "nlx" = Some(1.74e-7);
152    /// Short channel effect coeff. 0 (`BSIM3dvt0`)
153    dvt0: "dvt0" = Some(2.2);
154    /// Short channel effect coeff. 1 (`BSIM3dvt1`)
155    dvt1: "dvt1" = Some(0.53);
156    /// Short channel effect coeff. 2 (`BSIM3dvt2`)
157    dvt2: "dvt2" = Some(-0.032);
158    /// Narrow Width coeff. 0 (`BSIM3dvt0w`)
159    dvt0w: "dvt0w" = Some(0.0);
160    /// Narrow Width effect coeff. 1 (`BSIM3dvt1w`)
161    dvt1w: "dvt1w" = Some(5.3e6);
162    /// Narrow Width effect coeff. 2 (`BSIM3dvt2w`)
163    dvt2w: "dvt2w" = Some(-0.032);
164    /// DIBL coefficient of output resistance (`BSIM3drout`)
165    drout: "drout" = Some(0.56);
166    /// DIBL coefficient in the subthreshold region (`BSIM3dsub`)
167    dsub: "dsub" = None;
168    /// Threshold voltage (`BSIM3vth0`)
169    vth0: "vth0" | "vtho" = None;
170    /// Linear gate dependence of mobility (`BSIM3ua`)
171    ua: "ua" = Some(2.25e-9);
172    /// Temperature coefficient of ua (`BSIM3ua1`)
173    ua1: "ua1" = Some(4.31e-9);
174    /// Quadratic gate dependence of mobility (`BSIM3ub`)
175    ub: "ub" = Some(5.87e-19);
176    /// Temperature coefficient of ub (`BSIM3ub1`)
177    ub1: "ub1" = Some(-7.61e-18);
178    /// Body-bias dependence of mobility (`BSIM3uc`)
179    uc: "uc" = None;
180    /// Temperature coefficient of uc (`BSIM3uc1`)
181    uc1: "uc1" = None;
182    /// Low-field mobility at Tnom (`BSIM3u0`)
183    u0: "u0" = None;
184    /// Temperature coefficient of mobility (`BSIM3ute`)
185    ute: "ute" = Some(-1.5);
186    /// Threshold voltage offset (`BSIM3voff`)
187    voff: "voff" = Some(-0.08);
188    /// Parameter measurement temperature (`BSIM3tnom`)
189    tnom: "tnom" = None;
190    /// Gate-source overlap capacitance per width (`BSIM3cgso`)
191    cgso: "cgso" = None;
192    /// Gate-drain overlap capacitance per width (`BSIM3cgdo`)
193    cgdo: "cgdo" = None;
194    /// Gate-bulk overlap capacitance per length (`BSIM3cgbo`)
195    cgbo: "cgbo" = None;
196    /// Channel charge partitioning (`BSIM3xpart`)
197    xpart: "xpart" = Some(0.0);
198    /// Non-quasi-static Elmore Constant Parameter (`BSIM3elm`)
199    elm: "elm" = Some(5.0);
200    /// Effective Vds parameter (`BSIM3delta`)
201    delta: "delta" = Some(0.01);
202    /// Source-drain sheet resistance (`BSIM3sheetResistance`)
203    sheet_resistance: "rsh" = Some(0.0);
204    /// Source-drain resistance per width (`BSIM3rdsw`)
205    rdsw: "rdsw" = Some(0.0);
206    /// Gate-bias effect on parasitic resistance (`BSIM3prwg`)
207    prwg: "prwg" = Some(0.0);
208    /// Body-effect on parasitic resistance (`BSIM3prwb`)
209    prwb: "prwb" = Some(0.0);
210    /// Temperature coefficient of parasitic resistance (`BSIM3prt`)
211    prt: "prt" = Some(0.0);
212    /// Subthreshold region DIBL coefficient (`BSIM3eta0`)
213    eta0: "eta0" = Some(0.08);
214    /// Subthreshold region DIBL coefficient (`BSIM3etab`)
215    etab: "etab" = Some(-0.07);
216    /// Channel length modulation Coefficient (`BSIM3pclm`)
217    pclm: "pclm" = Some(1.3);
218    /// Drain-induced barrier lowering coefficient (`BSIM3pdibl1`)
219    pdibl1: "pdiblc1" = Some(0.39);
220    /// Drain-induced barrier lowering coefficient (`BSIM3pdibl2`)
221    pdibl2: "pdiblc2" = Some(0.0086);
222    /// Body-effect on drain-induced barrier lowering (`BSIM3pdiblb`)
223    pdiblb: "pdiblcb" = Some(0.0);
224    /// Substrate current body-effect coefficient (`BSIM3pscbe1`)
225    pscbe1: "pscbe1" = Some(4.24e8);
226    /// Substrate current body-effect coefficient (`BSIM3pscbe2`)
227    pscbe2: "pscbe2" = Some(1.0e-5);
228    /// Gate dependence of output resistance parameter (`BSIM3pvag`)
229    pvag: "pvag" = Some(0.0);
230    /// Source/drain junction reverse saturation current density (`BSIM3jctSatCurDensity`)
231    jct_sat_cur_density: "js" = Some(1.0E-4);
232    /// Sidewall junction reverse saturation current density (`BSIM3jctSidewallSatCurDensity`)
233    jct_sidewall_sat_cur_density: "jsw" = Some(0.0);
234    /// Source/drain junction built-in potential (`BSIM3bulkJctPotential`)
235    bulk_jct_potential: "pb" = Some(1.0);
236    /// Source/drain junction emission coefficient (`BSIM3jctEmissionCoeff`)
237    jct_emission_coeff: "nj" = Some(1.0);
238    /// Junction current temperature exponent (`BSIM3jctTempExponent`)
239    jct_temp_exponent: "xti" = Some(3.0);
240    /// Source/drain bottom junction capacitance grading coefficient (`BSIM3bulkJctBotGradingCoeff`)
241    bulk_jct_bot_grading_coeff: "mj" = Some(0.5);
242    /// Source/drain sidewall junction capacitance built in potential (`BSIM3sidewallJctPotential`)
243    sidewall_jct_potential: "pbsw" = Some(1.0);
244    /// Source/drain sidewall junction capacitance grading coefficient (`BSIM3bulkJctSideGradingCoeff`)
245    bulk_jct_side_grading_coeff: "mjsw" = Some(0.33);
246    /// Source/drain (gate side) sidewall junction capacitance built in potential (`BSIM3GatesidewallJctPotential`)
247    gatesidewall_jct_potential: "pbswg" = None;
248    /// Source/drain (gate side) sidewall junction capacitance grading coefficient (`BSIM3bulkJctGateSideGradingCoeff`)
249    bulk_jct_gate_side_grading_coeff: "mjswg" = None;
250    /// Source/drain bottom junction capacitance per unit area (`BSIM3unitAreaJctCap`)
251    unit_area_jct_cap: "cj" = Some(5.0E-4);
252    /// Flat Band Voltage parameter for capmod=0 only (`BSIM3vfbcv`)
253    vfbcv: "vfbcv" = Some(-1.0);
254    /// Flat Band Voltage (`BSIM3vfb`)
255    vfb: "vfb" = None;
256    /// Source/drain sidewall junction capacitance per unit periphery (`BSIM3unitLengthSidewallJctCap`)
257    unit_length_sidewall_jct_cap: "cjsw" = Some(5.0E-10);
258    /// Source/drain (gate side) sidewall junction capacitance per unit width (`BSIM3unitLengthGateSidewallJctCap`)
259    unit_length_gate_sidewall_jct_cap: "cjswg" = None;
260    /// Temperature coefficient of pb (`BSIM3tpb`)
261    tpb: "tpb" = Some(0.0);
262    /// Temperature coefficient of cj (`BSIM3tcj`)
263    tcj: "tcj" = Some(0.0);
264    /// Temperature coefficient of pbsw (`BSIM3tpbsw`)
265    tpbsw: "tpbsw" = Some(0.0);
266    /// Temperature coefficient of cjsw (`BSIM3tcjsw`)
267    tcjsw: "tcjsw" = Some(0.0);
268    /// Temperature coefficient of pbswg (`BSIM3tpbswg`)
269    tpbswg: "tpbswg" = Some(0.0);
270    /// Temperature coefficient of cjswg (`BSIM3tcjswg`)
271    tcjswg: "tcjswg" = Some(0.0);
272    /// Exponential coefficient for finite charge thickness (`BSIM3acde`)
273    acde: "acde" = Some(1.0);
274    /// Coefficient for gate-bias dependent surface potential (`BSIM3moin`)
275    moin: "moin" = Some(15.0);
276    /// C-V turn-on/off parameter (`BSIM3noff`)
277    noff: "noff" = Some(1.0);
278    /// C-V lateral-shift parameter (`BSIM3voffcv`)
279    voffcv: "voffcv" = Some(0.0);
280    /// lint offset for noise calculation (`BSIM3lintnoi`)
281    lintnoi: "lintnoi" = Some(0.0);
282    /// Length reduction parameter (`BSIM3Lint`)
283    lint: "lint" = Some(0.0);
284    /// Length reduction parameter (`BSIM3Ll`)
285    ll: "ll" = Some(0.0);
286    /// Length reduction parameter for CV (`BSIM3Llc`)
287    llc: "llc" = None;
288    /// Length reduction parameter (`BSIM3Lln`)
289    lln: "lln" = Some(1.0);
290    /// Length reduction parameter (`BSIM3Lw`)
291    lw: "lw" = Some(0.0);
292    /// Length reduction parameter for CV (`BSIM3Lwc`)
293    lwc: "lwc" = None;
294    /// Length reduction parameter (`BSIM3Lwn`)
295    lwn: "lwn" = Some(1.0);
296    /// Length reduction parameter (`BSIM3Lwl`)
297    lwl: "lwl" = Some(0.0);
298    /// Length reduction parameter for CV (`BSIM3Lwlc`)
299    lwlc: "lwlc" = None;
300    /// Minimum length for the model (`BSIM3Lmin`)
301    lmin: "lmin" = Some(0.0);
302    /// Maximum length for the model (`BSIM3Lmax`)
303    lmax: "lmax" = Some(1.0);
304    /// Length correction parameter (`BSIM3xl`)
305    xl: "xl" = Some(0.0);
306    /// Width correction parameter (`BSIM3xw`)
307    xw: "xw" = Some(0.0);
308    /// Width dependence of rds (`BSIM3wr`)
309    wr: "wr" = Some(1.0);
310    /// Width reduction parameter (`BSIM3Wint`)
311    wint: "wint" = Some(0.0);
312    /// Width reduction parameter (`BSIM3dwg`)
313    dwg: "dwg" = Some(0.0);
314    /// Width reduction parameter (`BSIM3dwb`)
315    dwb: "dwb" = Some(0.0);
316    /// Width reduction parameter (`BSIM3Wl`)
317    wl: "wl" = Some(0.0);
318    /// Width reduction parameter for CV (`BSIM3Wlc`)
319    wlc: "wlc" = None;
320    /// Width reduction parameter (`BSIM3Wln`)
321    wln: "wln" = Some(1.0);
322    /// Width reduction parameter (`BSIM3Ww`)
323    ww: "ww" = Some(0.0);
324    /// Width reduction parameter for CV (`BSIM3Wwc`)
325    wwc: "wwc" = None;
326    /// Width reduction parameter (`BSIM3Wwn`)
327    wwn: "wwn" = Some(1.0);
328    /// Width reduction parameter (`BSIM3Wwl`)
329    wwl: "wwl" = Some(0.0);
330    /// Width reduction parameter for CV (`BSIM3Wwlc`)
331    wwlc: "wwlc" = None;
332    /// Minimum width for the model (`BSIM3Wmin`)
333    wmin: "wmin" = Some(0.0);
334    /// Maximum width for the model (`BSIM3Wmax`)
335    wmax: "wmax" = Some(1.0);
336    /// Abulk narrow width parameter (`BSIM3b0`)
337    b0: "b0" = Some(0.0);
338    /// Abulk narrow width parameter (`BSIM3b1`)
339    b1: "b1" = Some(0.0);
340    /// New C-V model parameter (`BSIM3cgsl`)
341    cgsl: "cgsl" = Some(0.0);
342    /// New C-V model parameter (`BSIM3cgdl`)
343    cgdl: "cgdl" = Some(0.0);
344    /// New C-V model parameter (`BSIM3ckappa`)
345    ckappa: "ckappa" = Some(0.6);
346    /// Fringe capacitance parameter (`BSIM3cf`)
347    cf: "cf" = None;
348    /// Vdsat parameter for C-V model (`BSIM3clc`)
349    clc: "clc" = Some(0.1e-6);
350    /// Vdsat parameter for C-V model (`BSIM3cle`)
351    cle: "cle" = Some(0.6);
352    /// Delta W for C-V model (`BSIM3dwc`)
353    dwc: "dwc" = None;
354    /// Delta L for C-V model (`BSIM3dlc`)
355    dlc: "dlc" = None;
356    /// ACM Parameter: Distance Gate - contact (`BSIM3hdif`)
357    hdif: "hdif" = Some(0.0);
358    /// ACM Parameter: Length of LDD Gate-Source/Drain (`BSIM3ldif`)
359    ldif: "ldif" = Some(0.0);
360    /// ACM Parameter: Length of LDD under Gate (`BSIM3ld`)
361    ld: "ld" = Some(0.0);
362    /// ACM Parameter: Resistance of LDD drain side (`BSIM3rd`)
363    rd: "rd" = Some(0.0);
364    /// ACM Parameter: Resistance of LDD source side (`BSIM3rs`)
365    rs: "rs" = Some(0.0);
366    /// ACM Parameter: Resistance contact drain side (`BSIM3rdc`)
367    rdc: "rdc" = Some(0.0);
368    /// ACM Parameter: Resistance contact source side (`BSIM3rsc`)
369    rsc: "rsc" = Some(0.0);
370    /// ACM Parameter: Width shrink factor (`BSIM3wmlt`)
371    wmlt: "wmlt" = Some(1.0);
372    /// substrate current model parameter (`BSIM3alpha0`)
373    alpha0: "alpha0" = Some(0.0);
374    /// substrate current model parameter (`BSIM3alpha1`)
375    alpha1: "alpha1" = Some(0.0);
376    /// substrate current model parameter (`BSIM3beta0`)
377    beta0: "beta0" = Some(30.0);
378    /// Diode limiting current (`BSIM3ijth`)
379    ijth: "ijth" = Some(0.1);
380    /// Length dependence of cdsc (`BSIM3lcdsc`)
381    lcdsc: "lcdsc" = Some(0.0);
382    /// Length dependence of cdscb (`BSIM3lcdscb`)
383    lcdscb: "lcdscb" = Some(0.0);
384    /// Length dependence of cdscd (`BSIM3lcdscd`)
385    lcdscd: "lcdscd" = Some(0.0);
386    /// Length dependence of cit (`BSIM3lcit`)
387    lcit: "lcit" = Some(0.0);
388    /// Length dependence of nfactor (`BSIM3lnfactor`)
389    lnfactor: "lnfactor" = Some(0.0);
390    /// Length dependence of xj (`BSIM3lxj`)
391    lxj: "lxj" = Some(0.0);
392    /// Length dependence of vsat (`BSIM3lvsat`)
393    lvsat: "lvsat" = Some(0.0);
394    /// Length dependence of at (`BSIM3lat`)
395    lat: "lat" = Some(0.0);
396    /// Length dependence of a0 (`BSIM3la0`)
397    la0: "la0" = Some(0.0);
398    /// Length dependence of ags (`BSIM3lags`)
399    lags: "lags" = Some(0.0);
400    /// Length dependence of a1 (`BSIM3la1`)
401    la1: "la1" = Some(0.0);
402    /// Length dependence of a2 (`BSIM3la2`)
403    la2: "la2" = Some(0.0);
404    /// Length dependence of keta (`BSIM3lketa`)
405    lketa: "lketa" = Some(0.0);
406    /// Length dependence of nsub (`BSIM3lnsub`)
407    lnsub: "lnsub" = Some(0.0);
408    /// Length dependence of nch (`BSIM3lnpeak`)
409    lnpeak: "lnch" = Some(0.0);
410    /// Length dependence of ngate (`BSIM3lngate`)
411    lngate: "lngate" = Some(0.0);
412    /// Length dependence of gamma1 (`BSIM3lgamma1`)
413    lgamma1: "lgamma1" = None;
414    /// Length dependence of gamma2 (`BSIM3lgamma2`)
415    lgamma2: "lgamma2" = None;
416    /// Length dependence of vbx (`BSIM3lvbx`)
417    lvbx: "lvbx" = None;
418    /// Length dependence of vbm (`BSIM3lvbm`)
419    lvbm: "lvbm" = Some(0.0);
420    /// Length dependence of xt (`BSIM3lxt`)
421    lxt: "lxt" = Some(0.0);
422    /// Length dependence of k1 (`BSIM3lk1`)
423    lk1: "lk1" = None;
424    /// Length dependence of kt1 (`BSIM3lkt1`)
425    lkt1: "lkt1" = Some(0.0);
426    /// Length dependence of kt1l (`BSIM3lkt1l`)
427    lkt1l: "lkt1l" = Some(0.0);
428    /// Length dependence of kt2 (`BSIM3lkt2`)
429    lkt2: "lkt2" = Some(0.0);
430    /// Length dependence of k2 (`BSIM3lk2`)
431    lk2: "lk2" = None;
432    /// Length dependence of k3 (`BSIM3lk3`)
433    lk3: "lk3" = Some(0.0);
434    /// Length dependence of k3b (`BSIM3lk3b`)
435    lk3b: "lk3b" = Some(0.0);
436    /// Length dependence of w0 (`BSIM3lw0`)
437    lw0: "lw0" = Some(0.0);
438    /// Length dependence of nlx (`BSIM3lnlx`)
439    lnlx: "lnlx" = Some(0.0);
440    /// Length dependence of dvt0 (`BSIM3ldvt0`)
441    ldvt0: "ldvt0" = Some(0.0);
442    /// Length dependence of dvt1 (`BSIM3ldvt1`)
443    ldvt1: "ldvt1" = Some(0.0);
444    /// Length dependence of dvt2 (`BSIM3ldvt2`)
445    ldvt2: "ldvt2" = Some(0.0);
446    /// Length dependence of dvt0w (`BSIM3ldvt0w`)
447    ldvt0w: "ldvt0w" = Some(0.0);
448    /// Length dependence of dvt1w (`BSIM3ldvt1w`)
449    ldvt1w: "ldvt1w" = Some(0.0);
450    /// Length dependence of dvt2w (`BSIM3ldvt2w`)
451    ldvt2w: "ldvt2w" = Some(0.0);
452    /// Length dependence of drout (`BSIM3ldrout`)
453    ldrout: "ldrout" = Some(0.0);
454    /// Length dependence of dsub (`BSIM3ldsub`)
455    ldsub: "ldsub" = Some(0.0);
456    /// Length dependence of vth0 (`BSIM3lvth0`)
457    lvth0: "lvth0" | "lvtho" = Some(0.0);
458    /// Length dependence of ua (`BSIM3lua`)
459    lua: "lua" = Some(0.0);
460    /// Length dependence of ua1 (`BSIM3lua1`)
461    lua1: "lua1" = Some(0.0);
462    /// Length dependence of ub (`BSIM3lub`)
463    lub: "lub" = Some(0.0);
464    /// Length dependence of ub1 (`BSIM3lub1`)
465    lub1: "lub1" = Some(0.0);
466    /// Length dependence of uc (`BSIM3luc`)
467    luc: "luc" = Some(0.0);
468    /// Length dependence of uc1 (`BSIM3luc1`)
469    luc1: "luc1" = Some(0.0);
470    /// Length dependence of u0 (`BSIM3lu0`)
471    lu0: "lu0" = Some(0.0);
472    /// Length dependence of ute (`BSIM3lute`)
473    lute: "lute" = Some(0.0);
474    /// Length dependence of voff (`BSIM3lvoff`)
475    lvoff: "lvoff" = Some(0.0);
476    /// Length dependence of elm (`BSIM3lelm`)
477    lelm: "lelm" = Some(0.0);
478    /// Length dependence of delta (`BSIM3ldelta`)
479    ldelta: "ldelta" = Some(0.0);
480    /// Length dependence of rdsw (`BSIM3lrdsw`)
481    lrdsw: "lrdsw" = Some(0.0);
482    /// Length dependence of prwg (`BSIM3lprwg`)
483    lprwg: "lprwg" = Some(0.0);
484    /// Length dependence of prwb (`BSIM3lprwb`)
485    lprwb: "lprwb" = Some(0.0);
486    /// Length dependence of prt (`BSIM3lprt`)
487    lprt: "lprt" = Some(0.0);
488    /// Length dependence of eta0 (`BSIM3leta0`)
489    leta0: "leta0" = Some(0.0);
490    /// Length dependence of etab (`BSIM3letab`)
491    letab: "letab" = Some(-0.0);
492    /// Length dependence of pclm (`BSIM3lpclm`)
493    lpclm: "lpclm" = Some(0.0);
494    /// Length dependence of pdiblc1 (`BSIM3lpdibl1`)
495    lpdibl1: "lpdiblc1" = Some(0.0);
496    /// Length dependence of pdiblc2 (`BSIM3lpdibl2`)
497    lpdibl2: "lpdiblc2" = Some(0.0);
498    /// Length dependence of pdiblcb (`BSIM3lpdiblb`)
499    lpdiblb: "lpdiblcb" = Some(0.0);
500    /// Length dependence of pscbe1 (`BSIM3lpscbe1`)
501    lpscbe1: "lpscbe1" = Some(0.0);
502    /// Length dependence of pscbe2 (`BSIM3lpscbe2`)
503    lpscbe2: "lpscbe2" = Some(0.0);
504    /// Length dependence of pvag (`BSIM3lpvag`)
505    lpvag: "lpvag" = Some(0.0);
506    /// Length dependence of wr (`BSIM3lwr`)
507    lwr: "lwr" = Some(0.0);
508    /// Length dependence of dwg (`BSIM3ldwg`)
509    ldwg: "ldwg" = Some(0.0);
510    /// Length dependence of dwb (`BSIM3ldwb`)
511    ldwb: "ldwb" = Some(0.0);
512    /// Length dependence of b0 (`BSIM3lb0`)
513    lb0: "lb0" = Some(0.0);
514    /// Length dependence of b1 (`BSIM3lb1`)
515    lb1: "lb1" = Some(0.0);
516    /// Length dependence of cgsl (`BSIM3lcgsl`)
517    lcgsl: "lcgsl" = Some(0.0);
518    /// Length dependence of cgdl (`BSIM3lcgdl`)
519    lcgdl: "lcgdl" = Some(0.0);
520    /// Length dependence of ckappa (`BSIM3lckappa`)
521    lckappa: "lckappa" = Some(0.0);
522    /// Length dependence of cf (`BSIM3lcf`)
523    lcf: "lcf" = Some(0.0);
524    /// Length dependence of clc (`BSIM3lclc`)
525    lclc: "lclc" = Some(0.0);
526    /// Length dependence of cle (`BSIM3lcle`)
527    lcle: "lcle" = Some(0.0);
528    /// Length dependence of alpha0 (`BSIM3lalpha0`)
529    lalpha0: "lalpha0" = Some(0.0);
530    /// Length dependence of alpha1 (`BSIM3lalpha1`)
531    lalpha1: "lalpha1" = Some(0.0);
532    /// Length dependence of beta0 (`BSIM3lbeta0`)
533    lbeta0: "lbeta0" = Some(0.0);
534    /// Length dependence of vfbcv (`BSIM3lvfbcv`)
535    lvfbcv: "lvfbcv" = Some(0.0);
536    /// Length dependence of vfb (`BSIM3lvfb`)
537    lvfb: "lvfb" = Some(0.0);
538    /// Length dependence of acde (`BSIM3lacde`)
539    lacde: "lacde" = Some(0.0);
540    /// Length dependence of moin (`BSIM3lmoin`)
541    lmoin: "lmoin" = Some(0.0);
542    /// Length dependence of noff (`BSIM3lnoff`)
543    lnoff: "lnoff" = Some(0.0);
544    /// Length dependence of voffcv (`BSIM3lvoffcv`)
545    lvoffcv: "lvoffcv" = Some(0.0);
546    /// Width dependence of cdsc (`BSIM3wcdsc`)
547    wcdsc: "wcdsc" = Some(0.0);
548    /// Width dependence of cdscb (`BSIM3wcdscb`)
549    wcdscb: "wcdscb" = Some(0.0);
550    /// Width dependence of cdscd (`BSIM3wcdscd`)
551    wcdscd: "wcdscd" = Some(0.0);
552    /// Width dependence of cit (`BSIM3wcit`)
553    wcit: "wcit" = Some(0.0);
554    /// Width dependence of nfactor (`BSIM3wnfactor`)
555    wnfactor: "wnfactor" = Some(0.0);
556    /// Width dependence of xj (`BSIM3wxj`)
557    wxj: "wxj" = Some(0.0);
558    /// Width dependence of vsat (`BSIM3wvsat`)
559    wvsat: "wvsat" = Some(0.0);
560    /// Width dependence of at (`BSIM3wat`)
561    wat: "wat" = Some(0.0);
562    /// Width dependence of a0 (`BSIM3wa0`)
563    wa0: "wa0" = Some(0.0);
564    /// Width dependence of ags (`BSIM3wags`)
565    wags: "wags" = Some(0.0);
566    /// Width dependence of a1 (`BSIM3wa1`)
567    wa1: "wa1" = Some(0.0);
568    /// Width dependence of a2 (`BSIM3wa2`)
569    wa2: "wa2" = Some(0.0);
570    /// Width dependence of keta (`BSIM3wketa`)
571    wketa: "wketa" = Some(0.0);
572    /// Width dependence of nsub (`BSIM3wnsub`)
573    wnsub: "wnsub" = Some(0.0);
574    /// Width dependence of nch (`BSIM3wnpeak`)
575    wnpeak: "wnch" = Some(0.0);
576    /// Width dependence of ngate (`BSIM3wngate`)
577    wngate: "wngate" = Some(0.0);
578    /// Width dependence of gamma1 (`BSIM3wgamma1`)
579    wgamma1: "wgamma1" = None;
580    /// Width dependence of gamma2 (`BSIM3wgamma2`)
581    wgamma2: "wgamma2" = None;
582    /// Width dependence of vbx (`BSIM3wvbx`)
583    wvbx: "wvbx" = None;
584    /// Width dependence of vbm (`BSIM3wvbm`)
585    wvbm: "wvbm" = Some(0.0);
586    /// Width dependence of xt (`BSIM3wxt`)
587    wxt: "wxt" = Some(0.0);
588    /// Width dependence of k1 (`BSIM3wk1`)
589    wk1: "wk1" = None;
590    /// Width dependence of kt1 (`BSIM3wkt1`)
591    wkt1: "wkt1" = Some(0.0);
592    /// Width dependence of kt1l (`BSIM3wkt1l`)
593    wkt1l: "wkt1l" = Some(0.0);
594    /// Width dependence of kt2 (`BSIM3wkt2`)
595    wkt2: "wkt2" = Some(0.0);
596    /// Width dependence of k2 (`BSIM3wk2`)
597    wk2: "wk2" = None;
598    /// Width dependence of k3 (`BSIM3wk3`)
599    wk3: "wk3" = Some(0.0);
600    /// Width dependence of k3b (`BSIM3wk3b`)
601    wk3b: "wk3b" = Some(0.0);
602    /// Width dependence of w0 (`BSIM3ww0`)
603    ww0: "ww0" = Some(0.0);
604    /// Width dependence of nlx (`BSIM3wnlx`)
605    wnlx: "wnlx" = Some(0.0);
606    /// Width dependence of dvt0 (`BSIM3wdvt0`)
607    wdvt0: "wdvt0" = Some(0.0);
608    /// Width dependence of dvt1 (`BSIM3wdvt1`)
609    wdvt1: "wdvt1" = Some(0.0);
610    /// Width dependence of dvt2 (`BSIM3wdvt2`)
611    wdvt2: "wdvt2" = Some(0.0);
612    /// Width dependence of dvt0w (`BSIM3wdvt0w`)
613    wdvt0w: "wdvt0w" = Some(0.0);
614    /// Width dependence of dvt1w (`BSIM3wdvt1w`)
615    wdvt1w: "wdvt1w" = Some(0.0);
616    /// Width dependence of dvt2w (`BSIM3wdvt2w`)
617    wdvt2w: "wdvt2w" = Some(0.0);
618    /// Width dependence of drout (`BSIM3wdrout`)
619    wdrout: "wdrout" = Some(0.0);
620    /// Width dependence of dsub (`BSIM3wdsub`)
621    wdsub: "wdsub" = Some(0.0);
622    /// Width dependence of vth0 (`BSIM3wvth0`)
623    wvth0: "wvth0" | "wvtho" = Some(0.0);
624    /// Width dependence of ua (`BSIM3wua`)
625    wua: "wua" = Some(0.0);
626    /// Width dependence of ua1 (`BSIM3wua1`)
627    wua1: "wua1" = Some(0.0);
628    /// Width dependence of ub (`BSIM3wub`)
629    wub: "wub" = Some(0.0);
630    /// Width dependence of ub1 (`BSIM3wub1`)
631    wub1: "wub1" = Some(0.0);
632    /// Width dependence of uc (`BSIM3wuc`)
633    wuc: "wuc" = Some(0.0);
634    /// Width dependence of uc1 (`BSIM3wuc1`)
635    wuc1: "wuc1" = Some(0.0);
636    /// Width dependence of u0 (`BSIM3wu0`)
637    wu0: "wu0" = Some(0.0);
638    /// Width dependence of ute (`BSIM3wute`)
639    wute: "wute" = Some(0.0);
640    /// Width dependence of voff (`BSIM3wvoff`)
641    wvoff: "wvoff" = Some(0.0);
642    /// Width dependence of elm (`BSIM3welm`)
643    welm: "welm" = Some(0.0);
644    /// Width dependence of delta (`BSIM3wdelta`)
645    wdelta: "wdelta" = Some(0.0);
646    /// Width dependence of rdsw (`BSIM3wrdsw`)
647    wrdsw: "wrdsw" = Some(0.0);
648    /// Width dependence of prwg (`BSIM3wprwg`)
649    wprwg: "wprwg" = Some(0.0);
650    /// Width dependence of prwb (`BSIM3wprwb`)
651    wprwb: "wprwb" = Some(0.0);
652    /// Width dependence of prt (`BSIM3wprt`)
653    wprt: "wprt" = Some(0.0);
654    /// Width dependence of eta0 (`BSIM3weta0`)
655    weta0: "weta0" = Some(0.0);
656    /// Width dependence of etab (`BSIM3wetab`)
657    wetab: "wetab" = Some(0.0);
658    /// Width dependence of pclm (`BSIM3wpclm`)
659    wpclm: "wpclm" = Some(0.0);
660    /// Width dependence of pdiblc1 (`BSIM3wpdibl1`)
661    wpdibl1: "wpdiblc1" = Some(0.0);
662    /// Width dependence of pdiblc2 (`BSIM3wpdibl2`)
663    wpdibl2: "wpdiblc2" = Some(0.0);
664    /// Width dependence of pdiblcb (`BSIM3wpdiblb`)
665    wpdiblb: "wpdiblcb" = Some(0.0);
666    /// Width dependence of pscbe1 (`BSIM3wpscbe1`)
667    wpscbe1: "wpscbe1" = Some(0.0);
668    /// Width dependence of pscbe2 (`BSIM3wpscbe2`)
669    wpscbe2: "wpscbe2" = Some(0.0);
670    /// Width dependence of pvag (`BSIM3wpvag`)
671    wpvag: "wpvag" = Some(0.0);
672    /// Width dependence of wr (`BSIM3wwr`)
673    wwr: "wwr" = Some(0.0);
674    /// Width dependence of dwg (`BSIM3wdwg`)
675    wdwg: "wdwg" = Some(0.0);
676    /// Width dependence of dwb (`BSIM3wdwb`)
677    wdwb: "wdwb" = Some(0.0);
678    /// Width dependence of b0 (`BSIM3wb0`)
679    wb0: "wb0" = Some(0.0);
680    /// Width dependence of b1 (`BSIM3wb1`)
681    wb1: "wb1" = Some(0.0);
682    /// Width dependence of cgsl (`BSIM3wcgsl`)
683    wcgsl: "wcgsl" = Some(0.0);
684    /// Width dependence of cgdl (`BSIM3wcgdl`)
685    wcgdl: "wcgdl" = Some(0.0);
686    /// Width dependence of ckappa (`BSIM3wckappa`)
687    wckappa: "wckappa" = Some(0.0);
688    /// Width dependence of cf (`BSIM3wcf`)
689    wcf: "wcf" = Some(0.0);
690    /// Width dependence of clc (`BSIM3wclc`)
691    wclc: "wclc" = Some(0.0);
692    /// Width dependence of cle (`BSIM3wcle`)
693    wcle: "wcle" = Some(0.0);
694    /// Width dependence of alpha0 (`BSIM3walpha0`)
695    walpha0: "walpha0" = Some(0.0);
696    /// Width dependence of alpha1 (`BSIM3walpha1`)
697    walpha1: "walpha1" = Some(0.0);
698    /// Width dependence of beta0 (`BSIM3wbeta0`)
699    wbeta0: "wbeta0" = Some(0.0);
700    /// Width dependence of vfbcv (`BSIM3wvfbcv`)
701    wvfbcv: "wvfbcv" = Some(0.0);
702    /// Width dependence of vfb (`BSIM3wvfb`)
703    wvfb: "wvfb" = Some(0.0);
704    /// Width dependence of acde (`BSIM3wacde`)
705    wacde: "wacde" = Some(0.0);
706    /// Width dependence of moin (`BSIM3wmoin`)
707    wmoin: "wmoin" = Some(0.0);
708    /// Width dependence of noff (`BSIM3wnoff`)
709    wnoff: "wnoff" = Some(0.0);
710    /// Width dependence of voffcv (`BSIM3wvoffcv`)
711    wvoffcv: "wvoffcv" = Some(0.0);
712    /// Cross-term dependence of cdsc (`BSIM3pcdsc`)
713    pcdsc: "pcdsc" = Some(0.0);
714    /// Cross-term dependence of cdscb (`BSIM3pcdscb`)
715    pcdscb: "pcdscb" = Some(0.0);
716    /// Cross-term dependence of cdscd (`BSIM3pcdscd`)
717    pcdscd: "pcdscd" = Some(0.0);
718    /// Cross-term dependence of cit (`BSIM3pcit`)
719    pcit: "pcit" = Some(0.0);
720    /// Cross-term dependence of nfactor (`BSIM3pnfactor`)
721    pnfactor: "pnfactor" = Some(0.0);
722    /// Cross-term dependence of xj (`BSIM3pxj`)
723    pxj: "pxj" = Some(0.0);
724    /// Cross-term dependence of vsat (`BSIM3pvsat`)
725    pvsat: "pvsat" = Some(0.0);
726    /// Cross-term dependence of at (`BSIM3pat`)
727    pat: "pat" = Some(0.0);
728    /// Cross-term dependence of a0 (`BSIM3pa0`)
729    pa0: "pa0" = Some(0.0);
730    /// Cross-term dependence of ags (`BSIM3pags`)
731    pags: "pags" = Some(0.0);
732    /// Cross-term dependence of a1 (`BSIM3pa1`)
733    pa1: "pa1" = Some(0.0);
734    /// Cross-term dependence of a2 (`BSIM3pa2`)
735    pa2: "pa2" = Some(0.0);
736    /// Cross-term dependence of keta (`BSIM3pketa`)
737    pketa: "pketa" = Some(0.0);
738    /// Cross-term dependence of nsub (`BSIM3pnsub`)
739    pnsub: "pnsub" = Some(0.0);
740    /// Cross-term dependence of nch (`BSIM3pnpeak`)
741    pnpeak: "pnch" = Some(0.0);
742    /// Cross-term dependence of ngate (`BSIM3pngate`)
743    pngate: "pngate" = Some(0.0);
744    /// Cross-term dependence of gamma1 (`BSIM3pgamma1`)
745    pgamma1: "pgamma1" = None;
746    /// Cross-term dependence of gamma2 (`BSIM3pgamma2`)
747    pgamma2: "pgamma2" = None;
748    /// Cross-term dependence of vbx (`BSIM3pvbx`)
749    pvbx: "pvbx" = None;
750    /// Cross-term dependence of vbm (`BSIM3pvbm`)
751    pvbm: "pvbm" = Some(0.0);
752    /// Cross-term dependence of xt (`BSIM3pxt`)
753    pxt: "pxt" = Some(0.0);
754    /// Cross-term dependence of k1 (`BSIM3pk1`)
755    pk1: "pk1" = None;
756    /// Cross-term dependence of kt1 (`BSIM3pkt1`)
757    pkt1: "pkt1" = Some(0.0);
758    /// Cross-term dependence of kt1l (`BSIM3pkt1l`)
759    pkt1l: "pkt1l" = Some(0.0);
760    /// Cross-term dependence of kt2 (`BSIM3pkt2`)
761    pkt2: "pkt2" = Some(0.0);
762    /// Cross-term dependence of k2 (`BSIM3pk2`)
763    pk2: "pk2" = None;
764    /// Cross-term dependence of k3 (`BSIM3pk3`)
765    pk3: "pk3" = Some(0.0);
766    /// Cross-term dependence of k3b (`BSIM3pk3b`)
767    pk3b: "pk3b" = Some(0.0);
768    /// Cross-term dependence of w0 (`BSIM3pw0`)
769    pw0: "pw0" = Some(0.0);
770    /// Cross-term dependence of nlx (`BSIM3pnlx`)
771    pnlx: "pnlx" = Some(0.0);
772    /// Cross-term dependence of dvt0 (`BSIM3pdvt0`)
773    pdvt0: "pdvt0" = Some(0.0);
774    /// Cross-term dependence of dvt1 (`BSIM3pdvt1`)
775    pdvt1: "pdvt1" = Some(0.0);
776    /// Cross-term dependence of dvt2 (`BSIM3pdvt2`)
777    pdvt2: "pdvt2" = Some(0.0);
778    /// Cross-term dependence of dvt0w (`BSIM3pdvt0w`)
779    pdvt0w: "pdvt0w" = Some(0.0);
780    /// Cross-term dependence of dvt1w (`BSIM3pdvt1w`)
781    pdvt1w: "pdvt1w" = Some(0.0);
782    /// Cross-term dependence of dvt2w (`BSIM3pdvt2w`)
783    pdvt2w: "pdvt2w" = Some(0.0);
784    /// Cross-term dependence of drout (`BSIM3pdrout`)
785    pdrout: "pdrout" = Some(0.0);
786    /// Cross-term dependence of dsub (`BSIM3pdsub`)
787    pdsub: "pdsub" = Some(0.0);
788    /// Cross-term dependence of vth0 (`BSIM3pvth0`)
789    pvth0: "pvth0" | "pvtho" = Some(0.0);
790    /// Cross-term dependence of ua (`BSIM3pua`)
791    pua: "pua" = Some(0.0);
792    /// Cross-term dependence of ua1 (`BSIM3pua1`)
793    pua1: "pua1" = Some(0.0);
794    /// Cross-term dependence of ub (`BSIM3pub`)
795    pub_: "pub" = Some(0.0);
796    /// Cross-term dependence of ub1 (`BSIM3pub1`)
797    pub1: "pub1" = Some(0.0);
798    /// Cross-term dependence of uc (`BSIM3puc`)
799    puc: "puc" = Some(0.0);
800    /// Cross-term dependence of uc1 (`BSIM3puc1`)
801    puc1: "puc1" = Some(0.0);
802    /// Cross-term dependence of u0 (`BSIM3pu0`)
803    pu0: "pu0" = Some(0.0);
804    /// Cross-term dependence of ute (`BSIM3pute`)
805    pute: "pute" = Some(0.0);
806    /// Cross-term dependence of voff (`BSIM3pvoff`)
807    pvoff: "pvoff" = Some(0.0);
808    /// Cross-term dependence of elm (`BSIM3pelm`)
809    pelm: "pelm" = Some(0.0);
810    /// Cross-term dependence of delta (`BSIM3pdelta`)
811    pdelta: "pdelta" = Some(0.0);
812    /// Cross-term dependence of rdsw (`BSIM3prdsw`)
813    prdsw: "prdsw" = Some(0.0);
814    /// Cross-term dependence of prwg (`BSIM3pprwg`)
815    pprwg: "pprwg" = Some(0.0);
816    /// Cross-term dependence of prwb (`BSIM3pprwb`)
817    pprwb: "pprwb" = Some(0.0);
818    /// Cross-term dependence of prt (`BSIM3pprt`)
819    pprt: "pprt" = Some(0.0);
820    /// Cross-term dependence of eta0 (`BSIM3peta0`)
821    peta0: "peta0" = Some(0.0);
822    /// Cross-term dependence of etab (`BSIM3petab`)
823    petab: "petab" = Some(0.0);
824    /// Cross-term dependence of pclm (`BSIM3ppclm`)
825    ppclm: "ppclm" = Some(0.0);
826    /// Cross-term dependence of pdiblc1 (`BSIM3ppdibl1`)
827    ppdibl1: "ppdiblc1" = Some(0.0);
828    /// Cross-term dependence of pdiblc2 (`BSIM3ppdibl2`)
829    ppdibl2: "ppdiblc2" = Some(0.0);
830    /// Cross-term dependence of pdiblcb (`BSIM3ppdiblb`)
831    ppdiblb: "ppdiblcb" = Some(0.0);
832    /// Cross-term dependence of pscbe1 (`BSIM3ppscbe1`)
833    ppscbe1: "ppscbe1" = Some(0.0);
834    /// Cross-term dependence of pscbe2 (`BSIM3ppscbe2`)
835    ppscbe2: "ppscbe2" = Some(0.0);
836    /// Cross-term dependence of pvag (`BSIM3ppvag`)
837    ppvag: "ppvag" = Some(0.0);
838    /// Cross-term dependence of wr (`BSIM3pwr`)
839    pwr: "pwr" = Some(0.0);
840    /// Cross-term dependence of dwg (`BSIM3pdwg`)
841    pdwg: "pdwg" = Some(0.0);
842    /// Cross-term dependence of dwb (`BSIM3pdwb`)
843    pdwb: "pdwb" = Some(0.0);
844    /// Cross-term dependence of b0 (`BSIM3pb0`)
845    pb0: "pb0" = Some(0.0);
846    /// Cross-term dependence of b1 (`BSIM3pb1`)
847    pb1: "pb1" = Some(0.0);
848    /// Cross-term dependence of cgsl (`BSIM3pcgsl`)
849    pcgsl: "pcgsl" = Some(0.0);
850    /// Cross-term dependence of cgdl (`BSIM3pcgdl`)
851    pcgdl: "pcgdl" = Some(0.0);
852    /// Cross-term dependence of ckappa (`BSIM3pckappa`)
853    pckappa: "pckappa" = Some(0.0);
854    /// Cross-term dependence of cf (`BSIM3pcf`)
855    pcf: "pcf" = Some(0.0);
856    /// Cross-term dependence of clc (`BSIM3pclc`)
857    pclc: "pclc" = Some(0.0);
858    /// Cross-term dependence of cle (`BSIM3pcle`)
859    pcle: "pcle" = Some(0.0);
860    /// Cross-term dependence of alpha0 (`BSIM3palpha0`)
861    palpha0: "palpha0" = Some(0.0);
862    /// Cross-term dependence of alpha1 (`BSIM3palpha1`)
863    palpha1: "palpha1" = Some(0.0);
864    /// Cross-term dependence of beta0 (`BSIM3pbeta0`)
865    pbeta0: "pbeta0" = Some(0.0);
866    /// Cross-term dependence of vfbcv (`BSIM3pvfbcv`)
867    pvfbcv: "pvfbcv" = Some(0.0);
868    /// Cross-term dependence of vfb (`BSIM3pvfb`)
869    pvfb: "pvfb" = Some(0.0);
870    /// Cross-term dependence of acde (`BSIM3pacde`)
871    pacde: "pacde" = Some(0.0);
872    /// Cross-term dependence of moin (`BSIM3pmoin`)
873    pmoin: "pmoin" = Some(0.0);
874    /// Cross-term dependence of noff (`BSIM3pnoff`)
875    pnoff: "pnoff" = Some(0.0);
876    /// Cross-term dependence of voffcv (`BSIM3pvoffcv`)
877    pvoffcv: "pvoffcv" = Some(0.0);
878    /// Flicker noise parameter (`BSIM3oxideTrapDensityA`)
879    oxide_trap_density_a: "noia" = None;
880    /// Flicker noise parameter (`BSIM3oxideTrapDensityB`)
881    oxide_trap_density_b: "noib" = None;
882    /// Flicker noise parameter (`BSIM3oxideTrapDensityC`)
883    oxide_trap_density_c: "noic" = None;
884    /// Flicker noise parameter (`BSIM3em`)
885    em: "em" = Some(4.1e7);
886    /// Flicker noise frequency exponent (`BSIM3ef`)
887    ef: "ef" = Some(1.0);
888    /// Flicker noise exponent (`BSIM3af`)
889    af: "af" = Some(1.0);
890    /// Flicker noise coefficient (`BSIM3kf`)
891    kf: "kf" = Some(0.0);
892    /// maximum voltage G-S branch (`BSIM3vgsMax`)
893    vgs_max: "vgs_max" = Some(1e99);
894    /// maximum voltage G-D branch (`BSIM3vgdMax`)
895    vgd_max: "vgd_max" = Some(1e99);
896    /// maximum voltage G-B branch (`BSIM3vgbMax`)
897    vgb_max: "vgb_max" = Some(1e99);
898    /// maximum voltage D-S branch (`BSIM3vdsMax`)
899    vds_max: "vds_max" = Some(1e99);
900    /// maximum voltage B-S branch (`BSIM3vbsMax`)
901    vbs_max: "vbs_max" = Some(1e99);
902    /// maximum voltage B-D branch (`BSIM3vbdMax`)
903    vbd_max: "vbd_max" = Some(1e99);
904    /// maximum voltage G-S branch (`BSIM3vgsrMax`)
905    vgsr_max: "vgsr_max" = Some(1e99);
906    /// maximum voltage G-D branch (`BSIM3vgdrMax`)
907    vgdr_max: "vgdr_max" = Some(1e99);
908    /// maximum voltage G-B branch (`BSIM3vgbrMax`)
909    vgbr_max: "vgbr_max" = Some(1e99);
910    /// maximum voltage B-S branch (`BSIM3vbsrMax`)
911    vbsr_max: "vbsr_max" = Some(1e99);
912    /// maximum voltage B-D branch (`BSIM3vbdrMax`)
913    vbdr_max: "vbdr_max" = Some(1e99);
914
915}
916
917/// `EPSOX` of `b3set.c`/`b3temp.c`/`b3ld.c`.
918pub(crate) const EPSOX: f64 = 3.453133e-11;
919/// `EPSSI`.
920pub(crate) const EPSSI: f64 = 1.03594e-10;
921/// The `PI` of `b3set.c` (truncated, as in the C).
922#[allow(clippy::approx_constant)]
923const PI_B3: f64 = 3.141592654;
924
925impl Bsim3Model {
926    /// An empty card of the given polarity: nothing given, every
927    /// default still to be applied by `BSIM3setup`.
928    pub fn new(nmos: bool) -> Self {
929        Bsim3Model {
930            nmos,
931            ..Default::default()
932        }
933    }
934
935    /// `true` for an `nmos` card.
936    pub fn is_nmos(&self) -> bool {
937        self.nmos
938    }
939
940    /// Set one model parameter by its deck keyword (lowercase, the
941    /// `b3.c` names and aliases: `vth0`/`vtho`, `nch`, `rsh`, …),
942    /// marking it given (`BSIM3mParam`). The integer selectors
943    /// (`capmod`, `mobmod`, `noimod`, `nqsmod`, `acnqsmod`, `acm`,
944    /// `calcacm`, `paramchk`, `binunit`) truncate like `IF_INTEGER`;
945    /// `tnom` is in °C. Unknown keywords are an error.
946    pub fn set(&mut self, name: &str, value: f64) -> Result<(), String> {
947        let iv = value as i32;
948        let g = &mut self.given;
949        match name {
950            "capmod" => (self.cap_mod, g.cap_mod) = (iv, true),
951            "mobmod" => (self.mob_mod, g.mob_mod) = (iv, true),
952            "noimod" => (self.noi_mod, g.noi_mod) = (iv, true),
953            "nqsmod" => (self.nqs_mod, g.nqs_mod) = (iv, true),
954            "acnqsmod" => (self.acnqs_mod, g.acnqs_mod) = (iv, true),
955            "acm" => (self.acm_mod, g.acm_mod) = (iv, true),
956            "calcacm" => (self.calcacm, g.calcacm) = (iv, true),
957            "paramchk" => (self.param_chk, g.param_chk) = (iv, true),
958            "binunit" => (self.bin_unit, g.bin_unit) = (iv, true),
959            // `b3mpar.c`: TNOM is stored in kelvin.
960            "tnom" => {
961                self.tnom = value + crate::consts::CTOK;
962                self.given.tnom = true;
963            }
964            _ => {
965                if !self.set_real(name, value) {
966                    return Err(format!("unknown BSIM3 model parameter `{name}`"));
967                }
968            }
969        }
970        Ok(())
971    }
972
973    /// `VERSION=`: kept as given (only 3.3.x is implemented).
974    pub fn set_version(&mut self, version: &str) {
975        self.version = Some(version.to_string());
976    }
977
978    /// Read one real model parameter back by keyword (`tnom` in °C).
979    pub fn get(&self, name: &str) -> Option<f64> {
980        match name {
981            "tnom" => Some(self.tnom - crate::consts::CTOK),
982            _ => self.get_real(name),
983        }
984    }
985
986    /// Model-level `BSIM3setup` (`b3set.c`): the defaults, in the C's
987    /// order where one default reads another. `tnom` is
988    /// `CKTnomTemp` (kelvin). Idempotent: only parameters not given
989    /// are touched.
990    pub(crate) fn setup(&mut self, tnom: f64) {
991        let nmos = self.nmos;
992        if !self.given.mob_mod {
993            self.mob_mod = 1;
994        }
995        if !self.given.bin_unit {
996            self.bin_unit = 1;
997        }
998        if !self.given.param_chk {
999            self.param_chk = 0;
1000        }
1001        if !self.given.cap_mod {
1002            self.cap_mod = 3;
1003        }
1004        if !self.given.acm_mod {
1005            self.acm_mod = 0;
1006        }
1007        if !self.given.calcacm {
1008            self.calcacm = 0;
1009        }
1010        if !self.given.noi_mod {
1011            self.noi_mod = 1;
1012        }
1013        // nqsMod/acnqsMod outside {0, 1} fall back to 0 (with a
1014        // warning in the C).
1015        if !self.given.nqs_mod || (self.nqs_mod != 0 && self.nqs_mod != 1) {
1016            self.nqs_mod = 0;
1017        }
1018        if !self.given.acnqs_mod || (self.acnqs_mod != 0 && self.acnqs_mod != 1) {
1019            self.acnqs_mod = 0;
1020        }
1021        self.constant_defaults();
1022        let g = self.given.clone();
1023        self.cox = EPSOX / self.tox;
1024        if !g.toxm {
1025            self.toxm = self.tox;
1026        }
1027        if !g.dsub {
1028            self.dsub = self.drout;
1029        }
1030        if !g.vth0 {
1031            self.vth0 = if nmos { 0.7 } else { -0.7 };
1032        }
1033        if !g.uc {
1034            self.uc = if self.mob_mod == 3 {
1035                -0.0465
1036            } else {
1037                -0.0465e-9
1038            };
1039        }
1040        if !g.uc1 {
1041            self.uc1 = if self.mob_mod == 3 { -0.056 } else { -0.056e-9 };
1042        }
1043        if !g.u0 {
1044            self.u0 = if nmos { 0.067 } else { 0.025 };
1045        }
1046        if !g.tnom {
1047            self.tnom = tnom;
1048        }
1049        if !g.llc {
1050            self.llc = self.ll;
1051        }
1052        if !g.lwc {
1053            self.lwc = self.lw;
1054        }
1055        if !g.lwlc {
1056            self.lwlc = self.lwl;
1057        }
1058        if !g.wlc {
1059            self.wlc = self.wl;
1060        }
1061        if !g.wwc {
1062            self.wwc = self.ww;
1063        }
1064        if !g.wwlc {
1065            self.wwlc = self.wwl;
1066        }
1067        if !g.dwc {
1068            self.dwc = self.wint;
1069        }
1070        if !g.dlc {
1071            self.dlc = self.lint;
1072        }
1073        if !g.cf {
1074            self.cf = 2.0 * EPSOX / PI_B3 * f64::ln(1.0 + 0.4e-6 / self.tox);
1075        }
1076        if !g.cgdo {
1077            self.cgdo = if g.dlc && self.dlc > 0.0 {
1078                self.dlc * self.cox - self.cgdl
1079            } else {
1080                0.6 * self.xj * self.cox
1081            };
1082        }
1083        if !g.cgso {
1084            self.cgso = if g.dlc && self.dlc > 0.0 {
1085                self.dlc * self.cox - self.cgsl
1086            } else {
1087                0.6 * self.xj * self.cox
1088            };
1089        }
1090        if !g.cgbo {
1091            self.cgbo = 2.0 * self.dwc * self.cox;
1092        }
1093        if !g.unit_length_gate_sidewall_jct_cap {
1094            self.unit_length_gate_sidewall_jct_cap = self.unit_length_sidewall_jct_cap;
1095        }
1096        if !g.gatesidewall_jct_potential {
1097            self.gatesidewall_jct_potential = self.sidewall_jct_potential;
1098        }
1099        if !g.bulk_jct_gate_side_grading_coeff {
1100            self.bulk_jct_gate_side_grading_coeff = self.bulk_jct_side_grading_coeff;
1101        }
1102        if !g.oxide_trap_density_a {
1103            self.oxide_trap_density_a = if nmos { 1e20 } else { 9.9e18 };
1104        }
1105        if !g.oxide_trap_density_b {
1106            self.oxide_trap_density_b = if nmos { 5e4 } else { 2.4e3 };
1107        }
1108        if !g.oxide_trap_density_c {
1109            self.oxide_trap_density_c = if nmos { -1.4e-12 } else { 1.4e-12 };
1110        }
1111    }
1112
1113    /// `BSIM3type`: +1 NMOS, −1 PMOS.
1114    pub(crate) fn type_(&self) -> f64 {
1115        if self.nmos { 1.0 } else { -1.0 }
1116    }
1117
1118    /// Series resistances present (`BSIM3setup` makes the prime
1119    /// nodes when `rsh·squares != 0`, ACM off).
1120    pub(crate) fn needs_prime(&self, squares: f64) -> bool {
1121        self.sheet_resistance * squares != 0.0
1122    }
1123}
1124
1125impl Bsim3Model {
1126    /// A given integer selector (`capmod`, `nqsmod`, …), `None` when
1127    /// not given.
1128    pub(crate) fn get_int(&self, name: &str) -> Option<i32> {
1129        let g = &self.given;
1130        match name {
1131            "capmod" if g.cap_mod => Some(self.cap_mod),
1132            "mobmod" if g.mob_mod => Some(self.mob_mod),
1133            "noimod" if g.noi_mod => Some(self.noi_mod),
1134            "nqsmod" if g.nqs_mod => Some(self.nqs_mod),
1135            "acnqsmod" if g.acnqs_mod => Some(self.acnqs_mod),
1136            "acm" if g.acm_mod => Some(self.acm_mod),
1137            "calcacm" if g.calcacm => Some(self.calcacm),
1138            "paramchk" if g.param_chk => Some(self.param_chk),
1139            "binunit" if g.bin_unit => Some(self.bin_unit),
1140            _ => None,
1141        }
1142    }
1143}