• 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. Is there a Calculator function like firstVal to get the...

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 125
  • Views 5215
  • 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

Is there a Calculator function like firstVal to get the y-value

Volker T
Volker T over 1 year ago

Dear all,

Calculator function firstVal() returns the first x-value of a waveform.

I wonder, if there is something like firstVal() to return the first y-value.

Example:

Imagine a DC voltage sweep from 1 V to 2 V and a resulting output waveform VS("/result") with some arbitrary data.

firstVal(VS("/result"))

returns 1.0, as my voltage sweep starts at 1.0 V.

Of course, I could find the corresponding "first" y-value with

value(VS("/result") firstVal(VS("/result")))

The point is though, I need this in a way more complex function, and the formula gets very complex and hard to read if there was no simple and compact way, like a hypthetical "firstY()" function to do the job, like this:

firstY(VS("/result"))

Obviously, ymin or ymax cannot do the job, as the data is arbitrary, i.e. not in ascending or descending order.

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 1 year ago

    See this article: How can I get the first or last X or Y value from a waveform?

    It doesn't have the functions to register it with the calculator (only the old way of doing it - I'll aim to update the article in the next day or so) - but using the fx button should add the relevant code to the file for you.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 1 year ago in reply to Andrew Beckett
    Andrew Beckett said:
    It doesn't have the functions to register it with the calculator (only the old way of doing it - I'll aim to update the article in the next day or so)

    The article is now updated to have the the builder template stuff included rather than the historical way of registering a calculator function.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 1 year ago in reply to Andrew Beckett
    Andrew Beckett said:
    It doesn't have the functions to register it with the calculator (only the old way of doing it - I'll aim to update the article in the next day or so)

    The article is now updated to have the the builder template stuff included rather than the historical way of registering a calculator function.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Volker T
    Volker T over 1 year ago in reply to Andrew Beckett

    Thank you very much.

    In the mean time, I had my own Calculator functions "firstY" and "lastY" implemented, working exctly the same way. Still, it is very helpful to see your code.

    Edit:

    I also added a conditional

            (numberp(signal)
                signal
            )

    so that the function can also handle a simple scalar value (you use "wave" as argument name, not "signal" as I do).

    • 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