• 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 bounding box of an instance excluding the...

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 144
  • Views 17269
  • 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 bounding box of an instance excluding the labels inside that instance?

ashley
ashley over 16 years ago
Hi,
I'm new in skill coding and maybe someone can help me with my problem. 
How can I compute the bounding box of an instance excluding the labels inside that instance (and also the labels on its sub-cells)?  BBox of labels are sometimes out-of-grid and I want to exclude them especially when they are located on the edges.  I can filter out the labels if they are within the current cell view, but I don't know how to do it if they are inside the instances.
Thank you very much.
regards,
ashley
  • Cancel
  • skillUser
    skillUser over 16 years ago

     Hi Ashley,

    There is a function, dbComputeBBoxNoNLP(), that will calculate a cellviews' bounding box excluding any NLP labels that it contains, or its sub-cells.  Here is an example of how it might be used:

     ;; get the seleted instance object id
     inst = car(geGetSelectedSet())
     ;; calculate the bounding box of the instances' master and
     ;; transform the bounding box (to the current cellview's
     ;; co-ordinate system) using the instance transform
     geTransformUserBBox(dbComputeBBoxNoNLP(inst~>master) geGetInstTransform(inst))

    Now, I don't know if you are working in a layout (I will guess "yes") or a schematic, but there will likely be labels that are not NLP labels if you are working in a layout, so the above may not help too much.  If this is the case, then it may be necessary to write something like the dbComputeBBoxNoNLP() function yourself, excluding labels from the calculated bounding box. Let us know - someone may have already written such code that they wouldn't mind sharing.

    I hope that the above is at least a good starting point, if not the actual answer that you are looking for.

    Regards,

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ashley
    ashley over 16 years ago

    Hi Lawrence,

     

    Yes, I'm working in a layout.  The dbComputeBBoxNoNLP() function still includes the labels, maybe because the labels in my layout are not NLP labels.  I think I need to write the code myself. 

     

    Can anyone give me an idea how to do it?  I have something in my mind but I'm not sure if it is the right way to do it.  I'm thinking of opening each of the instances' master and its sub-cells, select all objects excluding the labels and calculate the bbox of the group, and then close the opened cells once the bbox is determined.  I know it is not a good idea specially if an instance has sub-cells.  Is there a better way to do it?

     

    Thanks for your help.

     

    regards,

    ashley

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ahamlett
    ahamlett over 16 years ago

    This is untested but I'm sure you can use it:

     

     procedure( getBoundingBox(cell @optional (transform list((0:0) "R0" 1.0)))
        let( (left bottom right top inst via mosaic lpp shape temp)
            
            foreach(lpp cell->lpps
                foreach(shape lpp->shapes
                    if(shape->objType != "label" && shape->objType != "textDisplay" then
                        temp = geTransformUserBBox(shape->bBox transform)
                        left    = caar(temp)
                        bottom    = cadar(temp)
                        right    = caadr(temp)
                        top        = cadadr(temp)
                    )
                )
            )
            
            foreach(inst cell->instances ; loop through instances
                if(inst->objType == "inst" then
                    if(dbobjectp(inst->master) then
                        temp = getBoundingBox(inst->master dbConcatTransform(inst->transform transform))
                        if(!floatp(left) || caar(temp) < left then
                            left = caar(temp)
                        )
                        if(!floatp(bottom) || cadar(temp) < bottom then
                            bottom = cadar(temp)
                        )
                        if(!floatp(right) || caadr(temp) > right then
                            right = caadr(temp)
                        )
                        if(!floatp(top) || cadadr(temp) > top then
                            top = cadadr(temp)
                        )
                    else
                        getWarn() ; the cell couldn't be opened so get the warning before its printed
                    )
                )
            )
            
            foreach(via cell->vias ; loop through vias
                if(dbobjectp(via->viaHeader->master) then
                    temp = getBoundingBox(via->viaHeader->master dbConcatTransform(list(via->origin via->orient 1.0) transform))
                    if(!floatp(left) || caar(temp) < left then
                        left = caar(temp)
                    )
                    if(!floatp(bottom) || cadar(temp) < bottom then
                        bottom = cadar(temp)
                    )
                    if(!floatp(right) || caadr(temp) > right then
                        right = caadr(temp)
                    )
                    if(!floatp(top) || cadadr(temp) > top then
                        top = cadadr(temp)
                    )
                else
                    getWarn() ; the cell couldn't be opened so get the warning before its printed
                )
            )
            
            foreach(mosaic cell->mosaics ; loop through mosaics
                if(mosaic->mosaicType == "simple" then
                    let((orient xy isOA newTransform mosaicTransform)
                        isOA = (isCallable('dbGetDatabaseType) && dbGetDatabaseType() == "OpenAccess")
                        orient = car(mosaic->tileArray)
                        when(isOA
                            mosaicTransform = dbConcatTransform(dbConcatTransform(list(mapcar('minus mosaic->xy) "R0" 1.0) list(list(0 0) orient 1.0)) list(mosaic->xy "R0" 1.0))
                        )
                        for(row 0 sub1(mosaic->rows)
                            for(col 0 sub1(mosaic->columns)
                                xy = list((xCoord(mosaic->xy) + (col * mosaic->uX)) (yCoord(mosaic->xy) + (row * mosaic->uY)))
                                newTransform = if(isOA dbConcatTransform(dbConcatTransform(list(xy "R0" 1.0) mosaicTransform) transform) dbConcatTransform(list(xy orient 1.0) transform))
                                if(dbobjectp(car(mosaic->instanceList)->master) then
                                    temp = getBoundingBox(car(mosaic->instanceList)->master newTransform)
                                    if(!floatp(left) || caar(temp) < left then
                                        left = caar(temp)
                                    )
                                    if(!floatp(bottom) || cadar(temp) < bottom then
                                        bottom = cadar(temp)
                                    )
                                    if(!floatp(right) || caadr(temp) > right then
                                        right = caadr(temp)
                                    )
                                    if(!floatp(top) || cadadr(temp) > top then
                                        top = cadadr(temp)
                                    )
                                else
                                    getWarn()
                                )
                            )
                        )
                    )
                )
            )
            
            list(left:bottom right:top)
        )
    )

    inst = car(geGetSelectedSet())
    println(getBoundingBox(inst))

     

    • 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