Refined the new "gds maskhints" command option for GDS input from

yesterday's commit to allow the syntax "gds maskhints <types>", in
which mask hints can be restricted to a specific list of layers
rather than all layers which define mask hints in the cifoutput
rule.
This commit is contained in:
Tim Edwards 2022-01-21 14:48:59 -05:00
parent 97441bc07a
commit 93c4503fa8
7 changed files with 41 additions and 17 deletions

View File

@ -50,7 +50,7 @@ int calmaNonManhattan;
int CalmaFlattenLimit = 10;
int NameConvertErrors = 0;
bool CalmaRewound = FALSE;
bool CalmaMaskHints = FALSE;
TileTypeBitMask *CalmaMaskHints = NULL;
extern HashTable calmaDefInitHash;

View File

@ -34,7 +34,7 @@ extern bool CalmaAddendum;
extern bool CalmaNoDuplicates;
extern time_t *CalmaDateStamp;
extern bool CalmaUnique;
extern bool CalmaMaskHints;
extern TileTypeBitMask *CalmaMaskHints;
extern bool CalmaMergeTiles;
extern bool CalmaFlattenArrays;
extern bool CalmaNoDRCCheck;

View File

@ -723,7 +723,7 @@ CIFPaintCurrent(filetype)
/* plane for that layer, compare to the input plane, and create */
/* mask hint properties to make the output the same as the input. */
if (CalmaMaskHints)
if ((CalmaMaskHints != NULL) && (!TTMaskIsZero(CalmaMaskHints)))
{
int j;
CIFOp *op, newop, subop;
@ -737,6 +737,8 @@ CIFPaintCurrent(filetype)
for (i = 0; i < cifNReadLayers; i++)
{
if (!TTMaskHasType(CalmaMaskHints, i)) continue;
/* Does the input layer have a corresponding output layer? */
in_out_map[i] = -1;
for (j = 0; j < CIFCurStyle->cs_nLayers; j++)
@ -787,6 +789,8 @@ CIFPaintCurrent(filetype)
char locstr[512];
Plane *tempp;
if (!TTMaskHasType(CalmaMaskHints, i)) continue;
j = in_out_map[i];
if (j < 0) continue;

View File

@ -248,9 +248,10 @@ CIFCalmaLayerToCifLayer(layer, datatype, calmaStyle)
*/
void
CIFParseReadLayers(string, mask)
CIFParseReadLayers(string, mask, newok)
char *string; /* Comma-separated list of CIF layers. */
TileTypeBitMask *mask; /* Where to store bit mask. */
bool newok; /* If TRUE, create new layers if they don't exist */
{
int i;
char *p;
@ -265,10 +266,10 @@ CIFParseReadLayers(string, mask)
if (p != NULL)
*p = 0;
i = CIFReadNameToType(string, TRUE);
i = CIFReadNameToType(string, newok);
if (i >= 0)
TTMaskSetType(mask, i);
else
else if (newok)
{
HashEntry *he;
TileTypeBitMask *amask;
@ -280,6 +281,8 @@ CIFParseReadLayers(string, mask)
TTMaskSetMask(mask, amask);
}
}
else
TxError("Error: CIF layer \"%s\" is unknown.\n", string);
if (p == NULL) break;
*p = ',';
@ -743,7 +746,7 @@ CIFReadTechLine(sectionName, argc, argv)
cifCurReadOp = (CIFOp *) mallocMagic(sizeof(CIFOp));
cifCurReadOp->co_opcode = CIFOP_OR;
cifCurReadOp->co_client = (ClientData)NULL;
CIFParseReadLayers(argv[2], &cifCurReadOp->co_cifMask);
CIFParseReadLayers(argv[2], &cifCurReadOp->co_cifMask, TRUE);
TTMaskZero(&cifCurReadOp->co_paintMask);
cifCurReadOp->co_next = NULL;
cifCurReadOp->co_distance = 0;
@ -793,7 +796,7 @@ CIFReadTechLine(sectionName, argc, argv)
cifCurReadOp = (CIFOp *) mallocMagic(sizeof(CIFOp));
cifCurReadOp->co_opcode = CIFOP_OR;
cifCurReadOp->co_client = (ClientData)NULL;
CIFParseReadLayers(argv[2], &cifCurReadOp->co_cifMask);
CIFParseReadLayers(argv[2], &cifCurReadOp->co_cifMask, TRUE);
TTMaskZero(&cifCurReadOp->co_paintMask);
cifCurReadOp->co_next = NULL;
cifCurReadOp->co_distance = 0;
@ -865,7 +868,7 @@ CIFReadTechLine(sectionName, argc, argv)
else
goto wrongNumArgs;
}
CIFParseReadLayers(argv[1], &mask);
CIFParseReadLayers(argv[1], &mask, TRUE);
for (i=0; i<MAXCIFRLAYERS; i+=1)
{
if (TTMaskHasType(&mask,i))
@ -891,7 +894,7 @@ CIFReadTechLine(sectionName, argc, argv)
int i;
if (argc != 2) goto wrongNumArgs;
CIFParseReadLayers(argv[1], &mask);
CIFParseReadLayers(argv[1], &mask, TRUE);
/* trash the value in crs_labelLayer so that any labels on this
layer get junked, also. dcs 4/11/90
*/
@ -968,7 +971,7 @@ CIFReadTechLine(sectionName, argc, argv)
case CIFOP_OR:
case CIFOP_COPYUP:
if (argc != 2) goto wrongNumArgs;
CIFParseReadLayers(argv[1], &newOp->co_cifMask);
CIFParseReadLayers(argv[1], &newOp->co_cifMask, TRUE);
break;
case CIFOP_GROW:
case CIFOP_GROW_G:

View File

@ -62,6 +62,7 @@ extern void CIFReadTechStyleInit();
extern void CIFReadTechInit();
extern bool CIFReadTechLine();
extern void CIFReadTechFinal();
extern void CIFParseReadLayers();
/* Externally-visible procedures: */

View File

@ -545,9 +545,12 @@ CmdCalma(w, cmd)
if (cmd->tx_argc == 2)
{
#ifdef MAGIC_WRAPPER
Tcl_SetObjResult(magicinterp, Tcl_NewBooleanObj(CalmaMaskHints));
if ((CalmaMaskHints != NULL) && !TTMaskIsZero(CalmaMaskHints))
Tcl_SetObjResult(magicinterp, Tcl_NewBooleanObj(TRUE));
else
Tcl_SetObjResult(magicinterp, Tcl_NewBooleanObj(FALSE));
#else
if (CalmaMaskHints)
if ((CalmaMaskHints != NULL) && !TTMaskIsZero(CalmaMaskHints))
TxPrintf("Mask hints generated from GDS input.\n");
else
TxPrintf("No mask hints generated from GDS input.\n");
@ -557,10 +560,21 @@ CmdCalma(w, cmd)
else if (cmd->tx_argc != 3)
goto wrongNumArgs;
if (CalmaMaskHints == NULL)
{
CalmaMaskHints = (TileTypeBitMask *)mallocMagic(sizeof(TileTypeBitMask));
TTMaskZero(CalmaMaskHints);
}
option = Lookup(cmd->tx_argv[2], cmdCalmaYesNo);
if (option < 0)
goto wrongNumArgs;
CalmaMaskHints = (option < 4) ? FALSE : TRUE;
CIFParseReadLayers(cmd->tx_argv[2], CalmaMaskHints, FALSE);
else
{
if (option < 4)
TTMaskZero(CalmaMaskHints);
else
TTMaskSetMask(CalmaMaskHints, &DBAllTypeBits);
}
return;
case CALMA_MERGE:

View File

@ -105,7 +105,7 @@ Read GDSII input or generate GDSII output.
Otherwise, the use of <B>yes</B> and <B>no</B> toggles the
flattening behavior without affecting any value previously
set by <B>flatten</B> <I>number</I>.
<DT> <B>maskhints</B> [<B>yes</B>|<B>no</B>]
<DT> <B>maskhints</B> [<B>yes</B>|<B>no</B>|<I>layers</I>]
<DD> When set to <B>yes</B>, then after reading each cell
definition from the GDS file, magic will re-generate the
GDS output data from its internal representation of the
@ -114,7 +114,9 @@ Read GDSII input or generate GDSII output.
the <B>cifoutput</B> section for a GDS layer, magic will
automatically generate the mask hint property for the cell
such that writing GDS of the cell will produce exactly the
same mask data as was in the original GDS file.
same mask data as was in the original GDS file. Alternatively
to specifying "<B>yes</B>", a comma-separated list <I>layers</I>
of GDS layers to create mask hints for can be specified
(default <B>no</B>).
<DT> <B>noduplicates</B> [<B>yes</B>|<B>no</B>]
<DD> When reading a GDS file, this option forces magic to ignore