Finally got around to undoing an annoyance caused by the wholesale

reduction of memory and startup time, which was to maintain only
one CIF style in memory.  The new method is just to read in and
keep the DRC CIF style separately from the output CIF style.
Because the CIF sections of the techfile are read before the DRC
sections, and the CIF DRC style is declared in the DRC section,
the CIF DRC style is read in on the fly during the first DRC
checking.
This commit is contained in:
Tim Edwards 2019-10-15 16:24:49 -04:00
parent e969097f84
commit 3d7a56ac3a
4 changed files with 106 additions and 15 deletions

View File

@ -842,6 +842,35 @@ endbloat:
return 0;
}
/*
*-------------------------------------------------------
*
* cifFoundFun --
*
* Find the first tile in the given area.
*
* Results:
* Return 1 to stop the search and process.
* Set clientData to the tile found.
*
*-------------------------------------------------------
*/
int
cifFoundFunc(tile, treturn)
Tile *tile;
Tile **treturn;
{
*treturn = tile;
return 1;
}
/* Data structure for bloat-all function */
typedef struct _bloatStruct {
CIFOp *op;
CellDef *def;
} BloatStruct;
/*
* ----------------------------------------------------------------------------
*
@ -873,18 +902,26 @@ endbloat:
}
int
cifBloatAllFunc(tile, op)
cifBloatAllFunc(tile, bls)
Tile *tile; /* The tile to be processed. */
CIFOp *op; /* Describes the operation to be performed */
BloatStruct *bls;
{
Rect area;
TileTypeBitMask connect;
Tile *t, *tp;
TileType type;
BloatData *bloats = (BloatData *)op->co_client;
BloatData *bloats;
int i;
PlaneMask pmask;
int pNum;
CIFOp *op;
CellDef *def;
static Stack *BloatStack = (Stack *)NULL;
op = bls->op;
def = bls->def;
bloats = (BloatData *)op->co_client;
/* Create a mask of all connecting types (these must be in a single
* plane), then call a search function to find all connecting material
* of these types.
@ -900,7 +937,24 @@ cifBloatAllFunc(tile, op)
if (BloatStack == (Stack *)NULL)
BloatStack = StackNew(64);
PUSHTILE(tile, BloatStack);
/* If the type of the tile to be processed is not in the same plane */
/* as the bloat type(s), then find any tile under the tile to be */
/* processed that belongs to the connect mask, and use that as the */
/* starting tile. */
t = tile;
type = TiGetType(tile);
pNum = DBPlane(type);
pmask = CoincidentPlanes(&connect, pNum);
if (pmask == 0)
{
TiToRect(tile, &area);
if (DBSrPaintArea((Tile *)NULL, def->cd_planes[bloats->bl_plane], &area,
&connect, cifFoundFunc, (ClientData)(&t)) == 0)
return 0; /* Nothing found here */
}
PUSHTILE(t, BloatStack);
while (!StackEmpty(BloatStack))
{
t = (Tile *) STACKPOP(BloatStack);
@ -2688,6 +2742,7 @@ cifSrTiles(cifOp, area, cellDef, temps, func, cdArg)
{
TileTypeBitMask maskBits;
TileType t;
Tile *tp;
int i;
BloatData *bloats;
@ -2699,7 +2754,7 @@ cifSrTiles(cifOp, area, cellDef, temps, func, cdArg)
cifScale = (CIFCurStyle) ? CIFCurStyle->cs_scaleFactor : 1;
/* Bloat operations have to be in a single plane */
/* Bloat operations (except bloat-all) have to be in a single plane */
switch (cifOp->co_opcode) {
case CIFOP_BLOAT:
@ -2783,6 +2838,7 @@ CIFGenLayer(op, area, cellDef, temps, clientdata)
SearchContext scx;
TileType ttype;
char *netname;
BloatStruct bls;
int (*cifGrowFuncPtr)() = (CIFCurStyle->cs_flags & CWF_GROW_EUCLIDEAN) ?
cifGrowEuclideanFunc : cifGrowFunc;
@ -2971,8 +3027,10 @@ CIFGenLayer(op, area, cellDef, temps, clientdata)
case CIFOP_BLOATALL:
cifPlane = curPlane;
bls.op = op;
bls.def = cellDef;
cifSrTiles(op, area, cellDef, temps,
cifBloatAllFunc, (ClientData) op);
cifBloatAllFunc, (ClientData)&bls);
break;
case CIFOP_SQUARES:

View File

@ -310,6 +310,7 @@ extern void CIFLoadStyle();
extern Plane *CIFPlanes[]; /* Normal place to store CIF. */
extern CIFKeep *CIFStyleList; /* List of all CIF styles. */
extern CIFStyle *CIFCurStyle; /* Current style being used. */
extern CIFStyle *CIFDRCStyle; /* CIF style for DRC checking (optional) */
extern CellUse *CIFComponentUse; /* Flatten stuff in here if needed. */
extern CellDef *CIFComponentDef; /* Corresponds to CIFComponentUse. */
extern CellUse *CIFDummyUse; /* Used to dummy up a CellUse for a

View File

@ -1081,13 +1081,17 @@ CIFTechLine(sectionName, argc, argv)
if (argc != 3) goto wrongNumArgs;
cifParseLayers(argv[1], CIFCurStyle, &newOp->co_paintMask,
(TileTypeBitMask *)NULL, FALSE);
bloatLayers = newOp->co_paintMask;
bloats = (BloatData *)mallocMagic(sizeof(BloatData));
for (i = 0; i < TT_MAXTYPES; i++)
bloats->bl_distance[i] = 0;
newOp->co_client = (ClientData)bloats;
cifParseLayers(argv[2], CIFCurStyle, &mask, &tempMask, TRUE);
/* 10/15/2019: Lifting restriction that the types that */
/* trigger the bloating must be in the same plane as the */
/* types that are bloated into. */
TTMaskZero(&bloatLayers);
TTMaskSetMask(&bloatLayers, &mask);
if (!TTMaskEqual(&tempMask, &DBZeroTypeBits))
TechError("Can't use templayers in bloat statement.\n");
@ -1945,7 +1949,7 @@ CIFLoadStyle(stylename)
{
SectionID invcif;
if (CIFCurStyle->cs_name == stylename) return;
if (CIFCurStyle && (CIFCurStyle->cs_name == stylename)) return;
cifTechNewStyle();
CIFCurStyle->cs_name = stylename;

View File

@ -67,9 +67,10 @@ extern bool DRCForceReload;
TileTypeBitMask drcCifGenLayers;
DRCCookie *drcCifRules[MAXCIFLAYERS][2];
DRCCookie *drcCifCur=NULL;
DRCCookie *drcCifCur = NULL;
int drcCifValid = FALSE;
int beenWarned;
bool beenWarned = FALSE;
char *drcNeedStyle = NULL;
#define DRC_CIF_SPACE 0
#define DRC_CIF_SOLID 1
@ -112,14 +113,12 @@ drcCifSetStyle(argc, argv)
{
if (!strcmp(new->cs_name, argv[1]))
{
drcNeedStyle = new->cs_name;
DRCForceReload = TRUE;
if (!strcmp(new->cs_name, CIFCurStyle->cs_name))
drcCifStyle = CIFCurStyle;
else
{
TechError("DRC cif extensions are not enabled.\n\t"
"Use \"cif ostyle %s\" to enable them.\n",
new->cs_name);
drcCifStyle = NULL;
beenWarned = TRUE; /* post no more error messages */
}
@ -501,9 +500,35 @@ drcCifCheck(arg)
int scale;
int i,j;
int oldTiles;
CIFStyle *CIFSaveStyle = NULL;
if (CIFCurStyle != drcCifStyle)
{
if (drcNeedStyle == NULL) {
TxError("Error: No DRC CIF style declared!\n");
return;
}
CIFSaveStyle = CIFCurStyle;
if (drcCifStyle == NULL)
{
TxPrintf("Loading DRC CIF style.\n");
CIFCurStyle = NULL;
CIFLoadStyle(drcNeedStyle);
if (drcCifValid == FALSE)
CIFCurStyle = CIFSaveStyle;
else
drcCifStyle = CIFCurStyle;
}
if (drcCifStyle == NULL)
{
TxError("Error: Failed to load CIF DRC style.\n");
return;
}
CIFCurStyle = drcCifStyle;
}
if (drcCifValid == FALSE) return;
else if (CIFCurStyle != drcCifStyle) return;
scale = drcCifStyle->cs_scaleFactor;
cifrect = *checkRect;
@ -534,6 +559,9 @@ drcCifCheck(arg)
}
arg->dCD_rect = checkRect;
DRCstatCifTiles += DRCstatTiles - oldTiles;
/* Put it back the way you found it */
if (CIFSaveStyle != NULL) CIFCurStyle = CIFSaveStyle;
}
/*