Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

If else in Cadence ADE calculator

Status
Not open for further replies.

analog_ant

Newbie
Joined
Feb 23, 2023
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
51
I am running a trimming simulation in Cadence ADE to find the optimum trim bits for my oscillator. For the simulation I am varying the 2 trim bits during transient simulation and finding the frequency of the clock for each trim bit. What I now want to do is to find the trim bit configuration which gives me the frequency closest to the desired frequency. I was planning to write an if else kind of function in ADE calculator to achieve the same. Does anyone know how I can write an expression in Cadence ADE calculator for this ?
 

Use value and cross.
Thanks for your quick response.

Unfortunately I think where value and cross doesn't work as I can have cases where the output frequency-desired frequency transitions from 5k to say -3k for successive trim combination, as in that case the value command may not give me correct response when the frequency difference crosses 0.

if(condition then expr1 else expr2)
Also where exactly do I have to enter this ?

I have a condition like if (frequency(clip(VT("/CLK2_TRF<2>") 2e-07 8.4e-06))>500k then x=1 else x =2), but when I copy it to an ADE expression, the expression doesn't copy correctly
1689791284538.png

--- Updated ---

Thanks for your quick response.

Unfortunately I think where value and cross doesn't work as I can have cases where the output frequency-desired frequency transitions from 5k to say -3k for successive trim combination, as in that case the value command may not give me correct response when the frequency difference crosses 0.

if(condition then expr1 else expr2)
Also where exactly do I have to enter this ?

I have a condition like if (frequency(clip(VT("/CLK2_TRF<2>") 2e-07 8.4e-06))>500k then x=1 else x =2), but when I copy it to an ADE expression, the expression doesn't copy correctly
1689791284538.png
I think I have the error resolved. There should be no space between if and the first bracket
 
Last edited:

Unfortunately I think where value and cross doesn't work as I can have cases where the output frequency-desired frequency transitions from 5k to say -3k for successive trim combination, as in that case the value command may not give me correct response when the frequency difference crosses 0.
I can't imagine negative frequency in transient… Anyway, everything is possible to achieve in simple way, as long as you will not messing things.

Back to you question. You have syntax error. Proper example:
Code:
if(Output>500k then 1 else 2 )
Remember to avoid space betwen if and parenthesis. Also, condition might need to be enclosed by parenthesis.
 

I can't imagine negative frequency in transient… Anyway, everything is possible to achieve in simple way, as long as you will not messing things.
Difference between actual and expected frequency can go negative. Did not mean the actual frequency.
Thanks for pointing out the syntax error in the if command.
 

You might be able to "stack up some math" to do logical - numerical
figuring but my preference is to "just run the codes" in a loop around
one analysis, pick off numbers by expression->print, paste to a text
file and grind it out in Excel (or your OpenOffice equivalent).

Something like freq(clip(v(out),0,1u)>freq(clip(v(out),1u,2u) should return
you a printable 1 / 0 outcome and you could get more elaborate using
relational operators and numerical values to make (say) a trim-index result
by adding relational*index terms together and making the sum follow
a logic, but expressed by operators (look to "+" and "*" for OR and AND
once you've got 1/0 terms to work on, from the relationals).


Calculator sure has begun to suck, after IC5. Can't even save & load
an expression that you got to finally work (so have to grab and paste
to an external text file for next time).

The good thing about Cadence is, it's created generations of open
source fans.
 
Last edited:

Another point, if you have the expression for frequency then a
parametric analysis would be able to run single and probably
shorter tran (you only need to stabilize from an initial condition
as trim can be presumed to be fine?) and get plots of freq vs
code easy enough (helps if you use a dec2bin control scheme
for easy looping index rather than (say) a binary <>.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top