From 838c9b840d17b3832ebc5fa60845a650fc0226f9 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Thu, 16 Jul 2020 08:55:46 -0400 Subject: [PATCH] Added a "calma library" command option, to generate a GDS library from the subcircuits of a top-level layout without also writing the top level. --- VERSION | 2 +- calma/CalmaWrite.c | 11 +++++++---- calma/calma.h | 1 + commands/CmdCD.c | 40 +++++++++++++++++++++++++++++++--------- 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/VERSION b/VERSION index 2c358a89..04e6cffe 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.33 +8.3.34 diff --git a/calma/CalmaWrite.c b/calma/CalmaWrite.c index 4ef116c3..b2815e0b 100644 --- a/calma/CalmaWrite.c +++ b/calma/CalmaWrite.c @@ -53,6 +53,7 @@ static char rcsid[] __attribute__ ((unused)) ="$Header: /usr/cvsroot/magic-8.0/c #include "utils/stack.h" /* Exports */ +bool CalmaDoLibrary = FALSE; /* If TRUE, do not output the top level */ bool CalmaDoLabels = TRUE; /* If FALSE, don't output labels with GDS-II */ bool CalmaDoLower = TRUE; /* If TRUE, allow lowercase labels. */ bool CalmaFlattenArrays = FALSE; /* If TRUE, output arrays as individual uses */ @@ -328,7 +329,7 @@ CalmaWrite(rootDef, f) * to insure that each child cell is output before it is used. The * root cell is output last. */ - (void) calmaProcessDef(rootDef, f); + (void) calmaProcessDef(rootDef, f, CalmaDoLibrary); /* Finish up by outputting the end-of-library marker */ calmaOutRH(4, CALMA_ENDLIB, CALMA_NODATA, f); @@ -741,13 +742,14 @@ calmaProcessUse(use, outf) CellUse *use; /* Process use->cu_def */ FILE *outf; /* Stream file */ { - return (calmaProcessDef(use->cu_def, outf)); + return (calmaProcessDef(use->cu_def, outf, FALSE)); } int -calmaProcessDef(def, outf) +calmaProcessDef(def, outf, do_library) CellDef *def; /* Output this def's children, then the def itself */ FILE *outf; /* Stream file */ + bool do_library; /* If TRUE, output only children of def, but not def */ { char *filename; bool isReadOnly, oldStyle, hasContent, isAbstract, hasGDSEnd; @@ -907,7 +909,8 @@ calmaProcessDef(def, outf) /* Output this cell definition from the Magic database */ if (!isReadOnly) - calmaOutFunc(def, outf, &TiPlaneRect); + if (!do_library) + calmaOutFunc(def, outf, &TiPlaneRect); return (0); } diff --git a/calma/calma.h b/calma/calma.h index f810e7a1..a7e7ebb7 100644 --- a/calma/calma.h +++ b/calma/calma.h @@ -28,6 +28,7 @@ extern bool CalmaSubcellPolygons; extern bool CalmaSubcellPaths; extern bool CalmaDoLabels; +extern bool CalmaDoLibrary; extern bool CalmaDoLower; extern bool CalmaMergeTiles; extern bool CalmaFlattenArrays; diff --git a/commands/CmdCD.c b/commands/CmdCD.c index aebc0b4e..3eb439d5 100644 --- a/commands/CmdCD.c +++ b/commands/CmdCD.c @@ -95,15 +95,16 @@ bool cmdDumpParseArgs(); #define CALMA_FLATTEN 4 #define CALMA_ORDERING 5 #define CALMA_LABELS 6 -#define CALMA_LOWER 7 -#define CALMA_MERGE 8 -#define CALMA_READ 9 -#define CALMA_READONLY 10 -#define CALMA_RESCALE 11 -#define CALMA_WARNING 12 -#define CALMA_WRITE 13 -#define CALMA_POLYS 14 -#define CALMA_PATHS 15 +#define CALMA_LIBRARY 7 +#define CALMA_LOWER 8 +#define CALMA_MERGE 9 +#define CALMA_READ 10 +#define CALMA_READONLY 11 +#define CALMA_RESCALE 12 +#define CALMA_WARNING 13 +#define CALMA_WRITE 14 +#define CALMA_POLYS 15 +#define CALMA_PATHS 16 #define CALMA_WARN_HELP CIF_WARN_END /* undefined by CIF module */ @@ -132,6 +133,7 @@ CmdCalma(w, cmd) "flatten [yes|no|limit] flatten simple cells (e.g., contacts) on input", "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", "merge [yes|no] merge tiles into polygons in the output", "read file read Calma GDS-II format from \"file\"\n" @@ -227,6 +229,26 @@ CmdCalma(w, cmd) CalmaDoLabels = (option < 3) ? FALSE : TRUE; return; + case CALMA_LIBRARY: + if (cmd->tx_argc == 2) + { +#ifdef MAGIC_WRAPPER + Tcl_SetObjResult(magicinterp, Tcl_NewBooleanObj(CalmaDoLibrary)); +#else + TxPrintf("The top-level cell will %sbe output to the GDS file.\n", + (CalmaDoLibrary) ? "not " : ""); +#endif + return; + } + else if (cmd->tx_argc != 3) + goto wrongNumArgs; + + option = Lookup(cmd->tx_argv[2], cmdCalmaYesNo); + if (option < 0) + goto wrongNumArgs; + CalmaDoLibrary = (option < 3) ? FALSE : TRUE; + return; + case CALMA_CONTACTS: if (cmd->tx_argc == 2) {