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 /* 9 * This file defines the BJT data structures that are 10 * available to the next level(s) up the calling hierarchy 11 */ 12 13 #include "spice.h" 14 #include <stdio.h> 15 #include "bjtdefs.h" 16 #include "uflags.h" 17 18 static IFparm BJTpTable[] = { /* parameters */ 19 IOPU( "area", BJT_AREA, IF_REAL, "Area factor"), 20 IOPU( "off", BJT_OFF, IF_FLAG, "Device initially off"), 21 IOPAU("icvbe", BJT_IC_VBE, IF_REAL, "Initial B-E voltage"), 22 IOPAU("icvce", BJT_IC_VCE, IF_REAL, "Initial C-E voltage"), 23 IP( "ic", BJT_IC, IF_REALVEC, "Initial condition vector"), 24 IOPU( "temp", BJT_TEMP, IF_REAL, "instance temperature"), 25 26 OPU( "ft", BJT_QUEST_FT, IF_REAL,"Frequency for unity gain"), 27 28 OPU( "colnode", BJT_QUEST_COLNODE, IF_INTEGER, 29 "Number of collector node"), 30 OPU( "basenode", BJT_QUEST_BASENODE, IF_INTEGER, 31 "Number of base node"), 32 OPU( "emitnode", BJT_QUEST_EMITNODE, IF_INTEGER, 33 "Number of emitter node"), 34 OPU( "substnode", BJT_QUEST_SUBSTNODE, IF_INTEGER, 35 "Number of substrate node"), 36 OPU( "colprimenode", BJT_QUEST_COLPRIMENODE, IF_INTEGER, 37 "Internal collector node"), 38 OPU( "baseprimenode", BJT_QUEST_BASEPRIMENODE, IF_INTEGER, 39 "Internal base node"), 40 OPU( "emitprimenode", BJT_QUEST_EMITPRIMENODE, IF_INTEGER, 41 "Internal emitter node"), 42 43 OP( "vbe", BJT_QUEST_VBE, IF_REAL,"B-E voltage"), 44 OP( "vbc", BJT_QUEST_VBC, IF_REAL,"B-C voltage"), 45 OP( "ic", BJT_QUEST_CC, IF_REAL,"Current at collector node"), 46 OPR("cc", BJT_QUEST_CC, IF_REAL,"Current at collector node"), 47 OP( "ib", BJT_QUEST_CB, IF_REAL,"Current at base node"), 48 OPR("cb", BJT_QUEST_CB, IF_REAL,"Current at base node"), 49 OP( "gpi", BJT_QUEST_GPI, IF_REAL,"Small signal input conductance - pi"), 50 OP( "gmu", BJT_QUEST_GMU, IF_REAL,"Small signal conductance - mu"), 51 OP( "gm", BJT_QUEST_GM, IF_REAL,"Small signal transconductance"), 52 OP( "go", BJT_QUEST_GO, IF_REAL,"Small signal output conductance"), 53 OPU("qbe", BJT_QUEST_QBE, IF_REAL,"Charge storage B-E junction"), 54 OPU("cqbe", BJT_QUEST_CQBE, IF_REAL,"Cap. due to charge storage in B-E jct."), 55 OPU("qbc", BJT_QUEST_QBC, IF_REAL,"Charge storage B-C junction"), 56 OPU("cqbc", BJT_QUEST_CQBC, IF_REAL,"Cap. due to charge storage in B-C jct."), 57 OPU("qcs", BJT_QUEST_QCS, IF_REAL,"Charge storage C-S junction"), 58 OPU("cqcs", BJT_QUEST_CQCS, IF_REAL,"Cap. due to charge storage in C-S jct."), 59 OPU("qbx", BJT_QUEST_QBX, IF_REAL,"Charge storage B-X junction"), 60 OPU("cqbx", BJT_QUEST_CQBX, IF_REAL,"Cap. due to charge storage in B-X jct."), 61 OP( "gx", BJT_QUEST_GX, IF_REAL,"Conductance from base to internal base"), 62 OPU("cexbc",BJT_QUEST_CEXBC,IF_REAL,"Total Capacitance in B-X junction"), 63 OPU("geqcb",BJT_QUEST_GEQCB,IF_REAL,"d(Ibe)/d(Vbc)"), 64 OPU("gccs", BJT_QUEST_GCCS, IF_REAL,"Internal C-S cap. equiv. cond."), 65 OPU("geqbx",BJT_QUEST_GEQBX,IF_REAL,"Internal C-B-base cap. equiv. cond."), 66 OP( "ie", BJT_QUEST_CE, IF_REAL,"Emitter current"), 67 OPR("ce", BJT_QUEST_CE, IF_REAL,"Emitter current"), 68 OPU("is", BJT_QUEST_CS, IF_REAL,"Substrate current"), 69 OPR("cs", BJT_QUEST_CS, IF_REAL,"Substrate current"), 70 OPU("p", BJT_QUEST_POWER,IF_REAL,"Power dissipation"), 71 OP( "cpi", BJT_QUEST_CPI, IF_REAL,"Internal base to emitter capactance"), 72 OP( "cmu", BJT_QUEST_CMU, IF_REAL,"Internal base to collector capactiance"), 73 OP( "cbx", BJT_QUEST_CBX, IF_REAL,"Base to collector capacitance"), 74 OP( "ccs", BJT_QUEST_CCS, IF_REAL,"Collector to substrate capacitance") 75 }; 76 77 static IFparm BJTmPTable[] = { /* model parameters */ 78 IP ("npn", BJT_MOD_NPN, IF_FLAG, "NPN type device"), 79 IP ("pnp", BJT_MOD_PNP, IF_FLAG, "PNP type device"), 80 IOP( "is", BJT_MOD_IS, IF_REAL, "Saturation Current"), 81 IOP( "bf", BJT_MOD_BF, IF_REAL, "Ideal forward beta"), 82 IOP( "nf", BJT_MOD_NF, IF_REAL, "Forward emission coefficient"), 83 IOP( "vaf", BJT_MOD_VAF, IF_REAL, "Forward Early voltage"), 84 IOPR("va", BJT_MOD_VAF, IF_REAL, "Forward Early voltage"), 85 IOP( "ikf", BJT_MOD_IKF, IF_REAL, "Forward beta roll-off corner current"), 86 IOPR("ik", BJT_MOD_IKF, IF_REAL, "Forward beta roll-off corner current"), 87 IOP( "ise", BJT_MOD_ISE, IF_REAL, "B-E leakage saturation current"), 88 IOP( "ne", BJT_MOD_NE, IF_REAL, "B-E leakage emission coefficient"), 89 IOP( "br", BJT_MOD_BR, IF_REAL, "Ideal reverse beta"), 90 IOP( "nr", BJT_MOD_NR, IF_REAL, "Reverse emission coefficient"), 91 IOP( "var", BJT_MOD_VAR, IF_REAL, "Reverse Early voltage"), 92 IOPR("vb", BJT_MOD_VAR, IF_REAL, "Reverse Early voltage"), 93 IOP( "ikr", BJT_MOD_IKR, IF_REAL, "reverse beta roll-off corner current"), 94 IOP( "isc", BJT_MOD_ISC, IF_REAL, "B-C leakage saturation current"), 95 IOP( "nc", BJT_MOD_NC, IF_REAL, "B-C leakage emission coefficient"), 96 IOP( "rb", BJT_MOD_RB, IF_REAL, "Zero bias base resistance"), 97 IOP( "irb", BJT_MOD_IRB, IF_REAL, "Current for base resistance=(rb+rbm)/2"), 98 IOP( "rbm", BJT_MOD_RBM, IF_REAL, "Minimum base resistance"), 99 IOP( "re", BJT_MOD_RE, IF_REAL, "Emitter resistance"), 100 IOP( "rc", BJT_MOD_RC, IF_REAL, "Collector resistance"), 101 IOPA("cje", BJT_MOD_CJE, IF_REAL, "Zero bias B-E depletion capacitance"), 102 IOPA("vje", BJT_MOD_VJE, IF_REAL, "B-E built in potential"), 103 IOPR("pe", BJT_MOD_VJE, IF_REAL, "B-E built in potential"), 104 IOPA("mje", BJT_MOD_MJE, IF_REAL, "B-E junction grading coefficient"), 105 IOPR("me", BJT_MOD_MJE, IF_REAL, "B-E junction grading coefficient"), 106 IOPA("tf", BJT_MOD_TF, IF_REAL, "Ideal forward transit time"), 107 IOPA("xtf", BJT_MOD_XTF, IF_REAL, "Coefficient for bias dependence of TF"), 108 IOPA("vtf", BJT_MOD_VTF, IF_REAL, "Voltage giving VBC dependence of TF"), 109 IOPA("itf", BJT_MOD_ITF, IF_REAL, "High current dependence of TF"), 110 IOPA("ptf", BJT_MOD_PTF, IF_REAL, "Excess phase"), 111 IOPA("cjc", BJT_MOD_CJC, IF_REAL, "Zero bias B-C depletion capacitance"), 112 IOPA("vjc", BJT_MOD_VJC, IF_REAL, "B-C built in potential"), 113 IOPR("pc", BJT_MOD_VJC, IF_REAL, "B-C built in potential"), 114 IOPA("mjc", BJT_MOD_MJC, IF_REAL, "B-C junction grading coefficient"), 115 IOPR("mc", BJT_MOD_MJC, IF_REAL, "B-C junction grading coefficient"), 116 IOPA("xcjc",BJT_MOD_XCJC,IF_REAL, "Fraction of B-C cap to internal base"), 117 IOPA("tr", BJT_MOD_TR, IF_REAL, "Ideal reverse transit time"), 118 IOPA("cjs", BJT_MOD_CJS, IF_REAL, "Zero bias C-S capacitance"), 119 IOPA("ccs", BJT_MOD_CJS, IF_REAL, "Zero bias C-S capacitance"), 120 IOPA("vjs", BJT_MOD_VJS, IF_REAL, "Substrate junction built in potential"), 121 IOPR("ps", BJT_MOD_VJS, IF_REAL, "Substrate junction built in potential"), 122 IOPA("mjs", BJT_MOD_MJS, IF_REAL, "Substrate junction grading coefficient"), 123 IOPR("ms", BJT_MOD_MJS, IF_REAL, "Substrate junction grading coefficient"), 124 IOP( "xtb", BJT_MOD_XTB, IF_REAL, "Forward and reverse beta temp. exp."), 125 IOP( "eg", BJT_MOD_EG, IF_REAL, "Energy gap for IS temp. dependency"), 126 IOP( "xti", BJT_MOD_XTI, IF_REAL, "Temp. exponent for IS"), 127 IOP( "fc", BJT_MOD_FC, IF_REAL, "Forward bias junction fit parameter"), 128 IP( "tnom",BJT_MOD_TNOM,IF_REAL, "Parameter measurement temperature"), 129 IP( "kf", BJT_MOD_KF, IF_REAL, "Flicker Noise Coefficient"), 130 IP( "af", BJT_MOD_AF, IF_REAL, "Flicker Noise Exponent"), 131 132 OPU( "invearlyvoltf", BJT_MOD_INVEARLYF, IF_REAL, 133 "Inverse early voltage:forward"), 134 OPU( "invearlyvoltr", BJT_MOD_INVEARLYR, IF_REAL, 135 "Inverse early voltage:reverse"), 136 OPU( "invrollofff", BJT_MOD_INVROLLOFFF, IF_REAL, 137 "Inverse roll off - forward"), 138 OPU( "invrolloffr", BJT_MOD_INVROLLOFFR, IF_REAL, 139 "Inverse roll off - reverse"), 140 OPU( "collectorconduct", BJT_MOD_COLCONDUCT, IF_REAL, 141 "Collector conductance"), 142 OPU( "emitterconduct", BJT_MOD_EMITTERCONDUCT,IF_REAL, 143 "Emitter conductance"), 144 OPU( "transtimevbcfact", BJT_MOD_TRANSVBCFACT, IF_REAL, 145 "Transit time VBC factor"), 146 OPU( "excessphasefactor",BJT_MOD_EXCESSPHASEFACTOR,IF_REAL, 147 "Excess phase fact."), 148 OP( "type",BJT_MOD_TYPE,IF_STRING, "NPN or PNP") 149 }; 150 151 static char *BJTnames[] = { 152 "collector", 153 "base", 154 "emitter", 155 "substrate" 156 }; 157 158 static char *BJTmodNames[] = { 159 "npn", 160 "pnp", 161 NULL 162 }; 163 164 static IFkeys BJTkeys[] = { 165 { 'q', NUMELEMS(BJTnames), BJTnames, 1, 0 }, 166 }; 167 168 169 static int BJTkSize = NUMELEMS(BJTkeys); 170 static int BJTpTSize = NUMELEMS(BJTpTable); 171 static int BJTmPTSize = NUMELEMS(BJTmPTable); 172 static int BJTiSize = sizeof(BJTinstance); 173 static int BJTmSize = sizeof(BJTmodel); 174 175 176 SPICEdev BJTinfo = { 177 { "BJT", 178 "Bipolar Junction Transistor", 179 180 &BJTkSize, 181 BJTkeys, 182 1, 183 BJTmodNames, 184 BJTparse, 185 186 &BJTpTSize, 187 BJTpTable, 188 189 &BJTmPTSize, 190 BJTmPTable 191 }, 192 193 BJTparam, 194 BJTmParam, 195 BJTload, 196 BJTsetup, 197 BJTsetup, 198 BJTtemp, 199 BJTtrunc, 200 NULL, 201 BJTacLoad, 202 NULL, 203 GENdestroy, 204 GENmDelete, 205 GENdelete, 206 BJTgetic, 207 BJTask, 208 BJTmAsk, 209 BJTpzLoad, 210 BJTconvTest, 211 BJTdisto, 212 BJTnoise, 213 214 &BJTiSize, 215 &BJTmSize 216 }; 217