• 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 SKILL
  3. Getting the time point in the calculation

Stats

  • Locked Locked
  • Replies 8
  • Subscribers 143
  • Views 19381
  • 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

Getting the time point in the calculation

liorscotland
liorscotland over 8 years ago

hello all.
I am looking to create a waveform. How do I use the x point value as a point?
I.e.:
wave(time) = average( VT(net1) time )

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 8 years ago

    I don't understand your question. Can you explain this in a bit more detail? What do you mean, how do you use the x point value as a point? I don't know what your "i.e." means - average doesn't take a second positional argument.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • liorscotland
    liorscotland over 8 years ago
    Sorry, wave(time ) = average( clip (waveform) nil time) )
    So, the time acts as input to the clip, and "forces" a wave context.
    Maybe a mapcar procedure is needed here, and generate a new empty waveform?
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 8 years ago

    Hi Lior,

    Sorry, I still don't understand what you mean. You already can give time arguments to the clip function, so I just don't get what you're asking for?

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • liorscotland
    liorscotland over 8 years ago
    Yes, but how do you get the average to output a time-dependent average waveform, and not a scalar?
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • liorscotland
    liorscotland over 8 years ago
    i.e. I want to see a waveform that would be: for each X value, the Y value would be, for example, the average of VF("/net1") from the leftmost X point until the X value. So, in the leftmost X axis value, the value of waveform will be, in fact, just the value of VF( "/net" ). So, average needs to be sampled in every X axis point, and collected to a new waveform.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 8 years ago

    Thanks. That's clear now.

    What  you want is (assuming your signal is in a variable called signal):

    iinteg(signal)/xval(signal)

    This assumes that the signal starts at X=0. If not, you could use the abFirstX function defined in this COS article and use:

    iinteg(signal)/(xval(signal)-abFirstX(signal))

    or if you had the signal not in a variable:

    iinteg(VT("/OUT"))/(xval(VT("/OUTM")-abFirstX(VT("/OUTM")))

    The normal average is defined as the definite integral (integ) divided by the difference between the last and first X point; in this case we just use the indefinite integral (iinteg) and divide by the difference between the current X point and the first X point (for each point).

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • liorscotland
    liorscotland over 8 years ago

    Thanks.

    But don't you get a divide by 0, when xval(signal) == abFirstX(signal)) )?

    Should it not be:

    iinteg( VT("/OUT" ) )/ if( xval(V("/OUTM") > abFirstX( "/OUTM" ) (VT("/OUTM") - abFirstX(VT("/OUTM")) 1 )

    ?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 8 years ago

    I was a bit lazy. It worked because the first value ends up being NaN (actually -nan) and so doesn't get plotted. What you could do is:

    procedure(CCFcumulativeAverage(sig)
      let((new)
        new=iinteg(sig)/(xval(sig)-abFirstX(sig))
        drSetElem(drGetWaveformYVec(new) 0 abFirstY(sig))
        new
      )
    )

    I have not attempted to set the units, axis names, expression etc on the waveform object - this is just to show the principle of how it could be done (the above should work though). You can't use your conditional approach because it's going to be comparing the wrong types of object. Also, you asked for the first value of the output to be the first value of the input waveform - this function will now do that.

    Regards,

    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