Jspice3
mosic.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  1989 Takayasu Sakurai
6  1993 Stephen R. Whiteley
7 ****************************************************************************/
8 
9 #include "spice.h"
10 #include <stdio.h>
11 #include "mosdefs.h"
12 #include "sperror.h"
13 
14 
15 int
16 MOSgetic(inModel,ckt)
17 
18 GENmodel *inModel;
19 CKTcircuit *ckt;
20 {
21  MOSmodel *model = (MOSmodel *)inModel;
22  MOSinstance *here;
23  /*
24  * grab initial conditions out of rhs array. User specified, so use
25  * external nodes to get values
26  */
27 
28  for ( ; model; model = model->MOSnextModel) {
29  for (here = model->MOSinstances; here;
30  here = here->MOSnextInstance) {
31 
32  if (!here->MOSicVBSGiven) {
33  here->MOSicVBS =
34  *(ckt->CKTrhs + here->MOSbNode) -
35  *(ckt->CKTrhs + here->MOSsNode);
36  }
37  if (!here->MOSicVDSGiven) {
38  here->MOSicVDS =
39  *(ckt->CKTrhs + here->MOSdNode) -
40  *(ckt->CKTrhs + here->MOSsNode);
41  }
42  if (!here->MOSicVGSGiven) {
43  here->MOSicVGS =
44  *(ckt->CKTrhs + here->MOSgNode) -
45  *(ckt->CKTrhs + here->MOSsNode);
46  }
47  }
48  }
49  return (OK);
50 }
struct sMOSmodel * MOSnextModel
Definition: mosdefs.h:274
MOSinstance * MOSinstances
Definition: mosdefs.h:276
unsigned MOSicVGSGiven
Definition: mosdefs.h:229
unsigned MOSicVDSGiven
Definition: mosdefs.h:228
int MOSsNode
Definition: mosdefs.h:27
#define OK
Definition: iferrmsg.h:17
int MOSgNode
Definition: mosdefs.h:26
double MOSicVBS
Definition: mosdefs.h:63
unsigned MOSicVBSGiven
Definition: mosdefs.h:227
int MOSgetic(GENmodel *inModel, CKTcircuit *ckt)
Definition: mosic.c:16
int MOSdNode
Definition: mosdefs.h:25
double MOSicVGS
Definition: mosdefs.h:65
static char model[32]
Definition: subckt.c:76
int MOSbNode
Definition: mosdefs.h:28
struct sMOSinstance * MOSnextInstance
Definition: mosdefs.h:20
double * CKTrhs
Definition: cktdefs.h:97
double MOSicVDS
Definition: mosdefs.h:64