• 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. Add an item ADE-XL results tab (when right clicking on a...

Stats

  • Locked Locked
  • Replies 12
  • Subscribers 143
  • Views 20691
  • 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

Add an item ADE-XL results tab (when right clicking on a test result)

PatrikOsgnach
PatrikOsgnach over 8 years ago

Hello,

I have this scenario: in ADE-XL, after I load an old result to active, if I select the results tab and right click on a result, I have a nice menu with many options.

I would like to add an item to this menu. From what I read on this forum, I added this code to menus/spectre.menus


(sevAddMenuItemLists                                                                                          
    (lambda (session name)
        (case name
              ("&Results" list( (list "TestItem" ?disable nil ?form t ?callback "(testfunc session)") ) )
        );case
    ) ; lambda
) ; sevAddMenuItemLists
(procedure (testfunc s) (println (sprintf nil "Simdir is %s" s->axlCurrentDataDir)) )

but, when I right click, I get this message in CIW:

ERROR (ADEXL-2822): Invalid menu list structure "(false false)" provided.
Menu items must be specified as a list of ("menu name" "callback" {"true", "false"}), where the last argument specifies whether the item is disabled.
For submenus, replace the callback string with a sublist of menu items.

and nothing gets printed

What is the correct way to achieve this? I need to be able to access the "session" variable inside my callback

Best regards,

Patrik

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 8 years ago

    Hi Patrick,

    Doing  search for sevAddMenuItemLists in the forums came up with two other threads; both were more focussed about adding a menu in ADE L, ideally a new pulldown menu altogether,

    In order to add context menus in ADE XL, you really need to call the menu "&Results" (as you've done) but what your code would be trying to do is replacing that menu rather than adding a new item into it. I'm sure that's not what you want. My solution 11286092 covers this - it's the slightly more complex example at the end. The idea is that you need to record the existing lambda function that generates the Results menu, and then augment that with your own lambda function.

    The callback shouldn't be specified as a string, but using this backquote syntax and ,session so that the session id passed into the lambda when the function is called is passed to your callback.

    An example of adding an item to the Results menu is as follows (this is a bit simpler than the example in the solution):

    ;------------------------------------------------------------------------
    ; Get hold of the original menu construction function. This avoids redefining
    ; the Results menu as "&Results ", which breaks ADE-XL
    ;------------------------------------------------------------------------
    myOrigSpectreMenus=sevCustomEntity('sevItemListsCME)
    
    ;------------------------------------------------------------------------
    ; now define the "Simulation" menu, appending the
    ; new stuff to the already defined "Simulation" menu items...
    ; Also replace existing items
    ;------------------------------------------------------------------------
    (sevAddMenuItemLists
      (lambda (session name)
        (case name
          (("Results" "&Results")
           ;-----------------------------------------------------------------
           ; Traverse the existing Simulation menu, and re-use all the items,
           ; until we find the "Options" submenu - which will be extended
           ;-----------------------------------------------------------------
           (append1
             (funcall myOrigSpectreMenus session name)
             `("Save Violations to HTML" 
               ?callback (abHiSaveViolationsToHTML ',session) 
               ?form t 
               ?disable (sevNoViolationsFound ',session))
             )
           ) 
          ) ; case
        ) ; lambda
      ) ; sevAddMenuItemLists

    Regards,

    Andrew.

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

    Thank you, Andrew, I have a working solution now.

    The part about the lambda was not clear enough and I didn't find how to write the proper callback in this context.

    Where is sevCustomEntity documented? I don't find it in skartistref.pdf where many other sev* functions are documented.

    Side question: is it possible to do currying or partial application of a function is Skill? Like in haskell?

    Best regards,

    Patrik

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

    Patrik,

    sevCustomEntity is not documented. It probably should be given the number of situations I've had to use it...

    Currying is possible in SKILL because it supports closures. Here's an example. Either put this code in a file with the suffix ".ils" or enter it in the CIW having used:

    toplevel('ils)

    first (to change you to "SKILL++" mode):

    procedure(CCFcurry(func @rest initialArgs)
      procedure(curried(@rest extraArgs)
        apply(func append(initialArgs extraArgs))
      )
      curried
    )

    Then you can do:

    expt10=CCFcurry(expt 10)
    expt10(3) => 1000

    This is just one of several ways you can implement closures in SKILL (or SKILL++).

    Note that if I then use resume() to return to SKILL mode, I can still call the curried function I created earlier

    I can also create one in SKILL mode too but it's rather less elegant:

    putd('times20 CCFcurry('times 20))
    times20(5) => 100

    Regards,

    Andrew.

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

    Hello Andrew,

    so essentially it is a function that creates curryed functions? It is still helpful, but I was hoping for something simpler like:

    (procedure (adder x y) x + y)

    (adder 1 2) => 3

    x= (adder 3)

    (x 4) => 7

    y = (adder)

    (y 5 6) => 11

    anyway, back to the issue at hand

    Is there a function that, in this context, returns the full path to the file containing the simulation's results? Now I am doing (strcat session->axlCurrentDataDir "/psf/tran.tran) but we are not always doing transient simulations.

    Thank you and best regards,

    Patrik

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

    Patrick,

    Given that everything in SKILL is a function (all operators are functions masquerading as operators), I don't think it's too onerous to do:

    x=(CCFcurry adder 3)
    y=(CCFcurry adder)

    (actually the second of these could just be done with x=adder). Then you can do (x 4) or (y 5 6)

    You could also write a different currying function like this (as a macro) so that you can specify the argument in a more conventional function call syntax:

    (defmacro CCFbalti (expr "l")
      `(lambda (@rest args) (apply ,(car expr) (append ',(cdr expr) args)))
    )

    Then you could do:

    x=CCFbalti(adder(3))
    y=CCFbalti(adder())
    z=CCFbalti(1+2+3) ; this is really doing (plus 1 2 3), so that's what it is currying

    x(4) => 7
    y(1 2) => 3
    z(4) => 10

    Apologies to Haskell Curry for the dreadful pun on his name for this second function...

    For the second part, you probably just want asiGetPsfDir(session). You shouldn't really be trying to access the individual result database filename - because the name of that is dependent upon which analyses you've run and which output format you've chosen (and to some extent, which version of the simulator you're using). Why do you need to do that? You can use openResults(...) to open a PSF results directory, and then access all the analysis data within.

    Regards,

    Andrew.

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

    Mmm...  asiGetPsfDir(session) tells me

    *** Error in routine error:

    Message: *Error* The default SKILL generic function has not been defined for the function "asiGetPsfDir". Ensure that this function is called with the correct argument(s) (session).

    I have an external program that needs to read that file. Plus, for personal education reasons, I'd like to know how to do this in a clean way.

    If I double-click on the results, "Visualization & analysis" opens up and it selects the correct file, so I assume there is a mechanism which tells me which is the file.

    I don't want my user to have to know which file they should open. I must be all transparent.

    Best regards,

    Patrik

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

    Patrik,

    What kind of session is the object passed to asiGetPsfDir? There's also asiGetResultsPsfDir() but I suspect this will behave similarly (I can't test right now).

    Knowing the actual filename is handled levels below the public APIs, so as far as I am aware there are no APIs to return the actual file names (other than using getDirFiles() to read the directory). I don't know how you would know which "file" to read when actually it could be one of several files depending on which analyses were run anyway. Also, I'm not sure all formats will be readable by some external tool (depends on the format) since not all formats are public (in fact most of them aren't).

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • PatrikOsgnach
    PatrikOsgnach over 8 years ago
    Hello Andrew,

    Which session? Well... the code you wrote above has a line like
    ?callback (abHiSaveViolationsToHTML ',session)
    that is the session I pass to asiGetPsfDir (and asiGetResultsPsfDir behaves like asiGetPsfDir).

    Usually, we do just one analysis per test, so I could try to infer the file name by reading input.scs

    Best regards,
    Patrik
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 8 years ago

    Hi Patrick,

    Sorry, I was being a bit dumb. The session passed in to the callback is a "sev" session, and from that you need to get the "asi" session to be able to use the asi (Analog Simulation Interface - or OASIS) APIs. To do that you need to use the sevEnvironment function.

    There's no need to parse the input.scs. You can find out the names of the analyses enabled like this (this was something I just threw together to add as a RMB menu to test this out):

    procedure(abGetInformation(session)
      let((asiSess analysesEnabled)
        printf("SESSION=%L\n" session)
        asiSess=sevEnvironment(session)
        printf("PSF DIR=%L\n" asiGetPsfDir(asiSess))
        analysesEnabled=mapcar('asiGetAnalysisName
          asiGetEnabledAnalysisList(asiSess))
        printf("ANALYSES=%L\n" analysesEnabled)
      )
    )

    Only one analysis per test is fairly unusual, but if that's how you work then I'm sure you can do something sensible (albeit having to make an assumption about the file naming convention).

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • PatrikOsgnach
    PatrikOsgnach over 8 years ago
    Hello Andrew,
    ok, this makes more sense. In most of the cases where I have to read the data file is for transient simulations, so I can just look for tran.* files but it would be really nice to have a function that tells me, for every analysis, which is the data file.

    Best regards,
    Patrik
    • 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