Electronic – How to compare Matlab/Theory <=> Cadence: Switched-cap. Integrator: Mag & Phase

cadencecircuit analysissample and holdswitched-capacitortransfer function

I tried to compare the simple switched-capacitor integrator below, between Cadence and Matlab (at the end acting as a simple loop-filter for a delta-sigma). I am stuck now on the point of how to compare the 2 results CORRECTLY, because of the additional sample & hold maybe (?) needed and instantiated in the Cadence schematics.

I have read Mr. Ken Kundert’s papers:

  • “Simulating Switched-Capacitor Filters with SpectreRF”, and
  • “Device Noise Simulation of Delta-Sigma Modulators”.

I’m an electronics engineer, but not a mathematician, and so, from the practical point of view I have not found a good answer for me from the internet. Therefore I would be very happy, if you could give me some practical advice.

Block schematics and timing diagram:

Block schematics and timing diagram:

Transfer function for this circuit

enter image description here

(confirmed by e.g. [Richard Schreier, “yellow” Delta-Sigma book, p.337]):

vo/vi =(-Cs)/(Cf)∙z^(-0.5)/(1-z^(-1) )

I also calculated the theoretical magnitude and phase at fs/2 (with ideal opamp and with Cs = Cf = 1). It yields “+j/2” which is 0.5 magnitude (-6 dB) and +90° phase.

Cadence circuit:

enter image description here

As Ken Kundert writes in his papers, I am interested upfront in the discrete-time (DT) behavior, thus I have attached his S&H circuit next to the output “Vo”. It is sampling just a few moments before the rising edge of phase p1, so should be equivalent the read-out at rising edge of p1 at time point “n*T” indicated in the block diagram (node “Vo_ext”) and match with the theoretical result.

Cadence results:

enter image description here
enter image description here

Matlab result:

enter image description here

I created a Bode diagram of the above theoretical, also discrete-time transfer function (thick green line).

Comparison and questions:

1. Q1: Why does Cadence show 159 mHz as 0 dB magnitude line (as it would be a continuous-time (CT) integrator comparable to a Matlab “1/s” transfer function), although it is discrete-time (DT) behavior after the S&H?

Ken Kundert writes in his papers that Spectre basically reports the continuous-time behavior, and if I am interested in the discrete-time behavior then I need to attach a S&H, which I did, but for the magnitude result (as in contrast to the phase result) there is NO difference. The PAC result of BOTH nodes, “Vo” and “Vo_ext” show the 159 mHz. Matlab, instead, shows 167 mHz as 0 dB line.

2. Q2: Why the Cadence PAC goes on with the -20dB/dec straight line as again it would be a continuous-time integrator (and reaches -10 dB at fs/2), although it’s the PAC result AFTER the S&H (I have 2 sidebands shown above fs/2 that one can see well the continuing straight line). Matlab’s result, however, flattens out to -6dB at fs/2, also my theoretical calculation yields -6dB.

3. When I extend the Matlab plot to beyond fs/2, one could see (not shown here) the symmetrical behavior around fs/2, as it should be for a DT system.
Q3: Why does the node after the S&H (“Vo_ext”) in Cadence PAC not show the symmetry around fs/2, although it should be a DT behavior, as Ken writes in his papers?

4. For the phase, I would have found a solution for an conclusive explanation in my head, but it is not consistent with the procedure / method of the amplitude:
I could argue the following way: When I want to know the response of the integrator alone, I omit the S&H at the end in the Cadence circuit, and I get 90° of phase shift (from +180° to +90°) and make the trick with the Matlab that I can plot z^-0.5. Then, for the phase at least, Matlab fits to Cadence, at least to fs/2. When I want to know the “real” DT behavior (so e.g. every 1/fs = every integer second here (and not half a sec.)), I take node “Vo_ext” in Cadence AFTER the S&H and of course then in Matlab for every Ts=1/fs, it also has to be z^-1, and both results fit.
Q4: Is my thinking here somehow correct?

5. We see: If I apply the same procedure for the magnitude as for the phase, both Cadence results, before and as well after the S&H are still showing 159 mHz as 0 dB line and -10 dB at fs/2 and neither case does fit to Matlab / theory (167 mHz and -6 dB).
Q5: Why does the phase match with this thinking (at least to fs/2), but the magnitude doesn’t?

6. I somehow have in mind, that of course I will see the unwanted (“sin(x)/x” coloring) but maybe also wanted (DT, as Ken writes) behavior of the S&H. As by theory, a sim. has shown -3.9 dB of magnitude drop and the phase is at -180 degrees if the S&H is simulated alone. If I simulate 2 of them in series, I obtain the very same data. Thus I conclude, this S&H is NOT an LTI system. Therefore, it’s not allowed to simply divide by its transfer function (so to deduct the sample and hold from the overall circuit, so to exclude the behavior of the additional magnitude and phase influence of the S&H (but which I possibly even want, because, as Ken writes, I am interested in the discrete-time behavior). So maybe I need the discrete-time behavior without the influence of the S&H??? You see, it’s not clear to me.
Q6: So, my main question: How to CORRECTLY compare, evaluate, interpret and argue the results obtained in order that the answers are consistent and I have a correct procedure / methodology which is valid for also all the circuits to be analyzed in the future? (e.g. the STF of complete Delta-Sigma modulators, etc.)? So in a way that someone of you says: “Take this node and do that with it and then you get the correct result”, and not that the methodology for some cases it maybe will fit (e.g. here phase until fs/2) in others it doesn’t (magnitude).

Thank you so much in advance.

Best Answer

Mr. Ken Kundert in person gave the crucial hint for the solution of this topic and I want to thank him 1.000.000 times for his answer and share the essential result here also with you:


So the key point summarized for all:

The key point (for this case at least, the rest I have to check, then) is obviously to apply in Cadence the “PAC SAMPLED” ANALYSIS and moreover, CORRECTLY apply it (i.e. select a concrete time, and not “time averaged”, see below)! The S&H in the output can stay and so in this example “Vo_ext” can be taken for the result. With these actions, Cadence then matches Matlab perfectly, see the screenshot!

In a bit more detail: In my case, there was a choice of 2 sub-options in the PAC (Periodic AC analysis for the others) result: That is to say, if one choses the PAC result “time averaged” then one gets wrong results (or at least me in this case), so guys, also maybe you need to take option B: The concrete time “e.g. 799ms”, then you’ll get the correct results which PERFECTLY match to Matlab (or to “theory” if you want)! I have to find out what is behind this selection in more detail, but this I can do on my own, I think.

So I wanted to state this also here as a closing summary that maybe others who will fall into the same issue will have an easier job! ;-)

Many greetings, bernd2700

enter image description here