Design of Complex Integrated Circuits
GHDL (VHDL), iVerilog and Verilator (Verilog/SystemVerilog)ngspice, VACASK, Xyce\[ i_\mathrm{R} = \frac{1}{R} ( v_1 - v_2 ), \qquad i_\mathrm{C} = C \frac{ d( v_1 - v_2 )}{dt}, \qquad \frac{di_\mathrm{L}}{dt} = \frac{1}{L} (v_1 - v_2) \]
Note 6: MNA Example
Let us perform the modified nodal analysis for the simple circuit in Figure 90. As a first step, the voltage nodes are numbered, and the directions of the branch currents are fixed. The KCL equations are formulated for each node except the reference node (current flowing out counts positive):
Node \(v_1\): \(i_\mathrm{a} + i_\mathrm{b} = 0\), and node \(v_2\): \(-i_\mathrm{b} + i_\mathrm{c} - i_\mathrm{d} = 0\).
Next, the currents are expressed through the element equations. For node \(v_1\):
\[ i_\mathrm{a} + \frac{v_1 - v_2}{R_1} = 0 \]
and for node \(v_2\), using \(i_\mathrm{d} = I_\mathrm{g}\):
\[ -\frac{v_1 - v_2}{R_1} + \frac{v_2}{R_2} - I_\mathrm{g} = 0 \]
MNA Example
The current through the voltage source cannot be expressed by node voltages, so we keep it as an additional unknown and add the compensating equation \(v_1 - V_\mathrm{g} = 0\). Finally, everything is put into matrix form:
\[ \begin{bmatrix} \frac{1}{R_1} & -\frac{1}{R_1} & 1 \\ -\frac{1}{R_1} & \frac{1}{R_1} + \frac{1}{R_2} & 0 \\ 1 & 0 & 0 \end{bmatrix} \begin{bmatrix} v_1 \\ v_2 \\ i_\mathrm{a} \end{bmatrix} - \begin{bmatrix} 0 \\ I_\mathrm{g} \\ V_\mathrm{g} \end{bmatrix} = 0 \tag{66}\]
MNA Example
Equation 66 has the form \(\mathbf{G} \mathbf{x} - \mathbf{w} = 0\). Since the entries of \(\mathbf{G}\) are constant in this example, the solution is simply \(\mathbf{x} = \mathbf{G}^{-1} \mathbf{w}\). Note that \(\mathbf{G}\) must be invertible (\(\det \mathbf{G} \neq 0\)), otherwise no solution can be found—and this is also true inside circuit simulators (a typical cause is a floating node without a DC path to ground, or a loop of ideal voltage sources)! Simulators never compute \(\mathbf{G}^{-1}\) explicitly but solve the system by sparse LU factorization.
MNA Example
\[ \mathbf{G} \mathbf{x} + \mathbf{p}(\mathbf{x}) - \mathbf{w} = 0 \tag{67}\]
\[ x_{n+1} = x_n - \left[ \frac{d}{dx} f(x_n) \right]^{-1} f(x_n) \]
\[ \mathbf{x}_{n+1} = \mathbf{x}_n - \left[ \mathbf{J}(\mathbf{x}_n) \right]^{-1} \mathbf{F}(\mathbf{x}_n) \tag{68}\]
RELTOL: relative tolerance of voltages and currents from one iteration to the next; default 0.001 (0.1 %).VNTOL: absolute node-voltage tolerance; default 1 µV.ABSTOL: absolute branch-current tolerance; default 1 pA..nodeset statement (in contrast to .ic, which forces an initial condition for the transient simulation).GMIN (default \(10^{-12}\), i.e., 1 TΩ)—which itself can cause accuracy issues, e.g., in sample-and-hold circuits.GMIN stepping can be used).\[ \left[ \mathbf{G} + j \omega \mathbf{C} \right]\mathbf{x} - \mathbf{w} = 0 \tag{69}\]
stb (Tian et al. 2001)).ac \(\rightarrow\) no nonlinear noise (mixers, oscillators, sampled circuits)\[ \mathbf{C} \frac{d}{dt} \mathbf{x} + \mathbf{G} \mathbf{x} + \mathbf{p}(\mathbf{x}) - \mathbf{w}(t) = 0 \tag{70}\]
| Method | Approximation |
|---|---|
Forward Euler (FE) |
\(\frac{d}{dt}v(t_k) \approx \frac{1}{\Delta T} [ v(t_{k+1}) - v(t_k) ]\) |
Backward Euler (BE) |
\(\frac{d}{dt}v(t_{k+1}) \approx \frac{1}{\Delta T} [ v(t_{k+1}) - v(t_k) ]\) |
Trapezoidal rule (TR) |
\(\frac{d}{dt}v(t_{k+1}) \approx \frac{2}{\Delta T} [ v(t_{k+1}) - v(t_k) ] - \frac{d}{dt}v(t_{k})\) |
2nd-order backward difference (Gear2) |
\(\frac{d}{dt}v(t_{k+1}) \approx \frac{3}{2\Delta T} v(t_{k+1}) - \frac{2}{\Delta T} v(t_k) + \frac{1}{2\Delta T} v(t_{k-1})\) |
FE is an explicit method and is numerically unstable for stiff circuits (with widely separated time constants, which is the normal case), unless the time step is tiny; therefore, it is not used in general-purpose circuit simulators.TR and Gear2 are the most heavily used integration methods in circuit simulation.TR, followed by Gear2.TR is overly sensitive to errors of previous time steps, so do not use it with a loose RELTOL!BE and TR adapt quickly, but beware of the artificial ringing introduced by TR.Gear2 is efficient when simulating with tight tolerances or smooth waveforms.BE, TR, and Gear2 are stable on stiff circuits, but BE shows strong artificial numerical damping (TR shows none, Gear2 weak damping)..op does not converge, by slowly ramping all dc sources from zero to their final values.RELTOL, VNTOL, ABSTOL) and limit the maximum time step (TMAX)..tran—but noise is not!TSTART to delay the recording of the output). As the time points are not equidistant, the waveform is interpolated before the FFT; limit TMAX accordingly, and use coherent sampling or a window function to avoid spectral leakage.ngspice, e.g., by using trnoise sources, or in VACASK by using the transient noise analysis). As the noise bandwidth is linked to the time step, such simulations are slow and require many runs or long simulation times for statistically meaningful results.Xyce and VACASK offer a harmonic-balance analysis.pss, with pac, pstb, pnoise, pxf, pspqpss, …hb, hbac, hbnoise, …dcmatch, acmatch), stability (stb), pole-zero (pz), \(S\)-parameters (sp), envelope following (envlp)ngspice (OSDI interface) and VACASK\[ I_\mathrm{D}= \frac{1}{2} K_\mathrm{p} \frac{W}{L - 2 L_\mathrm{D}} \left[ 2 (V_\mathrm{GS}- V_\mathrm{th}) V_\mathrm{DS}- V_\mathrm{DS}^2 \right] ( 1 + \lambda V_\mathrm{DS}) \quad \text{(triode)} \]
\[ I_\mathrm{D}= \frac{1}{2} K_\mathrm{p} \frac{W}{L - 2 L_\mathrm{D}} (V_\mathrm{GS}- V_\mathrm{th})^2 ( 1 + \lambda V_\mathrm{DS}) \quad \text{(saturation)} \]
\[ R_\mathrm{G,nqs} = \frac{1}{5 g_\mathrm{m}} \tag{71}\]
0, 1, X (unknown), Z (high impedance)GHDL and iVerilog) evaluate a logic element only when one of its inputs changes, and support the full language semantics including delays and X/Z states. After synthesis and place-and-route, a gate-level simulation with delays back-annotated from an SDF file is possible, although timing is primarily verified by static timing analysis.Verilator) compile the design into a C++ model that is evaluated once per clock cycle, typically with two-state (0/1) logic and without delays; this is dramatically faster and well suited for large synchronous designs and long test runs (e.g., booting software on a CPU core).0/1 levels are mapped to voltage levels.0 and 1 (and X in between).