⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bjt.va

📁 一个晶体管的veriloga模型,完整的模型
💻 VA
📖 第 1 页 / 共 2 页
字号:
/* 

 Copyright 2002-2005 Tiburon Design Automation, Inc. All rights reserved.

 This software has been provided pursuant to a License Agreement
 containing restrictions on its use.  This software contains
 valuable trade secrets and proprietary information of 
 Tiburon Design Automation, Inc. and is protected by law.  It may 
 not be copied or distributed in any form or medium, disclosed 
 to third parties, reverse engineered or used in any manner not 
 provided for in said License Agreement except with the prior 
 written authorization from Tiburon Design Automation, Inc.

 Verilog-A definition of SPICE Gummel-Poon

 $RCSfile: bjt.va,v $ $Revision: 1.11 $ $Date: 2006/07/04 07:02:14 $

*/ 

`include "constants.vams"
`include "disciplines.vams"
`include "compact.vams"

`define INCLUDE_LEAD_INDUCTANCE
//`define INCLUDE_DELAY
`define USE_EXCESS_PHASE
// `define THREE_TERMINALS

`define PI_SQ_24    2.43170840742   // = 24 / pi / pi
`define PI_SQ_144 14.5902504445     // = 144 / pi / pi

`define ZERO_TO_INF(paramValue, varName, infinity) \
    if (paramValue == 0.0) \
        varName = infinity;\
    else \
        varName = paramValue
  
`ifdef THREE_TERMINALS
module bjt_va(c,b,e);
`else
module bjt_va(c,b,e,s);
`endif

    // %%DEVICE_CLASS=BJT4(NPN,PNP)%%

`ifdef THREE_TERMINALS
    inout c,b,e;
`else
    inout c,b,e,s;
`endif
    electrical c,b,e,s;
    electrical ci,bi,ei;

`define max_arg 80 

     analog function real  exp_soft;
         input x;
         real  x;
         begin
             if (x < `max_arg)
                 exp_soft = exp(x);
             else
                 exp_soft = (x + 1 - `max_arg) * exp(`max_arg);
         end
     endfunction


    //Ordering of parameters is basically the same as SPICE
    parameter real Area = 1 from (0.0:inf]; // Area scaling factor
    parameter real Temp = `NOT_GIVEN;       // Device temperature override [C]
    parameter real Is = 1e-16 from (0.0:inf]; // Transport saturation current [A]
    parameter real Bf = 100 from (0.0:inf]; // Ideal max fwd beta
    parameter real Nf = 1.0 from (0.0:inf]; // Forward current emission coeff
    parameter real Vaf = 1e9 from [0.0:inf]; // Forward early voltage [v]
    parameter real Ikf = 1e9 from (0.0:inf]; // Forward beta high-current roll-off [A]
    parameter real Ise = 0 from [0.0:inf]; // B-E leakage current [A]
    parameter real Ne = 1.5 from (0.0:inf]; // B-E p-n leakage emission coeff
    parameter real Br = 1.0 from (0.0:inf]; // Ideal max rev beta
    parameter real Nr = 1.0 from (0.0:inf]; // Reverse current emission coeff
    parameter real Var = 1e9 from [0.0:inf]; // Forward Early voltage [v]
    parameter real Ikr = 1e9 from (0.0:inf]; // Reverse beta high-current roll-off [A]
    parameter real Isc = 0 from [0.0:inf]; // B-C leakage current [A]
    parameter real Nc = 2.0 from (0.0:inf]; // B-C p-n leakage emission coeff
    parameter real Rb = 0.0 from [0.0:inf]; // Zero-bias maximum base resistance [Ohm]
    parameter real Irb = 1e9 from [0.0:inf]; // Current where Rb falls halfway [A]
    parameter real Rbm = Rb from [0.0:inf]; // Zero-bias minimum base res (def=Rb) [Ohm]
    parameter real Re = 0.0 from [0.0:inf]; // Emitter ohmic resistance [Ohm]
    parameter real Rc = 0.0 from [0.0:inf]; // Collector ohmic resistance [Ohm]
    parameter real Cje = 0.0 from [0.0:inf]; // B-E zero-bias p-n cap [F]
    parameter real Vje = 0.75 from [0.0:inf]; // B-E built-in potential [v]
    parameter real Mje = 0.33 from (0.0:inf]; // B-E p-n grading factor
    parameter real Cjc = 0.0 from [0.0:inf]; // B-C zero-bias p-n cap [F]
    parameter real Vjc = 0.75 from [0.0:inf]; // B-C built-in potential [v]
    parameter real Mjc = 0.33 from (0.0:inf]; // B-C p-n grading factor
    parameter real Xcjc = 1.0 from [0.0:inf]; // Fraction of Cjc connected to Rb
    parameter real Cjs = 0.0 from [0.0:inf]; // C-S zero-bias p-n cap [F]
    parameter real Vjs = 0.75 from [0.0:1e9]; // Substrate built-in potential [v]
    parameter real Mjs = 0.0 from [0.0:inf]; // Substrate p-n grading factor
    parameter real Fc = 0.5 from (0.0:inf]; // Forward bias depletion cap coeff.
    parameter real Xtf = 0.0 from [0.0:inf]; // Transit time bias coeff 
    parameter real Tf = 0.0 from [0.0:inf]; // Ideal forward transit time [s]
    parameter real Vtf = 1e9 from [0.0:inf]; // Transit time dependency on Vbe [v]
    parameter real Itf = 0 from [0.0:inf]; // Transit time dependence on Ic [A]
    parameter real Ptf = 0.0 from [0.0:inf]; // Excess phase at 1/(2*pi*TF), degrees
    parameter real Tr = 0.0 from [0.0:inf]; // Ideal reverse transit time [s]
    parameter real Kf = 0 from [0.0:inf]; // Flicker noise coeff
    parameter real Af = 1 from (0.0:inf]; // Flicker noise exponent
    parameter real Iss = 0 from [0.0:inf]; // Unused: Substrate P-N staturation current [A]
    parameter real Ns = 1.0 from (0.0:inf]; // Unused: Substrate p-n emission coeff
    parameter real Nk = 0.5 from (0.0:inf]; // High current roll-off coeff
    parameter real Tnom = `DEFAULT_TNOM from (-`P_CELSIUS0:inf); // Param meas temp [C]
    parameter real Eg = 1.11 from [0.0:inf]; // Bandgap voltage [eV]
    parameter real Xtb = 0.0 from [0.0:inf]; // Fwd and rev beta temp coeff 
    parameter real Xti = 3.0 from [0.0:inf]; // IS temperature effect exponent
    parameter integer RbModel= 1 from [0:1]; // MDS=0 SPICE/LIBRA=1

    // The following parameters are ignored but are used to allow easy
    // use in some simulators.
    parameter real Imax= 1e3; // Ignored!
    parameter real Ab= 0; // Ignored!
    parameter real Fb= 0; // Ignored!
    parameter real Ffe= 0; // Ignored!
    parameter integer Lateral= 0; // Ignored!
    parameter integer Approxqb= 0; // Ignored!
    parameter integer Mode= 0; // Ignored!
    parameter integer Noise= 0; // Ignored!

`ifdef INCLUDE_DELAY        
    parameter real Delay = 0 from [0.0:inf]; // delay of Ice(Vbe)
`endif    

    parameter integer NPN = 1 from [0:1]; 
    parameter integer PNP = 0 from [0:1];
    
`ifdef INCLUDE_LEAD_INDUCTANCE
    parameter real Lb = 0 from [0:inf]; // Base inductance [H]
    parameter real Lc = 0 from [0:inf]; // Collector inductance [H]
    parameter real Le = 0 from [0:inf]; // Emitter inductance [H]
`endif

    real Vbe, Vbi, Vt, Vbcx, Vbci, Vcs;
    real Ib, Ibe1, Ibe2, Ibc1, Ibc2, i_rb, Ic, rb;   
    real vaf, var, vtf, Vtn;
    real Kq1, Kq2, Kqb;
    real Qje, Qbe, Qbc, Qjcx, Qjs;
    real x, tanx, Type;  
    real tff, t0, t1, t2, t3;
    real T, EG_T, IS_T, ISE_T, ISC_T, BF_T, BR_T;
    real T_NOM;
    real Cjc_1, Cjc_2, Cjc0, Qjc0, Qjc, fcpe, fcpc;
    real Cje_1, Cje_2, Cje0, Qje0, vdiff;
    real Cjs_1, Cjs0, Qjs0;
    real T0, T1, Jrb, Ib_Jrb;
    real ratioT;
`ifdef USE_EXCESS_PHASE
    real Delay;
`endif

    analog function real IS_of_T;
       input IS, ratioT, EG, Vth, XTI;
       real  IS, ratioT, EG, Vth, XTI;
       begin
           IS_of_T = IS * exp((ratioT - 1) * EG / Vth) 
                       * pow(ratioT, XTI);
       end
    endfunction // IS_T
         
    analog function real I_of_T;
        input IS, ratioT, EG, N, Vth, XTI, XTB;
        real  IS, ratioT, EG, N, Vth, XTI, XTB;
        begin
            I_of_T = IS / pow(ratioT, XTB) * exp( ( ratioT - 1) 
                      * EG / (N * Vth)) * pow(ratioT, XTI/N);
        end
    endfunction // I_of_T
 
    analog function real B_of_T;
        input B, ratioT, XTB;
        real B, ratioT, XTB;
        begin
            B_of_T = B * pow(ratioT, XTB);
        end
    endfunction // B_of_T
 
    analog function real EG_of_T;
        input T;
        real T;
        begin
            EG_of_T = 1.16- 0.000702 * T * T / (T + 1108);
        end
    endfunction // EG_of_T
 
    analog begin
 
        if (Temp == `NOT_GIVEN)
            T = $temperature;
        else
            T = Temp + `P_CELSIUS0;

        Vt = $vt(T);
        
        // Some simulators use allow variables to 0 to mean inf 
        `ZERO_TO_INF(Vaf, vaf, 1.0e9);
        `ZERO_TO_INF(Var, var, 1.0e9);
        `ZERO_TO_INF(Vtf, vtf, 1.0e9);
        
        T_NOM = Tnom + `P_CELSIUS0;
       
        ratioT = T / T_NOM;    
        EG_T = EG_of_T(T);
        IS_T = IS_of_T(Is, ratioT, EG_T, Vt, Xti);
        ISE_T = I_of_T(Ise, ratioT, EG_T, Ne, Vt, Xti, Xtb);
        ISC_T = I_of_T(Isc, ratioT, EG_T, Nc, Vt, Xti, Xtb);
        BF_T = B_of_T(Bf, ratioT, Xtb);
        BR_T = B_of_T(Br, ratioT, Xtb);
  
        `SET_TYPE(NPN,PNP,Type);
        if (Type == 0)
            Type = 1;

        Vbe = Type * V(bi, ei);
        Vbci = Type * V(bi, ci);
        Vbcx = Type * V(b, ci); 
        Vcs = Type * V(ci, s);
        Vbi = Type * V(b, bi);
      
        Vtn = Vt * Nf;
        if (Vbe > -5 * Vtn) begin 
            Ibe1 = IS_T  * (exp_soft(Vbe / (Nf * Vt)) - 1);
            Ibe2 = ISE_T * (exp_soft(Vbe / (Ne * Vt)) - 1);
        end
        else begin
            Ibe1 = - IS_T + `SPICE_GMIN * Vbe;
            Ibe2 = - ISE_T;
        end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -