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.148.2.1 $
40 //
41 // Revision Date : $Date: 2014/02/26 20:16:30 $
42 //
43 // Current Owner : $Author: tvrusso $
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 const int numNodes() {return 4;}
73  static const bool modelRequired() {return true;}
74  static const 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 
984  {
985  return instanceContainer;
986  }
987 
989  {
990  return instanceContainer;
991  }
992 
993 private:
994  std::vector<Instance*> instanceContainer;
995 
996 private:
997 
998  // 3f5 stuff:
999  int modType;
1000  int dtype;
1001 
1002  int mobMod;
1003  int capMod;
1004  int noiMod;
1005  int binUnit;
1007 
1008  std::string version;
1009 
1011  // Bogus PSpice-y thing where you can set L and W on the model *or* the
1012  // instance line, with instance overriding model
1013  double model_l;
1014  double model_w;
1015  //
1016 
1017  double tox;
1018  double toxm;
1019  double cdsc;
1020  double cdscb;
1021  double cdscd;
1022  double cit;
1023  double nfactor;
1024  double xj;
1025  double vsat;
1026  double at;
1027  double a0;
1028  double ags;
1029  double a1;
1030  double a2;
1031  double keta;
1032  double nsub;
1033  double npeak;
1034  double ngate;
1035  double gamma1;
1036  double gamma2;
1037  double vbx;
1038  double vbm;
1039  double xt;
1040  double k1;
1041  double kt1;
1042  double kt1l;
1043  double kt2;
1044  double k2;
1045  double k3;
1046  double k3b;
1047  double w0;
1048  double nlx;
1049  double dvt0;
1050  double dvt1;
1051  double dvt2;
1052  double dvt0w;
1053  double dvt1w;
1054  double dvt2w;
1055  double drout;
1056  double dsub;
1057  double vth0;
1058  double ua;
1059  double ua1;
1060  double ub;
1061  double ub1;
1062  double uc;
1063  double uc1;
1064  double u0;
1065  double ute;
1066  double voff;
1067  double delta;
1068  double rdsw;
1069  double prwg;
1070  double prwb;
1071  double prt;
1072  double eta0;
1073  double etab;
1074  double pclm;
1075  double pdibl1;
1076  double pdibl2;
1077  double pdiblb;
1078  double pscbe1;
1079  double pscbe2;
1080  double pvag;
1081  double wr;
1082  double dwg;
1083  double dwb;
1084  double b0;
1085  double b1;
1086  double alpha0;
1087  double alpha1;
1088  double beta0;
1089  double ijth;
1090  double vfb;
1091 
1092  // CV model
1093  double elm;
1094  double cgsl;
1095  double cgdl;
1096  double ckappa;
1097  double cf;
1098  double vfbcv;
1099  double clc;
1100  double cle;
1101  double dwc;
1102  double dlc;
1103  double noff;
1104  double voffcv;
1105  double acde;
1106  double moin;
1107  double tcj;
1108  double tcjsw;
1109  double tcjswg;
1110  double tpb;
1111  double tpbsw;
1112  double tpbswg;
1113 
1114  // Length Dependence
1115  double lcdsc;
1116  double lcdscb;
1117  double lcdscd;
1118  double lcit;
1119  double lnfactor;
1120  double lxj;
1121  double lvsat;
1122  double lat;
1123  double la0;
1124  double lags;
1125  double la1;
1126  double la2;
1127  double lketa;
1128  double lnsub;
1129  double lnpeak;
1130  double lngate;
1131  double lgamma1;
1132  double lgamma2;
1133  double lvbx;
1134  double lvbm;
1135  double lxt;
1136  double lk1;
1137  double lkt1;
1138  double lkt1l;
1139  double lkt2;
1140  double lk2;
1141  double lk3;
1142  double lk3b;
1143  double lw0;
1144  double lnlx;
1145  double ldvt0;
1146  double ldvt1;
1147  double ldvt2;
1148  double ldvt0w;
1149  double ldvt1w;
1150  double ldvt2w;
1151  double ldrout;
1152  double ldsub;
1153  double lvth0;
1154  double lua;
1155  double lua1;
1156  double lub;
1157  double lub1;
1158  double luc;
1159  double luc1;
1160  double lu0;
1161  double lute;
1162  double lvoff;
1163  double ldelta;
1164  double lrdsw;
1165  double lprwg;
1166  double lprwb;
1167  double lprt;
1168  double leta0;
1169  double letab;
1170  double lpclm;
1171  double lpdibl1;
1172  double lpdibl2;
1173  double lpdiblb;
1174  double lpscbe1;
1175  double lpscbe2;
1176  double lpvag;
1177  double lwr;
1178  double ldwg;
1179  double ldwb;
1180  double lb0;
1181  double lb1;
1182  double lalpha0;
1183  double lalpha1;
1184  double lbeta0;
1185  double lvfb;
1186 
1187  // CV model
1188  double lelm;
1189  double lcgsl;
1190  double lcgdl;
1191  double lckappa;
1192  double lcf;
1193  double lclc;
1194  double lcle;
1195  double lvfbcv;
1196  double lnoff;
1197  double lvoffcv;
1198  double lacde;
1199  double lmoin;
1200 
1201  // Width Dependence
1202  double wcdsc;
1203  double wcdscb;
1204  double wcdscd;
1205  double wcit;
1206  double wnfactor;
1207  double wxj;
1208  double wvsat;
1209  double wat;
1210  double wa0;
1211  double wags;
1212  double wa1;
1213  double wa2;
1214  double wketa;
1215  double wnsub;
1216  double wnpeak;
1217  double wngate;
1218  double wgamma1;
1219  double wgamma2;
1220  double wvbx;
1221  double wvbm;
1222  double wxt;
1223  double wk1;
1224  double wkt1;
1225  double wkt1l;
1226  double wkt2;
1227  double wk2;
1228  double wk3;
1229  double wk3b;
1230  double ww0;
1231  double wnlx;
1232  double wdvt0;
1233  double wdvt1;
1234  double wdvt2;
1235  double wdvt0w;
1236  double wdvt1w;
1237  double wdvt2w;
1238  double wdrout;
1239  double wdsub;
1240  double wvth0;
1241  double wua;
1242  double wua1;
1243  double wub;
1244  double wub1;
1245  double wuc;
1246  double wuc1;
1247  double wu0;
1248  double wute;
1249  double wvoff;
1250  double wdelta;
1251  double wrdsw;
1252  double wprwg;
1253  double wprwb;
1254  double wprt;
1255  double weta0;
1256  double wetab;
1257  double wpclm;
1258  double wpdibl1;
1259  double wpdibl2;
1260  double wpdiblb;
1261  double wpscbe1;
1262  double wpscbe2;
1263  double wpvag;
1264  double wwr;
1265  double wdwg;
1266  double wdwb;
1267  double wb0;
1268  double wb1;
1269  double walpha0;
1270  double walpha1;
1271  double wbeta0;
1272  double wvfb;
1273 
1274  // CV model
1275  double welm;
1276  double wcgsl;
1277  double wcgdl;
1278  double wckappa;
1279  double wcf;
1280  double wclc;
1281  double wcle;
1282  double wvfbcv;
1283  double wnoff;
1284  double wvoffcv;
1285  double wacde;
1286  double wmoin;
1287 
1288  // Cross-term Dependence
1289  double pcdsc;
1290  double pcdscb;
1291  double pcdscd;
1292  double pcit;
1293  double pnfactor;
1294  double pxj;
1295  double pvsat;
1296  double pat;
1297  double pa0;
1298  double pags;
1299  double pa1;
1300  double pa2;
1301  double pketa;
1302  double pnsub;
1303  double pnpeak;
1304  double pngate;
1305  double pgamma1;
1306  double pgamma2;
1307  double pvbx;
1308  double pvbm;
1309  double pxt;
1310  double pk1;
1311  double pkt1;
1312  double pkt1l;
1313  double pkt2;
1314  double pk2;
1315  double pk3;
1316  double pk3b;
1317  double pw0;
1318  double pnlx;
1319  double pdvt0;
1320  double pdvt1;
1321  double pdvt2;
1322  double pdvt0w;
1323  double pdvt1w;
1324  double pdvt2w;
1325  double pdrout;
1326  double pdsub;
1327  double pvth0;
1328  double pua;
1329  double pua1;
1330  double pub;
1331  double pub1;
1332  double puc;
1333  double puc1;
1334  double pu0;
1335  double pute;
1336  double pvoff;
1337  double pdelta;
1338  double prdsw;
1339  double pprwg;
1340  double pprwb;
1341  double pprt;
1342  double peta0;
1343  double petab;
1344  double ppclm;
1345  double ppdibl1;
1346  double ppdibl2;
1347  double ppdiblb;
1348  double ppscbe1;
1349  double ppscbe2;
1350  double ppvag;
1351  double pwr;
1352  double pdwg;
1353  double pdwb;
1354  double pb0;
1355  double pb1;
1356  double palpha0;
1357  double palpha1;
1358  double pbeta0;
1359  double pvfb;
1360 
1361  // CV model
1362  double pelm;
1363  double pcgsl;
1364  double pcgdl;
1365  double pckappa;
1366  double pcf;
1367  double pclc;
1368  double pcle;
1369  double pvfbcv;
1370  double pnoff;
1371  double pvoffcv;
1372  double pacde;
1373  double pmoin;
1374 
1375  double tnom;
1376  double cgso;
1377  double cgdo;
1378  double cgbo;
1379  double xpart;
1380  double cFringOut;
1381  double cFringMax;
1382 
1397 
1398  double Lint;
1399  double Ll;
1400  double Llc;
1401  double Lln;
1402  double Lw;
1403  double Lwc;
1404  double Lwn;
1405  double Lwl;
1406  double Lwlc;
1407  double Lmin;
1408  double Lmax;
1409 
1410  double Wint;
1411  double Wl;
1412  double Wlc;
1413  double Wln;
1414  double Ww;
1415  double Wwc;
1416  double Wwn;
1417  double Wwl;
1418  double Wwlc;
1419  double Wmin;
1420  double Wmax;
1421 
1422 
1423  // Pre-calculated constants
1424  // MCJ: move to size-dependent param.
1425  double vtm;
1426  double cox;
1427  double cof1;
1428  double cof2;
1429  double cof3;
1430  double cof4;
1431  double vcrit;
1432  double factor1;
1433  double PhiB;
1434  double PhiBSW;
1435  double PhiBSWG;
1436 
1440  double em;
1441  double ef;
1442  double af;
1443  double kf;
1444 
1445  std::list<SizeDependParam*> sizeDependParamList;
1446 
1450  bool k1Given;
1451  bool k2Given;
1453  bool xtGiven;
1454  bool vbxGiven;
1455  bool vbmGiven;
1456  bool vfbGiven;
1458 
1459  // Variables from the 3f5 BSIM3 function b3temp, but are more
1460  // appropriate as model variables.
1461  double Vtm0;
1462  double Eg0;
1463  double ni;
1464 };
1465 
1466 //-----------------------------------------------------------------------------
1467 // Function : Instance:isConverged ()
1468 // Purpose : Return whether a BSIM3 device has done something that should
1469 // be interpreted as invalidating other convergence tests
1470 // In case of bsim3, just do it if the limiter function
1471 // pnjlim. This actually agrees with how the Check flag
1472 // is used in Spice3F5 b3ld.c
1473 // Special Notes :
1474 // Scope : public
1475 // Creator : Tom Russo, SNL, Component Information and Models
1476 // Creation Date : 03/22/05
1477 //-----------------------------------------------------------------------------
1479 {
1480  return (!limitedFlag);
1481 }
1482 
1483 //-----------------------------------------------------------------------------
1484 // Class : Master
1485 // Purpose :
1486 // Special Notes :
1487 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
1488 // Creation Date : 11/26/08
1489 //-----------------------------------------------------------------------------
1490 class Master : public DeviceMaster<Traits>
1491 {
1492  friend class SizeDependParam;
1493 public:
1495  const Configuration & configuration,
1496  const FactoryBlock & factory_block,
1497  const SolverState & ss1,
1498  const DeviceOptions & do1)
1499  : DeviceMaster<Traits>(configuration, factory_block, ss1, do1)
1500  {}
1501 
1502  virtual bool updateState (double * solVec, double * staVec, double * stoVec);
1503 
1504  // load functions, residual:
1505  virtual bool loadDAEVectors (double * solVec, double * fVec, double * qVec, double * storeLeadF, double * storeLeadQ);
1506 
1507  // load functions, Jacobian:
1508  virtual bool loadDAEMatrices (N_LAS_Matrix & dFdx, N_LAS_Matrix & dQdx);
1509 
1510 };
1511 
1512 void registerDevice();
1513 
1514 } // namespace MOSFET_B3
1515 } // namespace Device
1516 } // namespace Xyce
1517 
1521 
1522 #endif
1523