Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_DEV_MOSFET_B3.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // Copyright Notice
3 //
4 // Copyright 2002 Sandia Corporation. Under the terms
5 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
6 // Government retains certain rights in this software.
7 //
8 // Xyce(TM) Parallel Electrical Simulator
9 // Copyright (C) 2002-2014 Sandia Corporation
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //-----------------------------------------------------------------------------
24 
25 //-----------------------------------------------------------------------------
26 // Filename : $RCSfile: N_DEV_MOSFET_B3.h,v $
27 //
28 // Purpose :
29 //
30 // Special Notes :
31 //
32 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
33 //
34 // Creation Date : 02/28/00
35 //
36 // Revision Information:
37 // ---------------------
38 //
39 // Revision Number: $Revision: 1.152 $
40 //
41 // Revision Date : $Date: 2014/05/22 17:40:29 $
42 //
43 // Current Owner : $Author: erkeite $
44 //-----------------------------------------------------------------------------
45 
46 #ifndef Xyce_N_DEV_MOSFET_B3_h
47 #define Xyce_N_DEV_MOSFET_B3_h
48 
49 // ---------- Standard Includes ----------
50 #include <N_DEV_Configuration.h>
51 #include <map>
52 
53 // ---------- Xyce Includes ----------
54 #include <N_DEV_DeviceMaster.h>
55 #include <N_DEV_DeviceInstance.h>
56 #include <N_DEV_DeviceModel.h>
57 #include <N_DEV_DeviceBlock.h>
58 
59 #include <N_DEV_MOSFET1.h>
60 
61 namespace Xyce {
62 namespace Device {
63 namespace MOSFET_B3 {
64 
65 class Model;
66 class Instance;
67 
68 struct Traits : public DeviceTraits<Model, Instance, MOSFET1::Traits>
69 {
70  static const char *name() {return "BSIM3";}
71  static const char *deviceTypeName() {return "M level 9";}
72  static int numNodes() {return 4;}
73  static bool modelRequired() {return true;}
74  static bool isLinearDevice() {return false;}
75 
76  static Device *factory(const Configuration &configuration, const FactoryBlock &factory_block);
77  static void loadModelParameters(ParametricData<Model> &model_parameters);
78  static void loadInstanceParameters(ParametricData<Instance> &instance_parameters);
79 };
80 
81 //-----------------------------------------------------------------------------
82 // Struct : bsim3SizeDependParam
83 // Purpose : copied over from the 3f5 code. Almost no changes.
84 // Special Notes :
85 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
86 // Creation Date : 01/14/01
87 //-----------------------------------------------------------------------------
89 {
90  friend class Model;
91  friend class Instance;
92  friend class Master;
93 
94 private:
95  double Width;
96  double Length;
97 
98  double cdsc;
99  double cdscb;
100  double cdscd;
101  double cit;
102  double nfactor;
103  double xj;
104  double vsat;
105  double at;
106  double a0;
107  double ags;
108  double a1;
109  double a2;
110  double keta;
111  double nsub;
112  double npeak;
113  double ngate;
114  double gamma1;
115  double gamma2;
116  double vbx;
117  double vbi;
118  double vbm;
119  double vbsc;
120  double xt;
121  double phi;
122  double litl;
123  double k1;
124  double kt1;
125  double kt1l;
126  double kt2;
127  double k2;
128  double k3;
129  double k3b;
130  double w0;
131  double nlx;
132  double dvt0;
133  double dvt1;
134  double dvt2;
135  double dvt0w;
136  double dvt1w;
137  double dvt2w;
138  double drout;
139  double dsub;
140  double vth0;
141  double ua;
142  double ua1;
143  double ub;
144  double ub1;
145  double uc;
146  double uc1;
147  double u0;
148  double ute;
149  double voff;
150  double vfb;
151  double delta;
152  double rdsw;
153  double rds0;
154  double prwg;
155  double prwb;
156  double prt;
157  double eta0;
158  double etab;
159  double pclm;
160  double pdibl1;
161  double pdibl2;
162  double pdiblb;
163  double pscbe1;
164  double pscbe2;
165  double pvag;
166  double wr;
167  double dwg;
168  double dwb;
169  double b0;
170  double b1;
171  double alpha0;
172  double alpha1;
173  double beta0;
174 
175 
176  // CV model
177  double elm;
178  double cgsl;
179  double cgdl;
180  double ckappa;
181  double cf;
182  double clc;
183  double cle;
184  double vfbcv;
185  double noff;
186  double voffcv;
187  double acde;
188  double moin;
189 
190 
191  // Pre-calculated constants
192  double dw;
193  double dl;
194  double leff;
195  double weff;
196 
197  double dwc;
198  double dlc;
199  double leffCV;
200  double weffCV;
202  double cgso;
203  double cgdo;
204  double cgbo;
205  double tconst;
206 
207  double u0temp;
208  double vsattemp;
209  double sqrtPhi;
210  double phis3;
211  double Xdep0;
212  double sqrtXdep0;
213  double theta0vb0;
214  double thetaRout;
215 
216  double cof1;
217  double cof2;
218  double cof3;
219  double cof4;
220  double cdep0;
221  double vfbzb;
222  double ldeb;
223  double k1ox;
224  double k2ox;
225 
226  // ERK. I added this to make temperature sweeps work.
228 };
229 
230 
231 //-----------------------------------------------------------------------------
232 // Class : Instance
233 // Purpose :
234 // Special Notes :
235 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
236 // Creation Date : 3/16/00
237 //-----------------------------------------------------------------------------
238 class Instance : public DeviceInstance
239 {
240  friend class SizeDependParam;
241  friend class ParametricData<Instance>;
242  friend class Model;
243  friend class Traits;friend class Master;
244 
245  // functions
246 public:
247 
248  Instance(
249  const Configuration & configuration,
250  const InstanceBlock & IB,
251  Model & Miter,
252  const FactoryBlock & factory_block);
253 
254  ~Instance();
255 
256 private:
257  Instance(const Instance &);
258  Instance &operator=(const Instance &);
259 
260 public:
261  void registerLIDs( const std::vector<int> & intLIDVecRef,
262  const std::vector<int> & extLIDVecRef );
263  void registerStateLIDs( const std::vector<int> & staLIDVecRef);
264  void registerStoreLIDs( const std::vector<int> & stoLIDVecRef);
265 
266  std::map<int,std::string> & getIntNameMap ();
267  std::map<int,std::string> & getStoreNameMap ();
268 
269  const std::vector< std::vector<int> > & jacobianStamp() const;
270  void registerJacLIDs( const std::vector< std::vector<int> > & jacLIDVec );
271 
272  bool processParams ();
273 
274  bool updateTemperature(const double & temp_tmp);
275  bool updateIntermediateVars ();
276  bool updatePrimaryState ();
277 
278  // load functions, residual:
279  bool loadDAEQVector ();
280  bool loadDAEFVector ();
281 
282  bool auxChargeCalculations ();
283  bool setupCapacitors_newDAE ();
284 
285  bool setupCapacitors_oldDAE ();
286 
287  // load functions, Jacobian:
288  bool loadDAEdQdx ();
289  bool loadDAEdFdx ();
290 
291  void setupPointers ();
292 
293  bool setIC ();
294 
295  inline bool isConverged();
296 
297 public:
298  // Getters and setters
300  {
301  return model_;
302  }
303 
304 private:
305 
306  Model & model_; ///< Owning model
307 
308  int dNode;
309  int gNode;
310  int sNode;
311  int bNode;
314  int qNode;
315 
316  double ueff;
317  double thetavth;
318  double von;
319  double vdsat;
320  double cgdo;
321  double cgso;
322  double vjsm;
323  double IsEvjsm;
324  double vjdm;
325  double IsEvjdm;
326 
327  double l;
328  double w;
329  double numberParallel; // PSpiceish "parallel copies" kludge
330  double drainArea;
331  double sourceArea;
332  double drainSquares;
338 
339  double icVBS;
340  double icVDS;
341  double icVGS;
342  bool OFF;
343  int mode;
344  int nqsMod;
345 
346  // OP point
347  double qinv;
348  double cd;
349  double cbs;
350  double cbd;
351  double csub;
352  double cdrain;
353  double gm;
354  double gds;
355  double gmbs;
356  double gbd;
357  double gbs;
358 
359  double gbbs;
360  double gbgs;
361  double gbds;
362 
363  double cggb;
364  double cgdb;
365  double cgsb;
366  double cbgb;
367  double cbdb;
368  double cbsb;
369  double cdgb;
370  double cddb;
371  double cdsb;
372  double capbd;
373  double capbs;
374 
375  double cqgb;
376  double cqdb;
377  double cqsb;
378  double cqbb;
379 
380  double qgate;
381  double qbulk;
382  double qdrn;
383 
384  double gtau;
385  double gtg;
386  double gtd;
387  double gts;
388  double gtb;
389 
391 
393 
397 
400 
401  // end of original 3f5 stuff
402 
403  // Variables from the 3f5 b3ld function, which were local to that
404  // function but are more appropriate as instance variables:
406 
407  double gcbdb;
408  double gcbgb;
409  double gcbsb;
410  double gcddb;
411  double gcdgb;
412  double gcdsb;
413  double gcgdb;
414  double gcggb;
415  double gcgsb;
416  double gcsdb;
417  double gcsgb;
418  double gcssb;
419 
420  double qgd, qgs, qgb;
421  double qgdo, qgso;
422 
423  double qsrc, CoxWL;
424  double Cgg, Cgd;
425  double Cgb, Cdg, Cdd, Cds;
426  double Csg, Csd, Css, Csb, Cbg, Cbd;
427  double Cbb;
428 
429  // new DAE stuff:
430  // Capacitance variables, which should correspond to the
431  // conductance variables used by the old-DAE.
432  //
433  // In general gcggb --> CAPcggb.
434  // gcgdb --> CAPcgdb. etc.
435  double CAPcggb;
436  double CAPcgdb;
437  double CAPcgsb;
438  double CAPcbgb;
439  double CAPcbdb;
440  double CAPcbsb;
441  double CAPcdgb;
442  double CAPcddb;
443  double CAPcdsb;
444  double CAPcsgb;
445  double CAPcsdb;
446  double CAPcssb;
447 
448  double Qeqqd_Jdxp;
449  double Qeqqb_Jdxp;
450  double Qeqqg_Jdxp;
451  // end of new-DAE stuff.
452 
453  double dxpart;
454  double sxpart;
455  double ggtg;
456  double ggtd;
457  double ggts;
458  double ggtb;
459  double ddxpart_dVd;
460  double ddxpart_dVg;
461  double ddxpart_dVb;
462  double ddxpart_dVs;
463  double dsxpart_dVd;
464  double dsxpart_dVg;
465  double dsxpart_dVb;
466  double dsxpart_dVs;
467 
468  double gbspsp;
469  double gbbdp;
470  double gbbsp;
471  double gbspg;
472  double gbspb;
473  double gbspdp;
474  double gbdpdp;
475  double gbdpg;
476  double gbdpb;
477  double gbdpsp;
478 
479  double cdreq;
480  double ceqbd;
481  double ceqbs;
482  double cdreq_Jdxp;
483  double ceqbd_Jdxp;
484  double ceqbs_Jdxp;
485 
486  double Gm;
487  double Gmbs;
488  double FwdSum;
489  double RevSum;
490  double T1global;
491 
492  double dVgst_dVg;
493  double dVgst_dVb;
494  double dVgs_eff_dVg;
495 
499 
500  double gqdef;
501  double gcqdb, gcqsb, gcqgb;
502  double gcqbb;
504  double cqgate, cqbulk, cqdrn;
505 
506  // Variables which were model variables in the 3f5 version of the BSIM3,
507  // but are temperature dependent and should be instance variables (as
508  // temperature is an instance-level quantity.
509  double vtm;
512 
516  double PhiBTemp;
517  double PhiBSWTemp;
518  double PhiBSWGTemp;
519  // end of 3f5 stuff
520 
521  double temp;
522 
523  // solution variables, and intermediate quantities.
524  //double mode; // mode=1:normal mode. mode=-1:inverse mode.
525  double Vd; // drain node voltage
526  double Vs; // source node voltage
527  double Vg; // gate node voltage
528  double Vb; // bulk node voltage
529  double Vsp; // source prime voltage
530  double Vdp; // drain prime voltage
531 
532  double Qtotal; // total charge variable.
533 
534  double Vddp; // voltage drop between drain and drain'
535  double Vssp; // voltage drop between source and source'
536 
537  double Vbsp; // voltage drop, bulk-source prime
538  double Vbdp; // voltage drop, bulk-drain prime
539 
540  double Vgsp; // voltage drop, gate-Source prime
541  double Vgdp; // voltage drop, gate-Drain prime
542  double Vgb; // voltage drop, gate-Bulk
543 
544  double Vdpsp; // voltage drop accross the channel
545  double Vgt; // Vgs-Vthresh
546 
547  // resistor currents:
548  double Idrain; // current through drain resistor
549  double Isource; // current through source resistor
550 
551  // channel current stuff:
552  double df1dVdp;
553  double df2dVdp;
554 
555  double df1dVsp;
556  double df2dVsp;
557 
558  double df1dVg;
559  double df2dVg;
560 
561  double df1dVb;
562  double df2dVb;
563 
564  double vgb, vgd;
565  double cqdef;
566  double ceqqd;
567  double ceqqb;
568  double ceqqg;
569 
570  double cqdef_Jdxp;
571  double ceqqd_Jdxp;
572  double ceqqb_Jdxp;
573  double ceqqg_Jdxp;
574 
575  // state variables, voltage drops
576  double vbd; // Volage drop, bulk-drain'
577  double vbs; // Volage drop, bulk-source'
578  double vgs; // Volage drop, gate-source'
579  double vds; // Volage drop, drain-source'
580 
581  // old versions of state variables, voltage drops
582  // here "old" refers to the previous newton iteration.
583  double vbd_old; // Volage drop, bulk-drain'
584  double vbs_old; // Volage drop, bulk-source'
585  double vgs_old; // Volage drop, gate-source'
586  double vds_old; // Volage drop, drain-source'
587 
588  // "original" versions of various voltage drop variables:
589  // original refers to the beginning of the newton iterations,
590  // before any limits are imposed on the change in voltage drop.
591  double vgs_orig;
592  double vds_orig;
593  double vbs_orig;
594  double vbd_orig;
595  double vgd_orig;
596 
598 
599  // state variables, intrinsic capacitors
600  double qb;
601  double qg;
602  double qd;
603 
604  // state variables, parasitic capacitors
605  double qbs;
606  double qbd;
607 
608  // state variables, cheq
609  double qcheq;
610 
611  // state variables, cdump
612  double qcdump;
613 
614  // state variable, qdef
615  double qdef;
616 
617  // Indices into the state vector:
618 
619  // state variables, voltage drops
629 
630  // state variables, intrinsic capacitors
634 
635  // state variables, parasitic capacitors
638 
639  // state variables, cheq
641 
642  // state variables, cdump
644 
645  // state variable, qdef
647 
648  ////////////////////////////////////////////////////////////////////
649  // Local variable indices
650  int li_Drain;
651  int li_Gate;
653  int li_Bulk;
657 
658  // local indies
659  int li_Ibs;
660  int li_Ids;
661  int li_Igs;
662 
663  ////////////////////////////////////////////////////////////////////
664  // Jacobian matrix indices:
665  // This is a 7x7 to 10x10 matrix block with 37 entries
666  //
667  // ---------------------------------------------------------------------------
668  // | #NZ | | |
669  // | entries | | V_d V_g V_s V_b V_d' V_s' Q Ibs Ids Igs |
670  // ---------------------------------------------------------------------------|
671  // | 3/2 | KCL_d | a b i1 |
672  // | 6/5 | KCL_g | c d e f 1 i2 |
673  // | 5/2 | KCL_s | g h i3 i4 i5 |
674  // | 6/5 | KCL_b | i j k l 2 i6 |
675  // | 6 | KCL_d'| m n o p q 3 |
676  // | 6 | KCL_s'| r s t u v 4 |
677  // | 5 | Q_equ | 7 9 6 8 5 |
678  // | 2/1 | icVBS | i7 i8 (i9) |
679  // | 2/1 | icVDS | i10 i11 (i12) |
680  // | 2/1 | icVGS | i13 i14 (i15) |
681  // ---------------------------------------------------------------------------
682  // 43 at operating point, 34 normally
683  //
684  // Terms beginning with "i", not in parenthesis are for
685  // initial conditions and apply only at the operating point.
686  // These terms reduce to the terms in parenthesis during time
687  // integration -- i.e. the other "i" terms go to zero during
688  // time integration.
689  ////////////////////////////////////////////////////////////////////
690 
691  // Offset variables corresponding to the above declared indices.
692 
693  // Jacobian Matrix Offsets:
694 
695  // V_d Row:
699 
700  // V_g Row:
706  int AGateEquIgsOffset; // i2
707 
708  // V_s Row:
714 
715  // V_b Row:
721  int ABulkEquIbsOffset; // i6
722 
723  // V_d' Row:
730 
731  // V_s' Row:
738 
739  // MOSFET charge (Q) Row:
745 
746  // icVBS
747  int icVBSEquVsOffset; // i7
748  int icVBSEquVbOffset; // i8
749  int icVBSEquIbsOffset; // i9
750 
751  // icVDS
752  int icVDSEquVdOffset; // i10
753  int icVDSEquVsOffset; // i11
754  int icVDSEquIdsOffset; // i12
755 
756  // icVGS
757  int icVGSEquVgOffset; // i13
758  int icVGSEquVsOffset; // i14
759  int icVGSEquIgsOffset; // i15
760 
761 #ifndef Xyce_NONPOINTER_MATRIX_LOAD
762  ///////////////////////////////////////////////////
763  // Jacobian Matrix Pointers:
764 
765  // V_d Row:
766  double * f_DrainEquDrainNodePtr; // a
768  double * f_DrainEquIdsPtr; // i1
769 
770  // V_g Row:
771  double * f_GateEquGateNodePtr; // c
772  double * f_GateEquBulkNodePtr; // d
775  double * f_GateEquChargeVarPtr; // 1
776  double * f_GateEquIgsPtr; // i2
777 
778  // V_s Row:
781  double * f_SourceEquIbsPtr; // i3
782  double * f_SourceEquIdsPtr; // i4
783  double * f_SourceEquIgsPtr; // i5
784 
785  // V_b Row:
786  double * f_BulkEquGateNodePtr; // i
787  double * f_BulkEquBulkNodePtr; // j
790  double * f_BulkEquChargeVarPtr; // 2
791  double * f_BulkEquIbsPtr; // i6
792 
793  // V_d' Row:
800 
801  // V_s' Row:
808 
809  // MOSFET charge (Q) Row:
810  double * f_ChargeEquChargeVarPtr; // 5
812  double * f_ChargeEquGateNodePtr; // 7
814  double * f_ChargeEquBulkNodePtr; // 9
815 
816  // icVBS
817  double * f_icVBSEquVsPtr; // i7
818  double * f_icVBSEquVbPtr; // i8
819  double * f_icVBSEquIbsPtr; // i9
820 
821  // icVDS
822  double * f_icVDSEquVdPtr; // i10
823  double * f_icVDSEquVsPtr; // i11
824  double * f_icVDSEquIdsPtr; // i12
825 
826  // icVGS
827  double * f_icVGSEquVgPtr; // i13
828  double * f_icVGSEquVsPtr; // i14
829  double * f_icVGSEquIgsPtr; // i15
830 
831  // V_d Row:
832  double * q_DrainEquDrainNodePtr; // a
834  double * q_DrainEquIdsPtr; // i1
835 
836  // V_g Row:
837  double * q_GateEquGateNodePtr; // c
838  double * q_GateEquBulkNodePtr; // d
841  double * q_GateEquChargeVarPtr; // 1
842  double * q_GateEquIgsPtr; // i2
843 
844  // V_s Row:
847  double * q_SourceEquIbsPtr; // i3
848  double * q_SourceEquIdsPtr; // i4
849  double * q_SourceEquIgsPtr; // i5
850 
851  // V_b Row:
852  double * q_BulkEquGateNodePtr; // i
853  double * q_BulkEquBulkNodePtr; // j
856  double * q_BulkEquChargeVarPtr; // 2
857  double * q_BulkEquIbsPtr; // i6
858 
859  // V_d' Row:
866 
867  // V_s' Row:
874 
875  // MOSFET charge (Q) Row:
876  double * q_ChargeEquChargeVarPtr; // 5
878  double * q_ChargeEquGateNodePtr; // 7
880  double * q_ChargeEquBulkNodePtr; // 9
881 
882  // icVBS
883  double * q_icVBSEquVsPtr; // i7
884  double * q_icVBSEquVbPtr; // i8
885  double * q_icVBSEquIbsPtr; // i9
886 
887  // icVDS
888  double * q_icVDSEquVdPtr; // i10
889  double * q_icVDSEquVsPtr; // i11
890  double * q_icVDSEquIdsPtr; // i12
891 
892  // icVGS
893  double * q_icVGSEquVgPtr; // i13
894  double * q_icVGSEquVsPtr; // i14
895  double * q_icVGSEquIgsPtr; // i15
896 #endif
897 
898  // flag for updateTemperature call. Needed for .STEP temperature sweeps.
900 
901  static std::vector< std::vector<int> > jacStamp_DC_SC;
902  static std::vector< std::vector<int> > jacStamp_DC;
903  static std::vector< std::vector<int> > jacStamp_SC;
904  static std::vector< std::vector<int> > jacStamp;
905 
906  static std::vector<int> jacMap_DC_SC;
907  static std::vector<int> jacMap_DC;
908  static std::vector<int> jacMap_SC;
909  static std::vector<int> jacMap;
910 
911  static std::vector< std::vector<int> > jacMap2_DC_SC;
912  static std::vector< std::vector<int> > jacMap2_DC;
913  static std::vector< std::vector<int> > jacMap2_SC;
914  static std::vector< std::vector<int> > jacMap2;
915 
916  int blockHomotopyID; // For homotopy
917  double randomPerturb; // For homotopy
918 
919  // Most versions of this device will use one of the four
920  // jacobian's defined as static above. However, if nqsMod is true
921  // or or any of the three initial conditions are specified (icVBS,
922  // icVDS or icVGS), then the number of jacobian permutations goes
923  // up to 112 (4 from static versions above * 2 for nqsMod on/off *
924  // 7 for IC's = 4 * 2 * 7 = 56) Rather than enumerate all of these
925  // as static functions, we'll make non-static, member variables of
926  // the jacStamp for those few devices that specify nqsMod or
927  // initial conditoins.
928 
929  std::vector< std::vector< int > > jacStampSpecial; // for simulation
930 
931  // used when we need to merge the d' and or s' nodes
932  std::vector< std::vector<int> > jacStampSpecialMerged;
933  std::vector<int> jacSpecialMap;
934  std::vector< std::vector<int> > jacSpecialMap2;
935  std::vector<int> jacSpecialMergedMap;
936  std::vector< std::vector<int> > jacSpecialMergedMap2;
937 };
938 
939 //-----------------------------------------------------------------------------
940 // Class : Model
941 // Purpose :
942 // Special Notes :
943 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
944 // Creation Date : 11/14/00
945 //-----------------------------------------------------------------------------
946 class Model : public DeviceModel
947 {
948  typedef std::vector<Instance *> InstanceVector;
949 
950  friend class SizeDependParam;
951  friend class ParametricData<Model>;
952  friend class Instance;
953  friend class Traits;friend class Master;
954 
955 public:
956  Model(
957  const Configuration & configuration,
958  const ModelBlock & MB,
959  const FactoryBlock & factory_block);
960  ~Model();
961 
962 private:
963  Model();
964  Model(const Model &);
965  Model &operator=(const Model &);
966 
967 public:
968  virtual void forEachInstance(DeviceInstanceOp &op) const /* override */;
969 
970  virtual std::ostream &printOutInstances(std::ostream &os) const;
971 
972  bool processParams ();
973  bool processInstanceParams ();
974 
975  bool clearTemperatureData ();
976 
977 public:
978  void addInstance(Instance *instance)
979  {
980  instanceContainer.push_back(instance);
981  }
982 
983 private:
984  std::vector<Instance*> instanceContainer;
985 
986 private:
987 
988  // 3f5 stuff:
989  int modType;
990  int dtype;
991 
992  int mobMod;
993  int capMod;
994  int noiMod;
995  int binUnit;
996  int paramChk;
997 
998  std::string version;
999 
1001  // Bogus PSpice-y thing where you can set L and W on the model *or* the
1002  // instance line, with instance overriding model
1003  double model_l;
1004  double model_w;
1005  //
1006 
1007  double tox;
1008  double toxm;
1009  double cdsc;
1010  double cdscb;
1011  double cdscd;
1012  double cit;
1013  double nfactor;
1014  double xj;
1015  double vsat;
1016  double at;
1017  double a0;
1018  double ags;
1019  double a1;
1020  double a2;
1021  double keta;
1022  double nsub;
1023  double npeak;
1024  double ngate;
1025  double gamma1;
1026  double gamma2;
1027  double vbx;
1028  double vbm;
1029  double xt;
1030  double k1;
1031  double kt1;
1032  double kt1l;
1033  double kt2;
1034  double k2;
1035  double k3;
1036  double k3b;
1037  double w0;
1038  double nlx;
1039  double dvt0;
1040  double dvt1;
1041  double dvt2;
1042  double dvt0w;
1043  double dvt1w;
1044  double dvt2w;
1045  double drout;
1046  double dsub;
1047  double vth0;
1048  double ua;
1049  double ua1;
1050  double ub;
1051  double ub1;
1052  double uc;
1053  double uc1;
1054  double u0;
1055  double ute;
1056  double voff;
1057  double delta;
1058  double rdsw;
1059  double prwg;
1060  double prwb;
1061  double prt;
1062  double eta0;
1063  double etab;
1064  double pclm;
1065  double pdibl1;
1066  double pdibl2;
1067  double pdiblb;
1068  double pscbe1;
1069  double pscbe2;
1070  double pvag;
1071  double wr;
1072  double dwg;
1073  double dwb;
1074  double b0;
1075  double b1;
1076  double alpha0;
1077  double alpha1;
1078  double beta0;
1079  double ijth;
1080  double vfb;
1081 
1082  // CV model
1083  double elm;
1084  double cgsl;
1085  double cgdl;
1086  double ckappa;
1087  double cf;
1088  double vfbcv;
1089  double clc;
1090  double cle;
1091  double dwc;
1092  double dlc;
1093  double noff;
1094  double voffcv;
1095  double acde;
1096  double moin;
1097  double tcj;
1098  double tcjsw;
1099  double tcjswg;
1100  double tpb;
1101  double tpbsw;
1102  double tpbswg;
1103 
1104  // Length Dependence
1105  double lcdsc;
1106  double lcdscb;
1107  double lcdscd;
1108  double lcit;
1109  double lnfactor;
1110  double lxj;
1111  double lvsat;
1112  double lat;
1113  double la0;
1114  double lags;
1115  double la1;
1116  double la2;
1117  double lketa;
1118  double lnsub;
1119  double lnpeak;
1120  double lngate;
1121  double lgamma1;
1122  double lgamma2;
1123  double lvbx;
1124  double lvbm;
1125  double lxt;
1126  double lk1;
1127  double lkt1;
1128  double lkt1l;
1129  double lkt2;
1130  double lk2;
1131  double lk3;
1132  double lk3b;
1133  double lw0;
1134  double lnlx;
1135  double ldvt0;
1136  double ldvt1;
1137  double ldvt2;
1138  double ldvt0w;
1139  double ldvt1w;
1140  double ldvt2w;
1141  double ldrout;
1142  double ldsub;
1143  double lvth0;
1144  double lua;
1145  double lua1;
1146  double lub;
1147  double lub1;
1148  double luc;
1149  double luc1;
1150  double lu0;
1151  double lute;
1152  double lvoff;
1153  double ldelta;
1154  double lrdsw;
1155  double lprwg;
1156  double lprwb;
1157  double lprt;
1158  double leta0;
1159  double letab;
1160  double lpclm;
1161  double lpdibl1;
1162  double lpdibl2;
1163  double lpdiblb;
1164  double lpscbe1;
1165  double lpscbe2;
1166  double lpvag;
1167  double lwr;
1168  double ldwg;
1169  double ldwb;
1170  double lb0;
1171  double lb1;
1172  double lalpha0;
1173  double lalpha1;
1174  double lbeta0;
1175  double lvfb;
1176 
1177  // CV model
1178  double lelm;
1179  double lcgsl;
1180  double lcgdl;
1181  double lckappa;
1182  double lcf;
1183  double lclc;
1184  double lcle;
1185  double lvfbcv;
1186  double lnoff;
1187  double lvoffcv;
1188  double lacde;
1189  double lmoin;
1190 
1191  // Width Dependence
1192  double wcdsc;
1193  double wcdscb;
1194  double wcdscd;
1195  double wcit;
1196  double wnfactor;
1197  double wxj;
1198  double wvsat;
1199  double wat;
1200  double wa0;
1201  double wags;
1202  double wa1;
1203  double wa2;
1204  double wketa;
1205  double wnsub;
1206  double wnpeak;
1207  double wngate;
1208  double wgamma1;
1209  double wgamma2;
1210  double wvbx;
1211  double wvbm;
1212  double wxt;
1213  double wk1;
1214  double wkt1;
1215  double wkt1l;
1216  double wkt2;
1217  double wk2;
1218  double wk3;
1219  double wk3b;
1220  double ww0;
1221  double wnlx;
1222  double wdvt0;
1223  double wdvt1;
1224  double wdvt2;
1225  double wdvt0w;
1226  double wdvt1w;
1227  double wdvt2w;
1228  double wdrout;
1229  double wdsub;
1230  double wvth0;
1231  double wua;
1232  double wua1;
1233  double wub;
1234  double wub1;
1235  double wuc;
1236  double wuc1;
1237  double wu0;
1238  double wute;
1239  double wvoff;
1240  double wdelta;
1241  double wrdsw;
1242  double wprwg;
1243  double wprwb;
1244  double wprt;
1245  double weta0;
1246  double wetab;
1247  double wpclm;
1248  double wpdibl1;
1249  double wpdibl2;
1250  double wpdiblb;
1251  double wpscbe1;
1252  double wpscbe2;
1253  double wpvag;
1254  double wwr;
1255  double wdwg;
1256  double wdwb;
1257  double wb0;
1258  double wb1;
1259  double walpha0;
1260  double walpha1;
1261  double wbeta0;
1262  double wvfb;
1263 
1264  // CV model
1265  double welm;
1266  double wcgsl;
1267  double wcgdl;
1268  double wckappa;
1269  double wcf;
1270  double wclc;
1271  double wcle;
1272  double wvfbcv;
1273  double wnoff;
1274  double wvoffcv;
1275  double wacde;
1276  double wmoin;
1277 
1278  // Cross-term Dependence
1279  double pcdsc;
1280  double pcdscb;
1281  double pcdscd;
1282  double pcit;
1283  double pnfactor;
1284  double pxj;
1285  double pvsat;
1286  double pat;
1287  double pa0;
1288  double pags;
1289  double pa1;
1290  double pa2;
1291  double pketa;
1292  double pnsub;
1293  double pnpeak;
1294  double pngate;
1295  double pgamma1;
1296  double pgamma2;
1297  double pvbx;
1298  double pvbm;
1299  double pxt;
1300  double pk1;
1301  double pkt1;
1302  double pkt1l;
1303  double pkt2;
1304  double pk2;
1305  double pk3;
1306  double pk3b;
1307  double pw0;
1308  double pnlx;
1309  double pdvt0;
1310  double pdvt1;
1311  double pdvt2;
1312  double pdvt0w;
1313  double pdvt1w;
1314  double pdvt2w;
1315  double pdrout;
1316  double pdsub;
1317  double pvth0;
1318  double pua;
1319  double pua1;
1320  double pub;
1321  double pub1;
1322  double puc;
1323  double puc1;
1324  double pu0;
1325  double pute;
1326  double pvoff;
1327  double pdelta;
1328  double prdsw;
1329  double pprwg;
1330  double pprwb;
1331  double pprt;
1332  double peta0;
1333  double petab;
1334  double ppclm;
1335  double ppdibl1;
1336  double ppdibl2;
1337  double ppdiblb;
1338  double ppscbe1;
1339  double ppscbe2;
1340  double ppvag;
1341  double pwr;
1342  double pdwg;
1343  double pdwb;
1344  double pb0;
1345  double pb1;
1346  double palpha0;
1347  double palpha1;
1348  double pbeta0;
1349  double pvfb;
1350 
1351  // CV model
1352  double pelm;
1353  double pcgsl;
1354  double pcgdl;
1355  double pckappa;
1356  double pcf;
1357  double pclc;
1358  double pcle;
1359  double pvfbcv;
1360  double pnoff;
1361  double pvoffcv;
1362  double pacde;
1363  double pmoin;
1364 
1365  double tnom;
1366  double cgso;
1367  double cgdo;
1368  double cgbo;
1369  double xpart;
1370  double cFringOut;
1371  double cFringMax;
1372 
1387 
1388  double Lint;
1389  double Ll;
1390  double Llc;
1391  double Lln;
1392  double Lw;
1393  double Lwc;
1394  double Lwn;
1395  double Lwl;
1396  double Lwlc;
1397  double Lmin;
1398  double Lmax;
1399 
1400  double Wint;
1401  double Wl;
1402  double Wlc;
1403  double Wln;
1404  double Ww;
1405  double Wwc;
1406  double Wwn;
1407  double Wwl;
1408  double Wwlc;
1409  double Wmin;
1410  double Wmax;
1411 
1412 
1413  // Pre-calculated constants
1414  // MCJ: move to size-dependent param.
1415  double vtm;
1416  double cox;
1417  double cof1;
1418  double cof2;
1419  double cof3;
1420  double cof4;
1421  double vcrit;
1422  double factor1;
1423  double PhiB;
1424  double PhiBSW;
1425  double PhiBSWG;
1426 
1430  double em;
1431  double ef;
1432  double af;
1433  double kf;
1434 
1435  std::list<SizeDependParam*> sizeDependParamList;
1436 
1440  bool k1Given;
1441  bool k2Given;
1443  bool xtGiven;
1444  bool vbxGiven;
1445  bool vbmGiven;
1446  bool vfbGiven;
1448 
1449  // Variables from the 3f5 BSIM3 function b3temp, but are more
1450  // appropriate as model variables.
1451  double Vtm0;
1452  double Eg0;
1453  double ni;
1454 };
1455 
1456 //-----------------------------------------------------------------------------
1457 // Function : Instance:isConverged ()
1458 // Purpose : Return whether a BSIM3 device has done something that should
1459 // be interpreted as invalidating other convergence tests
1460 // In case of bsim3, just do it if the limiter function
1461 // pnjlim. This actually agrees with how the Check flag
1462 // is used in Spice3F5 b3ld.c
1463 // Special Notes :
1464 // Scope : public
1465 // Creator : Tom Russo, SNL, Component Information and Models
1466 // Creation Date : 03/22/05
1467 //-----------------------------------------------------------------------------
1469 {
1470  return (!limitedFlag);
1471 }
1472 
1473 //-----------------------------------------------------------------------------
1474 // Class : Master
1475 // Purpose :
1476 // Special Notes :
1477 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
1478 // Creation Date : 11/26/08
1479 //-----------------------------------------------------------------------------
1480 class Master : public DeviceMaster<Traits>
1481 {
1482  friend class SizeDependParam;
1483 public:
1485  const Configuration & configuration,
1486  const FactoryBlock & factory_block,
1487  const SolverState & ss1,
1488  const DeviceOptions & do1)
1489  : DeviceMaster<Traits>(configuration, factory_block, ss1, do1)
1490  {}
1491 
1492  virtual bool updateState (double * solVec, double * staVec, double * stoVec);
1493 
1494  // load functions, residual:
1495  virtual bool loadDAEVectors (double * solVec, double * fVec, double * qVec, double * bVec, double * storeLeadF, double * storeLeadQ);
1496 
1497  // load functions, Jacobian:
1498  virtual bool loadDAEMatrices (N_LAS_Matrix & dFdx, N_LAS_Matrix & dQdx);
1499 
1500 };
1501 
1502 void registerDevice();
1503 
1504 } // namespace MOSFET_B3
1505 } // namespace Device
1506 } // namespace Xyce
1507 
1511 
1512 #endif
1513