From 59fc24729c64033fedec7d73453bb8d9f5556d67 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Wed, 21 Apr 2021 13:03:26 -0400 Subject: [PATCH] Corrected issues in the extresist function found after the previous commit, mostly relating to the scale of values in the ".nodes" file produced by ext2sim. Making this file CIF syntax seemed unnecessary, so I removed the CIF syntax and scaling. "extresist" can now produce an apparently valid output on a standard cell layout. Even with the change, the extresist output is still only pseudo-hierarchical, so this does not preclude the need for eliminating the .sim format file in favor of the .ext file, but it provides a working intermediate form. --- VERSION | 2 +- database/DBconnect.c | 61 +++------------------ database/database.h.in | 52 ++++++++++++++++++ ext2sim/ext2sim.c | 3 +- extflat/EFflat.c | 14 ----- resis/ResConDCS.c | 26 --------- resis/ResMain.c | 44 +++++++-------- resis/ResReadSim.c | 34 +++++------- resis/ResRex.c | 119 +++++++++++++++++------------------------ router/rtrTravers.c | 20 ------- sim/SimDBstuff.c | 51 +----------------- 11 files changed, 142 insertions(+), 284 deletions(-) diff --git a/VERSION b/VERSION index a7015476..0b32410c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.155 +8.3.156 diff --git a/database/DBconnect.c b/database/DBconnect.c index 950c8d45..1b665473 100644 --- a/database/DBconnect.c +++ b/database/DBconnect.c @@ -45,55 +45,6 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ * is used to clear the markings again. */ -/* The following structure is used to hold several pieces - * of information that must be passed through multiple - * levels of search function (used by dbSrConnectFunc). - */ - -struct conSrArg -{ - CellDef *csa_def; /* Definition being searched. */ - int csa_plane; /* Index of current plane being searched. */ - TileTypeBitMask *csa_connect; /* Table indicating what connects - * to what. - */ - int (*csa_clientFunc)(); /* Client function to call. */ - ClientData csa_clientData; /* Argument for clientFunc. */ - bool csa_clear; /* FALSE means pass 1, TRUE - * means pass 2. - */ - Rect csa_bounds; /* Area that limits search. */ -}; - -/* The following structure is used to hold several pieces - * of information that must be passed through multiple - * levels of search function (used by dbcConnectFunc). - */ - -typedef struct -{ - Rect area; /* Area to process */ - TileTypeBitMask *connectMask; /* Connection mask for search */ - TileType dinfo; /* Info about triangular search areas */ -} conSrArea; - -struct conSrArg2 -{ - CellUse *csa2_use; /* Destination use */ - TileTypeBitMask *csa2_connect; /* Table indicating what connects - * to what. - */ - SearchContext *csa2_topscx; /* Original top-level search context */ - Rect *csa2_bounds; /* Area that limits the search */ - - Stack *csa2_stack; /* Stack of full csa2_list entries */ - conSrArea *csa2_list; /* List of areas to process */ - int csa2_top; /* Index of next area to process */ - int csa2_lasttop; /* Previous top index */ -}; - -#define CSA2_LIST_SIZE 65536 /* Number of entries per list */ - /* *----------------------------------------------------------------- * DBTransformDiagonal -- @@ -257,6 +208,7 @@ DBSrConnect(def, startArea, mask, connect, bounds, func, clientData) startTile = NULL; for (startPlane = PL_TECHDEPBASE; startPlane < DBNumPlanes; startPlane++) { + csa.csa_pNum = startPlane; if (DBSrPaintArea((Tile *) NULL, def->cd_planes[startPlane], startArea, mask, dbSrConnectStartFunc, (ClientData) &startTile) != 0) break; @@ -272,7 +224,6 @@ DBSrConnect(def, startArea, mask, connect, bounds, func, clientData) csa.csa_clientData = clientData; csa.csa_clear = FALSE; csa.csa_connect = connect; - csa.csa_plane = startPlane; if (dbSrConnectFunc(startTile, &csa) != 0) result = 1; /* Pass 2. Don't call any client function, just clear the marks. @@ -282,7 +233,6 @@ DBSrConnect(def, startArea, mask, connect, bounds, func, clientData) SigDisableInterrupts(); csa.csa_clientFunc = NULL; csa.csa_clear = TRUE; - csa.csa_plane = startPlane; (void) dbSrConnectFunc(startTile, &csa); SigEnableInterrupts(); @@ -348,6 +298,7 @@ DBSrConnectOnePass(def, startArea, mask, connect, bounds, func, clientData) startTile = NULL; for (startPlane = PL_TECHDEPBASE; startPlane < DBNumPlanes; startPlane++) { + csa.csa_pNum = startPlane; if (DBSrPaintArea((Tile *) NULL, def->cd_planes[startPlane], startArea, mask, dbSrConnectStartFunc, (ClientData) &startTile) != 0) break; @@ -363,7 +314,6 @@ DBSrConnectOnePass(def, startArea, mask, connect, bounds, func, clientData) csa.csa_clientData = clientData; csa.csa_clear = FALSE; csa.csa_connect = connect; - csa.csa_plane = startPlane; if (dbSrConnectFunc(startTile, &csa) != 0) result = 1; return result; @@ -436,7 +386,7 @@ dbSrConnectFunc(tile, csa) if (csa->csa_clientFunc != NULL) { - if ((*csa->csa_clientFunc)(tile, csa->csa_plane, csa->csa_clientData) != 0) + if ((*csa->csa_clientFunc)(tile, csa->csa_pNum, csa->csa_clientData) != 0) return 1; } @@ -579,7 +529,7 @@ donesides: */ planes = DBConnPlanes[loctype]; - planes &= ~(PlaneNumToMaskBit(csa->csa_plane)); + planes &= ~(PlaneNumToMaskBit(csa->csa_pNum)); if (planes != 0) { struct conSrArg newcsa; @@ -591,7 +541,7 @@ donesides: for (i = PL_TECHDEPBASE; i < DBNumPlanes; i++) { if (!PlaneMaskHasPlane(planes, i)) continue; - newcsa.csa_plane = i; + newcsa.csa_pNum = i; if (IsSplit(tile)) { if (DBSrPaintNMArea((Tile *) NULL, csa->csa_def->cd_planes[i], @@ -786,6 +736,7 @@ dbcConnectLabelFunc(scx, lab, tpath, csa2) sizeof(conSrArea)); StackPush((ClientData)csa2->csa2_list, csa2->csa2_stack); csa2->csa2_list = newlist; + csa2->csa2_top = 0; } csa2->csa2_list[csa2->csa2_top].area = newarea; diff --git a/database/database.h.in b/database/database.h.in index 6a2f25d3..646882f6 100644 --- a/database/database.h.in +++ b/database/database.h.in @@ -33,6 +33,10 @@ #include "utils/hash.h" #endif /* _HASH_H */ +#ifndef _STACK_H +#include "utils/stack.h" +#endif /* _STACK_H */ + #ifndef _BPLANE_H #include "bplane/bplane.h" #endif /* _BPLANE_H */ @@ -658,6 +662,54 @@ typedef struct treeFilter /* To do: Make the tpath entries dynamically allocated */ #define FLATTERMSIZE 4096 /* Used for generating flattened labels */ +/* ------------ Information used in connectivity searches --------------*/ + +/* The following structure is used to hold several pieces of information + * that must be passed through multiple levels of search function. This + * structure is used by DBSrConnect, DBTreeCopyConnect, SimTreeCopyConnect, + * and DBTreeCopyConnectDCS. + */ + +struct conSrArg +{ + CellDef *csa_def; /* Definition being searched. */ + int csa_pNum; /* Index of plane being searched */ + TileTypeBitMask *csa_connect; /* Table indicating what connects + * to what. + */ + int (*csa_clientFunc)(); /* Client function to call. */ + ClientData csa_clientData; /* Argument for clientFunc. */ + bool csa_clear; /* FALSE means pass 1, TRUE + * means pass 2. + */ + Rect csa_bounds; /* Area that limits search. */ +}; + +typedef struct +{ + Rect area; /* Area to process */ + TileTypeBitMask *connectMask; /* Connection mask for search */ + TileType dinfo; /* Info about triangular search areas */ +} conSrArea; + +struct conSrArg2 +{ + CellUse *csa2_use; /* Destination use */ + TileTypeBitMask *csa2_connect; /* Table indicating what connects + * to what. + */ + SearchContext *csa2_topscx; /* Original top-level search context */ + int csa2_xMask; /* Cell window mask for search */ + Rect *csa2_bounds; /* Area that limits the search */ + + Stack *csa2_stack; /* Stack of full csa2_list entries */ + conSrArea *csa2_list; /* List of areas to process */ + int csa2_top; /* Index of next area to process */ + int csa2_lasttop; /* Previous top index */ +}; + +#define CSA2_LIST_SIZE 65536 /* Number of entries per list */ + /* -------------- Undo information passed to DBPaintPlane ------------- */ typedef struct diff --git a/ext2sim/ext2sim.c b/ext2sim/ext2sim.c index e40148b7..ce0ad59b 100644 --- a/ext2sim/ext2sim.c +++ b/ext2sim/ext2sim.c @@ -1624,9 +1624,8 @@ int simnodeVisit(node, res, cap) if (esLabF) { - fprintf(esLabF, "94 "); EFHNOut(hierName, esLabF); - fprintf(esLabF, " %d %d %s;\n", + fprintf(esLabF, " %d %d %s\n", node->efnode_loc.r_xbot, node->efnode_loc.r_ybot, EFLayerNames[node->efnode_type]); } diff --git a/extflat/EFflat.c b/extflat/EFflat.c index 463b196e..95c80bb0 100644 --- a/extflat/EFflat.c +++ b/extflat/EFflat.c @@ -440,12 +440,10 @@ efAddNodes(hc, stdcell) EFNode *node, *newnode; EFAttr *ap, *newap; HierName *hierName; - float scale; int size, asize; HashEntry *he; bool is_subcircuit = (def->def_flags & DEF_SUBCIRCUIT) ? TRUE : FALSE; - scale = def->def_scale; size = sizeof (EFNode) + (efNumResistClasses-1) * sizeof (EFPerimArea); for (node = (EFNode *) def->def_firstn.efnode_next; @@ -464,10 +462,6 @@ efAddNodes(hc, stdcell) newap = (EFAttr *) mallocMagic((unsigned)(asize)); (void) strcpy(newap->efa_text, ap->efa_text); GeoTransRect(&hc->hc_trans, &ap->efa_loc, &newap->efa_loc); - newap->efa_loc.r_xbot = (int)((float)(newap->efa_loc.r_xbot) * scale); - newap->efa_loc.r_xtop = (int)((float)(newap->efa_loc.r_xtop) * scale); - newap->efa_loc.r_ybot = (int)((float)(newap->efa_loc.r_ybot) * scale); - newap->efa_loc.r_ytop = (int)((float)(newap->efa_loc.r_ytop) * scale); newap->efa_type = ap->efa_type; newap->efa_next = newnode->efnode_attrs; @@ -490,14 +484,6 @@ efAddNodes(hc, stdcell) efNumResistClasses * sizeof (EFPerimArea)); GeoTransRect(&hc->hc_trans, &node->efnode_loc, &newnode->efnode_loc); - /* Scale the result by "scale" --- hopefully we end up with an integer */ - /* We don't scale the transform because the scale may be non-integer */ - /* and the Transform type has integers only. */ - newnode->efnode_loc.r_xbot = (int)((float)(newnode->efnode_loc.r_xbot) * scale); - newnode->efnode_loc.r_xtop = (int)((float)(newnode->efnode_loc.r_xtop) * scale); - newnode->efnode_loc.r_ybot = (int)((float)(newnode->efnode_loc.r_ybot) * scale); - newnode->efnode_loc.r_ytop = (int)((float)(newnode->efnode_loc.r_ytop) * scale); - /* Add each name for this node to the hash table */ newnode->efnode_name = (EFNodeName *) NULL; diff --git a/resis/ResConDCS.c b/resis/ResConDCS.c index c8591f97..c1cca55b 100644 --- a/resis/ResConDCS.c +++ b/resis/ResConDCS.c @@ -30,31 +30,6 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include "textio/txcommands.h" #include "resis/resis.h" -typedef struct -{ - Rect area; /* Area to process */ - TileTypeBitMask *connectMask; /* Connection mask for search */ - TileType dinfo; /* Info about triangular search areas */ -} conSrArea; - -struct conSrArg2 -{ - CellUse *csa2_use; /* Destination use */ - TileTypeBitMask *csa2_connect; /* Table indicating what connects - * to what. - */ - SearchContext *csa2_topscx; /* Original top-level search context */ - int csa2_xMask; /* Cell window mask for search */ - Rect *csa2_bounds; /* Area that limits the search */ - - Stack *csa2_stack; /* Stack of full csa2_list entries */ - conSrArea *csa2_list; /* List of areas to process */ - int csa2_top; /* Index of next area to process */ - int csa2_lasttop; /* Previous top index */ -}; - -#define CSA2_LIST_SIZE 65536 /* Number of entries per list */ - extern int dbcUnconnectFunc(); extern int dbcConnectLabelFunc(); extern int dbcConnectFuncDCS(); @@ -69,7 +44,6 @@ TileTypeBitMask ResSubsTypeBitMask; /* Forward declarations */ extern void ResCalcPerimOverlap(); - /* * ---------------------------------------------------------------------------- * diff --git a/resis/ResMain.c b/resis/ResMain.c index f1e65a47..e89816da 100644 --- a/resis/ResMain.c +++ b/resis/ResMain.c @@ -37,10 +37,10 @@ resNode *ResNodeQueue=NULL; /* Pending nodes */ resNode *ResOriginNode=NULL; /* node where R=0 */ resNode *resCurrentNode; int ResTileCount=0; /* Number of tiles rn_status */ -extern Region *ResFirst(); +extern Region *ResFirst(); extern Tile *FindStartTile(); -extern int ResEachTile(); -extern int ResLaplaceTile(); +extern int ResEachTile(); +extern int ResLaplaceTile(); extern ResSimNode *ResInitializeNode(); extern HashTable ResNodeTable; @@ -561,19 +561,18 @@ ResProcessTiles(goodies, origin) * * Side effects: Produces a resistance network for the node. * - * *------------------------------------------------------------------------- */ bool -ResExtractNet(startlist,goodies,cellname) +ResExtractNet(startlist, goodies, cellname) ResFixPoint *startlist; ResGlobalParams *goodies; char *cellname; { SearchContext scx; int pNum; - ResDevTile *DevTiles,*lasttile; + ResDevTile *DevTiles, *lasttile; TileTypeBitMask FirstTileMask; Point startpoint; ResFixPoint *fix; @@ -581,10 +580,10 @@ ResExtractNet(startlist,goodies,cellname) /* Make sure all global network variables are reset */ - ResResList=NULL; - ResNodeList=NULL; - ResDevList=NULL; - ResNodeQueue=NULL; + ResResList = NULL; + ResNodeList = NULL; + ResDevList = NULL; + ResNodeQueue = NULL; ResContactList = NULL; ResOriginNode = NULL; @@ -630,17 +629,16 @@ ResExtractNet(startlist,goodies,cellname) DBCellClearDef(ResUse->cu_def); - - /* Copy Paint */ + /* Copy Paint */ DevTiles = NULL; lasttile = NULL; - for (fix = startlist; fix != NULL;fix=fix->fp_next) + for (fix = startlist; fix != NULL; fix = fix->fp_next) { - ResDevTile *newdevtiles,*tmp; + ResDevTile *newdevtiles, *tmp; #ifdef ARIEL if ((ResOptionsFlags & ResOpt_Power) && - strcmp(fix->fp_name,goodies->rg_name) != 0) continue; + strcmp(fix->fp_name, goodies->rg_name) != 0) continue; #endif scx.scx_area.r_ll.p_x = fix->fp_loc.p_x-2; @@ -649,10 +647,10 @@ ResExtractNet(startlist,goodies,cellname) scx.scx_area.r_ur.p_y = fix->fp_loc.p_y+2; startpoint = fix->fp_loc; - // Because fix->fp_ttype might come from a label with a sticky type - // that does not correspond exactly to the layer underneath, include - // all connecting types. - /* TTMaskSetOnlyType(&FirstTileMask,fix->fp_ttype); */ + /* Because fix->fp_ttype might come from a label with a sticky type + * that does not correspond exactly to the layer underneath, include + * all connecting types. + */ TTMaskSetMask(&FirstTileMask, &DBConnectTbl[fix->fp_ttype]); newdevtiles = DBTreeCopyConnectDCS(&scx, &FirstTileMask, 0, @@ -662,13 +660,9 @@ ResExtractNet(startlist,goodies,cellname) if (newdevtiles) { if (DevTiles) - { lasttile->nextDev = newdevtiles; - } else - { DevTiles = newdevtiles; - } lasttile = tmp; } } @@ -682,7 +676,7 @@ ResExtractNet(startlist,goodies,cellname) &DBAllButSpaceAndDRCBits, ResConnectWithSD, extUnInit, ResFirst, ResEach); - ExtResetTiles(ResUse->cu_def,extUnInit); + ExtResetTiles(ResUse->cu_def, extUnInit); /* * dissolve the contacts and find which tiles now cover the point @@ -697,7 +691,7 @@ ResExtractNet(startlist,goodies,cellname) { Plane *plane = ResUse->cu_def->cd_planes[pNum]; Rect *rect = &ResUse->cu_def->cd_bbox; - ResFracture(plane,rect); + ResFracture(plane, rect); (void) DBSrPaintClient((Tile *) NULL,plane,rect, &DBAllButSpaceAndDRCBits, (ClientData) CLIENTDEFAULT, ResAddPlumbing, diff --git a/resis/ResReadSim.c b/resis/ResReadSim.c index e2bfc2b5..cb663a0b 100644 --- a/resis/ResReadSim.c +++ b/resis/ResReadSim.c @@ -50,11 +50,10 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #define COUPLEVALUE 3 #define REALNAME 1 #define ALIASNAME 2 -#define NODECIFCOMMAND 0 -#define NODENODENAME 1 -#define NODENODEX 2 -#define NODENODEY 3 -#define NODETYPE 4 +#define NODES_NODENAME 0 +#define NODES_NODEX 1 +#define NODES_NODEY 2 +#define NODES_NODETYPE 3 #define NODE_BBOX_LL_X 5 #define NODE_BBOX_LL_Y 6 #define NODE_BBOX_UR_X 7 @@ -236,13 +235,6 @@ ResReadNode(nodefile) char *cp; float lambda; - /* NOTE: Units from the .nodes file are in centimicrons. - * Divide by the extract scale (exts_unitsPerLambda) to get back - * to database units. This assumes that exts_unitsPerLambda doesn't - * change between output and readback. - */ - lambda = (float)ExtCurStyle->exts_unitsPerLambda; - fp = PaOpen(nodefile,"r",".nodes",".", (char *) NULL, (char **) NULL); if (fp == NULL) { @@ -251,19 +243,19 @@ ResReadNode(nodefile) } while (gettokens(line,fp) != 0) { - entry = HashFind(&ResNodeTable,line[NODENODENAME]); + entry = HashFind(&ResNodeTable,line[NODES_NODENAME]); node = ResInitializeNode(entry); - node->location.p_x = (int)((float)atof(line[NODENODEX]) / lambda); - node->location.p_y = (int)((float)atof(line[NODENODEY]) / lambda); + node->location.p_x = atoi(line[NODES_NODEX]); + node->location.p_y = atoi(line[NODES_NODEY]); #ifdef ARIEL - node->rs_bbox.r_xbot = (int)((float)atof(line[NODE_BBOX_LL_X]) / lambda); - node->rs_bbox.r_ybot = (int)((float)atof(line[NODE_BBOX_LL_Y]) / lambda); - node->rs_bbox.r_xtop = (int)((float)atof(line[NODE_BBOX_UR_X]) / lambda); - node->rs_bbox.r_ytop = (int)((float)atof(line[NODE_BBOX_UR_Y]) / lambda); + node->rs_bbox.r_xbot = atoi(line[NODE_BBOX_LL_X]); + node->rs_bbox.r_ybot = atoi(line[NODE_BBOX_LL_Y]); + node->rs_bbox.r_xtop = atoi(line[NODE_BBOX_UR_X]); + node->rs_bbox.r_ytop = atoi(line[NODE_BBOX_UR_Y]); #endif - if (cp = strchr(line[NODETYPE], ';')) *cp = '\0'; - node->type = DBTechNameType(line[NODETYPE]); + if (cp = strchr(line[NODES_NODETYPE], ';')) *cp = '\0'; + node->type = DBTechNameType(line[NODES_NODETYPE]); if (node->type == -1) { diff --git a/resis/ResRex.c b/resis/ResRex.c index bde291e2..ea4d7bb5 100644 --- a/resis/ResRex.c +++ b/resis/ResRex.c @@ -37,9 +37,9 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ /* Time constants are produced by multiplying attofarads by milliohms, */ /* giving zeptoseconds (yes, really. Look it up). This constant */ -/* converts zeptoseconds to nanoseconds. */ +/* converts zeptoseconds to picoseconds. */ -#define Z_TO_N 1e12 +#define Z_TO_P 1e9 /* ResSimNode is a node read in from a sim file */ @@ -766,12 +766,12 @@ ResCheckPorts(cellDef) result = 0; if ((node = (ResSimNode *) HashGetValue(entry)) != NULL) { - TxError("Port: name = %s exists, forcing drivepoint\n", + TxPrintf("Port: name = %s exists, forcing drivepoint\n", lab->lab_text); - TxError("Location is (%d, %d); drivepoint (%d, %d)\n", + TxPrintf("Location is (%d, %d); drivepoint (%d, %d)\n", node->location.p_x, node->location.p_y, portloc.p_x, portloc.p_y); - TxFlushErr(); + TxFlush(); node->drivepoint = portloc; node->status |= FORCE; } @@ -782,9 +782,9 @@ ResCheckPorts(cellDef) /* and a drivepoint. */ node = ResInitializeNode(entry); - TxError("Port: name = %s is new node 0x%x\n", + TxPrintf("Port: name = %s is new node 0x%x\n", lab->lab_text, node); - TxError("Location is (%d, %d); drivepoint (%d, %d)\n", + TxPrintf("Location is (%d, %d); drivepoint (%d, %d)\n", portloc.p_x, portloc.p_y, portloc.p_x, portloc.p_y); node->location = portloc; @@ -1111,37 +1111,33 @@ ResCheckSimNodes(celldef, resisdata) if (total) { - TxError("Total Nets: %d\nNets extracted: " + TxPrintf("Total Nets: %d\nNets extracted: " "%d (%f)\nNets output: %d (%f)\n", total, failed1, (float)failed1 / (float)total, failed3, (float)failed3 / (float)total); } else { - TxError("Total Nodes: %d\n",total); + TxPrintf("Total Nodes: %d\n",total); } /* close output files */ if (ResExtFile != NULL) - { (void) fclose(ResExtFile); - } + if (ResLumpFile != NULL) - { (void) fclose(ResLumpFile); - } + if (ResFHFile != NULL) - { (void) fclose(ResFHFile); - } } /* *------------------------------------------------------------------------- * - * ResFixUpConnections-- Changes the connection to a terminal of the sim + * ResFixUpConnections-- Changes the connection to a terminal of the sim * device. The new name is formed by appending .t# to the old name. * The new name is added to the hash table of node names. * @@ -1182,14 +1178,14 @@ ResFixUpConnections(simDev, layoutDev, simNode, nodename) { strcpy(oldnodename,nodename); } - (void)sprintf(newname,"%s%s%d",nodename,".t",resNodeNum++); + sprintf(newname, "%s%s%d", nodename, ".t", resNodeNum++); notdecremented = TRUE; if (simDev->gate == simNode) { if ((gate=layoutDev->rd_fet_gate) != NULL) { - /* cosmetic addition: If the layout device already has a */ + /* Cosmetic addition: If the layout device already has a */ /* name, the new one won't be used, so we decrement resNodeNum */ if (gate->rn_name != NULL) { @@ -1197,45 +1193,41 @@ ResFixUpConnections(simDev, layoutDev, simNode, nodename) notdecremented = FALSE; } - ResFixDevName(newname,GATE,simDev,gate); + ResFixDevName(newname, GATE, simDev, gate); gate->rn_name = simDev->gate->name; - (void)sprintf(newname,"%s%s%d",nodename,".t",resNodeNum++); + sprintf(newname, "%s%s%d", nodename, ".t", resNodeNum++); } else - { TxError("Missing gate connection\n"); - } } if (simDev->source == simNode) { if (simDev->drain == simNode) { - if ((source=layoutDev->rd_fet_source) && - (drain=layoutDev->rd_fet_drain)) + if ((source = layoutDev->rd_fet_source) && + (drain = layoutDev->rd_fet_drain)) { if (source->rn_name != NULL && notdecremented) { resNodeNum--; notdecremented = FALSE; } - ResFixDevName(newname,SOURCE,simDev,source); + ResFixDevName(newname, SOURCE, simDev, source); source->rn_name = simDev->source->name; - (void)sprintf(newname,"%s%s%d",nodename,".t",resNodeNum++); + (void)sprintf(newname, "%s%s%d", nodename, ".t", resNodeNum++); if (drain->rn_name != NULL) resNodeNum--; - ResFixDevName(newname,DRAIN,simDev,drain); + ResFixDevName(newname, DRAIN, simDev, drain); drain->rn_name = simDev->drain->name; /* one to each */ } else - { TxError("Missing SD connection\n"); - } } else { - if (source=layoutDev->rd_fet_source) + if ((source = layoutDev->rd_fet_source) != NULL) { - if (drain=layoutDev->rd_fet_drain) + if ((drain = layoutDev->rd_fet_drain) != NULL) { if (source != drain) { @@ -1256,7 +1248,7 @@ ResFixUpConnections(simDev, layoutDev, simNode, nodename) } layoutDev->rd_fet_drain = (resNode *)NULL; if (source->rn_name != NULL) resNodeNum--; - ResFixDevName(newname,SOURCE,simDev,source); + ResFixDevName(newname, SOURCE, simDev, source); source->rn_name = simDev->source->name; } else @@ -1266,22 +1258,20 @@ ResFixUpConnections(simDev, layoutDev, simNode, nodename) resNodeNum--; notdecremented = FALSE; } - ResFixDevName(newname,SOURCE,simDev,source); + ResFixDevName(newname, SOURCE, simDev, source); source->rn_name = simDev->source->name; } } else - { TxError("missing SD connection\n"); - } } } else if (simDev->drain == simNode) { - if (source=layoutDev->rd_fet_source) + if ((source = layoutDev->rd_fet_source) != NULL) { - if (drain=layoutDev->rd_fet_drain) + if ((drain = layoutDev->rd_fet_drain) != NULL) { if (drain != source) { @@ -1321,14 +1311,10 @@ ResFixUpConnections(simDev, layoutDev, simNode, nodename) } } else - { TxError("missing SD connection\n"); - } } else - { resNodeNum--; - } } @@ -1346,7 +1332,7 @@ ResFixUpConnections(simDev, layoutDev, simNode, nodename) */ void -ResFixDevName(line,type,device,layoutnode) +ResFixDevName(line, type, device, layoutnode) char line[]; int type; RDev *device; @@ -1359,13 +1345,13 @@ ResFixDevName(line,type,device,layoutnode) if (layoutnode->rn_name != NULL) { - entry = HashFind(&ResNodeTable,layoutnode->rn_name); + entry = HashFind(&ResNodeTable, layoutnode->rn_name); node = ResInitializeNode(entry); } else { - entry = HashFind(&ResNodeTable,line); + entry = HashFind(&ResNodeTable, line); node = ResInitializeNode(entry); } tptr = (devPtr *) mallocMagic((unsigned) (sizeof(devPtr))); @@ -1397,7 +1383,7 @@ ResFixDevName(line,type,device,layoutnode) /* *------------------------------------------------------------------------- * - * ResSortByGate--sorts device pointers whose terminal field is either + * ResSortByGate -- sorts device pointers whose terminal field is either * drain or source by gate node number, then by drain (source) number. * This places devices with identical connections next to one * another. @@ -1448,8 +1434,8 @@ ResSortByGate(DevpointerList) last = NULL; while (working != NULL && (current = working->nextDev) != NULL) { - RDev *w = working->thisDev; - RDev *c = current->thisDev; + RDev *w = working->thisDev; + RDev *c = current->thisDev; if (w->gate > c->gate) { @@ -1503,17 +1489,12 @@ ResSortByGate(DevpointerList) else { if (working->nextDev != NULL) - { TxError("Bad Device pointer in sort\n"); - } else - { working->nextDev = gatelist; - } } } - /* *------------------------------------------------------------------------- * @@ -1536,13 +1517,11 @@ ResWriteLumpFile(node) { if (gparams.rg_nodecap != 0) { - lumpedres = (int)((gparams.rg_Tdi/gparams.rg_nodecap - -(float)(gparams.rg_bigdevres))/OHMSTOMILLIOHMS); + lumpedres = (int)((gparams.rg_Tdi / gparams.rg_nodecap + - (float)(gparams.rg_bigdevres)) / OHMSTOMILLIOHMS); } else - { lumpedres = 0; - } } else { @@ -1636,35 +1615,35 @@ ResWriteExtFile(celldef, node, tol, rctol, nidx, eidx) RCdev = gparams.rg_bigdevres * gparams.rg_nodecap; - if (tol == 0.0 ||(node->status & FORCE) || - (ResOptionsFlags & ResOpt_ExtractAll)|| - (ResOptionsFlags & ResOpt_Simplify)==0|| - (rctol+1)*RCdev < rctol*gparams.rg_Tdi) + if (tol == 0.0 || (node->status & FORCE) || + (ResOptionsFlags & ResOpt_ExtractAll) || + (ResOptionsFlags & ResOpt_Simplify) == 0 || + (rctol + 1) * RCdev < rctol * gparams.rg_Tdi) { - ASSERT(gparams.rg_Tdi != -1,"ResWriteExtFile"); - (void)sprintf(newname,"%s",node->name); - cp = newname+strlen(newname)-1; + ASSERT(gparams.rg_Tdi != -1, "ResWriteExtFile"); + (void)sprintf(newname,"%s", node->name); + cp = newname + strlen(newname)-1; if (*cp == '!' || *cp == '#') *cp = '\0'; - if ((rctol+1)*RCdev < rctol*gparams.rg_Tdi || + if ((rctol + 1) * RCdev < rctol * gparams.rg_Tdi || (ResOptionsFlags & ResOpt_Tdi) == 0) { - if ((ResOptionsFlags & (ResOpt_RunSilent|ResOpt_Tdi)) == ResOpt_Tdi) + if ((ResOptionsFlags & (ResOpt_RunSilent | ResOpt_Tdi)) == ResOpt_Tdi) { - TxError("Adding %s; Tnew = %.2fns,Told = %.2fns\n", - node->name,gparams.rg_Tdi/Z_TO_N, RCdev/Z_TO_N); + TxPrintf("Adding %s; Tnew = %.2fns, Told = %.2fns\n", + node->name, gparams.rg_Tdi / Z_TO_P, RCdev / Z_TO_P); } } for (ptr = node->firstDev; ptr != NULL; ptr=ptr->nextDev) { if (layoutDev = ResGetDevice(&ptr->thisDev->location)) { - ResFixUpConnections(ptr->thisDev,layoutDev,node,newname); + ResFixUpConnections(ptr->thisDev, layoutDev, node, newname); } } if (ResOptionsFlags & ResOpt_DoExtFile) { - ResPrintExtNode(ResExtFile,ResNodeList,node->name); - ResPrintExtRes(ResExtFile,ResResList,newname); + ResPrintExtNode(ResExtFile, ResNodeList, node->name); + ResPrintExtRes(ResExtFile, ResResList, newname); } if (ResOptionsFlags & ResOpt_FastHenry) { diff --git a/router/rtrTravers.c b/router/rtrTravers.c index 73d00868..4aea9cc0 100644 --- a/router/rtrTravers.c +++ b/router/rtrTravers.c @@ -52,26 +52,6 @@ int rtrDelta; /* Change in layer width */ * is used to clear the markings again. */ -/* The following structure is used to hold several pieces - * of information that must be passed through multiple - * levels of search function. - */ - -struct conSrArg -{ - CellDef *csa_def; /* Definition being searched. */ - int csa_pNum; /* Index of plane being searched. */ - TileTypeBitMask *csa_connect; /* Table indicating what connects - * to what. - */ - int (*csa_clientFunc)(); /* Client function to call. */ - ClientData csa_clientData; /* Argument for clientFunc. */ - bool csa_clear; /* FALSE means pass 1, TRUE - * means pass 2. - */ - Rect csa_bounds; /* Area that limits search. */ -}; - /* * The search path is maintained on the C runtime stack * with rtrTileStack sructures. Each entry on the stack diff --git a/sim/SimDBstuff.c b/sim/SimDBstuff.c index 9fafac20..640519ef 100644 --- a/sim/SimDBstuff.c +++ b/sim/SimDBstuff.c @@ -46,55 +46,6 @@ #include "utils/styles.h" #include "graphics/graphics.h" -/* The following structure is used to hold several pieces - * of information that must be passed through multiple - * levels of search function. - */ - -struct conSrArg -{ - CellDef *csa_def; /* Definition being searched. */ - Plane *csa_plane; /* Current plane being searched. */ - TileTypeBitMask *csa_connect; /* Table indicating what connects - * to what. - */ - int (*csa_clientFunc)(); /* Client function to call. */ - ClientData csa_clientData; /* Argument for clientFunc. */ - bool csa_clear; /* FALSE means pass 1, TRUE - * means pass 2. - */ - Rect csa_bounds; /* Area that limits search. */ -}; - -/* For SimTreeSrConnect, the extraction proceeds in one pass, copying - * all connected stuff from a hierarchy into a single cell. A list - * is kept to record areas that still have to be searched for - * hierarchical stuff. - */ - -typedef struct -{ - Rect area; /* Area to process */ - TileTypeBitMask *connectMask; /* Connection mask for search */ - TileType dinfo; /* Info about triangular search areas */ -} conSrArea; - -struct conSrArg2 -{ - CellUse *csa2_use; /* Destination use */ - TileTypeBitMask *csa2_connect; /* Table indicating what connects - * to what. - */ - Rect *csa2_bounds; /* Area that limits the search */ - - Stack *csa2_stack; /* Stack of full csa2_list entries */ - conSrArea *csa2_list; /* List of areas to process */ - int csa2_top; /* Index of next area to process */ - int csa2_lasttop; /* Previous top index */ -}; - -#define CSA2_LIST_SIZE 65536 /* Number of entries per list */ - /* Forward declarations */ extern char *DBPrintUseId(); @@ -656,7 +607,7 @@ SimSrConnect(def, startArea, mask, connect, bounds, func, clientData) csa.csa_clientData = clientData; csa.csa_clear = FALSE; csa.csa_connect = connect; - csa.csa_plane = def->cd_planes[startPlane]; + csa.csa_pNum = startPlane; if (dbSrConnectFunc(startTile, &csa) != 0) result = 1; return result;