1 /* 2 * project.h 3 * 4 * Timing Simulator (ESWEC) 5 * 6 * Date: October 5, 1990 7 * 8 * Author: Shen Lin 9 * 10 * Copyright (C) University of California, Berkeley 11 * 12 */ 13 #ifndef ngspice_SWEC_H 14 #define ngspice_SWEC_H 15 16 /************************************************************ 17 * 18 * Defines 19 * 20 ************************************************************/ 21 22 #define MainTitle " Timing Simulator\n" 23 #define MAXDEVICE 4 24 #define MAXMOS 31500 /* suggested value */ 25 #define MAXDD 256 /* suggested value */ 26 #define MAXVCCS 128 /* suggested value */ 27 #define MAXTIME 1000000 28 #define MAXNODE 136 29 30 #define TAB_SIZE 8192 /* originally 2048 */ 31 #define NUM_STEPS_PER_MICRON 10 /* 0.1 micron is the smallest step */ 32 #define MAX_FET_SIZE 80 /* largest fet in microns */ 33 #define Vol_Step 1.0e-3 /* voltage resolution */ 34 #define SCL 1000.0 /* voltage scaler (1V/3mv) */ 35 #define MAX_CP_TX_LINES 8 /* max number of coupled lines in 36 a multiconductor line system */ 37 38 /************************************************************ 39 * 40 * Macro 41 * 42 ************************************************************/ 43 #ifndef MAX 44 #define MAX(x, y) ((x) > (y) ? (x) : (y)) 45 #endif 46 #ifndef MIN 47 #define MIN(x, y) ((x) < (y) ? (x) : (y)) 48 #endif 49 #ifndef ABS 50 #define ABS(x) ((x) >= 0 ? (x) : (-(x))) 51 #endif 52 53 /************************************************************ 54 * 55 * Data Structure Definitions 56 * 57 ************************************************************/ 58 59 typedef struct reglist REGLIST; 60 typedef struct node NODE; 61 typedef struct mosfet MOSFET; 62 typedef struct emosfet EMOSFET; 63 typedef struct diode DIODE; 64 typedef struct ediode EDIODE; 65 typedef struct vccs VCCS; 66 typedef struct evccs EVCCS; 67 typedef struct i_cap I_CAP; 68 typedef struct ei_cap EI_CAP; 69 typedef struct resistor RESISTOR; 70 typedef struct eresistor ERESISTOR; 71 typedef struct rline RLINE; 72 typedef struct erline ERLINE; 73 typedef struct txline TXLine; 74 typedef struct etxline ETXLine; 75 typedef struct cpline CPLine; 76 typedef struct ecpline ECPLine; 77 typedef struct bqueue BQUEUE; 78 typedef struct pqueue PQUEUE; 79 typedef struct ms_device MS_DEVICE; 80 typedef struct bp_device BP_DEVICE; 81 typedef struct dd_device DD_DEVICE; 82 83 struct mosfet{ 84 int type; /* 1 : NMOS, 2 : PMOS */ 85 MS_DEVICE *device; /* NULL if the nominal device model */ 86 NODE *out_node; 87 NODE *in_node; 88 float Cs, Cd; 89 MOSFET *nx; 90 int time; /* instantaneous information */ 91 float voltage, dvg; /* instantaneous information */ 92 float vgN_1; /* gate voltage at previous event point */ 93 float G; /* effective conductance at t(n) */ 94 float effective; /* W over effective L */ 95 int tabW; /* width in ns/um */ 96 REGLIST *region; /* region associated with this mos */ 97 /* NULL if driven by the node of the same region */ 98 }; 99 100 struct diode{ 101 float Is; /* saturation current */ 102 float Vj; /* junction potential */ 103 double G; 104 NODE *in_node; 105 NODE *out_node; 106 DIODE *nx; 107 }; 108 109 struct vccs{ 110 float Is; /* saturation current */ 111 NODE *in_node; 112 NODE *out_node; 113 NODE *pcv_node; 114 NODE *ncv_node; 115 DIODE *nx; 116 }; 117 118 typedef struct { 119 char name[10]; /* device name */ 120 int type; /* 1 : NMOS, 2 : PMOS */ 121 int device_id; /* device id */ 122 } DEVICENAME; 123 124 struct ms_device{ 125 char name[10]; 126 int used; /* device used in circuit flag */ 127 float rho; /* device vsat denom param */ 128 float alpha; /* device vsat denom vgg param */ 129 float vt; /* device zero bias threshold voltage in mv*/ 130 float gamma; /* device backgate bias vt param */ 131 float fermi; /* device fermi potential in mv */ 132 float theta; /* device backgate bias vt width param */ 133 float mu; /* device vt width param */ 134 float eta; /* device saturation slope */ 135 float eta5; /* eta - 0.5 */ 136 int pzld; /* positive lambda */ 137 float lambda; /* channel-length modulation */ 138 float kp; /* device conductance parameter */ 139 float cgs0; /* gate-source overlap capacitance 140 per meter channel width */ 141 float cgd0; /* gate-drain overlap capacitance 142 per meter channel width */ 143 float cox; /* oxide-field capacitance 144 per square meter of gate area */ 145 float cjsw; /* zero-biased junction sidewall capacitace 146 per meter of junction perimeter */ 147 float cj0; /* zero-biased junction bottom capacitace 148 per square meter of junction area */ 149 float keq; /* abrupt junction parameter */ 150 151 float ld; /* lateral diffusion */ 152 float *thresh; 153 float *sat; 154 float *dsat; 155 float *body; 156 float *gammod; 157 }; 158 159 struct bp_device{ 160 char name[10]; 161 int type; /* 1 : NPN; 2 : PNP */ 162 float rc; /* collector resistance */ 163 float re; /* emitter resistance */ 164 float rb; /* zero bias base resistance */ 165 float Is; /* transport saturation current */ 166 float Af; /* ideal maximum forward alpha */ 167 float Ar; /* ideal maximum reverse alpha */ 168 float Vje; /* B-E built-in potential */ 169 float Vjc; /* B-C built-in potential */ 170 }; 171 172 struct dd_device{ 173 char name[10]; 174 float Is; /* saturation current */ 175 float rs; /* ohmic resistance */ 176 float Vj; /* junction potential */ 177 }; 178 179 typedef struct linked_lists_of_Bpoint{ 180 struct linked_lists_of_Bpoint *next; 181 int time; 182 float voltage; 183 float slope; 184 } BPOINT, *BPOINTPTR; 185 186 typedef struct linked_lists_of_nodeName{ 187 char id[24]; 188 struct linked_lists_of_nodeName *left, *right; 189 NODE *nd; 190 } NDname, *NDnamePt; 191 192 struct node { 193 NDnamePt name; 194 EMOSFET *mptr; /* pointer to head of src/drn MOSFET list */ 195 EMOSFET *gptr; /* pointer to head of gate MOSFET list */ 196 EI_CAP *cptr; /* pointer to head of internodal cap list */ 197 ERESISTOR *rptr; /* pointer to head of internodal resistor list */ 198 ERLINE *rlptr; /* pointer to head of internodal TX line list */ 199 ETXLine *tptr; /* pointer to head of transmission line list */ 200 ECPLine *cplptr; /* pointer to head of coupled lines list */ 201 EDIODE *ddptr; /* pointer to head of diode list */ 202 EVCCS *vccsptr; /* pointer to head of VCCS list */ 203 EVCCS *cvccsptr;/* pointer to head of controlled VCCS list */ 204 NODE *next; /* pointer to next node */ 205 REGLIST *region; /* region associated with this node */ 206 NODE *base_ptr; /* group src/drn nodes into region */ 207 /* charles 2,2 1/18/93 208 float V; 209 float dv; voltage at t(n-1) and slope at t(n) 210 */ 211 double V; 212 double dv; 213 double CL; /* grounded capacitance in F */ 214 double gsum; /*^ sum of the equivalent conductance */ 215 double cgsum; /*^ sum of the constant conductance */ 216 double is; /*^ equivalent Is */ 217 int tag; /* -2 : Vdd, -3 : Vss, -1 : initial value */ 218 int flag; /*^ flag to show some features of the node */ 219 PQUEUE *qptr; /*^ pointer to the entry in the queue or waiting list */ 220 FILE *ofile; /* output file for the signal at this node */ 221 /* NULL if not for print */ 222 int dvtag; 223 }; 224 225 struct reglist{ 226 REGLIST *rnxt; /* pointer to next region */ 227 NODE *nlist; /* node list */ 228 MOSFET *mos; 229 I_CAP *cap; 230 RESISTOR *res; 231 TXLine *txl; 232 CPLine *cpl; 233 struct linked_lists_of_Bpoint *Bpoint; /* break points at primary inputs */ 234 struct linked_lists_of_Bpoint *head; /* header of the break points at primary inputs */ 235 int eTime; /* time when this region previously evaluated */ 236 int DCvalue; 237 /* 1, 0, 2 : unknown, 3 : unchangeable 1, 4 : unchangeable 0 */ 238 BQUEUE *prediction; 239 }; 240 241 242 struct bqueue{ 243 int key; /* time for the event to be fired, or DC weight */ 244 BQUEUE *left; 245 BQUEUE *right; 246 BQUEUE *pred; 247 BQUEUE *pool; 248 REGLIST *region; /* region id */ 249 }; 250 251 struct pqueue { 252 NODE *node; 253 PQUEUE *next; 254 PQUEUE *prev; 255 }; 256 257 struct i_cap { 258 NODE *in_node; 259 NODE *out_node; 260 float cap; 261 I_CAP *nx; 262 }; 263 264 struct resistor { 265 NODE *in_node; 266 NODE *out_node; 267 float g; /* conductance */ 268 int ifF; /* whether floating */ 269 float g1; /* conductance for floating resistor */ 270 RESISTOR *nx; 271 }; 272 273 struct rline { 274 NODE *in_node; 275 NODE *out_node; 276 double g; /* conductance */ 277 RLINE *nx; 278 }; 279 280 typedef struct linked_lists_of_vi_txl{ 281 struct linked_lists_of_vi_txl *next; 282 struct linked_lists_of_vi_txl *pool; 283 int time; 284 /* charles 2,2 285 float v_i, v_o; 286 float i_i, i_o; 287 */ 288 double v_i, v_o; 289 double i_i, i_o; 290 } VI_list_txl; 291 292 typedef struct linked_lists_of_vi{ 293 struct linked_lists_of_vi *next; 294 struct linked_lists_of_vi *pool; 295 int time; 296 double v_i[MAX_CP_TX_LINES], v_o[MAX_CP_TX_LINES]; 297 double i_i[MAX_CP_TX_LINES], i_o[MAX_CP_TX_LINES]; 298 } VI_list; 299 300 typedef struct { 301 double c, x; 302 double cnv_i, cnv_o; 303 } TERM; 304 305 typedef struct { 306 int ifImg; 307 double aten; 308 TERM tm[3]; 309 } TMS; 310 311 struct cpline { 312 int noL; 313 int ext; 314 double ratio[MAX_CP_TX_LINES]; 315 double taul[MAX_CP_TX_LINES]; 316 TMS *h1t[MAX_CP_TX_LINES][MAX_CP_TX_LINES]; 317 TMS *h2t[MAX_CP_TX_LINES][MAX_CP_TX_LINES][MAX_CP_TX_LINES]; 318 TMS *h3t[MAX_CP_TX_LINES][MAX_CP_TX_LINES][MAX_CP_TX_LINES]; 319 double h1C[MAX_CP_TX_LINES][MAX_CP_TX_LINES]; 320 double h2C[MAX_CP_TX_LINES][MAX_CP_TX_LINES][MAX_CP_TX_LINES]; 321 double h3C[MAX_CP_TX_LINES][MAX_CP_TX_LINES][MAX_CP_TX_LINES]; 322 double h1e[MAX_CP_TX_LINES][MAX_CP_TX_LINES][3]; 323 NODE *in_node[MAX_CP_TX_LINES]; 324 NODE *out_node[MAX_CP_TX_LINES]; 325 int tag_i[MAX_CP_TX_LINES], tag_o[MAX_CP_TX_LINES]; 326 CPLine *nx; 327 struct linked_lists_of_vi *vi_head; 328 struct linked_lists_of_vi *vi_tail; 329 double dc1[MAX_CP_TX_LINES], dc2[MAX_CP_TX_LINES]; 330 }; 331 332 struct txline { 333 int lsl; /* 1 if the line is lossless, otherwise 0 */ 334 int ext; /* a flag, set if time step is greater than tau */ 335 double ratio; 336 double taul; 337 double sqtCdL; 338 double h2_aten; 339 double h3_aten; 340 double h1C; 341 double h1e[3]; 342 int ifImg; 343 NODE *in_node; 344 NODE *out_node; 345 int tag_i, tag_o; 346 TERM h1_term[3]; 347 TERM h2_term[3]; 348 TERM h3_term[6]; 349 TXLine *nx; 350 struct linked_lists_of_vi_txl *vi_head; 351 struct linked_lists_of_vi_txl *vi_tail; 352 double dc1, dc2; 353 int newtp; /* flag indicating new time point */ 354 }; 355 356 struct evccs { 357 VCCS *vccs; 358 EVCCS *link; 359 }; 360 361 struct ediode { 362 DIODE *dd; 363 EDIODE *link; 364 }; 365 366 struct emosfet { 367 MOSFET *mos; 368 EMOSFET *link; 369 }; 370 371 struct ei_cap { 372 I_CAP *cap; 373 EI_CAP *link; 374 }; 375 376 struct eresistor { 377 RESISTOR *res; 378 ERESISTOR *link; 379 }; 380 381 struct erline { 382 RLINE *rl; 383 ERLINE *link; 384 }; 385 386 struct etxline { 387 TXLine *line; 388 ETXLine *link; 389 }; 390 391 struct ecpline { 392 CPLine *line; 393 ECPLine *link; 394 }; 395 396 #endif 397