The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Simulators >> Circuit Simulators >> Using Fourier results in Cadence calculator expressions
https://designers-guide.org/forum/YaBB.pl?num=1233338166

Message started by JSL on Jan 30th, 2009, 9:56am

Title: Using Fourier results in Cadence calculator expressions
Post by JSL on Jan 30th, 2009, 9:56am

Hello, I have a syntax question about displaying/manipulating the results from Spectre's fourier analysis.  By default, the results are printed out in the spectre.out file.  I would like to set up my outputs in the Cadence framework to, for example, plot the 3rd harmonic while I sweep amplitude or some other variable.  Previously I have been doing this using a dft analysis on the transient, controlling the simulator options to get the desired accuracy, but the fourier method seems more efficient in terms of simulator time for a given accuracy.
Is there a standard way of calling the fourier results using a calculator expression?  I can manually build up somewhat complex expressions, for example this spits out the 3rd harmonic in terms of dBc from the fundamental:

value(dB20((v("/OUT" ?result "FOUR0-tran.refer_fourier") / abs(value(v("/OUT" ?result "FOUR0-tran.refer_fourier") VAR("frequency"))))) (3 * VAR("frequency")))

(Note that in this case the signal being measured is node "OUT" and I have defined a variable named "frequency" which sets the frequency of an independent source's sine wave)

THD is messier.  Is there a shortcut?

Thanks in advance.

Title: Re: Using Fourier results in Cadence calculator expressions
Post by Andrew Beckett on Feb 3rd, 2009, 10:03pm

The easiest way would be to write a function (since it's SKILL) and then use that:


Code:
procedure(MYharm(netName harm)
let((signal harm1 harmN)
 selectResult("FOUR0-tran.refer_fourier")
 harm1=VAR("frequency")
 harmN=harm1*harm
 signal=v(netName)
 value(dB20(signal / abs(value(signal harm1))) harmN)
))


Define this in your .cdsinit (or put it in a file that you load from the .cdsinit) and then all you need to use in the calculator is:

MYharm("/OUT" 3)

You could even create a custom calculator function out of this. There are lots of examples of that on sourcelink - for example, solution 11018920.

(Note, I didn't test the code above - it was just a transformation of your example).

Regards,

Andrew.

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