• 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. bindkey to toggle between leHiMarkNet() and leHiUnmarkNet...

Stats

  • Locked Locked
  • Replies 7
  • Subscribers 142
  • Views 5390
  • 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

bindkey to toggle between leHiMarkNet() and leHiUnmarkNet()

mdydyz112
mdydyz112 over 7 years ago

Hi all, 

I want to implement a (only 1) bindkey to toggle between leHiMarkNet() and  leHiUnmarkNet(). I am not sure how to find out whether or not the current cell view has a net that is being mark by leHiMarkNet(). 

I have a idea, but not sure if it will work. Please share your thought and idea if you have another one.

1. check if previous cmd is leHiMarkNet()

2. if yes, then do leHiUnmarkNet(), if no then do leHiMarkNet()

but i am not sure how to find out previous cmd used. If you have any other idea, please share.

Many thanks

  • Cancel
  • RK56
    RK56 over 7 years ago

    Hi,

    If the current window does not have a flag set with markNets then you can set it by yourself.

    if(hiGetCurrentWindow()~>markedNets then

      hiGetCurrentWindow()~>markedNets = nil

      leHiMarkNet()

    else

      hiGetCurrentWindow()~>markedNets = t

      leHiUnmarkNet()

    )

    -Ramakrishnan

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

    Ramakrishnan's suggestion of using a flag on the window object to keep track of the toggle state is the best you can do given that there isn't really something to tell you whether anything is marked or not.

    However, the request is a bit odd. The functions both prompt you to click on a net to mark (or unmark) - so they're not really opposites. What if you don't click on a net and hit escape? What if you've marked two nets and then only one when you're in "unmark" mode of the toggle? That would be a rather odd use model.

    I could (almost) understand it if you wanted to toggle between leHiMarkNet() and leHiUnmarkNetAll() - that makes (slightly) more sense. Of course, if you use the menu instead of your bindkey, it would get out of sync with the toggle status, but that would mean you just need to press the bindkey again to get back in sync.

    Regards,

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • mdydyz112
    mdydyz112 over 7 years ago in reply to RK56

    Hi Ramakrishnan, the hiGetCurrentWindow()~>markedNets cmd always return nil no matter if i have a marked nets or not in the layout. I wonder if this is related to cadence version i used, i have ICADV 12.3. 

    Hi Andrew, yes i think i want to toggle between leHiMarkNet() and leHiUnmarkNetAll(). It doesnt matter if there is any nets being marked before. 

    Thanks

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

    Nothing in Virtuoso sets the hiGetCurrentWindow()~>markedNets flag. It's Ramakrishnan's code that is using that to record the current state - whether the bindkey is in mark or unmark mode. So you'd have to call Ramakrishnan's code. So put this in your .cdsinit :

    procedure(CCFtoggleMarkNet()
     if(hiGetCurrentWindow()~>markedNets then
       hiGetCurrentWindow()~>markedNets = nil
       leHiMarkNet()
     else
       hiGetCurrentWindow()~>markedNets = t
       leHiUnmarkNetAll()
     )
    )

    Then set your bindkey to CCFtoggleMarkNet() .

    Note, I didn't test this...

    Andrew.

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

    Hi Andrew, 

    I loaded the code and set the bindkey but it always triggers unmarknetAll, I put a print statement inside else right after hiGetCurrentWindow()~>markedNets = t to print the value of hiGetCurrentWindow()~>markedNets, and found that it always returns nil. Also it never enters the if statement and only enters the else statement. The code wont work because it will never evaluate hiGetCurrentWindow()~>markedNets to true even if i manually set it to true. 

    I wonder if there is a way to find the previous cmd used so I can check if the previous cmd is leHiMarkNet() or leHiUnmarkNet() then i will set the current cmd to leHiUnmarkNet() or leHiMarkNet()

    Thanks

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

    The code works for me, although it probably makes more sense to be:

    procedure(CCFtoggleMarkNet()
     if(hiGetCurrentWindow()~>markedNets then
       hiGetCurrentWindow()~>markedNets = nil
       printf("MARK NET FLAG=%L\n" hiGetCurrentWindow()~>markedNets)
       leHiUnmarkNetAll()
     else

       hiGetCurrentWindow()~>markedNets = t
       printf("MARK NET FLAG=%L\n" hiGetCurrentWindow()~>markedNets)

       leHiMarkNet()
     )
    )

    (i.e. the mark and unmark net swapped around) because otherwise it starts in the wrong state. The markedNets property on the window is being set correctly - I can't really see how it would not do that because this kind of thing works all the time.

    See what the above outputs for me:

    CCFtoggleMarkNet()
    MARK NET FLAG=nil
    CCFtoggleMarkNet()
    MARK NET FLAG=t
    CCFtoggleMarkNet()
    MARK NET FLAG=nil
    CCFtoggleMarkNet()
    MARK NET FLAG=t
    CCFtoggleMarkNet()
    MARK NET FLAG=nil

    You asked before about getting the "previous cmd used" - well there isn't really such a concept. You can find the current command using hiGetCurrentCmd() - useful if you need to find the active command in various places, but knowing what has been run before isn't supported - you'd have to wrap the function in something that recorded which was last used. That's effectively what this flag approach is being used for in the code above.

    Regards,

    Andrew.

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

    Hi Andrew,

    Actually, it works now because i have hiGetCurrentWindow()~>markedNets == t which is not right. it should have 1 equal sign. 

    Thank you so much for you help.

    Thanks to Ramakrishnan

    • 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