• 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. Finding Layer Box In a Instance

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 145
  • Views 16891
  • 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

Finding Layer Box In a Instance

harishgurram
harishgurram over 11 years ago

 Hi,

I have placed a instance in my cell view(layout). 

Is there any functions to get the bBox of a particular layer purpose pair, with out flattening the instance.

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    Hadn't seen Ted's response before I wrote this (was based on something I had already for a different purpose, so didn't have to start from scratch). Mine handles hierarchy within the instance (most of the work is to handle mosaics).

    Regards,

    Andrew

    /* abGetLayerBBox.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       Aug 06, 2014 
    Modified   
    By         
    
    Find the bounding box of a layer purpose pair within a
    cellView. For example:
    
    bBox=abGetLayerBBox(geGetEditCellView() list("Metal1" "drawing"))
    
    or for an instance:
    
    bBox=abGetLayerBBox(instId~>master list("Metal3" "drawing") instId~>transform)
    
    ***************************************************
    
    SCCS Info: @(#) abGetLayerBBox.il 08/06/14.06:28:58 1.1
    
    */
    
    
    /***************************************************************
    *                                                              *
    *             (abGetLayerBBoxExtend bBox newBBox)              *
    *                                                              *
    *   Utility function to find the overall bBox of two bBoxes    *
    *                                                              *
    ***************************************************************/
    
    (defun abGetLayerBBoxExtend (bBox newBBox)
      (cond
        ((null bBox) newBBox)
        ((null newBBox) bBox)
        (t
          (list
            (mapcar 'min (lowerLeft bBox) (lowerLeft newBBox))
            (mapcar 'max (upperRight bBox) (upperRight newBBox)))
          )
        )
      )
    
    /*****************************************************************
    *                                                                *
    *              (abGetLayerBBox cv lpp [transform])               *
    *                                                                *
    * Get the bounding box of a layer purpose pair within a cellView *
    *   with an optional transform (needed for the recursion, but    *
    *                   also useful for instances)                   *
    *                                                                *
    *****************************************************************/
    
    (defun abGetLayerBBox (cv lpp @optional 
                                    (transform list(0:0 "R0" 1))
                                    )
      (let (bBox)
        (foreach shape 
                 (dbGetq
                   (car (exists LPP (dbGetq cv lpps) 
                                (and
                                  (equal (dbGetq LPP layerName) (car lpp))
                                  (equal (dbGetq LPP purpose) (cadr lpp)))))
                   shapes)
                 (setq bBox (abGetLayerBBoxExtend 
                              bBox
                              (dbTransformBBox (dbGetq shape bBox) transform)))
                 )
        (foreach inst (dbGetq cv instances)
                 (when (equal (dbGetq inst objType) "inst")
                   (setq bBox (abGetLayerBBoxExtend 
                                bBox
                                (abGetLayerBBox 
                                  (dbGetq inst master) 
                                  lpp
                                  (dbConcatTransform
                                    (dbGetq inst transform)
                                    transform)
                                  )
                                ))
                   )
                 )
        (foreach via (dbGetq cv vias)
                 (setq bBox (abGetLayerBBoxExtend 
                              bBox
                              (abGetLayerBBox 
                                (dbGetq (dbGetq via viaHeader) master) 
                                lpp
                                (dbConcatTransform
                                  (list (dbGetq via origin) (dbGetq via orient) 1)
                                  transform)
                                )
                              ))
                 )
        (foreach mosaic (dbGetq cv mosaics)
                 (if (equal (dbGetq mosaic mosaicType) "simple")
                   (let (master orient xy isOA newTransform mosaicTransform)
                     ;-------------------------------------------------------
                     ; OpenAccess stores mosaics differently - in CDB,
                     ; the individual instances are rotated - in OA, the
                     ; whole mosaic is rotated. So need to detect database
                     ; type used, and adjust transformations accordingly
                     ;-------------------------------------------------------
                     (setq isOA (and (isCallable 'dbGetDatabaseType)
                                     (equal (dbGetDatabaseType) "OpenAccess")))
                     (setq master 
                           (dbGetq (car (dbGetq mosaic instanceList)) master))
                     (setq orient (car (dbGetq mosaic tileArray)))
                     ;-------------------------------------------------------
                     ; If OA, the transformation of the whole mosaic
                     ; is calculated - by shifting to the origin, rotating,
                     ; and then shifting back
                     ;-------------------------------------------------------
                     (when isOA
                       (setq mosaicTransform
                             (dbConcatTransform
                               (dbConcatTransform
                                 (list 
                                   (mapcar 'minus (dbGetq mosaic xy)) "R0" 1)
                                 (list (list 0 0) orient 1))
                               (list (dbGetq mosaic xy) "R0" 1))
                             ))
                     ;-------------------------------------------------------
                     ; Iterate over the rows and columns, flattening each
                     ; sub-instance in the simple mosaic
                     ;-------------------------------------------------------
                     (for row 0 (sub1 (dbGetq mosaic rows))
                          (for col 0 (sub1 (dbGetq mosaic columns))
                               (setq xy
                                     (list
                                       (plus (xCoord (dbGetq mosaic xy))
                                             (times col (dbGetq mosaic uX)))
                                       (plus (yCoord (dbGetq mosaic xy))
                                             (times row (dbGetq mosaic uY)))
                                       ))
                               ;---------------------------------------------
                               ; Compute the transformation of the sub-instance
                               ; Done differently for OA and CDB
                               ;---------------------------------------------
                               (setq newTransform
                                     (if isOA
                                       (dbConcatTransform
                                         (dbConcatTransform
                                           (list xy "R0" 1)
                                           mosaicTransform)
                                         transform)
                                       (dbConcatTransform
                                         (list xy orient 1)
                                         transform)
                                       ))
                               ;---------------------------------------------
                               ; Call abGetLayerBBox recursively
                               ;---------------------------------------------
                               (setq bBox 
                                     (abGetLayerBBoxExtend 
                                       bBox
                                       (abGetLayerBBox master lpp newTransform)
                                       ))
                               ) ; for col
                          ) ; for row
                     ) ; let
                   (warn "Complex mosaic %s in %s/%s/%s ignored\n"
                         (dbGetq mosaic name)
                         (dbGetq cv libName)
                         (dbGetq cv cellName)
                         (dbGetq cv viewName)
                         )
                   )
                 )
        bBox
        )
      ) 
    
     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    Hadn't seen Ted's response before I wrote this (was based on something I had already for a different purpose, so didn't have to start from scratch). Mine handles hierarchy within the instance (most of the work is to handle mosaics).

    Regards,

    Andrew

    /* abGetLayerBBox.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       Aug 06, 2014 
    Modified   
    By         
    
    Find the bounding box of a layer purpose pair within a
    cellView. For example:
    
    bBox=abGetLayerBBox(geGetEditCellView() list("Metal1" "drawing"))
    
    or for an instance:
    
    bBox=abGetLayerBBox(instId~>master list("Metal3" "drawing") instId~>transform)
    
    ***************************************************
    
    SCCS Info: @(#) abGetLayerBBox.il 08/06/14.06:28:58 1.1
    
    */
    
    
    /***************************************************************
    *                                                              *
    *             (abGetLayerBBoxExtend bBox newBBox)              *
    *                                                              *
    *   Utility function to find the overall bBox of two bBoxes    *
    *                                                              *
    ***************************************************************/
    
    (defun abGetLayerBBoxExtend (bBox newBBox)
      (cond
        ((null bBox) newBBox)
        ((null newBBox) bBox)
        (t
          (list
            (mapcar 'min (lowerLeft bBox) (lowerLeft newBBox))
            (mapcar 'max (upperRight bBox) (upperRight newBBox)))
          )
        )
      )
    
    /*****************************************************************
    *                                                                *
    *              (abGetLayerBBox cv lpp [transform])               *
    *                                                                *
    * Get the bounding box of a layer purpose pair within a cellView *
    *   with an optional transform (needed for the recursion, but    *
    *                   also useful for instances)                   *
    *                                                                *
    *****************************************************************/
    
    (defun abGetLayerBBox (cv lpp @optional 
                                    (transform list(0:0 "R0" 1))
                                    )
      (let (bBox)
        (foreach shape 
                 (dbGetq
                   (car (exists LPP (dbGetq cv lpps) 
                                (and
                                  (equal (dbGetq LPP layerName) (car lpp))
                                  (equal (dbGetq LPP purpose) (cadr lpp)))))
                   shapes)
                 (setq bBox (abGetLayerBBoxExtend 
                              bBox
                              (dbTransformBBox (dbGetq shape bBox) transform)))
                 )
        (foreach inst (dbGetq cv instances)
                 (when (equal (dbGetq inst objType) "inst")
                   (setq bBox (abGetLayerBBoxExtend 
                                bBox
                                (abGetLayerBBox 
                                  (dbGetq inst master) 
                                  lpp
                                  (dbConcatTransform
                                    (dbGetq inst transform)
                                    transform)
                                  )
                                ))
                   )
                 )
        (foreach via (dbGetq cv vias)
                 (setq bBox (abGetLayerBBoxExtend 
                              bBox
                              (abGetLayerBBox 
                                (dbGetq (dbGetq via viaHeader) master) 
                                lpp
                                (dbConcatTransform
                                  (list (dbGetq via origin) (dbGetq via orient) 1)
                                  transform)
                                )
                              ))
                 )
        (foreach mosaic (dbGetq cv mosaics)
                 (if (equal (dbGetq mosaic mosaicType) "simple")
                   (let (master orient xy isOA newTransform mosaicTransform)
                     ;-------------------------------------------------------
                     ; OpenAccess stores mosaics differently - in CDB,
                     ; the individual instances are rotated - in OA, the
                     ; whole mosaic is rotated. So need to detect database
                     ; type used, and adjust transformations accordingly
                     ;-------------------------------------------------------
                     (setq isOA (and (isCallable 'dbGetDatabaseType)
                                     (equal (dbGetDatabaseType) "OpenAccess")))
                     (setq master 
                           (dbGetq (car (dbGetq mosaic instanceList)) master))
                     (setq orient (car (dbGetq mosaic tileArray)))
                     ;-------------------------------------------------------
                     ; If OA, the transformation of the whole mosaic
                     ; is calculated - by shifting to the origin, rotating,
                     ; and then shifting back
                     ;-------------------------------------------------------
                     (when isOA
                       (setq mosaicTransform
                             (dbConcatTransform
                               (dbConcatTransform
                                 (list 
                                   (mapcar 'minus (dbGetq mosaic xy)) "R0" 1)
                                 (list (list 0 0) orient 1))
                               (list (dbGetq mosaic xy) "R0" 1))
                             ))
                     ;-------------------------------------------------------
                     ; Iterate over the rows and columns, flattening each
                     ; sub-instance in the simple mosaic
                     ;-------------------------------------------------------
                     (for row 0 (sub1 (dbGetq mosaic rows))
                          (for col 0 (sub1 (dbGetq mosaic columns))
                               (setq xy
                                     (list
                                       (plus (xCoord (dbGetq mosaic xy))
                                             (times col (dbGetq mosaic uX)))
                                       (plus (yCoord (dbGetq mosaic xy))
                                             (times row (dbGetq mosaic uY)))
                                       ))
                               ;---------------------------------------------
                               ; Compute the transformation of the sub-instance
                               ; Done differently for OA and CDB
                               ;---------------------------------------------
                               (setq newTransform
                                     (if isOA
                                       (dbConcatTransform
                                         (dbConcatTransform
                                           (list xy "R0" 1)
                                           mosaicTransform)
                                         transform)
                                       (dbConcatTransform
                                         (list xy orient 1)
                                         transform)
                                       ))
                               ;---------------------------------------------
                               ; Call abGetLayerBBox recursively
                               ;---------------------------------------------
                               (setq bBox 
                                     (abGetLayerBBoxExtend 
                                       bBox
                                       (abGetLayerBBox master lpp newTransform)
                                       ))
                               ) ; for col
                          ) ; for row
                     ) ; let
                   (warn "Complex mosaic %s in %s/%s/%s ignored\n"
                         (dbGetq mosaic name)
                         (dbGetq cv libName)
                         (dbGetq cv cellName)
                         (dbGetq cv viewName)
                         )
                   )
                 )
        bBox
        )
      ) 
    
     

     

    • 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