Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_DEV_MOSFET6.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_MOSFET6.h,v $
27 //
28 // Purpose : Level 6 Metal-oxide-semiconductor field effect transistor
29 // (MOSFET) classes.
30 //
31 // Special Notes :
32 //
33 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
34 //
35 // Creation Date : 02/28/00
36 //
37 // Revision Information:
38 // ---------------------
39 //
40 // Revision Number: $Revision: 1.47.2.1 $
41 //
42 // Revision Date : $Date: 2014/02/26 20:16:30 $
43 //
44 // Current Owner : $Author: tvrusso $
45 //-----------------------------------------------------------------------------
46 
47 #ifndef Xyce_N_DEV_MOSFET6_h
48 #define Xyce_N_DEV_MOSFET6_h
49 
50 // ---------- Xyce Includes ----------
51 #include <N_DEV_Configuration.h>
52 #include <N_DEV_DeviceMaster.h>
53 #include <N_DEV_DeviceInstance.h>
54 #include <N_DEV_DeviceModel.h>
55 #include <N_DEV_DeviceBlock.h>
56 
57 #include <N_DEV_MOSFET1.h>
58 
59 namespace Xyce {
60 namespace Device {
61 namespace MOSFET6 {
62 
63 class Model;
64 class Instance;
65 
66 struct Traits : public DeviceTraits<Model, Instance, MOSFET1::Traits>
67 {
68  static const char *name() {return "MOSFET level 6";}
69  static const char *deviceTypeName() {return "M level 6";}
70  static const int numNodes() {return 4;}
71  static const bool modelRequired() {return true;}
72  static const bool isLinearDevice() {return false;}
73 
74  static Device *factory(const Configuration &configuration, const FactoryBlock &factory_block);
75  static void loadModelParameters(ParametricData<Model> &model_parameters);
76  static void loadInstanceParameters(ParametricData<Instance> &instance_parameters);
77 };
78 
79 //-----------------------------------------------------------------------------
80 // Class : Instance
81 // Purpose :
82 // Special Notes :
83 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
84 // Creation Date : 3/16/00
85 //-----------------------------------------------------------------------------
86 class Instance : public DeviceInstance
87 {
88  friend class ParametricData<Instance>;
89  friend class Model;
90  friend class Traits;friend class Master;
91 
92 public:
93 
94  Instance(
95  const Configuration & configuration,
96  const InstanceBlock & IB,
97  Model & Miter,
98  const FactoryBlock & factory_block);
99 
100  ~Instance();
101 
102 private:
103  Instance(const Instance &);
104  Instance &operator=(const Instance &);
105 
106 public:
107  void registerLIDs( const std::vector<int> & intLIDVecRef,
108  const std::vector<int> & extLIDVecRef );
109  void registerStateLIDs( const std::vector<int> & staLIDVecRef);
110  void registerStoreLIDs(const std::vector<int> & stoLIDVecRef);
111 
112  std::map<int,std::string> & getIntNameMap ();
113  std::map<int,std::string> & getStoreNameMap ();
114 
115 
116  const std::vector< std::vector<int> > & jacobianStamp() const;
117  void registerJacLIDs( const std::vector< std::vector<int> > & jacLIDVec );
118 
119  bool processParams ();
120 
121  bool updateTemperature(const double & temp_tmp);
122  bool updateIntermediateVars ();
123  bool updatePrimaryState ();
124 
125  // load functions, residual:
126  bool loadDAEQVector ();
127  bool loadDAEFVector ();
128 
129  // load functions, Jacobian:
130  bool loadDAEdQdx ();
131  bool loadDAEdFdx ();
132 
133  void setupPointers();
134 
135  // Additional Public Declarations
136  bool isConverged();
137 
138 public:
139  // Getters and setters
141  {
142  return model_;
143  }
144 
145 private:
146  static std::vector< std::vector<int> > jacStamp_DC_SC;
147  static std::vector< std::vector<int> > jacStamp_DC;
148  static std::vector< std::vector<int> > jacStamp_SC;
149  static std::vector< std::vector<int> > jacStamp;
150 
151  static std::vector<int> jacMap_DC_SC;
152  static std::vector<int> jacMap_DC;
153  static std::vector<int> jacMap_SC;
154  static std::vector<int> jacMap;
155 
156  static std::vector< std::vector<int> > jacMap2_DC_SC;
157  static std::vector< std::vector<int> > jacMap2_DC;
158  static std::vector< std::vector<int> > jacMap2_SC;
159  static std::vector< std::vector<int> > jacMap2;
160 
161 
162  Model & model_; //< Owning model
163 
164  // instance variables ripped -- bleeding and without anesthetic -- from
165  // 3f5, with obvious modifications to names (remove MOS6 prefix)
166  int states; // index into state table for this device
167  int dNode; // number of the gate node of the mosfet
168  int gNode; // number of the gate node of the mosfet
169  int sNode; // number of the source node of the mosfet
170  int bNode; // number of the bulk node of the mosfet
171  int dNodePrime; // number of the internal drain node of the mosfet
172  int sNodePrime; // number of the internal source node of the mosfet
173 
174 
175  bool OFF; // device initialized OFF (vbs=vgs=vds=0)
176 
177  double l; // the length of the channel region
178  double w; // the width of the channel region
179  double drainArea; // the area of the drain diffusion
180  double sourceArea; // the area of the source diffusion
181  double drainSquares; // the length of the drain in squares
182  double sourceSquares; // the length of the source in squares
185  double sourceConductance; //conductance of source(or 0):set in setup
186  double drainConductance; //conductance of drain(or 0):set in setup
187  double temp; // operating temperature of this instance
188  double numberParallel; // number simulated parallel mosfets
189 
190  double tKv; // temperature corrected drain linear cond. factor
191  double tKc; // temperature corrected saturation cur. factor
192  double tSurfMob; // temperature corrected surface mobility
193  double tPhi; // temperature corrected Phi
194  double tVto; // temperature corrected Vto
195  double tSatCur; // temperature corrected saturation Cur.
196  double tSatCurDens; // temperature corrected saturation Cur. density
197  double tCbd; // temperature corrected B-D Capacitance
198  double tCbs; // temperature corrected B-S Capacitance
199  double tCj; // temperature corrected Bulk bottom Capacitance
200  double tCjsw; // temperature corrected Bulk side Capacitance
201  double tBulkPot; // temperature corrected Bulk potential
202  double tDepCap; // temperature adjusted transition point in
203  // the cureve matching Fc * Vj
204  double tVbi; // temperature adjusted Vbi
205 
206  double icVBS; // initial condition B-S voltage
207  double icVDS; // initial condition D-S voltage
208  double icVGS; // initial condition G-S voltage
209  double von;
210  double vdsat;
211  double sourceVcrit; // vcrit for pos. vds
212  double drainVcrit; // vcrit for neg. vds
213  double cd;
214  double cbs;
215  double cbd;
216  double gmbs;
217  double gm;
218  double gds;
219  double gbd;
220  double gbs;
221  double capbd;
222  double capbs;
223  double Cbd;
224  double Cbdsw;
225  double Cbs;
226  double Cbssw;
227  double f2d;
228  double f3d;
229  double f4d;
230  double f2s;
231  double f3s;
232  double f4s;
233  int mode; // device mode : 1 = normal, -1 = inverse
234  double mode_low;
235  double mode_high;
236 
237  bool limitedFlag; // for convergence testing.
238  bool IC_GIVEN;
239 
240  //end of 3f5 outtakes
241 
242  ////////////////////////////////////////////////////////////////////
243  // these are intermediate variables added to the instance class instead
244  // of leaving them to be calculated repeatedly in the load function
245 
246  // some caluclated quantities
248  double DrainSatCur;
249  double SourceSatCur;
253  double OxideCap;
254 
255  // Solution variables and intermediate quantities
256  // drain,source,gate, bulk, drainprime and sourceprime voltages
257  double Vd;
258  double Vs;
259  double Vg;
260  double Vb;
261  double Vdp;
262  double Vsp;
263  // voltage drops between pairs of nodes
264  double Vddp; // drain-drain'
265  double Vssp; // source-source'
266  double Vbsp; // bulk-source'
267  double Vbdp; // bulk-drain'
268  double Vgsp; // gate-source'
269  double Vgdp; // gate-drain'
270  double Vgb; //gate-bulk
271  double Vdpsp; //drop across channel
272 
273  // the gate-drain voltage drop isn't actually a state variable, but it
274  // is calculated at the same time and in the same manner as the state
275  // vars. So here we go, sticking it in the instance class.
276  double vgd;
277 
278  // Some stuff from mos6temp that were local vars but used elsewhere
279  double vt; // set in updateTemperature to CONSTKoverQ*temp
280 
281 
282  // the variables capgs, capgd and capgb are the raw output of
283  // qmeyer. They get massaged into total capacitances in
284  // updateIntermediateVars, and get used in updatePrimaryState to get
285  // charges on the capacitors.
286 
287  double Capgs; // total gate-source capacitance
288  double Capgd; // total gate-drain capacitance
289  double Capgb; // total gate-bulk capacitance
290 
291  // current through source and drain resistors
292  double Isource;
293  double Idrain;
294 
295  double cdrain; // the channel current shouldn't be a local variable in */
296  // updateIntermediateVars!
297 
298  // these are calculated in loadRHS and used in the jacobian load
299  double Gm,Gmbs; // we do this so we don't really need the xnrm/xrev vars
300  double revsum; // described in comments at the end of
301  double nrmsum; // updateIntermediateVars (uIVB in remaining comments)
302  double cdreq;
303 
304  // end of intermediate variables that aren't state variables
305  ////////////////////////////
306  // vector indices
307 
308  int li_Drain;
312  int li_Gate;
313  int li_Bulk;
314 
315  ////////////////////////////////////////////////////////////////////
316  // The following verbatim from Level=1, which has the same jacobian
317  // structure
318  ////////////////////////////////////////////////////////////////////
319  // Jacobian matrix indices:
320  // This is a 6x6 matrix block, of which 22 entries are nonzero:
321  //
322  // ---------------------------------------------------------
323  // | #NZ | | |
324  // | entries | | V_d V_g V_s V_b V_d' V_s' |
325  // ---------------------------------------------------------
326  // | 2 | KCL_d | a b |
327  // | 4 | KCL_g | c d e f |
328  // | 2 | KCL_s | g h |
329  // | 4 | KCL_b | i j k l |
330  // | 5 | KCL_d'| m n o p q |
331  // | 5 | KCL_s'| r s t u v |
332  // ---------------------------------------------------------
333  // 22 total
334 
335  ////////////////////////////////////////////////////////////////////
336  // Offset variables corresponding to the above declared indices.
337 
338  // Jacobian Matrix Offset:
339 
340  // V_d Row:
343 
344  // V_g Row:
349 
350  // V_s Row:
353 
354  // V_b Row:
359 
360  // V_d' Row:
366 
367  // V_s' Row:
373 
374 #ifndef Xyce_NONPOINTER_MATRIX_LOAD
375  // Jacobian Matrix Pointers:
376 
377  // F-vector pointers:
378  // V_d Row:
379  double * f_DrainEquDrainNodePtr; // a
381 
382  // V_g Row:
383  double * f_GateEquGateNodePtr; // c
384  double * f_GateEquBulkNodePtr; // d
387 
388  // V_s Row:
391 
392  // V_b Row:
393  double * f_BulkEquGateNodePtr; // i
394  double * f_BulkEquBulkNodePtr; // j
397 
398  // V_d' Row:
404 
405  // V_s' Row:
411 
412  // Q-vector pointers:
413  // V_d Row:
414  double * q_DrainEquDrainNodePtr; // a
416 
417  // V_g Row:
418  double * q_GateEquGateNodePtr; // c
419  double * q_GateEquBulkNodePtr; // d
422 
423  // V_s Row:
426 
427  // V_b Row:
428  double * q_BulkEquGateNodePtr; // i
429  double * q_BulkEquBulkNodePtr; // j
432 
433  // V_d' Row:
439 
440  // V_s' Row:
446 #endif
447 
448  ////////////////////////////////////////////////////////////////////
449  // 3f5 State Variables & related quantities:
450  // voltage drops
451  double vbd;
452  double vbs;
453  double vgs;
454  double vds;
455 
456  // "original" versions of various voltage drop variables:
457  double vgs_orig;
458  double vds_orig;
459  double vbs_orig;
460  double vbd_orig;
461  double vgd_orig;
462 
463  // "old" versions of various voltage drop variables:
464  double vgs_old;
465  double vds_old;
466  double vbs_old;
467  double vbd_old;
468  double vgd_old;
469 
470 
471  // meyer capacitances
472  //gate-source capacitor
473  double capgs; //value
474  double qgs; // charge
475  // gate-drain capacitor
476  double capgd; //value
477  double qgd; //charge
478  //gate-bulk capacitor
479  double capgb; //value
480  double qgb; //charge
481 
482  // diode capacitances
483  double qbd; // bulk-drain capacitor charge
484  double qbs; // bulk-source capacitor charge
485 
486  // indices into the state vector.
492 
493  // place in store vec for lead currents.
498 
502 
506 
509 
510  int blockHomotopyID; // For homotopy
511  double randomPerturb; // For homotopy
512 };
513 
514 
515 //-----------------------------------------------------------------------------
516 // Class : Model
517 // Purpose :
518 // Special Notes :
519 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
520 // Creation Date : 3/16/00
521 //-----------------------------------------------------------------------------
522 class Model : public DeviceModel
523 {
524  typedef std::vector<Instance *> InstanceVector;
525 
526  friend class ParametricData<Model>;
527  friend class Instance;
528  friend class Traits;friend class Master;
529 
530 public:
531  Model(
532  const Configuration & configuration,
533  const ModelBlock & MB,
534  const FactoryBlock & factory_block);
535  ~Model();
536 
537 private:
538  Model();
539  Model(const Model &);
540  Model &operator=(const Model &);
541 
542 public:
543  virtual void forEachInstance(DeviceInstanceOp &op) const /* override */;
544 
545  virtual std::ostream &printOutInstances(std::ostream &os) const;
546 
547  bool processParams ();
548  bool processInstanceParams ();
549 
550 
551 public:
552  void addInstance(Instance *instance)
553  {
554  instanceContainer.push_back(instance);
555  }
556 
558  {
559  return instanceContainer;
560  }
561 
563  {
564  return instanceContainer;
565  }
566 
567 private:
568  std::vector<Instance*> instanceContainer;
569 
570 private:
571 
572  int dtype; // device type : 1 = nmos, -1 = pmos
573  double tnom; // temperature at which parameters measured
574  double latDiff;
575  double jctSatCurDensity; // input - use tSatCurDens
576  double jctSatCur; // input - use tSatCur instead
580 
581  double kv; // input - use tKv
582  double nv; // drain linear conductance factor
583  double kc; // input - use tKc
584  double nc; // saturation current coeff.
585  double nvth; // threshold voltage coeff.
586  double ps; // saturation current modification parameter
587 
592  double vt0; // input - use tVto
593  double capBD; // input - use tCbs
594  double capBS; // input - use tCbd
595  double bulkCapFactor; // input - use tCj
596  double sideWallCapFactor; // input - use tCjsw
597  double bulkJctPotential; // input - use tBulkPot
601  double phi; // input - use tPhi
602  double gamma;
603 
604  double gamma1; /* secondary back-gate effect parametr */
605  double sigma;
606  double lambda;
607  double lambda0;
608  double lambda1;
609 
611  int gateType;
614  double surfaceMobility; // input - use tSurfMob
616 
617  bool lambdaGiven ;
620 
621  bool capBDGiven ;
622  bool capBSGiven ;
625 
626  // These variables were used as temporaries in mos6temp, but since
627  // the calculations in mos6temp are split between the model block
628  // constructor and the function updateTemperature, we need them to be
629  // model variables.
630 
631  double fact1;
632  double vtnom;
633  double egfet1;
634  double pbfact1;
635 };
636 
637 
638 //-----------------------------------------------------------------------------
639 // Class : Master
640 // Purpose :
641 // Special Notes :
642 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
643 // Creation Date : 11/26/08
644 //-----------------------------------------------------------------------------
645 class Master : public DeviceMaster<Traits>
646 {
647  friend class Instance;
648  friend class Model;
649 
650 public:
652  const Configuration & configuration,
653  const FactoryBlock & factory_block,
654  const SolverState & ss1,
655  const DeviceOptions & do1)
656  : DeviceMaster<Traits>(configuration, factory_block, ss1, do1)
657  {}
658 
659  virtual bool updateState (double * solVec, double * staVec, double * stoVec);
660 
661  // new DAE stuff:
662  // new DAE load functions, residual:
663  virtual bool loadDAEVectors (double * solVec, double * fVec, double * qVec, double * storeLeadF, double * storeLeadQ);
664 
665  // new DAE load functions, Jacobian:
666  virtual bool loadDAEMatrices (N_LAS_Matrix & dFdx, N_LAS_Matrix & dQdx);
667 };
668 
669 void registerDevice();
670 
671 } // namespace MOSFET6
672 } // namespace Device
673 } // namespace Xyce
674 
678 
679 #endif