• 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. Return sweep variable in transient simulation

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 144
  • Views 7326
  • 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

Return sweep variable in transient simulation

asrf
asrf over 2 years ago

Hi,

I am searching for a function (or script) in cadence virtuoso to do the following task:

Assuming that I am running a transient simulation (or plotting transient signal in harmonic balance sim)

I am sweeping 2 variables in this case and plotting multiple time domain waves (voltage vs time).

My amplitude varies and I want to write a function that finds the curve which has maximum amplitude and then returns values of 2 variables for that case.

  • Cancel
  • ShawnLogan
    ShawnLogan over 2 years ago

    Dear asrf,

    asrf said:
    I am searching for a function (or script) in cadence virtuoso to do the following task:

    ...

    asrf said:
    My amplitude varies and I want to write a function that finds the curve which has maximum amplitude and then returns values of 2 variables for that case.

    I am not sure if you are interested in utilizing an ocean script, but your task can easily be accomplished via an ocean script that navigates through your simulation database (i.e., the simulation results for each corner), measures the waveform amplitude and, if that corner has an amplitude that is a maximum of all the corners analyzed at that point, read and store the value of the two variables. Otherwise, make no change to the stored two variable values. After traversing all your simulation cases, the resulting maximum amplitude value and its corresponding two variables will correspond to the two variables for the overall maximum amplitude. 

    I recently responded to a similar request that traverses an Explorer/Assembler database and included a sample script with comments to allow one to modify it for one's specific simulation in the Forum post at URL:

    https://community.cadence.com/cadence_technology_forums/f/custom-ic-design/57720/evaluating-outputs-for-running-ade-assembler-explorer-simulations/1392023#1392023

    In that case, the Forum poster was trying to measure a result available very early in a simulation for all corners even if the corner simulation had not completed. Hopefully, this might provide enough information for you to use the template.

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 2 years ago in reply to ShawnLogan

    Another way (which doesn't require writing an OCEAN script) would be to use this general function and then take advantage of the evalType=all outputs. I had originally thought of using an output with evalType=all and using swapSweep() to change the x-axis to what I wanted and then xmax to find the x value for the maximum. The trouble is that this doesn't work with more than one sweep because xmax doesn't have an ?overall t argument (it potentially would be ambiguous, I guess; there's been some discussion about this but it's not been implemented).

    So instead I wrote a new function to enable this to be done in a generic way.

    Here's the code (below that I'll explain how to use it):

    /* abFindMinMaxParam.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       Aug 07, 2023 
    Modified   
    By         
    
    Find the value of a parameter corresponding to the given output name
    and test name's max or min value.
    
    Use in an output with evalType "all". Supported for Explorer/Assembler.
    
    Add to the calculator by using the fx button in the function panel or 
    the + button in the expression builder 
    
    ***************************************************
    
    SCCS Info: @(#) abFindMinMaxParam.il 08/07/23.08:34:30 1.2
    
    */
    
    /*************************************************************************
    *                                                                        *
    *    abFindMinMaxParam(outputName testName paramName comparisonFunc)     *
    *                                                                        *
    *    Find the value of a given parameter name which gives the min or     *
    * max value of a given output. For max use "greaterp" for comparisonFunc *
    *                        and for min use "lessp".                        *
    *                                                                        *
    *************************************************************************/
    
    procedure(abFindMinMaxParam(outputName testName paramName comparisonFunc)
      let((rdb peakVal peakParamVal paramVal outputVal)
        when(stringp(comparisonFunc)
          comparisonFunc=concat(comparisonFunc)
        )
        rdb=maeReadResDB()
        foreach(point rdb->points()
          foreach(corner point->corners()
            paramVal=corner->param(paramName)->value
            outputVal=corner->output(outputName testName)->value
            when(outputVal && paramVal
              when(peakVal && funcall(comparisonFunc outputVal peakVal) || !peakVal
                peakVal=outputVal
                peakParamVal=paramVal
              )
            )
          )
        )
        peakParamVal
      )
    )
    
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;; GUI builder information ;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ocnmRegGUIBuilder(
     '(nil
      function abFindMinMaxParam
      name abFindMinMaxParam
      description "Find parameter for min or max value of output. Use with evalType=all"
      category ("Custom Functions")
      analysis (nil
          general (nil
            args (outputName testName paramName comparisonFunc )
              params(nil
                     outputName (nil
                           prompt "Output"
                           tooltip "Output Name"
                           guiRowHint 0
                           type string
                           required t
                     )
                     testName (nil
                           prompt "Test"
                           tooltip "Test Name"
                           guiRowHint 0
                           type string
                           required t
                     )
                     paramName (nil
                           prompt "Parameter"
                           tooltip "Parameter Name"
                           guiRowHint 1
                           type string
                           required t
                     )
                     comparisonFunc (nil
                           prompt "Function"
                           tooltip "Comparison Function"
                           guiRowHint 1
                           default "greaterp"
                           type ("greaterp" "lessp" )
                           required t
                     )
              )
            inputrange t
          )
      )
      outputs(result)
     )
    )

    First of all, you're going to want something to determine the amplitude of your output. Maybe that might be ymax(VT("/out")) or ymax(VT("/out")-average(VT("/out"))) or something else - I'll leave that to you to find something appropriate for whatever you want to measure. Call this output (say) "ampl". 

    Next take the code above and register it with the calculator by using the 'fx" button in the function panel, or use the "+" button in the expression builder to point to the file. This will serve two purposes - first to ensure it's loaded automatically, and secondly to make it available in the calculator. Note that the function can't be used for normal "point" expressions, only for suitable "measure across" expressions.

    Then add an output called (say) "tempMax" and set the expression to: abFindMinMaxParam("ampl" "myTest" "temperature" "greaterp" ) - the first argument is the output name you're looking for, and the second is your test. The third argument is the parameter you want to return, and the final argument can be either "greaterp" (for max) or "lessp" (for min). Set the evalType column on this output to be "all" so that it measures across all points.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 2 years ago in reply to Andrew Beckett

    Note, I edited my previous reply above as the quotation marks had got messed up in the calculator template, so I edited to include an updated version with the correction.

    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