Added Diode component with standard and verilog model (diode, led, zener)
This commit is contained in:
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
|
||||
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 diode
|
||||
|
||||
Note that GMIN is not picked up from Options card
|
||||
|
||||
$RCSfile: diode.va,v $ $Revision: 1.8 $ $Date: 2012/07/09 19:37:45 $
|
||||
|
||||
*/
|
||||
|
||||
`include "constants.vams"
|
||||
`include "disciplines.vams"
|
||||
|
||||
`define SPICE_GMIN 1.0e-12
|
||||
`define LARGE_REAL 1.0e99
|
||||
`define DEFAULT_TNOM 27
|
||||
`define MAX_EXPL 2.688117142e+43
|
||||
`define MIN_EXPL 3.720075976e-44
|
||||
`define EXPL_THRESHOLD 100.0
|
||||
|
||||
`define DEXP(A,B) \
|
||||
if (A > `EXPL_THRESHOLD) begin \
|
||||
B = `MAX_EXPL*(1.0+(A)-`EXPL_THRESHOLD); \
|
||||
end else if (A < -`EXPL_THRESHOLD) begin \
|
||||
B = `MIN_EXPL; \
|
||||
end else begin \
|
||||
B = exp(A); \
|
||||
end
|
||||
|
||||
module va_diode(anode,cathode);
|
||||
|
||||
// %%DEVICE_CLASS=DIODE%%
|
||||
|
||||
inout anode, cathode;
|
||||
electrical anode, cathode, internal;
|
||||
|
||||
parameter real Area = 1.0 from (0:inf]; //Area scaling factor
|
||||
parameter real Is = 1e-14 from [0:inf]; //Saturation current [A]
|
||||
parameter real Tnom = `DEFAULT_TNOM from (-`P_CELSIUS0:inf); //Measurement temperature [C]
|
||||
parameter real Rs = 0.0 from [0:inf]; //Ohmic res [Ohm]
|
||||
parameter real N = 1.0 from [0:inf]; //Emission coef
|
||||
parameter real Tt = 0.0 from [0:inf]; //Transit time [s]
|
||||
parameter real Cjo = 0.0 from [0:inf]; //Junction capacitance [F]
|
||||
parameter real Vj = 1.0 exclude 0; //Junction potential [v]
|
||||
parameter real M = 0.5 from [0:inf]; //Grading coef
|
||||
parameter real Eg = 1.11 from (0:inf]; //Activation energy [eV]
|
||||
parameter real Xti = 3.0 from [0:inf]; //IS temp exp.
|
||||
parameter real Kf = 0.0; //Flicker noise coef
|
||||
parameter real Af = 1.0 from (0:inf); //Flicker noise exponent
|
||||
parameter real Fc = 0.5 from [0:1]; //Forward bias junct parm
|
||||
parameter real Bv = `LARGE_REAL from [0:inf]; //Reverse breakdown voltage [v]
|
||||
parameter real Ibv = 0.001 from [0:inf]; //Current at BV [A]
|
||||
|
||||
real Vd, Id, Qd;
|
||||
real f1, f2, f3, Fcp;
|
||||
real Ibv_calc, Vth;
|
||||
real Is_temp, Vth_nom, T_nom, T;
|
||||
real exponent;
|
||||
|
||||
analog begin
|
||||
Vth = $vt;
|
||||
T = $temperature;
|
||||
|
||||
f1 = (Vj/(1 - M))*(1 - pow((1 - Fc), 1 - M));
|
||||
f2 = pow((1 - Fc), (1 + M));
|
||||
f3 = 1 - Fc * (1 + M);
|
||||
Fcp = Fc * Vj;
|
||||
|
||||
if (Ibv !=0)
|
||||
Ibv_calc = Ibv;
|
||||
else
|
||||
Ibv_calc = Is * Bv / Vth;
|
||||
|
||||
Vd = V(anode, internal);
|
||||
|
||||
// Temperature dependence
|
||||
T_nom = Tnom + `P_CELSIUS0;
|
||||
Vth_nom = $vt(T_nom);
|
||||
`DEXP((Eg / Vth_nom - Eg / Vth),exponent);
|
||||
|
||||
Is_temp = Is * pow(T/T_nom, Xti / N) * exponent;
|
||||
|
||||
// Intrinsic diode
|
||||
// BV is not adjusted to match Ibv if I(BV) <> Ibv
|
||||
if (Vd < 0) begin
|
||||
if (Vd < -Bv) // Past breakdown
|
||||
begin
|
||||
`DEXP(-(Bv + Vd) / Vth,exponent);
|
||||
Id = -Area * Is_temp * (exponent + Bv / Vth);
|
||||
end
|
||||
|
||||
else if (Vd == -Bv) // At breakdown
|
||||
Id = -Area * Ibv_calc;
|
||||
|
||||
else if (Vd <= -5 * N * Vth) // -Bv < Vd < -5 nKT/q
|
||||
Id = -Area * Is_temp + Vd * `SPICE_GMIN;
|
||||
|
||||
else // -5 nKT/q <= Vd < 0
|
||||
begin
|
||||
`DEXP(Vd / Vth,exponent);
|
||||
Id = Area * Is_temp * (exponent - 1) + Vd * `SPICE_GMIN;
|
||||
end
|
||||
end
|
||||
else // Fwd bias:
|
||||
begin
|
||||
`DEXP(Vd / (N*Vth),exponent);
|
||||
Id = Area * Is_temp * (exponent - 1) +
|
||||
Vd * `SPICE_GMIN;
|
||||
end
|
||||
// Capacitance (junction and diffusion)
|
||||
if (Vd <= Fcp)
|
||||
Qd = Tt * Id + Area * Cjo * Vj
|
||||
* (1 - pow((1 - Vd / Vj), (1 - M)))/(1 - M);
|
||||
else
|
||||
Qd = Tt * Id + Area * Cjo
|
||||
* (f1 + (1 / f2) * (f3 * (Vd - Fcp) + (0.5 * M / Vj)
|
||||
* (Vd * Vd - Fcp * Fcp)));
|
||||
|
||||
I(anode, internal) <+ Id;
|
||||
I(anode, internal) <+ ddt(Qd);
|
||||
if (Rs > 0.0) begin
|
||||
I(internal, cathode) <+ V(internal, cathode) / (Rs / Area);
|
||||
I(internal, cathode) <+ white_noise(4 * `P_K * T / (Rs / Area),
|
||||
"Rs");
|
||||
end
|
||||
else
|
||||
V(internal, cathode) <+ 0.0;
|
||||
|
||||
I(anode, internal) <+ white_noise(2 * `P_Q * abs(Id), "shot");
|
||||
I(anode, internal) <+ flicker_noise(Kf * pow(abs(Id), Af), 1.0, "flicker");
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
||||
Reference in New Issue
Block a user