The Designer's Guide Community Forum
Design >> Analog Design >> Spectre cmin setting

Message started by bmurmann on Jul 27th, 2022, 11:25am

Title: Spectre cmin setting
Post by bmurmann on Jul 27th, 2022, 11:25am

I am simulating a high-fidelity SC circuit and I am seeing some unexpected behavior with the Spectre cmin setting. The designers I work with tend to use a default of cmin=10f as some reasonable floor for node capacitance to ground, but when I simulate with that setting it seems that some critical nodes start violating charge conservation (with errors being a couple of tens of uV on caps around 1p).

I may be misunderstanding what cmin exactly does, but I thought it literally just adds shut caps to ground at every node. In my circuit, there are already caps much larger than 10f to ground at every node yet setting cmin=10f has a strong effect on the simulation error. I am quite puzzled by this and the only thing I could think of is that the added cmin caps are not properly accounted for as the simulator works on conserving charge?

Title: Re: Spectre cmin setting
Post by Ken Kundert on Jul 27th, 2022, 12:44pm

It's been 30 years, so my memory might not be terribly reliable, but as I remember it the cmin capacitors were implemented without error control.  Meaning that the cmin capacitors should act as normal capacitors except that the time step will not be reduced to accurately resolve the capacitor currents during fast transients.  The logic behind that decision stems from the belief that cmin is a convergence parameter rather than a modeling parameter.  In other words, there is no reason to believe that in a real circuit each node would have an equal amount of capacitance to ground, so adding cmin to model the circuit is not really useful.  Instead, adding a small capacitor to ground at every node results in smoothed waveforms that can improve convergence.  Since cmin is a convergence parameter rather than a modeling parameter, we assumed that cmin would be set to a value that is much smaller than the actual capacitors in the circuit.  In other words, cmin is intended to be set to a value that would be considered negligible.

If the value is negligible, why specify it?  The default move of a simulator when it gets into convergence trouble during a transient analysis is to shrink the time step.  If the waveforms are smooth, shrinking the time step results in the solution at the previous time step being a better starting point for the Newton iteration at the current time point.  It should always be possible to shrink the time step enough so that the previous solution is within the region of convergence for the current point.  This logic breaks down if the circuit exhibits jumps (discontinuous changes in the solution trajectory).  Adding a small capacitor from every node to ground should smooth those jumps, allowing the shrink-the-time-step strategy to continue to work.  And it does not matter if the cmin value is negligible, because the simulator can always choose a time step small enough for the smoothing to work its magic.

So, fundamentally, using cmin to model actual circuit parasitics violates the assumptions we made when implementing the feature.  That is not necessarily a problem, just something you should be aware of.  That, and the fact that the simulator it not doing its normal error control on those capacitor voltages.

However having said all that, I cannot see how cmin capacitors can result in charge conservation issues.  As far as I know, there are only two things that can result in violating charge conservation:

1. incremental models
2. Newton residue

Incremental models are nonlinear models formulated using derivatives of fundamental quantities (R, G, C, L) rather than fundamental quantities themselves (V, I, Q, φ).  The early SPICE MOS models (MOS2, MOS3) were formulated using capacitance rather than charge and so suffered terrible charge conservation issues.  The modern MOS models are now all formulated using charge, and so this issue is much less of a problem.  However, foundries will often supplement the standard MOS models with added nonlinear elements implemented in Verilog-A, and those models are sometimes problematic because they are formulated using capacitance rather than charge.

Newton residue is the amount by which the circuit equations are allowed to be violated.  Newton's method is an iterative approach that starts with a guess at the final solution that is refined on each iteration.  In order for Newton's method to be practical, that iteration must be terminated before the final solution is reached, which would otherwise take an infinite number of iterations.  The computed result will differ from the true solution by a small amount, and that amount is the residue.  SPICE formulates the circuit equations using KCL, and so the residue equals the amount by which KCL is not satisfied.  So it represents the amount of charge that is created or destroyed at each time point.

In general the Newton residue is a much smaller contributor to charge conservation errors than incremental models, but incremental models are rare whereas Newton residue is created at every time point whenever the circuit is nonlinear.

In the case of incremental models and Newton residue, charge conservation is only corrupted if the model is nonlinear.  In the case of incremental models, it is the changing capacitance that is the genesis of the error in the charge, and in linear models the capacitance does not change.  In a Newton iteration, a linear circuit the solution is computed exactly on the first iteration, meaning that the iteration can be terminated without error.  Thus, I am not seeing a way for cmin to contribute to charge conservation error.

⟪ continued in next post ⟫

Title: Re: Spectre cmin setting
Post by Ken Kundert on Jul 27th, 2022, 12:45pm

In an attempt to be complete, let me say a bit more about simulation errors.  Neglecting any deficiencies in the models, there are two types of errors in a SPICE transient analysis: truncation errors and Newton residue errors.

Truncation errors stem from the breaking of time into discrete steps.  Doing so allows us to replace the continuous derivatives with finite-difference approximations.  With capacitors, the error in the approximations will be in the shape of the currents.  However, as long as no incremental models are present, any errors in the currents that result in moving away from a voltage will be equal and opposite to those made when returning to that voltage even if the wave shape differs for the two transitions.  Thus, the truncation error that results from the use of non-zero time steps will affect the shapes of transitions in switching waveforms, but not the value of the final equilibrium points.

As mentioned before, Newton residue does contribute charge error, so can affect the value of equilibrium points in switching waveforms.

SPICE and Spectre, apply different tolerances to control both of these errors, but they are linked for user convenience.  reltol is the universal accuracy knob, meaning that tightening reltol should reduce both Newton residue error and truncation error.  Reltol controls the Newton residue error directly, and it controls truncation error when scaled by lteratio.  This suggests a strategy for efficiently reducing charge conservation errors.  As long as no incremental models are present, shrinking the time step does not reduce charge conservation errors, but tightening reltol does by reducing the Newton residue error.  Thus, one can tighten reltol while loosening lteratio by an equal amount to reduce the residue error while leaving the time step largely unchanged.

I apologize for the long winded response to your question, but I thought it might be helpful to have an understanding of the simulators error mechanisms.

Having said all that, let me respond more directly to your questions.

You say that you are seeing charge conservation errors.  How do you know they are charge conservation errors rather than some other kind of error?  Are you seeing the equilibrium points being affected?

Have you tried to replace cmin with equivalent traditional capacitors to determine whether the problem is in the implementation of cmin rather than being due to the capacitance being added to the circuit.

You might consider employing my strategy of tightening reltol while loosening lteratio to see if you can reduce the charge errors to negligible levels.  If the error is really due to charge conservation issues, that should reduce the problem.  I traditionally start by reducing reltol by an order of magnitude.  Since Newton's method has quadratic convergence, that should result in two orders of magnitude reduction in the charge error.  In my experience, simulator convergence and speed are not degraded by such a change.

You should also consider examining your PDK to see if it contains any incremental models, and if so, replacing them with charge-based models.


The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.