From 9eb406ffbaee2e526f7bfaeadabd522a453906cf Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Sun, 9 Sep 2018 15:09:15 -0400 Subject: [PATCH] Implemented an idea from Staf Verhaegen to have "labels" options "port" and "noport" in the cifoutput section to distinguish between layer:purpose pairs for port text vs. other kinds of text. This allows a closer correspondence between GDS read and write. Note that the port writing is currently only in the GDS write routine, not in the CIF routine. --- calma/CalmaWrite.c | 9 ++++++--- cif/CIFint.h | 9 +++++++-- cif/CIFtech.c | 26 ++++++++++++++++++++++++-- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/calma/CalmaWrite.c b/calma/CalmaWrite.c index 06c73e72..2ef72893 100644 --- a/calma/CalmaWrite.c +++ b/calma/CalmaWrite.c @@ -892,7 +892,7 @@ 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) + if ((type >= 0) && (lab->lab_flags & PORT_DIR_MASK) == 0) { calmaWriteLabelFunc(lab, type, f); } @@ -906,8 +906,8 @@ calmaOutFunc(def, f, cliprect) 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) && + type = CIFCurStyle->cs_portLayer[lab->lab_type]; + if ((type >= 0) && ((lab->lab_flags & PORT_DIR_MASK) != 0) && ((lab->lab_flags & PORT_NUM_MASK) == i)) { calmaWriteLabelFunc(lab, type, f); @@ -2470,6 +2470,9 @@ calmaWriteLabelFunc(lab, type, f) /* and the label rectangle is not degenerate, then output the label */ /* rectangle as a boundary with the label's layer:purpose pair. */ + /* Note that the check for whether the CIF_LABEL_NOPORT flag has */ + /* been set is done outside of this routine. */ + 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)) diff --git a/cif/CIFint.h b/cif/CIFint.h index 1a60aebc..f7f82105 100644 --- a/cif/CIFint.h +++ b/cif/CIFint.h @@ -208,8 +208,8 @@ typedef struct * only be generated if the cell is a top-level cell. */ -#define CIF_TEMP 1 -#define CIF_BBOX_TOP 2 +#define CIF_TEMP 1 +#define CIF_BBOX_TOP 2 /* The following data structure describes a complete set of CIF * layers. The number of CIF layers (MAXCIFLAYERS) must not be @@ -271,6 +271,11 @@ typedef struct cifstyle * -1 means no known CIF layer for this Magic * layer. */ + int cs_portLayer[TT_MAXTYPES]; + /* Similar to cs_labelLayer, to distinguish + * between output types used for "normal" + * text and those used specifically for ports. + */ CIFLayer *cs_layers[MAXCIFLAYERS]; /* Describes how to generate each layer.*/ int cs_flags; /* bitmask of boolean-valued output options */ diff --git a/cif/CIFtech.c b/cif/CIFtech.c index ed5e834f..5048cd53 100644 --- a/cif/CIFtech.c +++ b/cif/CIFtech.c @@ -179,7 +179,10 @@ cifTechStyleInit() CIFCurStyle->cs_hierLayers = DBZeroTypeBits; CIFCurStyle->cs_flags = 0; for (i=0; ics_labelLayer[i] = -1; + CIFCurStyle->cs_portLayer[i] = -1; + } for (i = 0; i < MAXCIFLAYERS; i++) CIFCurStyle->cs_layers[i] = NULL; } @@ -859,6 +862,8 @@ CIFTechLine(sectionName, argc, argv) if (strcmp(argv[0], "labels") == 0) { + bool portOnly = FALSE, noPort = FALSE; + if (cifCurLayer == NULL) { TechError("Must define layer before giving labels it holds.\n"); @@ -866,12 +871,29 @@ CIFTechLine(sectionName, argc, argv) } if (cifCurLayer->cl_flags & CIF_TEMP) TechError("Why are you attaching labels to a temporary layer?\n"); - if (argc != 2) goto wrongNumArgs; + if (argc == 3) + { + if (!strncmp(argv[2], "port", 4)) + portOnly = TRUE; + else if (!strncmp(argv[2], "noport", 6)) + noPort = TRUE; + else + { + TechError("Unknown option %s for labels statement.\n", argv[2]); + goto wrongNumArgs; + } + } + else if (argc != 2) goto wrongNumArgs; DBTechNoisyNameMask(argv[1], &mask); for (i=0; ics_labelLayer[i] = CIFCurStyle->cs_nLayers-1; + { + if (noPort == FALSE) + CIFCurStyle->cs_labelLayer[i] = CIFCurStyle->cs_nLayers-1; + if (portOnly == TRUE) + CIFCurStyle->cs_portLayer[i] = CIFCurStyle->cs_nLayers-1; + } } cifGotLabels = TRUE; return TRUE;