1 /**********
2 Copyright 1990 Regents of the University of California. All rights reserved.
3 Author: 1988 Jaijeet S Roychowdhury
4 Modified: Alan Gillespie
5 **********/
6
7 #include "ngspice/ngspice.h"
8 #include "ngspice/cktdefs.h"
9 #include "mos9defs.h"
10 #include "ngspice/sperror.h"
11 #include "ngspice/distodef.h"
12 #include "ngspice/suffix.h"
13
14 int
MOS9disto(int mode,GENmodel * genmodel,CKTcircuit * ckt)15 MOS9disto(
16 int mode,
17 GENmodel *genmodel,
18 CKTcircuit *ckt)
19
20 /* assuming here that ckt->CKTomega has been initialised to
21 * the correct value
22 */
23 {
24 MOS9model *model = (MOS9model *) genmodel;
25 DISTOAN* job = (DISTOAN*) ckt->CKTcurJob;
26 DpassStr pass;
27 double r1h1x,i1h1x;
28 double r1h1y,i1h1y;
29 double r1h1z, i1h1z;
30 double r1h2x, i1h2x;
31 double r1h2y, i1h2y;
32 double r1h2z, i1h2z;
33 double r1hm2x,i1hm2x;
34 double r1hm2y,i1hm2y;
35 double r1hm2z, i1hm2z;
36 double r2h11x,i2h11x;
37 double r2h11y,i2h11y;
38 double r2h11z, i2h11z;
39 double r2h1m2x,i2h1m2x;
40 double r2h1m2y,i2h1m2y;
41 double r2h1m2z, i2h1m2z;
42 double temp, itemp;
43 register MOS9instance *here;
44
45 if (mode == D_SETUP)
46 return(MOS9dSetup(genmodel,ckt));
47
48 if ((mode == D_TWOF1) || (mode == D_THRF1) ||
49 (mode == D_F1PF2) || (mode == D_F1MF2) ||
50 (mode == D_2F1MF2)) {
51
52 /* loop through all the MOS9 models */
53 for( ; model != NULL; model = MOS9nextModel(model)) {
54
55 /* loop through all the instances of the model */
56 for (here = MOS9instances(model); here != NULL ;
57 here=MOS9nextInstance(here)) {
58
59 /* loading starts here */
60
61 switch (mode) {
62 case D_TWOF1:
63 /* x = vgs, y = vbs z = vds */
64
65 /* getting first order (linear) Volterra kernel */
66 r1h1x = *(job->r1H1ptr + (here->MOS9gNode)) -
67 *(job->r1H1ptr + (here->MOS9sNodePrime));
68 i1h1x = *(job->i1H1ptr + (here->MOS9gNode)) -
69 *(job->i1H1ptr + (here->MOS9sNodePrime));
70
71 r1h1y = *(job->r1H1ptr + (here->MOS9bNode)) -
72 *(job->r1H1ptr + (here->MOS9sNodePrime));
73 i1h1y = *(job->i1H1ptr + (here->MOS9bNode)) -
74 *(job->i1H1ptr + (here->MOS9sNodePrime));
75
76 r1h1z = *(job->r1H1ptr + (here->MOS9dNodePrime)) -
77 *(job->r1H1ptr + (here->MOS9sNodePrime));
78 i1h1z = *(job->i1H1ptr + (here->MOS9dNodePrime)) -
79 *(job->i1H1ptr + (here->MOS9sNodePrime));
80
81 /* loading starts here */
82 /* loading cdrain term */
83
84 temp = DFn2F1(here->cdr_x2,
85 here->cdr_y2,
86 here->cdr_z2,
87 here->cdr_xy,
88 here->cdr_yz,
89 here->cdr_xz,
90 r1h1x,
91 i1h1x,
92 r1h1y,
93 i1h1y,
94 r1h1z,
95 i1h1z);
96
97 itemp = DFi2F1(here->cdr_x2,
98 here->cdr_y2,
99 here->cdr_z2,
100 here->cdr_xy,
101 here->cdr_yz,
102 here->cdr_xz,
103 r1h1x,
104 i1h1x,
105 r1h1y,
106 i1h1y,
107 r1h1z,
108 i1h1z);
109
110 *(ckt->CKTrhs + (here->MOS9dNodePrime)) -= temp;
111 *(ckt->CKTirhs + (here->MOS9dNodePrime)) -= itemp;
112 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
113 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
114
115 /* cdrain term over */
116
117 /* loading gbs term */
118
119 temp = D1n2F1(here->gbs2,
120 r1h1y,
121 i1h1y);
122
123 itemp = D1i2F1(here->gbs2,
124 r1h1y,
125 i1h1y);
126
127
128 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
129 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
130 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
131 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
132
133 /* gbs over */
134
135 /* loading gbd term */
136
137 temp = D1n2F1(here->gbd2,
138 r1h1y - r1h1z,
139 i1h1y - i1h1z);
140
141 itemp = D1i2F1(here->gbd2,
142 r1h1y - r1h1z,
143 i1h1y - i1h1z);
144
145
146 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
147 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
148 *(ckt->CKTrhs + (here->MOS9dNodePrime)) += temp;
149 *(ckt->CKTirhs + (here->MOS9dNodePrime)) += itemp;
150
151 /* gbd over */
152
153 /* loading capgs term */
154
155 temp = -ckt->CKTomega *
156 D1i2F1(here->capgs2,
157 r1h1x,
158 i1h1x);
159
160 itemp = ckt->CKTomega *
161 D1n2F1(here->capgs2,
162 r1h1x,
163 i1h1x);
164
165 *(ckt->CKTrhs + (here->MOS9gNode)) -= temp;
166 *(ckt->CKTirhs + (here->MOS9gNode)) -= itemp;
167 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
168 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
169
170 /* capgs over */
171
172 /* loading capgd term */
173
174 temp = -ckt->CKTomega *
175 D1i2F1(here->capgd2,
176 r1h1x - r1h1z,
177 i1h1x - i1h1z);
178
179 itemp = ckt->CKTomega *
180 D1n2F1(here->capgd2,
181 r1h1x - r1h1z,
182 i1h1x - i1h1z);
183
184
185 *(ckt->CKTrhs + (here->MOS9gNode)) -= temp;
186 *(ckt->CKTirhs + (here->MOS9gNode)) -= itemp;
187 *(ckt->CKTrhs + (here->MOS9dNodePrime)) += temp;
188 *(ckt->CKTirhs + (here->MOS9dNodePrime)) += itemp;
189
190 /* capgd over */
191 /* loading capgb term */
192
193 temp = -ckt->CKTomega *
194 D1i2F1(here->capgb2,
195 r1h1x - r1h1y,
196 i1h1x - i1h1y);
197
198 itemp = ckt->CKTomega *
199 D1n2F1(here->capgb2,
200 r1h1x - r1h1y,
201 i1h1x - i1h1y);
202
203 *(ckt->CKTrhs + (here->MOS9gNode)) -= temp;
204 *(ckt->CKTirhs + (here->MOS9gNode)) -= itemp;
205 *(ckt->CKTrhs + (here->MOS9bNode)) += temp;
206 *(ckt->CKTirhs + (here->MOS9bNode)) += itemp;
207
208 /* capgb over */
209
210 /* loading capbs term */
211
212 temp = -ckt->CKTomega *
213 D1i2F1(here->capbs2,
214 r1h1y,
215 i1h1y);
216
217 itemp = ckt->CKTomega *
218 D1n2F1(here->capbs2,
219 r1h1y,
220 i1h1y);
221
222
223 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
224 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
225 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
226 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
227
228 /* capbs over */
229
230 /* loading capbd term */
231
232 temp = -ckt->CKTomega *
233 D1i2F1(here->capbd2,
234 r1h1y - r1h1z,
235 i1h1y - i1h1z);
236
237 itemp = ckt->CKTomega *
238 D1n2F1(here->capbd2,
239 r1h1y - r1h1z,
240 i1h1y - i1h1z);
241
242
243 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
244 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
245 *(ckt->CKTrhs + (here->MOS9dNodePrime)) += temp;
246 *(ckt->CKTirhs + (here->MOS9dNodePrime)) += itemp;
247
248 /* capbd over */
249 /* all done */
250
251 break;
252
253 case D_THRF1:
254 /* x = vgs, y = vbs z = vds */
255
256 /* getting first order (linear) Volterra kernel */
257 r1h1x = *(job->r1H1ptr + (here->MOS9gNode)) -
258 *(job->r1H1ptr + (here->MOS9sNodePrime));
259 i1h1x = *(job->i1H1ptr + (here->MOS9gNode)) -
260 *(job->i1H1ptr + (here->MOS9sNodePrime));
261
262 r1h1y = *(job->r1H1ptr + (here->MOS9bNode)) -
263 *(job->r1H1ptr + (here->MOS9sNodePrime));
264 i1h1y = *(job->i1H1ptr + (here->MOS9bNode)) -
265 *(job->i1H1ptr + (here->MOS9sNodePrime));
266
267 r1h1z = *(job->r1H1ptr + (here->MOS9dNodePrime)) -
268 *(job->r1H1ptr + (here->MOS9sNodePrime));
269 i1h1z = *(job->i1H1ptr + (here->MOS9dNodePrime)) -
270 *(job->i1H1ptr + (here->MOS9sNodePrime));
271
272 r2h11x = *(job->r2H11ptr + (here->MOS9gNode)) -
273 *(job->r2H11ptr + (here->MOS9sNodePrime));
274 i2h11x = *(job->i2H11ptr + (here->MOS9gNode)) -
275 *(job->i2H11ptr + (here->MOS9sNodePrime));
276
277 r2h11y = *(job->r2H11ptr + (here->MOS9bNode)) -
278 *(job->r2H11ptr + (here->MOS9sNodePrime));
279 i2h11y = *(job->i2H11ptr + (here->MOS9bNode)) -
280 *(job->i2H11ptr + (here->MOS9sNodePrime));
281
282 r2h11z = *(job->r2H11ptr + (here->MOS9dNodePrime)) -
283 *(job->r2H11ptr + (here->MOS9sNodePrime));
284 i2h11z = *(job->i2H11ptr + (here->MOS9dNodePrime)) -
285 *(job->i2H11ptr + (here->MOS9sNodePrime));
286 /* loading starts here */
287 /* loading cdrain term */
288
289 temp = DFn3F1(here->cdr_x2,
290 here->cdr_y2,
291 here->cdr_z2,
292 here->cdr_xy,
293 here->cdr_yz,
294 here->cdr_xz,
295 here->cdr_x3,
296 here->cdr_y3,
297 here->cdr_z3,
298 here->cdr_x2y,
299 here->cdr_x2z,
300 here->cdr_xy2,
301 here->cdr_y2z,
302 here->cdr_xz2,
303 here->cdr_yz2,
304 here->cdr_xyz,
305 r1h1x,
306 i1h1x,
307 r1h1y,
308 i1h1y,
309 r1h1z,
310 i1h1z,
311 r2h11x,
312 i2h11x,
313 r2h11y,
314 i2h11y,
315 r2h11z,
316 i2h11z);
317 itemp = DFi3F1(here->cdr_x2,
318 here->cdr_y2,
319 here->cdr_z2,
320 here->cdr_xy,
321 here->cdr_yz,
322 here->cdr_xz,
323 here->cdr_x3,
324 here->cdr_y3,
325 here->cdr_z3,
326 here->cdr_x2y,
327 here->cdr_x2z,
328 here->cdr_xy2,
329 here->cdr_y2z,
330 here->cdr_xz2,
331 here->cdr_yz2,
332 here->cdr_xyz,
333 r1h1x,
334 i1h1x,
335 r1h1y,
336 i1h1y,
337 r1h1z,
338 i1h1z,
339 r2h11x,
340 i2h11x,
341 r2h11y,
342 i2h11y,
343 r2h11z,
344 i2h11z);
345
346
347 *(ckt->CKTrhs + (here->MOS9dNodePrime)) -= temp;
348 *(ckt->CKTirhs + (here->MOS9dNodePrime)) -= itemp;
349 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
350 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
351
352 /* cdrain term over */
353
354 /* loading gbs term */
355
356 temp = D1n3F1(here->gbs2,
357 here->gbs3,
358 r1h1y,
359 i1h1y,
360 r2h11y,
361 i2h11y);
362
363
364 itemp = D1i3F1(here->gbs2,
365 here->gbs3,
366 r1h1y,
367 i1h1y,
368 r2h11y,
369 i2h11y);
370
371
372 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
373 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
374 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
375 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
376
377 /* gbs over */
378
379 /* loading gbd term */
380
381 temp = D1n3F1(here->gbd2,
382 here->gbd3,
383 r1h1y - r1h1z,
384 i1h1y - i1h1z,
385 r2h11y - r2h11z,
386 i2h11y - i2h11z);
387
388 itemp = D1i3F1(here->gbd2,
389 here->gbd3,
390 r1h1y - r1h1z,
391 i1h1y - i1h1z,
392 r2h11y - r2h11z,
393 i2h11y - i2h11z);
394
395 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
396 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
397 *(ckt->CKTrhs + (here->MOS9dNodePrime)) += temp;
398 *(ckt->CKTirhs + (here->MOS9dNodePrime)) += itemp;
399
400 /* gbd over */
401
402 /* loading capgs term */
403
404 temp = -ckt->CKTomega *
405 D1i3F1(here->capgs2,
406 here->capgs3,
407 r1h1x,
408 i1h1x,
409 r2h11x,
410 i2h11x);
411
412 itemp = ckt->CKTomega *
413 D1n3F1(here->capgs2,
414 here->capgs3,
415 r1h1x,
416 i1h1x,
417 r2h11x,
418 i2h11x);
419
420 *(ckt->CKTrhs + (here->MOS9gNode)) -= temp;
421 *(ckt->CKTirhs + (here->MOS9gNode)) -= itemp;
422 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
423 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
424
425 /* capgs over */
426
427 /* loading capgd term */
428
429 temp = -ckt->CKTomega *
430 D1i3F1(here->capgd2,
431 here->capgd3,
432 r1h1x - r1h1z,
433 i1h1x - i1h1z,
434 r2h11x - r2h11z,
435 i2h11x - i2h11z);
436
437 itemp = ckt->CKTomega *
438 D1n3F1(here->capgd2,
439 here->capgd3,
440 r1h1x - r1h1z,
441 i1h1x - i1h1z,
442 r2h11x - r2h11z,
443 i2h11x - i2h11z);
444
445
446 *(ckt->CKTrhs + (here->MOS9gNode)) -= temp;
447 *(ckt->CKTirhs + (here->MOS9gNode)) -= itemp;
448 *(ckt->CKTrhs + (here->MOS9dNodePrime)) += temp;
449 *(ckt->CKTirhs + (here->MOS9dNodePrime)) += itemp;
450
451 /* capgd over */
452 /* loading capgb term */
453
454 temp = -ckt->CKTomega *
455 D1i3F1(here->capgb2,
456 here->capgb3,
457 r1h1x - r1h1y,
458 i1h1x - i1h1y,
459 r2h11x - r2h11y,
460 i2h11x - i2h11y);
461
462 itemp = ckt->CKTomega *
463 D1n3F1(here->capgb2,
464 here->capgb3,
465 r1h1x - r1h1y,
466 i1h1x - i1h1y,
467 r2h11x - r2h11y,
468 i2h11x - i2h11y);
469
470 *(ckt->CKTrhs + (here->MOS9gNode)) -= temp;
471 *(ckt->CKTirhs + (here->MOS9gNode)) -= itemp;
472 *(ckt->CKTrhs + (here->MOS9bNode)) += temp;
473 *(ckt->CKTirhs + (here->MOS9bNode)) += itemp;
474
475 /* capgb over */
476
477 /* loading capbs term */
478
479 temp = -ckt->CKTomega *
480 D1i3F1(here->capbs2,
481 here->capbs3,
482 r1h1y,
483 i1h1y,
484 r2h11y,
485 i2h11y);
486
487 itemp = ckt->CKTomega *
488 D1n3F1(here->capbs2,
489 here->capbs3,
490 r1h1y,
491 i1h1y,
492 r2h11y,
493 i2h11y);
494
495
496 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
497 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
498 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
499 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
500
501 /* capbs over */
502
503 /* loading capbd term */
504
505 temp = -ckt->CKTomega *
506 D1i3F1(here->capbd2,
507 here->capbd3,
508 r1h1y - r1h1z,
509 i1h1y - i1h1z,
510 r2h11y - r2h11z,
511 i2h11y - i2h11z);
512
513 itemp = ckt->CKTomega *
514 D1n3F1(here->capbd2,
515 here->capbd3,
516 r1h1y - r1h1z,
517 i1h1y - i1h1z,
518 r2h11y - r2h11z,
519 i2h11y - i2h11z);
520
521
522 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
523 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
524 *(ckt->CKTrhs + (here->MOS9dNodePrime)) += temp;
525 *(ckt->CKTirhs + (here->MOS9dNodePrime)) += itemp;
526
527 /* capbd over */
528 /* all done */
529
530 break;
531 case D_F1PF2:
532 /* x = vgs, y = vbs z = vds */
533
534 /* getting first order (linear) Volterra kernel */
535 r1h1x = *(job->r1H1ptr + (here->MOS9gNode)) -
536 *(job->r1H1ptr + (here->MOS9sNodePrime));
537 i1h1x = *(job->i1H1ptr + (here->MOS9gNode)) -
538 *(job->i1H1ptr + (here->MOS9sNodePrime));
539
540 r1h1y = *(job->r1H1ptr + (here->MOS9bNode)) -
541 *(job->r1H1ptr + (here->MOS9sNodePrime));
542 i1h1y = *(job->i1H1ptr + (here->MOS9bNode)) -
543 *(job->i1H1ptr + (here->MOS9sNodePrime));
544
545 r1h1z = *(job->r1H1ptr + (here->MOS9dNodePrime)) -
546 *(job->r1H1ptr + (here->MOS9sNodePrime));
547 i1h1z = *(job->i1H1ptr + (here->MOS9dNodePrime)) -
548 *(job->i1H1ptr + (here->MOS9sNodePrime));
549
550 r1h2x = *(job->r1H2ptr + (here->MOS9gNode)) -
551 *(job->r1H2ptr + (here->MOS9sNodePrime));
552 i1h2x = *(job->i1H2ptr + (here->MOS9gNode)) -
553 *(job->i1H2ptr + (here->MOS9sNodePrime));
554
555 r1h2y = *(job->r1H2ptr + (here->MOS9bNode)) -
556 *(job->r1H2ptr + (here->MOS9sNodePrime));
557 i1h2y = *(job->i1H2ptr + (here->MOS9bNode)) -
558 *(job->i1H2ptr + (here->MOS9sNodePrime));
559
560 r1h2z = *(job->r1H2ptr + (here->MOS9dNodePrime)) -
561 *(job->r1H2ptr + (here->MOS9sNodePrime));
562 i1h2z = *(job->i1H2ptr + (here->MOS9dNodePrime)) -
563 *(job->i1H2ptr + (here->MOS9sNodePrime));
564
565 /* loading starts here */
566 /* loading cdrain term */
567
568 temp = DFnF12(here->cdr_x2,
569 here->cdr_y2,
570 here->cdr_z2,
571 here->cdr_xy,
572 here->cdr_yz,
573 here->cdr_xz,
574 r1h1x,
575 i1h1x,
576 r1h1y,
577 i1h1y,
578 r1h1z,
579 i1h1z,
580 r1h2x,
581 i1h2x,
582 r1h2y,
583 i1h2y,
584 r1h2z,
585 i1h2z);
586
587 itemp = DFiF12(here->cdr_x2,
588 here->cdr_y2,
589 here->cdr_z2,
590 here->cdr_xy,
591 here->cdr_yz,
592 here->cdr_xz,
593 r1h1x,
594 i1h1x,
595 r1h1y,
596 i1h1y,
597 r1h1z,
598 i1h1z,
599 r1h2x,
600 i1h2x,
601 r1h2y,
602 i1h2y,
603 r1h2z,
604 i1h2z);
605
606 *(ckt->CKTrhs + (here->MOS9dNodePrime)) -= temp;
607 *(ckt->CKTirhs + (here->MOS9dNodePrime)) -= itemp;
608 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
609 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
610
611 /* cdrain term over */
612
613 /* loading gbs term */
614
615 temp = D1nF12(here->gbs2,
616 r1h1y,
617 i1h1y,
618 r1h2y,
619 i1h2y);
620
621 itemp = D1iF12(here->gbs2,
622 r1h1y,
623 i1h1y,
624 r1h2y,
625 i1h2y);
626
627
628 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
629 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
630 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
631 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
632
633 /* gbs over */
634
635 /* loading gbd term */
636
637 temp = D1nF12(here->gbd2,
638 r1h1y - r1h1z,
639 i1h1y - i1h1z,
640 r1h2y - r1h2z,
641 i1h2y - i1h2z);
642
643 itemp = D1iF12(here->gbd2,
644 r1h1y - r1h1z,
645 i1h1y - i1h1z,
646 r1h2y - r1h2z,
647 i1h2y - i1h2z);
648
649
650 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
651 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
652 *(ckt->CKTrhs + (here->MOS9dNodePrime)) += temp;
653 *(ckt->CKTirhs + (here->MOS9dNodePrime)) += itemp;
654
655 /* gbd over */
656
657 /* loading capgs term */
658
659 temp = -ckt->CKTomega *
660 D1iF12(here->capgs2,
661 r1h1x,
662 i1h1x,
663 r1h2x,
664 i1h2x);
665
666 itemp = ckt->CKTomega *
667 D1nF12(here->capgs2,
668 r1h1x,
669 i1h1x,
670 r1h2x,
671 i1h2x);
672
673 *(ckt->CKTrhs + (here->MOS9gNode)) -= temp;
674 *(ckt->CKTirhs + (here->MOS9gNode)) -= itemp;
675 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
676 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
677
678 /* capgs over */
679
680 /* loading capgd term */
681
682 temp = -ckt->CKTomega *
683 D1iF12(here->capgd2,
684 r1h1x - r1h1z,
685 i1h1x - i1h1z,
686 r1h2x - r1h2z,
687 i1h2x - i1h2z);
688
689 itemp = ckt->CKTomega *
690 D1nF12(here->capgd2,
691 r1h1x - r1h1z,
692 i1h1x - i1h1z,
693 r1h2x - r1h2z,
694 i1h2x - i1h2z);
695
696
697 *(ckt->CKTrhs + (here->MOS9gNode)) -= temp;
698 *(ckt->CKTirhs + (here->MOS9gNode)) -= itemp;
699 *(ckt->CKTrhs + (here->MOS9dNodePrime)) += temp;
700 *(ckt->CKTirhs + (here->MOS9dNodePrime)) += itemp;
701
702 /* capgd over */
703 /* loading capgb term */
704
705 temp = -ckt->CKTomega *
706 D1iF12(here->capgb2,
707 r1h1x - r1h1y,
708 i1h1x - i1h1y,
709 r1h2x - r1h2y,
710 i1h2x - i1h2y);
711
712 itemp = ckt->CKTomega *
713 D1nF12(here->capgb2,
714 r1h1x - r1h1y,
715 i1h1x - i1h1y,
716 r1h2x - r1h2y,
717 i1h2x - i1h2y);
718
719 *(ckt->CKTrhs + (here->MOS9gNode)) -= temp;
720 *(ckt->CKTirhs + (here->MOS9gNode)) -= itemp;
721 *(ckt->CKTrhs + (here->MOS9bNode)) += temp;
722 *(ckt->CKTirhs + (here->MOS9bNode)) += itemp;
723
724 /* capgb over */
725
726 /* loading capbs term */
727
728 temp = -ckt->CKTomega *
729 D1iF12(here->capbs2,
730 r1h1y,
731 i1h1y,
732 r1h2y,
733 i1h2y);
734
735 itemp = ckt->CKTomega *
736 D1nF12(here->capbs2,
737 r1h1y,
738 i1h1y,
739 r1h2y,
740 i1h2y);
741
742
743 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
744 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
745 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
746 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
747
748 /* capbs over */
749
750 /* loading capbd term */
751
752 temp = -ckt->CKTomega *
753 D1iF12(here->capbd2,
754 r1h1y - r1h1z,
755 i1h1y - i1h1z,
756 r1h2y - r1h2z,
757 i1h2y - i1h2z);
758
759 itemp = ckt->CKTomega *
760 D1nF12(here->capbd2,
761 r1h1y - r1h1z,
762 i1h1y - i1h1z,
763 r1h2y - r1h2z,
764 i1h2y - i1h2z);
765
766
767 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
768 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
769 *(ckt->CKTrhs + (here->MOS9dNodePrime)) += temp;
770 *(ckt->CKTirhs + (here->MOS9dNodePrime)) += itemp;
771
772 /* capbd over */
773 /* all done */
774
775 break;
776 case D_F1MF2:
777 /* x = vgs, y = vbs z = vds */
778
779 /* getting first order (linear) Volterra kernel */
780 r1h1x = *(job->r1H1ptr + (here->MOS9gNode)) -
781 *(job->r1H1ptr + (here->MOS9sNodePrime));
782 i1h1x = *(job->i1H1ptr + (here->MOS9gNode)) -
783 *(job->i1H1ptr + (here->MOS9sNodePrime));
784
785 r1h1y = *(job->r1H1ptr + (here->MOS9bNode)) -
786 *(job->r1H1ptr + (here->MOS9sNodePrime));
787 i1h1y = *(job->i1H1ptr + (here->MOS9bNode)) -
788 *(job->i1H1ptr + (here->MOS9sNodePrime));
789
790 r1h1z = *(job->r1H1ptr + (here->MOS9dNodePrime)) -
791 *(job->r1H1ptr + (here->MOS9sNodePrime));
792 i1h1z = *(job->i1H1ptr + (here->MOS9dNodePrime)) -
793 *(job->i1H1ptr + (here->MOS9sNodePrime));
794
795 r1hm2x = *(job->r1H2ptr + (here->MOS9gNode)) -
796 *(job->r1H2ptr + (here->MOS9sNodePrime));
797 i1hm2x = -(*(job->i1H2ptr + (here->MOS9gNode)) -
798 *(job->i1H2ptr + (here->MOS9sNodePrime)));
799
800 r1hm2y = *(job->r1H2ptr + (here->MOS9bNode)) -
801 *(job->r1H2ptr + (here->MOS9sNodePrime));
802 i1hm2y = -(*(job->i1H2ptr + (here->MOS9bNode)) -
803 *(job->i1H2ptr + (here->MOS9sNodePrime)));
804
805 r1hm2z = *(job->r1H2ptr + (here->MOS9dNodePrime)) -
806 *(job->r1H2ptr + (here->MOS9sNodePrime));
807 i1hm2z = -(*(job->i1H2ptr + (here->MOS9dNodePrime)) -
808 *(job->i1H2ptr + (here->MOS9sNodePrime)));
809
810 /* loading starts here */
811 /* loading cdrain term */
812
813 temp = DFnF12(here->cdr_x2,
814 here->cdr_y2,
815 here->cdr_z2,
816 here->cdr_xy,
817 here->cdr_yz,
818 here->cdr_xz,
819 r1h1x,
820 i1h1x,
821 r1h1y,
822 i1h1y,
823 r1h1z,
824 i1h1z,
825 r1hm2x,
826 i1hm2x,
827 r1hm2y,
828 i1hm2y,
829 r1hm2z,
830 i1hm2z);
831
832 itemp = DFiF12(here->cdr_x2,
833 here->cdr_y2,
834 here->cdr_z2,
835 here->cdr_xy,
836 here->cdr_yz,
837 here->cdr_xz,
838 r1h1x,
839 i1h1x,
840 r1h1y,
841 i1h1y,
842 r1h1z,
843 i1h1z,
844 r1hm2x,
845 i1hm2x,
846 r1hm2y,
847 i1hm2y,
848 r1hm2z,
849 i1hm2z);
850
851 *(ckt->CKTrhs + (here->MOS9dNodePrime)) -= temp;
852 *(ckt->CKTirhs + (here->MOS9dNodePrime)) -= itemp;
853 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
854 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
855
856 /* cdrain term over */
857
858 /* loading gbs term */
859
860 temp = D1nF12(here->gbs2,
861 r1h1y,
862 i1h1y,
863 r1hm2y,
864 i1hm2y);
865
866 itemp = D1iF12(here->gbs2,
867 r1h1y,
868 i1h1y,
869 r1hm2y,
870 i1hm2y);
871
872
873 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
874 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
875 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
876 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
877
878 /* gbs over */
879
880 /* loading gbd term */
881
882 temp = D1nF12(here->gbd2,
883 r1h1y - r1h1z,
884 i1h1y - i1h1z,
885 r1hm2y - r1hm2z,
886 i1hm2y - i1hm2z);
887
888 itemp = D1iF12(here->gbd2,
889 r1h1y - r1h1z,
890 i1h1y - i1h1z,
891 r1hm2y - r1hm2z,
892 i1hm2y - i1hm2z);
893
894
895 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
896 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
897 *(ckt->CKTrhs + (here->MOS9dNodePrime)) += temp;
898 *(ckt->CKTirhs + (here->MOS9dNodePrime)) += itemp;
899
900 /* gbd over */
901
902 /* loading capgs term */
903
904 temp = -ckt->CKTomega *
905 D1iF12(here->capgs2,
906 r1h1x,
907 i1h1x,
908 r1hm2x,
909 i1hm2x);
910
911 itemp = ckt->CKTomega *
912 D1nF12(here->capgs2,
913 r1h1x,
914 i1h1x,
915 r1hm2x,
916 i1hm2x);
917
918 *(ckt->CKTrhs + (here->MOS9gNode)) -= temp;
919 *(ckt->CKTirhs + (here->MOS9gNode)) -= itemp;
920 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
921 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
922
923 /* capgs over */
924
925 /* loading capgd term */
926
927 temp = -ckt->CKTomega *
928 D1iF12(here->capgd2,
929 r1h1x - r1h1z,
930 i1h1x - i1h1z,
931 r1hm2x - r1hm2z,
932 i1hm2x - i1hm2z);
933
934 itemp = ckt->CKTomega *
935 D1nF12(here->capgd2,
936 r1h1x - r1h1z,
937 i1h1x - i1h1z,
938 r1hm2x - r1hm2z,
939 i1hm2x - i1hm2z);
940
941
942 *(ckt->CKTrhs + (here->MOS9gNode)) -= temp;
943 *(ckt->CKTirhs + (here->MOS9gNode)) -= itemp;
944 *(ckt->CKTrhs + (here->MOS9dNodePrime)) += temp;
945 *(ckt->CKTirhs + (here->MOS9dNodePrime)) += itemp;
946
947 /* capgd over */
948 /* loading capgb term */
949
950 temp = -ckt->CKTomega *
951 D1iF12(here->capgb2,
952 r1h1x - r1h1y,
953 i1h1x - i1h1y,
954 r1hm2x - r1hm2y,
955 i1hm2x - i1hm2y);
956
957 itemp = ckt->CKTomega *
958 D1nF12(here->capgb2,
959 r1h1x - r1h1y,
960 i1h1x - i1h1y,
961 r1hm2x - r1hm2y,
962 i1hm2x - i1hm2y);
963
964 *(ckt->CKTrhs + (here->MOS9gNode)) -= temp;
965 *(ckt->CKTirhs + (here->MOS9gNode)) -= itemp;
966 *(ckt->CKTrhs + (here->MOS9bNode)) += temp;
967 *(ckt->CKTirhs + (here->MOS9bNode)) += itemp;
968
969 /* capgb over */
970
971 /* loading capbs term */
972
973 temp = -ckt->CKTomega *
974 D1iF12(here->capbs2,
975 r1h1y,
976 i1h1y,
977 r1hm2y,
978 i1hm2y);
979
980 itemp = ckt->CKTomega *
981 D1nF12(here->capbs2,
982 r1h1y,
983 i1h1y,
984 r1hm2y,
985 i1hm2y);
986
987
988 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
989 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
990 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
991 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
992
993 /* capbs over */
994
995 /* loading capbd term */
996
997 temp = -ckt->CKTomega *
998 D1iF12(here->capbd2,
999 r1h1y - r1h1z,
1000 i1h1y - i1h1z,
1001 r1hm2y - r1hm2z,
1002 i1hm2y - i1hm2z);
1003
1004 itemp = ckt->CKTomega *
1005 D1nF12(here->capbd2,
1006 r1h1y - r1h1z,
1007 i1h1y - i1h1z,
1008 r1hm2y - r1hm2z,
1009 i1hm2y - i1hm2z);
1010
1011
1012 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
1013 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
1014 *(ckt->CKTrhs + (here->MOS9dNodePrime)) += temp;
1015 *(ckt->CKTirhs + (here->MOS9dNodePrime)) += itemp;
1016
1017 /* capbd over */
1018 /* all done */
1019
1020 break;
1021 case D_2F1MF2:
1022 /* x = vgs, y = vbs z = vds */
1023
1024 /* getting first order (linear) Volterra kernel */
1025 r1h1x = *(job->r1H1ptr + (here->MOS9gNode)) -
1026 *(job->r1H1ptr + (here->MOS9sNodePrime));
1027 i1h1x = *(job->i1H1ptr + (here->MOS9gNode)) -
1028 *(job->i1H1ptr + (here->MOS9sNodePrime));
1029
1030 r1h1y = *(job->r1H1ptr + (here->MOS9bNode)) -
1031 *(job->r1H1ptr + (here->MOS9sNodePrime));
1032 i1h1y = *(job->i1H1ptr + (here->MOS9bNode)) -
1033 *(job->i1H1ptr + (here->MOS9sNodePrime));
1034
1035 r1h1z = *(job->r1H1ptr + (here->MOS9dNodePrime)) -
1036 *(job->r1H1ptr + (here->MOS9sNodePrime));
1037 i1h1z = *(job->i1H1ptr + (here->MOS9dNodePrime)) -
1038 *(job->i1H1ptr + (here->MOS9sNodePrime));
1039
1040 r1hm2x = *(job->r1H2ptr + (here->MOS9gNode)) -
1041 *(job->r1H2ptr + (here->MOS9sNodePrime));
1042 i1hm2x = -(*(job->i1H2ptr + (here->MOS9gNode)) -
1043 *(job->i1H2ptr + (here->MOS9sNodePrime)));
1044
1045 r1hm2y = *(job->r1H2ptr + (here->MOS9bNode)) -
1046 *(job->r1H2ptr + (here->MOS9sNodePrime));
1047 i1hm2y = -(*(job->i1H2ptr + (here->MOS9bNode)) -
1048 *(job->i1H2ptr + (here->MOS9sNodePrime)));
1049
1050 r1hm2z = *(job->r1H2ptr + (here->MOS9dNodePrime)) -
1051 *(job->r1H2ptr + (here->MOS9sNodePrime));
1052 i1hm2z = -(*(job->i1H2ptr + (here->MOS9dNodePrime)) -
1053 *(job->i1H2ptr + (here->MOS9sNodePrime)));
1054
1055 r2h11x = *(job->r1H1ptr + (here->MOS9gNode)) -
1056 *(job->r1H1ptr + (here->MOS9sNodePrime));
1057 i2h11x = *(job->i1H1ptr + (here->MOS9gNode)) -
1058 *(job->i1H1ptr + (here->MOS9sNodePrime));
1059
1060 r2h11y = *(job->r1H1ptr + (here->MOS9bNode)) -
1061 *(job->r1H1ptr + (here->MOS9sNodePrime));
1062 i2h11y = *(job->i1H1ptr + (here->MOS9bNode)) -
1063 *(job->i1H1ptr + (here->MOS9sNodePrime));
1064
1065 r2h11z = *(job->r1H1ptr + (here->MOS9dNodePrime)) -
1066 *(job->r1H1ptr + (here->MOS9sNodePrime));
1067 i2h11z = *(job->i1H1ptr + (here->MOS9dNodePrime)) -
1068 *(job->i1H1ptr + (here->MOS9sNodePrime));
1069
1070 r2h1m2x = *(job->r2H1m2ptr + (here->MOS9gNode)) -
1071 *(job->r2H1m2ptr + (here->MOS9sNodePrime));
1072 i2h1m2x = *(job->i2H1m2ptr + (here->MOS9gNode)) -
1073 *(job->i2H1m2ptr + (here->MOS9sNodePrime));
1074
1075 r2h1m2y = *(job->r2H1m2ptr + (here->MOS9bNode)) -
1076 *(job->r2H1m2ptr + (here->MOS9sNodePrime));
1077 i2h1m2y = *(job->i2H1m2ptr + (here->MOS9bNode)) -
1078 *(job->i2H1m2ptr + (here->MOS9sNodePrime));
1079
1080 r2h1m2z = *(job->r2H1m2ptr + (here->MOS9dNodePrime)) -
1081 *(job->r2H1m2ptr + (here->MOS9sNodePrime));
1082 i2h1m2z = *(job->i2H1m2ptr + (here->MOS9dNodePrime)) -
1083 *(job->i2H1m2ptr + (here->MOS9sNodePrime));
1084
1085 /* loading starts here */
1086 /* loading cdrain term */
1087
1088 pass.cxx = here->cdr_x2;
1089 pass.cyy = here->cdr_y2;
1090 pass.czz = here->cdr_z2;
1091 pass.cxy = here->cdr_xy;
1092 pass.cyz = here->cdr_yz;
1093 pass.cxz = here->cdr_xz;
1094 pass.cxxx = here->cdr_x3;
1095 pass.cyyy = here->cdr_y3;
1096 pass.czzz = here->cdr_z3;
1097 pass.cxxy = here->cdr_x2y;
1098 pass.cxxz = here->cdr_x2z;
1099 pass.cxyy = here->cdr_xy2;
1100 pass.cyyz = here->cdr_y2z;
1101 pass.cxzz = here->cdr_xz2;
1102 pass.cyzz = here->cdr_yz2;
1103 pass.cxyz = here->cdr_xyz;
1104 pass.r1h1x = r1h1x;
1105 pass.i1h1x = i1h1x;
1106 pass.r1h1y = r1h1y;
1107 pass.i1h1y = i1h1y;
1108 pass.r1h1z = r1h1z;
1109 pass.i1h1z = i1h1z;
1110 pass.r1h2x = r1hm2x;
1111 pass.i1h2x = i1hm2x;
1112 pass.r1h2y = r1hm2y;
1113 pass.i1h2y = i1hm2y;
1114 pass.r1h2z = r1hm2z;
1115 pass.i1h2z = i1hm2z;
1116 pass.r2h11x = r2h11x;
1117 pass.i2h11x = i2h11x;
1118 pass.r2h11y = r2h11y;
1119 pass.i2h11y = i2h11y;
1120 pass.r2h11z = r2h11z;
1121 pass.i2h11z = i2h11z;
1122 pass.h2f1f2x = r2h1m2x;
1123 pass.ih2f1f2x = i2h1m2x;
1124 pass.h2f1f2y = r2h1m2y;
1125 pass.ih2f1f2y = i2h1m2y;
1126 pass.h2f1f2z = r2h1m2z;
1127 pass.ih2f1f2z = i2h1m2z;
1128 temp = DFn2F12(&pass);
1129
1130 itemp = DFi2F12(&pass);
1131
1132
1133 *(ckt->CKTrhs + (here->MOS9dNodePrime)) -= temp;
1134 *(ckt->CKTirhs + (here->MOS9dNodePrime)) -= itemp;
1135 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
1136 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
1137
1138 /* cdrain term over */
1139
1140 /* loading gbs term */
1141
1142 temp = D1n2F12(here->gbs2,
1143 here->gbs3,
1144 r1h1y,
1145 i1h1y,
1146 r1hm2y,
1147 i1hm2y,
1148 r2h11y,
1149 i2h11y,
1150 r2h1m2y,
1151 i2h1m2y);
1152
1153
1154
1155 itemp = D1i2F12(here->gbs2,
1156 here->gbs3,
1157 r1h1y,
1158 i1h1y,
1159 r1hm2y,
1160 i1hm2y,
1161 r2h11y,
1162 i2h11y,
1163 r2h1m2y,
1164 i2h1m2y);
1165
1166
1167 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
1168 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
1169 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
1170 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
1171
1172 /* gbs over */
1173
1174 /* loading gbd term */
1175
1176 temp = D1n2F12(here->gbd2,
1177 here->gbd3,
1178 r1h1y - r1h1z,
1179 i1h1y - i1h1z,
1180 r1hm2y - r1hm2z,
1181 i1hm2y - i1hm2z,
1182 r2h11y - r2h11z,
1183 i2h11y - i2h11z,
1184 r2h1m2y - r2h1m2z,
1185 i2h1m2y - i2h1m2z);
1186
1187 itemp = D1i2F12(here->gbd2,
1188 here->gbd3,
1189 r1h1y - r1h1z,
1190 i1h1y - i1h1z,
1191 r1hm2y - r1hm2z,
1192 i1hm2y - i1hm2z,
1193 r2h11y - r2h11z,
1194 i2h11y - i2h11z,
1195 r2h1m2y - r2h1m2z,
1196 i2h1m2y - i2h1m2z);
1197
1198 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
1199 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
1200 *(ckt->CKTrhs + (here->MOS9dNodePrime)) += temp;
1201 *(ckt->CKTirhs + (here->MOS9dNodePrime)) += itemp;
1202
1203 /* gbd over */
1204
1205 /* loading capgs term */
1206
1207 temp = -ckt->CKTomega *
1208 D1i2F12(here->capgs2,
1209 here->capgs3,
1210 r1h1x,
1211 i1h1x,
1212 r1hm2x,
1213 i1hm2x,
1214 r2h11x,
1215 i2h11x,
1216 r2h1m2x,
1217 i2h1m2x);
1218
1219 itemp = ckt->CKTomega *
1220 D1n2F12(here->capgs2,
1221 here->capgs3,
1222 r1h1x,
1223 i1h1x,
1224 r1hm2x,
1225 i1hm2x,
1226 r2h11x,
1227 i2h11x,
1228 r2h1m2x,
1229 i2h1m2x);
1230
1231 *(ckt->CKTrhs + (here->MOS9gNode)) -= temp;
1232 *(ckt->CKTirhs + (here->MOS9gNode)) -= itemp;
1233 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
1234 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
1235
1236 /* capgs over */
1237
1238 /* loading capgd term */
1239
1240 temp = -ckt->CKTomega *
1241 D1i2F12(here->capgd2,
1242 here->capgd3,
1243 r1h1x - r1h1z,
1244 i1h1x - i1h1z,
1245 r1hm2x - r1hm2z,
1246 i1hm2x - i1hm2z,
1247 r2h11x - r2h11z,
1248 i2h11x - i2h11z,
1249 r2h1m2x - r2h1m2z,
1250 i2h1m2x - i2h1m2z);
1251
1252 itemp = ckt->CKTomega *
1253 D1n2F12(here->capgd2,
1254 here->capgd3,
1255 r1h1x - r1h1z,
1256 i1h1x - i1h1z,
1257 r1hm2x - r1hm2z,
1258 i1hm2x - i1hm2z,
1259 r2h11x - r2h11z,
1260 i2h11x - i2h11z,
1261 r2h1m2x - r2h1m2z,
1262 i2h1m2x - i2h1m2z);
1263
1264
1265 *(ckt->CKTrhs + (here->MOS9gNode)) -= temp;
1266 *(ckt->CKTirhs + (here->MOS9gNode)) -= itemp;
1267 *(ckt->CKTrhs + (here->MOS9dNodePrime)) += temp;
1268 *(ckt->CKTirhs + (here->MOS9dNodePrime)) += itemp;
1269
1270 /* capgd over */
1271 /* loading capgb term */
1272
1273 temp = -ckt->CKTomega *
1274 D1i2F12(here->capgb2,
1275 here->capgb3,
1276 r1h1x - r1h1y,
1277 i1h1x - i1h1y,
1278 r1hm2x - r1hm2y,
1279 i1hm2x - i1hm2y,
1280 r2h11x - r2h11y,
1281 i2h11x - i2h11y,
1282 r2h1m2x - r2h1m2y,
1283 i2h1m2x - i2h1m2y);
1284
1285 itemp = ckt->CKTomega *
1286 D1n2F12(here->capgb2,
1287 here->capgb3,
1288 r1h1x - r1h1y,
1289 i1h1x - i1h1y,
1290 r1hm2x - r1hm2y,
1291 i1hm2x - i1hm2y,
1292 r2h11x - r2h11y,
1293 i2h11x - i2h11y,
1294 r2h1m2x - r2h1m2y,
1295 i2h1m2x - i2h1m2y);
1296
1297 *(ckt->CKTrhs + (here->MOS9gNode)) -= temp;
1298 *(ckt->CKTirhs + (here->MOS9gNode)) -= itemp;
1299 *(ckt->CKTrhs + (here->MOS9bNode)) += temp;
1300 *(ckt->CKTirhs + (here->MOS9bNode)) += itemp;
1301
1302 /* capgb over */
1303
1304 /* loading capbs term */
1305
1306 temp = -ckt->CKTomega *
1307 D1i2F12(here->capbs2,
1308 here->capbs3,
1309 r1h1y,
1310 i1h1y,
1311 r1hm2y,
1312 i1hm2y,
1313 r2h11y,
1314 i2h11y,
1315 r2h1m2y,
1316 i2h1m2y);
1317
1318 itemp = ckt->CKTomega *
1319 D1n2F12(here->capbs2,
1320 here->capbs3,
1321 r1h1y,
1322 i1h1y,
1323 r1hm2y,
1324 i1hm2y,
1325 r2h11y,
1326 i2h11y,
1327 r2h1m2y,
1328 i2h1m2y);
1329
1330
1331 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
1332 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
1333 *(ckt->CKTrhs + (here->MOS9sNodePrime)) += temp;
1334 *(ckt->CKTirhs + (here->MOS9sNodePrime)) += itemp;
1335
1336 /* capbs over */
1337
1338 /* loading capbd term */
1339
1340 temp = -ckt->CKTomega *
1341 D1i2F12(here->capbd2,
1342 here->capbd3,
1343 r1h1y - r1h1z,
1344 i1h1y - i1h1z,
1345 r1hm2y - r1hm2z,
1346 i1hm2y - i1hm2z,
1347 r2h11y - r2h11z,
1348 i2h11y - i2h11z,
1349 r2h1m2y - r2h1m2z,
1350 i2h1m2y - i2h1m2z);
1351
1352 itemp = ckt->CKTomega *
1353 D1n2F12(here->capbd2,
1354 here->capbd3,
1355 r1h1y - r1h1z,
1356 i1h1y - i1h1z,
1357 r1hm2y - r1hm2z,
1358 i1hm2y - i1hm2z,
1359 r2h11y - r2h11z,
1360 i2h11y - i2h11z,
1361 r2h1m2y - r2h1m2z,
1362 i2h1m2y - i2h1m2z);
1363
1364
1365 *(ckt->CKTrhs + (here->MOS9bNode)) -= temp;
1366 *(ckt->CKTirhs + (here->MOS9bNode)) -= itemp;
1367 *(ckt->CKTrhs + (here->MOS9dNodePrime)) += temp;
1368 *(ckt->CKTirhs + (here->MOS9dNodePrime)) += itemp;
1369
1370 /* capbd over */
1371 /* all done */
1372
1373 break;
1374 default:
1375 ;
1376 }
1377 }
1378 }
1379 return(OK);
1380 }
1381 else
1382 return(E_BADPARM);
1383 }
1384