// // Verilog-A definition of VBIC // // Version: 1.2 // Revision: 1.1 // // 1. Functions redefined to work properly in Verilog-A, previously // they were substituted by special code to generate .va files // without function calls. // 2. Noise declarations added, consistent with 1.1.5 version. // 3. qb and qbp calculations protected from having argument of the // square-root go less than zero (this required very unusual // conditions and parameters to occur, and needless to say // this happened some times). // 4. Parameter names changed to lower case, this is what they are // in simulator implementations. // 5. log mapped to ln, this was done in generated code, but in // Verilog-A log is log_10, not log_e. // 6. The avalanche function was modified to protect against // numerical problems for forward and low reverse bias. // 7. Hard limits on the local temperature were added. This is // required to avoid numerical problems. // 8. The excess phase network has been defined in a simpler // manner, but is exactly equivalent to the previous version. // It is now done without an inductor. This is the transformation: // Itzf-V(xf2)-j*w*C*V(xf1)=0 // j*w*L*V(xf2)+V(xf2)-V(xf1)=0 // where C=TD and L=TD/3 is what was done. // Itzf=V(xf2)+j*w*TD*V(xf1) // V(xf1)=j*w*(TD/3)*V(xf2)+V(xf2) // node xf1: two VCCS (Itzf, V(xf2)) plus TD capacitor // node xf2: one VCCS (V(xf1)), TD/3 capacitor, 1Ohm resistor // 9. gmin added explicitly // 10. pnjmaxi added explicitly, diode type currents linearized // for values greater than pnjmaxi // 11. Fixed implementation of shrink factors // `include "discipline.h" `ifdef insideADMS `define P(prop) (* prop *) `define PGIVEN(p) $given(p) `define GMIN $options("OPTgmin") `define PNJMAXI $options("OPTpnjmaxi") `define SHRINKL $shrinkl("q") `define SHRINKA $shrinka("q") `define SCALE $scale `define DERIVATE(x,y) $derivate(x,y) `define INITIAL_MODEL @(initial_model) `define INITIAL_INSTANCE @(initial_instance) `define FINAL_STEP `else `define P(prop) `define PGIVEN(p) p `define GMIN gmin `define PNJMAXI pnjmaxi `define SHRINKL 1.0 `define SHRINKA 1.0 `define SCALE 1.0 `define DERIVATE(x,y) 1.0 `define INITIAL_MODEL @(initial_step("op","dc","ac","noise")) `define INITIAL_INSTANCE @(initial_step("op","dc","ac","noise")) `define FINAL_STEP @(final_step) `endif `define KB 1.380662e-23 // Boltzmann constant (J/K) `define QQ 1.602189e-19 // mag. of electronic charge (C) `define TABS 2.731500e+02 // 0C in K `define NPN +1 `define PNP -1 `define expLinA(expv,V,Vmax,a) \ if (V0.0) begin \ pwq = pow((1.0-FC),(-1.0-M)); \ qlo = P*(1.0-pwq*(1.0-FC)*(1.0-FC))/(1.0-M); \ qhi = dvh*(1.0-FC+0.5*M*dvh/P)*pwq; \ end else begin \ qlo = P*(1.0-pow((1.0-V/P),(1.0-M)))/(1.0-M); \ qhi = 0.0; \ end \ qj = qlo+qhi; \ end else begin \ mv0 = sqrt(dv0*dv0+4*A*A); \ vl0 = -0.5*(dv0+mv0); \ q0 = -P*pow((1.0-vl0/P),(1.0-M))/(1.0-M); \ dv = V+dv0; \ mv = sqrt(dv*dv+4*A*A); \ vl = 0.5*(dv-mv)-dv0; \ qlo = -P*pow((1.0-vl/P),(1.0-M))/(1.0-M); \ qj = qlo+pow((1.0-FC),(-M))*(V-vl+vl0)-q0; \ end `define qjrt(qj,V,P,M,FC,A,VRT,ART) \ dv0 = -P*FC; \ if (A<=0.0) begin \ dvh = V+dv0; \ if (dvh>0.0) begin \ pwq = pow((1.0-FC),(-1.0-M)); \ qlo = P*(1.0-pwq*(1.0-FC)*(1.0-FC))/(1.0-M); \ qhi = dvh*(1.0-FC+0.5*M*dvh/P)*pwq; \ end else begin \ if ((VRT>0.0)&&(V<-VRT)) begin \ qlo = P*(1.0-pow((1.0+VRT/P),(1.0-M))*(1.0-((1.0-M)*(V+VRT))/(P+VRT)))/(1.0-M); \ end else begin \ qlo = P*(1.0-pow((1.0-V/P),(1.0-M)))/(1.0-M); \ end \ qhi = 0.0; \ end \ qj = qlo+qhi; \ end else begin \ if ((VRT>0.0)&&(ART>0.0)) begin \ vn0 = (VRT+dv0)/(VRT-dv0); \ vnl0 = 2.0*vn0/(sqrt((vn0-1.0)*(vn0-1)+4*A*A)+sqrt((vn0+1.0)*(vn0+1)+4*ART*ART)); \ vl0 = 0.5*(vnl0*(VRT-dv0)-VRT-dv0); \ qlo0 = P*(1.0-pow((1.0-vl0/P),(1.0-M)))/(1.0-M); \ vn = (2*V+VRT+dv0)/(VRT-dv0); \ vnl = 2.0*vn/(sqrt((vn-1.0)*(vn-1)+4*A*A)+sqrt((vn+1.0)*(vn+1)+4*ART*ART)); \ vl = 0.5*(vnl*(VRT-dv0)-VRT-dv0); \ qlo = P*(1.0-pow((1.0-vl/P),(1.0-M)))/(1.0-M); \ sel = 0.5*(vnl+1.0); \ crt = pow((1.0+VRT/P),(-M)); \ cmx = pow((1.0+dv0/P),(-M)); \ cl = (1.0-sel)*crt+sel*cmx; \ ql = (V-vl+vl0)*cl; \ qj = ql+qlo-qlo0; \ end else begin \ mv0 = sqrt(dv0*dv0+4*A*A); \ vl0 = -0.5*(dv0+mv0); \ q0 = -P*pow((1.0-vl0/P),(1.0-M))/(1.0-M); \ dv = V+dv0; \ mv = sqrt(dv*dv+4*A*A); \ vl = 0.5*(dv-mv)-dv0; \ qlo = -P*pow((1.0-vl/P),(1.0-M))/(1.0-M); \ qj = qlo+pow((1.0-FC),(-M))*(V-vl+vl0)-q0; \ end \ end `define avalm(avalm,V,P,M,AV1,AV2,VmaxExp) \ vminm = pow((0.02*(AV2+1.0)),(1.0/(1.01-M))); \ vl = 0.5*(sqrt((P-V-vminm)*(P-V-vminm)+0.01)+(P-V-vminm))+vminm; \ mac1 = -AV2*pow(vl,(M-1.0)); \ if (mac1tmax) Tdev = tmax; Tdev = Tdev+`TABS; Vtv = `KB*Tdev/`QQ; rT = Tdev/Tini; dT = Tdev-Tini; ikf_t = ikf*pow(rT,xikf); if (`PGIVEN(xrcx)) rcx_t = rcx*pow(rT,xrcx); else rcx_t = rcx*pow(rT,xrc); if (`PGIVEN(xrci)) rci_t = rci*pow(rT,xrci); else rci_t = rci*pow(rT,xrc); if (`PGIVEN(xrbx)) rbx_t = rbx*pow(rT,xrbx); else rbx_t = rbx*pow(rT,xrb); if (`PGIVEN(xrbi)) rbi_t = rbi*pow(rT,xrbi); else rbi_t = rbi*pow(rT,xrb); re_t = re*pow(rT,xre); rs_t = rs*pow(rT,xrs); if (`PGIVEN(xrbp)) rbp_t = rbp*pow(rT,xrbp); else rbp_t = rbp*pow(rT,xrc); is_t = is*pow((pow(rT,xis)*exp(-ea*(1.0-rT)/Vtv)),(1.0/nf)); isrr_t = isrr*pow((pow(rT,xisr)*exp(-dear*(1.0-rT)/Vtv)),(1.0/nr)); isp_t = isp*pow((pow(rT,xis)*exp(-eap*(1.0-rT)/Vtv)),(1.0/nfp)); ibei_t = ibei*pow((pow(rT,xii)*exp(-eaie*(1.0-rT)/Vtv)),(1.0/nei)); iben_t = iben*pow((pow(rT,xin)*exp(-eane*(1.0-rT)/Vtv)),(1.0/nen)); ibci_t = ibci*pow((pow(rT,xii)*exp(-eaic*(1.0-rT)/Vtv)),(1.0/nci)); ibcn_t = ibcn*pow((pow(rT,xin)*exp(-eanc*(1.0-rT)/Vtv)),(1.0/ncn)); ibeip_t = ibeip*pow((pow(rT,xii)*exp(-eaic*(1.0-rT)/Vtv)),(1.0/nci)); ibenp_t = ibenp*pow((pow(rT,xin)*exp(-eanc*(1.0-rT)/Vtv)),(1.0/ncn)); ibcip_t = ibcip*pow((pow(rT,xii)*exp(-eais*(1.0-rT)/Vtv)),(1.0/ncip)); ibcnp_t = ibcnp*pow((pow(rT,xin)*exp(-eans*(1.0-rT)/Vtv)),(1.0/ncnp)); nf_t = nf*(1.0+dT*tnf); nr_t = nr*(1.0+dT*tnf); avc2_t = avc2*(1.0+dT*tavc); vbbe_t = vbbe*(1.0+dT*(tvbbe1+dT*tvbbe2)); nbbe_t = nbbe*(1.0+dT*tnbbe); `psibi(pe_t,pe,eaie,Vtv,rT); `psibi(pc_t,pc,eaic,Vtv,rT); `psibi(ps_t,ps,eais,Vtv,rT); cje_t = cje*pow(pe/pe_t,me); cjc_t = cjc*pow(pc/pc_t,mc); cjep_t = cjep*pow(pc/pc_t,mc); cjcp_t = cjcp*pow(ps/ps_t,ms); gamm_t = gamm*pow(rT,xis)*exp(-ea*(1.0-rT)/Vtv); vo_t = vo*pow(rT,xvo); ebbe_t = exp(-vbbe_t/(nbbe_t*Vtv)); if (ibbe>0.0) maxvIbbe= nbbe_t*Vtv*ln(ebbe_t+`PNJMAXI/ibbe); else maxvIbbe= 0.0; if (is_t>0.0) maxvIfi = nf_t*Vtv*ln(1.0+`PNJMAXI/is_t); else maxvIfi = 0.0; if (is_t>0.0&&isrr_t>0.0) maxvIri = nr_t*Vtv*ln(1.0+`PNJMAXI/(is_t*isrr_t)); else maxvIri = 0.0; if (isp_t>0.0) maxvIp = nfp*Vtv*ln(1.0+`PNJMAXI/isp_t); else maxvIp = 0.0; if (ibei_t>0.0) maxvIbei= nei*Vtv*ln(1.0+`PNJMAXI/ibei_t); else maxvIbei= 0.0; if (iben_t>0.0) maxvIben= nen*Vtv*ln(1.0+`PNJMAXI/iben_t); else maxvIben= 0.0; if (ibci_t>0.0) maxvIbci= nci*Vtv*ln(1.0+`PNJMAXI/ibci_t); else maxvIbci= 0.0; if (ibcn_t>0.0) maxvIbcn= ncn*Vtv*ln(1.0+`PNJMAXI/ibcn_t); else maxvIbcn= 0.0; if (ibeip_t>0.0) maxvIbeip= nci*Vtv*ln(1.0+`PNJMAXI/ibeip_t); else maxvIbeip= 0.0; if (ibenp_t>0.0) maxvIbenp= ncn*Vtv*ln(1.0+`PNJMAXI/ibenp_t); else maxvIbenp= 0.0; if (ibcip_t>0.0) maxvIbcip= ncip*Vtv*ln(1.0+`PNJMAXI/ibcip_t); else maxvIbcip= 0.0; if (ibcnp_t>0.0) maxvIbcnp= ncnp*Vtv*ln(1.0+`PNJMAXI/ibcnp_t); else maxvIbcnp= 0.0; VmaxExp = ln(maxexp); // // Parameter mappings // Gcx = rcx_t>1.0e-3 ? 1.0/rcx_t : 1.0e3; Gci = rci_t>1.0e-3 ? 1.0/rci_t : 1.0e3; Gbx = rbx_t>1.0e-3 ? 1.0/rbx_t : 1.0e3; Gbi = rbi_t>1.0e-3 ? 1.0/rbi_t : 1.0e3; Ge = re_t >1.0e-3 ? 1.0/re_t : 1.0e3; Gbp = rbp_t>1.0e-3 ? 1.0/rbp_t : 1.0e3; Gs = rs_t >1.0e-3 ? 1.0/rs_t : 1.0e3; Gth = rth >1.0e-3 ? 1.0/rth : 1.0e3; Ivef = vef >0.0 ? 1.0/vef : 0.0; Iver = ver >0.0 ? 1.0/ver : 0.0; Iikf = ikf >0.0 ? 1.0/ikf_t : 0.0; Iikr = ikr >0.0 ? 1.0/ikr : 0.0; Iikp = ikp >0.0 ? 1.0/ikp : 0.0; Ivo = vo >0.0 ? 1.0/vo_t : 0.0; Ihrcf = hrcf >0.0 ? 1.0/hrcf : 0.0; Ivtf = vtf >0.0 ? 1.0/vtf : 0.0; Iitf = itf >0.0 ? 1.0/itf : 0.0; sltf = itf >0.0 ? 0.0 : 1.0; // // Branch voltages // Vbei = VBICtype*V(b_bei); Vbex = VBICtype*V(b_bex); Vbci = VBICtype*V(b_bci); Vbcx = VBICtype*V(b_bcx); Vcei = VBICtype*V(b_cei); Vbep = VBICtype*V(b_bep); Vbcp = VBICtype*V(b_bcp); Vcep = VBICtype*V(b_cep); Vxf1 = V(b_xf1); Vxf2 = V(b_xf2); Vbe = V(b_be); Vbc = V(b_bc); Vrcx = V(b_rcx); Vrci = VBICtype*V(b_rci); Vrbx = V(b_rbx); Vrbi = V(b_rbi); Vre = V(b_re); Vrbp = V(b_rbp); Vrs = V(b_rs); // // Electrical branch constituent relations // // // Depletion charges // `qj(qdbe,Vbei,pe_t,me,fc,aje); `qj(qdbex,Vbex,pe_t,me,fc,aje); `qjrt(qdbc,Vbci,pc_t,mc,fc,ajc,vrt,art); `qjrt(qdbep,Vbep,pc_t,mc,fc,ajc,vrt,art); if (cjcp>0.0) begin `qj(qdbcp,Vbcp,ps_t,ms,fc,ajs); end else qdbcp = 0.0; // // Transport current of main transistor // afac = 1.0/(nf_t*Vtv); `expLinA(expi,Vbei,maxvIfi,afac); Ifi = is_t*(expi-1.0); afac = 1.0/(nr_t*Vtv); `expLinA(expi,Vbci,maxvIri,afac); Iri = is_t*isrr_t*(expi-1.0); q1z = 1.0+qdbe*Iver+qdbc*Ivef; q1 = 0.5*(sqrt((q1z-1.0e-4)*(q1z-1.0e-4)+1.0e-8)+q1z-1.0e-4)+1.0e-4; q2 = Ifi*Iikf+Iri*Iikr; if (qbm<0.5) begin arg = pow(q1,1.0/nkf)+4.0*q2; if (arg>1.0e-8) qb = 0.5*(q1+pow(arg,nkf)); else qb = 0.5*(q1+pow(1.0e-8,nkf)); end else begin arg = 1.0+4.0*q2; if (arg>1.0e-8) qb = 0.5*q1*(1.0+pow(arg,nkf)); else qb = 0.5*q1*(1.0+pow(1.0e-8,nkf)); end Itzr = Iri/qb; Itzf = Ifi/qb; Itxf = Vxf2; // // Transport current of parasitic transistor // if (isp>0.0) begin afac = 1.0/(nfp*Vtv); `expLinA(expi,Vbep,maxvIp,afac); `expLinA(expx,Vbci,maxvIp,afac); Ifp = isp_t*(wsp*expi+(1.0-wsp)*expx-1.0); q2p = Ifp*Iikp; arg = 1.0+4.0*q2p; if (arg>1.0e-8) qbp = 0.5*(1.0+sqrt(arg)); else qbp = 0.5*(1.0+sqrt(1.0e-8)); `expLinA(expi,Vbcp,maxvIp,afac); Irp = isp_t*(expi-1.0); Iccp = (Ifp-Irp)/qbp; end else begin Ifp = 0.0; qbp = 1.0; Iccp = 0.0; end // // Diode-like currents for main transistor (includes // exponential-like breakdown for base-emitter) // and base-emitter of parasitic transistor // if (wbe==1.0) begin afac = 1.0/(nei*Vtv); `expLinA(expi,Vbei,maxvIbei,afac); afac = 1.0/(nen*Vtv); `expLinA(expn,Vbei,maxvIben,afac); if (vbbe>0.0) begin Bvbe = -vbbe_t-Vbei; afac = 1.0/(nbbe_t*Vtv); `expLinA(expx,Bvbe,maxvIbbe,afac); Ibe = ibei_t*(expi-1.0)+iben_t*(expn-1.0)-ibbe*(expx-ebbe_t); end else Ibe = ibei_t*(expi-1.0)+iben_t*(expn-1.0); Ibex = 0.0; end else if (wbe==0.0) begin Ibe = 0.0; afac = 1.0/(nei*Vtv); `expLinA(expi,Vbex,maxvIbei,afac); afac = 1.0/(nen*Vtv); `expLinA(expn,Vbex,maxvIben,afac); if (vbbe>0.0) begin Bvbe = -vbbe_t-Vbei; afac = 1.0/(nbbe_t*Vtv); `expLinA(expx,Bvbe,maxvIbbe,afac); Ibex = ibei_t*(expi-1.0)+iben_t*(expn-1.0)-ibbe*(expx-ebbe_t); end else Ibex = ibei_t*(expi-1.0)+iben_t*(expn-1.0); end else begin afac = 1.0/(nei*Vtv); `expLinA(expi,Vbei,maxvIbei,afac); afac = 1.0/(nen*Vtv); `expLinA(expn,Vbei,maxvIben,afac); if (vbbe>0.0) begin Bvbe = -vbbe_t-Vbei; afac = 1.0/(nbbe_t*Vtv); `expLinA(expx,Bvbe,maxvIbbe,afac); Ibe = wbe*(ibei_t*(expi-1.0)+iben_t*(expn-1.0)-ibbe*(expx-ebbe_t)); end else Ibe = wbe*(ibei_t*(expi-1.0)+iben_t*(expn-1.0)); afac = 1.0/(nei*Vtv); `expLinA(expi,Vbex,maxvIbei,afac); afac = 1.0/(nen*Vtv); `expLinA(expn,Vbex,maxvIben,afac); if (vbbe>0.0) begin Bvbe = -vbbe_t-Vbei; afac = 1.0/(nbbe_t*Vtv); `expLinA(expx,Bvbe,maxvIbbe,afac); Ibex = (1.0-wbe)*(ibei_t*(expi-1.0)+iben_t*(expn-1.0)-ibbe*(expx-ebbe_t)); end else Ibex = (1.0-wbe)*(ibei_t*(expi-1.0)+iben_t*(expn-1.0)); end afac = 1.0/(nci*Vtv); `expLinA(expi,Vbci,maxvIbci,afac); afac = 1.0/(ncn*Vtv); `expLinA(expn,Vbci,maxvIbcn,afac); Ibcj = ibci_t*(expi-1.0)+ibcn_t*(expn-1.0); if ((ibeip>0.0)||(ibenp>0.0)) begin afac = 1.0/(nci*Vtv); `expLinA(expi,Vbep,maxvIbeip,afac); afac = 1.0/(ncn*Vtv); `expLinA(expn,Vbep,maxvIbenp,afac); Ibep = ibeip_t*(expi-1.0)+ibenp_t*(expn-1.0); end else Ibep = 0.0; // // Avalanche current // if (avc1>0.0) begin `avalm(avalf,Vbci,pc_t,mc,avc1,avc2_t,VmaxExp); Igc = (Itxf-Itzr-Ibcj)*avalf; end else Igc = 0.0; Ibc = Ibcj-Igc; // // Base pushout charge factors // arg = Vbci/Vtv; `expLin(expi,arg,VmaxExp); arg = Vbcx/Vtv; `expLin(expx,arg,VmaxExp); Kbci = sqrt(1.0+gamm_t*expi); Kbcx = sqrt(1.0+gamm_t*expx); // // Diode-like current for base-collector of parasitic transistor // if ((ibcip>0.0)||(ibcnp>0.0)) begin afac = 1.0/(ncip*Vtv); `expLinA(expi,Vbcp,maxvIbcip,afac); afac = 1.0/(ncnp*Vtv); `expLinA(expn,Vbcp,maxvIbcnp,afac); Ibcp = ibcip_t*(expi-1.0)+ibcnp_t*(expn-1.0); end else Ibcp = 0.0; // // Transit time // sgIf = Ifi>0.0?1.0:0.0; rIf = Ifi*sgIf*Iitf; mIf = rIf/(rIf+1.0); arg = Vbci*Ivtf/1.44; `expLin(expi,arg,VmaxExp); tff = tf*(1.0+qtf*q1)*(1.0+xtf*expi*(sltf+mIf*mIf)*sgIf); // // Charge elements // Qbe = cje_t*qdbe*wbe+tff*Ifi/qb; Qbex = cje_t*qdbex*(1.0-wbe); Qbc = cjc_t*qdbc+tr*Iri+qco*Kbci; Qbcx = qco*Kbcx; Qbep = cjep_t*qdbep+tr*Ifp; Qbcp = cjcp_t*qdbcp+ccso*Vbcp; Qbeo = Vbe*cbeo; Qbco = Vbc*cbco; // // Resistance branch currents // Ircx = Vrcx*Gcx; rKp1 = (Kbci+1.0)/(Kbcx+1.0); Iohm = (Vrci+Vtv*(Kbci-Kbcx-ln(rKp1)))*Gci; derf = Ivo*Iohm/(Gci*(1.0+0.5*Ivo*Ihrcf*sqrt(Vrci*Vrci+0.01))); Irci = Iohm/sqrt(1+derf*derf); Irbx = Vrbx*Gbx; Irbi = Vrbi*qb*Gbi; Ire = Vre*Ge; Irbp = Vrbp*qbp*Gbp; Irs = Vrs*Gs; // // Thermal network elements // Ith = -(Ibe*Vbei+Ibc*Vbci+(Itxf-Itzr)*Vcei+Ibex*Vbex+Ibep*Vbep+Irs*Vrs+Ibcp*Vbcp+Iccp*Vcep+Ircx*Vrcx+Irci*Vrci+Irbx*Vrbx+Irbi*Vrbi+Ire*Vre+Irbp*Vrbp); Irth = Vrth*Gth; Qcth = Vrth*cth; // // Excess phase elements // Ixf1 = Vxf2-Itzf; Ixf2 = Vxf2-Vxf1; Qxf1 = td*Vxf1; Qxf2 = td*Vxf2/3; // // Add gmin current to diode-like branches // Ibe = Ibe + `GMIN * Vbei; Ibex = Ibex + `GMIN * Vbex; Ibep = Ibep + `GMIN * Vbep; Ibc = Ibc + `GMIN * Vbci; Ibcp = Ibcp + `GMIN * Vbcp; // // Apply multiplicity factor and device type (+1 or -1, polarity) // (resistors apart from Irci do not depend on polarity) // Ibe = VBICtype * meff * Ibe; Ibex = VBICtype * meff * Ibex; Itzf = VBICtype * meff * Itzf; Itxf = VBICtype * meff * Itxf; Itzr = VBICtype * meff * Itzr; Ibc = VBICtype * meff * Ibc; Ibep = VBICtype * meff * Ibep; Ircx = meff * Ircx; Irci = VBICtype * meff * Irci; Irbx = meff * Irbx; Irbi = meff * Irbi; Ire = meff * Ire; Irbp = meff * Irbp; Qbe = VBICtype * meff * Qbe; Qbex = VBICtype * meff * Qbex; Qbc = VBICtype * meff * Qbc; Qbcx = VBICtype * meff * Qbcx; Qbep = VBICtype * meff * Qbep; Qbeo = meff * Qbeo; Qbco = meff * Qbco; Ibcp = VBICtype * meff * Ibcp; Iccp = VBICtype * meff * Iccp; Irs = meff * Irs; Qbcp = VBICtype * meff * Qbcp; Ith = meff * Ith; Irth = meff * Irth; Qcth = meff * Qcth; // // Branch contributions to VBIC model // I(b_bei) <+ Ibe; I(b_bex) <+ Ibex; I(b_cei) <+ Itxf; I(b_eci) <+ Itzr; I(b_bci) <+ Ibc; I(b_bep) <+ Ibep; I(b_rcx) <+ Ircx; I(b_rci) <+ Irci; I(b_rbx) <+ Irbx; I(b_rbi) <+ Irbi; I(b_re) <+ Ire; I(b_rbp) <+ Irbp; I(b_bei) <+ ddt(Qbe); I(b_bex) <+ ddt(Qbex); I(b_bci) <+ ddt(Qbc); I(b_bcx) <+ ddt(Qbcx); I(b_bep) <+ ddt(Qbep); I(b_be) <+ ddt(Qbeo); I(b_bc) <+ ddt(Qbco); I(b_bcp) <+ Ibcp; I(b_cep) <+ Iccp; I(b_rs) <+ Irs; I(b_bcp) <+ ddt(Qbcp); I(b_xf1) <+ Ixf1; I(c_xf1) <+ ddt(Qxf1); I(b_xf2) <+ Ixf2; I(c_xf2) <+ ddt(Qxf2); I(b_rth) <+ Irth; I(b_rth) <+ ddt(Qcth); I(b_ith) <+ Ith; `ifdef insideADMS `else // begin // begin noise block I(b_bei) <+ white_noise(2*`QQ*abs(Ibe))+flicker_noise(meff*kfn*pow(abs(Ibe/meff),afn),bfn); I(b_bex) <+ white_noise(2*`QQ*abs(Ibex))+flicker_noise(meff*kfn*pow(abs(Ibex/meff),afn),bfn); I(b_cei) <+ white_noise(2*`QQ*abs(Itzf)); I(b_bep) <+ white_noise(2*`QQ*abs(Ibep))+flicker_noise(meff*kfn*pow(abs(Ibep/meff),afn),bfn); I(b_rcx) <+ white_noise(4*`KB*Tdev*Gcx*meff); I(b_rci) <+ white_noise(4*`KB*Tdev*((abs(Irci)+1.0e-10*Gci)/(abs(Vrci)+1.0e-10))*meff); I(b_rbx) <+ white_noise(4*`KB*Tdev*Gbx*meff); I(b_rbi) <+ white_noise(4*`KB*Tdev*qb*Gbi*meff); I(b_re) <+ white_noise(4*`KB*Tdev*Ge*meff); I(b_rbp) <+ white_noise(4*`KB*Tdev*qbp*Gbp*meff); I(b_cep) <+ white_noise(2*`QQ*abs(Iccp)); I(b_rs) <+ white_noise(4*`KB*Tdev*Gs*meff); end // end noise block // `endif `FINAL_STEP begin // conductances of resistance elements Ircx_Vrcx = `DERIVATE(Ircx,V(b_rcx)); Irci_Vrci = `DERIVATE(Irci,V(b_rci)); Irbx_Vrbx = `DERIVATE(Irbx,V(b_rbx)); Irbi_Vrbi = `DERIVATE(Irbi,V(b_rbi)); Irbp_Vrbp = `DERIVATE(Irbp,V(b_rbp)); Ire_Vre = `DERIVATE(Ire,V(b_re)); Irs_Vrs = `DERIVATE(Irs,V(b_rs)); // conductances gm = `DERIVATE(Itzf,V(b_bei))+`DERIVATE(Itzf,V(b_bci))-`DERIVATE(Itzr,V(b_bei))-`DERIVATE(Itzr,V(b_bci)); go = `DERIVATE(Itzr,V(b_bci))-`DERIVATE(Itzf,V(b_bci)); gpi = `DERIVATE(Ibe,V(b_bei)); gpix = `DERIVATE(Ibex,V(b_bex)); gmu = `DERIVATE(Ibc,V(b_bci)); gmux = `DERIVATE(Ibep,V(b_bep)); // conductances (for backward compatibility with level 2) ibc_vbci = gmu; ibcp_vbcp = `DERIVATE(Ibcp,V(b_bcp)); ibe_vbei = gpi; ibep_vbep = gmux; ibex_vbex = gpix; iccp_vbci = `DERIVATE(Iccp,V(b_bci)); iccp_vbcp = `DERIVATE(Iccp,V(b_bcp)); iccp_vbep = `DERIVATE(Iccp,V(b_bep)); irbi_vbci = `DERIVATE(Irbi,V(b_bci)); irbi_vbei = `DERIVATE(Irbi,V(b_bei)); irbp_vbci = `DERIVATE(Irbp,V(b_bci)); irci_vbci = `DERIVATE(Irci,V(b_bci)); itzf_vbci = `DERIVATE(Itzf,V(b_bci)); itzf_vbei = `DERIVATE(Itzf,V(b_bei)); itzr_vbci = `DERIVATE(Itzr,V(b_bci)); itzr_vbei = `DERIVATE(Itzr,V(b_bei)); // capacitances cpi = `DERIVATE(Qbe,V(b_bei)); cpix = `DERIVATE(Qbex,V(b_bex)); cmu = `DERIVATE(Qbc,V(b_bci)); cmux = `DERIVATE(Qbcx,V(b_bcx)); cpip = `DERIVATE(Qbep,V(b_bep)); ccs = `DERIVATE(Qbcp,V(b_bcp)); cbeoXX = `DERIVATE(Qbeo,V(b_be)); cbcoXX = `DERIVATE(Qbco,V(b_bc)); // crude estimate of ft, intrinsic component just has // overlap capacitances added, and the extrinsic ft // will be affected by extrinsic elements like Rc*Cc, // proper terminal simulations are needed to get the // actual ft, this is just an estimate: gm/(2*pi*Cbase) ft_int = 0.1591549*abs(gm)/(1.0e-20+abs(cpi+cpix+cmu+cmux+cpip+cbeoXX+cbcoXX)); // capacitances (for backward compatibility with level 2) qbc_vbci = cmu; qbco_vbc = cbcoXX; qbcp_vbcp = ccs; qbcx_vbcx = `DERIVATE(Qbcx,V(b_bcx)); // not equivalent to level 2, Vbcx=Vbci-Vrcx qbe_vbci = `DERIVATE(Qbe,V(b_bci)); qbe_vbei = cpi; qbeo_vbe = cbeoXX; qbep_vbci = `DERIVATE(Qbep,V(b_bci)); qbep_vbep = cpip; qbex_vbex = cpix; // resistances rci_mod = Gci/((abs(Irci)+1.0e-10*Gci)/(abs(Vrci)+1.0e-10)); rci_eff = `DERIVATE(Irci,V(b_rci)); rci_eff = (rci_eff==0)?rci_eff:(1/rci_eff); rbi_eff = (qb*Gbi); rbi_eff = (rbi_eff==0)?rbi_eff:((1/rbi_eff)/meff); rbp_eff = (qbp*Gbp); rbp_eff = (rbp_eff==0)?rbp_eff:((1/rbp_eff)/meff); // terminal currents ic = Itzf - Itzr - Ibc - Ibcp - Ibep; ib = Ibe + Ibex + Ibc + Ibep + Iccp; ie = -Itzf + Itzr - Ibe - Ibex; isub = -ic - ib - ie; ic = VBICtype * ic; ib = VBICtype * ib; ie = VBICtype * ie; isub = VBICtype * isub; // power currents powerT =-Ith; powerD = Irth; tauTh = cth/Gth; // power currents (for backward compatibility with level 2) p = powerT; // power currents (for backward compatibility with level 2) trise = dtemp; // terminal voltages Vce = V(b_be)-V(b_bc); end end endmodule