Jspice3
capsetup.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  1992 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 #include "spice.h"
9 #include <stdio.h>
10 #include "capdefs.h"
11 #include "sperror.h"
12 #include "util.h"
13 
14 
15 /*ARGSUSED*/
16 int
17 CAPsetup(matrix,inModel,ckt,states)
18 
19 /* load the capacitor structure with those pointers needed later
20  * for fast matrix loading
21  */
22 SMPmatrix *matrix;
23 GENmodel *inModel;
24 CKTcircuit *ckt;
25 int *states;
26 {
27  CAPmodel *model = (CAPmodel*)inModel;
28  CAPinstance *here;
29 
30  /* loop through all the capacitor models */
31  for ( ; model != NULL; model = model->CAPnextModel) {
32 
33  /*Default Value Processing for Model Parameters */
34  if (!model->CAPcjGiven) {
35  model->CAPcj = 0;
36  }
37  if (!model->CAPcjswGiven){
38  model->CAPcjsw = 0;
39  }
40  if (!model->CAPdefWidthGiven) {
41  model->CAPdefWidth = 10.e-6;
42  }
43  if (!model->CAPnarrowGiven) {
44  model->CAPnarrow = 0;
45  }
46 
47  /* loop through all the instances of the model */
48  for (here = model->CAPinstances; here != NULL;
49  here = here->CAPnextInstance) {
50 
51  /* Default Value Processing for Capacitor Instance */
52  if (!here->CAPlengthGiven) {
53  here->CAPlength = 0;
54  }
55  TSTALLOC(CAPposPosptr,CAPposNode,CAPposNode)
56  TSTALLOC(CAPnegNegptr,CAPnegNode,CAPnegNode)
57  TSTALLOC(CAPposNegptr,CAPposNode,CAPnegNode)
58  TSTALLOC(CAPnegPosptr,CAPnegNode,CAPposNode)
59  here->CAPqcap = *states;
60  *states += 2;
61  }
62  }
63  return (OK);
64 }
65 
unsigned CAPnarrowGiven
Definition: capdefs.h:67
struct sCAPinstance * CAPnextInstance
Definition: capdefs.h:21
unsigned CAPdefWidthGiven
Definition: capdefs.h:66
double CAPcjsw
Definition: capdefs.h:61
unsigned CAPlengthGiven
Definition: capdefs.h:47
unsigned CAPcjGiven
Definition: capdefs.h:64
double CAPcj
Definition: capdefs.h:60
#define TSTALLOC(ptr, first, second)
Definition: devdefs.h:124
CAPinstance * CAPinstances
Definition: capdefs.h:57
#define OK
Definition: iferrmsg.h:17
double CAPnarrow
Definition: capdefs.h:63
#define NULL
Definition: spdefs.h:121
unsigned CAPcjswGiven
Definition: capdefs.h:65
double CAPlength
Definition: capdefs.h:32
double CAPdefWidth
Definition: capdefs.h:62
static char model[32]
Definition: subckt.c:76
int CAPsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
Definition: capsetup.c:17
#define SMPmatrix
Definition: smpdefs.h:11
struct sCAPmodel * CAPnextModel
Definition: capdefs.h:55