• 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. Trigger a Skill Code by Selecting/Deselecting an Instance...

Stats

  • Locked Locked
  • Replies 9
  • Subscribers 144
  • Views 6728
  • 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

Trigger a Skill Code by Selecting/Deselecting an Instance in Schematic

mapReduce
mapReduce over 6 years ago

Hello,

Is there a way to call-back a user defined skill code after I select an instance in schematic. I found a similar question on this forum but they suggest using leRegUserLayerSelectionFilter. This function seems to create a user-defined filter option which is not exactly what I want.

Thanks!

  • Cancel
Parents
  • mbracht
    mbracht over 6 years ago

    Hi,

    For a start - you need to use leRegUserObjectSelectionFilter(<filterFunction>) to allow for all objects and not just shapes. However the filter function is called not only when you select an object by clicking on it but also when you hover the mouse over it.The code below handles this:

    (defun osf (fig)
       (let ()
          (when (car (last (geGetSelSet))) == fig && fig->objType == "inst"
             (printf "selected %L\n" fig->cellName)
             ; ...here goes your code....
          )
          t
       )
    )

    leRegUserObjectSelectionFilter("osf")

    So whatever code you want to run when an instance is selected, just put it in the when() statement.

    regards
    Max

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • mbracht
    mbracht over 6 years ago

    Hi,

    For a start - you need to use leRegUserObjectSelectionFilter(<filterFunction>) to allow for all objects and not just shapes. However the filter function is called not only when you select an object by clicking on it but also when you hover the mouse over it.The code below handles this:

    (defun osf (fig)
       (let ()
          (when (car (last (geGetSelSet))) == fig && fig->objType == "inst"
             (printf "selected %L\n" fig->cellName)
             ; ...here goes your code....
          )
          t
       )
    )

    leRegUserObjectSelectionFilter("osf")

    So whatever code you want to run when an instance is selected, just put it in the when() statement.

    regards
    Max

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • mapReduce
    mapReduce over 6 years ago in reply to mbracht

    Hi Max,

    I tried the following code as per your suggestion:

     procedure(osf(fig)
        (let ()
           (when (car (last (geGetSelSet))) == fig && fig->objType == "inst"
             (printf "selected %L\n" fig->cellName)
           )
           t
         )
      )
    leRegUserObjectSelectionFilter("osf")

    But when I select any instance in my schematic, then nothing gets printed in the CIW. Could you please let me know what am I doing wrong.

    Thanks!

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • henker
    henker over 6 years ago in reply to mapReduce

    leRegUserObjectSelectionFilter is a layout function (note the 'le' prefix = Layout Editor). I think there is no schematic equivalent.

    You could still redefine the selection bindkeys to add this functionality there.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mbracht
    mbracht over 6 years ago in reply to mapReduce

    Sorry my mistake - I didnt read your description carefully and because you mentioned a layout function figured that was about layouts.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mbracht
    mbracht over 6 years ago in reply to henker

    hmmh...what do you mean with selection bindkey? You select an instance by a single left click which is bound to schSingleSelectPt(). Now that function selects an instance when there is one under your mouse and does nothing while you are in an empty area of the schematic. So you'd have to know whether there is an instance under your mouse - and which one that would be. Is there a way to find this out in terms of a SKILL function?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • henker
    henker over 6 years ago in reply to mbracht

    What you basically need to do is

    1) remember the current selection

    2) do whatever the mouse action click/drag/etc is doing

    3) compare the now modified selection with the one stored at 1)

    So, default bindkey for e.g. layout area selection is

    hiSetBindKey( "Layout"     "<DrawThru1>"      "leSelBoxOrStretch()" )

    To match the 1),2),3) points, you could replace this (and all other selection bindkeys accordingly) with

    hiSetBindKey( "Layout"     "<DrawThru1>"      "selectionHook_start() leSelBoxOrStretch() selectionHook_done()" )

    and have the two functions for 1) and 3) as (toy example)

    procedure( selectionHook_start()
        let( (win)
            win = hiGetCurrentWindow()
            GLB_PRE = geGetSelSet(win)
        )
    )
    procedure( selectionHook_done(mode)
        let( (win pre cur sList dList)
            win = hiGetCurrentWindow()
            cur = geGetSelSet(win)
            pre = GLB_PRE
            GLB_PRE = nil

            ;; call select_hooks on current - remembered
            ;; call deselect_hooks on remembered - current
            dList = setof(e pre !member(e cur))
            sList = setof(e cur !member(e pre))

            when(dList printf("deselecting %L\n" dList~>objType))
            when(sList printf("selecting %L\n"   sList~>objType))
        );let
    )

    Could be much more optimized, setof+member is O(n^2), should be replaced with a table; with preknowledge if it is only adding or subtracting from selection (Shift or Ctrl pressed), then there can be either nothing deselected resp. selected, so this half could be omitted, etc.

    You could probably also have only one function with all three steps combined and pass the original function name (here leSelBoxOrStretch) as symbol to do 2) internally; so you would get rid of the global variable; but in this special case here leSelBoxOrStretch is a macro, and I did not find out how to evaluate a macro and pass it afterwards as argument or how to evaluate the macro symbol after being passed into the function (as macros are evaluated at compile time).

    Anyway, just a toy example...

    • 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