Added a "flatten -doproperty" command option that allows selective

flattening based on cells which have a property "flatten".  Also:
Modified the DEF read and write to convert DIEAREA into a
FIXED_BBOX property.  This solves issues with placing of components
from DEF, when those components may not have have come from place &
route and may not have P&R bounding boxes.  Also:  Fixed the
documentation for the "dump" command, which was missing the optional
orientation in the description.
This commit is contained in:
Tim Edwards 2022-10-15 11:33:59 -04:00
parent bc5093502c
commit eecdc3c642
8 changed files with 77 additions and 15 deletions

View File

@ -1 +1 @@
8.3.329
8.3.330

View File

@ -2004,7 +2004,10 @@ CmdFlatten(w, cmd)
toplabels = (invert) ? FALSE : TRUE;
break;
case 'p':
doports = (invert) ? FALSE : TRUE;
if (!strncmp(cmd->tx_argv[i] + 3, "prop", 4))
xMask = (invert) ? CU_DESCEND_ALL : CU_DESCEND_PROP_FLAT;
else
doports = (invert) ? FALSE : TRUE;
break;
case 's':
xMask = (invert) ? CU_DESCEND_NO_SUBCKT : CU_DESCEND_ALL;
@ -2014,7 +2017,7 @@ CmdFlatten(w, cmd)
break;
default:
TxError("options are: -nolabels, -nosubcircuits, -noports, "
"-novendor, -dotoplabels, -dobox\n");
"-novendor, -dotoplabels, -doproperty, -dobox\n");
break;
}
}

View File

@ -64,6 +64,8 @@ DBDescendSubcell(use, xMask)
CellUse *use;
unsigned int xMask;
{
bool propfound;
/* Check single bit (window ID) or zero */
if (((xMask - 1) & xMask) == 0)
return ((use->cu_expandMask & xMask) == xMask);
@ -91,6 +93,16 @@ DBDescendSubcell(use, xMask)
case CU_DESCEND_NO_VENDOR:
return (use->cu_def->cd_flags & CDVENDORGDS) ? FALSE : TRUE;
case CU_DESCEND_PROP_FLAT:
if (use->cu_expandMask == CU_DESCEND_SPECIAL)
return TRUE;
else
{
/* Descend only into cells marked with property "flatten" */
DBPropGet(use->cu_def, "flatten", &propfound);
return (propfound) ? TRUE : FALSE;
}
case CU_DESCEND_NONE:
return FALSE;
}

View File

@ -559,6 +559,7 @@ typedef struct celluse
#define CU_DESCEND_NO_VENDOR 0x0006 /* Descend no vendor-GDS subcells */
#define CU_DESCEND_NO_LOCK 0x0007 /* Descend unlocked subcells only */
#define CU_DESCEND_NONE 0x0009 /* Descend no subcells */
#define CU_DESCEND_PROP_FLAT 0x000a /* Descend by property string "flatten" */
/*
* Declare tile type structure for non-manhattan geometry

View File

@ -25,16 +25,20 @@ Copy contents of the indicated cell into the current edit cell.
<H3>Usage:</H3>
<BLOCKQUOTE>
<B>dump</B> <I>cell</I> [<B>child</B> <I>child_refpoint</I>]
<B>dump</B> <I>cell</I> [<I>orientation</I>]
[<B>child</B> <I>child_refpoint</I>]
[<B>parent</B> <I>parent_refpoint</I>]
<BR><BR>
<BLOCKQUOTE>
where <I>cell</I> is the name of the cell whose contents are to
be copied, and optional <I>child_refpoint</I> and
<I>parent_refpoint</I> are coordinate pairs of <I>x y</I> values,
or keywords <B>ll</B>, <B>lr</B>, <B>ul</B>, or <B>ur</B>. The
syntax and use of the reference points is the same as for the
<B>getcell</B> command.
or keywords <B>ll</B>, <B>lr</B>, <B>ul</B>, or <B>ur</B>.
The optional <I>orientation</I> may be any valid orientation
(flip or rotation), such as <B>h</B>, <B>v</B>, <B>90</B>,
<B>180</B>, or <B>270</B>.
The syntax and use of the orientation and reference points is the
same as for the <B>getcell</B> command.
</BLOCKQUOTE>
</BLOCKQUOTE>

View File

@ -30,8 +30,8 @@ Flatten edit cell into the indicated destination cell.
where <I>cellname</I> is the name of a cell definition to be
created, and into which the flattened geometry will be placed.
<I>option</I> may be one of <B>-nolabels</B>, <B>-nosubcircuits</B>,
or <B>-noports</B>, <B>-novendor</B>, <B>-dotoplabels</B>, and
<B>-dobox</B>.
or <B>-noports</B>, <B>-novendor</B>, <B>-dotoplabels</B>,
<B>-doproperty</B>, and <B>-dobox</B>.
</BLOCKQUOTE>
</BLOCKQUOTE>
@ -63,6 +63,11 @@ Flatten edit cell into the indicated destination cell.
<DD> This option tells magic to preserve in the flattened view
only the labels that are in the top level cell. Labels in
subcells will be ignored.
<DT> <B>-doproperty</B>
<DD> This option will only flatten subcells which are marked
with the property string "<B>flatten</B>". This is useful
for flattening an entire set of cells; for example, flattening
subcells with routing before creating a DEF file of a layout.
<DT> <B>-dobox</B>
<DD> When this option is specified, magic flattens only the area
of the circuit that is inside the boundary of the cursor box.

View File

@ -2354,8 +2354,10 @@ DefRead(inName, dolabels, annotate, noblockage)
FILE *f;
char *filename;
char *token;
char *bboxstr;
int keyword, dscale, total;
float oscale;
Rect *dierect;
static char *sections[] = {
"VERSION",
@ -2496,6 +2498,14 @@ DefRead(inName, dolabels, annotate, noblockage)
LefEndStatement(f);
break;
case DEF_DIEAREA:
dierect = LefReadRect(f, 0, oscale);
bboxstr = mallocMagic(40);
sprintf(bboxstr, "%d %d %d %d",
dierect->r_xbot,
dierect->r_ybot,
dierect->r_xtop,
dierect->r_ytop);
DBPropPut(rootDef, "FIXED_BBOX", bboxstr);
LefEndStatement(f);
break;
case DEF_PROPERTYDEFINITIONS:

View File

@ -102,6 +102,8 @@ defWriteHeader(def, f, oscale, units)
int units; /* Units for UNITS; could be derived from oscale */
{
TileType type;
char *propvalue;
bool propfound;
TxPrintf("Diagnostic: Write DEF header for cell %s\n", def->cd_name);
@ -130,12 +132,37 @@ defWriteHeader(def, f, oscale, units)
fprintf(f, " UNITS DISTANCE MICRONS %d ;\n", units);
/* Die area, taken from the cell def bounding box. */
fprintf(f, " DIEAREA ( %.10g %.10g ) ( %.10g %.10g ) ;\n",
(float)def->cd_bbox.r_xbot * oscale,
(float)def->cd_bbox.r_ybot * oscale,
(float)def->cd_bbox.r_xtop * oscale,
(float)def->cd_bbox.r_ytop * oscale);
/* For DIEAREA, use the FIXED_BBOX property if present. Otherwise, */
/* use the extents of geometry (CellDef bounding box) */
propvalue = (char *)DBPropGet(def, "FIXED_BBOX", &propfound);
if (propfound)
{
Rect bbox;
/* Die area, taken from the declared FIXED_BBOX. */
if (sscanf(propvalue, "%d %d %d %d", &bbox.r_xbot, &bbox.r_ybot,
&bbox.r_xtop, &bbox.r_ytop) == 4)
{
fprintf(f, " DIEAREA ( %.10g %.10g ) ( %.10g %.10g ) ;\n",
(float)bbox.r_xbot * oscale,
(float)bbox.r_ybot * oscale,
(float)bbox.r_xtop * oscale,
(float)bbox.r_ytop * oscale);
}
else
propfound = FALSE;
}
if (!propfound)
{
/* Die area, taken from the cell def bounding box. */
fprintf(f, " DIEAREA ( %.10g %.10g ) ( %.10g %.10g ) ;\n",
(float)def->cd_bbox.r_xbot * oscale,
(float)def->cd_bbox.r_ybot * oscale,
(float)def->cd_bbox.r_xtop * oscale,
(float)def->cd_bbox.r_ytop * oscale);
}
fprintf(f, "\n");
}