1 /**********
2 Copyright 1991 Regents of the University of California. All rights reserved.
3 Authors: 1987 Karti Mayaram, 1991 David Gates
4 **********/
5 
6 #ifndef NUMOS_H
7 #define NUMOS_H
8 
9 /* data structures used to describe 2D Numerical MOSFETs */
10 
11 /* circuit level includes */
12 #include "ngspice/ifsim.h"
13 #include "ngspice/cktdefs.h"
14 #include "ngspice/gendefs.h"
15 
16 /* device level includes */
17 #include "ngspice/twomesh.h"
18 #include "ngspice/twodev.h"
19 #include "ngspice/profile.h"
20 #include "ngspice/numglobs.h"
21 #include "ngspice/carddefs.h"
22 
23 /* information needed per instance */
24 typedef struct sNUMOSinstance {
25 
26   struct GENinstance gen;
27 
28 #define NUMOSmodPtr(inst) ((struct sNUMOSmodel *)((inst)->gen.GENmodPtr))
29 #define NUMOSnextInstance(inst) ((struct sNUMOSinstance *)((inst)->gen.GENnextInstance))
30 #define NUMOSname gen.GENname
31 #define NUMOSstate gen.GENstate
32 
33 #define NUMOSvdb NUMOSstate
34 #define NUMOSvsb NUMOSstate+1
35 #define NUMOSvgb NUMOSstate+2
36 #define NUMOSid  NUMOSstate+3
37 #define NUMOSis  NUMOSstate+4
38 #define NUMOSig  NUMOSstate+5
39 #define NUMOSdIdDVdb NUMOSstate+6
40 #define NUMOSdIdDVsb NUMOSstate+7
41 #define NUMOSdIdDVgb NUMOSstate+8
42 #define NUMOSdIsDVdb NUMOSstate+9
43 #define NUMOSdIsDVsb NUMOSstate+10
44 #define NUMOSdIsDVgb NUMOSstate+11
45 #define NUMOSdIgDVdb NUMOSstate+12
46 #define NUMOSdIgDVsb NUMOSstate+13
47 #define NUMOSdIgDVgb NUMOSstate+14
48 #define NUMOSnumStates 15
49 
50   const int NUMOSdrainNode;	/* number of drain node of MOSFET */
51   const int NUMOSgateNode;	/* number of gate node of MOSFET */
52   const int NUMOSsourceNode;	/* number of source node of MOSFET */
53   const int NUMOSbulkNode;	/* number of bulk node of MOSFET */
54   double NUMOSarea;		/* area factor for the mosfet */
55   double NUMOSwidth;		/* width factor for the mosfet */
56   double NUMOSlength;		/* length factor for the mosfet */
57   TWOdevice *NUMOSpDevice;
58   int NUMOStype;
59   double NUMOStemp;		/* Instance Temperature */
60   double NUMOSc11;		/* small-signal capacitance */
61   double NUMOSy11r;		/* small-signal admittance, real part */
62   double NUMOSy11i;		/* small-signal admittance, imag part */
63   double NUMOSc12;		/* small-signal capacitance */
64   double NUMOSy12r;		/* small-signal admittance, real part */
65   double NUMOSy12i;		/* small-signal admittance, imag part */
66   double NUMOSc13;		/* small-signal capacitance */
67   double NUMOSy13r;		/* small-signal admittance, real part */
68   double NUMOSy13i;		/* small-signal admittance, imag part */
69   double NUMOSc21;		/* small-signal capacitance */
70   double NUMOSy21r;		/* small-signal admittance, real part */
71   double NUMOSy21i;		/* small-signal admittance, imag part */
72   double NUMOSc22;		/* small-signal capacitance */
73   double NUMOSy22r;		/* small-signal admittance, real part */
74   double NUMOSy22i;		/* small-signal admittance, imag part */
75   double NUMOSc23;		/* small-signal capacitance */
76   double NUMOSy23r;		/* small-signal admittance, real part */
77   double NUMOSy23i;		/* small-signal admittance, imag part */
78   double NUMOSc31;		/* small-signal capacitance */
79   double NUMOSy31r;		/* small-signal admittance, real part */
80   double NUMOSy31i;		/* small-signal admittance, imag part */
81   double NUMOSc32;		/* small-signal capacitance */
82   double NUMOSy32r;		/* small-signal admittance, real part */
83   double NUMOSy32i;		/* small-signal admittance, imag part */
84   double NUMOSc33;		/* small-signal capacitance */
85   double NUMOSy33r;		/* small-signal admittance, real part */
86   double NUMOSy33i;		/* small-signal admittance, imag part */
87   GLOBvalues NUMOSglobals;	/* Temp.-Dep. Global Parameters */
88   int NUMOSprint;		/* print timepoints */
89   char *NUMOSicFile;            /* Name of initial condition file */
90   double *NUMOSdrainDrainPtr;	/* pointer to sparse matrix at (drain,drain) */
91   double *NUMOSdrainSourcePtr;	/* pointer to sparse matrix at (drain,source) */
92   double *NUMOSdrainGatePtr;	/* pointer to sparse matrix at (drain,gate) */
93   double *NUMOSdrainBulkPtr;	/* pointer to sparse matrix at (drain,bulk) */
94   double *NUMOSsourceDrainPtr;	/* pointer to sparse matrix at (source,drain) */
95   double *NUMOSsourceSourcePtr;	/* pointer to sparse matrix at
96 				 * (source,source) */
97   double *NUMOSsourceGatePtr;	/* pointer to sparse matrix at (source,gate) */
98   double *NUMOSsourceBulkPtr;	/* pointer to sparse matrix at (source,bulk) */
99   double *NUMOSgateDrainPtr;	/* pointer to sparse matrix at (gate,drain) */
100   double *NUMOSgateSourcePtr;	/* pointer to sparse matrix at (gate,source) */
101   double *NUMOSgateGatePtr;	/* pointer to sparse matrix at (gate,gate) */
102   double *NUMOSgateBulkPtr;	/* pointer to sparse matrix at (gate,bulk) */
103   double *NUMOSbulkDrainPtr;	/* pointer to sparse matrix at (bulk,drain) */
104   double *NUMOSbulkSourcePtr;	/* pointer to sparse matrix at (bulk,source) */
105   double *NUMOSbulkGatePtr;	/* pointer to sparse matrix at (bulk,gate) */
106   double *NUMOSbulkBulkPtr;	/* pointer to sparse matrix at (bulk,bulk) */
107 
108   int NUMOSoff;			/* 'off' flag for mosfet */
109   unsigned NUMOSsmSigAvail:1;	/* flag to indicate small-signal done */
110   unsigned NUMOSareaGiven:1;	/* flag to indicate area was specified */
111   unsigned NUMOSwidthGiven:1;	/* flag to indicate width was specified */
112   unsigned NUMOSlengthGiven:1;	/* flag to indicate length was specified */
113   unsigned NUMOSicFileGiven:1;	/* flag to indicate init. cond. file given */
114   unsigned NUMOSprintGiven:1;	/* flag to indicate print was given */
115   unsigned NUMOStempGiven:1;	/* flag to indicate temp was given */
116 } NUMOSinstance;
117 
118 /* per model data */
119 typedef struct sNUMOSmodel {	/* model structure for a numerical device */
120 
121   struct GENmodel gen;
122 
123 #define NUMOSmodType gen.GENmodType
124 #define NUMOSnextModel(inst) ((struct sNUMOSmodel *)((inst)->gen.GENnextModel))
125 #define NUMOSinstances(inst) ((NUMOSinstance *)((inst)->gen.GENinstances))
126 #define NUMOSmodName gen.GENmodName
127 
128   MESHcard *NUMOSxMeshes;	/* list of xmesh cards */
129   MESHcard *NUMOSyMeshes;	/* list of ymesh cards */
130   DOMNcard *NUMOSdomains;	/* list of domain cards */
131   BDRYcard *NUMOSboundaries;	/* list of boundary cards */
132   DOPcard *NUMOSdopings;	/* list of doping cards */
133   ELCTcard *NUMOSelectrodes;	/* list of electrode cards */
134   CONTcard *NUMOScontacts;	/* list of contact cards */
135   MODLcard *NUMOSmodels;	/* list of model cards */
136   MATLcard *NUMOSmaterials;	/* list of material cards */
137   MOBcard *NUMOSmobility;	/* list of mobility cards */
138   METHcard *NUMOSmethods;	/* list of method cards */
139   OPTNcard *NUMOSoptions;	/* list of option cards */
140   OUTPcard *NUMOSoutputs;	/* list of output cards */
141   TWOtranInfo *NUMOSpInfo;	/* transient analysis information */
142   DOPprofile *NUMOSprofiles;	/* expanded list of doping profiles */
143   DOPtable *NUMOSdopTables;	/* list of tables used by profiles */
144   TWOmaterial *NUMOSmatlInfo;	/* list of material info structures */
145 } NUMOSmodel;
146 
147 /* type of 2D MOSFET */
148 #define N_CH 1
149 #define P_CH -1
150 
151 /* device parameters */
152 #define NUMOS_AREA 1
153 #define NUMOS_WIDTH 2
154 #define NUMOS_LENGTH 3
155 #define NUMOS_OFF 4
156 #define NUMOS_IC_FILE 5
157 #define NUMOS_PRINT 9
158 #define NUMOS_TEMP 10
159 
160 #define NUMOS_G11 11
161 #define NUMOS_C11 12
162 #define NUMOS_Y11 13
163 #define NUMOS_G12 14
164 #define NUMOS_C12 15
165 #define NUMOS_Y12 16
166 #define NUMOS_G13 17
167 #define NUMOS_C13 18
168 #define NUMOS_Y13 19
169 #define NUMOS_G14 20
170 #define NUMOS_C14 21
171 #define NUMOS_Y14 22
172 #define NUMOS_G21 23
173 #define NUMOS_C21 24
174 #define NUMOS_Y21 25
175 #define NUMOS_G22 26
176 #define NUMOS_C22 27
177 #define NUMOS_Y22 28
178 #define NUMOS_G23 29
179 #define NUMOS_C23 30
180 #define NUMOS_Y23 31
181 #define NUMOS_G24 32
182 #define NUMOS_C24 33
183 #define NUMOS_Y24 34
184 #define NUMOS_G31 35
185 #define NUMOS_C31 36
186 #define NUMOS_Y31 37
187 #define NUMOS_G32 38
188 #define NUMOS_C32 39
189 #define NUMOS_Y32 40
190 #define NUMOS_G33 41
191 #define NUMOS_C33 42
192 #define NUMOS_Y33 43
193 #define NUMOS_G34 44
194 #define NUMOS_C34 45
195 #define NUMOS_Y34 46
196 #define NUMOS_G41 47
197 #define NUMOS_C41 48
198 #define NUMOS_Y41 49
199 #define NUMOS_G42 50
200 #define NUMOS_C42 51
201 #define NUMOS_Y42 52
202 #define NUMOS_G43 53
203 #define NUMOS_C43 54
204 #define NUMOS_Y43 55
205 #define NUMOS_G44 56
206 #define NUMOS_C44 57
207 #define NUMOS_Y44 58
208 
209 /* model parameters */
210 /* NOTE: all true model parameters have been moved to IFcardInfo structures */
211 #define NUMOS_MOD_NUMOS 1
212 
213 /* device questions */
214 
215 /* model questions */
216 
217 #include "numosext.h"
218 
219 #endif				/* NUMOS_H */
220