• 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 6566
  • 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
  • RiadKaced
    RiadKaced over 6 years ago

    Hi mapReduce

    The "leRegUserLayerSelectionFilter" is a Layout Editor function only as pointed out by @henkl. There is no equivalent in Schematic. However, what you are looking for is very easy with a custom Bindkey that redefines the deault selection bindkey. Here is an example where I'm overriding the LMB click for single selection with a custom function that does the selection and prints a message to the CIW about the instance being slected, here is the code.

    ; Define a custom function that overloads schSingleSelectPt()

    procedure(mySingleSelectPt()

      let((inst)

        ; Use the original selection function

        schSingleSelectPt()

        ; Print info about the selected Instance

        inst=car(geGetSelectedSet())

        printf("Instance %s (%s/%s)\n" inst~>name inst~>libName inst~>cellName)

      )

    )

    ; Redifine the bindkey. I always suggest to check the bindkey override

    ; from CIW -> Options -> Bindkeys. or with SKILL using

    ; hiGetBindKey("Schematics" "None<Btn1Down>")

    hiSetBindKey("Schematics" "None<Btn1Down>" "mySingleSelectPt()")

    Cheers,

    Riad.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Sheppie
    Sheppie over 5 years ago in reply to RiadKaced

    Hi Riad,

    Thank you for your suggestion. I was looking for something similar and your implementation worked great for what I needed: changing the entry layer in LSW by simply selecting an existing shape in layout (the LPP of that shape will be the new entry layer). Please see the code below.

    Fullscreen 0640.SCLLeMouseSingleSelectPt.il.txt Download
    ;;; This procedure sets the entry layer depending on lpp of the shape selected.
    ;;; This functionality is standard in Mentor Pyxis, and ported to Virtuoso using this procedure and bind-key re-mapping.
    procedure( SCLMouseSingleSelectPt()
    	let( (	( selection nil ) )
    
    		;;; Use the original selection function
    		mouseSingleSelectPt()
    
    		selection = geGetSelectedSet()
    
    		;;; Put any custom code that should be triggered by selecting anything in a lay-out editor window below...
    		SCLSetLSWEntryLayerByShape( selection )
    
    	) ;;; end of let
    ) ;;; end of procedure SCLMouseSingleSelectPt
    
    ;;; Re-define the bindkey. I suggest to check the bindkey override
    ;;; from CIW -> Options -> Bindkeys; or with SKILL using:
    ;;; hiGetBindKey("Layout" "None<Btn1Down>")
    hiSetBindKey("Layout" "None<Btn1Down>" "SCLMouseSingleSelectPt()")
    

    Fullscreen 7723.SCLLeSetLSWEntryLayerByShape.il.txt Download
    ;;; This procedure is called from SCLMouseSingleSelectPt()
    procedure( SCLSetLSWEntryLayerByShape( selection )
    	let( (	( cvId nil )
    		( tfId nil )
    		( objId nil )
    		( lpp nil )
    		( proceed t ) )
    		
    		;;; If the selection has multiple items, then all object types have to be the same.
    		;;; This is to get this script to work with wires. A wire is a special type of path.
    		;;; A wire may consist of multiple segments, which will result in "selection" being
    		;;; a list of more then 1 item. With the 'setof' part all items NOT equal to the first
    		;;; item will be listed, thus signaling that not all items are from the same object type.
    		;;; This works when only one object has been selected too.
    		when( selection
    			if( setof( item selection nequal( item~>objType car( selection )~>objType ) )
    			then
    				;;; Different object types have been selected (like rectangles/paths/instances)
    				proceed = nil
    			else
    				foreach( item selection
    					when( proceed
    						cond(
    							;;; The item must be a shape AND it must have an lpp.
    							;;; If it doesn't comply to this, no use to proceed...
    							;;; For instance: an instance does not have an lpp...
    							( not( and( item~>isShape item~>lpp ) )
    								proceed = nil
    							)
    							;;; It is a valid item (it did not past the first conditional test),
    							;;; now see if the lpp has already been set: if not, this is the first item, thus set lpp.
    							( not( lpp )
    								lpp = item~>lpp
    							)
    							;;; It is a valid item, and the lpp has already been set, thus it is not the first item.
    							;;; Chech whether or not the LPP different, if it is, no need to proceed: which lpp
    							;;; should be used? 
    							( nequal( lpp item~>lpp )
    								proceed = nil
    							)
    						) ;;; end of cond
    					) ;;; end of when
    				) ;;; end of foreach item
    			) ;;; end of if
    
    			when( proceed
    				objId = car( selection )
    				cvId = objId~>cellView
    				tfId = techGetTechFile( cvId )
    
    				when( leIsLayerValid( lpp tfId )
    					unless( leIsLayerVisible( lpp tfId )
    						leSetLayerVisible( lpp t tfId )
    					) ;;; end of unless
    
    					leSetEntryLayer( lpp tfId )
    				) ;;; end of when
    			) ;;; end of when
    		) ;;; end of when
    	) ;;; end of let
    ) ;;; end of procedure SCLSetLSWEntryLayerByShape
    

    After downloading, remove the .txt part of the extention...

    This forum is a really good place to get inspiration.

    Kind regards,

    Sjoerd

    UPDATE: code has been updated to work with wires (= multi-segment path)

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Sheppie
    Sheppie over 5 years ago in reply to RiadKaced

    Hi Riad,

    Thank you for your suggestion. I was looking for something similar and your implementation worked great for what I needed: changing the entry layer in LSW by simply selecting an existing shape in layout (the LPP of that shape will be the new entry layer). Please see the code below.

    Fullscreen 0640.SCLLeMouseSingleSelectPt.il.txt Download
    ;;; This procedure sets the entry layer depending on lpp of the shape selected.
    ;;; This functionality is standard in Mentor Pyxis, and ported to Virtuoso using this procedure and bind-key re-mapping.
    procedure( SCLMouseSingleSelectPt()
    	let( (	( selection nil ) )
    
    		;;; Use the original selection function
    		mouseSingleSelectPt()
    
    		selection = geGetSelectedSet()
    
    		;;; Put any custom code that should be triggered by selecting anything in a lay-out editor window below...
    		SCLSetLSWEntryLayerByShape( selection )
    
    	) ;;; end of let
    ) ;;; end of procedure SCLMouseSingleSelectPt
    
    ;;; Re-define the bindkey. I suggest to check the bindkey override
    ;;; from CIW -> Options -> Bindkeys; or with SKILL using:
    ;;; hiGetBindKey("Layout" "None<Btn1Down>")
    hiSetBindKey("Layout" "None<Btn1Down>" "SCLMouseSingleSelectPt()")
    

    Fullscreen 7723.SCLLeSetLSWEntryLayerByShape.il.txt Download
    ;;; This procedure is called from SCLMouseSingleSelectPt()
    procedure( SCLSetLSWEntryLayerByShape( selection )
    	let( (	( cvId nil )
    		( tfId nil )
    		( objId nil )
    		( lpp nil )
    		( proceed t ) )
    		
    		;;; If the selection has multiple items, then all object types have to be the same.
    		;;; This is to get this script to work with wires. A wire is a special type of path.
    		;;; A wire may consist of multiple segments, which will result in "selection" being
    		;;; a list of more then 1 item. With the 'setof' part all items NOT equal to the first
    		;;; item will be listed, thus signaling that not all items are from the same object type.
    		;;; This works when only one object has been selected too.
    		when( selection
    			if( setof( item selection nequal( item~>objType car( selection )~>objType ) )
    			then
    				;;; Different object types have been selected (like rectangles/paths/instances)
    				proceed = nil
    			else
    				foreach( item selection
    					when( proceed
    						cond(
    							;;; The item must be a shape AND it must have an lpp.
    							;;; If it doesn't comply to this, no use to proceed...
    							;;; For instance: an instance does not have an lpp...
    							( not( and( item~>isShape item~>lpp ) )
    								proceed = nil
    							)
    							;;; It is a valid item (it did not past the first conditional test),
    							;;; now see if the lpp has already been set: if not, this is the first item, thus set lpp.
    							( not( lpp )
    								lpp = item~>lpp
    							)
    							;;; It is a valid item, and the lpp has already been set, thus it is not the first item.
    							;;; Chech whether or not the LPP different, if it is, no need to proceed: which lpp
    							;;; should be used? 
    							( nequal( lpp item~>lpp )
    								proceed = nil
    							)
    						) ;;; end of cond
    					) ;;; end of when
    				) ;;; end of foreach item
    			) ;;; end of if
    
    			when( proceed
    				objId = car( selection )
    				cvId = objId~>cellView
    				tfId = techGetTechFile( cvId )
    
    				when( leIsLayerValid( lpp tfId )
    					unless( leIsLayerVisible( lpp tfId )
    						leSetLayerVisible( lpp t tfId )
    					) ;;; end of unless
    
    					leSetEntryLayer( lpp tfId )
    				) ;;; end of when
    			) ;;; end of when
    		) ;;; end of when
    	) ;;; end of let
    ) ;;; end of procedure SCLSetLSWEntryLayerByShape
    

    After downloading, remove the .txt part of the extention...

    This forum is a really good place to get inspiration.

    Kind regards,

    Sjoerd

    UPDATE: code has been updated to work with wires (= multi-segment path)

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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