Jspice3
mosacld.c
Go to the documentation of this file.
1 /***************************************************************************
2 JSPICE3 adaptation of Spice3f2 - Copyright (c) Stephen R. Whiteley 1992
3 Copyright 1990 Regents of the University of California. All rights reserved.
4 Authors: 1985 Thomas L. Quarles
5  1993 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 #include "spice.h"
9 #include <stdio.h>
10 #include "mosdefs.h"
11 #include "sperror.h"
12 
13 
14 int
15 MOSacLoad(inModel,ckt)
16 
17 GENmodel *inModel;
18 CKTcircuit *ckt;
19 {
20  MOSmodel *model = (MOSmodel *)inModel;
21  MOSinstance *here;
22  double xgs;
23  double xgd;
24  double xgb;
25  double xbd;
26  double xbs;
27  double dcon;
28  double scon;
29  double omega = ckt->CKTomega;
30 
31  for ( ; model != NULL; model = model->MOSnextModel) {
32  for (here = model->MOSinstances; here!= NULL;
33  here = here->MOSnextInstance) {
34 
35  /*
36  * meyer's model parameters
37  */
38  xgs = *(ckt->CKTstate0 + here->MOScapgs) +
39  *(ckt->CKTstate0 + here->MOScapgs) +
41  xgd = *(ckt->CKTstate0 + here->MOScapgd) +
42  *(ckt->CKTstate0 + here->MOScapgd) +
44  xgb = *(ckt->CKTstate0 + here->MOScapgb) +
45  *(ckt->CKTstate0 + here->MOScapgb) +
47 
48  xgs *= omega;
49  xgd *= omega;
50  xgb *= omega;
51  xbd = here->MOScapbd * omega;
52  xbs = here->MOScapbs * omega;
53 
54  dcon = here->MOSdrainConductance;
55  scon = here->MOSsourceConductance;
56  /*
57  * load matrix
58  */
59  *(here->MOSGgPtr +1) += xgd + xgs + xgb;
60  *(here->MOSBbPtr +1) += xgb + xbd + xbs;
61  *(here->MOSDPdpPtr+1) += xgd + xbd;
62  *(here->MOSSPspPtr+1) += xgs + xbs;
63  *(here->MOSGbPtr +1) -= xgb;
64  *(here->MOSGdpPtr +1) -= xgd;
65  *(here->MOSGspPtr +1) -= xgs;
66  *(here->MOSBgPtr +1) -= xgb;
67  *(here->MOSBdpPtr +1) -= xbd;
68  *(here->MOSBspPtr +1) -= xbs;
69  *(here->MOSDPgPtr +1) -= xgd;
70  *(here->MOSDPbPtr +1) -= xbd;
71  *(here->MOSSPgPtr +1) -= xgs;
72  *(here->MOSSPbPtr +1) -= xbs;
73  *(here->MOSDdPtr) += dcon;
74  *(here->MOSSsPtr) += scon;
75  *(here->MOSBbPtr) += here->MOSgbd + here->MOSgbs;
76  *(here->MOSDdpPtr) -= dcon;
77  *(here->MOSSspPtr) -= scon;
78  *(here->MOSBdpPtr) -= here->MOSgbd;
79  *(here->MOSBspPtr) -= here->MOSgbs;
80  *(here->MOSDPdPtr) -= dcon;
81  *(here->MOSSPsPtr) -= scon;
82 
83  if (here->MOSmode > 0) {
84 
85  *(here->MOSDPdpPtr) +=
86  dcon + here->MOSgds + here->MOSgbd;
87  *(here->MOSSPspPtr) +=
88  scon + here->MOSgds + here->MOSgbs +
89  here->MOSgm + here->MOSgmbs;
90 
91  *(here->MOSDPgPtr) += here->MOSgm;
92  *(here->MOSDPbPtr) += -here->MOSgbd + here->MOSgmbs;
93  *(here->MOSDPspPtr) -=
94  here->MOSgds + here->MOSgm + here->MOSgmbs;
95 
96  *(here->MOSSPgPtr) -= here->MOSgm;
97  *(here->MOSSPbPtr) -= here->MOSgbs + here->MOSgmbs;
98  *(here->MOSSPdpPtr) -= here->MOSgds;
99  }
100  else {
101  *(here->MOSDPdpPtr) +=
102  dcon + here->MOSgds + here->MOSgbd +
103  here->MOSgm + here->MOSgmbs;
104  *(here->MOSSPspPtr) +=
105  scon + here->MOSgds + here->MOSgbs;
106 
107  *(here->MOSDPgPtr) -= here->MOSgm;
108  *(here->MOSDPbPtr) -= here->MOSgbd + here->MOSgmbs;
109  *(here->MOSDPspPtr) -= here->MOSgds;
110 
111  *(here->MOSSPgPtr) += here->MOSgm;
112  *(here->MOSSPbPtr) -= here->MOSgbs - here->MOSgmbs;
113  *(here->MOSSPdpPtr) -=
114  here->MOSgds + here->MOSgm + here->MOSgmbs;
115  }
116  }
117  }
118  return (OK);
119 }
struct sMOSmodel * MOSnextModel
Definition: mosdefs.h:274
double MOSgateBulkOverlapCap
Definition: mosdefs.h:94
MOSinstance * MOSinstances
Definition: mosdefs.h:276
double * MOSDPdpPtr
Definition: mosdefs.h:106
double MOSgm
Definition: mosdefs.h:74
int MOSacLoad(GENmodel *inModel, CKTcircuit *ckt)
Definition: mosacld.c:15
double * MOSSPbPtr
Definition: mosdefs.h:139
double MOSgmbs
Definition: mosdefs.h:73
double * MOSBspPtr
Definition: mosdefs.h:122
double * MOSSsPtr
Definition: mosdefs.h:102
double * MOSSspPtr
Definition: mosdefs.h:118
double * MOSGspPtr
Definition: mosdefs.h:116
double * MOSSPgPtr
Definition: mosdefs.h:133
double MOSgds
Definition: mosdefs.h:75
double MOScapbd
Definition: mosdefs.h:78
double * MOSDPbPtr
Definition: mosdefs.h:137
double * MOSSPspPtr
Definition: mosdefs.h:108
double * MOSSPsPtr
Definition: mosdefs.h:135
double MOSgateSourceOverlapCap
Definition: mosdefs.h:92
double * MOSDdPtr
Definition: mosdefs.h:98
#define OK
Definition: iferrmsg.h:17
double * MOSGbPtr
Definition: mosdefs.h:112
double MOSgbs
Definition: mosdefs.h:77
#define NULL
Definition: spdefs.h:121
double MOSgbd
Definition: mosdefs.h:76
double * MOSSPdpPtr
Definition: mosdefs.h:141
double CKTomega
Definition: cktdefs.h:198
double * MOSBdpPtr
Definition: mosdefs.h:120
double * MOSGgPtr
Definition: mosdefs.h:100
double * MOSGdpPtr
Definition: mosdefs.h:114
double * MOSDPgPtr
Definition: mosdefs.h:130
static char model[32]
Definition: subckt.c:76
int MOSmode
Definition: mosdefs.h:32
double * MOSBgPtr
Definition: mosdefs.h:128
double MOSgateDrainOverlapCap
Definition: mosdefs.h:93
double * MOSDPspPtr
Definition: mosdefs.h:124
double MOSsourceConductance
Definition: mosdefs.h:42
double MOScapbs
Definition: mosdefs.h:79
struct sMOSinstance * MOSnextInstance
Definition: mosdefs.h:20
double * MOSDPdPtr
Definition: mosdefs.h:126
double * MOSBbPtr
Definition: mosdefs.h:104
double * MOSDdpPtr
Definition: mosdefs.h:110
double MOSdrainConductance
Definition: mosdefs.h:43