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 RES
9 #define RES
10 
11 #include "devdefs.h"
12 
13         /* definitions used to describe resistors */
14 
15 
16 /* information used to describe a single instance */
17 
18 typedef struct sRESinstance {
19     struct sRESmodel *RESmodPtr;    /* backpointer to model */
20     struct sRESinstance *RESnextInstance;   /* pointer to next instance of
21                                              * current model*/
22     IFuid RESname;  /* pointer to character string naming this instance */
23     int RESstate;   /* not used, placeholder for GENinstance */
24 
25     int RESposNode; /* number of positive node of resistor */
26     int RESnegNode; /* number of negative node of resistor */
27 
28     double REStemp;     /* temperature at which this resistor operates */
29     double RESconduct;  /* conductance at current analysis temperature */
30     double RESresist;   /* resistance at temperature Tnom */
31     double RESwidth;    /* width of the resistor */
32     double RESlength;   /* length of the resistor */
33     double *RESposPosptr;    /* pointer to sparse matrix diagonal at
34                               * (positive,positive) */
35     double *RESnegNegptr;    /* pointer to sparse matrix diagonal at
36                               * (negative,negative) */
37     double *RESposNegptr;    /* pointer to sparse matrix offdiagonal at
38                               * (positive,negative) */
39     double *RESnegPosptr;    /* pointer to sparse matrix offdiagonal at
40                               * (negative,positive) */
41     /* flag to indicate... */
42     unsigned RESresGiven    : 1;  /* resistance was specified */
43     unsigned RESwidthGiven  : 1;  /* width given */
44     unsigned RESlengthGiven : 1;  /* length given */
45     unsigned REStempGiven   : 1;  /* temperature specified */
46 
47     double RESnVar[NSTATVARS];
48 
49 } RESinstance;
50 
51 
52 /* per model data */
53 
54 typedef struct sRESmodel {     /* model structure for a resistor */
55     int RESmodType;            /* type index of this device type */
56     struct sRESmodel *RESnextModel; /* pointer to next possible model in
57                                      * linked list */
58     RESinstance *RESinstances; /* pointer to list of instances that have this
59                                 * model */
60     IFuid RESmodName;     /* pointer to character string naming this model */
61 
62     double REStnom;       /* temperature at which resistance measured */
63     double REStempCoeff1; /* first temperature coefficient of resistors */
64     double REStempCoeff2; /* second temperature coefficient of resistors */
65     double RESsheetRes;   /* sheet resistance of devices in ohms/square */
66     double RESdefWidth;   /* default width of a resistor */
67     double RESnarrow;     /* amount by which device is narrower than drawn */
68 
69     /* flag to indicate... */
70     unsigned REStnomGiven: 1;     /* nominal temp. was given */
71     unsigned REStc1Given : 1;     /* tc1 was specified */
72     unsigned REStc2Given : 1;     /* tc2 was specified */
73     unsigned RESsheetResGiven :1; /* sheet resistance given */
74     unsigned RESdefWidthGiven :1; /* default width given */
75     unsigned RESnarrowGiven   :1; /* narrow effect given */
76 } RESmodel;
77 
78 /* device parameters */
79 #define RES_RESIST      1
80 #define RES_WIDTH       2
81 #define RES_LENGTH      3
82 #define RES_CONDUCT     4
83 #define RES_CURRENT     5
84 #define RES_POWER       6
85 #define RES_TEMP        7
86 
87 /* model parameters */
88 #define RES_MOD_TC1         101
89 #define RES_MOD_TC2         102
90 #define RES_MOD_RSH         103
91 #define RES_MOD_DEFWIDTH    104
92 #define RES_MOD_NARROW      105
93 #define RES_MOD_R           106
94 #define RES_MOD_TNOM        107
95 
96 
97 #ifdef __STDC__
98 
99 extern int  RESacLoad(GENmodel*,CKTcircuit*);
100 extern int  RESask(CKTcircuit*,GENinstance*,int,IFvalue*,IFvalue*);
101 extern int  RESmAsk(CKTcircuit*,GENmodel*,int,IFvalue*);
102 extern int  RESmParam(int,IFvalue*,GENmodel*);
103 extern int  RESnoise(int,int,GENmodel*,CKTcircuit*,GENERIC*,double*);
104 extern int  RESparam(CKTcircuit*,int,IFvalue*,GENinstance*,IFvalue*);
105 extern void RESparse(int,GENERIC*,GENERIC*,GENERIC*);
106 extern int  RESpzLoad(GENmodel*,CKTcircuit*,SPcomplex*);
107 extern int  RESsetup(SMPmatrix*,GENmodel*,CKTcircuit*,int*);
108 extern int  REStemp(GENmodel*,CKTcircuit*);
109 
110 #else /* stdc */
111 
112 extern int  RESacLoad();
113 extern int  RESask();
114 extern int  RESmAsk();
115 extern int  RESmParam();
116 extern int  RESnoise();
117 extern int  RESparam();
118 extern void RESparse();
119 extern int  RESpzLoad();
120 extern int  RESsetup();
121 extern int  REStemp();
122 
123 #endif /* stdc */
124 
125 
126 #endif /*RES*/
127