• 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. Blogs
  2. Digital Design
  3. Guest User Blog: dbShape For All Your Logical Operation…
BobD
BobD

Community Member

Blog Activity
Options
  • Subscribe by email
  • More
  • Cancel
CDNS - RequestDemo

Have a question? Need more information?

Contact Us
EDI
Avago
encounter
EDI 10.1
dbShape
db access
Digital Implementation
Gentry
logical operations
tcl

Guest User Blog: dbShape For All Your Logical Operation Needs

16 Feb 2011 • 4 minute read

This is a guest post from Jason Gentry at Avago. I hope you enjoy this useful piece he's contributed on using the Encounter Digital Implementation System's dbShape command that debuted in 10.1.

I figured it was time for another guest blog, especially since I've been able to play with one of the new-to-EDI10.1 commands called "dbShape."  During CDNLive! 2008, one of the topics I talked about was my need for logical operations or LogOps for short.  Think basic OR, AND, ANDNOT, etc. operations on physical geometries.  I had Tcl-implemented versions of these that worked well (N-log(N)) but their performance was really poor when dealing with a large number of shapes (N).  Well, apparently Cadence was listening and decided to bolt-on a shapes engine.  EDI10.1 introduces the 'dbShape' command and it is a thing of beauty.  The usage is as follows:

Usage: dbShape [-help] [-d] [-step <step>] [-output <polygon|rect>]
             <shapeList> [AND <shapeList> | ANDNOT <shapeList> | OR <shapeList> | XOR <shapeList>
             | SIZE <value>| BBOX | MOVE {<dx> <dy>}] ...

-help            # Prints out the command usage
-d               # User specified values and return values are in database units.
                 # Default: All values are in user units, in microns. (bool, optional)
-step <step>     # Specifies step size if output format is rect, required to convert
                 # non-orthogonal shapes into series of rectangles. Default: minwidth
                 # value of first routing layer (coord, optional).
-output <polygon|rect>
                 # Specifies the output format. default: rect (string, optional)
<shapeList>      # polygon or rect or list of polygon and rect. polygon:
                 # {{x y} {x y} {x y} ... }; rect: {x1 y1 x2 y2} (list, required)
AND <shapeList>  # binary operator: intersection of shapeLists
ANDNOT <shapeList> # binary operator: initial shapeList minus <shapeList>
OR <shapelist>   # binary operator: union of shapelists
XOR <shapeList>  # binary operator: OR minus AND of shapeList
                 # (string, optional)
SIZE <value>     # unary operator: increase the size of shapeList by <value>
MOVE {<dx> <dy>} # unary operator: move the shapeList by {<dx> <dy>}
BBOX             # unary operator: computes the bounding box of shapeList
                 # (string, optional)


I've since replaced all of my low-level LogOp procedures with calls to dbShape.  I've seen some performance improvement but it wasn't until I re-architected some of my biggest programs that I saw a major impact.  One such script, a custom power grid insertion script, went from running in 8-9 hours to running in 1/2 an hour.  It ran so fast I had to double check that my power grid actually got inserted.  Below are some examples of each of the available operations (note that I use the '-output rect' option for all of these to simplify the illustrations but it is not necessary).

set shapes1 [list [list 100 100 1100 1100]]

 set shapes2 [list [list 300 300 500 500] [list 700 700 900 900]]

 

set shapes3 [list [list 500 700 1200 900]]

 

LogOp OR:
dbShape -d -output rect $shapes1 OR $shapes3


LogOp: AND
dbShape -d -output rect $shapes1 AND $shapes2



LopOp: ANDNOT
dbShape -d -output rect $shapes1 ANDNOT $shapes2



LogOp: SIZE
dbShape -d -output rect $shapes2 SIZE 100



There are some limitations that you should know about before you write your own scripts:

  - There is only a 'SIZE' logop, no 'SIZEX' or 'SIZEY' for sizing only one dimension.  This has caused me some headaches but I've gotten around it for the most part for now, albeit inefficiently.

  - The is no 'INTERSECTS' LogOp; a LogOp that returns all shapes that intersect the specified shapeList.  Think 'AND' without modifying the original shapeList.  This would be really nice for finding floating power wires (wires with no vias connecting to it).

  - If you choose to work with rectangles (-output rect), all of the rectangles are returned in maximally-vertical form.  In other words, the resulting rectangles will be cut such that they are as tall as possible.  You might ask, "Why do I care?"  The only time that I've needed to care whether I have maximally-horizontal versus maximally-vertical rectangles dealt with trying to compute spacing requirements.  The "run-length" of a given shape may change depending on whether or not it appears very long or very short.  I've included images below showing the above ANDNOT example with maximally-horizontal and maximally-vertical configurations.

Maximally-Vertical Rectangles:

 

Maximally-Horizontal Rectangles:

 

  - You can daisy-chain the operations.  This is best shown through example:

dbShape -d -output rect $shapes1 OR $shapes3 ANDNOT $shapes2

 

-Jason Gentry

Related Post: Using dbTransform to Translate Geometric Coordinates in Encounter


CDNS - RequestDemo

Try Cadence Software for your next design!

Free Trials

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information