>Does anyone have Skill code to convert a polygon into rectangles?
>(Is there already a built-in command for this?)
You didn't say what you needed your rectangles for and you didn't note
how complicated the polygons are....but this type of conversion is
called fracturing and is used to drive machines such as pattern
generators.
The old Dracula had such a routine "optical PG" however it costs about
$20-30K. I do believe that Cadence has dropped optical PG. You can
contact a company called Artwork Conversion Software
(http://www.artwork.com). They have a program called ASM 2600 that
reads GDSII and outputs either Electromask or Mann which consists of
a stream of rectangles. They can also take the Electromask back to
GDSII.
Regards,
Steve DiBartolomeo
IC and PCB Design Utilities
Santa Cruz, CA
To answer my own question, the code is attached below. The reason I'm
doing this is that Cell3 has a bug when it reads a LEF description of
an abstract. We have donut holes in our obstruction layers, and sometimes
Cell3 creates imaginary zero-width lines that are an extension of the hole's
cutline when it interprets our polygon statements in the LEF, causing the
router all sorts of grief. The problem supposedly goes away if the polygons
are replaced by rectangles in the LEF. So I'm looking for an automatic way
to modify our abstracts.
One solution is to put "tile" in the saveDerived() statements of our
abgenRules, but to keep from spending a few days rerunning abgen on
our 5000-cell library, I want a faster skill solution. The fracture()
routine below is part of the solution.
While testing this code, I discovered a separate bug with Cadence layoutPlus.
Using a line to cut a polygon doesn't always work, as in this case:
.
.
+-----------------+
| B |
| +------+
| | .
| | .
| +------+
| |
| |
| +----+
| . |
| . A |
+----------------------+
.
If you try to chop the shape with the dotted line, it doesn't do anything.
The solution for me is to chop with a rectangle that includes the line and
some bounding box edges instead.
atl
/*
Function Name: fracture (the opposite of Merge)
Category: layout
Author: Tony Laundrie, Cray Research
Date: January 17, 1997
Revision: 1.0
SW Release: 4.3.4
Synopsis: fracture(d_shapeID) => t/nil
Description: Convert a polygon into non-overlapping rectangles and
triangles. Recursive function.
Notes: The shapes returned are not guaranteed to be the
minimum number required. For another solution,
check out the "tile" option with the saveDerived()
command.
There's a bug in Cadence where chopping with a line
sometimes doesn't work. I use a rectangle instead.
*/
procedure(fracture(p)
let( (bb xll xur xy xx yll yur yy pieces pp pnts)
(if (p~>objType == "polygon") then ; only fracture polygons
(if (p~>nPoints > 3) then ; not a triangle
bb=p~>bBox
; printf("bBox=%L\n" bb)
xll=xCoord(lowerLeft(bb))
yll=yCoord(lowerLeft(bb))
xur=xCoord(upperRight(bb))
yur=yCoord(upperRight(bb))
pieces=nil
; first look for places to cut vertically
pnts=p~>points
(while pnts
xy=car(pnts)
; printf("xy=%L\n" xy)
pnts=cdr(pnts)
xx=xCoord(xy)
(if (xx > xll && xx < xur) then
; printf("vchop %L\n" list(xx:yll xx:yur) )
pieces=leChopShape(p
list(xx:yll xx:yur xll:yur xll:yll) t nil)
pnts=nil
)
)
(if (pieces==nil) then
; didn't find vertical cut, look for horizontal cut
pnts=p~>points
(while pnts
xy=car(pnts)
pnts=cdr(pnts)
yy=yCoord(xy)
(if (yy > yll && yy < yur) then
; printf("hchop %L\n" list(xll:yy xur:yy) )
pieces=leChopShape(p
list(xll:yy xur:yy xur:yll xll:yll) t nil)
pnts=nil
)
)
)
(foreach pp pieces
fracture(pp)
)
)
)
)
)
procedure( fractureAllPolygons(lib name view)
prog( (c l s)
c=dbOpenCellView(lib name view nil "an")
(foreach s c~>shapes
fracture(s)
)
dbSave(c)
dbClose(c)
)
)