1 /***************************************************************************
2 JSPICE3 adaptation of Spice3e2 - Copyright (c) Stephen R. Whiteley 1992
3 Copyright 1990 Regents of the University of California.  All rights reserved.
4 Authors: 1985 Gordon M. Jacobs
5          1992 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 #include "spice.h"
9 #include <stdio.h>
10 #include "swdefs.h"
11 #include "sperror.h"
12 #include "util.h"
13 
14 
15 int
SWmParam(param,value,inModel)16 SWmParam(param,value,inModel)
17 
18 int param;
19 IFvalue *value;
20 GENmodel *inModel;
21 {
22     SWmodel *model = (SWmodel *)inModel;
23 
24     switch (param) {
25 
26         case SW_MOD_SW:
27             /* just says that this is a switch */
28             break;
29         case SW_MOD_RON:
30             model->SWonResistance = value->rValue;
31             model->SWonConduct = 1.0/(value->rValue);
32             model->SWonGiven = TRUE;
33             break;
34         case SW_MOD_ROFF:
35             model->SWoffResistance = value->rValue;
36             model->SWoffConduct = 1.0/(value->rValue);
37             model->SWoffGiven = TRUE;
38             break;
39         case SW_MOD_VTH:
40             model->SWvThreshold = value->rValue;
41             model->SWvThreshGiven = TRUE;
42             break;
43         case SW_MOD_VHYS:
44             /* take absolute value of hysteresis voltage */
45             model->SWvHysteresis = FABS(value->rValue);
46             model->SWvHystGiven = TRUE;
47             break;
48         case SW_MOD_ITH:
49             model->SWiThreshold = value->rValue;
50             model->SWiThreshGiven = TRUE;
51             break;
52         case SW_MOD_IHYS:
53             /* take absolute value of hysteresis current */
54             model->SWiHysteresis = FABS(value->rValue);
55             model->SWiHystGiven = TRUE;
56             break;
57         default:
58             return(E_BADPARM);
59     }
60     return(OK);
61 }
62