• 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 sample a signal at specific (non-uniform) points...

Stats

  • Locked Locked
  • Replies 7
  • Subscribers 126
  • Views 6858
  • 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 sample a signal at specific (non-uniform) points in time?

DomiHammerfall
DomiHammerfall over 1 year ago

Dear Community

I am simulating a circuit having an inverter at the output in a transient simulation. At the output, I measure the time where the signal crosses the vdd/2 threshold using the cross() function. Suppose that the output voltage is simply named vout, then the corresponding expression in the Virtuoso Visualization and analysis XL Calculator would look like this:

cross(VT("/vout") (VAR("vdd") / 2) 1 "rising" t nil nil)

This returns an array of time samples. Now I am interested what potential an internal node has at these specific time points. Notice that above's expression returns non-uniform samples due to the way the circuit is built. Both the value() and sample() function only work with uniform samples, i.e. I can only specify a period time rather than passing an array with predefined sampling points. Is there an equivalent to the value() function for multiple samples? Are there alternatives or workarounds?

Thanks for any suggestion.

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

    See this article: Calculator function to measure the value of a waveform when another waveform crosses a threshold

    Andrew

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

    Thanks!

    Quick follow-up question:

    Calling abCrossTwoWaves seems to work inside the calculator, but not when set as output in ADE Explorer or ADE Assembler. What to do such that this works as well?

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

    Dear DomiHammerfall,

    DomiHammerfall said:
    Calling abCrossTwoWaves seems to work inside the calculator, but not when set as output in ADE Explorer or ADE Assembler. What to do such that this works as well?

    1. Are you using the SKILL function in a post-simulation ocean script defined as an output?

    If so,at the beginning of all my ocean scripts, I load the functions I need for the script. As an example, the initial lines for a script that calls a couple of user defined scripts integrate() and rise_fall():

    load("/home/smlogan/ocean_files/integrate.il")
    load("/home/smlogan/ocean_files/rise_fall.il"

    ....

    Hence, in your case, include the line:

    load("<path_to_script>/abCrossTwoWaves.il")

    at the beginning of your ocean script.

    2. If you using the script name as part of an ADE output expression, did you try including the load statement:

    load("<path_to_script>/abCrossTwoWaves.il")

    in your .cdsinit (and then restarting Virtuouso) or instantiating the load command in the CIW?

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 1 year ago in reply to ShawnLogan
    ShawnLogan said:

    2. If you using the script name as part of an ADE output expression, did you try including the load statement:

    load("<path_to_script>/abCrossTwoWaves.il")

    in your .cdsinit

    If you use the approach in the article and use the "fx" button in the calculator (or + button in the expression builder) to add the function, then there is no need to load it in the .cdsinit (and/or .vdsinit). It will get loaded automatically by the calculator (because the code contains functions to register with the calculator).

    However, the additional file (your original reply mentioned this, but you've edited it since) abMakeWaveform.il will not get auto-loaded (that's not a calculator function so isn't really suitable for registration this way). For that, you should add the line:

    load("/path/to/abMakeWaveform.il") 

    to both your .cdsinit and also .vdsinit (the .vdsinit if it doesn't exist can be in various places, but most likely your working directory or failing that the home directory). The .vdsinit file is used for the expression evaluator as part of the LSCS mechanism in ADE; if using the calculator or the older ICRP mechanism, then the .cdsinit is needed.

    That should then allow it to work in the calculator and output expressions.

    ShawnLogan said:

    1. Are you using the SKILL function in a post-simulation ocean script defined as an output?

    If so,at the beginning of all my ocean scripts, I load the functions I need for the script.

    I wouldn't recommend this approach. For a start, the code ends up potentially being loaded multiple times unnecessarily, and it's far cleaner to load calculator functions by the registration mechanism or to load common utilities through the .cdsinit/.vdsinit file.

    Andrew

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

    Thanks for the help Shawn and Andrew.

    I added the .il file both in .cdsinit and .vdsinit. So my .cdsinit file looks like this:

    envSetVal("maestro.lscs" "centralizedDotVdsinitDirectory" 'string "/path/to/.vdsinit")
    load("/path/to/abCrossTwoWaves.il")
    load("/path/to/abMakeWaveform.il")

    The first line is taken from here. The .vdsinit file looks as follows:

    load("/path/to/abCrossTwoWaves.il")
    load("/path/to/abMakeWaveform.il")

    The CDS.log does not show any errors on startup.
    The behaviour I observe in Virtuoso is very strange, though. I set

    abCrossTwoWaves(VT("/vout") VT("/vin") (VAR("vdd") / 2) "rising")

    as output in ADE Explorer. After simulation, it just shows "eval err" in the UI. However, if I rightclick and select "send to calculator", then pressing the evaluate button in the calculator gives the correct result.

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

    Thanks for the help Shawn and Andrew.

    I added the .il file both in .cdsinit and .vdsinit. So my .cdsinit file looks like this:

    envSetVal("maestro.lscs" "centralizedDotVdsinitDirectory" 'string "/path/to/.vdsinit")
    load("/path/to/abCrossTwoWaves.il")
    load("/path/to/abMakeWaveform.il")

    The first line is taken from here. The .vdsinit file looks as follows:

    load("/path/to/abCrossTwoWaves.il")
    load("/path/to/abMakeWaveform.il")

    The CDS.log does not show any errors on startup.
    The behaviour I observe in Virtuoso is very strange, though. I set

    abCrossTwoWaves(VT("/vout") VT("/vin") (VAR("vdd") / 2) "rising")

    as output in ADE Explorer. After simulation, it just shows "eval err" in the UI. However, if I rightclick and select "send to calculator", then pressing the evaluate button in the calculator gives the correct result.

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

    The article you reference is a bit misleading. It was trying to say that centralizedDotVdsinitDirectory should be set to the directory containing .vdsinit - but the example makes it look as if it's the path to the .vdsinit itself (which it is not). So you should set:

    envSetVal("maestro.lscs" "centralizedDotVdsinitDirectory" 'string "/path/to") ; i.e. not the file but the containing directory

    That should work if you do that. As I said, this is less important for abCrossTwoWaves.il if properly registered, but for the abMakeWaveform.il you certainly need to use this approach (or have a local .vdsinit).

    Andrew

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

    Thanks for your reply.

    I can confirm that it is working correctly now.

    • 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