From b964f9d33ab15c13be185c9aa67c34f562937042 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Mon, 27 Aug 2018 12:23:10 -0400 Subject: [PATCH] Corrected a number of errors in the last two commits, as well as additional functionality for ports in GDS format. This has been tested with a techfile encoding pin types on a different purpose than the metal layer drawing purpose. The label rectangle is correctly written to the GDS output as geometry on the pin purpose layer, and the same layer gets read back in from the GDS file and translated back into the label rectangle. Port order is maintained. --- calma/CalmaRdpt.c | 2 +- calma/CalmaWrite.c | 60 +++++++++++++++++++++++++++++++++++++++------- 2 files changed, 53 insertions(+), 9 deletions(-) diff --git a/calma/CalmaRdpt.c b/calma/CalmaRdpt.c index 8c679ce6..04cde28b 100644 --- a/calma/CalmaRdpt.c +++ b/calma/CalmaRdpt.c @@ -298,7 +298,7 @@ calmaElementBoundary() 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)) + if ((GEO_SURROUND(&rp->r_r, &lab->lab_rect)) && (lab->lab_type == type)) { lab->lab_rect = rp->r_r; /* Replace with larger rectangle */ break; diff --git a/calma/CalmaWrite.c b/calma/CalmaWrite.c index 29ad020c..06c73e72 100644 --- a/calma/CalmaWrite.c +++ b/calma/CalmaWrite.c @@ -891,25 +891,29 @@ calmaOutFunc(def, f, cliprect) for (lab = def->cd_labels; lab; lab = lab->lab_next) { + type = CIFCurStyle->cs_labelLayer[lab->lab_type]; if ((lab->lab_flags & PORT_DIR_MASK) == 0) - calmaWriteLabelFunc(lab, - CIFCurStyle->cs_labelLayer[lab->lab_type], f); + { + calmaWriteLabelFunc(lab, type, f); + } else { - if ((lab->lab_flags & PORT_NUM_MASK) > maxport) - maxport = lab->lab_flags & PORT_NUM_MASK; + if ((int)(lab->lab_flags & PORT_NUM_MASK) > maxport) + maxport = (int)(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) + { + type = CIFCurStyle->cs_labelLayer[lab->lab_type]; if (((lab->lab_flags & PORT_DIR_MASK) != 0) && ((lab->lab_flags & PORT_NUM_MASK) == i)) { - calmaWriteLabelFunc(lab, - CIFCurStyle->cs_labelLayer[lab->lab_type], f); + calmaWriteLabelFunc(lab, type, f); break; } + } } /* End of structure */ @@ -2370,7 +2374,7 @@ calmaWriteLabelFunc(lab, type, f) FILE *f; /* Stream file */ { Point p; - int calmanum; + int calmanum, calmatype; if (type < 0) return; @@ -2384,8 +2388,9 @@ calmaWriteLabelFunc(lab, type, f) calmaOutRH(6, CALMA_LAYER, CALMA_I2, f); calmaOutI2(calmanum, f); + calmatype = CIFCurStyle->cs_layers[type]->cl_calmatype; calmaOutRH(6, CALMA_TEXTTYPE, CALMA_I2, f); - calmaOutI2(CIFCurStyle->cs_layers[type]->cl_calmatype, f); + calmaOutI2(calmatype, f); if (lab->lab_font >= 0) { @@ -2460,6 +2465,45 @@ calmaWriteLabelFunc(lab, type, f) /* End of element */ calmaOutRH(4, CALMA_ENDEL, CALMA_NODATA, f); + + /* If the cifoutput layer is for labels only (has no operators), */ + /* and the label rectangle is not degenerate, then output the label */ + /* rectangle as a boundary with the label's layer:purpose pair. */ + + if ((CIFCurStyle->cs_layers[type]->cl_ops == NULL) && + (lab->lab_rect.r_xtop > lab->lab_rect.r_xbot) && + (lab->lab_rect.r_ytop > lab->lab_rect.r_ybot)) + { + Rect r; + + r = lab->lab_rect; + r.r_xbot *= calmaWriteScale; + r.r_ybot *= calmaWriteScale; + r.r_xtop *= calmaWriteScale; + r.r_ytop *= calmaWriteScale; + + /* Boundary */ + calmaOutRH(4, CALMA_BOUNDARY, CALMA_NODATA, f); + + /* Layer */ + calmaOutRH(6, CALMA_LAYER, CALMA_I2, f); + calmaOutI2(calmanum, f); + + /* Data type */ + calmaOutRH(6, CALMA_DATATYPE, CALMA_I2, f); + calmaOutI2(calmatype, f); + + /* Coordinates */ + calmaOutRH(44, CALMA_XY, CALMA_I4, f); + calmaOutI4(r.r_xbot, f); calmaOutI4(r.r_ybot, f); + calmaOutI4(r.r_xtop, f); calmaOutI4(r.r_ybot, f); + calmaOutI4(r.r_xtop, f); calmaOutI4(r.r_ytop, f); + calmaOutI4(r.r_xbot, f); calmaOutI4(r.r_ytop, f); + calmaOutI4(r.r_xbot, f); calmaOutI4(r.r_ybot, f); + + /* End of element */ + calmaOutRH(4, CALMA_ENDEL, CALMA_NODATA, f); + } } /*