1 /**********
2 Copyright 1990 Regents of the University of California.  All rights reserved.
3 Author: 1985 Thomas L. Quarles
4 **********/
5 
6 #ifndef BJT
7 #define BJT
8 
9 #include "ngspice/cktdefs.h"
10 #include "ngspice/ifsim.h"
11 #include "ngspice/gendefs.h"
12 #include "ngspice/complex.h"
13 #include "ngspice/noisedef.h"
14 
15 /* structures to describe Bipolar Junction Transistors */
16 
17 /* indices to array of BJT noise sources */
18 
19 enum {
20     BJTRCNOIZ = 0,
21     BJTRBNOIZ,
22     BJT_RE_NOISE,
23     BJTICNOIZ,
24     BJTIBNOIZ,
25     BJTFLNOIZ,
26     BJTTOTNOIZ,
27     /* finally, the number of noise sources */
28     BJTNSRCS
29 };
30 
31 /* data needed to describe a single instance */
32 
33 typedef struct sBJTinstance {
34 
35     struct GENinstance gen;
36 
37 #define BJTmodPtr(inst) ((struct sBJTmodel *)((inst)->gen.GENmodPtr))
38 #define BJTnextInstance(inst) ((struct sBJTinstance *)((inst)->gen.GENnextInstance))
39 #define BJTname gen.GENname
40 #define BJTstate gen.GENstate
41 
42     const int BJTcolNode;   /* number of collector node of bjt */
43     const int BJTbaseNode;  /* number of base node of bjt */
44     const int BJTemitNode;  /* number of emitter node of bjt */
45     const int BJTsubstNode; /* number of substrate node of bjt */
46     int BJTcollCXNode;      /* number of internal collector node of bjt */
47     int BJTcolPrimeNode;    /* number of internal collector node of bjt */
48     int BJTbasePrimeNode;   /* number of internal base node of bjt */
49     int BJTemitPrimeNode;   /* number of internal emitter node of bjt */
50     int BJTsubstConNode;   /* number of node which substrate is connected to */
51                            /* Substrate connection is either base prime      *
52                             * or collector prime depending on whether        *
53                             * the device is VERTICAL or LATERAL              */
54     double BJTarea;      /* (emitter) area factor for the bjt */
55     double BJTareab;     /* base area factor for the bjt */
56     double BJTareac;     /* collector area factor for the bjt */
57     double BJTm;        /* parallel multiplier */
58     double BJTicVBE;    /* initial condition voltage B-E*/
59     double BJTicVCE;    /* initial condition voltage C-E*/
60     double BJTtemp;     /* instance temperature */
61     double BJTdtemp;     /* instance delta temperature from circuit */
62     double BJTtSatCur;  /* temperature adjusted saturation current */
63     double BJTtBetaF;   /* temperature adjusted forward beta */
64     double BJTtBetaR;   /* temperature adjusted reverse beta */
65     double BJTtBEleakCur;  /* temperature adjusted B-E leakage current */
66     double BJTtBCleakCur;  /* temperature adjusted B-C leakage current */
67     double BJTtBEcap;   /* temperature adjusted B-E capacitance */
68     double BJTtBEpot;   /* temperature adjusted B-E potential */
69     double BJTtBCcap;   /* temperature adjusted B-C capacitance */
70     double BJTtBCpot;   /* temperature adjusted B-C potential */
71     double BJTtSubcap;   /* temperature adjusted Substrate capacitance */
72     double BJTtSubpot;   /* temperature adjusted Substrate potential */
73     double BJTtDepCap;  /* temperature adjusted join point in diode curve */
74     double BJTtf1;      /* temperature adjusted polynomial coefficient */
75     double BJTtf4;      /* temperature adjusted polynomial coefficient */
76     double BJTtf5;      /* temperature adjusted polynomial coefficient */
77     double BJTtf2;      /* temperature adjusted polynomial coefficient */
78     double BJTtf3;      /* temperature adjusted polynomial coefficient */
79     double BJTtf6;      /* temperature adjusted polynomial coefficient */
80     double BJTtf7;      /* temperature adjusted polynomial coefficient */
81     double BJTtVcrit;   /* temperature adjusted critical voltage */
82     double BJTtSubVcrit; /* temperature adjusted substrate critical voltage */
83     double BJTtSubSatCur; /* temperature adjusted subst. saturation current */
84     double BJTtcollectorConduct;   /* temperature adjusted */
85     double BJTtemitterConduct;   /* temperature adjusted */
86     double BJTtbaseResist;   /* temperature adjusted */
87     double BJTtbaseCurrentHalfResist;   /* temperature adjusted */
88     double BJTtminBaseResist;   /* temperature adjusted */
89     double BJTtinvEarlyVoltF;   /* temperature adjusted */
90     double BJTtinvEarlyVoltR;   /* temperature adjusted */
91     double BJTtinvRollOffF;   /* temperature adjusted */
92     double BJTtinvRollOffR;   /* temperature adjusted */
93     double BJTtemissionCoeffF;   /* temperature adjusted NF */
94     double BJTtemissionCoeffR;   /* temperature adjusted NR */
95     double BJTtleakBEemissionCoeff;   /* temperature adjusted NE */
96     double BJTtleakBCemissionCoeff;   /* temperature adjusted NC */
97     double BJTttransitTimeHighCurrentF;   /* temperature adjusted */
98     double BJTttransitTimeF;   /* temperature adjusted */
99     double BJTttransitTimeR;   /* temperature adjusted */
100     double BJTtjunctionExpBE;   /* temperature adjusted MJE */
101     double BJTtjunctionExpBC;   /* temperature adjusted MJC */
102     double BJTtjunctionExpSub;   /* temperature adjusted MJS */
103     double BJTtemissionCoeffS;   /* temperature adjusted NS */
104     double BJTtintCollResist;   /* temperature adjusted QS RO */
105     double BJTtepiSatVoltage;   /* temperature adjusted QS VO */
106     double BJTtepiDoping;   /* temperature adjusted QS GAMMA */
107 
108     double *BJTcollCollCXPtr;    /* pointer to sparse matrix at
109                              * (collector,collector cx) */
110     double *BJTbaseBasePrimePtr;    /* pointer to sparse matrix at
111                              * (base,base prime) */
112     double *BJTemitEmitPrimePtr;    /* pointer to sparse matrix at
113                              * (emitter,emitter prime) */
114     double *BJTcollCXCollPtr;    /* pointer to sparse matrix at
115                              * (collector cx,collector) */
116     double *BJTcolPrimeBasePrimePtr;    /* pointer to sparse matrix at
117                              * (collector prime,base prime) */
118     double *BJTcolPrimeEmitPrimePtr;    /* pointer to sparse matrix at
119                              * (collector prime,emitter prime) */
120     double *BJTbasePrimeBasePtr;    /* pointer to sparse matrix at
121                              * (base prime,base ) */
122     double *BJTbasePrimeColPrimePtr;    /* pointer to sparse matrix at
123                              * (base prime,collector prime) */
124     double *BJTbasePrimeEmitPrimePtr;   /* pointer to sparse matrix at
125                              * (base primt,emitter prime) */
126     double *BJTemitPrimeEmitPtr;    /* pointer to sparse matrix at
127                              * (emitter prime,emitter) */
128     double *BJTemitPrimeColPrimePtr;    /* pointer to sparse matrix at
129                              * (emitter prime,collector prime) */
130     double *BJTemitPrimeBasePrimePtr;   /* pointer to sparse matrix at
131                              * (emitter prime,base prime) */
132     double *BJTcolColPtr;   /* pointer to sparse matrix at
133                              * (collector,collector) */
134     double *BJTbaseBasePtr; /* pointer to sparse matrix at
135                              * (base,base) */
136     double *BJTemitEmitPtr; /* pointer to sparse matrix at
137                              * (emitter,emitter) */
138     double *BJTcolPrimeColPrimePtr; /* pointer to sparse matrix at
139                              * (collector prime,collector prime) */
140     double *BJTbasePrimeBasePrimePtr;   /* pointer to sparse matrix at
141                              * (base prime,base prime) */
142     double *BJTemitPrimeEmitPrimePtr;   /* pointer to sparse matrix at
143                              * (emitter prime,emitter prime) */
144     double *BJTsubstSubstPtr;   /* pointer to sparse matrix at
145                              * (substrate,substrate) */
146     double *BJTsubstConSubstPtr;    /* pointer to sparse matrix at
147                              * (Substrate connection, substrate) */
148     double *BJTsubstSubstConPtr;    /* pointer to sparse matrix at
149                              * (substrate, Substrate connection) */
150     double *BJTsubstConSubstConPtr; /* pointer to sparse matrix at
151                              * (Substrate connection, Substrate connection) */
152                             /* Substrate connection is either base prime *
153                              * or collector prime depending on whether   *
154                              * the device is VERTICAL or LATERAL         */
155     double *BJTbaseColPrimePtr; /* pointer to sparse matrix at
156                              * (base,collector prime) */
157     double *BJTcolPrimeBasePtr; /* pointer to sparse matrix at
158                              * (collector prime,base) */
159 
160     double *BJTcollCXcollCXPtr; /* pointer to sparse matrix at
161                              * (collector cx,collector cx) */
162     double *BJTcollCXBasePrimePtr; /* pointer to sparse matrix at
163                              * (collector cx,base prime) */
164     double *BJTbasePrimeCollCXPtr; /* pointer to sparse matrix at
165                              * (base prime,collector cx) */
166     double *BJTcolPrimeCollCXPtr;    /* pointer to sparse matrix at
167                              * (collector prime,collector cx) */
168     double *BJTcollCXColPrimePtr;    /* pointer to sparse matrix at
169                              * (collector cx,base prime) */
170 
171     unsigned BJToff         :1;   /* 'off' flag for bjt */
172     unsigned BJTtempGiven   :1; /* temperature given  for bjt instance*/
173     unsigned BJTdtempGiven  :1; /* delta temperature given  for bjt instance*/
174     unsigned BJTareaGiven   :1; /* flag to indicate area was specified */
175     unsigned BJTareabGiven   :1; /* flag to indicate base area was specified */
176     unsigned BJTareacGiven   :1; /* flag to indicate collector area was specified */
177     unsigned BJTmGiven      :1; /* flag to indicate m parameter specified */
178     unsigned BJTicVBEGiven  :1; /* flag to indicate VBE init. cond. given */
179     unsigned BJTicVCEGiven  :1; /* flag to indicate VCE init. cond. given */
180     unsigned BJTsenPertFlag :1; /* indictes whether the the parameter of
181                         the particular instance is to be perturbed */
182 
183     int  BJTsenParmNo;   /* parameter # for sensitivity use;
184             set equal to  0 if not a design parameter*/
185     double BJTcapbe;
186     double BJTcapbc;
187     double BJTcapsub;
188     double BJTcapbx;
189     double BJTcapbcx;
190     double *BJTsens;
191 
192 #define BJTsenGpi BJTsens /* stores the perturbed values of gpi */
193 #define BJTsenGmu BJTsens+5 /* stores the perturbed values of gmu */
194 #define BJTsenGm BJTsens+10 /* stores the perturbed values of gm */
195 #define BJTsenGo BJTsens+15 /* stores the perturbed values of go */
196 #define BJTsenGx BJTsens+20 /* stores the perturbed values of gx */
197 #define BJTsenCpi BJTsens+25 /* stores the perturbed values of cpi */
198 #define BJTsenCmu BJTsens+30 /* stores the perturbed values of cmu */
199 #define BJTsenCbx BJTsens+35 /* stores the perturbed values of cbx */
200 #define BJTsenCmcb BJTsens+40 /* stores the perturbed values of cmcb */
201 #define BJTsenCsub BJTsens+45 /* stores the perturbed values of csub */
202 #define BJTdphibedp BJTsens+51
203 #define BJTdphibcdp BJTsens+52
204 #define BJTdphisubdp BJTsens+53
205 #define BJTdphibxdp BJTsens+54
206 
207 /*
208  * distortion stuff
209  * the following naming convention is used:
210  * x = vbe
211  * y = vbc
212  * z = vbb
213  * w = vbed (vbe delayed for the linear gm delay)
214  * therefore ic_xyz stands for the coefficient of the vbe*vbc*vbb
215  * term in the multidimensional Taylor expansion for ic; and ibb_x2y
216  * for the coeff. of the vbe*vbe*vbc term in the ibb expansion.
217  */
218 
219 #define BJTNDCOEFFS	65
220 
221 #ifndef NODISTO
222 	double BJTdCoeffs[BJTNDCOEFFS];
223 #else /* NODISTO */
224 	double *BJTdCoeffs;
225 #endif /* NODISTO */
226 
227 #ifndef CONFIG
228 
229 #define	ic_x		BJTdCoeffs[0]
230 #define	ic_y		BJTdCoeffs[1]
231 #define	ic_xd		BJTdCoeffs[2]
232 #define	ic_x2		BJTdCoeffs[3]
233 #define	ic_y2		BJTdCoeffs[4]
234 #define	ic_w2		BJTdCoeffs[5]
235 #define	ic_xy		BJTdCoeffs[6]
236 #define	ic_yw		BJTdCoeffs[7]
237 #define	ic_xw		BJTdCoeffs[8]
238 #define	ic_x3		BJTdCoeffs[9]
239 #define	ic_y3		BJTdCoeffs[10]
240 #define	ic_w3		BJTdCoeffs[11]
241 #define	ic_x2w		BJTdCoeffs[12]
242 #define	ic_x2y		BJTdCoeffs[13]
243 #define	ic_y2w		BJTdCoeffs[14]
244 #define	ic_xy2		BJTdCoeffs[15]
245 #define	ic_xw2		BJTdCoeffs[16]
246 #define	ic_yw2		BJTdCoeffs[17]
247 #define	ic_xyw		BJTdCoeffs[18]
248 
249 #define	ib_x		BJTdCoeffs[19]
250 #define	ib_y		BJTdCoeffs[20]
251 #define	ib_x2		BJTdCoeffs[21]
252 #define	ib_y2		BJTdCoeffs[22]
253 #define	ib_xy		BJTdCoeffs[23]
254 #define	ib_x3		BJTdCoeffs[24]
255 #define	ib_y3		BJTdCoeffs[25]
256 #define	ib_x2y		BJTdCoeffs[26]
257 #define	ib_xy2		BJTdCoeffs[27]
258 
259 #define	ibb_x		BJTdCoeffs[28]
260 #define	ibb_y		BJTdCoeffs[29]
261 #define	ibb_z		BJTdCoeffs[30]
262 #define	ibb_x2		BJTdCoeffs[31]
263 #define	ibb_y2		BJTdCoeffs[32]
264 #define	ibb_z2		BJTdCoeffs[33]
265 #define	ibb_xy		BJTdCoeffs[34]
266 #define	ibb_yz		BJTdCoeffs[35]
267 #define	ibb_xz		BJTdCoeffs[36]
268 #define	ibb_x3		BJTdCoeffs[37]
269 #define	ibb_y3		BJTdCoeffs[38]
270 #define	ibb_z3		BJTdCoeffs[39]
271 #define	ibb_x2z		BJTdCoeffs[40]
272 #define	ibb_x2y		BJTdCoeffs[41]
273 #define	ibb_y2z		BJTdCoeffs[42]
274 #define	ibb_xy2		BJTdCoeffs[43]
275 #define	ibb_xz2		BJTdCoeffs[44]
276 #define	ibb_yz2		BJTdCoeffs[45]
277 #define	ibb_xyz		BJTdCoeffs[46]
278 
279 #define	qbe_x		BJTdCoeffs[47]
280 #define	qbe_y		BJTdCoeffs[48]
281 #define	qbe_x2		BJTdCoeffs[49]
282 #define	qbe_y2		BJTdCoeffs[50]
283 #define	qbe_xy		BJTdCoeffs[51]
284 #define	qbe_x3		BJTdCoeffs[52]
285 #define	qbe_y3		BJTdCoeffs[53]
286 #define	qbe_x2y		BJTdCoeffs[54]
287 #define	qbe_xy2		BJTdCoeffs[55]
288 
289 #define	capbc1		BJTdCoeffs[56]
290 #define	capbc2		BJTdCoeffs[57]
291 #define	capbc3		BJTdCoeffs[58]
292 
293 #define	capbx1		BJTdCoeffs[59]
294 #define	capbx2		BJTdCoeffs[60]
295 #define	capbx3		BJTdCoeffs[61]
296 
297 #define	capsc1		BJTdCoeffs[62]
298 #define	capsc2		BJTdCoeffs[63]
299 #define	capsc3		BJTdCoeffs[64]
300 
301 #endif
302 
303 
304 #ifndef NONOISE
305       double BJTnVar[NSTATVARS][BJTNSRCS];
306 #else /*NONOISE*/
307       double **BJTnVar;
308 #endif /*NONOISE*/
309 /* the above to avoid allocating memory when it is not needed */
310 
311 } BJTinstance ;
312 
313 /* entries in the state vector for bjt: */
314 #define BJTvbe BJTstate
315 #define BJTvbc BJTstate+1
316 #define BJTvbcx BJTstate+2
317 #define BJTvrci BJTstate+3
318 #define BJTcc BJTstate+4
319 #define BJTcb BJTstate+5
320 #define BJTgpi BJTstate+6
321 #define BJTgmu BJTstate+7
322 #define BJTgm BJTstate+8
323 #define BJTgo BJTstate+9
324 #define BJTqbe BJTstate+10
325 #define BJTcqbe BJTstate+11
326 #define BJTqbc BJTstate+12
327 #define BJTcqbc BJTstate+13
328 #define BJTqsub BJTstate+14
329 #define BJTcqsub BJTstate+15
330 #define BJTqbx BJTstate+16
331 #define BJTcqbx BJTstate+17
332 #define BJTgx BJTstate+18
333 #define BJTcexbc BJTstate+19
334 #define BJTgeqcb BJTstate+20
335 #define BJTgcsub BJTstate+21
336 #define BJTgeqbx BJTstate+22
337 #define BJTvsub BJTstate+23
338 #define BJTcdsub BJTstate+24
339 #define BJTgdsub BJTstate+25
340 #define BJTirci BJTstate+26
341 #define BJTirci_Vrci BJTstate+27
342 #define BJTirci_Vbci BJTstate+28
343 #define BJTirci_Vbcx BJTstate+29
344 #define BJTqbcx BJTstate+30
345 #define BJTcqbcx BJTstate+31
346 #define BJTgbcx BJTstate+32
347 
348 #define BJTnumStates 33
349 
350 #define BJTsensxpbe BJTstate+24 /* charge sensitivities and their
351                    derivatives. +25 for the derivatives -
352                    pointer to the beginning of the array */
353 #define BJTsensxpbc BJTstate+26
354 #define BJTsensxpsub BJTstate+28
355 #define BJTsensxpbx BJTstate+30
356 
357 #define BJTnumSenStates 8
358 
359 /* per model data */
360 typedef struct sBJTmodel {          /* model structure for a bjt */
361 
362     struct GENmodel gen;
363 
364 #define BJTmodType gen.GENmodType
365 #define BJTnextModel(inst) ((struct sBJTmodel *)((inst)->gen.GENnextModel))
366 #define BJTinstances(inst) ((BJTinstance *)((inst)->gen.GENinstances))
367 #define BJTmodName gen.GENmodName
368 
369     int BJTtype;
370     int BJTsubs;
371 
372     double BJTtnom; /* nominal temperature */
373     double BJTsatCur;   /* input - don't use */
374     double BJTbetaF;    /* input - don't use */
375     double BJTemissionCoeffF;
376     double BJTearlyVoltF;
377     double BJTrollOffF;
378     double BJTleakBEcurrent;    /* input - don't use */
379     double BJTc2;
380     double BJTleakBEemissionCoeff;
381     double BJTbetaR;    /* input - don't use */
382     double BJTemissionCoeffR;
383     double BJTearlyVoltR;
384     double BJTrollOffR;
385     double BJTleakBCcurrent;    /* input - don't use */
386     double BJTc4;
387     double BJTleakBCemissionCoeff;
388     double BJTbaseResist;
389     double BJTbaseCurrentHalfResist;
390     double BJTminBaseResist;
391     double BJTemitterResist;
392     double BJTcollectorResist;
393     double BJTdepletionCapBE;   /* input - don't use */
394     double BJTpotentialBE;  /* input - don't use */
395     double BJTjunctionExpBE;
396     double BJTtransitTimeF;
397     double BJTtransitTimeBiasCoeffF;
398     double BJTtransitTimeFVBC;
399     double BJTtransitTimeHighCurrentF;
400     double BJTexcessPhase;
401     double BJTdepletionCapBC;   /* input - don't use */
402     double BJTpotentialBC;  /* input - don't use */
403     double BJTjunctionExpBC;
404     double BJTbaseFractionBCcap;
405     double BJTtransitTimeR;
406     double BJTcapSub;
407     double BJTpotentialSubstrate;
408     double BJTexponentialSubstrate;
409     double BJTbetaExp;
410     double BJTenergyGap;
411     double BJTtempExpIS;
412     double BJTdepletionCapCoeff;
413     double BJTfNcoef;
414     double BJTfNexp;
415     double BJTsubSatCur;   /* input - don't use */
416     double BJTemissionCoeffS;
417     double BJTintCollResist;
418     double BJTepiSatVoltage;
419     double BJTepiDoping;
420     double BJTepiCharge;
421     int    BJTtlev;
422     int    BJTtlevc;
423     double BJTtbf1;
424     double BJTtbf2;
425     double BJTtbr1;
426     double BJTtbr2;
427     double BJTtikf1;
428     double BJTtikf2;
429     double BJTtikr1;
430     double BJTtikr2;
431     double BJTtirb1;
432     double BJTtirb2;
433     double BJTtnc1;
434     double BJTtnc2;
435     double BJTtne1;
436     double BJTtne2;
437     double BJTtnf1;
438     double BJTtnf2;
439     double BJTtnr1;
440     double BJTtnr2;
441     double BJTtrb1;
442     double BJTtrb2;
443     double BJTtrc1;
444     double BJTtrc2;
445     double BJTtre1;
446     double BJTtre2;
447     double BJTtrm1;
448     double BJTtrm2;
449     double BJTtvaf1;
450     double BJTtvaf2;
451     double BJTtvar1;
452     double BJTtvar2;
453     double BJTctc;
454     double BJTcte;
455     double BJTcts;
456     double BJTtvjc;
457     double BJTtvje;
458     double BJTtvjs;
459     double BJTtitf1;
460     double BJTtitf2;
461     double BJTttf1;
462     double BJTttf2;
463     double BJTttr1;
464     double BJTttr2;
465     double BJTtmje1;
466     double BJTtmje2;
467     double BJTtmjc1;
468     double BJTtmjc2;
469     double BJTtmjs1;
470     double BJTtmjs2;
471     double BJTtns1;
472     double BJTtns2;
473     double BJTnkf;
474     double BJTinvEarlyVoltF;    /* inverse of BJTearlyVoltF */
475     double BJTinvEarlyVoltR;    /* inverse of BJTearlyVoltR */
476     double BJTinvRollOffF;  /* inverse of BJTrollOffF */
477     double BJTinvRollOffR;  /* inverse of BJTrollOffR */
478     double BJTcollectorConduct; /* collector conductance */
479     double BJTemitterConduct;   /* emitter conductance */
480     double BJTtransitTimeVBCFactor; /* */
481     double BJTexcessPhaseFactor;
482     double BJTf2;
483     double BJTf3;
484     double BJTf6;
485     double BJTf7;
486     double BJTtis1;
487     double BJTtis2;
488     double BJTtise1;
489     double BJTtise2;
490     double BJTtisc1;
491     double BJTtisc2;
492     double BJTtiss1;
493     double BJTtiss2;
494     int    BJTquasimod;
495     double BJTenergyGapQS;
496     double BJTtempExpRCI;
497     double BJTtempExpVO;
498     double BJTvbeMax; /* maximum voltage over B-E junction */
499     double BJTvbcMax; /* maximum voltage over B-C junction */
500     double BJTvceMax; /* maximum voltage over C-E branch */
501 
502     unsigned BJTsubsGiven : 1;
503     unsigned BJTtnomGiven : 1;
504     unsigned BJTsatCurGiven : 1;
505     unsigned BJTbetaFGiven : 1;
506     unsigned BJTemissionCoeffFGiven : 1;
507     unsigned BJTearlyVoltFGiven : 1;
508     unsigned BJTrollOffFGiven : 1;
509     unsigned BJTleakBEcurrentGiven : 1;
510     unsigned BJTc2Given : 1;
511     unsigned BJTleakBEemissionCoeffGiven : 1;
512     unsigned BJTbetaRGiven : 1;
513     unsigned BJTemissionCoeffRGiven : 1;
514     unsigned BJTearlyVoltRGiven : 1;
515     unsigned BJTrollOffRGiven : 1;
516     unsigned BJTleakBCcurrentGiven : 1;
517     unsigned BJTc4Given : 1;
518     unsigned BJTleakBCemissionCoeffGiven : 1;
519     unsigned BJTbaseResistGiven : 1;
520     unsigned BJTbaseCurrentHalfResistGiven : 1;
521     unsigned BJTminBaseResistGiven : 1;
522     unsigned BJTemitterResistGiven : 1;
523     unsigned BJTcollectorResistGiven : 1;
524     unsigned BJTdepletionCapBEGiven : 1;
525     unsigned BJTpotentialBEGiven : 1;
526     unsigned BJTjunctionExpBEGiven : 1;
527     unsigned BJTtransitTimeFGiven : 1;
528     unsigned BJTtransitTimeBiasCoeffFGiven : 1;
529     unsigned BJTtransitTimeFVBCGiven : 1;
530     unsigned BJTtransitTimeHighCurrentFGiven : 1;
531     unsigned BJTexcessPhaseGiven : 1;
532     unsigned BJTdepletionCapBCGiven : 1;
533     unsigned BJTpotentialBCGiven : 1;
534     unsigned BJTjunctionExpBCGiven : 1;
535     unsigned BJTbaseFractionBCcapGiven : 1;
536     unsigned BJTtransitTimeRGiven : 1;
537     unsigned BJTcapSubGiven : 1;
538     unsigned BJTpotentialSubstrateGiven : 1;
539     unsigned BJTexponentialSubstrateGiven : 1;
540     unsigned BJTbetaExpGiven : 1;
541     unsigned BJTenergyGapGiven : 1;
542     unsigned BJTtempExpISGiven : 1;
543     unsigned BJTdepletionCapCoeffGiven : 1;
544     unsigned BJTfNcoefGiven : 1;
545     unsigned BJTfNexpGiven :1;
546     unsigned BJTsubSatCurGiven : 1;
547     unsigned BJTemissionCoeffSGiven : 1;
548     unsigned BJTintCollResistGiven : 1;
549     unsigned BJTepiSatVoltageGiven : 1;
550     unsigned BJTepiDopingGiven : 1;
551     unsigned BJTepiChargeGiven : 1;
552     unsigned BJTtlevGiven : 1;
553     unsigned BJTtlevcGiven : 1;
554     unsigned BJTtbf1Given : 1;
555     unsigned BJTtbf2Given : 1;
556     unsigned BJTtbr1Given : 1;
557     unsigned BJTtbr2Given : 1;
558     unsigned BJTtikf1Given : 1;
559     unsigned BJTtikf2Given : 1;
560     unsigned BJTtikr1Given : 1;
561     unsigned BJTtikr2Given : 1;
562     unsigned BJTtirb1Given : 1;
563     unsigned BJTtirb2Given : 1;
564     unsigned BJTtnc1Given : 1;
565     unsigned BJTtnc2Given : 1;
566     unsigned BJTtne1Given : 1;
567     unsigned BJTtne2Given : 1;
568     unsigned BJTtnf1Given : 1;
569     unsigned BJTtnf2Given : 1;
570     unsigned BJTtnr1Given : 1;
571     unsigned BJTtnr2Given : 1;
572     unsigned BJTtrb1Given : 1;
573     unsigned BJTtrb2Given : 1;
574     unsigned BJTtrc1Given : 1;
575     unsigned BJTtrc2Given : 1;
576     unsigned BJTtre1Given : 1;
577     unsigned BJTtre2Given : 1;
578     unsigned BJTtrm1Given : 1;
579     unsigned BJTtrm2Given : 1;
580     unsigned BJTtvaf1Given : 1;
581     unsigned BJTtvaf2Given : 1;
582     unsigned BJTtvar1Given : 1;
583     unsigned BJTtvar2Given : 1;
584     unsigned BJTctcGiven : 1;
585     unsigned BJTcteGiven : 1;
586     unsigned BJTctsGiven : 1;
587     unsigned BJTtvjcGiven : 1;
588     unsigned BJTtvjeGiven : 1;
589     unsigned BJTtvjsGiven : 1;
590     unsigned BJTtitf1Given : 1;
591     unsigned BJTtitf2Given : 1;
592     unsigned BJTttf1Given : 1;
593     unsigned BJTttf2Given : 1;
594     unsigned BJTttr1Given : 1;
595     unsigned BJTttr2Given : 1;
596     unsigned BJTtmje1Given : 1;
597     unsigned BJTtmje2Given : 1;
598     unsigned BJTtmjc1Given : 1;
599     unsigned BJTtmjc2Given : 1;
600     unsigned BJTtmjs1Given : 1;
601     unsigned BJTtmjs2Given : 1;
602     unsigned BJTtns1Given : 1;
603     unsigned BJTtns2Given : 1;
604     unsigned BJTnkfGiven : 1;
605     unsigned BJTtis1Given : 1;
606     unsigned BJTtis2Given : 1;
607     unsigned BJTtise1Given : 1;
608     unsigned BJTtise2Given : 1;
609     unsigned BJTtisc1Given : 1;
610     unsigned BJTtisc2Given : 1;
611     unsigned BJTtiss1Given : 1;
612     unsigned BJTtiss2Given : 1;
613     unsigned BJTquasimodGiven : 1;
614     unsigned BJTenergyGapQSGiven : 1;
615     unsigned BJTtempExpRCIGiven : 1;
616     unsigned BJTtempExpVOGiven : 1;
617     unsigned BJTvbeMaxGiven : 1;
618     unsigned BJTvbcMaxGiven : 1;
619     unsigned BJTvceMaxGiven : 1;
620 } BJTmodel;
621 
622 #ifndef NPN
623 #define NPN 1
624 #define PNP -1
625 #endif /*NPN*/
626 
627 /*
628  *  BJT defaults to vertical for both NPN and
629  *  PNP devices.
630  */
631 #ifndef VERTICAL
632 #define VERTICAL 1
633 #define LATERAL -1
634 #endif /* VERTICAL */
635 
636 /* device parameters */
637 enum {
638     BJT_AREA = 1,
639     BJT_OFF,
640     BJT_IC_VBE,
641     BJT_IC_VCE,
642     BJT_IC,
643     BJT_AREA_SENS,
644     BJT_TEMP,
645     BJT_DTEMP,
646     BJT_M,
647     BJT_AREAB,
648     BJT_AREAC,
649 };
650 
651 /* model parameters */
652 enum {
653     BJT_MOD_NPN = 101,
654     BJT_MOD_PNP,
655     BJT_MOD_IS,
656     BJT_MOD_BF,
657     BJT_MOD_NF,
658     BJT_MOD_VAF,
659     BJT_MOD_IKF,
660     BJT_MOD_ISE,
661     BJT_MOD_C2,
662     BJT_MOD_NE,
663     BJT_MOD_BR,
664     BJT_MOD_NR,
665     BJT_MOD_VAR,
666     BJT_MOD_IKR,
667     BJT_MOD_ISC,
668     BJT_MOD_C4,
669     BJT_MOD_NC,
670     BJT_MOD_RB,
671     BJT_MOD_IRB,
672     BJT_MOD_RBM,
673     BJT_MOD_RE,
674     BJT_MOD_RC,
675     BJT_MOD_CJE,
676     BJT_MOD_VJE,
677     BJT_MOD_MJE,
678     BJT_MOD_TF,
679     BJT_MOD_XTF,
680     BJT_MOD_VTF,
681     BJT_MOD_ITF,
682     BJT_MOD_PTF,
683     BJT_MOD_CJC,
684     BJT_MOD_VJC,
685     BJT_MOD_MJC,
686     BJT_MOD_XCJC,
687     BJT_MOD_TR,
688     BJT_MOD_CJS,
689     BJT_MOD_VJS,
690     BJT_MOD_MJS,
691     BJT_MOD_XTB,
692     BJT_MOD_EG,
693     BJT_MOD_XTI,
694     BJT_MOD_FC,
695     BJT_MOD_AF,
696     BJT_MOD_KF,
697     BJT_MOD_ISS,
698     BJT_MOD_NS,
699     BJT_MOD_RCO,
700     BJT_MOD_VO,
701     BJT_MOD_GAMMA,
702     BJT_MOD_QCO,
703     BJT_MOD_TNOM,
704     BJT_MOD_TLEV,
705     BJT_MOD_TLEVC,
706     BJT_MOD_TBF1,
707     BJT_MOD_TBF2,
708     BJT_MOD_TBR1,
709     BJT_MOD_TBR2,
710     BJT_MOD_TIKF1,
711     BJT_MOD_TIKF2,
712     BJT_MOD_TIKR1,
713     BJT_MOD_TIKR2,
714     BJT_MOD_TIRB1,
715     BJT_MOD_TIRB2,
716     BJT_MOD_TNC1,
717     BJT_MOD_TNC2,
718     BJT_MOD_TNE1,
719     BJT_MOD_TNE2,
720     BJT_MOD_TNF1,
721     BJT_MOD_TNF2,
722     BJT_MOD_TNR1,
723     BJT_MOD_TNR2,
724     BJT_MOD_TRB1,
725     BJT_MOD_TRB2,
726     BJT_MOD_TRC1,
727     BJT_MOD_TRC2,
728     BJT_MOD_TRE1,
729     BJT_MOD_TRE2,
730     BJT_MOD_TRM1,
731     BJT_MOD_TRM2,
732     BJT_MOD_TVAF1,
733     BJT_MOD_TVAF2,
734     BJT_MOD_TVAR1,
735     BJT_MOD_TVAR2,
736     BJT_MOD_CTC,
737     BJT_MOD_CTE,
738     BJT_MOD_CTS,
739     BJT_MOD_TVJC,
740     BJT_MOD_TVJE,
741     BJT_MOD_TVJS,
742     BJT_MOD_TITF1,
743     BJT_MOD_TITF2,
744     BJT_MOD_TTF1,
745     BJT_MOD_TTF2,
746     BJT_MOD_TTR1,
747     BJT_MOD_TTR2,
748     BJT_MOD_TMJE1,
749     BJT_MOD_TMJE2,
750     BJT_MOD_TMJC1,
751     BJT_MOD_TMJC2,
752     BJT_MOD_TMJS1,
753     BJT_MOD_TMJS2,
754     BJT_MOD_TNS1,
755     BJT_MOD_TNS2,
756     BJT_MOD_SUBS,
757     BJT_MOD_NKF,
758     BJT_MOD_TIS1,
759     BJT_MOD_TIS2,
760     BJT_MOD_TISE1,
761     BJT_MOD_TISE2,
762     BJT_MOD_TISC1,
763     BJT_MOD_TISC2,
764     BJT_MOD_TISS1,
765     BJT_MOD_TISS2,
766     BJT_MOD_QUASIMOD,
767     BJT_MOD_EGQS,
768     BJT_MOD_XRCI,
769     BJT_MOD_XD,
770     BJT_MOD_VBE_MAX,
771     BJT_MOD_VBC_MAX,
772     BJT_MOD_VCE_MAX,
773 };
774 
775 /* device questions */
776 enum {
777     BJT_QUEST_FT = 211,
778     BJT_QUEST_COLNODE,
779     BJT_QUEST_BASENODE,
780     BJT_QUEST_EMITNODE,
781     BJT_QUEST_SUBSTNODE,
782     BJT_QUEST_COLLCXNODE,
783     BJT_QUEST_COLPRIMENODE,
784     BJT_QUEST_BASEPRIMENODE,
785     BJT_QUEST_EMITPRIMENODE,
786     BJT_QUEST_VBE,
787     BJT_QUEST_VBC,
788     BJT_QUEST_CC,
789     BJT_QUEST_CB,
790     BJT_QUEST_GPI,
791     BJT_QUEST_GMU,
792     BJT_QUEST_GM,
793     BJT_QUEST_GO,
794     BJT_QUEST_QBE,
795     BJT_QUEST_CQBE,
796     BJT_QUEST_QBC,
797     BJT_QUEST_CQBC,
798     BJT_QUEST_QSUB,
799     BJT_QUEST_CQSUB,
800     BJT_QUEST_QBX,
801     BJT_QUEST_CQBX,
802     BJT_QUEST_GX,
803     BJT_QUEST_CEXBC,
804     BJT_QUEST_GEQCB,
805     BJT_QUEST_GCSUB,
806     BJT_QUEST_GEQBX,
807     BJT_QUEST_SENS_REAL,
808     BJT_QUEST_SENS_IMAG,
809     BJT_QUEST_SENS_MAG,
810     BJT_QUEST_SENS_PH,
811     BJT_QUEST_SENS_CPLX,
812     BJT_QUEST_SENS_DC,
813     BJT_QUEST_CE,
814     BJT_QUEST_CS,
815     BJT_QUEST_POWER,
816     BJT_QUEST_CPI,
817     BJT_QUEST_CMU,
818     BJT_QUEST_CBX,
819     BJT_QUEST_CSUB,
820     BJT_QUEST_GDSUB,
821 };
822 
823 /* model questions */
824 enum {
825     BJT_MOD_INVEARLYF = 301,
826     BJT_MOD_INVEARLYR,
827     BJT_MOD_INVROLLOFFF,
828     BJT_MOD_INVROLLOFFR,
829     BJT_MOD_COLCONDUCT,
830     BJT_MOD_EMITTERCONDUCT,
831     BJT_MOD_TRANSVBCFACT,
832     BJT_MOD_EXCESSPHASEFACTOR,
833     BJT_MOD_TYPE,
834     BJT_MOD_QUEST_SUBS,
835 };
836 
837 #include "bjtext.h"
838 #endif /*BJT*/
839