• 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. using cross to find limits

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 125
  • Views 16322
  • 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

using cross to find limits

Darrell MLX
Darrell MLX over 5 years ago

I want to determine what input voltage makes a unity gain amplifier gain exceed the spec limits of +/- 2%.  So I sweep the input voltage, calculate the gain and use the following functions:

upper limit: min(cross(clip((VS("/OUT") / VS("/IN")) 1 3.6) 1.02 1 "rising" nil nil nil) cross(clip((VS("/OUT") / VS("/IN")) 1 3.6) 0.98 1 "falling" nil nil nil) 3.6)

lower limit: max(cross(clip(VS("/OUT")/VS("/IN") 0 2) 1.02 1 "falling" nil nil  nil ) cross(clip(VS("/OUT")/VS("/IN") 0 2) 0.98 1 "rising" nil nil  nil ) 0)

This all works if the cross functions return -nil for cases where the gain never crosses the threshold.  But sometimes the cross function returns -nil, and sometimes it fails to evaluate. For example.  If VS("/OUT")/VS("/IN") has values from 1.01 to 1.00, then the function checking for a crossing at 1.02 will return -nil, but the function checking for a crossing at 0.98 fails to evaluate and I get no answer.  I can not determine what makes the cross function fail instead of returning -nil.

Is there any way to make this function work reliably?

Is there a better way to find these limits knowing that the gain function may never go out of limit for some corners.

Thanks in advance for the help

  • Cancel
Parents
  • ShawnLogan
    ShawnLogan over 5 years ago

    Dear Darrell MLX,

    I must admit I am little confused by exactly you want the cross() function to do. However, I can suggest an alternative for what I think is your basic problem My understanding is that you want to determine the input voltage where the output gain falls outside the values of 0.98 and 1.02. If that is the case, might I suggest a slightly different way to set the criteria?

    Create a waveform for your gain, for example amp_gain = VS("/OUT") / VS("/IN"). Since, you are concerned with it exceeding your specification centered about 1.0, set the cross() criteria to examine the crossing point of the modified waveform from pow(0.02,2)

    cross( pow((amp_gain-1).0,2) pow(0.02,2) "rising" nil nil nil)

    In essence, I am squaring the difference between the measured gain and 1.0 (your target gain) and using the cross(0 function to determine if the gain error squared crosses 0.02^2.

    Is my understanding of your objective correct?

    Is this alternative criteria of any use for you?

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Darrell MLX
    Darrell MLX over 5 years ago in reply to ShawnLogan

    Hi Shawn,

    Your expression is indeed more clean and easier to use, thank you for that tip.  But I still have a problem when the gain never exceeds the threshold of 0.02V.  Sometimes the cross function will return a 'nil' when there is no crossing point, but other times it fails to evaluate and returns with an error.  If it returns a 'nil' I can put this in a function to choose 3.6V if there is no crossing point.  To do this I am using the 'min' function: min(3.6 cross(....)).  This works when the cross function returns nil, but when the cross function fails to evaluate I get an error and no usable value.

    I am probably abusing the crossing function by using it on a DC sweep instead of a transient simulation.  But it does return the correct value when the output crosses the threshold.  But I can not find a good way to handle cases where the output never exceeds the limit, and thus never crosses the threshold. 

    -Thanks, 

    Darrell

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 5 years ago in reply to Darrell MLX

    Dear Darrell MLX,

    I was happy to read at least my interpretation of your basic issue was correct - and that the expression may help.

    Darrell MLX said:
    Sometimes the cross function will return a 'nil' when there is no crossing point, but other times it fails to evaluate and returns with an error.  If it returns a 'nil' I can put this in a function to choose 3.6V if there is no crossing point.  To do this I am using the 'min' function: min(3.6 cross(....)).  This works when the cross function returns nil, but when the cross function fails to evaluate I get an error and no usable value.

    In the case where the cross() function does not return a "nil" or a valid crossing point and it "fails to evaluate", what exactly is the error you are seeing?

    I do not know the details of your simulation or final expressions, but I am wondering if it is returning a value because there is a point in your waveform that is satisfying its criteria that is causing your min() function to choose 3.6  is actually returning a value of greater than 3.6.

    Darrell MLX said:
    I am probably abusing the crossing function by using it on a DC sweep instead of a transient simulation. 

    The cross() function works on a DC analysis. I've used it for both types of analyses.

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • ShawnLogan
    ShawnLogan over 5 years ago in reply to Darrell MLX

    Dear Darrell MLX,

    I was happy to read at least my interpretation of your basic issue was correct - and that the expression may help.

    Darrell MLX said:
    Sometimes the cross function will return a 'nil' when there is no crossing point, but other times it fails to evaluate and returns with an error.  If it returns a 'nil' I can put this in a function to choose 3.6V if there is no crossing point.  To do this I am using the 'min' function: min(3.6 cross(....)).  This works when the cross function returns nil, but when the cross function fails to evaluate I get an error and no usable value.

    In the case where the cross() function does not return a "nil" or a valid crossing point and it "fails to evaluate", what exactly is the error you are seeing?

    I do not know the details of your simulation or final expressions, but I am wondering if it is returning a value because there is a point in your waveform that is satisfying its criteria that is causing your min() function to choose 3.6  is actually returning a value of greater than 3.6.

    Darrell MLX said:
    I am probably abusing the crossing function by using it on a DC sweep instead of a transient simulation. 

    The cross() function works on a DC analysis. I've used it for both types of analyses.

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Darrell MLX
    Darrell MLX over 5 years ago in reply to ShawnLogan

    Hi Shawn,

    I don't think it is possible to return a value greater 3.6 since the DC sweep is from 0V to 3.6V.  And when I put the cross function into the calculator by itself, and press the button to display results in a table, some cases will returns '-nan' in the table and return 'successful evaluation' in the calculator messages.  But other cases make it fail to run and display an error message on the bottom of the calculator: 'expression evaluation failed: cross(pow(((VS("/OUT") / VS("/IN")) - 1) 2) 0.0004 1 "rising").

    For cases where -nan is returned I interpret that to be 'nil'.  In these cases the min or max functions ignore that value and work on the remaining valid values.  So I believe that part is working as expected.  But it only works when the cross function runs and returns nil.

    I can not figure out why it works for some cases and not for others.  I am not even sure how the cross function is expected to handle cases where there is no crossing.  That possibility is not mentioned in any documentation I could find.  So it's possible that I am expecting the function to be smarter than it actually is.  Maybe it is suppose to return an error when there is no crossing and I was just lucky sometimes when it returned nil.  Just thought I would ask before I gave up completely.

    No matter what I learned a new trick, so thanks for that,

    Darrell

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 5 years ago in reply to Darrell MLX

    Hi Darrell,

    Darrell MLX said:
    I don't think it is possible to return a value greater 3.6 since the DC sweep is from 0V to 3.6V. 

    I was just using the expression "min(3.6 cross(....)). "  from your post - and don't know the details of your circuit - sorry!

    Darrell MLX said:
    I am not even sure how the cross function is expected to handle cases where there is no crossing. 

    The "nil" value is essentially the "false" logic state in Cadence SKILL. Hence, when no crossing event is detected, cross() should return a nil. Hence, detecting the nil condition seems like the best way to determine if your expression does not cross your threshold.

    The -nan expression refers to negative  infinity - which is different than nil - in my understanding. The fact you are seeing a -nan output suggests to me there is some data point in your waveform due to the clip operation or incomplete data where cross() finds a threshold crossing.

    The reference manual includes the following cross() return values from URL:

    https://support.cadence.com/apex/techpubDocViewerPage?xmlName=oceanref.xml&title=OCEAN%20Reference%20--%2010%20-%20cross&hash=1054952&c_version=ICADV12.3&path=oceanref/oceanrefICADV12.3/chap10.html#1054952

    Value Returned

    o_waveform

    Returns a waveform if the input argument is a family of waveforms.

    g_value

    Returns the X-axis value of the crossing point if the input argument is a single waveform.

    nil

    Returns nil and an error message otherwise.

    Finally, with respect to the use of the cross() function with DC analyses, I did find a recent Troubleshooting article that pertains to an issue, but it appears your expression does not conform to the failing case they note. The article is at URL:

    https://support.cadence.com/apex/ArticleAttachmentPortal?id=a1O3w000009bfnpEAA&pageName=ArticleContent

    Anyway, sorry I can't fully explain what you are are observing! Hopefully, you can "limp" thought this with the discussions we've had.

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Darrell MLX
    Darrell MLX over 5 years ago in reply to ShawnLogan

    Thanks for the helpful insights.  I'll try a few more experiments, but looks like I'll need to go to plan B.  

    Thanks anyways,

    Darrell

    • 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