The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> PAC of a VCO and a few other questions
https://designers-guide.org/forum/YaBB.pl?num=1124964940

Message started by svensl on Aug 25th, 2005, 3:15am

Title: PAC of a VCO and a few other questions
Post by svensl on Aug 25th, 2005, 3:15am

1)
The PAC output of a VCO should look like the one of an integrator. When using the code given below, the magnitude of the response is only a few mV. It should have a very high gain at dc, should it not? I am confused.
.....
analog begin
freq=f0+Kvco*V(in);
$bound_step(0.01/freq);
phase=2*PI*idtmod(freq, 0, 1, -0.5);
V(out) <+ sin (phase)
end
.....
f0=1e6, Kvco=0.5e6
clkalone pss fund=1e6 errpreset=conservative
freqresp pac start=0.1 stop=1e6/4 log=500

2)
When using phase=2*PI*idtmod(freq, 0, 1); instead of
phase=2*PI*idtmod(freq, 0, 1, -0.5); the PSS will just sit there and do nothing. Why is that? Do I need an offset?

3)
I found that there is a difference between
@(cross( x - 0.5 ,1))
and
@(cross( x - 1/2 ,1))
When using 1/2 it will not trigger.

BTW, I am currently using version 5.10.41.052404

Thanks,
Any feedback is appreciated.

Title: Re: PAC of a VCO and a few other questions
Post by Eugene on Aug 25th, 2005, 8:32am

Regarding item #3, assuming the 1/2 and 0.5 are the only differences in your file, try replacing 2 with 2.0. On some rare occasions I've seen the ".0" make a difference.

Title: Re: PAC of a VCO and a few other questions
Post by Eugene on Aug 25th, 2005, 8:37am

Regarding item #1, the integration is associated with phase. Is your PAC analysis looking at VCO phase or VCO voltage?

Title: Re: PAC of a VCO and a few other questions
Post by Eugene on Aug 25th, 2005, 8:44am

Regarding item #2, I think we need more information. Is x from #3 somehow related to the idtmod of #2? It sounds like the lack of an offset shifts the idtmod output such that it never crosses some sort of key threshold.

Title: Re: PAC of a VCO and a few other questions
Post by svensl on Aug 25th, 2005, 9:02am

Thanks Eugene for taking the time to answer my questions.

Eugene wrote on Aug 25th, 2005, 8:37am:
 Regarding item #1, the integration is associated with phase. Is your PAC analysis looking at VCO phase or VCO voltage?

I have the output defined as voltages. How would that make  difference? Please explain your thoughts.


Eugene wrote on Aug 25th, 2005, 8:37am:
Regarding item #3, assuming the 1/2 and 0.5 are the only differences in your file, try replacing 2 with 2.0. On some rare occasions I've seen the ".0" make a difference.

That solved the problem. That is funny. Why would there be a difference between 1/2.0 and 1/2?


Eugene wrote on Aug 25th, 2005, 8:37am:
  Regarding item #2, I think we need more information. Is x from #3 somehow related to the idtmod of #2? It sounds like the lack of an offset shifts the idtmod output such that it never crosses some sort of key threshold.

When I take the code from #1 and do a PSS as shown it works fine. When I do the same thing again, but this time remove the offset or have 0 offset, the PSS will run once, and sit at the beginning of the second try forever.

Title: Re: PAC of a VCO and a few other questions
Post by Geoffrey_Coram on Aug 25th, 2005, 10:13am

> Why would there be a difference between 1/2.0 and 1/2?

1/2 is an integer divide, according to the rules of Verilog. :(

Title: Re: PAC of a VCO and a few other questions
Post by Eugene on Aug 25th, 2005, 10:58am

Item #1:
You are of course right about integrals producing infinite AC response at DC but the VCO voltage is a sinusoidal function of phase and a sinusoid  is bounded.  In fact, regardless of the phase, the amplitude of the sinusoid is constant. So if your PAC analysis looks only at voltage amplitude, you will see little or no dependence on the integral of frequency. You must detect phase to see the effects of the integral in a PAC analysis and that is not trivial.

Note that the "phase" button on the pac output form is for the phase of the transfer function, not the phase of the VCO output. You can have a transfer function from frequency input to amplitude output and from frequency input to phase output. Both transfer functions have phase and those phases are not the same as the phase of the VCO output. For the output of interest, you can only select peak or rms units, which both relate to the amplitude of the sinusoidal VCO output, not its phase. You will need a phase detector to get the transfer function from frequency input to VCO phase.

Item #2:
Thanks for the information Geoffrey. My knowledge of the integer divide was strictly empirical. I did not know it was related to the standard. Personally, I would like to see this problem classified as a bug.

Item #3:
I suspect the idtmod drives something; some other signal probably depends on the idtmod output, probably by way of a threshold. If you remove the offset, you shift the idtmod output, perhaps such that the idtmod output can no longer trip the threshold. That's just my guess. As I hinted, it's hard to diagnose the problem without more of the code.

Title: Re: PAC of a VCO and a few other questions
Post by Eugene on Aug 25th, 2005, 11:33am

Regarding item #2, I believe I've duplicated the problem. I think it's a bug. I'll add more later. I have to run.

Title: Re: PAC of a VCO and a few other questions
Post by Geoffrey_Coram on Aug 25th, 2005, 12:27pm


Eugene wrote on Aug 25th, 2005, 10:58am:
Item #2:
Thanks for the information Geoffrey. My knowledge of the integer divide was strictly empirical. I did not know it was related to the standard. Personally, I would like to see this problem classified as a bug.


Try it in C:
 double foo;
 foo = 1/2;
 printf("foo = %f \n", foo);

I get 0.000000.

Title: Re: PAC of a VCO and a few other questions
Post by Eugene on Aug 25th, 2005, 1:57pm

The code below duplicates problem #3. Without the offset, PSS makes the first pass and then hangs. In my opinion, regardless of the error, the simulator should never just hang. I should have gotten a warning or error message, even a cryptic one. But to just hang is very strange. I would strip the circuit down to its most simple form and submit it to Cadence.

In the circuit below, I drove vin with a one volt DC source. I included an external 1Hz source to make sure the time steps were correct and to have a named frequency.  Commenting out the idtmod with the offset and uncommenting the other reproduces the problem I think you encountered. One source runs phase from 0 to 2pi while the one that works runs the phase from -pi to +pi. I have no idea why one works and the other causes PSS to hang but as I said, I think it's a bug.

module vco(vout, vin);
output vout;
electrical vout;
input vin;
electrical vin;
real phase;

analog begin
  //phase = idtmod(V(vin),0,1,-0.5);//Works.
  phase = idtmod(V(vin),0,1);//Hangs PSS.
  V(vout) <+ sin(`M_TWO_PI*phase);
end
endmodule

Title: Re: PAC of a VCO and a few other questions
Post by svensl on Aug 25th, 2005, 10:39pm

Thanks for the feedback and recognizing (duplicating) the issues I raised.

For the problem with the PSS that hangs at the second trial, I would not really know how to strip the circuit down even simpler as it is already consists of only two lines of code.
BTW, Spectre version 5.033 produces the same errors. I had only tested the code with 5.141.

Eugene, thanks for explaining more on phase and voltages. But one more question, when I have the vco offset frequency f0=0 and leave Kvco at Kvco=1e6 and do a PSS and PAC with fund=1e6 then, it will give me a very large gain at dc. So, with f0=1e6 almost no gain at dc, with f0=0 almost infinity.

I do agree that 2 is an integer, but that should no make 1/2 an integer too, especially when ones assigns  1/2 to a variable of type other than integer as Geoffrey_Coram did with the C program.

Title: Re: PAC of a VCO and a few other questions
Post by Frank Wiedmann on Aug 26th, 2005, 1:04am


svensl wrote on Aug 25th, 2005, 10:39pm:
I do agree that 2 is an integer, but that should no make 1/2 an integer too, especially when ones assigns  1/2 to a variable of type other than integer as Geoffrey_Coram did with the C program.

The result of 1/2 is first calculated as an integer (giving 0), then this result is assigned to the variable (this action of course does not change the value of the result). Although it may be non-intuitive, this is the standard behavior of programming languages like C and Fortran, see e.g. http://computer.howstuffworks.com/c11.htm and http://www.liv.ac.uk/HPC/HTMLF90Course/HTMLF90CourseNotesnode112.html.

Title: Re: PAC of a VCO and a few other questions
Post by svensl on Aug 26th, 2005, 1:21am


Frank Wiedmann wrote on Aug 26th, 2005, 1:04am:
The result of 1/2 is first calculated as an integer (giving 0), then this result is assigned to the variable (this action of course does not change the value of the result). Although it may be non-intuitive, this is the standard behavior of programming languages like C and Fortran, see e.g. http://computer.howstuffworks.com/c11.htm and http://www.liv.ac.uk/HPC/HTMLF90Course/HTMLF90CourseNotesnode112.html.

Thanks for pointing that out to me Frank. I will keep it in mind in the future.

Title: Re: PAC of a VCO and a few other questions
Post by Frank Wiedmann on Aug 26th, 2005, 4:20am


Eugene wrote on Aug 25th, 2005, 1:57pm:
The code below duplicates problem #3. Without the offset, PSS makes the first pass and then hangs. In my opinion, regardless of the error, the simulator should never just hang. I should have gotten a warning or error message, even a cryptic one. But to just hang is very strange. I would strip the circuit down to its most simple form and submit it to Cadence.

I can also confirm this problem (with Spectre version 5.10.41_USR2.052705). Interestingly, it does not occur when I activate the pss oscillator analysis. It also only seems to occur when I perform the same simulation a second time.

I have reported this to Cadence. The application engineer at Cadence has been able to reproduce the problem and it is now being handled as PCR 835250.

Title: Re: PAC of a VCO and a few other questions
Post by Frank Wiedmann on Aug 26th, 2005, 4:32am


svensl wrote on Aug 25th, 2005, 10:39pm:
Eugene, thanks for explaining more on phase and voltages. But one more question, when I have the vco offset frequency f0=0 and leave Kvco at Kvco=1e6 and do a PSS and PAC with fund=1e6 then, it will give me a very large gain at dc. So, with f0=1e6 almost no gain at dc, with f0=0 almost infinity.


I have tested your circuit and there is a large gain at dc. Did you look at the correct sidebands? Here are the relevant parts of my netlist:


Code:
Ivco (in out) vco f0=1e6 Kvco=1e6
Vin (in 0) vsource dc=0 pacmag=1 pacphase=0 type=dc
pss  pss  fund=1e6  harms=5  errpreset=conservative  annotate=status
pac  pac  sweeptype=absolute  start=1  stop=1e5  maxsideband=5  annotate=status

Plot dB20(v("/out" ?result "pac-pac")) and look at the harmonics 1 and -1. I get 114 dB at 1 Hz and the expected slope of 20 dB per decade.

Title: Re: PAC of a VCO and a few other questions
Post by Frank Wiedmann on Aug 26th, 2005, 4:53am


Eugene wrote on Aug 25th, 2005, 10:58am:
Item #1:
You are of course right about integrals producing infinite AC response at DC but the VCO voltage is a sinusoidal function of phase and a sinusoid  is bounded.  In fact, regardless of the phase, the amplitude of the sinusoid is constant. So if your PAC analysis looks only at voltage amplitude, you will see little or no dependence on the integral of frequency. You must detect phase to see the effects of the integral in a PAC analysis and that is not trivial.

I believe that the linearization performed by the PAC analysis results in a linear relationship between the phase and the amplitude calculated by this analysis. The bounded amplitude of the signal results in a nonlinear effect which is not taken into account by the PAC analysis.

The same effect can be seen in the results of the Pnoise analysis (see http://www.designers-guide.org/Forum/?board=rfsim;action=display;num=1050465395;start=1#1). The noise calculated by Spectre will rise towards infinity for very low frequencies because the nonlinear effect due to the bounded signal amplitude is not taken into account. Likewise, the result of the PAC analysis in Sven's example will rise towards infinity for very low frequencies with a slope of 20 dB per decade.

Title: Re: PAC of a VCO and a few other questions
Post by Eugene on Aug 26th, 2005, 6:08pm

Frank,

I see your point. Thanks for the insight. If the VCO output is sin(phi), where phi = integral of frequency wrt time, the linearization is

sin(phi)+delta_phi*cos(phi).

Since delta_phi is the output of an integration, it grows with decreasing frequency. Also, since PAC probably only plots the amplitude of the perturbation, the normalized perturbation indeed equals phase perturbation. It seems only the normalized plot has meaning since the absolute plot (in Volts)  implies incorrectly that the amplitude goes to infinity at DC. Right?

svensl,
By "stripping down the circuit" I meant yours. However, my simple circuit should suffice.

Regarding your f0 offset, are you sure you selected the correct sideband? When you change the offset, don't you also change the VCO unperturbed frequency?

Title: Re: PAC of a VCO and a few other questions
Post by svensl on Aug 26th, 2005, 11:26pm

Thank you Eugene and Frank.

The PAC linearizes the circuit about a periodically time-varying operating point.
Is that what you mean by the equation sin(phi)+delta_phi*cos(phi) with delta_phi being a small excursion from the operating point, Eugene?

As for the sideband, I did not consider them before. When doing as suggested by Frank I obtain the expected dB plot. Could you please further explain how the sidebands come into play here and their meaning? I am a bit confused. In a noise analysis, the sidebands will specify how much noise is taking into consideration because the sidebands are used to account for aliasing in SC circuits.
How does that relate to the sideband here?

Title: Re: PAC of a VCO and a few other questions
Post by Eugene on Aug 27th, 2005, 4:13pm


Quote:
The PAC linearizes the circuit about a periodically time-varying operating point.  
Is that what you mean by the equation sin(phi)+delta_phi*cos(phi) with delta_phi being a small excursion from the operating point, Eugene?  


Yes. It would be nice if one of the SpectreRF experts could confirm my claim.

You are not the first to be confused. If I don't use the tool for a few months I have to dig into the manual or e-mail someone. One of my complaints about the SpectreRF PAC, Pnoise, Pxf GUIs is that although the manual is very clear about sidebands, the GUI does not say which field is the input and which is the output. Thus, I am forced to waste time experimenting with simple circuits or searching for someone who remembers. Anyway, I believe that for PAC, the topmost frequency fields in the GUI are for the input range. The rest is output. For Pnoise and PXF, it is reversed. You must deal with sidebands when you have frequency translation. Since you are injecting a frequency perturbation, you are injecting at baseband. However, you are observing it at RF(i.e. passband). You have frequency translation. I duplicated Frank's observations by specifying a baseband range in the topmost fields and selecting the output range in the lower fields. I believe I used a -1 sideband but I'm not sure, I am not at my workstation. Frank included some netlist lines that answer that question. I believe the +1 side band gives similar results because a sinusoid has output at positive and negative frequencies.

Title: Re: PAC of a VCO and a few other questions
Post by Andrew Beckett on Aug 27th, 2005, 11:25pm

Eugene,

In fact I also have seen this confusion at many customers when using PAC, PXF and PNoise. As a result, I asked for the forms for these analyses (as well as the corresponding QP
analyses) to update the "Frequency Range" label to say either "Input Frequency Range" (for PAC) or "Output Frequency Range" (for PXF, PNoise). This has been done for IC5141 USR2, so if you use that, you'll see the changes.

Regards,

Andrew.

Title: Re: PAC of a VCO and a few other questions
Post by Eugene on Aug 28th, 2005, 11:13am

Excellent! Thanks Andrew.


Title: Re: PAC of a VCO and a few other questions
Post by Frank Wiedmann on Aug 29th, 2005, 12:15am


Eugene wrote on Aug 26th, 2005, 6:08pm:
It seems only the normalized plot has meaning since the absolute plot (in Volts)  implies incorrectly that the amplitude goes to infinity at DC. Right?

If you interpret the result of the PAC analysis as gain (like in an AC analysis), it is still correct as long as the linear small-signal approximation is valid for all signals. However, in the case of a slow frequency modulation this condition is easily violated, even for a small input signal, because the deviation of the phase accumulates over a long time.

Title: Re: PAC of a VCO and a few other questions
Post by Eugene on Aug 29th, 2005, 8:08am

Frank,
Even for small signals and high frequencies, I am still not sure I agree that the PAC analysis in this case is valid in the absolute sense, i.e. when interpreted as the transfer function from frequency perturbation to amplitude perturbation.  How can any perturbation in frequency have any affect on the amplitude of the VCO output? PAC says it can. However, I think we both agree that for high frequency, small signal perturbations, the normalized PAC output can be interpreted as a phase output.

Also, we agree that phase output should go to infinity at low frequency perturbations, and this PAC analysis does just that.

I therefore maintain that the PAC analysis in this case only has meaning when normalized to amplitude and and interpreted as a phase output. I am not convinced that in this case, the interpretation of the PAC output as an amplitude response is valid at any frequency or for any size of perturbation.

Title: Re: PAC of a VCO and a few other questions
Post by Frank Wiedmann on Aug 29th, 2005, 11:15am

The result of the PAC analysis does not mean that the VCO amplitude will change. It means that sidebands will be generated.

Title: Re: PAC of a VCO and a few other questions
Post by Ken Kundert on Aug 29th, 2005, 10:03pm

To be more specific, in an oscillator PAC will show that both upper and lower sidebands are generated and that they are correlated in such a way as to produce phase noise rather than amplitude noise.

-Ken

Title: Re: PAC of a VCO and a few other questions
Post by Frank Wiedmann on Aug 29th, 2005, 11:49pm

I would talk of phase modulation rather than phase noise in this specific example.

For those interested in the theory behind this, look up under "narrowband frequency modulation". Some online resources are http://www.radiolab.com.au/DesignFile/PNRef/intro4.htm (and the previous page) and http://www.educatorscorner.com/cbt/fm/1.htm (also accessible as "FM Fundamentals" from http://www.educatorscorner.com/index.cgi?CONTENT_ID=2523).

Title: Re: PAC of a VCO and a few other questions
Post by Ken Kundert on Aug 30th, 2005, 7:45am

Concerning Eugene's comments about how it is difficult to remember how to fill out the forms for the periodic small-signal analyses (PAC, PXF, PNoise, etc): it might be helpful to remember that you are "specifying what is unique".

For example, PAC computes the transfer function from a single input to multiple outputs. So with PAC you must specify both the location of the input and the band of the input. You specify the location by adding a nonzero pacmag to a source and you specify the band by giving the start and stop frequencies on the analysis form. In this case, there is one input band and multiple output bands. So you specify the input band, which is unique.

Similarly with PXF and PNoise. These compute transfer function from multiple inputs to a single output. So with these you specify the output location and output band on the analysis form. Here, it is the output band that is unique.

Finally, with these analyses the sidebands are specified relative to the frequency band you specified.

Hope that helps.

-Ken

Title: Re: PAC of a VCO and a few other questions
Post by Eugene on Aug 30th, 2005, 9:03am

Ken,
Thanks for the clarification on the PAC/PXF analyses. Your comments are indeed helpful, as usual.

All,
I see Frank's point about the sidebands. In my simple example, the perturbed VCO output is

sin(phi) + delta_phi*cos(phi),

which can be expressed as a single sinusoid with an amplitude of

sqrt(1+delta_phi**2).

The amplitude depends on delta_phi but not to first order. Since the PAC is a first order analysis, second order terms should be ignored. So to first order, yes, we have sidebands but no amplitude perturbation. I retract my statement about this PAC analysis implying that the frequency perturbation affects amplitude. It does not. I think we all agree now that the PAC analysis of the VCO output in this case is strictly a phase response.

svensl,
Sorry about hijacking your topic. I was working on something similar and found the interaction very helpful. Thanks everyone.

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.