• 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 30933
  • 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
Parents
  • 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
  • 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
  • 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
  • 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
Reply
  • 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
Children
  • 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
  • bernd2700
    bernd2700 over 3 years ago in reply to Frank Wiedmann

    Dear Frank,

     

    Yes, I have already read through these answers felt 100 times before , and honestly, I couldn’t get all the ideas out of those specific ones (there are other answers from you where I could get out 100%). Why so? :

     

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

    “After the first sampler, the circuit can no longer distinguish between a frequency f and a frequency n*fs+f or n*fs-f”

    If I am correct, the reverse conclusion out of this sentence is: As soon as I use a sampler in the circuit, it automatically must follow a DT signal on its output.  –  However, this doesn’t seem to be the case if you watch my circuit at the very top at this post and follow the blue curve ( = node “Vo_sh1” , after the sampler): The spectrum is NOT being DT.

    I have understood:

    *) You basically say:      Install a sampler in the circuit and its output is DT.         <== This would be also logical to “my theory”!

    *) PAC sampled, however, says:      Although a sampler installed in the circuit, its output is still CT (blue curve).

    For me this is a contradiction. Where is the error??

     

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

     “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).”

    Ok, clear is for me the 2nd part in the parentheses. Not clear is the first part:  Why from DC to fs/2 I shouldn’t see the first sampler’s sinc. shaping effect (e.g. its attenuation of already non-negligible ca. 4 dB at fs/2)??

     

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

    I have also re-visited the topic how conceptionally the PAC sampled is done, and now really have found perfect matching between doing in praxis your verbal description and the real PAC sampled output result. I’m sorry that you had to repeat here an already given answer, but now I got it.

    For the other readers, I show here clearly the result what Frank means:

    In the source V1 I included the AC source “pacm = 1” as well as a sinusoid of 1V with 500 MHz ( = fs/2 here):

     

    So I take the output "out" and do (max-min)/2, so: Manual calculation: “20*log10( 9.887E-3 / 2 ) = -46.12 dB”

    I found out that the small difference from -46.12 dB to -46.06 dB to the “real PAC” comes from the non-steady-state condition where the marker points are taken from.

    So including steady-state-condition it perfectly fits to what Frank has written (not shown here).

     

    What for me is still NOT clear, as written already above, is: As soon as I take the regularly sampled values (here the red curve) why the response is not automatically DT? (here it is, but not in all the cases, as e.g. for my pure analog RC-LPF at the very top).

     

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

    You write: “The normal PAC result of a DT circuit with a ZOH at the output is the sampled PAC * sinc”

    So the equation “pac_normal=pac_sampled.*sinc(f*ts);” seems only valid for above type of circuit. If I would put the same equation but when simulating a CT circuit, as the RC-LPF, I would get wrong results.

    So, I would like to have a general valid statement between the relation of the normal PAC and sampled PAC. Is it maybe just to leave away the “sample” command and take the normal output (e.g. in above picture to take the cyan instead of the red curve) ?

     

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

    “In order to be entirely precise, sampled PAC analysis does not generate a sampled output spectrum, but it samples the transfer function”

    Although I have found it to be for sure a very important info, I am also not completely sure about what you meant here exactly with “samples the tf.” How can something sample a tf? If my tf is e.g. in CT domain, e.g. “mytf = 1/(s+1)”, how can you “sample” that thing? A tf is an equation in my opinion, either in s or in z I know. You also could not mean to do a la: “sample( freqresp ( mytf ))”, because the freqresp is what just the PAC tries to generate.

     

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

    “Wikipedia 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."

    But I do not have a signal consisting of Dirac impulses. I have an analog sinusoid input source and on the output a ZOH. For me this Wikipedia page is not answering my specific question here, or I do not get the point all the time – could be!

     

    In the other forum topic (goto: “51410”), you write: “if you sample a signal in the time domain (by multiplying it with the sampling function), you need to convolute the spectra …” So yes, we sample in TD. But in your Matlab example you still do a multiplication in FD “... = pac_sampled.*sinc( ...” and the result seems to be correct.

     

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

    Last: Can I force SpectreRF to produce a DT Bode diagram? (Independently of the schematics)

    I guess: “Possibly No”, because I already searched some weeks ago before I asked this question inside the PAC menu options for a while but I didn’t find any hint about forcing a DT response and maybe a conversion method to it , BUT: Just because _ I _ did not find, it does NOT mean: There isn’t any available!!! Often, things are hidden or one can apply some tricks. So, here I just can repeat myself: It would be nice, if some-one from Cadence could make a clarifying statement: “YES” or “NO”, and if “yes”, how!

     

     

    Thanks a lot, mainly to you Frank of course for all your effort, but you see, I already came huge steps forward because of you!

    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