Xyce  6.1
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-2015 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.159 $
40 //
41 // Revision Date : $Date: 2015/04/08 19:18:24 $
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 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  void loadNodeSymbols(Util::SymbolTable &symbol_table) const; // override
267 
268  const std::vector< std::vector<int> > & jacobianStamp() const;
269  void registerJacLIDs( const std::vector< std::vector<int> > & jacLIDVec );
270 
271  bool processParams ();
272 
273  bool updateTemperature(const double & temp_tmp);
274  bool updateIntermediateVars ();
275  bool updatePrimaryState ();
276 
277  double StrongInversionNoiseEval(double Vds, double freq, double temp);
278  int getNumNoiseSources () const;
279  void setupNoiseSources (Xyce::Analysis::NoiseData & noiseData);
280  void getNoiseSources (Xyce::Analysis::NoiseData & noiseData);
281 
282  // load functions, residual:
283  bool loadDAEQVector ();
284  bool loadDAEFVector ();
285 
286  bool auxChargeCalculations ();
287  bool setupCapacitors_newDAE ();
288 
289  bool setupCapacitors_oldDAE ();
290 
291  // load functions, Jacobian:
292  bool loadDAEdQdx ();
293  bool loadDAEdFdx ();
294 
295  void setupPointers ();
296 
297  bool setIC ();
298 
299  inline bool isConverged();
300 
301 public:
302  // Getters and setters
304  {
305  return model_;
306  }
307 
308 private:
309 
310  Model & model_; ///< Owning model
311 
312  int dNode;
313  int gNode;
314  int sNode;
315  int bNode;
318  int qNode;
319 
320  double ueff;
321  double thetavth;
322  double von;
323  double vdsat;
324  double cgdo;
325  double cgso;
326  double vjsm;
327  double IsEvjsm;
328  double vjdm;
329  double IsEvjdm;
330 
331  double l;
332  double w;
333  double numberParallel; // PSpiceish "parallel copies" kludge
334  double drainArea;
335  double sourceArea;
336  double drainSquares;
342 
343  double icVBS;
344  double icVDS;
345  double icVGS;
346  bool OFF;
347  int mode;
348  int nqsMod;
349 
350  // OP point
351  double qinv;
352  double cd;
353  double cbs;
354  double cbd;
355  double csub;
356  double cdrain;
357  double gm;
358  double gds;
359  double gmbs;
360  double gbd;
361  double gbs;
362 
363  double gbbs;
364  double gbgs;
365  double gbds;
366 
367  double cggb;
368  double cgdb;
369  double cgsb;
370  double cbgb;
371  double cbdb;
372  double cbsb;
373  double cdgb;
374  double cddb;
375  double cdsb;
376  double capbd;
377  double capbs;
378 
379  double cqgb;
380  double cqdb;
381  double cqsb;
382  double cqbb;
383 
384  double qgate;
385  double qbulk;
386  double qdrn;
387 
388  double gtau;
389  double gtg;
390  double gtd;
391  double gts;
392  double gtb;
393 
394  double rds; // Noise bugfix
395  double Vgsteff;
396  double Vdseff;
397  double Abulk;
398  double AbovVgst2Vtm;
399 
401 
403 
407 
410 
411  // end of original 3f5 stuff
412 
413  // Variables from the 3f5 b3ld function, which were local to that
414  // function but are more appropriate as instance variables:
416 
417  double gcbdb;
418  double gcbgb;
419  double gcbsb;
420  double gcddb;
421  double gcdgb;
422  double gcdsb;
423  double gcgdb;
424  double gcggb;
425  double gcgsb;
426  double gcsdb;
427  double gcsgb;
428  double gcssb;
429 
430  double qgd, qgs, qgb;
431  double qgdo, qgso;
432 
433  double qsrc, CoxWL;
434  double Cgg, Cgd;
435  double Cgb, Cdg, Cdd, Cds;
436  double Csg, Csd, Css, Csb, Cbg, Cbd;
437  double Cbb;
438 
439  // new DAE stuff:
440  // Capacitance variables, which should correspond to the
441  // conductance variables used by the old-DAE.
442  //
443  // In general gcggb --> CAPcggb.
444  // gcgdb --> CAPcgdb. etc.
445  double CAPcggb;
446  double CAPcgdb;
447  double CAPcgsb;
448  double CAPcbgb;
449  double CAPcbdb;
450  double CAPcbsb;
451  double CAPcdgb;
452  double CAPcddb;
453  double CAPcdsb;
454  double CAPcsgb;
455  double CAPcsdb;
456  double CAPcssb;
457 
458  double Qeqqd_Jdxp;
459  double Qeqqb_Jdxp;
460  double Qeqqg_Jdxp;
461  // end of new-DAE stuff.
462 
463  double dxpart;
464  double sxpart;
465  double ggtg;
466  double ggtd;
467  double ggts;
468  double ggtb;
469  double ddxpart_dVd;
470  double ddxpart_dVg;
471  double ddxpart_dVb;
472  double ddxpart_dVs;
473  double dsxpart_dVd;
474  double dsxpart_dVg;
475  double dsxpart_dVb;
476  double dsxpart_dVs;
477 
478  double gbspsp;
479  double gbbdp;
480  double gbbsp;
481  double gbspg;
482  double gbspb;
483  double gbspdp;
484  double gbdpdp;
485  double gbdpg;
486  double gbdpb;
487  double gbdpsp;
488 
489  double cdreq;
490  double ceqbd;
491  double ceqbs;
492  double cdreq_Jdxp;
493  double ceqbd_Jdxp;
494  double ceqbs_Jdxp;
495 
496  double Gm;
497  double Gmbs;
498  double FwdSum;
499  double RevSum;
500  double T1global;
501 
502  double dVgst_dVg;
503  double dVgst_dVb;
504  double dVgs_eff_dVg;
505 
509 
510  double gqdef;
511  double gcqdb, gcqsb, gcqgb;
512  double gcqbb;
514  double cqgate, cqbulk, cqdrn;
515 
516  // Variables which were model variables in the 3f5 version of the BSIM3,
517  // but are temperature dependent and should be instance variables (as
518  // temperature is an instance-level quantity.
519  double vtm;
522 
526  double PhiBTemp;
527  double PhiBSWTemp;
528  double PhiBSWGTemp;
529  // end of 3f5 stuff
530 
531  double temp;
532 
533  // solution variables, and intermediate quantities.
534  //double mode; // mode=1:normal mode. mode=-1:inverse mode.
535  double Vd; // drain node voltage
536  double Vs; // source node voltage
537  double Vg; // gate node voltage
538  double Vb; // bulk node voltage
539  double Vsp; // source prime voltage
540  double Vdp; // drain prime voltage
541 
542  double Qtotal; // total charge variable.
543 
544  double Vddp; // voltage drop between drain and drain'
545  double Vssp; // voltage drop between source and source'
546 
547  double Vbsp; // voltage drop, bulk-source prime
548  double Vbdp; // voltage drop, bulk-drain prime
549 
550  double Vgsp; // voltage drop, gate-Source prime
551  double Vgdp; // voltage drop, gate-Drain prime
552  double Vgb; // voltage drop, gate-Bulk
553 
554  double Vdpsp; // voltage drop accross the channel
555  double Vgt; // Vgs-Vthresh
556 
557  // resistor currents:
558  double Idrain; // current through drain resistor
559  double Isource; // current through source resistor
560 
561  // channel current stuff:
562  double df1dVdp;
563  double df2dVdp;
564 
565  double df1dVsp;
566  double df2dVsp;
567 
568  double df1dVg;
569  double df2dVg;
570 
571  double df1dVb;
572  double df2dVb;
573 
574  double vgb, vgd;
575  double cqdef;
576  double ceqqd;
577  double ceqqb;
578  double ceqqg;
579 
580  double cqdef_Jdxp;
581  double ceqqd_Jdxp;
582  double ceqqb_Jdxp;
583  double ceqqg_Jdxp;
584 
585  // state variables, voltage drops
586  double vbd; // Volage drop, bulk-drain'
587  double vbs; // Volage drop, bulk-source'
588  double vgs; // Volage drop, gate-source'
589  double vds; // Volage drop, drain-source'
590 
591  // old versions of state variables, voltage drops
592  // here "old" refers to the previous newton iteration.
593  double vbd_old; // Volage drop, bulk-drain'
594  double vbs_old; // Volage drop, bulk-source'
595  double vgs_old; // Volage drop, gate-source'
596  double vds_old; // Volage drop, drain-source'
597 
598  // "original" versions of various voltage drop variables:
599  // original refers to the beginning of the newton iterations,
600  // before any limits are imposed on the change in voltage drop.
601  double vgs_orig;
602  double vds_orig;
603  double vbs_orig;
604  double vbd_orig;
605  double vgd_orig;
606 
607  // state variables, intrinsic capacitors
608  double qb;
609  double qg;
610  double qd;
611 
612  // state variables, parasitic capacitors
613  double qbs;
614  double qbd;
615 
616  // state variables, cheq
617  double qcheq;
618 
619  // state variables, cdump
620  double qcdump;
621 
622  // state variable, qdef
623  double qdef;
624 
625  // Indices into the state vector:
626 
627  // state variables, voltage drops
637 
638  // state variables, intrinsic capacitors
642 
643  // state variables, parasitic capacitors
646 
647  // state variables, cheq
649 
650  // state variables, cdump
652 
653  // state variable, qdef
655 
656  ////////////////////////////////////////////////////////////////////
657  // Local variable indices
658  int li_Drain;
659  int li_Gate;
661  int li_Bulk;
665 
666  // local indies
667  int li_Ibs;
668  int li_Ids;
669  int li_Igs;
670 
671  ////////////////////////////////////////////////////////////////////
672  // Jacobian matrix indices:
673  // This is a 7x7 to 10x10 matrix block with 37 entries
674  //
675  // ---------------------------------------------------------------------------
676  // | #NZ | | |
677  // | entries | | V_d V_g V_s V_b V_d' V_s' Q Ibs Ids Igs |
678  // ---------------------------------------------------------------------------|
679  // | 3/2 | KCL_d | a b i1 |
680  // | 6/5 | KCL_g | c d e f 1 i2 |
681  // | 5/2 | KCL_s | g h i3 i4 i5 |
682  // | 6/5 | KCL_b | i j k l 2 i6 |
683  // | 6 | KCL_d'| m n o p q 3 |
684  // | 6 | KCL_s'| r s t u v 4 |
685  // | 5 | Q_equ | 7 9 6 8 5 |
686  // | 2/1 | icVBS | i7 i8 (i9) |
687  // | 2/1 | icVDS | i10 i11 (i12) |
688  // | 2/1 | icVGS | i13 i14 (i15) |
689  // ---------------------------------------------------------------------------
690  // 43 at operating point, 34 normally
691  //
692  // Terms beginning with "i", not in parenthesis are for
693  // initial conditions and apply only at the operating point.
694  // These terms reduce to the terms in parenthesis during time
695  // integration -- i.e. the other "i" terms go to zero during
696  // time integration.
697  ////////////////////////////////////////////////////////////////////
698 
699  // Offset variables corresponding to the above declared indices.
700 
701  // Jacobian Matrix Offsets:
702 
703  // V_d Row:
707 
708  // V_g Row:
714  int AGateEquIgsOffset; // i2
715 
716  // V_s Row:
722 
723  // V_b Row:
729  int ABulkEquIbsOffset; // i6
730 
731  // V_d' Row:
738 
739  // V_s' Row:
746 
747  // MOSFET charge (Q) Row:
753 
754  // icVBS
755  int icVBSEquVsOffset; // i7
756  int icVBSEquVbOffset; // i8
757  int icVBSEquIbsOffset; // i9
758 
759  // icVDS
760  int icVDSEquVdOffset; // i10
761  int icVDSEquVsOffset; // i11
762  int icVDSEquIdsOffset; // i12
763 
764  // icVGS
765  int icVGSEquVgOffset; // i13
766  int icVGSEquVsOffset; // i14
767  int icVGSEquIgsOffset; // i15
768 
769 #ifndef Xyce_NONPOINTER_MATRIX_LOAD
770  ///////////////////////////////////////////////////
771  // Jacobian Matrix Pointers:
772 
773  // V_d Row:
774  double * f_DrainEquDrainNodePtr; // a
776  double * f_DrainEquIdsPtr; // i1
777 
778  // V_g Row:
779  double * f_GateEquGateNodePtr; // c
780  double * f_GateEquBulkNodePtr; // d
783  double * f_GateEquChargeVarPtr; // 1
784  double * f_GateEquIgsPtr; // i2
785 
786  // V_s Row:
789  double * f_SourceEquIbsPtr; // i3
790  double * f_SourceEquIdsPtr; // i4
791  double * f_SourceEquIgsPtr; // i5
792 
793  // V_b Row:
794  double * f_BulkEquGateNodePtr; // i
795  double * f_BulkEquBulkNodePtr; // j
798  double * f_BulkEquChargeVarPtr; // 2
799  double * f_BulkEquIbsPtr; // i6
800 
801  // V_d' Row:
808 
809  // V_s' Row:
816 
817  // MOSFET charge (Q) Row:
818  double * f_ChargeEquChargeVarPtr; // 5
820  double * f_ChargeEquGateNodePtr; // 7
822  double * f_ChargeEquBulkNodePtr; // 9
823 
824  // icVBS
825  double * f_icVBSEquVsPtr; // i7
826  double * f_icVBSEquVbPtr; // i8
827  double * f_icVBSEquIbsPtr; // i9
828 
829  // icVDS
830  double * f_icVDSEquVdPtr; // i10
831  double * f_icVDSEquVsPtr; // i11
832  double * f_icVDSEquIdsPtr; // i12
833 
834  // icVGS
835  double * f_icVGSEquVgPtr; // i13
836  double * f_icVGSEquVsPtr; // i14
837  double * f_icVGSEquIgsPtr; // i15
838 
839  // V_d Row:
840  double * q_DrainEquDrainNodePtr; // a
842  double * q_DrainEquIdsPtr; // i1
843 
844  // V_g Row:
845  double * q_GateEquGateNodePtr; // c
846  double * q_GateEquBulkNodePtr; // d
849  double * q_GateEquChargeVarPtr; // 1
850  double * q_GateEquIgsPtr; // i2
851 
852  // V_s Row:
855  double * q_SourceEquIbsPtr; // i3
856  double * q_SourceEquIdsPtr; // i4
857  double * q_SourceEquIgsPtr; // i5
858 
859  // V_b Row:
860  double * q_BulkEquGateNodePtr; // i
861  double * q_BulkEquBulkNodePtr; // j
864  double * q_BulkEquChargeVarPtr; // 2
865  double * q_BulkEquIbsPtr; // i6
866 
867  // V_d' Row:
874 
875  // V_s' Row:
882 
883  // MOSFET charge (Q) Row:
884  double * q_ChargeEquChargeVarPtr; // 5
886  double * q_ChargeEquGateNodePtr; // 7
888  double * q_ChargeEquBulkNodePtr; // 9
889 
890  // icVBS
891  double * q_icVBSEquVsPtr; // i7
892  double * q_icVBSEquVbPtr; // i8
893  double * q_icVBSEquIbsPtr; // i9
894 
895  // icVDS
896  double * q_icVDSEquVdPtr; // i10
897  double * q_icVDSEquVsPtr; // i11
898  double * q_icVDSEquIdsPtr; // i12
899 
900  // icVGS
901  double * q_icVGSEquVgPtr; // i13
902  double * q_icVGSEquVsPtr; // i14
903  double * q_icVGSEquIgsPtr; // i15
904 #endif
905 
906  // flag for updateTemperature call. Needed for .STEP temperature sweeps.
908 
909  static std::vector< std::vector<int> > jacStamp_DC_SC;
910  static std::vector< std::vector<int> > jacStamp_DC;
911  static std::vector< std::vector<int> > jacStamp_SC;
912  static std::vector< std::vector<int> > jacStamp;
913 
914  static std::vector<int> jacMap_DC_SC;
915  static std::vector<int> jacMap_DC;
916  static std::vector<int> jacMap_SC;
917  static std::vector<int> jacMap;
918 
919  static std::vector< std::vector<int> > jacMap2_DC_SC;
920  static std::vector< std::vector<int> > jacMap2_DC;
921  static std::vector< std::vector<int> > jacMap2_SC;
922  static std::vector< std::vector<int> > jacMap2;
923 
924  int blockHomotopyID; // For homotopy
925  double randomPerturb; // For homotopy
926 
927  // Most versions of this device will use one of the four
928  // jacobian's defined as static above. However, if nqsMod is true
929  // or or any of the three initial conditions are specified (icVBS,
930  // icVDS or icVGS), then the number of jacobian permutations goes
931  // up to 112 (4 from static versions above * 2 for nqsMod on/off *
932  // 7 for IC's = 4 * 2 * 7 = 56) Rather than enumerate all of these
933  // as static functions, we'll make non-static, member variables of
934  // the jacStamp for those few devices that specify nqsMod or
935  // initial conditoins.
936 
937  std::vector< std::vector< int > > jacStampSpecial; // for simulation
938 
939  // used when we need to merge the d' and or s' nodes
940  std::vector< std::vector<int> > jacStampSpecialMerged;
941  std::vector<int> jacSpecialMap;
942  std::vector< std::vector<int> > jacSpecialMap2;
943  std::vector<int> jacSpecialMergedMap;
944  std::vector< std::vector<int> > jacSpecialMergedMap2;
945 };
946 
947 //-----------------------------------------------------------------------------
948 // Class : Model
949 // Purpose :
950 // Special Notes :
951 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
952 // Creation Date : 11/14/00
953 //-----------------------------------------------------------------------------
954 class Model : public DeviceModel
955 {
956  typedef std::vector<Instance *> InstanceVector;
957 
958  friend class SizeDependParam;
959  friend class ParametricData<Model>;
960  friend class Instance;
961  friend class Traits;friend class Master;
962 
963 public:
964  Model(
965  const Configuration & configuration,
966  const ModelBlock & MB,
967  const FactoryBlock & factory_block);
968  ~Model();
969 
970 private:
971  Model();
972  Model(const Model &);
973  Model &operator=(const Model &);
974 
975 public:
976  virtual void forEachInstance(DeviceInstanceOp &op) const /* override */;
977 
978  virtual std::ostream &printOutInstances(std::ostream &os) const;
979 
980  bool processParams ();
981  bool processInstanceParams ();
982 
983  bool clearTemperatureData ();
984 
985 public:
986  void addInstance(Instance *instance)
987  {
988  instanceContainer.push_back(instance);
989  }
990 
991 private:
992  std::vector<Instance*> instanceContainer;
993 
994 private:
995 
996  // 3f5 stuff:
997  int modType;
998  int dtype;
999 
1000  int mobMod;
1001  int capMod;
1002  int noiMod;
1003  int binUnit;
1005 
1006  std::string version;
1007 
1009  // Bogus PSpice-y thing where you can set L and W on the model *or* the
1010  // instance line, with instance overriding model
1011  double model_l;
1012  double model_w;
1013  //
1014 
1015  double tox;
1016  double toxm;
1017  double cdsc;
1018  double cdscb;
1019  double cdscd;
1020  double cit;
1021  double nfactor;
1022  double xj;
1023  double vsat;
1024  double at;
1025  double a0;
1026  double ags;
1027  double a1;
1028  double a2;
1029  double keta;
1030  double nsub;
1031  double npeak;
1032  double ngate;
1033  double gamma1;
1034  double gamma2;
1035  double vbx;
1036  double vbm;
1037  double xt;
1038  double k1;
1039  double kt1;
1040  double kt1l;
1041  double kt2;
1042  double k2;
1043  double k3;
1044  double k3b;
1045  double w0;
1046  double nlx;
1047  double dvt0;
1048  double dvt1;
1049  double dvt2;
1050  double dvt0w;
1051  double dvt1w;
1052  double dvt2w;
1053  double drout;
1054  double dsub;
1055  double vth0;
1056  double ua;
1057  double ua1;
1058  double ub;
1059  double ub1;
1060  double uc;
1061  double uc1;
1062  double u0;
1063  double ute;
1064  double voff;
1065  double delta;
1066  double rdsw;
1067  double prwg;
1068  double prwb;
1069  double prt;
1070  double eta0;
1071  double etab;
1072  double pclm;
1073  double pdibl1;
1074  double pdibl2;
1075  double pdiblb;
1076  double pscbe1;
1077  double pscbe2;
1078  double pvag;
1079  double wr;
1080  double dwg;
1081  double dwb;
1082  double b0;
1083  double b1;
1084  double alpha0;
1085  double alpha1;
1086  double beta0;
1087  double ijth;
1088  double vfb;
1089 
1090  // CV model
1091  double elm;
1092  double cgsl;
1093  double cgdl;
1094  double ckappa;
1095  double cf;
1096  double vfbcv;
1097  double clc;
1098  double cle;
1099  double dwc;
1100  double dlc;
1101  double noff;
1102  double voffcv;
1103  double acde;
1104  double moin;
1105  double tcj;
1106  double tcjsw;
1107  double tcjswg;
1108  double tpb;
1109  double tpbsw;
1110  double tpbswg;
1111 
1112  // Length Dependence
1113  double lcdsc;
1114  double lcdscb;
1115  double lcdscd;
1116  double lcit;
1117  double lnfactor;
1118  double lxj;
1119  double lvsat;
1120  double lat;
1121  double la0;
1122  double lags;
1123  double la1;
1124  double la2;
1125  double lketa;
1126  double lnsub;
1127  double lnpeak;
1128  double lngate;
1129  double lgamma1;
1130  double lgamma2;
1131  double lvbx;
1132  double lvbm;
1133  double lxt;
1134  double lk1;
1135  double lkt1;
1136  double lkt1l;
1137  double lkt2;
1138  double lk2;
1139  double lk3;
1140  double lk3b;
1141  double lw0;
1142  double lnlx;
1143  double ldvt0;
1144  double ldvt1;
1145  double ldvt2;
1146  double ldvt0w;
1147  double ldvt1w;
1148  double ldvt2w;
1149  double ldrout;
1150  double ldsub;
1151  double lvth0;
1152  double lua;
1153  double lua1;
1154  double lub;
1155  double lub1;
1156  double luc;
1157  double luc1;
1158  double lu0;
1159  double lute;
1160  double lvoff;
1161  double ldelta;
1162  double lrdsw;
1163  double lprwg;
1164  double lprwb;
1165  double lprt;
1166  double leta0;
1167  double letab;
1168  double lpclm;
1169  double lpdibl1;
1170  double lpdibl2;
1171  double lpdiblb;
1172  double lpscbe1;
1173  double lpscbe2;
1174  double lpvag;
1175  double lwr;
1176  double ldwg;
1177  double ldwb;
1178  double lb0;
1179  double lb1;
1180  double lalpha0;
1181  double lalpha1;
1182  double lbeta0;
1183  double lvfb;
1184 
1185  // CV model
1186  double lelm;
1187  double lcgsl;
1188  double lcgdl;
1189  double lckappa;
1190  double lcf;
1191  double lclc;
1192  double lcle;
1193  double lvfbcv;
1194  double lnoff;
1195  double lvoffcv;
1196  double lacde;
1197  double lmoin;
1198 
1199  // Width Dependence
1200  double wcdsc;
1201  double wcdscb;
1202  double wcdscd;
1203  double wcit;
1204  double wnfactor;
1205  double wxj;
1206  double wvsat;
1207  double wat;
1208  double wa0;
1209  double wags;
1210  double wa1;
1211  double wa2;
1212  double wketa;
1213  double wnsub;
1214  double wnpeak;
1215  double wngate;
1216  double wgamma1;
1217  double wgamma2;
1218  double wvbx;
1219  double wvbm;
1220  double wxt;
1221  double wk1;
1222  double wkt1;
1223  double wkt1l;
1224  double wkt2;
1225  double wk2;
1226  double wk3;
1227  double wk3b;
1228  double ww0;
1229  double wnlx;
1230  double wdvt0;
1231  double wdvt1;
1232  double wdvt2;
1233  double wdvt0w;
1234  double wdvt1w;
1235  double wdvt2w;
1236  double wdrout;
1237  double wdsub;
1238  double wvth0;
1239  double wua;
1240  double wua1;
1241  double wub;
1242  double wub1;
1243  double wuc;
1244  double wuc1;
1245  double wu0;
1246  double wute;
1247  double wvoff;
1248  double wdelta;
1249  double wrdsw;
1250  double wprwg;
1251  double wprwb;
1252  double wprt;
1253  double weta0;
1254  double wetab;
1255  double wpclm;
1256  double wpdibl1;
1257  double wpdibl2;
1258  double wpdiblb;
1259  double wpscbe1;
1260  double wpscbe2;
1261  double wpvag;
1262  double wwr;
1263  double wdwg;
1264  double wdwb;
1265  double wb0;
1266  double wb1;
1267  double walpha0;
1268  double walpha1;
1269  double wbeta0;
1270  double wvfb;
1271 
1272  // CV model
1273  double welm;
1274  double wcgsl;
1275  double wcgdl;
1276  double wckappa;
1277  double wcf;
1278  double wclc;
1279  double wcle;
1280  double wvfbcv;
1281  double wnoff;
1282  double wvoffcv;
1283  double wacde;
1284  double wmoin;
1285 
1286  // Cross-term Dependence
1287  double pcdsc;
1288  double pcdscb;
1289  double pcdscd;
1290  double pcit;
1291  double pnfactor;
1292  double pxj;
1293  double pvsat;
1294  double pat;
1295  double pa0;
1296  double pags;
1297  double pa1;
1298  double pa2;
1299  double pketa;
1300  double pnsub;
1301  double pnpeak;
1302  double pngate;
1303  double pgamma1;
1304  double pgamma2;
1305  double pvbx;
1306  double pvbm;
1307  double pxt;
1308  double pk1;
1309  double pkt1;
1310  double pkt1l;
1311  double pkt2;
1312  double pk2;
1313  double pk3;
1314  double pk3b;
1315  double pw0;
1316  double pnlx;
1317  double pdvt0;
1318  double pdvt1;
1319  double pdvt2;
1320  double pdvt0w;
1321  double pdvt1w;
1322  double pdvt2w;
1323  double pdrout;
1324  double pdsub;
1325  double pvth0;
1326  double pua;
1327  double pua1;
1328  double pub;
1329  double pub1;
1330  double puc;
1331  double puc1;
1332  double pu0;
1333  double pute;
1334  double pvoff;
1335  double pdelta;
1336  double prdsw;
1337  double pprwg;
1338  double pprwb;
1339  double pprt;
1340  double peta0;
1341  double petab;
1342  double ppclm;
1343  double ppdibl1;
1344  double ppdibl2;
1345  double ppdiblb;
1346  double ppscbe1;
1347  double ppscbe2;
1348  double ppvag;
1349  double pwr;
1350  double pdwg;
1351  double pdwb;
1352  double pb0;
1353  double pb1;
1354  double palpha0;
1355  double palpha1;
1356  double pbeta0;
1357  double pvfb;
1358 
1359  // CV model
1360  double pelm;
1361  double pcgsl;
1362  double pcgdl;
1363  double pckappa;
1364  double pcf;
1365  double pclc;
1366  double pcle;
1367  double pvfbcv;
1368  double pnoff;
1369  double pvoffcv;
1370  double pacde;
1371  double pmoin;
1372 
1373  double tnom;
1374  double cgso;
1375  double cgdo;
1376  double cgbo;
1377  double xpart;
1378  double cFringOut;
1379  double cFringMax;
1380 
1395 
1396  double Lint;
1397  double Ll;
1398  double Llc;
1399  double Lln;
1400  double Lw;
1401  double Lwc;
1402  double Lwn;
1403  double Lwl;
1404  double Lwlc;
1405  double Lmin;
1406  double Lmax;
1407 
1408  double Wint;
1409  double Wl;
1410  double Wlc;
1411  double Wln;
1412  double Ww;
1413  double Wwc;
1414  double Wwn;
1415  double Wwl;
1416  double Wwlc;
1417  double Wmin;
1418  double Wmax;
1419 
1420 
1421  // Pre-calculated constants
1422  // MCJ: move to size-dependent param.
1423  double vtm;
1424  double cox;
1425  double cof1;
1426  double cof2;
1427  double cof3;
1428  double cof4;
1429  double vcrit;
1430  double factor1;
1431  double PhiB;
1432  double PhiBSW;
1433  double PhiBSWG;
1434 
1438  double em;
1439  double ef;
1440  double af;
1441  double kf;
1442  double lintnoi;
1443 
1444  std::list<SizeDependParam*> sizeDependParamList;
1445 
1449  bool k1Given;
1450  bool k2Given;
1452  bool xtGiven;
1453  bool vbxGiven;
1454  bool vbmGiven;
1455  bool vfbGiven;
1457 
1458  // Variables from the 3f5 BSIM3 function b3temp, but are more
1459  // appropriate as model variables.
1460  double Vtm0;
1461  double Eg0;
1462  double ni;
1463 };
1464 
1465 //-----------------------------------------------------------------------------
1466 // Function : Instance:isConverged ()
1467 // Purpose : Return whether a BSIM3 device has done something that should
1468 // be interpreted as invalidating other convergence tests
1469 // In case of bsim3, just do it if the limiter function
1470 // pnjlim. This actually agrees with how the Check flag
1471 // is used in Spice3F5 b3ld.c
1472 // Special Notes :
1473 // Scope : public
1474 // Creator : Tom Russo, SNL, Component Information and Models
1475 // Creation Date : 03/22/05
1476 //-----------------------------------------------------------------------------
1478 {
1479  return (!limitedFlag);
1480 }
1481 
1482 //-----------------------------------------------------------------------------
1483 // Class : Master
1484 // Purpose :
1485 // Special Notes :
1486 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
1487 // Creation Date : 11/26/08
1488 //-----------------------------------------------------------------------------
1489 class Master : public DeviceMaster<Traits>
1490 {
1491  friend class SizeDependParam;
1492 public:
1494  const Configuration & configuration,
1495  const FactoryBlock & factory_block,
1496  const SolverState & ss1,
1497  const DeviceOptions & do1)
1498  : DeviceMaster<Traits>(configuration, factory_block, ss1, do1)
1499  {}
1500 
1501  virtual bool updateState (double * solVec, double * staVec, double * stoVec);
1502 
1503  // load functions, residual:
1504  virtual bool loadDAEVectors (double * solVec, double * fVec, double * qVec, double * bVec, double * storeLeadF, double * storeLeadQ, double * leadF, double * leadQ, double * junctionV);
1505 
1506  // load functions, Jacobian:
1507  virtual bool loadDAEMatrices (Linear::Matrix & dFdx, Linear::Matrix & dQdx);
1508 
1509 };
1510 
1511 void registerDevice();
1512 
1513 } // namespace MOSFET_B3
1514 } // namespace Device
1515 } // namespace Xyce
1516 
1517 #endif
1518 
Instance(const Configuration &configuration, const InstanceBlock &IB, Model &Miter, const FactoryBlock &factory_block)
static const char * name()
static std::vector< std::vector< int > > jacMap2
void registerLIDs(const std::vector< int > &intLIDVecRef, const std::vector< int > &extLIDVecRef)
void registerStoreLIDs(const std::vector< int > &stoLIDVecRef)
static std::vector< int > jacMap_DC
Pure virtual class to augment a linear system.
double StrongInversionNoiseEval(double Vds, double freq, double temp)
std::list< SizeDependParam * > sizeDependParamList
std::vector< int > jacSpecialMergedMap
static std::vector< std::vector< int > > jacMap2_DC_SC
static std::vector< int > jacMap_SC
void registerStateLIDs(const std::vector< int > &staLIDVecRef)
std::vector< Instance * > instanceContainer
virtual bool updateState(double *solVec, double *staVec, double *stoVec)
Updates the devices state information.
static void loadModelParameters(ParametricData< Model > &model_parameters)
void getNoiseSources(Xyce::Analysis::NoiseData &noiseData)
void setupNoiseSources(Xyce::Analysis::NoiseData &noiseData)
Model & operator=(const Model &)
static std::vector< std::vector< int > > jacStamp_DC_SC
DeviceMaster instantiates a device as described by the device traits T.
The FactoryBlock contains parameters needed by the device, instance and model creation functions...
std::vector< Instance * > InstanceVector
virtual std::ostream & printOutInstances(std::ostream &os) const
bool updateTemperature(const double &temp_tmp)
static void loadInstanceParameters(ParametricData< Instance > &instance_parameters)
virtual void forEachInstance(DeviceInstanceOp &op) const
Apply a device instance "op" to all instances associated with this model.
void addInstance(Instance *instance)
const std::vector< std::vector< int > > & jacobianStamp() const
bool processInstanceParams()
processInstanceParams
The Device class is an interface for device implementations.
Definition: N_DEV_Device.h:101
Instance & operator=(const Instance &)
static std::vector< std::vector< int > > jacMap2_SC
std::vector< std::vector< int > > jacSpecialMap2
void registerJacLIDs(const std::vector< std::vector< int > > &jacLIDVec)
Class Configuration contains device configuration data.
bool processParams()
processParams
std::vector< std::vector< int > > jacSpecialMergedMap2
static std::vector< int > jacMap
virtual bool loadDAEVectors(double *solVec, double *fVec, double *qVec, double *bVec, double *storeLeadF, double *storeLeadQ, double *leadF, double *leadQ, double *junctionV)
Populates the device's ExternData object with these pointers.
std::vector< std::vector< int > > jacStampSpecial
std::vector< std::vector< int > > jacStampSpecialMerged
Master(const Configuration &configuration, const FactoryBlock &factory_block, const SolverState &ss1, const DeviceOptions &do1)
void loadNodeSymbols(Util::SymbolTable &symbol_table) const
Populates and returns the store name map.
static std::vector< std::vector< int > > jacStamp_SC
static std::vector< int > jacMap_DC_SC
static Device * factory(const Configuration &configuration, const FactoryBlock &factory_block)
static std::vector< std::vector< int > > jacStamp_DC
ModelBlock represents a .MODEL line from the netlist.
static std::vector< std::vector< int > > jacStamp
The DeviceTraits template describes the configuration of a device.
Manages parameter binding for class C.
Definition: N_DEV_Pars.h:214
InstanceBlock represent a device instance line from the netlist.
virtual bool loadDAEMatrices(Linear::Matrix &dFdx, Linear::Matrix &dQdx)
Populates the device's Jacobian object with these pointers.
static std::vector< std::vector< int > > jacMap2_DC
static const char * deviceTypeName()