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: 1988 Hong J. Park 5 1993 Stephen R. Whiteley 6 ****************************************************************************/ 7 8 #include "spice.h" 9 #include <stdio.h> 10 #include <math.h> 11 #include "bsim2def.h" 12 #include "sperror.h" 13 #include "util.h" 14 15 16 /*ARGSUSED*/ 17 int B2ask(ckt,inst,which,value,select)18B2ask(ckt,inst,which,value,select) 19 20 CKTcircuit *ckt; 21 GENinstance *inst; 22 int which; 23 IFvalue *value; 24 IFvalue *select; 25 { 26 B2instance *here = (B2instance*)inst; 27 28 switch (which) { 29 30 case BSIM2_L: 31 value->rValue = here->B2l; 32 break; 33 case BSIM2_W: 34 value->rValue = here->B2w; 35 break; 36 case BSIM2_AS: 37 value->rValue = here->B2sourceArea; 38 break; 39 case BSIM2_AD: 40 value->rValue = here->B2drainArea; 41 break; 42 case BSIM2_PS: 43 value->rValue = here->B2sourcePerimeter; 44 break; 45 case BSIM2_PD: 46 value->rValue = here->B2drainPerimeter; 47 break; 48 case BSIM2_NRS: 49 value->rValue = here->B2sourceSquares; 50 break; 51 case BSIM2_NRD: 52 value->rValue = here->B2drainSquares; 53 break; 54 case BSIM2_OFF: 55 value->rValue = here->B2off; 56 break; 57 case BSIM2_IC_VBS: 58 value->rValue = here->B2icVBS; 59 break; 60 case BSIM2_IC_VDS: 61 value->rValue = here->B2icVDS; 62 break; 63 case BSIM2_IC_VGS: 64 value->rValue = here->B2icVGS; 65 break; 66 case BSIM2_DNODE: 67 value->iValue = here->B2dNode; 68 break; 69 case BSIM2_GNODE: 70 value->iValue = here->B2gNode; 71 break; 72 case BSIM2_SNODE: 73 value->iValue = here->B2sNode; 74 break; 75 case BSIM2_BNODE: 76 value->iValue = here->B2bNode; 77 break; 78 case BSIM2_DNODEPRIME: 79 value->iValue = here->B2dNodePrime; 80 break; 81 case BSIM2_SNODEPRIME: 82 value->iValue = here->B2sNodePrime; 83 break; 84 case BSIM2_SOURCECONDUCT: 85 value->rValue = here->B2sourceConductance; 86 break; 87 case BSIM2_DRAINCONDUCT: 88 value->rValue = here->B2drainConductance; 89 break; 90 case BSIM2_VBD: 91 if (ckt->CKTstate0) 92 value->rValue = *(ckt->CKTstate0 + here->B2vbd); 93 break; 94 case BSIM2_VBS: 95 if (ckt->CKTstate0) 96 value->rValue = *(ckt->CKTstate0 + here->B2vbs); 97 break; 98 case BSIM2_VGS: 99 if (ckt->CKTstate0) 100 value->rValue = *(ckt->CKTstate0 + here->B2vgs); 101 break; 102 case BSIM2_VDS: 103 if (ckt->CKTstate0) 104 value->rValue = *(ckt->CKTstate0 + here->B2vds); 105 break; 106 case BSIM2_CD: 107 if (ckt->CKTstate0) 108 value->rValue = *(ckt->CKTstate0 + here->B2cd); 109 break; 110 case BSIM2_CBS: 111 if (ckt->CKTstate0) 112 value->rValue = *(ckt->CKTstate0 + here->B2cbs); 113 break; 114 case BSIM2_CBD: 115 if (ckt->CKTstate0) 116 value->rValue = *(ckt->CKTstate0 + here->B2cbd); 117 break; 118 case BSIM2_GM: 119 if (ckt->CKTstate0) 120 value->rValue = *(ckt->CKTstate0 + here->B2gm); 121 break; 122 case BSIM2_GDS: 123 if (ckt->CKTstate0) 124 value->rValue = *(ckt->CKTstate0 + here->B2gds); 125 break; 126 case BSIM2_GMBS: 127 if (ckt->CKTstate0) 128 value->rValue = *(ckt->CKTstate0 + here->B2gmbs); 129 break; 130 case BSIM2_GBD: 131 if (ckt->CKTstate0) 132 value->rValue = *(ckt->CKTstate0 + here->B2gbd); 133 break; 134 case BSIM2_GBS: 135 if (ckt->CKTstate0) 136 value->rValue = *(ckt->CKTstate0 + here->B2gbs); 137 break; 138 case BSIM2_QB: 139 if (ckt->CKTstate0) 140 value->rValue = *(ckt->CKTstate0 + here->B2qb); 141 break; 142 case BSIM2_CQB: 143 if (ckt->CKTstate0) 144 value->rValue = *(ckt->CKTstate0 + here->B2cqb); 145 break; 146 case BSIM2_QG: 147 if (ckt->CKTstate0) 148 value->rValue = *(ckt->CKTstate0 + here->B2qg); 149 break; 150 case BSIM2_CQG: 151 if (ckt->CKTstate0) 152 value->rValue = *(ckt->CKTstate0 + here->B2cqg); 153 break; 154 case BSIM2_QD: 155 if (ckt->CKTstate0) 156 value->rValue = *(ckt->CKTstate0 + here->B2qd); 157 break; 158 case BSIM2_CQD: 159 if (ckt->CKTstate0) 160 value->rValue = *(ckt->CKTstate0 + here->B2cqd); 161 break; 162 case BSIM2_CGG: 163 if (ckt->CKTstate0) 164 value->rValue = *(ckt->CKTstate0 + here->B2cggb); 165 break; 166 case BSIM2_CGD: 167 if (ckt->CKTstate0) 168 value->rValue = *(ckt->CKTstate0 + here->B2cgdb); 169 break; 170 case BSIM2_CGS: 171 if (ckt->CKTstate0) 172 value->rValue = *(ckt->CKTstate0 + here->B2cgsb); 173 break; 174 case BSIM2_CBG: 175 if (ckt->CKTstate0) 176 value->rValue = *(ckt->CKTstate0 + here->B2cbgb); 177 break; 178 case BSIM2_CAPBD: 179 if (ckt->CKTstate0) 180 value->rValue = *(ckt->CKTstate0 + here->B2capbd); 181 break; 182 case BSIM2_CQBD: 183 if (ckt->CKTstate0) 184 value->rValue = *(ckt->CKTstate0 + here->B2cqbd); 185 break; 186 case BSIM2_CAPBS: 187 if (ckt->CKTstate0) 188 value->rValue = *(ckt->CKTstate0 + here->B2capbs); 189 break; 190 case BSIM2_CQBS: 191 if (ckt->CKTstate0) 192 value->rValue = *(ckt->CKTstate0 + here->B2cqbs); 193 break; 194 case BSIM2_CDG: 195 if (ckt->CKTstate0) 196 value->rValue = *(ckt->CKTstate0 + here->B2cdgb); 197 break; 198 case BSIM2_CDD: 199 if (ckt->CKTstate0) 200 value->rValue = *(ckt->CKTstate0 + here->B2cddb); 201 break; 202 case BSIM2_CDS: 203 if (ckt->CKTstate0) 204 value->rValue = *(ckt->CKTstate0 + here->B2cdsb); 205 break; 206 case BSIM2_VON: 207 if (ckt->CKTstate0) 208 value->rValue = *(ckt->CKTstate0 + here->B2vono); 209 break; 210 case BSIM2_QBS: 211 if (ckt->CKTstate0) 212 value->rValue = *(ckt->CKTstate0 + here->B2qbs); 213 break; 214 case BSIM2_QBD: 215 if (ckt->CKTstate0) 216 value->rValue = *(ckt->CKTstate0 + here->B2qbd); 217 break; 218 default: 219 return (E_BADPARM); 220 } 221 return (OK); 222 } 223 224 225