Simulating Diodes in NGSpice

The Diode SPICE Model

(From https://www.allaboutcircuits.com/textbook/designing-analog-chips/simulation/the-diode-spice-model/ for the Spice Model)

A simple diode equivalent circuit would comprise:

The current/voltage relationship of an ideal junction is given by:

I 1   =   I S e ( q V d k T )

where:


In SPICE this diode equation is greatly expanded:

I 1   =   I S ( e q V d k T N )   ×   e ( ( Δ T 1 ) × q E g k T N )   ×   Δ T X T I N   +   I S R ( e q V d k T N R )   ×   ( ( 1 V d V J ) 2   +   0.005 M 2 )

where:

Though this equation might appear utterly complicated at first, it really isn’t. If you look at the portion of the equation to the left of the plus sign, you’ll see that it’s made of three terms multiplied together. The parameters that go into these terms are listed above.

With these three terms, you can shape the basic exponential curve to match what’s actually measured. If you don’t list the parameters in the model statement, SPICE will assume the default values.

The portion of the equation to the right of the plus sign adds a leakage current, which is a small current in excess of the reverse current predicted by the ideal diode equation. You can modify the shape of its curve with the constants NR, M, and VJ.

With the parameters we’ve specified, the model makes the breakdown voltage of the diode infinite. You can limit this with the parameter BV and three companions:

There’s also IKF, which splits the DC curve into two regions. In ICs, this parameter is very rarely used.

Series Resistance and Junction Capacitance

The series resistance, RS, which also influences the DC behavior, has first and second-order temperature coefficients, TRS1 and TRS2.

The junction capacitance shown in the model, CJ0 (or CJO) is measured at 0 V. Since its value at different voltages (forward or reverse) depends on the grading of the junction (abrupt, diffused, implanted, etc.), it too is modified by three constants: VJ, M, and FC. If you don’t specify these parameters in the model statement, the following default values are used:

  • VJ = 1
  • M = 0.5
  • FC = 0.5

For a voltage across the diode (not including RS) equal to or less than the product of FC and VJ, the formula for junction capacitance is:

C   =   C J 0   ×   ( 1     V d V J ) M

If the voltage across the diode is greater than FC × VJ, the formula is:

C   =   C J 0   ×   ( 1     F C ) ( 1 + M )   ×   ( 1     F C   ×   ( 1   +   M )   +   M   ×   V d V J )

Noise Parameters

There are two noise sources in a diode: the resistor (RS) and the current (I1). Without any additional parameters, these are treated as white noise sources—in other words, it’s assumed that the noise from them is the same at any frequency.

To account for flicker noise (which increases at low frequency), two constants—KF and AF—are used. When current source noise is calculated, the following expression is added:

K F   ×   I 1 A F f

The Diode NGSpice Model

General form:

DXXXXXXX n+ n- mname <area=val> <m=val> <pj=val> <off>
+   <ic=vd> <temp=val> <dtemp=val>
+   <lm=val> <wm=val> <lp=val> <wp=val>

Examples:

DBRIDGE 2 10 DIODE1
DCLMP aa cc DMOD AREA=3.0 IC=0.2

The pn junction (diode) implemented in ngspice expands the one found in SPICE3f5. Perimeter effects and high injection level have been introduced into the original model and temperature dependence of some parameters has been added. n+ and n- are the positive (anode) and negative (cathode) nodes, respectively. mname is the model name. Instance parameters may follow, dedicated to only the diode described on the respective line. area is the area scale factor, which may scale the saturation current given by the model parameters (and others, see table below). pj is the perimeter scale factor, scaling the sidewall saturation current and its associated capacitance. m is a multiplier of area and perimeter, and off indicates an (optional) starting condition on the device for dc analysis. If the area factor is omitted, a value of 1.0 is assumed. The (optional) initial condition specification using ic is intended for use with the uic option on the .tran control line, when a transient analysis is desired starting from other than the quiescent operating point. You should supply the initial voltage across the diode there. The (optional) temp value is the temperature at which this device is to operate, and overrides the temperature specification on the .option control line. The temperature of each instance can be specified as an offset to the circuit temperature with the dtemp option.

To fulfill requirements of modern process design kits (PDK) the basic spice3 model was extended with the capability of modeling parasitic effects like sidewall junction currents and capacitances, tunnel currents and metal and polysilicon overlap capacitances. Latter effect can be activated by level=3 model parameter or by setting element parameters lm, wm, lp and wp. If both are given, element parameters have priority.

With the (new in ngspice-39) OpenVAF/OSDI approach, all modern diode models, written in Verilog-A, become available, like JUNCAP etc.


The dc characteristics of the diode are determined by the parameters is and n. An ohmic resistance, rs, is included. Charge storage effects are modeled by a transit time, tt, and a nonlinear depletion layer capacitance that is determined by the parameters cjo, vj, and m. The temperature dependence of the saturation current is defined by the parameters eg, the energy, and xti, the saturation current temperature exponent. The nominal temperature where these parameters were measured is tnom, which defaults to the circuit-wide value specified on the .options control line. Reverse breakdown is modeled by an exponential increase in the reverse diode current and is determined by the parameters bv and ibv (both of which are positive numbers).

Junction DC parameters
Name
Parameter
Units Default Example Scale factor
IS (JS)
Saturation current
A 1.0e-14 1.0e-16 area
JSW
Sidewall saturation current
A 0.0 1.0e-15 perimeter
N
Emission coefficient
- 1 1.5
RS
Ohmic resistance
Ω 0.0 100 1 a r e a
BV
Reverse breakdown voltage
V 40
IBV
Current at breakdown voltage
A 1.0e-3 1.0e-4
NBV
Breakdown Emission Coefficient
- N 1.2
IKF (IK)
Forward knee current
A 0.0 1.0e-3
IKR
Reverse knee current
A 0.0 1.0e-3
JTUN
Tunneling saturation current
A 0.0 area
JTUNSW
Tunneling sidewall saturation current
A 0.0 perimeter
NTUN
Tunneling emission coefficient
- 30
XTITUN
Tunneling saturation current exponential
- 3
KEG
EG correction factor for tunneling
- 1.0
ISR
Recombination saturation current
A 1e-14 1pA area
NR
Recombination current emission coefficient
- 1 2
Junction capacitance parameters
Name
Parameter
Units Default Example Scale factor
CJO (CJ0)
Zero-bias junction bottom-wall capacitance
F 0.0 2pF area
CJP (CJSW)
Zero-bias junction sidewall capacitance
F 0.0 .1pF perimeter
FC
Coefficient for forward-bias depletion bottom-wall capacitance formula
- 0.5 -
FCS
Coefficient for forward-bias depletion sidewall capacitance formula
- 0.5 -
M (MJ)
Area junction grading coefficient
- 0.5 0.5
MJSW
Periphery junction grading coefficient
- 0.33 0.5
VJ (PB)
Junction potential
V 1 0.6
PHP
Periphery junction potential
V 1 0.6
TT
Transit-time
sec 0 0.1ns