From 3b396d65f09ae8ec64ca5bdc44b0cf9523fe5852 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Thu, 15 Dec 2022 12:25:23 -0500 Subject: [PATCH] Reverted the toolkit change from the last commit after realizing that the feature for implementing callbacks on a selection list was already implemented via the add_dependency procedure. Modified the GDS read to remove cell instances that are placed directly on top of one another in the same cell. Modified the GDS read to make a better selection of a default font size for text that specifies a font but not a size, using the minimum width for the layer the text is placed on. Modified the GDS read to remove text with empty-string placeholders (created when a pin layer is read but no text exists to go along with it, due to GDS not having a specific way to make pins, such that pins have to be split between one record for geometry and another for text). --- VERSION | 2 +- calma/CalmaRdcl.c | 41 ++++++++++++++++++++++++++++++++++++----- calma/CalmaRdpt.c | 20 +++++++++++++++++--- commands/CmdCD.c | 18 +++++++++--------- tcltk/toolkit.tcl | 11 ++++------- 5 files changed, 67 insertions(+), 25 deletions(-) diff --git a/VERSION b/VERSION index 0ba50bd8..99db6869 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.353 +8.3.354 diff --git a/calma/CalmaRdcl.c b/calma/CalmaRdcl.c index 38814823..ab004e5a 100644 --- a/calma/CalmaRdcl.c +++ b/calma/CalmaRdcl.c @@ -364,6 +364,7 @@ calmaParseStructure(filename) bool predefined; bool do_flatten; CellDef *def; + Label *lab; locPolygonCount = CalmaPolygonCount; @@ -600,6 +601,11 @@ calmaParseStructure(filename) CIFPaintCurrent(FILE_CALMA); } + /* Check for empty string labels that are caused by pin geometry that + * did not get any corresponding text type, and remove them. + */ + DBEraseLabelsByContent(cifReadCellDef, NULL, -1, ""); + if ((!CalmaSubcellPolygons) && (locPolygonCount < CalmaPolygonCount)) DBCellEnum(cifReadCellDef, calmaFlattenPolygonFunc, (ClientData)cifReadCellDef); @@ -1094,7 +1100,14 @@ calmaElementSref(filename) if (isArray) DBMakeArray(use, &GeoIdentityTransform, xlo, ylo, xhi, yhi, xsep, ysep); DBSetTrans(use, &trans); - DBPlaceCell(use, cifReadCellDef); + if (DBCellFindDup(use, cifReadCellDef) != NULL) + { + DBCellDeleteUse(use); + CalmaReadError("Warning: cell \"%s\" placed on top of" + " itself. Ignoring the extra one.\n", def->cd_name); + } + else + DBPlaceCell(use, cifReadCellDef); break; // No need to do 2nd loop } @@ -1161,8 +1174,17 @@ calmaElementSref(filename) if (isArray) DBMakeArray(use, &GeoIdentityTransform, xlo, ylo, xhi, yhi, xsep, ysep); DBSetTrans(use, &trans); - DBPlaceCell(use, cifReadCellDef); - madeinst = TRUE; + if (DBCellFindDup(use, cifReadCellDef) != NULL) + { + DBCellDeleteUse(use); + CalmaReadError("Warning: cell \"%s\" placed on top of" + " itself. Ignoring the extra one.\n", def->cd_name); + } + else + { + DBPlaceCell(use, cifReadCellDef); + madeinst = TRUE; + } } else { @@ -1179,8 +1201,17 @@ calmaElementSref(filename) if (isArray) DBMakeArray(use, &GeoIdentityTransform, xlo, ylo, xhi, yhi, xsep, ysep); DBSetTrans(use, &trans); - DBPlaceCell(use, cifReadCellDef); - madeinst = TRUE; + if (DBCellFindDup(use, cifReadCellDef) != NULL) + { + DBCellDeleteUse(use); + CalmaReadError("Warning: cell \"%s\" placed on top of" + " itself. Ignoring the extra one.\n", def->cd_name); + } + else + { + DBPlaceCell(use, cifReadCellDef); + madeinst = TRUE; + } } } diff --git a/calma/CalmaRdpt.c b/calma/CalmaRdpt.c index 5fc9d83e..697eb165 100644 --- a/calma/CalmaRdpt.c +++ b/calma/CalmaRdpt.c @@ -709,7 +709,7 @@ calmaElementText() TileType type; Rect r; double dval; - int size, angle, font, pos; + int size, micron, angle, font, pos; /* Skip CALMA_ELFLAGS, CALMA_PLEX */ calmaSkipSet(calmaElementIgnore); @@ -732,9 +732,23 @@ calmaElementText() font = -1; angle = 0; - /* Default size is 1um */ - size = (int)((1000 * cifCurReadStyle->crs_multiplier) + /* Use the minimum width of the layer on which the text is placed + * as the default text size, or 1um, whichever is smaller. Account + * for the 8/10 difference encoded in the rendered font height. + */ + size = DRCGetDefaultLayerWidth(type); + if (size > 0) + { + size *= (calmaReadScale2 * cifCurReadStyle->crs_multiplier * 8); + size /= (calmaReadScale1 * cifCurReadStyle->crs_scaleFactor * 10); + } + + /* Default or maximum size is 1um */ + micron = (int)((800 * cifCurReadStyle->crs_multiplier) / cifCurReadStyle->crs_scaleFactor); + if ((size == 0) || (size > micron)) + size = micron; + /* Default position is bottom-right (but what the spec calls "top-left"!) */ pos = GEO_SOUTHEAST; diff --git a/commands/CmdCD.c b/commands/CmdCD.c index c71355f3..2681eff0 100644 --- a/commands/CmdCD.c +++ b/commands/CmdCD.c @@ -102,14 +102,14 @@ bool cmdDumpParseArgs(); #define CALMA_DRCCHECK 7 #define CALMA_FLATTEN 8 #define CALMA_FLATGLOB 9 -#define CALMA_ORDERING 10 -#define CALMA_LABELS 11 -#define CALMA_LIBRARY 12 -#define CALMA_LOWER 13 -#define CALMA_MASKHINTS 14 -#define CALMA_MERGE 15 -#define CALMA_NO_STAMP 16 -#define CALMA_NO_DUP 17 +#define CALMA_LABELS 10 +#define CALMA_LIBRARY 11 +#define CALMA_LOWER 12 +#define CALMA_MASKHINTS 13 +#define CALMA_MERGE 14 +#define CALMA_NO_STAMP 15 +#define CALMA_NO_DUP 16 +#define CALMA_ORDERING 17 #define CALMA_READ 18 #define CALMA_READONLY 19 #define CALMA_RESCALE 20 @@ -158,7 +158,6 @@ CmdCalma(w, cmd) "drccheck [yes|no] mark all cells as needing DRC checking", "flatten [yes|no|limit] flatten simple cells (e.g., contacts) on input", "flatglob [|none] flatten cells by name with glob patterning", - "ordering [on|off] cause cells to be read in post-order", "labels [yes|no] cause labels to be output when writing GDS-II", "library [yes|no] do not output the top level, only subcells", "lower [yes|no] allow both upper and lower case in labels", @@ -166,6 +165,7 @@ CmdCalma(w, cmd) "merge [yes|no] merge tiles into polygons in the output", "nodatestamp [yes|no] write a zero value creation date stamp", "noduplicates [yes|no] do not read cells that exist before reading GDS", + "ordering [on|off] cause cells to be read in post-order", "read file read Calma GDS-II format from \"file\"\n" " into edit cell", "readonly [yes|no] set cell as read-only and generate output from GDS file", diff --git a/tcltk/toolkit.tcl b/tcltk/toolkit.tcl index 5188e574..500ed89b 100644 --- a/tcltk/toolkit.tcl +++ b/tcltk/toolkit.tcl @@ -1162,13 +1162,11 @@ proc magic::add_message {pname ptext parameters {color blue}} { #---------------------------------------------------------- # Add a selectable-list parameter to the gencell window -# Added 12/14/2022: Optional argument "func" specifies a -# callback procedure to trigger when a menu item is -# selected. +# (NOTE: Use magic::add_dependency to add a callback to +# the selection list choice.) #---------------------------------------------------------- -proc magic::add_selectlist {pname ptext all_values parameters {itext ""} \ - {func {}}} { +proc magic::add_selectlist {pname ptext all_values parameters {itext ""}} { if [dict exists $parameters $pname] { set value [dict get $parameters $pname] @@ -1185,8 +1183,7 @@ proc magic::add_selectlist {pname ptext all_values parameters {itext ""} \ menu .params.edits.${pname}_sel.menu -tearoff 0 foreach item ${all_values} { set cmdtxt ".params.edits.${pname}_sel configure -text $item" - if {$func != {}} {set cmdtxt "$cmdtxt ; $func"} - .params.edits.${pname}_sel.menu add radio -label $item \ + .params.edits.${pname}_sel.menu add radio -label $item \ -variable magic::${pname}_val -value $item \ -command $cmdtxt }