• 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. Custom Calculator Function for plotting multiple signals...

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 143
  • Views 18777
  • 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

Custom Calculator Function for plotting multiple signals with custom formatting.

Curtisma
Curtisma over 7 years ago

Hello:

I would like to be able to add an output to the output table which is able to take signals or output names as inputs in a form and plot all of them using a specific format.  What is the best way to approach this problem?  The cleanest way would be if I could make a custom calculator function that allows the user to input the signals to be plotted in a form and then the function runs the Skill code necessary to plot each of them and setup the formatting for them.  (title, markers, trace location, etc)  Is this possible with a custom calculator function? 

If not, would it be possible to do this by selecting "Ocean" as the output type and then writing a Script to do the same thing?  Would I be able to use VIVA Skill commands and not just ocean commands in the script?

I'm using IC6.1.7-64b.500.12

-Curtis

  • Cancel
  • Curtisma
    Curtisma over 7 years ago
    Any ideas if this is the correct way to approach this?

    -Curtis
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 7 years ago

    Curtis,

    No, it's not. Calculator functions should not plot anything; they should just compute results (either producing scalar values or new waveform objects).

    Also the OCEAN script output in ADE XL shouldn't be used for plotting things. Both doing it via a calculator function or the OCEAN script would be a problem because when multiple simulations are run, background virtuoso sessions (a.k.a ICRPs) are launched which are in "nograph" mode and so any plotting would not get seen.

    One approach could be to use the SKILL code below. This allows you to add an OCEAN script (with a ".ocn" suffix) to the "documents" folder in ADE XL, and have it run automatically when either simulation is finished or when results are loaded. This code also adds a menu into ADE to allow you to run the scripts manually.

    Then in these OCEAN scripts you can plot as much as you like!

    Regards,

    Andrew.

    /* abXLRunAfterSim.ils
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       Jul 19, 2012 
    Modified   Apr 05, 2013 
    By         A.D.Beckett
    
    To install this tool, call 
    
    abXLRunAfterSimInit()
    
    This provides the ability to run an OCEAN script after all the
    simulations have finished, or when View Results is used from the
    history. It also adds a pulldown menu in the window to run the
    scripts manually.
    
    The idea is that you can have a file with the suffix ".ocn" in the
    documents folder of the ADE XL view, and then this is invoked at the
    end. Primarily this is intended for doing custom graphing that you
    want - whilst "Refresh" provides some mechanism to do this, it is
    not as flexible as capturing the plotting requirements in a script.
    
    Note however that any graphs produced by the script will not appear 
    in any datasheet produced.
    
    All the functions which have abXLRunAfterSim prefix are global,
    and all the rest are local.
    
    Broadly based on abXLPlotGraphs.il - but converted to SKILL++ - so
    this file must keep the ".ils" suffix. That was done to allow some
    of the functions to be kept internal, but mostly to allow
    storage of the current results directory without requiring a global
    variable.
    
    There are four functions you can use inside the OCEAN script you
    attach, abXLRunAfterSimOpenResults(), abXLRunAfterSimGetResultsDir(),
    axlXLRunAfterSimGetHistory() and axlXLRunAfterSimIsTestEnabled()
    
    So for example, a script such as this can be used:
    
        when(abXLRunAfterSimIsTestEnabled("AC")
            abXLRunAfterSimOpenResults("AC")
            out=v("/out" ?result 'ac)
            awvPlotWaveform(newWindow() list(out) ?graphType "polar")
        )
        historyName=axlGetHistoryName(abXLRunAfterSimGetHistory())
        ; example of getting the resDB in this script
        resDB=axlReadHistoryResDB(historyName)
        foreach(point resDB->points()
            foreach(corner point->corners()
                printf("CORNER: %L\n" corner->name)
                foreach(test corner->tests()
                    printf("TEST: %L\n" test->name)
                    foreach(output test->outputs()
                        printf("  %s: %L\n" output->name||"" output->value)
                    )
                )
            )
        )
    
    ***************************************************
    
    SCCS Info: @(#) abXLRunAfterSim.ils 04/05/13.14:25:44 1.2
    
    */
    
    (importSkillVar abXLRunAfterSimMenu)
    
    (let (currentResultsDir currentHist)
      /****************************************************************
      *                                                               *
      *      (abXLRunAfterSimInit [?addMenu t] [?addTriggers t])      *
      *                                                               *
      *   Initialize the functions for auto-running of OCEAN scripts  *
      *                                                               *
      ****************************************************************/
      (defglobalfun abXLRunAfterSimInit (@key (addMenu t) (addTriggers t))
        ;--------------------------------------------------------------------
        ; Define trigger to automatically run an OCEAN script after simulation
        ;--------------------------------------------------------------------
        (when addTriggers
          (axlSessionRegisterCreationCallback setupTriggers)
          )
        ;--------------------------------------------------------------------
        ; Define pulldown menu to manually run the scripts
        ;--------------------------------------------------------------------
        (when addMenu
          (deRegUserTriggers "adexl" nil 'abXLRunAfterSimMenuTrigger)
          )
        ) ; defun abXLRunAfterSimInit
    
      /*******************************************************************
      *                                                                  *
      *                   (runFinished sess runId hist)                  *
      *                                                                  *
      * Trigger which is called when the simulations have finished. This *
      *            runs any OCEAN scripts stored as documents            *
      *                                                                  *
      *******************************************************************/
      (defun runFinished (sess _runId hist)
        (runAfterSim sess hist)
        ) ; defun runFinished
    
      /*******************************************************************
      *                                                                  *
      *                      (viewHistory sess hist)                     *
      *                                                                  *
      * Trigger which is called when you do a restore history. This also *
      *   runs any OCEAN scripts stored as documents                     *
      *                                                                  *
      *******************************************************************/
      (defun viewHistory (sess hist _histDir)
        (runAfterSim sess hist)
        ) ; defun viewHistory
    
      /********************************************************************
      *                                                                   *
      *                       (setupTriggers sess)                        *
      *                                                                   *
      *    Callback which is invoked at ADE XL creation time, and sets    *
      * up the triggers to be run automatically at the end of simulation. *
      *                                                                   *
      ********************************************************************/
      (defun setupTriggers (sess)
        (axlSessionConnect sess "runFinishedPrePlot" runFinished)
        ; This trigger is not for view results, but for setting a history
        (axlSessionConnect sess "postViewHistoryResults" viewHistory)
        ) ; defun setupTriggers
    
      /*****************************************************************
      *                                                                *
      *                     (runAfterSim sess hist)                    *
      *                                                                *
      *    For a given ADE XL session, and history id, find all the    *
      * graph documents, update them to reference the current results, *
      *         and then open waveform windows and plot them.          *
      *                                                                *
      *****************************************************************/
      (defun runAfterSim (sess hist)
        (let (oceanFiles resultsDir)
          (setq resultsDir (axlGetHistoryResultsDir hist))
          (setq currentResultsDir resultsDir)
          (setq currentHist hist)
          (setq oceanFiles (getOCEANFiles sess))
          (foreach oceanFile oceanFiles
                   (printf "Invoking %L\n" oceanFile)
                   (loadi oceanFile)
                   ) ; foreach
          t
          ) ; let
        ) ; defun runAfterSim
    
      /*******************************************************************
      *                                                                  *
      *            (abXLRunAfterSimGetResultsDir [testName])             *
      *                                                                  *
      *   Get the directory containing the current simulation results.   *
      * For use in the attached OCEAN document. The testName is optional *
      *                                                                  *
      *******************************************************************/
      (defglobalfun abXLRunAfterSimGetResultsDir (@optional testName)
        (cond
          ((null currentResultsDir) nil)
          (testName (strcat currentResultsDir "/psf/" testName))
          (t currentResultsDir)
          )
        )
    
      /********************************************************************
      *                                                                   *
      *               (abXLRunAfterSimOpenResults testName)               *
      *                                                                   *
      *    Can be used in place of openResults() to access the results    *
      * for a named test. This gets the root results for the complete run *
      *      (so will see families of data for sweeps, corners, etc)      *
      *                                                                   *
      ********************************************************************/
      (defglobalfun abXLRunAfterSimOpenResults (testName)
        (openResults (abXLRunAfterSimGetResultsDir testName))
        )
    
      /***************************************************************
      *                                                              *
      *                 (abXLRunAfterSimGetHistory)                  *
      *                                                              *
      *  Return the history item corresponding to the results being  *
      *                           accessed                           *
      *                                                              *
      ***************************************************************/
      (defglobalfun abXLRunAfterSimGetHistory ()
        currentHist
        )
    
      /****************************************************************
      *                                                               *
      *            (abXLRunAfterSimIsTestEnabled testName)            *
      *                                                               *
      * Return a boolean telling you whether the test was enabled for *
      *                      the current results                      *
      *                                                               *
      ****************************************************************/
      (defglobalfun abXLRunAfterSimIsTestEnabled (testName)
        (let (test)
          (setq test (axlGetTest (axlGetHistoryCheckpoint currentHist) testName))
          (and test (null (zerop test)) (axlGetEnabled test))
          )
        )
    
      /***************************************************************
      *                                                              *
      *                     (getOCEANFiles sess)                     *
      *                                                              *
      *               Get the OCEAN documents attached               *
      *                                                              *
      ***************************************************************/
      (defun getOCEANFiles (sess)
        (let (sdb documentsDir oceanFiles)
          (setq sdb (axlGetMainSetupDB sess))
          (setq documentsDir (strcat (axlGetSetupDBDir sdb) "/documents"))
          ;------------------------------------------------------------------
          ; Get a sorted list of files which end in .ocn
          ;------------------------------------------------------------------
          (setq oceanFiles 
                (sort 
                  (rexMatchList "\\.ocn$" (getDirFiles documentsDir))
                  'alphalessp
                  ) ; sort
                ) ; setq
          ;------------------------------------------------------------------
          ; Map the files to prepend the document directory path
          ;------------------------------------------------------------------
          (foreach mapcar oceanFile oceanFiles
                   (strcat documentsDir "/" oceanFile)
                   ) ; foreach
          ) ; let
        ) ; defun getOCEANFIles
    
    
      /***************************************************************
      *                                                              *
      *                          (createMenu)                        *
      *                                                              *
      *             Create the Run OCEAN pulldown menu               *
      *                                                              *
      ***************************************************************/
      (defun createMenu ()
        (let (runOCEAN)
          (setq runOCEAN
                (hiCreateMenuItem
                  ?name 'runOCEAN
                  ?itemText "&Run OCEAN Documents"
                  ?callback "(abXLRunAfterSimCB)"
                  )
                )
          (hiCreatePulldownMenu
            'abXLRunAfterSimMenu
            "Run &OCEAN Documents"
            (list runOCEAN)
            ) ; hiCreatePulldownMenu
          ) ; let
        ) ; defun
    
      /***************************************************************
      *                                                              *
      *              (abXLRunAfterSimMenuTrigger l_args)             *
      *                                                              *
      * Menu trigger to add the pulldown menu for adexl application; *
      *     called from deRegUserTriggers in abXLRunAfterSimInit     *
      *                                                              *
      ***************************************************************/
      (defglobalfun abXLRunAfterSimMenuTrigger (_l_args)
        (unless (boundp 'abXLRunAfterSimMenu)
          (createMenu)
          )
        (list abXLRunAfterSimMenu)
        )
    
      /***************************************************************
      *                                                              *
      *                      (abXLRunAfterSimCB)                     *
      *                                                              *
      *   Menu callback to run OCEAN scripts for the current history *
      *                            point.                            *
      *                                                              *
      ***************************************************************/
      (defglobalfun abXLRunAfterSimCB ()
        (let (sess hist)
          (setq sess (axlGetWindowSession))
          (unless sess (error "Could not find current ADE XL session"))
          (setq hist (axlGetCurrentHistory sess))
          (when (zerop hist) (error "Cannot run OCEAN scripts - No current history"))
          (runAfterSim sess hist)
          )
        )
      )
    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Curtisma
    Curtisma over 7 years ago
    Thanks for the feedback Andrew! I'm glad I asked before I tried it.

    It would be nice to use the outputs as the user interface rather than having a custom script for each sim/plot. Some of my fellow designers don't like to program.

    What do you think about a hybrid approach where the user defines the plot using an output. However that output doesn't plot anything but rather just stores the definition of the plot (signals, format, etc). Then the SKILL script that runs at the end or from the menu, similar to the example code, just looks at the information contained in the outputs and does the plotting using the settings defined in each output. The outputs would just return "1" or some other meaningful number to the results table.

    -Curtis
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 7 years ago

    Curtis,

    Potentially that could be done, although it would require coming up with a convention for defining something that specifies all the plot settings you want - which is not entirely trivial.

    Given that we are hopefully addressing the ability to truly use templates for plotting in the near future (there's a project underway for this), this would make it rather redundant, because then you could arrange the graphs the way you want and change various settings related to appearance and structure and then save that as a re-usable template within ADE.

    Regards,

    Andrew.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • KGh94
    KGh94 over 7 years ago in reply to Andrew Beckett

    Hello Andrew,

    This is rather interesting and I am looking to put this into use. However, I am still trying to find my way through the vast ocean of ADE-XL. (Pun intended)

    Andrew Beckett said:
    To install this tool, call abXLRunAfterSimInit()

    Could you please clarify where the function should be called from? I tried calling it from CIW and after invoking OCEAN, but the OCEAN document in the ADE-XL folder is not being initialized. Also from which manual can your script be clarified? I've been sticking to OCEAN and OCEAN-XL manuals but I don't see anything familiar. Your assistance would be highly appreciated.

    Edit: I had ADE-XL open, that is why it wasn't working. I re-run the script from CIW after closing ADE-XL and it worked perfectly. Thank you! Slight smile

    Best regards,

    Karam

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

    Hi Karam,

    This function needs to be called before you start ADE XL. For example in the .cdsinit. It would then mean that any subsequent ADE XL session would have a trigger installed looking for .ocn scripts in the ADE XL documents folder and then would run them after simulations are complete.

    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