• 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. Deleting Schematic instance and instantiating another device...

Stats

  • Locked Locked
  • Replies 19
  • Subscribers 143
  • Views 25447
  • 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

Deleting Schematic instance and instantiating another device on the same origin

archive
archive over 13 years ago

Dear All,

I am looking to do the following thing using SKILL

1. Open a schematic and look for a specific instance.

2. Delete the instance.

3. Instantiate another cell at the same origin (Both the symbols match in pin locations.)

 

I am not able to identify, how I can get the origin of the original instance before deleting it. Any kind of help is much appreciated.

 

Please help!

 

Thanks,

Vijay

  • Cancel
  • Reinice
    Reinice over 13 years ago

    Hi All,

    I'am migrating my schematic from old process to new process. I want to keep the position(orientation and xy position) and wiring of the old process to the new process. Example, I have an old instance in my schematic that when replaced by the new process is smaller in size. How can I keep the position and wiring of the old process to the new process?

    Can anyone help me?

    Thanks and Regards,

    Reinice

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

    Sounds as if the following could be useful (at least as a starting point):

    /* abMapAndWire.ils
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       May 20, 2004 
    Modified   
    By         
    
    Map instances from one library to another, with wiring
    because the symbols are a different size.
    
    Two main entry functions:
    
    (abMapAndWireLoadConfig "config.file")
    (abMapAndWire cellView)
    
    The config file is in this format (it can have comments
    too, using normal SKILL conventions):
    
    (
      nil
      xSnapSpacing 0.0625   ; defaults to 0.0625
      ySnapSpacing 0.0625   ; defaults to 0.0625
      fontHeight 0.0625     ; defaults to xSnapSpacing
      addWireLabels t       ; if it should add labels for wire stubs left by
                            ; inherited connections
      map
      (
       (nil
        ; lib/cell/view to be converted, from and to.
        ; all to setting default to the from settings, and the
        ; fromView defaults to "symbol".
        fromLib "gpdk"
        fromCell "nmosa1"
        fromView "symbol"
        toLib "gpdk"
        toCell "nmosa2"
        toView "symbol"
        ; if any pin names need mapping, do that here. Otherwise
        ; can omit
        pinMap (("G" "g") ("D" "d"))
        ; Which pins should not be wired, but should replace with a
        ; netSet on the instance
        pinToNetSet (("B" "nbulk"))
        ; which pin should be considered the origin - in other words,
        ; stay where it is. It does not have to be the origin of the symbol
        pinOrigin "G"
        ; this is the orientation you need to give to the new symbol 
        ; to rotate it to the same orientation as the old symbol
        orient "R90"
        )
       ; and now for another mapping...
       (nil
        fromLib "gpdk"
        fromCell "pmosa1"
        fromView "symbol"
        toLib "gpdk"
        toCell "pmosa2"
        toView "symbol"
        pinOrigin "G"
        orient "R90"
        )
       )
      )
    
    ***************************************************
    
    SCCS Info: @(#) abMapAndWire.ils 05/27/04.16:01:39 1.4
    
    */
    
    ;------------------------------------------------------------------------
    ; The two functions which will be public later in the lexical
    ; scope
    ;------------------------------------------------------------------------
    (define abMapAndWireLoadConfig nil)
    (define abMapAndWire nil)
    
    (let (mapData xSnapSpacing ySnapSpacing wireCatch addWireLabels fontHeight)
    
    /***************************************************************
    *                                                              *
    *                  (getPinPositions cellView)                  *
    *                                                              *
    *   Private function to Get the positions of the centres of    *
    *  each pin on the symbol, and return a table with these in.   *
    *                                                              *
    ***************************************************************/
    
      (defun getPinPositions (cellView)
             (let (positionArray pin)
                  (setq positionArray (makeTable "pinPositions" nil))
                  (foreach terminal (getq cellView terminals)
                           ;-------------------------------------------------
                           ; Only looking at the location of the first pin
                           ; for each terminal - in practice there will be only
                           ; one anyway
                           ;-------------------------------------------------
                           (setq pin (car (getq terminal pins)))
                           (when pin
                                 (setarray positionArray (getq terminal name)
                                           (centerBox
                                            (getq (getq pin fig) bBox)
                                            )
                                           )
                                 )
                           )
                  positionArray
                  )
             ) ; defun getPinPositions
    
    /******************************************************************
    *                                                                 *
    *                       (getMapDetails dpl)                       *
    *                                                                 *
    *  Private function to figure out all the information about the   *
    * master (both from and to), as well as the transformation needed *
    *          to map from the old symbol to the new symbol.          *
    *                     Returns the fromMaster.                     *
    *                                                                 *
    ******************************************************************/
    
      (defun getMapDetails (dpl)
             (let (fromMaster toMaster toPin fromPin fromPos toPos badMaps)
                  (setq fromMaster
                        (dbOpenCellViewByType
                         (getq dpl fromLib)
                         (getq dpl fromCell)
                         (or (getq dpl fromView) "symbol")
                         ))
                  (getWarn)
                  (if fromMaster
                      (progn
                       (setq toMaster
                             (dbOpenCellViewByType
                              (or (getq dpl toLib) (getq dpl fromLib))
                              (or (getq dpl toCell) (getq dpl fromCell))
                              (or (getq dpl toView) (getq dpl fromView) "symbol")
                              ))
                       (getWarn)
                       (unless toMaster
                               (printf "NOTE: map from %s/%s/%s to %s/%s/%s skipped due to missing destination cellView\n"
                                       (getq dpl fromLib) 
                                       (getq dpl fromCell)
                                       (getq dpl fromView)
                                       (getq dpl toLib) 
                                       (getq dpl toCell)
                                       (getq dpl toView)
                                       )
                               (setq fromMaster nil)
                               )
                       )
                      ;------------------------------------------------------
                      ; Else fromMaster doesn't exist
                      ;------------------------------------------------------
                      (printf "NOTE: map from %s/%s/%s to %s/%s/%s skipped due to missing source cellView\n"
                              (getq dpl fromLib) 
                              (getq dpl fromCell)
                              (getq dpl fromView)
                              (getq dpl toLib) 
                              (getq dpl toCell)
                              (getq dpl toView)
                              )
                      )
                  ;----------------------------------------------------------
                  ; Only do the rest if we're going to keep this mapping
                  ;----------------------------------------------------------
                  (when
                   fromMaster
                   (putpropq dpl fromMaster fromMaster)
                   (putpropq dpl toMaster toMaster)
                   (putpropq dpl (getPinPositions fromMaster) fromPinPositions)
                   (putpropq dpl (getPinPositions toMaster) toPinPositions)
                   ;----------------------------------------------------------
                   ; Check all the pin mappings are OK
                   ;----------------------------------------------------------
                   (setq badMaps
                         (setof pinMap (getq dpl pinMap)
                                (and
                                 (arrayref (getq dpl fromPinPositions) (car pinMap))
                                 (null (arrayref (getq dpl toPinPositions) (cadr pinMap)))
                                 )))
                   (when badMaps
                         (error "The pinMap contains invalid pins %L for %s/%s/%s\n"
                                (mapcar 'cadr badMaps)
                                (getq toMaster libName)
                                (getq toMaster cellName)
                                (getq toMaster viewName)
                                ))
                   (setq toPin (getMappedPin dpl (getq dpl pinOrigin)))
                   ;----------------------------------------------------------
                   ; Figure out the transform needed to map from one to
                   ; another
                   ;----------------------------------------------------------
                   (setq fromPin (getq dpl pinOrigin))
                   (setq toPos (arrayref (getq dpl toPinPositions) toPin))
                   (setq fromPos (arrayref (getq dpl fromPinPositions) fromPin))
                   (unless toPos 
                           (error "Could not find mapped pin %s on %s/%s/%s\n"
                                  toPin
                                  (getq toMaster libName)
                                  (getq toMaster cellName)
                                  (getq toMaster viewName)
                                  ))
                   (unless fromPos 
                           (error "Could not find pin %s on %s/%s/%s\n"
                                  fromPin
                                  (getq fromMaster libName)
                                  (getq fromMaster cellName)
                                  (getq fromMaster viewName)
                                  ))
                   (putpropq dpl 
                             (dbConcatTransform
                              (dbConcatTransform
                               (list 
                                (mapcar minus toPos)
                                "R0"
                                )
                               (list
                                (list 0 0)
                                (getq dpl orient)
                                )
                               )
                              (list
                               fromPos
                               "R0"
                               )
                              )
                             transform
                             )
                   ) ; when
                  fromMaster
                  )
             ) ; defun getMapDetails
    
    /***************************************************************
    *                                                              *
    *                    (checkMapDetails dpl)                     *
    *                                                              *
    *  Private function for checking that the minimum information  *
    *              has been provided for a map entry.              *
    *                                                              *
    ***************************************************************/
    
      (defun checkMapDetails (dpl)
             (unless
              (and
               (getq dpl fromLib)
               (getq dpl fromCell)
               (getq dpl fromView)
               (getq dpl pinOrigin)
               )
              (error "Minimum of fromLib, fromCell, fromView, pinOrigin must be specified in config file\n")
              )
             ) ; defun checkMapDetails
    
    /*******************************************************************
    *                                                                  *
    *                     (loadConfig configFile)                      *
    *                                                                  *
    * Public function (exported as abMapAndWireLoadConfig) to load the *
    * config file for the mapping, and set up all the data structures  *
    *                 needed for doing the conversion.                 *
    *                                                                  *
    *******************************************************************/
    
      (defun loadConfig (configFile)
             (let (prt data fromMaster)
                  (setq prt (infile configFile))
                  (unless prt (error "Could not open config file %s\n" configFile))
                  ;----------------------------------------------------------
                  ; skip over blank lines/comments
                  ;----------------------------------------------------------
                  (while (equal (setq data (lineread prt)) t) t)
                  (setq data (car data))
                  (close prt)
                  ;----------------------------------------------------------
                  ; Take out the top level options from the config
                  ;----------------------------------------------------------
                  (setq xSnapSpacing (or (getq data xSnapSpacing) 0.0625))
                  (setq ySnapSpacing (or (getq data ySnapSpacing) 0.0625))
                  (setq wireCatch (list (times xSnapSpacing 0.5) (times ySnapSpacing 0.5)))
                  (setq addWireLabels (getq data addWireLabels))
                  (setq fontHeight (or (getq data fontHeight)
                                       (getq data xSnapSpacing)
                                       0.0625))
                  ;----------------------------------------------------------
                  ; Now create the config table
                  ;----------------------------------------------------------
                  (setq mapData (makeTable "mapData" nil))
                  (foreach dpl (getq data map)
                           (checkMapDetails dpl)
                           (setq fromMaster (getMapDetails dpl))
                           (when fromMaster
                                 (setarray mapData fromMaster dpl)
                                 )
                           )
                  mapData
                  )
             ) ; defun loadConfig
    
    /******************************************************************
    *                                                                 *
    *                   (getMappedPin dpl pinName)                    *
    *                                                                 *
    *    Private function for getting the pin name in the toMaster    *
    * if it has been mapped (or the original name if it is unmapped). *
    *                                                                 *
    ******************************************************************/
    
      (defun getMappedPin (dpl pinName)
             (or (cadr (assoc pinName (getq dpl pinMap))) pinName)
             )
    
    /***************************************************************
    *                                                              *
    *                     (isNetLabelled net)                      *
    *                                                              *
    * Private function to guess whether a label is needed. If the  *
    * net has a terminal (then there is a pin, and so it is going  *
    *  to be autonamed), or if there is a label attached. Doesn't  *
    *                   spot supply/ground taps.                   *
    *                                                              *
    ***************************************************************/
    
      (defun isNetLabelled (net)
             (or
              (getq net term)
              (exists fig (getq net figs) (equal (getq fig objType) "label"))
              )
             )
    
    /*******************************************************************
    *                                                                  *
    *                      (replaceInstance inst)                      *
    *                                                                  *
    *   Private function to replace an individual instance, and then   *
    * do the wiring up to the old locations, or add netSet expressions *
    *                            if needed.                            *
    *                                                                  *
    *******************************************************************/
    
      (defun replaceInstance (inst)
             (let (dpl cellView newTransform oldTransform fromPinPositions toPinPositions
                       fromPos toPos termsToNets wire wireBox netSet netName)
                  (setq dpl (arrayref mapData (getq inst master)))
                  (when dpl
                        (setq cellView (getq inst cellView))
                        ;----------------------------------------------------
                        ; Record all the instTerm information - need it
                        ; later for the netSet handling
                        ;----------------------------------------------------
                        (setq termsToNets
                              (foreach mapcar instTerm (getq inst instTerms)
                                       (list (getq instTerm name) 
                                             (getq (getq instTerm net) name))))
                        ;----------------------------------------------------
                        ; Work out the transformation, and replace the instance
                        ;----------------------------------------------------
                        (setq oldTransform (getq inst transform))
                        (setq newTransform (dbConcatTransform (getq dpl transform)
                                                              oldTransform))
                        (putpropq inst (getq dpl toMaster) master)
                        (putpropq inst (car newTransform) xy)
                        (putpropq inst (cadr newTransform) orient)
                        ;----------------------------------------------------
                        ; Now do the routing
                        ;----------------------------------------------------
                        (setq fromPinPositions (getq dpl fromPinPositions))
                        (setq toPinPositions (getq dpl toPinPositions))
                        (foreach pin fromPinPositions
                                 (cond
                                  ;------------------------------------------
                                  ; If it is one of the pins to be handled with
                                  ; a netSet, do that
                                  ;------------------------------------------
                                  ((setq netSet (assoc pin (getq dpl pinToNetSet)))
                                   (setq netName (cadr (assoc pin termsToNets)))
                                   (dbCreateProp inst (cadr netSet) "netSet" netName)
                                   ;-----------------------------------------
                                   ; Check to see if we're supposed to be adding 
                                   ; labels, and there doesn't already seem to be one
                                   ;-----------------------------------------
                                   (when 
                                    (and 
                                     addWireLabels
                                     (null
                                      (isNetLabelled 
                                       (dbFindNetByName cellView netName))
                                      )
                                     )
                                    ;----------------------------------------
                                    ; Find the wire end where the pin used to be.
                                    ;----------------------------------------
                                    (setq fromPos (arrayref fromPinPositions pin))
                                    (setq fromPos
                                          (geTransformUserPoint 
                                           fromPos oldTransform))
                                    (setq wireBox
                                          (list
                                           (mapcar difference fromPos wireCatch)
                                           (mapcar plus fromPos wireCatch)
                                           ))
                                    (setq wire 
                                          (car
                                           (dbGetOverlaps
                                            cellView wireBox '("wire" "drawing") 0)))
                                    ;----------------------------------------
                                    ; Now add a wire label, just to be safe.
                                    ;----------------------------------------
                                    (schCreateWireLabel
                                     cellView
                                     wire
                                     fromPos
                                     netName
                                     "lowerLeft"
                                     "R0"
                                     "stick"
                                     fontHeight
                                     nil
                                     )
                                    )
                                   ) ; end of arm for netSet
                                  ;------------------------------------------
                                  ; Otherwise if it is not the pin marked as the 
                                  ; origin, wire it up.
                                  ;------------------------------------------
                                  ((nequal pin (getq dpl pinOrigin))
                                   (setq fromPos (arrayref fromPinPositions pin))
                                   (setq toPos 
                                         (arrayref toPinPositions 
                                                   (getMappedPin dpl pin)))
                                   (when
                                    (and fromPos toPos)
                                    (setq fromPos
                                          (geTransformUserPoint 
                                           fromPos oldTransform))
                                    (setq toPos
                                          (geTransformUserPoint
                                           toPos newTransform))
                                    (schCreateWire
                                     cellView
                                     "route"
                                     "full"
                                     (list fromPos toPos)
                                     xSnapSpacing
                                     ySnapSpacing
                                     0.0
                                     )
                                    ) ; when
                                   ) ; end of arm for pin wiring
                                  ) ; cond
                                 ) ; foreach
                        t
                        ) ; when
                  ) ; let
             ) ; defun replaceInstance
    
    /***************************************************************
    *                                                              *
    *                (replaceInstances [cellView])                 *
    *                                                              *
    *   Public function (exported as (abMapAndWire) ) to do the    *
    *        mapping and wiring for the cellView passed in.        *
    *                                                              *
    ***************************************************************/
    
      (defun replaceInstances (@optional (cellView (geGetEditCellView)))
             (foreach instance (getq cellView instances)
                      (replaceInstance instance)
                      )
             t
             ) ; defun replaceInstances
    
      (setq abMapAndWireLoadConfig loadConfig)
      (setq abMapAndWire replaceInstances)
      ) ; end of lexical scope

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Reinice
    Reinice over 13 years ago

    Hi Andrew,

    Thank you very much for the starting point to workaround. = )

    Thanks and Regards,

    Reinice

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Reinice
    Reinice over 13 years ago

    Hi Andrew,

    I 'am trying your abMapAndWire.ils

    I want to migrate this instance to the new process:               pnp5(old process)                       pnp(new process)

    Instance Name is                                                                         "Q1"                                          "Q0"

    Instance Orientation is                                                                 "MY"                                          "R0"

    Instance Terminal Name is                                                             "C"                                           "C"

    Pin Name is                                                                             "IO|P__2"                                       "3"

    Instance Terminal Name is                                                             "E"                                           "B"

    Pin Name is                                                                             "IO|P__1"                                       "2"

    Instance Terminal Name is                                                             "B"                                           "E"

    Pin Name is                                                                              "IO|P__0"                                      "1"

    But I'am having an error on (abMapAndWireLoadConfig "config.file")
     

    Here is the content of my config.file

    (
      nil
      xSnapSpacing 0.0625   ; defaults to 0.0625
      ySnapSpacing 0.0625   ; defaults to 0.0625
      fontHeight 0.0625     ; defaults to xSnapSpacing
      addWireLabels t       ; if it should add labels for wire stubs left by
                            ; inherited connections
      map
      (
       (nil
        ; lib/cell/view to be converted, from and to.
        ; all to setting default to the from settings, and the
        ; fromView defaults to "symbol".
        fromLib "TSMC90G1033"
        fromCell "pnp5"
        fromView "symbol_xform"
        toLib "tsmcN40"
        toCell "pnp"
        toView "symbol"
        ; if any pin names need mapping, do that here. Otherwise
        ; can omit
        pinMap (("IO|P__2" "3") ("IO|P__1" "2") ("IO|P__0" "1"))
        ; Which pins should not be wired, but should replace with a
        ; netSet on the instance
        ;pinToNetSet (("B" "nbulk"))
        ; which pin should be considered the origin - in other words,
        ; stay where it is. It does not have to be the origin of the symbol
        pinOrigin "IO|P__0"
        ; this is the orientation you need to give to the new symbol
        ; to rotate it to the same orientation as the old symbol
        orient "MY"
        )
       )
      )
     

    *Error* Could not find mapped pin 1 on tsmcN40/pnp/symbol

    and when I comment pinMap (("IO|P__2" "3") ("IO|P__1" "2") ("IO|P__0" "1")), here is the error:

    *Error* Could not find mapped pin 1 on tsmcN40/pnp/symbol

    What would be the correct input for my config.file?

    Is it needed that pin names of an instance must be the same for old process and new process so that errors such as above will not show?

    Hope you can help me on this. Thanks in advance.

    Thanks and Regards,

    Reinice

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Reinice
    Reinice over 13 years ago

    Hi Andrew, 

    When I input:

     (abMapAndWire cellView)
     

    in CIW I get an error message:

    *Error* eval: unbound variable - cellView

    Is cellView a wrong input for abMapAndWire?

    Thanks and Regards,

    Reinice

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

    Hi Reinice,

    First of all, I've no idea why you are using the names  "IO|P__2" etc. I'm positive they're not the names of the "pins" (actually it's the terminal name I care about - so maybe I'm using the wrong nomenclature - the term name is the one of interest).

    So the pinMap would be:

    pinMap (("B" "B") ("C" "C") ("E" "E"))

    In which case you can just leave it commented it. You show the "B" corresponding to the "E" pin in your table, but that can't be correct because that would mean the base and emitter are being swapped. Also you show the different orientation - the orientation is only needed if the transistor is a different way around.

    If you comment out the pinMap line, the error message you get is not the one you show, but instead would be:

    *Error* Could not find mapped pin IO|P__0 on tsmcN40/pnp/symbol

    That's not surprising, since the pin should be "B" - 

         pinOrigin "B"

    So given my above comment, I suspect you may want orient to be set to "R0" too - but you can experiment with that yourself.

    From your second question, you need to call the code with the database object of the cellView being migrated. If it's already open in the schematic editor, and the window is the current window, you can call:

    abMapAndWire(geGetEditCellView())

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Reinice
    Reinice over 13 years ago

    Hi Andrew,

    Good Day. I've tried your suggestions and corrections, the script is working ok.

    But when I tried to edit "config.file" 

    From

        fromLib "TSMC90G1033"
        fromCell "pnp5"
        fromView "symbol"
        toLib "tsmcN40"
        toCell "pnp"
        toView "symbol" 

    To

        fromLib "TSMC90G1033"
        fromCell "pnp5"
        fromView "symbol_xform"
        toLib "tsmcN40"
        toCell "pnp"
        toView "symbol"

    I' am encountering an error:

    *Error*  Could not find pin B on TSMC90G1033/pnp5/symbol_xform

    There are cells in my schematic that are on "symbol_xform" view. Is it needed that "view" of old process and new process be the same?

    Is there a way to migrate the old process(even if it is in "symbol_xform" view) to new process("which is in "symbol" view)?

    Thank you very much in advance.

    Thanks and Regards,

    Reinice

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

    Reinice,

    Unfortnately the code was not designed to cope with symbol pcells (which is what symbol_xform views are) - when loading the mapping file, it looks up various pieces of information in the source and destination symbols to work out the mapping; with symbol pcells it would have to do this per variant - and right now it doesn't do that (and would be a reasonably big change to do so).

    The reason why symbol_xform is a pcell is in order to emulate the "mag" attribute that used to exist in the CDB database in IC5141; this allowed you to scale an instance by a magnification factor. OpenAccess does not support this, so it was emulated by creating a wrapper pcell which had a parameter "mag" to effectively do the same thing.

    Given that I don't really have time at the moment to update the SKILL code to  support symbol pcells (I'd need to put together enough test data to try it out too), maybe you can do a search and replace and change your source schematic to use symbol instead of symbol_xform? Problem could be that if the mag factor has been set to something other than 1.0, it might mess up the schematic.

    I did have a look at the code, and have some ideas how to fix it to support symbol_xform views, but it needs more thought (as well as the work to modify the code) - and unfortunately I'm unlikely to have the time in the next few days due to work commitments.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Reinice
    Reinice over 13 years ago

    Hi Andrew,

    I will try your suggestion to do a search and replace and change my source schematic to use symbol instead of symbol_xform.

    I think I will be having a problem on the mag factor because there are some mag factors that are greater than 1.0.

    Thanks and Regards,

    Reinice

    • 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