Xyce  6.1
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-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_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.57.2.1 $
41 //
42 // Revision Date : $Date: 2015/04/02 18:20:11 $
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 int numNodes() {return 4;}
71  static bool modelRequired() {return true;}
72  static 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  void loadNodeSymbols(Util::SymbolTable &symbol_table) const; // override
113 
114  const std::vector< std::vector<int> > & jacobianStamp() const;
115  void registerJacLIDs( const std::vector< std::vector<int> > & jacLIDVec );
116 
117  bool processParams ();
118 
119  bool updateTemperature(const double & temp_tmp);
120  bool updateIntermediateVars ();
121  bool updatePrimaryState ();
122 
123  int getNumNoiseSources () const;
124  void setupNoiseSources (Xyce::Analysis::NoiseData & noiseData);
125  void getNoiseSources (Xyce::Analysis::NoiseData & noiseData);
126 
127  // load functions, residual:
128  bool loadDAEQVector ();
129  bool loadDAEFVector ();
130 
131  // load functions, Jacobian:
132  bool loadDAEdQdx ();
133  bool loadDAEdFdx ();
134 
135  void setupPointers();
136 
137  // Additional Public Declarations
138  bool isConverged();
139 
140 public:
141  // Getters and setters
143  {
144  return model_;
145  }
146 
147 private:
148  static std::vector< std::vector<int> > jacStamp_DC_SC;
149  static std::vector< std::vector<int> > jacStamp_DC;
150  static std::vector< std::vector<int> > jacStamp_SC;
151  static std::vector< std::vector<int> > jacStamp;
152 
153  static std::vector<int> jacMap_DC_SC;
154  static std::vector<int> jacMap_DC;
155  static std::vector<int> jacMap_SC;
156  static std::vector<int> jacMap;
157 
158  static std::vector< std::vector<int> > jacMap2_DC_SC;
159  static std::vector< std::vector<int> > jacMap2_DC;
160  static std::vector< std::vector<int> > jacMap2_SC;
161  static std::vector< std::vector<int> > jacMap2;
162 
163 
164  Model & model_; //< Owning model
165 
166  // instance variables ripped -- bleeding and without anesthetic -- from
167  // 3f5, with obvious modifications to names (remove MOS6 prefix)
168  int states; // index into state table for this device
169  int dNode; // number of the gate node of the mosfet
170  int gNode; // number of the gate node of the mosfet
171  int sNode; // number of the source node of the mosfet
172  int bNode; // number of the bulk node of the mosfet
173  int dNodePrime; // number of the internal drain node of the mosfet
174  int sNodePrime; // number of the internal source node of the mosfet
175 
176 
177  bool OFF; // device initialized OFF (vbs=vgs=vds=0)
178 
179  double l; // the length of the channel region
180  double w; // the width of the channel region
181  double drainArea; // the area of the drain diffusion
182  double sourceArea; // the area of the source diffusion
183  double drainSquares; // the length of the drain in squares
184  double sourceSquares; // the length of the source in squares
187  double sourceConductance; //conductance of source(or 0):set in setup
188  double drainConductance; //conductance of drain(or 0):set in setup
189  double temp; // operating temperature of this instance
190  double numberParallel; // number simulated parallel mosfets
191 
192  double tKv; // temperature corrected drain linear cond. factor
193  double tKc; // temperature corrected saturation cur. factor
194  double tSurfMob; // temperature corrected surface mobility
195  double tPhi; // temperature corrected Phi
196  double tVto; // temperature corrected Vto
197  double tSatCur; // temperature corrected saturation Cur.
198  double tSatCurDens; // temperature corrected saturation Cur. density
199  double tCbd; // temperature corrected B-D Capacitance
200  double tCbs; // temperature corrected B-S Capacitance
201  double tCj; // temperature corrected Bulk bottom Capacitance
202  double tCjsw; // temperature corrected Bulk side Capacitance
203  double tBulkPot; // temperature corrected Bulk potential
204  double tDepCap; // temperature adjusted transition point in
205  // the cureve matching Fc * Vj
206  double tVbi; // temperature adjusted Vbi
207 
208  double icVBS; // initial condition B-S voltage
209  double icVDS; // initial condition D-S voltage
210  double icVGS; // initial condition G-S voltage
211  double von;
212  double vdsat;
213  double sourceVcrit; // vcrit for pos. vds
214  double drainVcrit; // vcrit for neg. vds
215  double cd;
216  double cbs;
217  double cbd;
218  double gmbs;
219  double gm;
220  double gds;
221  double gbd;
222  double gbs;
223  double capbd;
224  double capbs;
225  double Cbd;
226  double Cbdsw;
227  double Cbs;
228  double Cbssw;
229  double f2d;
230  double f3d;
231  double f4d;
232  double f2s;
233  double f3s;
234  double f4s;
235  int mode; // device mode : 1 = normal, -1 = inverse
236  double mode_low;
237  double mode_high;
238 
239  bool limitedFlag; // for convergence testing.
240  bool IC_GIVEN;
241 
242  //end of 3f5 outtakes
243 
244  ////////////////////////////////////////////////////////////////////
245  // these are intermediate variables added to the instance class instead
246  // of leaving them to be calculated repeatedly in the load function
247 
248  // some caluclated quantities
250  double DrainSatCur;
251  double SourceSatCur;
255  double OxideCap;
256 
257  // Solution variables and intermediate quantities
258  // drain,source,gate, bulk, drainprime and sourceprime voltages
259  double Vd;
260  double Vs;
261  double Vg;
262  double Vb;
263  double Vdp;
264  double Vsp;
265  // voltage drops between pairs of nodes
266  double Vddp; // drain-drain'
267  double Vssp; // source-source'
268  double Vbsp; // bulk-source'
269  double Vbdp; // bulk-drain'
270  double Vgsp; // gate-source'
271  double Vgdp; // gate-drain'
272  double Vgb; //gate-bulk
273  double Vdpsp; //drop across channel
274 
275  // the gate-drain voltage drop isn't actually a state variable, but it
276  // is calculated at the same time and in the same manner as the state
277  // vars. So here we go, sticking it in the instance class.
278  double vgd;
279 
280  // Some stuff from mos6temp that were local vars but used elsewhere
281  double vt; // set in updateTemperature to CONSTKoverQ*temp
282 
283 
284  // the variables capgs, capgd and capgb are the raw output of
285  // qmeyer. They get massaged into total capacitances in
286  // updateIntermediateVars, and get used in updatePrimaryState to get
287  // charges on the capacitors.
288 
289  double Capgs; // total gate-source capacitance
290  double Capgd; // total gate-drain capacitance
291  double Capgb; // total gate-bulk capacitance
292 
293  // current through source and drain resistors
294  double Isource;
295  double Idrain;
296 
297  double cdrain; // the channel current shouldn't be a local variable in */
298  // updateIntermediateVars!
299 
300  // these are calculated in loadRHS and used in the jacobian load
301  double Gm,Gmbs; // we do this so we don't really need the xnrm/xrev vars
302  double revsum; // described in comments at the end of
303  double nrmsum; // updateIntermediateVars (uIVB in remaining comments)
304  double cdreq;
305 
306  // end of intermediate variables that aren't state variables
307  ////////////////////////////
308  // vector indices
309 
310  int li_Drain;
314  int li_Gate;
315  int li_Bulk;
316 
317  ////////////////////////////////////////////////////////////////////
318  // The following verbatim from Level=1, which has the same jacobian
319  // structure
320  ////////////////////////////////////////////////////////////////////
321  // Jacobian matrix indices:
322  // This is a 6x6 matrix block, of which 22 entries are nonzero:
323  //
324  // ---------------------------------------------------------
325  // | #NZ | | |
326  // | entries | | V_d V_g V_s V_b V_d' V_s' |
327  // ---------------------------------------------------------
328  // | 2 | KCL_d | a b |
329  // | 4 | KCL_g | c d e f |
330  // | 2 | KCL_s | g h |
331  // | 4 | KCL_b | i j k l |
332  // | 5 | KCL_d'| m n o p q |
333  // | 5 | KCL_s'| r s t u v |
334  // ---------------------------------------------------------
335  // 22 total
336 
337  ////////////////////////////////////////////////////////////////////
338  // Offset variables corresponding to the above declared indices.
339 
340  // Jacobian Matrix Offset:
341 
342  // V_d Row:
345 
346  // V_g Row:
351 
352  // V_s Row:
355 
356  // V_b Row:
361 
362  // V_d' Row:
368 
369  // V_s' Row:
375 
376 #ifndef Xyce_NONPOINTER_MATRIX_LOAD
377  // Jacobian Matrix Pointers:
378 
379  // F-vector pointers:
380  // V_d Row:
381  double * f_DrainEquDrainNodePtr; // a
383 
384  // V_g Row:
385  double * f_GateEquGateNodePtr; // c
386  double * f_GateEquBulkNodePtr; // d
389 
390  // V_s Row:
393 
394  // V_b Row:
395  double * f_BulkEquGateNodePtr; // i
396  double * f_BulkEquBulkNodePtr; // j
399 
400  // V_d' Row:
406 
407  // V_s' Row:
413 
414  // Q-vector pointers:
415  // V_d Row:
416  double * q_DrainEquDrainNodePtr; // a
418 
419  // V_g Row:
420  double * q_GateEquGateNodePtr; // c
421  double * q_GateEquBulkNodePtr; // d
424 
425  // V_s Row:
428 
429  // V_b Row:
430  double * q_BulkEquGateNodePtr; // i
431  double * q_BulkEquBulkNodePtr; // j
434 
435  // V_d' Row:
441 
442  // V_s' Row:
448 #endif
449 
450  ////////////////////////////////////////////////////////////////////
451  // 3f5 State Variables & related quantities:
452  // voltage drops
453  double vbd;
454  double vbs;
455  double vgs;
456  double vds;
457 
458  // "original" versions of various voltage drop variables:
459  double vgs_orig;
460  double vds_orig;
461  double vbs_orig;
462  double vbd_orig;
463  double vgd_orig;
464 
465  // "old" versions of various voltage drop variables:
466  double vgs_old;
467  double vds_old;
468  double vbs_old;
469  double vbd_old;
470  double vgd_old;
471 
472 
473  // meyer capacitances
474  //gate-source capacitor
475  double capgs; //value
476  double qgs; // charge
477  // gate-drain capacitor
478  double capgd; //value
479  double qgd; //charge
480  //gate-bulk capacitor
481  double capgb; //value
482  double qgb; //charge
483 
484  // diode capacitances
485  double qbd; // bulk-drain capacitor charge
486  double qbs; // bulk-source capacitor charge
487 
488  // indices into the state vector.
494 
495  // place in store vec for lead currents.
500 
504 
508 
511 
512  int blockHomotopyID; // For homotopy
513  double randomPerturb; // For homotopy
514 };
515 
516 
517 //-----------------------------------------------------------------------------
518 // Class : Model
519 // Purpose :
520 // Special Notes :
521 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
522 // Creation Date : 3/16/00
523 //-----------------------------------------------------------------------------
524 class Model : public DeviceModel
525 {
526  typedef std::vector<Instance *> InstanceVector;
527 
528  friend class ParametricData<Model>;
529  friend class Instance;
530  friend class Traits;friend class Master;
531 
532 public:
533  Model(
534  const Configuration & configuration,
535  const ModelBlock & MB,
536  const FactoryBlock & factory_block);
537  ~Model();
538 
539 private:
540  Model();
541  Model(const Model &);
542  Model &operator=(const Model &);
543 
544 public:
545  virtual void forEachInstance(DeviceInstanceOp &op) const /* override */;
546 
547  virtual std::ostream &printOutInstances(std::ostream &os) const;
548 
549  bool processParams ();
550  bool processInstanceParams ();
551 
552 
553 public:
554  void addInstance(Instance *instance)
555  {
556  instanceContainer.push_back(instance);
557  }
558 
559 private:
560  std::vector<Instance*> instanceContainer;
561 
562 private:
563 
564  int dtype; // device type : 1 = nmos, -1 = pmos
565  double tnom; // temperature at which parameters measured
566  double latDiff;
567  double jctSatCurDensity; // input - use tSatCurDens
568  double jctSatCur; // input - use tSatCur instead
572 
573  double kv; // input - use tKv
574  double nv; // drain linear conductance factor
575  double kc; // input - use tKc
576  double nc; // saturation current coeff.
577  double nvth; // threshold voltage coeff.
578  double ps; // saturation current modification parameter
579 
584  double vt0; // input - use tVto
585  double capBD; // input - use tCbs
586  double capBS; // input - use tCbd
587  double bulkCapFactor; // input - use tCj
588  double sideWallCapFactor; // input - use tCjsw
589  double bulkJctPotential; // input - use tBulkPot
593  double phi; // input - use tPhi
594  double gamma;
595 
596  double gamma1; /* secondary back-gate effect parametr */
597  double sigma;
598  double lambda;
599  double lambda0;
600  double lambda1;
601 
603  int gateType;
606  double surfaceMobility; // input - use tSurfMob
608 
609  double fNcoef;
610  double fNexp;
611 
612  bool lambdaGiven ;
615 
616  bool capBDGiven ;
617  bool capBSGiven ;
620 
621  // These variables were used as temporaries in mos6temp, but since
622  // the calculations in mos6temp are split between the model block
623  // constructor and the function updateTemperature, we need them to be
624  // model variables.
625 
626  double fact1;
627  double vtnom;
628  double egfet1;
629  double pbfact1;
630 };
631 
632 
633 //-----------------------------------------------------------------------------
634 // Class : Master
635 // Purpose :
636 // Special Notes :
637 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
638 // Creation Date : 11/26/08
639 //-----------------------------------------------------------------------------
640 class Master : public DeviceMaster<Traits>
641 {
642  friend class Instance;
643  friend class Model;
644 
645 public:
647  const Configuration & configuration,
648  const FactoryBlock & factory_block,
649  const SolverState & ss1,
650  const DeviceOptions & do1)
651  : DeviceMaster<Traits>(configuration, factory_block, ss1, do1)
652  {}
653 
654  virtual bool updateState (double * solVec, double * staVec, double * stoVec);
655 
656  // new DAE stuff:
657  // new DAE load functions, residual:
658  virtual bool loadDAEVectors (double * solVec, double * fVec, double * qVec, double * bVec, double * storeLeadF, double * storeLeadQ, double * leadF, double * leadQ, double * junctionV);
659 
660  // new DAE load functions, Jacobian:
661  virtual bool loadDAEMatrices (Linear::Matrix & dFdx, Linear::Matrix & dQdx);
662 };
663 
664 void registerDevice();
665 
666 } // namespace MOSFET6
667 } // namespace Device
668 } // namespace Xyce
669 
670 #endif
void addInstance(Instance *instance)
static void loadInstanceParameters(ParametricData< Instance > &instance_parameters)
Definition: N_DEV_MOSFET6.C:74
static std::vector< int > jacMap_DC_SC
bool processParams()
processParams
void getNoiseSources(Xyce::Analysis::NoiseData &noiseData)
const std::vector< std::vector< int > > & jacobianStamp() const
void registerLIDs(const std::vector< int > &intLIDVecRef, const std::vector< int > &extLIDVecRef)
Pure virtual class to augment a linear system.
std::vector< Instance * > InstanceVector
Master(const Configuration &configuration, const FactoryBlock &factory_block, const SolverState &ss1, const DeviceOptions &do1)
static std::vector< int > jacMap_SC
virtual std::ostream & printOutInstances(std::ostream &os) const
static std::vector< std::vector< int > > jacStamp_SC
static std::vector< std::vector< int > > jacStamp_DC_SC
virtual void forEachInstance(DeviceInstanceOp &op) const
Apply a device instance "op" to all instances associated with this model.
static std::vector< int > jacMap_DC
bool processInstanceParams()
processInstanceParams
bool updateTemperature(const double &temp_tmp)
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.
void registerStateLIDs(const std::vector< int > &staLIDVecRef)
Instance(const Configuration &configuration, const InstanceBlock &IB, Model &Miter, const FactoryBlock &factory_block)
Instance & operator=(const Instance &)
Model & operator=(const Model &)
void setupNoiseSources(Xyce::Analysis::NoiseData &noiseData)
DeviceMaster instantiates a device as described by the device traits T.
The FactoryBlock contains parameters needed by the device, instance and model creation functions...
static const char * deviceTypeName()
Definition: N_DEV_MOSFET6.h:69
static const char * name()
Definition: N_DEV_MOSFET6.h:68
std::vector< Instance * > instanceContainer
static Device * factory(const Configuration &configuration, const FactoryBlock &factory_block)
static std::vector< std::vector< int > > jacMap2_SC
The Device class is an interface for device implementations.
Definition: N_DEV_Device.h:101
static std::vector< std::vector< int > > jacMap2_DC_SC
static std::vector< std::vector< int > > jacStamp_DC
Class Configuration contains device configuration data.
static std::vector< std::vector< int > > jacMap2
void registerJacLIDs(const std::vector< std::vector< int > > &jacLIDVec)
void loadNodeSymbols(Util::SymbolTable &symbol_table) const
Populates and returns the store name map.
virtual bool loadDAEMatrices(Linear::Matrix &dFdx, Linear::Matrix &dQdx)
Populates the device's Jacobian object with these pointers.
static std::vector< std::vector< int > > jacStamp
static std::vector< std::vector< int > > jacMap2_DC
static void loadModelParameters(ParametricData< Model > &model_parameters)
ModelBlock represents a .MODEL line from the netlist.
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 updateState(double *solVec, double *staVec, double *stoVec)
Updates the devices state information.
void registerStoreLIDs(const std::vector< int > &stoLIDVecRef)
static std::vector< int > jacMap