• 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. How to get the lowerLeft & upperRight coordinate from 4000...

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 143
  • Views 1498
  • 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

How to get the lowerLeft & upperRight coordinate from 4000 or more shapes which layer is "ME1" ?

Charley Chen
Charley Chen over 8 years ago

Hi All,

I do not want to get CellView bBox as  Maximum bBox  , even it 's fast (for  many layers、object .... )

I want to get the lowerLeft/upperRight for all shapes(4000 or more) which lpp is "M1"  CellView bBox.

How to do it ?

 

Thank you,

Charley

 

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 8 years ago

    There's no simple built-in API to do this, but writing your own is easy enough. It wasn't clear whether you wanted just the shapes in this cellView, or the bBox of the shapes on that LPP in the entire hierarchy. So I have both here - one I just wrote in 5 minutes, and the other I wrote a while back:

    First, for just this cellView

    /* abGetCellViewLayerBBox.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       Jan 20, 2017 
    Modified   
    By         
    
    Simple function to find the bounding box of a layer purpose
    without traversing hierarchy.
    
    ***************************************************
    
    SCCS Info: @(#) abGetCellViewLayerBBox.il 01/20/17.11:17:29 1.1
    
    */
    
    /************************************************************************
    *                                                                       *
    * (abGetCellViewLayerBBox cvId layerName @optional (purpose "drawing")) *
    *                                                                       *
    *     Find the bounding box of the shapes on a particular layer and     *
    *       purpose in this cellView, i.e. not through the hierarchy.       *
    *                                                                       *
    ************************************************************************/
    
    (defun abGetCellViewLayerBBox (cvId layerName @optional (purpose "drawing"))
      (let (shapes)
        (setq shapes
              (dbGetq
                (car (exists lpp (dbGetq cvId lpps) 
                             (and (equal (getq lpp layerName) layerName)
                                  (equal (getq lpp purpose) purpose))))
                shapes))
        (when shapes
          (destructuringBind ((mllx mlly) (murx mury)) (dbGetq (car shapes) bBox)
            (foreach shape (cdr shapes)
                     (destructuringBind ((llx lly) (urx ury)) (dbGetq shape bBox)
                       (setq mllx (min mllx llx))
                       (setq mlly (min mlly lly))
                       (setq murx (max murx urx))
                       (setq mury (max mury ury))
                       ))
            (list (list mllx mlly) (list murx mury))
            )
          )
        )
      )
    

    Next for the hierarchy:

    /* 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
        )
      )
    

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Charley Chen
    Charley Chen over 8 years ago
    Hi Andrew,

    Yes, It works. You are great.

    Thank you,
    Charley
    • 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