• 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. Merge BBOX in hierarchical layout

Stats

  • Locked Locked
  • Replies 11
  • Subscribers 143
  • Views 20046
  • 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

Merge BBOX in hierarchical layout

mpshetty
mpshetty over 5 years ago

Hi Team,

Problem Statement:In hierarchical layout, I want to get BBOX of particular layer without actually flattening the layout.

Description:The layer can be at any hierarchical depth i.e both from PCELL or shapes but at top level if they are overlapping then I want the merged BBOX.

Now, I am able to get BBOX of all the shapes present at different hierarchy.But i finding issue in merging BBOX.

Please can help me on the same issue as I require efficient way to merge the BBOX because list containing the BBOX is huge.

Thanks in advance.

Regrads,

Prasanna

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

    Hi Prasanna,

    FIrst of all, asking this in the feedback, suggestions and questions forum was not a wise move, since that's not for technical subjects - so I moved this into the Custom IC SKILL forum (luckily I monitor the feedback forum because nearly everything there is misposted).

    Before I suggest an answer, which version of the tools are you using? (Help->About will tell you).

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mpshetty
    mpshetty over 5 years ago in reply to Andrew Beckett

    Hi Andrew,

    Sorry for posting in feedback section as I was not aware of Custom IC SKILL forum.Thanks for moving it to correct section.

    Cadence version i am using is  ICADV12.3-64b.500.21.

    Prasanna

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to mpshetty

    Hi Prasanna,

    Try this code:

    /* abGetHierLayerBBox.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       May 02, 2020 
    Modified   
    By         
    
    Computes the bounding box of a layer across a design hierarchy
    without needing to flatten anything. Uses the abe (Advanced Boolean
    Engine) functions to simplify the code, although this does have
    a limitation that it can only deal with 90- and 45-degree shapes.
    
    ***************************************************
    
    SCCS Info: @(#) abGetHierLayerBBox.il 05/02/20.09:32:39 1.1
    
    */
    
    /****************************************************************
    *                                                               *
    *               abGetHierLayerBBox(cv layerName)                *
    *                                                               *
    *    Computes the overall bounding box of a given layer name    *
    * in a cellView across the hierarchy. Is limited to shapes with *
    * 45 or 90 degree angles (so other angle shapes get excluded as *
    *         they are not handled by the "abe" functions.          *
    *                                                               *
    ****************************************************************/
    
    procedure(abGetHierLayerBBox(cv layerName)
        let((layer iter tile ollx olly ourx oury)
            abeInit(cv)
            layer=abeLayerFromCellView(layerName)
            iter=abeTileIterator(layer)
            while(tile=iter->next
                destructuringBind(((llx lly) (urx ury)) tile->bbox
                    ollx=if(ollx min(ollx llx) llx)
                    olly=if(olly min(olly lly) lly)
                    ourx=if(ourx max(ourx urx) urx)
                    oury=if(oury max(oury ury) ury)
                )
            )
            abeDone()
            when(ollx
                list(ollx:olly ourx:oury)
            )
        )
    )
    

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to mpshetty

    Hi Prasanna,

    Try this code:

    /* abGetHierLayerBBox.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       May 02, 2020 
    Modified   
    By         
    
    Computes the bounding box of a layer across a design hierarchy
    without needing to flatten anything. Uses the abe (Advanced Boolean
    Engine) functions to simplify the code, although this does have
    a limitation that it can only deal with 90- and 45-degree shapes.
    
    ***************************************************
    
    SCCS Info: @(#) abGetHierLayerBBox.il 05/02/20.09:32:39 1.1
    
    */
    
    /****************************************************************
    *                                                               *
    *               abGetHierLayerBBox(cv layerName)                *
    *                                                               *
    *    Computes the overall bounding box of a given layer name    *
    * in a cellView across the hierarchy. Is limited to shapes with *
    * 45 or 90 degree angles (so other angle shapes get excluded as *
    *         they are not handled by the "abe" functions.          *
    *                                                               *
    ****************************************************************/
    
    procedure(abGetHierLayerBBox(cv layerName)
        let((layer iter tile ollx olly ourx oury)
            abeInit(cv)
            layer=abeLayerFromCellView(layerName)
            iter=abeTileIterator(layer)
            while(tile=iter->next
                destructuringBind(((llx lly) (urx ury)) tile->bbox
                    ollx=if(ollx min(ollx llx) llx)
                    olly=if(olly min(olly lly) lly)
                    ourx=if(ourx max(ourx urx) urx)
                    oury=if(oury max(oury ury) ury)
                )
            )
            abeDone()
            when(ollx
                list(ollx:olly ourx:oury)
            )
        )
    )
    

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • mpshetty
    mpshetty over 5 years ago in reply to Andrew Beckett

    Hi Andrew,

     

    Thanks for the above code.

    But what i am looking at is to get Merged BBOX only if the shapes overlap.Here even if the shapes are far apart i.e not overlapping also the script is finding the extreme edges of the multiple shapes it encounters and giving the outermost BBOX.

    Requirement:If shapes doesn't overlap then I want their separate BBOX and if they overlap (can be 2 or more shapes overlapping which can be in any hierarchy) then i want their merged BBOX (same as merged shape does) and club all these BBOX as a list.

    Thanks in advance.

    -Prasanna

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to mpshetty

    Hi Prasanna,

    That shows the importance of asking a clear question in the first place. I rather wish you'd clearly stated that - I can't guarantee that I'll find you the time to produce an alternative which does what  you want.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to Andrew Beckett

    Prasanna,

    I was feeling generous as it was raining outside. The second function below should do what you want.

    /* abGetHierLayerBBox.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       May 02, 2020 
    Modified   May 03, 2020 
    By         A.D.Beckett
    
    Computes the bounding box of a layer across a design hierarchy
    without needing to flatten anything. Uses the abe (Advanced Boolean
    Engine) functions to simplify the code, although this does have
    a limitation that it can only deal with 90- and 45-degree shapes.
    
    Second function added to return a list of bBoxes, one for each
    merged region of the layer.
    
    ***************************************************
    
    SCCS Info: @(#) abGetHierLayerBBox.il 05/03/20.14:44:11 1.2
    
    */
    
    /****************************************************************
    *                                                               *
    *               abGetHierLayerBBox(cv layerName)                *
    *                                                               *
    *    Computes the overall bounding box of a given layer name    *
    * in a cellView across the hierarchy. Is limited to shapes with *
    * 45 or 90 degree angles (so other angle shapes get excluded as *
    *         they are not handled by the "abe" functions.          *
    *                                                               *
    ****************************************************************/
    
    procedure(abGetHierLayerBBox(cv layerName)
        let((layer iter tile ollx olly ourx oury)
            abeInit(cv)
            layer=abeLayerFromCellView(layerName)
            iter=abeTileIterator(layer)
            while(tile=iter->next
                destructuringBind(((llx lly) (urx ury)) tile->bbox
                    ollx=if(ollx min(ollx llx) llx)
                    olly=if(olly min(olly lly) lly)
                    ourx=if(ourx max(ourx urx) urx)
                    oury=if(oury max(oury ury) ury)
                )
            )
            abeDone()
            when(ollx
                list(ollx:olly ourx:oury)
            )
        )
    )
    
    /***************************************************************
    *                                                              *
    *           abGetHierMergedLayerBBoxes(cv layerName)           *
    *                                                              *
    *    Merging the specific layer name through the hierarchy,    *
    *    return a list of bounding boxes of each merged region.    *
    *     Has similar limitation to function above, in that it     *
    *       only copes with shapes with 45 degree multiples.       *
    *                                                              *
    ***************************************************************/
    
    procedure(abGetHierMergedLayerBBoxes(cv layerName)
        let((layer merged iter island bBoxes)
            abeInit(cv)
            layer=abeLayerFromCellView(layerName)
            merged=abeNewLayer()
            abeLayerOr(layer merged)
            iter=abeIslandIterator(merged)
            while(island=iter->next
                let((ollx olly ourx oury)
                    foreach(pt island
                        destructuringBind((x y) pt
                            ollx=if(ollx min(ollx x) x)
                            olly=if(olly min(olly y) y)
                            ourx=if(ourx max(ourx x) x)
                            oury=if(oury max(oury y) y)
                        )
                    )
                    when(ollx
                        bBoxes=cons(list(ollx:olly ourx:oury) bBoxes)
                    )
                )
            )
            abeDone()
            bBoxes
        )
    )
    

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • mpshetty
    mpshetty over 5 years ago in reply to Andrew Beckett

    Hi Andrew,

    Thanks for the script which works perfectly fine for rectangle shape it encountersSlight smile.

    From the comments you mentioned, it should work for polygon with 90 or 45 degree notch right?

    But I am facing issue of not getting proper BBOX values for those cases.It would be good if the script takes care of at least polygon with 90 degree notch.

    Thanks in advance.

    -Prasanna

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to mpshetty

    Hi Prasanna,

    Yes, this should work fine with 45 and 90 degree multiples including notches. See this example here where I have two instances of a lower cell with shapes in, and some overlapping shapes at the level above. As you can see the yellow highlights are correctly showing the bounding box of the merged shapes using this code:

    cv=geGetEditCellView()
    bboxes=abGetHierMergedLayerBBoxes(cv "Metal2")
    hs=geCreateHilightSet(cv list("y0" "drawing"))
    foreach(bbox bboxes geAddHilightRectangle(hs bbox))
    hs~>enable=t

    If it's not working for a particular shape, please post a picture here. If you can provide the coordinates of the shape, that would be even better (select it and use car(geGetSelSet())~>points assuming it's a polygon at the current level of hierarchy).

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mpshetty
    mpshetty over 5 years ago in reply to Andrew Beckett

    Hi Andrew,

    Sorry my understanding was wrong about the comment.

    Ya it works perfectly fine for all cases.Thanks a lot Andrew.

    Prior to this I had used transform function to get the BBOX of individual shapes and used if/while function to merge the shapes whenever it overlapped.This toke long time to compute merged BBOX for large layouts.

    Thanks for the quick and effective solution. Just out of curiosity, how is ABE so fast.

    -Prasanna

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to mpshetty

    ABE is fast because it's an optimised engine for performing boolean layer operations on large volumes of data, similar to how physical verification tools perform fast boolean operations.

    Probably the slowest piece here is collecting the bounding boxes of each island, because that's not something that the ABE results give directly - you need to iterate over all the points in each island to find the overall bBox. I didn't try to optimise the code too much - it may be possible to make it faster, but it was quick enough for the data I tried it on which had a pretty large number of islands to process.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mpshetty
    mpshetty over 5 years ago in reply to Andrew Beckett

    Thanks for the information.

    Previously I was not aware of ABE function.Its really helpful :) .

    -Prasanna

    • 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