• 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. How to obtain Discrete-Time (DT) response from a switched...

Stats

  • Locked Locked
  • Replies 52
  • Subscribers 127
  • Views 30929
  • 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

How to obtain Discrete-Time (DT) response from a switched-cap (SC) circuit (integrator)?

bernd2700
bernd2700 over 3 years ago

Hello everybody!

Before I start my questions, first I have to cite from Mr. Ken Kundert’s excellent paper “sc-filters  -  Simulating with Cadence SpectreRF” the following: “Usually, with switched-capacitor circuits, designers are interested in the discrete-time behavior as switched-capacitor filters are embedded in sampled-data systems. SpectreRF is set up to report on the continuous-time behavior. As such, you must take steps to get the discrete-time behavior if that is what you need. The PNoise analysis does provide a built-in feature that can be invoked in order to determine the noise of a filter acting as a discrete-time system. Otherwise you will need to add a idealized sample-and-hold to your circuit.”

 

He wrote to me at forum “designers-guide.org/.../YaBB.pl” the following: “I'm afraid I have no experience with sampled PAC”, because this was implemented later. So I count on you, Cadence guys that hopefully YOU have an answer to me:

 

Q1: I thought (wrongly) I would obtain the DT response of a system if I specify the special option “SAMPLED” of SpectreRF Periodic-AC (PAC). This is not the case. So, if anyone please could tell me what to do to get the DT frequency response for the PAC analysis? (see graphs below)

 

Q2: Do YOU have an idea which feature can be invoked to obtain the DT system response in the PNoise analysis? As you see above, Ken Kundert indicated so, but did not say which feature. Once, he wrote to me: “I think they confused autonomous sampling (sample very T seconds) and triggered sampling (sample at a threshold crossing), and assumed that triggered sampling in PNoise was enough”.

Ad Q1:

You see an CT (Conttinuous-Time) analog Low-Pass-Filter (LPF) which is simulated with Cadence SpectreRF PAC _sampled and the result of it below.

Ok, this time, it's not a SC circuit, but this is not the topic. It rather is: How to obtain the Bode diagram of the _DT_ response of any circuit.

You can recognize the obtained spectrum is NOT symmetrical around half the sampling frequency fs/2, as I was expecting, but it still seems to show the CT response.

Many thanks in advance and best regards,

bernd2700

  • Cancel
  • bernd2700
    bernd2700 over 3 years ago in reply to Frank Wiedmann

    Dear Frank (& others of course),

     

    Thanks a lot for another clarifying answer. The overall picture is getting a bit better with each answer of you!

    I divided-up my post into 2 sections, 1st concerning purely the PAC sampled simulator and 2nd concerning (purely ?) your sw.-cap. schematic.

     

    1. Concerning purely the SpectreRF analysis (“PAC sampled”):

    You have written: “You don't see any repetition because you are looking at a CT circuit; ... the spectrum repetition comes from the switching in the DT circuit”

    Therefore, what’d you say to my following summary-statement (Frank or other Cadence experts, please either confirm or decline):

     

    “A real DT response (with all its properties = symmetry around fs/2, repetition around fs …) CANNOT be forced by simply setting up a ‘PAC sampled’ analysis, regardless of the PAC menu setup !?? If I want to have a real DT response, I always have to do steps in the circuit/schematic itself !?? The ‘PAC sampled’ stand-alone will not do it for me !??”

     

    Q.1 => Is this statement true or false?

     

    However, what is still a contradiction for me, is: If the “PAC sampled” _DOES_ “Ideal Dirac sampling”, why do I then _NOT_ obtain a real DT spectrum in ALL the cases? Instead, both at the same time seems to be possible (“sampled”, but NO DT spectrum result).

     

    If I understand Mr. Kundert correctly, he wrote that PAC sampled does “autonomous sampling (sample very T seconds)”.

     

    Q.2 => I thought: If I do sample every T seconds, I AUTOMATICALLY obtain a DT spectrum? (True or false?)

     

    So, I somehow need to look “inside” the PAC, how it is working internally.

     

    Q.3 => Therefore, could anyone pls. fill out the empty boxes in below flow diagram to (hopefully) understand better, what the “PAC sampled” analysis internally is doing? :

    I hope there is a way to describe a bit in words with just the “essential” equations (without tons of them, so that non-mathematicians like me are also able to understand maybe).

    My goal is, if I would perform the very same steps in Matlab, I get the very same plot as in Cadence, even beyond fs/2. Because if I just do the ”c2d” command in Matlab, FOR SURE I will get a real DT response. But obviously, this is NOT how it is implemented in Cadence, because one of the 2 PAC sampled options, either the “time averaged” or at “a specific (rising/falling) edge” will NOT match to the converted “c2d” system, because, as Mr. Kundert has written, the SpectreRF is a CT simulator. So I would like to split up the Cadence PAC analysis into parts, that I finally can say: If I apply the output of ANY analog circuit to the Cadence PAC sampled and I also apply the same procedure in another program (e.g. Matlab) I will get basically _identical_ Bode plots, even to a good portion beyond fs/2.

      

     

    2. Concerning circuit (schematics):

    Further, what would be a correct flow diagram of the individual participating logical blocks of your (Frank’s) simple sw.-cap. LPF circuit to finally result in the red curve?

    We agree that your sw.-cap circuit also acts as an integrator (for the rest of the readers, you can see this best, if e.g. the “mid” cap is changed from 10fF to also 1pF and run a transient analysis: The output voltage “out_1p” is integrated-up, step by step, to the finally applied constant DC input voltage of 1V here.):

     

     

     

    In the Frequency-Domain (FD), I found out that modelling a lossy CT integrator (which is a LPF)  DIVIDING by a ZOH (to bring “up” the “nulls” at every n*fs) would give a match from DC until fs/2 at least to your red curve in the spectrum, but as we agreed, this is conceptually wrong (see post “51293”: “is probably a coincidence”). But what is correct then?

     

    You wrote, Frank: “The result of the "normal" pac analysis ... (the blue curve) ... is really the red curve MULTIPLIED by the sinc function due to the zero-order hold at the output”

    So this indicates to me, that if I do “normal PAC” there is an additional ZOH block in the game so that your blue curve can be obtained. But if I do “PAC sampled”, I obtain the red curve and the ZOH block is not there. But this seems in contradiction to my analog LPF at the very beginning of this post, because regardless with which PAC analysis option I treat the output node “Vo”, I obtain the _same_ Bode plot (see my cyan and red curve).

     

    Q.4 => How could a flow diagram of your simple SC circuit look like, if I want to reproduce it with equations?

    You have written: “You don't see any repetition because you are looking at a CT circuit; ... the spectrum repetition comes from the switching in the DT circuit”

    Where is the DT schematic section in this example? Or where would be the boarder / conversion from CT to DT in below flow diagram?

     

    Thank you very much for your reply in advance,

    bernd2700

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

    Conceptually, you can get the amplitude of the result of a sampled PAC analysis result in the following way: Apply a sine with the frequency of interest at the input (with an amplitude that is still within the linear range of the circuit), then note all the values of the output signal at the sampling timepoints (given by the threshold crossings of the sampling signal). The difference between the maximum and the minimum of these values is twice the output amplitude (because you are measuring peak-to-peak). As a result, you will get the response of the CT circuit up to the first sampler multiplied by the response of the following DT circuit. If you have a pure CT circuit, you will get the same result as from a normal PAC analysis (or a simple AC analysis, for that matter).

    In practice, it is usually not worth the effort to model the behavior of a DT circuit for input frequencies far beyond the Nyquist frequency. For this reason, environments like MATLAB might not provide any built-in functions for this purpose. If you like, you can of course multiply the the frequency response H(:) of the example I gave you with the frequency response of a CT lowpass.

    The normal PAC analysis result of a DT circuit with a piecewise constant response at the output (also called zero-order hold) is simply the result of the sampled PAC analysis multiplied by the sinc function (see https://en.wikipedia.org/wiki/Zero-order_hold for details).

    Finally, my example circuit is a simple lowpass filter, so I am not quite sure why you are putting additional integrators into your models. By the way, in practice, lowpass filters (above the corner frequency) are often used as integrators and little distinction is made between the two.

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

    Dear Frank,

     

    That’s what I am trying to do all the time in a similar way:

    Your switched cap Low Pass Filter example (I called it a lossy integrator, the transfer functions basically are the same) has an equivalent resistance of Req = 1/(C0*fs) = 1/(10fF*1GHz) = 100 k. Thus I form a CT LPF with Req=100k and C1=1pF, thus its mathematical equivalent transfer-function is: LPF_CT = 1/(s*Req*C1+1) , and so: “LPF_CT=1/(s*1E-7+1);”. So far, so good.

     

    I have understood from your previous post: The result of the normal PAC is ca. the PAC sampled curve multiplied by the sinc function due to the zero-order hold at the output.

    The tf. of a ZOH is: “ZOH_CT = (1-exp(-s*Ts))/(s*Ts);”, whereas “fs=1E9; Ts=1/fs;”.

     

    So, if I multiply my LPF by the tf. of the ZOH, which is:

    “Out_to_PAC = LPF_CT * ZOH_CT;”

     

    and I would do now:

    “bode( Out_to_PAC );”

     

    , the result is definitely not the same result as it comes out of the Cadence PAC analysis, I even do not want to show here the plot, because it’s wrong for sure, because 1st, I still miss the transfer function which is generated by the “PAC sampled” itself (this ideal Dirac sampling stuff; therefore I write "Out_to_PAC"), and 2nd, you write: “As a result, you will get the response of the CT circuit up to the first sampler multiplied by the response of the following DT circuit.” But where in-between of my equations to do the c2d command? If I would write: “Out_to_PAC = c2d(LPF_CT) * ZOH_CT;” , this is again nonsense. But how to do correctly?????????

     

    Thanks a lot,

    bernd2700

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

    I have already shown you how to get a frequency response in MATLAB that corresponds to the result of a sampled PAC analysis. In order to get the result of the normal PAC analysis, you simply have to multiply this frequency response by the sinc function. Here is the updated version of my MATLAB script, this time with the same values as in my circuit example:

    opt=bodeoptions;
    opt.FreqUnits = 'Hz';
    sys=zpk([],-1e7,1e7)
    figure
    bodeplot(sys,{1e4,1e10},opt)
    ts=1e-9;
    sysd=c2d(sys,ts,'impulse')
    figure
    bodeplot(sysd,{1e4,1e10},opt)
    f=logspace(4,14,1000001)';
    pac_sampled=freqresp(sysd,f,'Hz');
    pac_sampled=pac_sampled(:);
    figure
    semilogx(f,db(pac_sampled))
    pac_normal=pac_sampled.*sinc(f*ts);
    figure
    semilogx(f,db(pac_normal))
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • bernd2700
    bernd2700 over 3 years ago in reply to Frank Wiedmann

    Dear Frank,

     

    That’s another important answer for me that you gave here, and I thank you for that!

    However, this seems to be again specific to this type of circuit. What I am after here, is a GENERAL procedure how the PAC (sampled) is working, and which can be applied to ANY type of circuit.

    Explained in more detail, this means: If I translate into a graphical flow diagram what you have just typed in the Matlab code for THIS circuit, it shows that I have to apply the red path at the end:

     

    Side remark: I’ve done some sims. in the meantime and it seems for me that the result of a “normal PAC” is identical to the “PAC sampled, time averaged option” (“proof” not shown here; And please: Cadence experts, please correct me if this doesn’t hold true everywhere, I mean if the algorithm in the background is not the same implemented for both.).

     

    So, let’s say, I have given your circuit and as a result I would like to have the Bode diagram of the analysis type “normal PAC”. Thus, I just have to follow the red path (because I selected “PAC normal”), and I am done. I herewith have successfully obtained the same result as the Bode plot out of Cadence.

    Now, let’s say, I wanna apply the “normal PAC” analysis again, but this time to _another_ given circuit. So, because I selected again the “PAC normal” I also call again the red path. But this time, the circuit is my pure analog LPF example at the very beginning of this post! If I would do so and apply the same procedure ( = red path) to my ordinary pure RC analog LPF, I will suddenly obtain a wrong result, even if I have done a correct model of the schematic! (In fact, none of the blue, red, cyan line at the very top of this post shows a “*sinc” behaviour!)

    We see, the flow diagram / procedure / equivalent Matlab commands which have worked for one case didn’t work out for another, this is bad! It happens, because things are mixed here unfortunately, and my goal is to separate them clearly: Equivalent Matlab commands necessary for the circuit model, and equivalent Matlab commands necessary for the PAC analysis itself. This procedure / flow diagram should – of course – hold true for ANY type of analog schematic (model). Please help me with this!

    I hope, I described well enough what I am after all day long?

     

    I just can repeat: Many thanks in advance,

    bernd2700

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

    For a CT circuit like the pure RC analog LPF, you have a model in the s-domain (without the c2d function) and the freqresp function to get the frequency response (without the sinc function that is due to the piecewise constant output signal of the DT circuit). I have already mentioned that for a CT circuit, sampled PAC, normal PAC and a simple AC analysis will all give the same result. MATLAB is not a circuit simulator and (as far as I know) does not have an exact equivalent for the PAC analysis that can be used in exactly the same way for both DT and CT circuits.

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

    Dear Frank,

    Yes, you write it spot-on!

    The optimum for me would be a ready-made Matlab command called for instance “freqresp_EquivSpectrePAC”, and well documented what hides beneath it.

    Unfortunately, this doesn’t seem to be available yet.

    It simply would have the following enormous advantage: If I do in Matlab a model of my circuit, then call this command, and the result does not match the real circuit’s Cadence PAC result, I know automatically it is the model of my circuit which needs correction, because the (PAC) analysis method is (approx.) the same.

     

    Let’s assume, I only have a “pure analog circuit”, such as e.g. this RC-LPF (no SC. things). Let’s further call now the normal “AC” analysis from Cadence, and on the Matlab side, I do “freqresp” of my model in “s”. Here, it’s simple and I think I can easily state: If the Bode plot results Cadence <=> Matlab are different, it is the model of the circuit which needs correction.

    ==> For that reason, I would like to have the same for the SC. / PAC stuff, as described above.

     

    As you write: “Matlab is not a circuit simulator” - which indicates to me, that, PAC internally, things are possibly calculated completely differently, but: Is there really no way to do a model of the Cadence PAC analysis itself, so to “just write some Matlab commands / equations” which are executed when calling my invented command “freqresp_EquivSpectrePAC” which will do similar (with maybe some limitations) when a model in “s” is feeded to it? A là: “[ H , w_out ] = freqresp_EquivSpectrePAC( sys , w , ‘sampled’ , ‘rising’ )” ?

     

    I am convinced it would be extremely useful, not only for me but also for a lot of other people!

     

    Best regards,

    bernd2700

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

    I don't know a simple way to exactly model the PAC analysis in MATLAB, but I am not really an expert here. You should better ask this question at https://mathworks.com/matlabcentral/answers/ . I have already described above how the PAC analysis works conceptually.

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

    Dear Frank,

     

    I think I cannot ask this question there, since it is not a question about (a) specific Matlab command(s). For me it seems to be rather a question to re-type the necessary just conventional equations in ANY other program to re-produce how Cadence has implemented the PAC. And this, Mathworks cannot know. But Cadence of course knows how they did it, therefore my question in a Cadence forum.

    You write, you ”have already described above how the PAC analysis works conceptually”. Of course I remember that you wrote about that PAC uses this “ideal Dirac sampling” (for other readers, refer to forum topic “51410”). As I said, I try to read all your answers carefully, but it seems, that I am mathematically unfortunately a bit too weak that I can produce out of this, what does it mean in terms of concrete equations to type if I start searching the internet.

    As a perfect example, you have written me a _concrete_ netlist for a circuit and the _concrete_ equation: “pac_normal=pac_sampled.*sinc(f*ts);”, where I really was able to re-simulate it on my own at home and also could plug in some values in your concrete equations and see the output results and can compare. That’s the level I need and where I can follow how it is done correctly. And I thank you 1000 times for that concrete example! I am sure, many other people will find it helpful, too!

     

    And this concrete example from you permits me to be able to ask specific questions, where the following ones remain:

    Q1.: What I still didn’t understand is why you did a multiplication with the sinc function in Frequency-Domain (FD). I know already that convolution in Time-Domain (TD) automatically means multiplication in FD and vice versa. But what is telling you that multiplication in FD is here the right way to chose?

     

    Q2.: Is there now a convenient way (e.g. over the PAC menu or Spectre settings anywhere else) to force the PAC analysis to get a Bode plot in Discrete-Time (DT) domain of ANY circuit (also e.g. for the RC-LPF)?

     

    Q3.: If the PAC does perform this “ideal Dirac sampling”, I mean it’s also “sampling”, so taking values at every “n*Ts”, correct? Why I do not get then automatically a real DT response?

     

    Thanks a lot,

    bernd2700

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

    I am going to repeat some relevant quotes here that will hopefully help you find the answers to your questions yourself.

    Frank Wiedmann said:
    The repetition in the frequency domain comes from the circuit, not from the sampled PAC analysis by itself. After the first sampler, the circuit can no longer distinguish between a frequency f and a frequency n*fs+f or n*fs-f where fs is the sampling frequency and n is an integer. You will still see differences in the result due to circuit components up to the first sampler. However, you will not get the sinc shaping from the zero-order hold at the output (or effects from anything else that happens between the sampled points).
    Frank Wiedmann said:
    Conceptually, you can get the amplitude of the result of a sampled PAC analysis result in the following way: Apply a sine with the frequency of interest at the input (with an amplitude that is still within the linear range of the circuit), then note all the values of the output signal at the sampling timepoints (given by the threshold crossings of the sampling signal). The difference between the maximum and the minimum of these values is twice the output amplitude (because you are measuring peak-to-peak). As a result, you will get the response of the CT circuit up to the first sampler multiplied by the response of the following DT circuit. If you have a pure CT circuit, you will get the same result as from a normal PAC analysis (or a simple AC analysis, for that matter).
    Frank Wiedmann said:
    The normal PAC analysis result of a DT circuit with a piecewise constant response at the output (also called zero-order hold) is simply the result of the sampled PAC analysis multiplied by the sinc function (see https://en.wikipedia.org/wiki/Zero-order_hold for details).

    This Wikipedia page explains why going from a signal consisting of Dirac impulses to a piecewise constant signal in the time domain corresponds to a multiplication by the sinc function in the frequency domain.

    • 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