• 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. How to automatically find the final x-value of a waveform...

Stats

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

How to automatically find the final x-value of a waveform to be used by the integ() function

DomiHammerfall
DomiHammerfall over 1 year ago

Dear Community

I want to compute the "smoothness" of a waveform, that is, the integral of the absolute value of the second derivative of a signal. The problem I encounter is that the derivatives of a waveform are a little bit shorter than the simulation time (logically). The final value of the time vector is not consistent (depends on accuracy settings and such). I would like to find a way to automatically extract this final value of the time axis such that the integral can be computed over the whole range. The second derivative of a waveform can be very "noisy", so using the integ() function with extrapolation "on" leads to inaccurate results if the final value lies outside.

Suppose that the signal is simply called vout and the corresponding waveform is VT("/vout"). I can extract the final value of the x-axis with some workarounds, e.g.

ymax(xval(abs(deriv(deriv(VT("/vout"))))))

or

xmax(xval(abs(deriv(deriv(VT("/vout"))))))

The latter one works because the waveform has its "maximum" at the final value (the name xmax is misleading; that function does not return the highest x-value). The output of this expression, however, cannot be used as an argument for the integ() function, probably because it is also a waveform object or so? Using

integ(abs(deriv(deriv(VT("/vout")))) 0 ymax(xval(abs(deriv(deriv(VT("/vout")))))) nil )

yields a evaluation failed error.

What is the easiest way to accomplish this? Thanks for any help.

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 1 year ago

    Two approaches:

    1. If you provide integ() with only a single argument, it will integrate over the whole x-range without you needing to specify the limits
    2. Or you can use the lastVal() function on a waveform to find the final x-value.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • DomiHammerfall
    DomiHammerfall over 1 year ago in reply to Andrew Beckett

    Thanks for the fast reply, much appreciated.

    A quick comment on my approach: I noticed that not only the end time is shorter if you calculate the derivative, but also the start time is unequal to zero. So to make anything work, one also needs to extract the start time and pass it as an argument to the integration function; it then works.

    Of course, Andrew's approach is even better. I can confirm that both ways work and yield the same result.

    On a side note: that call of integ() with a single argument is not documents (or at least I couldn't find it).

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 1 year ago in reply to DomiHammerfall

    See: https://support.cadence.com/apex/techpubDocViewerPage?xmlName=oceanref.xml&title=OCEAN%20Reference%20--%20Predefined%20and%20Waveform%20(Calculator)%20Functions%20-%20integ&hash=pgfId-1028686&c_version=IC23.1&path=oceanref/oceanrefIC23.1/chap10.html#pgfId-1028686

    In particular: 

    You should specify either both the limits or neither. In case you do specify the limits, they become the end points of the range on the X-axis for definite integration. If you do not specify the limits, then the range for definite integration is the entire range of the sweep on the X-axis.

    Note there's also a firstVal as well as lastVal function should you need that.

    Andrew

    • 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