• 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 30913
  • 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
  • SpiceMonkey
    SpiceMonkey over 3 years ago

    You have got the right DT bode plot.

    For time-averaged PAC, you have got a response looks like sinc function (green one, it looks right)
    For sampled PAC, you should get a replica response in every Fs frequecncy (blue one, it also looks right)

    The blue one seems not that accurate, if you change you frequncy display type, or try linear with smaller step, or logrithm with 100 points per decade, you will get a more accurate response: exact replica every fs and each has fs/2-symmetry .

    For CT circut, I think you could also get a sampled PAC: just place a vpulse without any connection,  then use vpulse's frequecy as pss-beat-frequency and use it's posedge as sampled event. (make sure your circuit is periodic or just simply set the input transient signal = zero).

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 3 years ago in reply to SpiceMonkey

    Dear bernd2700,

    Well, after reading through your conversations with Mr. Kundert and your prior posts, I must also agree with Mr. Kundert's comment to one of your posts:

    "Too many questions all at once.  I need to focus on one at a time.  So lets focus on #1."

    bernd2700 said:
    It rather is: How to obtain the Bode diagram of the _DT_ response of any circuit.

    If you are just trying to find the Bode diagram, it seems as if spectreRF is not the most efficient simulation tool to use. Clearly you can view the second and third order effects of a transistor implementation of a discrete-time system, but it seems that i will take a lot more time and effort to find just its transfer function and Bode plot than using one of your MatLab models or a simulator designed for SC circuits such as Switcap.

    However, in spite of my trying to read through all your posts, I still do not know what your end goal is. So perhaps my comment is not relevant for which I apologize.

    Shawn

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

    Dear SpiceMonkey,

    Thank you for your reply!

    You write “For sampled PAC, you should get a replica response in every Fs frequecncy (blue one, it also looks right)”. Yes, you are exactly correct, I “SHOULD GET”, but I think I unfortunately “do NOT get” if I watch the blue curve. Why? Because a DT spectrum must be symmetrical around fs/2, and fs/2 in my case is 500 Hz. So I would have expected that the line is up at 0 dB again at fs = 1kHz in the Bode diagram, as it is also 0 dB for DC (here at e.g. 1 mHz since it’s a log plot). But it does NOT show 0 dB at fs = 1kHz. Instead, it goes further down with e.g. -20dB/dec, which, as a consequence, tells me, it is NOT the DT spectrum / response what I get but something else. Which simulator setup do I miss, or what I am doing wrong here? So, what to do, in order to obtain the Bode plot’s DT response, since Mr. Kundert perfectly has written in an article: “... you must understand upfront if you are interested in the CT or in the DT response of a system” => And yes, I am interested in the DT response and was thinking: This, I will get with the “PAC _sampled_” analysis at a specific (e.g. rising or falling) edge (every 1 ms), but as the Bode plot reveals, for me ( = not being symm. around fs/2) I still did NOT obtain the DT response.

    I even have 1000 points per decade, and from the below picture, you see, it is NOT symm. around fs/2 = 500 Hz, therefore your first sentence “You have got the right DT bode plot” confuses me.

    If you look at my schematic, it is exactly what I already did what you propose: I added a vpulse with 1kHz and used it for the PSS, see voltage “v1” and node “p1” there.

    Above Fig.: SpectreRF PAC sampled analysis, e.g. at rising edge (@ 500us): There is NO line going up to 0 dB again at fs=1kHz => No DT Bode plot!

    Thanks a lot so far and I am curious about your answer(s),

    bernd2700

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

    Dear Shawn,

    also thanks to you for your answer!

    Of course, I took to my heart Mr. Kunderts recommendation “not too many questions at once” and therefore reduced it to only 2 questions: Both – in my opinion – formulated as precise as possible. Honestly, I do not have an idea at the moment how to formulate my 2 questions even more precisely than: “Q1: What to do in SpectreRF PAC analysis to get a real DT Bode plot = symm. around fs/2” and “Q2: What to do in PNoise analysis to get the DT response, so what exactly to “invoke” there? (as there is no “sampled” option available)”

    My overall goal is quickly described: “Simply” (I thought, haha) to bring a Matlab model in agreement with the reference, a real switched-cap circuit in Cadence and from these, the Bode plots of the DT response, since I am interested in this one, as Mr. Kundert writes. So, my goal is reached if I see the _same_ result from both finally (apart from small deviations where I understand from where they come from). Therefore it is not helpful for me to just do the game in one of those either in Matlab or in Cadence. (And besides, it is my "specification" to use Cadence and Matlab.)

    Finally: Every comment I try to consider thoroughly and I am happy about!

    Thanks a lot so far and I am curious about your answer(s),

    bernd2700

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

    In order to be entirely precise, sampled PAC analysis does not generate a sampled output spectrum, but it samples the transfer function. 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).

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

    Frank, that’s VERY important information you give here, 1000 thanks for it, and this info is exactly what I need, and it seems to be written nowhere or at least well-hidden from me – and: It didn’t need a single equation for that :-) (you can guess, I’m not a mathematician).

    Since your post is full of essential, compact info, I divide it into more parts which I can then address separately:

    1. “sampled PAC analysis does not generate a sampled output spectrum”
    2. “but sampled PAC samples the transfer function”
    3. “The repetition in the frequency domain comes from the circuit, not from the sampled PAC analysis by itself”
    4. “After the first sampler, the circuit can no longer distinguish between a frequency f and a frequency n*fs+f or n*fs-f”
    5. “You will still see differences in the result due to circuit components up to the first sampler.”
    6. “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).”

    Point 1: I already had the feeling which I have proven now with my last plot here, but it is good, that also you write it that clearly. => But how to generate a sampled output spectrum with Cadence PAC analysis? Which knobs I have to press to get it?

    What do you mean for point 2? How is sampled PAC operating? A kind of flow diagram would be extremely helpful, if someone could draw!

    For point 3: Ok, that's basically very good info, but: You speak about “repetition in the FD”, and also "Spice Monkey" has written “You have got the right DT bode plot”. Sorry, maybe I am completely stupid now, but, guys, where do you see a repetition or a DT bode plot here? Please, someone has a detailed look to my picture with linear x-axis (frequency) zoomed-in from DC to 4.8 kHz: For me, there is NO such repetition of the frequency domain at all, and moreover, for me it is not symmetrical around fs/2 = 500 Hz, i.e. as written, none of the cyan, blue, red, green line is going up to 0 dB at fs=1kHz again as it is 0 dB for DC, as also indicated by the two markers A and B. As a consequence, for me, this CANNOT be a DT bode plot, can it? Maybe this consequence is wrong, but for me until now, this was a given, as 1+1=2, but I have to question this now if already 2 people start seeing a DT response here!? I am getting confused. (I would like and try all the time to get at DT response, but how?)

    For point 4: With “first sampler” I think, you mean the “Ideal S&H” with reference designator e.g. “id_sh.I1” with input node “Vo” and output node “Vo_sh1”, correct?

    For point 6: This unfortunately is still not clear to me what is really going on in Cadence PAC analysis: First we obviously have to distinguish between the outputs “time averaged” (red and green curve in the last picture) and the outputs at rising edge (cyan and blue). Exactly therefore I plotted all 4 possible combinations.

    I re-plot now, it’s exactly the same graph as in my last post, but now I just dashed some lines and made them thicker that everyone in this forum clearly can see which line color is producing which result.

    We see: In only one case of “time averaged” I do see sinc stuff (green), for the rising edge at 500us I don’t. To which case are you referring to, Frank, when you write “you will not get the sinc shaping from the zero-order hold at the output”?

    I (wrongly) thought: As soon as I insert Mr. Kundert’s “Ideal S&H” block in the circuit, I will obtain a sinc shaping, regardless of the specific type of the PAC analysis, but this is wrong, since the blue line is AFTER the S&H and also does not show sinc shaping.

    Unless I don’t know what’s really going on in Cadence PAC sampled, it’s hard for me to do an equivalent Matlab model of this simple sampled RC low pass filter, but that’s another story, and in order that it is not confusing for other people, it is not the topic of this isolated post, the topic rather is: Which knobs to press in order to get out a discrete-time Bode diagram from the Cadence PAC analysis of this circuit? I thought at the beginning of my post: It’s a very simple question, and someone will write: Go to PAC analysis menu X, tick on that and specify Y there & voilà you get the DT Bode plot response.

     

    Thank you so much in advance for your answers & many nice greetings,

    bernd2700

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

    You don't see any repetition because you are looking at a CT circuit; as I mentioned, the spectrum repetition comes from the switching in the DT circuit. With first sampler, I basically mean the first switch after the source.

    Here is a simple switched-capacitor filter for you to study:

    simulator lang=spectre
    global 0
    Vsmp (smp 0) vsource type=sine ampl=1 freq=1G
    Vin (in 0) vsource type=sine pacmag=1
    R1 (smp 0) resistor r=1K
    C0 (mid 0) capacitor c=10f
    C1 (out 0) capacitor c=1p
    W1 (mid out smp 0) relay vt1=-100m vt2=-200m ropen=1T rclosed=1.0
    W0 (in mid smp 0) relay vt1=100.0m vt2=200.0m ropen=1T rclosed=1.0
    simulatorOptions options psfversion="1.4.0" reltol=1e-3 vabstol=1e-6 \
    iabstol=1e-12 temp=27 tnom=27 scalem=1.0 scale=1.0 gmin=1e-12 rforce=1 \
    maxnotes=5 maxwarns=5 digits=5 cols=80 pivrel=1e-3
    pss pss fund=1G harms=1 errpreset=conservative maxacfreq=1T
    + annotate=status
    pac ( smp 0 ) pac crossingdirection=rise thresholdvalue=0
    + ptvtype=sampled start=1 stop=1T dec=10000 maxsideband=0
    + annotate=status
    pac_avg pac start=1 stop=1T dec=10000 maxsideband=0
    + annotate=status
    saveOptions options save=allpub

    And here is the equivalent time-continuous filter:

    simulator lang=spectre
    global 0
    Vsmp (smp 0) vsource type=sine ampl=1 freq=1G
    Vin (in 0) vsource type=sine pacmag=1
    R1 (smp 0) resistor r=1K
    R0 (in out) resistor r=100K
    C0 (out 0) capacitor c=1p
    simulatorOptions options psfversion="1.4.0" reltol=1e-3 vabstol=1e-6 \
    iabstol=1e-12 temp=27 tnom=27 scalem=1.0 scale=1.0 gmin=1e-12 rforce=1 \
    maxnotes=5 maxwarns=5 digits=5 cols=80 pivrel=1e-3
    pss pss fund=1G harms=1 errpreset=conservative maxacfreq=1T
    + annotate=status
    pac ( smp 0 ) pac crossingdirection=rise thresholdvalue=0
    + ptvtype=sampled start=1 stop=1T dec=10000 maxsideband=0
    + annotate=status
    pac_avg pac start=1 stop=1T dec=10000 maxsideband=0
    + annotate=status
    saveOptions options save=allpub

    Finally, here is something for you to try in MATLAB (with a different frequency scale):

    sys=zpk([],-1,1)
    figure
    bodeplot(sys,{1e-3,1e3})
    sysd=c2d(sys,.002*pi)
    figure
    bodeplot(sysd,{1e-3,1e3})
    w=logspace(-3,7,1000000);
    H=freqresp(sysd,w);
    figure
    semilogx(w,db(H(:)))

    I hope that studying these examples will make things clearer for you.

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

    Here is the schematic of the switched-capacitor filter:

    The time-continuous filter simply has a 100k resistor instead of the two switches and C0.

    Here are the simulation results:

    For the time-continuous filter, the results of the sampled and the "normal" pac analysis are identical (the green curve). For the switched-capacitor filter, the sampled pac analysis shows the expected repetition of the spectrum in the frequency domain (the red curve). At very high frequencies, the effect of the low-pass formed by the on-resistance of the switch W0 and the capacitance C0 can be seen.

    The result of the "normal" pac analysis of the switched-capacitor filter (the blue curve) looks very similar to the result of the time-continuous filter, but it is really the red curve multiplied by the sinc function due to the zero-order hold at the output. The very low values at the multiples of the sampling frequency are not numerical artifacts, but they come from the multiplication of the finite dc gain with the zeros of the sinc function.

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

    Dear Frank!

    Thanks for your nice answer, I had to do something else in the meantime, just give me a bit of time to go through your postings carefully and I will come back ...  => Generally, I like to ask questions, which I before have verified / thought about them, because it is the time which you also need to spend and I thank you for that, so  it should not be "just to write anything".

    To the topic: At least, I quickly managed to first simulate your netlist, but then also have drawn the schematic on my own (since it's easier with modifications as just from a netlist), and here, what I have for the rest of maybe interested readers, is how the switches are operating, so they have the following properties I found out:

    *) In Cadence analogLib, they call "switch = relay"

    *) Open voltage = If the voltage is less than this value, the switch is open = referred to as "vt1"

    *) Closed voltage = If the voltage is greather than this value, the switch is closed = referred to as "vt2"

    *) And the pinout of the switch in the netlist, e.g.: "W0 ( n+ n- nc+ nc-)", whereas, as you can see from my below schematics, the "nc" are the control terminals of it.

    Unfortunately the following transient simulation result I did for just testing the switches, somehow does not agree with the statements of the netlists: In Frank's netlist (and also in mine ! ), vt2 = +200mV of switch W0 is given. This should mean, that it should close when the control voltage (here "smp") rises above 0.2V, as far as I have understood the thing. But we see from the transient sim. result below, that they close and open only at around 100mV, not 200mV (I extra set maxstep to 100fs that the resolution is good). So I don't know for the moment why ...

     

    R2 (out 0) resistor r=1K
    R1 (mid 0) resistor r=1K
    R0 (smp 0) resistor r=1K
    V0 (smp 0) vsource dc=0 type=sine freq=1G ampl=1
    W1 (in out smp 0) relay vt1=-100m vt2=-200m ropen=1T rclosed=1.0
    W0 (in mid smp 0) relay vt1=100m vt2=200m ropen=1T rclosed=1.0
    C1 (net25 0) capacitor c=1p
    C0 (net025 0) capacitor c=10f
    V2 (in 0) vsource type=pwl wave=[ 0 0 9p 0 10p 1 ]
    simulatorOptions options psfversion="1.1.0" reltol=1e-3 vabstol=1e-6 \
    iabstol=1e-12 temp=27 tnom=27 scalem=1.0 scale=1.0 gmin=1e-12 rforce=1 \
    maxnotes=5 maxwarns=5 digits=5 cols=80 pivrel=1e-3 \
    sensfile="../psf/sens.output" dochecklimit=yes checklimitdest=both
    tranCheckLimit checklimit checkallasserts=yes severity=none
    tran tran stop=3n maxstep=100f write="spectre.ic" writefinal="spectre.fc" \
    method=gear2only annotate=status maxiters=5
    primitives info what=primitives where=rawfile
    subckts info what=subckts where=rawfile
    designParamVals info what=parameters where=rawfile
    asserts info what=assert where=rawfile
    saveOptions options save=allpub currents=all

     

    And: I have to understand, why in my original schematic at the very beginning ( = also a simple low-pass-filter) there is a green sinc-shaped like curve but only for PAC time-averaged and additionally going  "further _down_" beyond fs, so not being a DT spectrum at all, in my opinion, even not for PAC sampled (although SpiceMonkey said so for my linear frequency axis plot "You have got the right DT bode plot”). And in contrast to this: In YOUR (Frank's) schematic, the red curve of the PAC sampled is INDEED a DT spectrum, exactly I was searching for all the time. But here, there comes in your statement: "It's not the PAC sampled which is generating the DT spectrum but the circuit itself." So I have to find out all the relationships why the switches behave somehow differently than the "ideal S&H" of Mr. Kundert, which I have originally instantiated, because the switches also have some kind of "hold" (during the off state) at least, and moreover, Mr. Kundert has written they are even "Track&Hold", not ("S&H" which is approx. ZOH). Too much sample* stuff, all similar, but everything still a bit different! You see, I originally tried PACsampled TOGETHER WITH a S&H and I STILL did not obtain a DT response. So: What is THE correct block if I only want to see a DT spectrum (& make a model of this), and could it be obtained solely by the PAC sampled with modifying some settings? So these are the unclear things, and for this, I think this circuit comparison is perfect for it to study in detail. Maybe someone is faster in answering this, because he/she knows this already...

    CU, thanks so far, and many nice greetings,

    bernd2700

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

    If you type spectre -h relay at the command line, you will get the documentation for the relay component that includes the equation for the conductance between vt1 and vt2. By the way, the exact value of the control voltage where the switch closes or opens is not really important for the functionality of the circuit.

    • 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