Attempt at finishing the support of standard practices to define

geometry attached to a label in GDS using specific layer:purpose
pairs.  The additional code maintains the order of ports when
writing out text to GDS, and attempts to attach geometry to labels
when the geometry is defined on the same layer:purpose pair as
the text, and the cifinput style declares the purpose to be a
port label.
This commit is contained in:
Tim Edwards 2018-08-27 10:57:51 -04:00
parent 9dcaddc67c
commit 925136c652
2 changed files with 59 additions and 5 deletions

View File

@ -57,6 +57,8 @@ extern HashTable calmaDefInitHash;
extern void calmaLayerError();
bool calmaReadPath();
typedef enum { LABEL_TYPE_NONE, LABEL_TYPE_TEXT, LABEL_TYPE_PORT } labelType;
/*
* ----------------------------------------------------------------------------
*
@ -276,6 +278,35 @@ calmaElementBoundary()
rp = CIFPolyToRects(pathheadp, plane, CIFPaintTable, (PaintUndoInfo *)NULL);
CIFFreePath(pathheadp);
/* If the input layer is designated for ports by a "label" */
/* statement in the cifinput section, then find any label */
/* bounded by the path and attach the path to it. Note */
/* that this assumes two things: (1) that labels can only */
/* be attached to simple rectangles, and (2) that the */
/* rectangle appears in the GDS stream after the label. If */
/* either assumption is violated, this method needs to be */
/* re-coded. */
if (rp != NULL)
{
if ((ciftype >= 0) &&
((cifCurReadStyle->crs_labelSticky[ciftype] == LABEL_TYPE_PORT)))
{
Label *lab;
TileType type;
type = cifCurReadStyle->crs_labelLayer[ciftype];
for (lab = cifReadCellDef->cd_labels; lab; lab = lab->lab_next)
{
if ((GEO_SURROUND(&lab->lab_rect, &rp->r_r)) && (lab->lab_type == type))
{
lab->lab_rect = rp->r_r; /* Replace with larger rectangle */
break;
}
}
}
}
/* Paint the rectangles (if any) */
for (; rp != NULL ; rp = rp->r_next)
{
@ -631,8 +662,6 @@ calmaElementPath()
}
}
typedef enum { LABEL_TYPE_NONE, LABEL_TYPE_TEXT, LABEL_TYPE_PORT } labelType;
/*
* ----------------------------------------------------------------------------
*
@ -871,7 +900,7 @@ calmaElementText()
&GeoOrigin, pos, textbody, type, flags);
if ((lab != NULL) && (cifnum >= 0) &&
((cifCurReadStyle->crs_labelSticky[cifnum] == LABEL_TYPE_PORT)))
(cifCurReadStyle->crs_labelSticky[cifnum] == LABEL_TYPE_PORT))
{
Label *sl;
int idx;

View File

@ -881,11 +881,36 @@ calmaOutFunc(def, f, cliprect)
(ClientData) &cos);
}
/* Output labels */
/* Output labels. Do this in two passes, first for non-port labels */
/* while finding the highest-numbered port. Then output the port */
/* labels (if any) in the order of the port index. */
if (CalmaDoLabels)
{
int i, maxport = -1;
for (lab = def->cd_labels; lab; lab = lab->lab_next)
calmaWriteLabelFunc(lab,
{
if ((lab->lab_flags & PORT_DIR_MASK) == 0)
calmaWriteLabelFunc(lab,
CIFCurStyle->cs_labelLayer[lab->lab_type], f);
else
{
if ((lab->lab_flags & PORT_NUM_MASK) > maxport)
maxport = lab->lab_flags & PORT_NUM_MASK;
}
}
if (maxport >= 0)
for (i = 0; i <= maxport; i++)
for (lab = def->cd_labels; lab; lab = lab->lab_next)
if (((lab->lab_flags & PORT_DIR_MASK) != 0) &&
((lab->lab_flags & PORT_NUM_MASK) == i))
{
calmaWriteLabelFunc(lab,
CIFCurStyle->cs_labelLayer[lab->lab_type], f);
break;
}
}
/* End of structure */
calmaOutRH(4, CALMA_ENDSTR, CALMA_NODATA, f);