• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC Design
  3. Continuous & Discrete-Time behaviour of a Switched-Cap....

Stats

  • Locked Locked
  • Replies 13
  • Subscribers 127
  • Views 8127
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Continuous & Discrete-Time behaviour of a Switched-Cap. Integrator circuit

bernd2700
bernd2700 over 3 years ago

Dear guys,

I would have the following question at the end of this text.

Since I have read that Andrew Beckett also seems to have extremely profound experiecne  here (e.g. topic "custom-ic-design/48795/noise-figure-of-track-and-hold-circuit"), I have the little hope now, that, if I try it here, he or someone could bring a little bit of light into this to me unclear topic.

Many thanks in advance for that!

I also posted my question in the forum “designers-guide.org/.../YaBB.pl (Moderator edit - DG post is here: https://designers-guide.org/forum/YaBB.pl?num=1636713101 ) which also helped me further (many thanks again to Ken Kundert), but on this point now I am stuck. I furthermore posted it on "">electronics.stackexchange.com/.../612337" but also there without success. Hopefully one of you guys might have a good (= intuitive, explaining, not 10 pages of equations, pls.) answer.

To the topic itself: Before starting the question, I have to bring everyone to a common understanding and so, I need to develop it a bit first and make some statements.

I tried to be as precise and short as possible, but as long as necessary.

 

#1) A Zero-Order-Hold (“ZOH”) (Sample & Hold “S&H”) block stand-alone:

First, we watch the Bode plot for this block stand-alone (s=j*2*pi*f ; Ts=sample time). We notice:

*) The envelope of the transfer-function goes “DOWN” (with -20dB/dec).

*) The nulls go down to –INFINITY (only because of resolution, not as much in this graph).

*) At half the sampling frequency “fs/2”, in this example 500 Hz, the magnitude is down by approx. -4 dB.

I compared the Bode diagram of this ZOH above, to the “_SAMPLE_ & Hold (S&H)” from Ken Kundert (“sqrt( (sinc(f*Ts)).^2 );” f=frequency). The result: The MAGNITUDES are completely IDENTICAL (proof not shown here). However, the phase information from Kundert's S&H is missing ( = constantly 0°). => As a result, I say: “Approx., a ZOH = S&H”.

 

#2) Reference circuit to be modelled: A switched-cap (SC.) integrator:

The following circuit shall be my reference, which I want to model with Matlab at a later stage: It shows a (parasitic-sensitive), lossy switched-cap. integrator, operated at sampling frequency fs = 1 kHz. As input stimulus, I put an AC source with 1V magnitude. (I thought about replacing the schematic details just by the block diagram, but maybe the details are important, it is often the case to know what was done _exactly_!)

To obtain the following Bode plot, I do the “PAC sampled” analysis (at rising edge) in the Cadence SpectreRF simulator, since I am interested in its Discrete-Time (DT) behaviour:

We notice:

*) As requested by theory, the DT (Discrete-Time) answer of the sampled output node of the circuit is symmetrical around fs/2 (500 Hz), at fs (=1kHz), the magnitude goes up again to the DC value (+80 dBV). (If one would do a linear frequency axis plot, one would see the symmetry around fs/2 better.)

*) So the “nulls” at multiples of fs go up only to the DC gain of +80 dBV, not to +infinity. (Because of resolution some are not even reaching +80 dBV, but this is an artefact I have understood and shall not be a topic for further discussion here.)

*) At fs/2 at 500 Hz, the magnitude is -6 dBV.

So far, so good.

 

#3) Try: Matlab model of integrator from #1  …

#3a) ... try model over Discrete-Time (DT):

Everything here is clear and there is no question from my side. I just wanted to list it for completeness. So if I model over the following Matlab commands “z=exp(j*w*Ts);   Aol=10000;   f=1-1/Aol;   Int_z=-z^-0.5/(1-z^-1*f);”, I get the following bode plot which is fine and exactly what I expected.

We see from the above cyan graph that at fs/2, we also get -6 dBV, further, it is symmetrical around fs/2 (500 Hz) and so, at fs (1 kHz), the magnitude gets up to +80 dBV again.

So far, so good.

 

#3b) ... try model over Continuous-Time (CT) with subsequent sampling:

Now I would like to model the real circuit from #2 over a CT model with subsequent sampling applied.

Because then, it allows me to also model the speed limit of the opamp for instance (and for more reasons (noise)).

I expect the same results as from the SpectreRF simulator (shown in #2 in green color) if I sample the CT integrator output afterwards with a Sample&Hold (ZOH, shown in #1).

We see from below graph:

*) The pink curve shows the Matlab model of the CT integrator (reaching -10 dBV at fs/2).

*) The blue curve shows the Matlab model of the CT integrator DIVIDED     subsequently by the ZOH from #1.

*) The red  curve shows the Matlab model of the CT integrator MULTIPLIED subsequently by the ZOH from #1.

We further notice:

If we DIVIDE the CT response (pink) of the Matlab model by the S&H (ZOH, orange, see #1) transfer-function, we get the blue curve. Doing so, yields:

*) A PERFECT match at fs/2 at least of the Matlab model (blue) to the DT response of the Cadence circuit (green): The -10 dB from the pink DIVIDED by the ZOH (thus +4dB), gives together the blue curve, which has also the -6 dBV at fs/2. So from this point of view, the procedure, what I do, is good ( = divide the CT tf. by the ZOH).

*) However, what is not matching so well, is, that the result is not completely symmetrical around fs/2. Ok, the “nulls” at multiples of fs go up also here, but not just to the DC gain limit of +80 dBV, but to theoretically +infinity (since the ZOH from #1 shows -infinity nulls). So from this point of view, the procedure, what I do, is not so good.

 

#4) Questions:

Now, there come my 2 questions:

If I try to model the real Cadence switched-cap. (SC.) integrator circuit (in green color from #2) by a Continuous-Time (CT) integrator Matlab model (in “s”) (in #3b) which is then sampled by a ZOH (S&H) to get the DT response:

Q1 ==> Why the hell it seems I have to DIVIDE by the ZOH (S&H) transfer-function and NOT to MULTIPLY by it to get somehow matching results (blue curve) to the Cadence SC circuit (green)??

 

To account equivalently for the “_SAMPLED” option of the Cadence PAC analysis in the real circuit, also in this model, for me, this means (maybe I am wrong here??) I logically would have to subsequently MULTIPLY the integrator output by the S&H transfer function. This is my interpretation, because the strange thing is (= above question), obviously, I have to DIVIDE the integrator output by the ZOH transfer function, and not to multiply by it in order that the “nulls” go also up, and not down, as in the S&H stand-alone case. Then the Bode diagram of this result (blue color) matches approx. the real Cadence SC. circuit (green), apart from the nulls going up higher than just to the +80 dB DC gain limit, as said. Of course, then, there is no symmetry around fs/2 anymore (ok, I also probably do not have a DT signal which is valid only at 1/fs time points but still a CT signal whose value is held constant until the next point in time). So,

 

Q2 ==> Which mathematical operation I do have to for the CT Matlab model in order to also get out the DT response ?? Just sampling (with the S&H or ZOH) seems to be too less!

 

Thanks for any hint in advance,

bernd2700

  • Cancel
  • Frank Wiedmann
    Frank Wiedmann over 3 years ago

    Sampled PAC analysis does not include any hold function, so the result will be like a DT integrator rather than a CT integrator with subsequent ZOH.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • bernd2700
    bernd2700 over 3 years ago in reply to Frank Wiedmann

    First of all, many thanks for your reply, Frank!

    Yes, it seems so, that the sampled PAC result of the real sc. circuit will be like a DT integrator. You can see this when comparing the green and the cyan curve above. So far so good.

    But: Which mathematical operation I have to do when I model in Matlab a CT integrator (pink curve) and I want to see the DT behavior at the end, as the Cadence result in green color? So the output value sampled at every 1/fs second. I tried to multiply it by a ZOH (in the frequency domain of course). This would have been logical to me, but results were completely wrong (red curve). So I came to the trial & error idea to divide the CT integrator transfer-function (pink curve) by the ZOH. The result (blue) at least somehow matches: From DC to until fs/2 (with -6 dB) it matches perfectly to the Cadence reference (green), then the nulls go up at least, but to +infinity, not to +80 dB. So it matches only until fs/2 and furthermore why I have to divide by a transfer-function block and not to multiply by it? I am stuck somehow on this.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Frank Wiedmann
    Frank Wiedmann over 3 years ago in reply to bernd2700

    You need to convolute the original spectrum with the spectrum of the sampling function (a Dirac impulse train), which results in summing up an infinite number of copies of the original spectrum placed at every multiple of the sampling frequency (see for example https://www.sciencedirect.com/topics/engineering/original-signal-spectrum ).

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • bernd2700
    bernd2700 over 3 years ago in reply to Frank Wiedmann

    Dear Frank,

     

    Thank you for your reply!

    Certainly, I skimmed through your referenced documents. But what confuses me, is, why you suggest to do the convolution in the Frequency-Domain (FD), not in the Time-Domain (TD)?

     

    Ken Kundert writes in his paper “Simulating Switched-Capacitor Filters with SpectreRF” on p.8: “To implement a zero-order hold involves convolving the sequence vs with a pulse of unit height with a width of (1–m)Ts . Convolution in the time domain becomes multiplication in the frequency domain.”

     

    I also was expecting a multiplication of the CT integrator Transfer-Function (tf.) with the ZOH tf. => So neither a division nor a convolution in the FD !?

     

    Anyhow, you write: “You need to convolute A) the original spectrum with B) the spectrum of the sampling function (a Dirac impulse train), which results in summing up an infinite number …”. But how to do that in praxis?

     

    I like examples, because in Matlab I cannot sum up to an infinite number of course:

     

    I exactly have this CT integrator ( = pink curve plot in previous posts).

        H_Int_s =

     

                  -6.289e08

          -------------------------

          s^2 + 6.3e05 s + 6.289e04

     

    A) Orig. spectrum: To obtain, I extract the vector data of above tf. (whereas “w_vec = 2*pi*f_vec”):

        [ H_Int_s_bode_mag , H_Int_s_bode_phase , H_Int_s_bode_wout ] = bode( H_Int_s_ , w_vec );

        H_Int_s_mag = H_Int_s_bode_mag(:,:);

        H_Int_s_phase = H_Int_s_bode_phase(:,:);

     

    B) I create the spectrum of the sampling function (whereas “Ts=1/fs”):

        % Build S&H acc. to Kundert

            m = 0;

            ZOH_RSD_rms_vec = sqrt( ((1-m)*sinc(f_vec.*(1-m)*Ts)).^2 );

     

    C) = A) conv. B): As you suggest above, I now try to convolute A) with B)

        % Orig. spectrum convoluted with Spectrum of sampling function (Dirac impulse train)

            H_Int_s_Conv_ZOH = conv( H_Int_s_mag , ZOH_RSD_rms_vec );

        % Plot

            figure();

            semilogx( f_vec , 20*log10(H_Int_s_Conv_ZOH) , 'b' );

     

    => Then, if I try to plot “H_Int_s_Conv_ZOH”, Matlab returns me an error that the length of the vectors is not the same (my generated frequency vector “f_vec” etc. are 1300 elements long and “H_Int_s_Conv_ZOH” is 2599 elements long). I further read in the internet that in praxis for convoluting two signals, there are a LOT of possibilities (cyclic, same, zero-padding, etc.).

     

    Anyway, first, I would need to understand why I should do convolution in FD at all, as it seems for me to be in contradiction to Mr. Kundert’s paper and to my logic, as written above. Possibly I oversee an important detail, and that’s why I dare to ask you, best with the above example, what I shall do in praxis here that my CT integrator (pink line) sampled at the end becomes the same as the Cadence reference PAC sampled (green line).

     

    1000 thanks in advance for any help here and many nice greetings,

    bernd2700

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Frank Wiedmann
    Frank Wiedmann over 3 years ago in reply to bernd2700

    Multiplication in the time domain corresponds to convolution in the frequency domain (and vice versa), so if you sample a signal in the time domain (by multiplying it with the sampling function), you need to convolute the spectrum of the signal with the spectrum of the sampling function in the frequency domain. Sampled PAC analysis in Spectre performs ideal Dirac sampling, so there is no effect of a ZOH. If you want to see the effect of the ZOH (which indeed corresponds to a convolution in the time domain) in Spectre, you should run a normal PAC analysis at the output of the ZOH stage (or model).

    As I am not an expert in MATLAB modeling, I suggest that you ask your remaining questions at https://mathworks.com/matlabcentral/answers/ 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • bernd2700
    bernd2700 over 3 years ago in reply to Frank Wiedmann

    Dear Frank!

     

    Many thanks for your answer, it seems that it brings me at least a bit further!

    What you write is for me a very important sentence: “Sampled PAC analysis in Spectre performs ideal Dirac sampling, so there is no effect of a ZOH”.

     

    ==> Q.1: So, in order to do the equivalent sampling process for “Cadence PAC sampled” analysis also for my Matlab model, I need in Matlab to apply this “Ideal Dirac sampling” method, too, I think. But how Cadence PAC sampled does this mathematically? My hope is, that if I apply the same mathematics in Matlab, I also will get the same result as in Cadence.

     

    ==> Q.2: If I apply “Ideal Dirac sampling” for my Matlab model but do all in Frequency-Domain (FD), this means, I would have to convolve the bode diagram frequency output vector of my Continuous-Time (CT) lossy integrator transfer-function (the input is normalized to “1” ; pink curve) with the Fourier series transformed “Ideal Dirac sampling” (however this can be done in praxis), correct?

     

    Now, to the last part of your sentence: “...so there is no effect of a ZOH”:

     

    I thought: A ZOH itself _IS_ the sampling. Why? If e.g. in Simulink, one places a ZOH block after a CT signal, it turns DT, as one can see immediately by the color coding from the figure below, thus the signal _must_ have been sampled by the ZOH. As this is wildly used in Matlab/Simulink, this must also be true somehow, that a ZOH is the sampling itself. And I simply thought I will do the same: Taking a CT signal (= the output of my lossy integrator instead of the sine-wave block here) and let it pass through such a ZOH block (by multiplying with its transfer-function).

     

    “If you want to see the effect of the ZOH...”

    Due to my lack of understanding the theory here (and it zero helps me any further if I start reading tons of equations), that honestly, I unfortunately do NOT know now – after your answer – any more if I WANT to see the ZOH effect or not. The goal is, to finally bring the Matlab model in agreement with the Cadence PAC sampled sim. result = Trying to do the same mathematical operations in Matlab what my real sw.-cap. circuit does together with Cadence PAC sampled analysis. And I tried out a lot of different things and it seems to work partly. I mean, at least, I already partly reached perfect agreement:

     

    ==> Q.3: Why from DC until fs/2 Cadence (green) is fitting perfectly the Matlab (blue) when I started to try to DIVIDE by a ZOH block? Is this “just by chance” that one effect cancels the other? It’s still illogical to me!

     

    ==> Q.4: Do I possibly have a situation with _2 things combined_ here? :

    1st , I need to account for the switched-capacitor sample & hold stage, as it can be seen in my block diagram in a previous post from switch 1 and capacitor Cs, and this I first have to model with a S&H = ca. a ZOH, and

    2nd , only then, subsequently, I _additionally_ need to account for the “_sampled” option from the Cadence PAC with “ideal Dirac sampling” ??

     

    ==> Q.5.: Overall, what is the _correct procedure_ to establish a theoretical / model for my switched-cap circuit = when to sample which limb with which block and at which stage going from CT to DT ... ? As said, finding this “solution” by trial and error is no good engineering for me, I would like to understand it, why it is so, or why not.

     

     

    So you see, I am really “fighting” and trying hard to understand, but I need help from you professionals with my questions.

     

    Therefore 1000 thanks for your answer in advance!

    bernd2700

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Frank Wiedmann
    Frank Wiedmann over 3 years ago in reply to bernd2700

    Like I already mentioned, I am not an expert on MATLAB modeling. However, a little searching led me to a page where exactly this topic seems to be explained in detail: https://mathworks.com/matlabcentral/answers/1667279-spectra-replica-after-sampling-a-continuous-time-signal (see the answer by Paul). As this is a fairly recent discussion, you will probably even get an answer if you post any additional questions there.

    In the meantime, I have also found out that the zpk function takes an optional sample time parameter (see https://mathworks.com/help/control/ref/zpk.html), so perhaps this is all you need for the discrete-time model (possibly together with the c2d function https://mathworks.com/help/control/ref/lti.c2d.html).

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • bernd2700
    bernd2700 over 3 years ago in reply to Frank Wiedmann

    Dear Frank ( & others of course),

     

    Thanks for your answer!

    Certainly I read through your proposed links (which I partly already did before, e.g. the one with the “c2d” Matlab command), but unfortunately I did not get out of this (especially the Matlab forum question topic “1667279” and answer from “Paul” how this should be linked to my questions.

    I of course remembered that you wrote you are not so familiar with Matlab, I at least try to read every text carefully, therefore in my last post, I did not ask you for a single Matlab command any more. I therefore tried to formulate my questions in a way that the basic principle perhaps may be answered without any Matlab command.

    So, please, if you have an idea about the following, could you be so nice: I would be very happy for ANY hint on my questions (I try to summarize / re-phrase):

    Q1: How does Cadence PAC sampled do this “Ideal Dirac sampling” mathematically? I would like to bring Matlab in agreement with Cadence and it’s easier to do so, if I know the method behind or similar, therefore please see Q1 from my previous post.

    Q2: Is my thinking summary there, now after your last answer, basically correct? Yes or No? And if “No”, why not?

    Q3: Without calling a single Matlab command: Why I reach perfect matching Cadence <=> Matlab from DC until fs/2 by a _DIVISION_ with a ZOH? At the beginning for me logically would have been a multiplication, now, after your last answer, I think I have to do convolution in FD. So why a division now fits?

    Q4: Is my thinking here correct? Yes or No? And if “No”, why not?

    Q5: What would be the correct procedure / method / model of above switched-cap. circuit together with the PAC_sampled analysis: a), b), or any other?

    a) CT (Continuous-Time) Input signal ==> Process it with a CT S&H = ~ CT ZOH stage in s-domain (Model: “(1-exp(-s*Ts))/(s*Ts)“, in reality: Switch1 and cap. “Cs”) ==> Multiply by CT integrator transfer function in s-domain (pink) ==> Do Ideal Dirac sampling (How??) ==> DT out

    b) Any other …

    Q6:  You write in a previous post: “you sample a signal in the time domain by multiplying it with the sampling function…” and “If you want to see the effect of the ZOH (which indeed corresponds to a convolution in the time domain)” => I unfortunately do not get why with a ZOH = ~ Sample&H corresponds to convolving in TD, and sampling a signal in TD = multiply.

     

    Thank you very much for a decent response in advance,

    bernd2700

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Frank Wiedmann
    Frank Wiedmann over 3 years ago in reply to bernd2700

    Well, that MATLAB forum thread shows how sampling with a Dirac impulse train in the time domain leads to a repetition of the spectrum in the frequency domain, which is precisely what the sampled PAC analysis does. If that is not what you need, then please explain in detail what exactly you are trying to accomplish, what exactly you are doing and what exactly is not working as desired. Otherwise, nobody will be able to help you. For example, I have absolutely no idea why the c2d function does not work for you.

    The fact that the division by the sinc function from the ZOH leads to a spectrum that looks similar to the result of the sampled PAC analysis is probably a coincidence. The sinc function has zeros at multiples of the sampling frequency, so you are getting very large values there when you divide by this function. Please note that the result of the division gives you much larger values than the DC gain, unlike the sampled PAC analysis.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • bernd2700
    bernd2700 over 3 years ago in reply to Frank Wiedmann

    Dear Frank,

    First of all, thank you very much for your willingness to help!

    Ì try to explain now my ambitions in another way: So, first, my overall goal is to match a Matlab model to a real Cadence sw.-cap. circuit, that’s a given. To do so, there are 4 things to it:

     

    1. All the basic values of the Matlab model blocks must be set up correctly = the same to agree to the real Cadence circuit (e.g. lossy integrator of 80 dB, not 60, not 100, etc.).
    2. The input stimuli must be identical in both Matlab and Cadence.
    3. The methodology / procedure of the Matlab model must be correct, e.g. where to sample / use which block at which stage and why (See e.g. Q.5, figure a) in my previous post).
    4. Finally, ALSO the evaluation method (“FFT”) of the result must be somehow the same in Matlab as well as in Cadence.

     

    Only if all 4 points are ok, the result of the Matlab model will match the Cadence circuit result.

     

    About point 1 and 2, I am pretty sure that I did well enough, and I don't need further clarification.

    Point 3 and 4 are the big question-marks.

     

    In order to come further on point 4:

    It is, since my Matlab <=> Cadence is NOT in agreement yet, I think, too less, if I just know now that Cadence PAC sampled uses “Ideal Dirac sampling”, not more. This DEFINITLY was an important information from you that I know now at least the method what Cadence uses. I am sure there are numerous ways to implement it in detail. And in this Matlab forum what you linked for me, there is shown one way, as far as I understand it. But maybe it is not the SAME way as Cadence does. Unless you can tell me, loosely formulated, e.g. “Cadence PAC sampled evaluated at a specific edge = Matlab’s c2d command”. If this would be true, I am immediately fine with it and the task concerning point 4 is done. UNFORTUNATELY, as recently found out now and shown now in another, isolated topic post (“51410/how-to-obtain-discrete-time-dt-response-from-a-switched-cap-sc-circuit-integrator”), Cadence PAC sampled evaluated at a specific edge does NOT show “a repetition of the spectrum in the frequency domain” and thus for me does NOT give a DT response - whereas in contrast the Bode diagram of a converted system with “c2d” in Matlab does give. As a consequence, above “statement”: “Cadence PAC sampled evaluated at a specific edge = Matlab’s c2d command” turns out to be NOT true. As a consequence, I unfortunately have to dig in a bit more in detail here, and want to know, which mathematical formula is using Cadence. If I see the same mathematical formula then inside the Matlab command “c2d” I am fine. If I see the answer of Paul, to take an example, then I only know how Paul does it. I have no information about how Matlab does it...   =>  I hope, explained well what I am after?? Maybe you can tell me what to exactly specify in Cadence PAC simulator to really get a DT bode plot answer, and if I compare this then to Matlab’s converted c2d answer, both results suddenly will match, and then I am done successfully on this point. And this then must hold true for ANY circuit - doesn’t matter if it is a switched-cap integrator or a simple stupid analog RC lowpass filter.

     

    Remains point 3:

    I do not know how to specify my question even more precisely than saying: Please have a look at previous post, question Q.5 , Fig a) : Is it correct? YES?? / NO?? MAYBE?? => WHY??

    Since now you also write it’s maybe really just a coincidence if I divide by a ZOH that I get matching results from DC to fs/2 Matlab and Cadence, I need clarification also of this point 3: What would be the correct Matlab model STRUCTURE, i.e. when to sample / process what at which stage? And most important here is the “WHY”, as I need to understand it, because otherwise it’s no good engineering for me. So, if one just answers “Yes, it looks fine, or: No”, I did not gain anything.

     

    I hope I could explain better what I am trying to do all the time and I thank you for an answer,

    & many nice greetings,

    bernd2700

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
>

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information