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 #ifndef CAP
9 #define CAP
10 
11 
12 #include "devdefs.h"
13 
14     /* structures used to describe capacitors */
15 
16 
17 /* information to describe each instance */
18 
19 typedef struct sCAPinstance {
20     struct sCAPmodel *CAPmodPtr;    /* backpointer to model */
21     struct sCAPinstance *CAPnextInstance;  /* pointer to next instance of
22                                             * current model*/
23     IFuid CAPname;      /* pointer to character string naming this instance */
24     int CAPstate;       /* pointer to start of capacitor state vector */
25     int CAPposNode;     /* number of positive node of capacitor */
26     int CAPnegNode;     /* number of negative node of capacitor */
27     double CAPcapac;    /* capacitance */
28     double CAPinitCond; /* initial capacitor voltage if specified */
29     double CAPceq;      /* storage for ceq, rhs entry */
30     double CAPgeq;      /* stroage for geq, matrix entry */
31     double CAPwidth;    /* width of the capacitor */
32     double CAPlength;   /* length of the capacitor */
33 
34     double *CAPposPosptr;    /* pointer to sparse matrix diagonal at
35                               * (positive,positive) */
36     double *CAPnegNegptr;    /* pointer to sparse matrix diagonal at
37                               * (negative,negative) */
38     double *CAPposNegptr;    /* pointer to sparse matrix offdiagonal at
39                               * (positive,negative) */
40     double *CAPnegPosptr;    /* pointer to sparse matrix offdiagonal at
41                               * (negative,positive) */
42 
43     /* flags to indicate... */
44     unsigned CAPcapGiven    : 1; /* capacitance was specified */
45     unsigned CAPicGiven     : 1; /* init. condition was specified */
46     unsigned CAPwidthGiven  : 1; /* capacitor width given */
47     unsigned CAPlengthGiven : 1; /* capacitor length given */
48 
49 } CAPinstance;
50 
51 /* data per model */
52 
53 typedef struct sCAPmodel {      /* model structure for a capacitor */
54     int CAPmodType; /* type index of this device type */
55     struct sCAPmodel *CAPnextModel; /* pointer to next possible model in
56                                      * linked list */
57     CAPinstance * CAPinstances; /* pointer to list of instances that have this
58                                  * model */
59     IFuid CAPmodName;   /* pointer to character string naming this model */
60     double CAPcj;       /* Unit Area Capacitance ( F/ M**2 ) */
61     double CAPcjsw;     /* Unit Length Sidewall Capacitance ( F / M ) */
62     double CAPdefWidth; /* the default width of a capacitor */
63     double CAPnarrow;   /* amount by which length/width are less than drawn */
64     unsigned CAPcjGiven : 1;       /* Unit Area Capacitance ( F/ M**2 ) */
65     unsigned CAPcjswGiven : 1;     /* Unit Length Sidewall Capacitance(F/M) */
66     unsigned CAPdefWidthGiven : 1; /* flag indicates default width given*/
67     unsigned CAPnarrowGiven : 1;   /* flag indicates narrowing factor given */
68 
69 } CAPmodel;
70 
71 
72 #define CAPqcap CAPstate     /* charge on the capacitor */
73 #define CAPccap CAPstate+1   /* current through the capacitor */
74 
75 /* device parameters */
76 #define CAP_CAP      1
77 #define CAP_IC       2
78 #define CAP_WIDTH    3
79 #define CAP_LENGTH   4
80 #define CAP_CURRENT  5
81 #define CAP_POWER    6
82 
83 /* model parameters */
84 #define CAP_MOD_CJ          101
85 #define CAP_MOD_CJSW        102
86 #define CAP_MOD_DEFWIDTH    103
87 #define CAP_MOD_C           104
88 #define CAP_MOD_NARROW      105
89 
90 
91 #ifdef __STDC__
92 
93 extern int  CAPacLoad(GENmodel*,CKTcircuit*);
94 extern int  CAPask(CKTcircuit*,GENinstance*,int,IFvalue*,IFvalue*);
95 extern int  CAPgetic(GENmodel*,CKTcircuit*);
96 extern int  CAPload(GENmodel*,CKTcircuit*);
97 extern int  CAPmAsk(CKTcircuit*,GENmodel*,int,IFvalue*);
98 extern int  CAPmParam(int,IFvalue*,GENmodel*);
99 extern int  CAPparam(CKTcircuit*,int,IFvalue*,GENinstance*,IFvalue*);
100 extern void CAPparse(int,GENERIC*,GENERIC*,GENERIC*);
101 extern int  CAPpzLoad(GENmodel*,CKTcircuit*,SPcomplex*);
102 extern int  CAPsetup(SMPmatrix*,GENmodel*,CKTcircuit*,int*);
103 extern int  CAPtemp(GENmodel*,CKTcircuit*);
104 extern int  CAPtrunc(GENmodel*,CKTcircuit*,double*);
105 
106 #else /* stdc */
107 
108 extern int  CAPacLoad();
109 extern int  CAPask();
110 extern int  CAPgetic();
111 extern int  CAPload();
112 extern int  CAPmAsk();
113 extern int  CAPmParam();
114 extern int  CAPparam();
115 extern void CAPparse();
116 extern int  CAPpzLoad();
117 extern int  CAPsetup();
118 extern int  CAPtemp();
119 extern int  CAPtrunc();
120 
121 #endif /* stdc */
122 
123 
124 #endif /*CAP*/
125