A number of fixes to the extresist code (as well as style cleanup).

Still tracking down a problem with non-FET devices (e.g., capacitors).
So, work in progress.  Nothing should be affected outside of extresist.
This commit is contained in:
Tim Edwards 2021-05-25 22:41:52 -04:00
parent c22d584ac3
commit 9aa39f820f
7 changed files with 2271 additions and 2340 deletions

View File

@ -23,20 +23,20 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
#include "textio/txcommands.h" #include "textio/txcommands.h"
#include "resis/resis.h" #include "resis/resis.h"
CellUse *ResUse=NULL; /* Our use and def */ CellUse *ResUse = NULL; /* Our use and def */
CellDef *ResDef=NULL; CellDef *ResDef = NULL;
TileTypeBitMask ResConnectWithSD[NT]; /* A mask that goes from */ TileTypeBitMask ResConnectWithSD[NT]; /* A mask that goes from */
/* SD's to devices. */ /* SD's to devices. */
TileTypeBitMask ResCopyMask[NT]; /* Indicates which tiles */ TileTypeBitMask ResCopyMask[NT]; /* Indicates which tiles */
/* are to be copied. */ /* are to be copied. */
resResistor *ResResList=NULL; /* Resistor list */ resResistor *ResResList = NULL; /* Resistor list */
resNode *ResNodeList=NULL; /* Processed Nodes */ resNode *ResNodeList = NULL; /* Processed Nodes */
resDevice *ResDevList=NULL; /* Devices */ resDevice *ResDevList = NULL; /* Devices */
ResContactPoint *ResContactList=NULL; /* Contacts */ ResContactPoint *ResContactList = NULL; /* Contacts */
resNode *ResNodeQueue=NULL; /* Pending nodes */ resNode *ResNodeQueue = NULL; /* Pending nodes */
resNode *ResOriginNode=NULL; /* node where R=0 */ resNode *ResOriginNode = NULL; /* node where R=0 */
resNode *resCurrentNode; resNode *resCurrentNode;
int ResTileCount=0; /* Number of tiles rn_status */ int ResTileCount = 0; /* Number of tiles rn_status */
extern Region *ResFirst(); extern Region *ResFirst();
extern Tile *FindStartTile(); extern Tile *FindStartTile();
extern int ResEachTile(); extern int ResEachTile();
@ -46,7 +46,6 @@ extern ResSimNode *ResInitializeNode();
extern HashTable ResNodeTable; extern HashTable ResNodeTable;
/* /*
*-------------------------------------------------------------------------- *--------------------------------------------------------------------------
* *
@ -78,13 +77,13 @@ ResInitializeConn()
for (diff = TT_TECHDEPBASE; diff < TT_MAXTYPES; diff++) for (diff = TT_TECHDEPBASE; diff < TT_MAXTYPES; diff++)
{ {
if TTMaskHasType(&(devptr->exts_deviceSDTypes[0]), diff) if TTMaskHasType(&(devptr->exts_deviceSDTypes[0]), diff)
TTMaskSetType(&ResConnectWithSD[diff],dev); TTMaskSetType(&ResConnectWithSD[diff], dev);
if TTMaskHasType(&(devptr->exts_deviceSubstrateTypes),diff) if TTMaskHasType(&(devptr->exts_deviceSubstrateTypes), diff)
TTMaskSetType(&ResConnectWithSD[diff],dev); TTMaskSetType(&ResConnectWithSD[diff], dev);
} }
} }
TTMaskSetMask(&ResConnectWithSD[dev],&DBConnectTbl[dev]); TTMaskSetMask(&ResConnectWithSD[dev], &DBConnectTbl[dev]);
} }
} }
@ -121,7 +120,6 @@ ResGetReCell()
ResUse = DBCellNewUse(ResDef, (char *) NULL); ResUse = DBCellNewUse(ResDef, (char *) NULL);
DBSetTrans(ResUse, &GeoIdentityTransform); DBSetTrans(ResUse, &GeoIdentityTransform);
ResUse->cu_expandMask = CU_DESCEND_SPECIAL; ResUse->cu_expandMask = CU_DESCEND_SPECIAL;
} }
/* /*
@ -172,7 +170,7 @@ ResDissolveContacts(contacts)
} }
tp = ResDef->cd_planes[DBPlane(contacts->cp_type)]->pl_hint; tp = ResDef->cd_planes[DBPlane(contacts->cp_type)]->pl_hint;
GOTOPOINT(tp,&(contacts->cp_rect.r_ll)); GOTOPOINT(tp, &(contacts->cp_rect.r_ll));
#ifdef PARANOID #ifdef PARANOID
if (TiGetTypeExact(tp) == contacts->cp_type) if (TiGetTypeExact(tp) == contacts->cp_type)
{ {
@ -325,46 +323,46 @@ ResAddBreakpointFunc(tile, node)
void void
ResFindNewContactTiles(contacts) ResFindNewContactTiles(contacts)
ResContactPoint *contacts; ResContactPoint *contacts;
{ {
int pNum; int pNum;
Tile *tile; Tile *tile;
TileTypeBitMask mask; TileTypeBitMask mask;
for (; contacts != (ResContactPoint *) NULL; contacts = contacts->cp_nextcontact) for (; contacts != (ResContactPoint *) NULL; contacts = contacts->cp_nextcontact)
{ {
DBFullResidueMask(contacts->cp_type, &mask); DBFullResidueMask(contacts->cp_type, &mask);
for (pNum=PL_TECHDEPBASE; pNum<DBNumPlanes; pNum++) for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++)
{ {
tile = ResDef->cd_planes[pNum]->pl_hint; tile = ResDef->cd_planes[pNum]->pl_hint;
GOTOPOINT(tile, &(contacts->cp_center)); GOTOPOINT(tile, &(contacts->cp_center));
#ifdef PARANOID #ifdef PARANOID
if (tile == (Tile *) NULL) if (tile == (Tile *) NULL)
{ {
TxError("Error: setting contact tile to null\n"); TxError("Error: setting contact tile to null\n");
} }
#endif #endif
if ((IsSplit(tile) && TTMaskHasType(&mask, TiGetRightType(tile))) if ((IsSplit(tile) && TTMaskHasType(&mask, TiGetRightType(tile)))
|| TTMaskHasType(&mask, TiGetType(tile))) || TTMaskHasType(&mask, TiGetType(tile)))
{ {
tileJunk *j = (tileJunk *)tile->ti_client; tileJunk *j = (tileJunk *)tile->ti_client;
cElement *ce; cElement *ce;
ce = (cElement *) mallocMagic((unsigned) (sizeof(cElement))); ce = (cElement *) mallocMagic((unsigned) (sizeof(cElement)));
contacts->cp_tile[contacts->cp_currentcontact] = tile; contacts->cp_tile[contacts->cp_currentcontact] = tile;
ce->ce_thisc = contacts; ce->ce_thisc = contacts;
ce->ce_nextc = j->contactList; ce->ce_nextc = j->contactList;
(contacts->cp_currentcontact) += 1; (contacts->cp_currentcontact) += 1;
j->contactList = ce; j->contactList = ce;
} }
} }
#ifdef PARANOID #ifdef PARANOID
if (contacts->cp_currentcontact > LAYERS_PER_CONTACT) if (contacts->cp_currentcontact > LAYERS_PER_CONTACT)
{ {
TxError("Error: Not enough space allocated for contact nodes\n"); TxError("Error: Not enough space allocated for contact nodes\n");
} }
#endif #endif
} }
} }
/* /*
@ -388,78 +386,77 @@ ResProcessTiles(goodies, origin)
ResGlobalParams *goodies; ResGlobalParams *goodies;
{ {
Tile *startTile; Tile *startTile;
int tilenum,merged; int tilenum, merged;
resNode *resptr2; resNode *resptr2;
jElement *workingj; jElement *workingj;
cElement *workingc; cElement *workingc;
ResFixPoint *fix; ResFixPoint *fix;
resNode *resptr; resNode *resptr;
int (*tilefunc)(); int (*tilefunc)();
#ifdef LAPLACE #ifdef LAPLACE
tilefunc = (ResOptionsFlags & ResOpt_DoLaplace)?ResLaplaceTile:ResEachTile; tilefunc = (ResOptionsFlags & ResOpt_DoLaplace) ? ResLaplaceTile : ResEachTile;
#else #else
tilefunc = ResEachTile; tilefunc = ResEachTile;
#endif #endif
if (ResOptionsFlags & ResOpt_Signal) if (ResOptionsFlags & ResOpt_Signal)
{ {
startTile = FindStartTile(goodies, origin); startTile = FindStartTile(goodies, origin);
if (startTile == NULL) return(1); if (startTile == NULL) return(1);
resCurrentNode = NULL; resCurrentNode = NULL;
(void) (*tilefunc)(startTile, origin); (void) (*tilefunc)(startTile, origin);
} }
#ifdef ARIEL #ifdef ARIEL
else if (ResOptionsFlags & ResOpt_Power) else if (ResOptionsFlags & ResOpt_Power)
{ {
for (fix = ResFixList; fix != NULL;fix=fix->fp_next) for (fix = ResFixList; fix != NULL; fix = fix->fp_next)
{ {
Tile *tile = fix->fp_tile; Tile *tile = fix->fp_tile;
if (tile == NULL) if (tile == NULL)
{ {
tile = ResDef->cd_planes[DBPlane(fix->fp_ttype)]->pl_hint;
GOTOPOINT(tile, &(fix->fp_loc));
if (TiGetTypeExact(tile) != TT_SPACE)
{
fix->fp_tile = tile;
}
else
{
tile = NULL;
}
}
if (tile != NULL)
{
int x = fix->fp_loc.p_x;
int y = fix->fp_loc.p_y;
resptr = (resNode *) mallocMagic((unsigned)(sizeof(resNode)));
InitializeNode(resptr, x, y, RES_NODE_ORIGIN);
resptr->rn_status = TRUE;
resptr->rn_noderes = 0;
ResAddToQueue(resptr, &ResNodeQueue);
fix->fp_node = resptr;
NEWBREAK(resptr, tile, x, y, NULL);
}
}
for (fix = ResFixList; fix != NULL; fix = fix->fp_next)
{
Tile *tile = fix->fp_tile;
tile = ResDef->cd_planes[DBPlane(fix->fp_ttype)]->pl_hint; if (tile != NULL && (((tileJunk *)tile->ti_client)->tj_status &
GOTOPOINT(tile, &(fix->fp_loc));
if (TiGetTypeExact(tile) != TT_SPACE)
{
fix->fp_tile = tile;
}
else
{
tile = NULL;
}
}
if (tile != NULL)
{
int x = fix->fp_loc.p_x;
int y = fix->fp_loc.p_y;
resptr = (resNode *) mallocMagic((unsigned)(sizeof(resNode)));
InitializeNode(resptr, x, y, RES_NODE_ORIGIN);
resptr->rn_status = TRUE;
resptr->rn_noderes = 0;
ResAddToQueue(resptr, &ResNodeQueue);
fix->fp_node = resptr;
NEWBREAK(resptr, tile, x, y, NULL);
}
}
for (fix = ResFixList; fix != NULL; fix = fix->fp_next)
{
Tile *tile = fix->fp_tile;
if (tile != NULL && (((tileJunk *)tile->ti_client)->tj_status &
RES_TILE_DONE) == 0) RES_TILE_DONE) == 0)
{ {
resCurrentNode = fix->fp_node; resCurrentNode = fix->fp_node;
(void) (*tilefunc)(tile, (Point *)NULL); (void) (*tilefunc)(tile, (Point *)NULL);
} }
} }
} }
#endif #endif
#ifdef PARANOID #ifdef PARANOID
else else
{ {
TxError("Unknown analysis type in ResProcessTiles\n"); TxError("Unknown analysis type in ResProcessTiles\n");
} }
#endif #endif
@ -467,100 +464,100 @@ ResProcessTiles(goodies, origin)
while (ResNodeQueue != NULL) while (ResNodeQueue != NULL)
{ {
/* /*
* merged keeps track of whether another node gets merged into * merged keeps track of whether another node gets merged into
* the current one. If it does, then the node must be processed * the current one. If it does, then the node must be processed
* because additional junctions or contacts were added * because additional junctions or contacts were added
*/ */
resptr2 = ResNodeQueue; resptr2 = ResNodeQueue;
merged = FALSE; merged = FALSE;
/* Process all junctions associated with node */ /* Process all junctions associated with node */
for (workingj = resptr2->rn_je; workingj != NULL; workingj = workingj->je_nextj) for (workingj = resptr2->rn_je; workingj != NULL; workingj = workingj->je_nextj)
{ {
ResJunction *rj = workingj->je_thisj; ResJunction *rj = workingj->je_thisj;
if (rj->rj_status == FALSE) if (rj->rj_status == FALSE)
{ {
for (tilenum = 0; tilenum < TILES_PER_JUNCTION; tilenum++) for (tilenum = 0; tilenum < TILES_PER_JUNCTION; tilenum++)
{ {
Tile *tile = rj->rj_Tile[tilenum]; Tile *tile = rj->rj_Tile[tilenum];
tileJunk *j = (tileJunk *) tile->ti_client; tileJunk *j = (tileJunk *)tile->ti_client;
if ((j->tj_status & RES_TILE_DONE) == 0) if ((j->tj_status & RES_TILE_DONE) == 0)
{
resCurrentNode = resptr2;
merged |= (*tilefunc)(tile,(Point *)NULL);
}
if (merged & ORIGIN) break;
}
if (merged & ORIGIN) break;
rj->rj_status = TRUE;
}
}
/* Next, Process all contacts. */
for (workingc = resptr2->rn_ce;workingc != NULL;workingc = workingc->ce_nextc)
{
ResContactPoint *cp = workingc->ce_thisc;
if (merged & ORIGIN) break;
if (cp->cp_status == FALSE)
{
int newstatus = TRUE;
for (tilenum = 0; tilenum < cp->cp_currentcontact; tilenum++)
{
Tile *tile = cp->cp_tile[tilenum];
tileJunk *j = (tileJunk *) tile->ti_client;
if ((j->tj_status & RES_TILE_DONE) == 0)
{
if (cp->cp_cnode[tilenum] == resptr2)
{ {
resCurrentNode = resptr2; resCurrentNode = resptr2;
merged |= (*tilefunc)(tile,(Point *)NULL); merged |= (*tilefunc)(tile,(Point *)NULL);
} }
if (merged & ORIGIN) break; else
}
if (merged & ORIGIN) break;
rj->rj_status = TRUE;
}
}
/* Next, Process all contacts. */
for (workingc = resptr2->rn_ce;workingc != NULL;workingc = workingc->ce_nextc)
{
ResContactPoint *cp = workingc->ce_thisc;
if (merged & ORIGIN) break;
if (cp->cp_status == FALSE)
{
int newstatus = TRUE;
for (tilenum = 0; tilenum < cp->cp_currentcontact; tilenum++)
{
Tile *tile = cp->cp_tile[tilenum];
tileJunk *j = (tileJunk *) tile->ti_client;
if ((j->tj_status & RES_TILE_DONE) == 0)
{ {
if (cp->cp_cnode[tilenum] == resptr2) newstatus = FALSE;
{
resCurrentNode = resptr2;
merged |= (*tilefunc)(tile,(Point *)NULL);
}
else
{
newstatus = FALSE;
}
} }
if (merged & ORIGIN) break; }
} if (merged & ORIGIN) break;
if (merged & ORIGIN) break; }
cp->cp_status = newstatus; if (merged & ORIGIN) break;
} cp->cp_status = newstatus;
} }
}
/* /*
* If nothing new has been added via a merge, then the node is * If nothing new has been added via a merge, then the node is
* finished. It is removed from the pending queue, added to the * finished. It is removed from the pending queue, added to the
* done list, cleaned up, and passed to ResDoneWithNode * done list, cleaned up, and passed to ResDoneWithNode
*/ */
if (merged == FALSE) if (merged == FALSE)
{ {
ResRemoveFromQueue(resptr2,&ResNodeQueue); ResRemoveFromQueue(resptr2, &ResNodeQueue);
resptr2->rn_more = ResNodeList; resptr2->rn_more = ResNodeList;
resptr2->rn_less = NULL; resptr2->rn_less = NULL;
resptr2->rn_status &= ~PENDING; resptr2->rn_status &= ~PENDING;
resptr2->rn_status |= FINISHED | MARKED; resptr2->rn_status |= FINISHED | MARKED;
if (ResNodeList != NULL) if (ResNodeList != NULL)
{ {
ResNodeList->rn_less = resptr2; ResNodeList->rn_less = resptr2;
} }
if (resptr2->rn_noderes == 0) if (resptr2->rn_noderes == 0)
{ {
ResOriginNode=resptr2; ResOriginNode=resptr2;
} }
ResNodeList = resptr2; ResNodeList = resptr2;
ResCleanNode(resptr2, FALSE, &ResNodeList, &ResNodeQueue); ResCleanNode(resptr2, FALSE, &ResNodeList, &ResNodeQueue);
ResDoneWithNode(resptr2); ResDoneWithNode(resptr2);
} }
} }
return(0); return(0);
} }
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
@ -599,7 +596,7 @@ ResExtractNet(startlist, goodies, cellname)
ResContactList = NULL; ResContactList = NULL;
ResOriginNode = NULL; ResOriginNode = NULL;
/* Pass back network pointers */ /* Pass back network pointers */
goodies->rg_maxres = 0; goodies->rg_maxres = 0;
goodies->rg_tilecount = 0; goodies->rg_tilecount = 0;
@ -608,9 +605,9 @@ ResExtractNet(startlist, goodies, cellname)
if (first) if (first)
{ {
ResInitializeConn(); ResInitializeConn();
first = 0; first = 0;
ResGetReCell(); ResGetReCell();
} }
/* Initialize Cell */ /* Initialize Cell */
@ -618,7 +615,7 @@ ResExtractNet(startlist, goodies, cellname)
if (cellname) if (cellname)
{ {
CellDef *def = DBCellLookDef(cellname); CellDef *def = DBCellLookDef(cellname);
if (def == (CellDef *) NULL) if (def == (CellDef *)NULL)
{ {
TxError("Error: No such cell \"%s\"\n", cellname); TxError("Error: No such cell \"%s\"\n", cellname);
return TRUE; return TRUE;
@ -629,8 +626,8 @@ ResExtractNet(startlist, goodies, cellname)
} }
else else
{ {
MagWindow *w = ToolGetBoxWindow(&scx.scx_area, (int *) NULL); MagWindow *w = ToolGetBoxWindow(&scx.scx_area, (int *)NULL);
if (w == (MagWindow *) NULL) if (w == (MagWindow *)NULL)
{ {
TxError("Sorry, the box must appear in one of the windows.\n"); TxError("Sorry, the box must appear in one of the windows.\n");
return TRUE; return TRUE;
@ -646,45 +643,45 @@ ResExtractNet(startlist, goodies, cellname)
lasttile = 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 #ifdef ARIEL
if ((ResOptionsFlags & ResOpt_Power) && if ((ResOptionsFlags & ResOpt_Power) &&
strcmp(fix->fp_name, goodies->rg_name) != 0) continue; strcmp(fix->fp_name, goodies->rg_name) != 0) continue;
#endif #endif
scx.scx_area.r_ll.p_x = fix->fp_loc.p_x-2; scx.scx_area.r_ll.p_x = fix->fp_loc.p_x-2;
scx.scx_area.r_ll.p_y = fix->fp_loc.p_y-2; scx.scx_area.r_ll.p_y = fix->fp_loc.p_y-2;
scx.scx_area.r_ur.p_x = fix->fp_loc.p_x+2; scx.scx_area.r_ur.p_x = fix->fp_loc.p_x+2;
scx.scx_area.r_ur.p_y = fix->fp_loc.p_y+2; scx.scx_area.r_ur.p_y = fix->fp_loc.p_y+2;
startpoint = fix->fp_loc; startpoint = fix->fp_loc;
/* Because fix->fp_ttype might come from a label with a sticky type /* Because fix->fp_ttype might come from a label with a sticky type
* that does not correspond exactly to the layer underneath, include * that does not correspond exactly to the layer underneath, include
* all connecting types. * all connecting types.
*/ */
TTMaskZero(&FirstTileMask); TTMaskZero(&FirstTileMask);
TTMaskSetMask(&FirstTileMask, &DBConnectTbl[fix->fp_ttype]); TTMaskSetMask(&FirstTileMask, &DBConnectTbl[fix->fp_ttype]);
newdevtiles = DBTreeCopyConnectDCS(&scx, &FirstTileMask, 0, newdevtiles = DBTreeCopyConnectDCS(&scx, &FirstTileMask, 0,
ResCopyMask, &TiPlaneRect, ResUse); ResCopyMask, &TiPlaneRect, ResUse);
for (tmp = newdevtiles; tmp && tmp->nextDev; tmp = tmp->nextDev); for (tmp = newdevtiles; tmp && tmp->nextDev; tmp = tmp->nextDev);
if (newdevtiles) if (newdevtiles)
{ {
if (DevTiles) if (DevTiles)
lasttile->nextDev = newdevtiles; lasttile->nextDev = newdevtiles;
else else
DevTiles = newdevtiles; DevTiles = newdevtiles;
lasttile = tmp; lasttile = tmp;
} }
} }
ExtResetTiles(scx.scx_use->cu_def, extUnInit); ExtResetTiles(scx.scx_use->cu_def, extUnInit);
/* find all contacts in design and note their position */ /* Find all contacts in design and note their position */
ResContactList = (ResContactPoint *) ExtFindRegions(ResUse->cu_def, ResContactList = (ResContactPoint *)ExtFindRegions(ResUse->cu_def,
&(ResUse->cu_def->cd_bbox), &(ResUse->cu_def->cd_bbox),
&DBAllButSpaceAndDRCBits, &DBAllButSpaceAndDRCBits,
ResConnectWithSD, extUnInit, ResFirst, ResConnectWithSD, extUnInit, ResFirst,
@ -702,16 +699,16 @@ ResExtractNet(startlist, goodies, cellname)
for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++) for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++)
{ {
Plane *plane = ResUse->cu_def->cd_planes[pNum]; Plane *plane = ResUse->cu_def->cd_planes[pNum];
Rect *rect = &ResUse->cu_def->cd_bbox; Rect *rect = &ResUse->cu_def->cd_bbox;
ResFracture(plane, rect); ResFracture(plane, rect);
(void) DBSrPaintClient((Tile *) NULL,plane,rect, (void) DBSrPaintClient((Tile *) NULL, plane, rect,
&DBAllButSpaceAndDRCBits, &DBAllButSpaceAndDRCBits,
(ClientData) CLIENTDEFAULT, ResAddPlumbing, (ClientData) CLIENTDEFAULT, ResAddPlumbing,
(ClientData) &ResDevList); (ClientData) &ResDevList);
} }
/* Finish preprocessing. */ /* Finish preprocessing. */
ResMakePortBreakpoints(ResUse->cu_def); ResMakePortBreakpoints(ResUse->cu_def);
ResMakeLabelBreakpoints(ResUse->cu_def); ResMakeLabelBreakpoints(ResUse->cu_def);
@ -721,24 +718,24 @@ ResExtractNet(startlist, goodies, cellname)
#ifdef LAPLACE #ifdef LAPLACE
if (ResOptionsFlags & ResOpt_DoLaplace) if (ResOptionsFlags & ResOpt_DoLaplace)
{ {
for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++) for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++)
{ {
Plane *plane = ResUse->cu_def->cd_planes[pNum]; Plane *plane = ResUse->cu_def->cd_planes[pNum];
Rect *rect = &ResUse->cu_def->cd_bbox; Rect *rect = &ResUse->cu_def->cd_bbox;
Res1d(plane,rect); Res1d(plane, rect);
} }
} }
#endif #endif
#ifdef ARIEL #ifdef ARIEL
if (ResOptionsFlags & ResOpt_Power) if (ResOptionsFlags & ResOpt_Power)
{ {
for (fix = startlist; fix != NULL;fix=fix->fp_next) for (fix = startlist; fix != NULL; fix = fix->fp_next)
{ {
fix->fp_tile = ResUse->cu_def->cd_planes[DBPlane(fix->fp_ttype)]->pl_hint; fix->fp_tile = ResUse->cu_def->cd_planes[DBPlane(fix->fp_ttype)]->pl_hint;
GOTOPOINT(fix->fp_tile,&fix->fp_loc); GOTOPOINT(fix->fp_tile, &fix->fp_loc);
if (TiGetTypeExact(fix->fp_tile) == TT_SPACE) fix->fp_tile = NULL; if (TiGetTypeExact(fix->fp_tile) == TT_SPACE) fix->fp_tile = NULL;
} }
} }
#endif #endif
@ -766,25 +763,24 @@ void
ResCleanUpEverything() ResCleanUpEverything()
{ {
int pNum; int pNum;
resResistor *oldRes; resResistor *oldRes;
resDevice *oldDev; resDevice *oldDev;
ResContactPoint *oldCon; ResContactPoint *oldCon;
/* check integrity of internal database. Free up lists. */ /* Check integrity of internal database. Free up lists. */
for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++) for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++)
{ {
(void) DBSrPaintClient((Tile *) NULL,ResUse->cu_def->cd_planes[pNum], (void) DBSrPaintClient((Tile *)NULL, ResUse->cu_def->cd_planes[pNum],
&(ResUse->cu_def->cd_bbox),&DBAllButSpaceAndDRCBits, &(ResUse->cu_def->cd_bbox), &DBAllButSpaceAndDRCBits,
(ClientData) CLIENTDEFAULT,ResRemovePlumbing, (ClientData)CLIENTDEFAULT, ResRemovePlumbing,
(ClientData) NULL); (ClientData)NULL);
} }
while (ResNodeList != NULL) while (ResNodeList != NULL)
{ {
ResCleanNode(ResNodeList,TRUE,&ResNodeList,&ResNodeQueue); ResCleanNode(ResNodeList, TRUE, &ResNodeList, &ResNodeQueue);
} }
while (ResContactList != NULL) while (ResContactList != NULL)
{ {
@ -808,12 +804,9 @@ ResCleanUpEverything()
freeMagic((char *)oldDev); freeMagic((char *)oldDev);
} }
} }
DBCellClearDef(ResUse->cu_def); DBCellClearDef(ResUse->cu_def);
} }
/* /*
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
* *
@ -935,54 +928,55 @@ FindStartTile(goodies, SourcePoint)
t1 = TiGetType(tile); t1 = TiGetType(tile);
devptr = ExtCurStyle->exts_device[t1]; devptr = ExtCurStyle->exts_device[t1];
/* left */ /* left */
for (tp = BL(tile); BOTTOM(tp) < TOP(tile); tp=RT(tp)) for (tp = BL(tile); BOTTOM(tp) < TOP(tile); tp = RT(tp))
{ {
t2 = TiGetRightType(tp); t2 = TiGetRightType(tp);
if (TTMaskHasType(&(devptr->exts_deviceSDTypes[0]),t2)) if (TTMaskHasType(&(devptr->exts_deviceSDTypes[0]), t2))
{ {
SourcePoint->p_x = LEFT(tile); SourcePoint->p_x = LEFT(tile);
SourcePoint->p_y = (MIN(TOP(tile),TOP(tp))+ SourcePoint->p_y = (MIN(TOP(tile),TOP(tp)) +
MAX(BOTTOM(tile),BOTTOM(tp)))>>1; MAX(BOTTOM(tile), BOTTOM(tp))) >> 1;
return(tp); return(tp);
} }
} }
/* right */ /* right */
for (tp = TR(tile); TOP(tp) > BOTTOM(tile); tp=LB(tp)) for (tp = TR(tile); TOP(tp) > BOTTOM(tile); tp = LB(tp))
{ {
t2 = TiGetLeftType(tp); t2 = TiGetLeftType(tp);
if (TTMaskHasType(&(devptr->exts_deviceSDTypes[0]),t2)) if (TTMaskHasType(&(devptr->exts_deviceSDTypes[0]), t2))
{ {
SourcePoint->p_x = RIGHT(tile); SourcePoint->p_x = RIGHT(tile);
SourcePoint->p_y = (MIN(TOP(tile),TOP(tp))+ SourcePoint->p_y = (MIN(TOP(tile), TOP(tp))+
MAX(BOTTOM(tile),BOTTOM(tp)))>>1; MAX(BOTTOM(tile), BOTTOM(tp))) >> 1;
return(tp); return(tp);
} }
} }
/* top */ /* top */
for (tp = RT(tile); RIGHT(tp) > LEFT(tile); tp=BL(tp)) for (tp = RT(tile); RIGHT(tp) > LEFT(tile); tp = BL(tp))
{ {
t2 = TiGetBottomType(tp); t2 = TiGetBottomType(tp);
if (TTMaskHasType(&(devptr->exts_deviceSDTypes[0]),t2)) if (TTMaskHasType(&(devptr->exts_deviceSDTypes[0]), t2))
{ {
SourcePoint->p_y = TOP(tile); SourcePoint->p_y = TOP(tile);
SourcePoint->p_x = (MIN(RIGHT(tile),RIGHT(tp))+ SourcePoint->p_x = (MIN(RIGHT(tile),RIGHT(tp)) +
MAX(LEFT(tile),LEFT(tp)))>>1; MAX(LEFT(tile), LEFT(tp))) >> 1;
return(tp); return(tp);
} }
} }
/* bottom */ /* bottom */
for (tp = LB(tile); LEFT(tp) < RIGHT(tile); tp=TR(tp)) for (tp = LB(tile); LEFT(tp) < RIGHT(tile); tp = TR(tp))
{ {
t2 = TiGetTopType(tp); t2 = TiGetTopType(tp);
if (TTMaskHasType(&(devptr->exts_deviceSDTypes[0]),t2)) if (TTMaskHasType(&(devptr->exts_deviceSDTypes[0]), t2))
{ {
SourcePoint->p_y = BOTTOM(tile); SourcePoint->p_y = BOTTOM(tile);
SourcePoint->p_x = (MIN(RIGHT(tile),RIGHT(tp))+ SourcePoint->p_x = (MIN(RIGHT(tile), RIGHT(tp)) +
MAX(LEFT(tile),LEFT(tp)))>>1; MAX(LEFT(tile), LEFT(tp))) >> 1;
return(tp); return(tp);
} }
} }
@ -1006,36 +1000,36 @@ FindStartTile(goodies, SourcePoint)
resDevice * resDevice *
ResGetDevice(pt) ResGetDevice(pt)
Point *pt; Point *pt;
{ {
Point workingPoint; Point workingPoint;
Tile *tile; Tile *tile;
int pnum; int pnum;
workingPoint.p_x = (*pt).p_x; workingPoint.p_x = (*pt).p_x;
workingPoint.p_y = (*pt).p_y; workingPoint.p_y = (*pt).p_y;
for (pnum= PL_TECHDEPBASE; pnum < DBNumPlanes; pnum++) for (pnum = PL_TECHDEPBASE; pnum < DBNumPlanes; pnum++)
{ {
if (TTMaskIntersect(&ExtCurStyle->exts_deviceMask,&DBPlaneTypes[pnum]) == 0) if (TTMaskIntersect(&ExtCurStyle->exts_deviceMask, &DBPlaneTypes[pnum]) == 0)
{ continue;
continue;
}
/*start at hint tile for device plane */
tile = ResUse->cu_def->cd_planes[pnum]->pl_hint;
GOTOPOINT(tile,&workingPoint);
if (IsSplit(tile)) /* Start at hint tile for device plane */
{
if (TTMaskHasType(&ExtCurStyle->exts_deviceMask, TiGetLeftType(tile)) tile = ResUse->cu_def->cd_planes[pnum]->pl_hint;
GOTOPOINT(tile, &workingPoint);
if (IsSplit(tile))
{
if (TTMaskHasType(&ExtCurStyle->exts_deviceMask, TiGetLeftType(tile))
|| TTMaskHasType(&ExtCurStyle->exts_deviceMask, TiGetRightType(tile))) || TTMaskHasType(&ExtCurStyle->exts_deviceMask, TiGetRightType(tile)))
return(((tileJunk *)tile->ti_client)->deviceList); return (((tileJunk *)tile->ti_client)->deviceList);
} }
else if (TTMaskHasType(&ExtCurStyle->exts_deviceMask, TiGetType(tile))) else if (TTMaskHasType(&ExtCurStyle->exts_deviceMask, TiGetType(tile)))
{ {
return(((tileJunk *)tile->ti_client)->deviceList); return (((tileJunk *)tile->ti_client)->deviceList);
} }
} }
return (NULL); return NULL;
} }

File diff suppressed because it is too large Load Diff

View File

@ -171,16 +171,25 @@ ResPrintExtDev(outextfile, devices)
else else
fprintf(outextfile, " \"%s\"", subsName); fprintf(outextfile, " \"%s\"", subsName);
fprintf(outextfile, " \"%s\" %d %s \"%s\" %d %s \"%s\" %d %s\n", if (devices->gate != NULL)
devices->gate->name, fprintf(outextfile, " \"%s\" %d %s",
devices->layout->rd_length * 2, devices->gate->name,
devices->rs_gattr, devices->layout->rd_length * 2,
devices->source->name, devices->rs_gattr);
devices->layout->rd_width,
devices->rs_sattr, if (devices->source != NULL)
devices->drain->name, fprintf(outextfile, " \"%s\" %d %s",
devices->layout->rd_width, devices->source->name,
devices->rs_dattr); devices->layout->rd_width,
devices->rs_sattr);
if (devices->drain != NULL)
fprintf(outextfile, " \"%s\" %d %s",
devices->drain->name,
devices->layout->rd_width,
devices->rs_dattr);
fprintf(outextfile, "\n");
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -203,7 +203,7 @@ CmdExtResis(win, cmd)
TxCommand *cmd; TxCommand *cmd;
{ {
int i, j, k, option, value, saveFlags; int i, j, k, option, value, saveFlags;
static int init=1; static int init = 1;
static float tolerance, tdiTolerance, fhFrequency; static float tolerance, tdiTolerance, fhFrequency;
CellDef *mainDef; CellDef *mainDef;
CellUse *selectedUse; CellUse *selectedUse;
@ -264,6 +264,17 @@ typedef enum {
init = 0; init = 0;
} }
/* Initialize ResGlobalParams */
gparams.rg_ttype = TT_SPACE;
gparams.rg_Tdi = 0.0;
gparams.rg_nodecap = 0.0;
gparams.rg_maxres = 0.0;
gparams.rg_bigdevres = 0;
gparams.rg_tilecount = 0;
gparams.rg_status = 0;
gparams.rg_devloc = NULL;
gparams.rg_name = NULL;
option = (cmd->tx_argc > 1) ? Lookup(cmd->tx_argv[1], cmdExtresisCmd) option = (cmd->tx_argc > 1) ? Lookup(cmd->tx_argv[1], cmdExtresisCmd)
: RES_RUN; : RES_RUN;
@ -979,7 +990,7 @@ ResCheckSimNodes(celldef, resisdata)
t1->drain != t2->source)) break; t1->drain != t2->source)) break;
/* do parallel combination */ /* do parallel combination */
if (cumRes != 0.0 && t2->resistance != 0.0) if ((cumRes != 0.0) && (t2->resistance != 0.0))
{ {
cumRes = (cumRes * t2->resistance) / cumRes = (cumRes * t2->resistance) /
(cumRes + t2->resistance); (cumRes + t2->resistance);
@ -1016,32 +1027,32 @@ ResCheckSimNodes(celldef, resisdata)
gparams.rg_devloc = &node->drivepoint; gparams.rg_devloc = &node->drivepoint;
gparams.rg_status |= DRIVEONLY; gparams.rg_status |= DRIVEONLY;
} }
if (node->status & PORTNODE) if (node->status & PORTNODE)
{ {
/* The node is a port, not a device, so make */ /* The node is a port, not a device, so make */
/* sure rg_ttype is set accordingly. */ /* sure rg_ttype is set accordingly. */
gparams.rg_ttype = node->rs_ttype; gparams.rg_ttype = node->rs_ttype;
} }
} }
if (gparams.rg_devloc == NULL && node->status & FORCE) if ((gparams.rg_devloc == NULL) && (node->status & FORCE))
{ {
TxError("Node %s has force label but no drive point or " TxError("Node %s has force label but no drive point or "
"driving device\n",node->name); "driving device\n",node->name);
} }
if (minRes == FLT_MAX || gparams.rg_devloc == NULL) if ((minRes == FLT_MAX) || (gparams.rg_devloc == NULL))
{ {
continue; continue;
} }
gparams.rg_bigdevres = (int)minRes*OHMSTOMILLIOHMS; gparams.rg_bigdevres = (int)minRes * OHMSTOMILLIOHMS;
if (rctol == 0.0 || tol == 0.0) if ((rctol == 0.0) || (tol == 0.0))
{ {
ftolerance = 0.0; ftolerance = 0.0;
rctolerance = 0.0; rctolerance = 0.0;
} }
else else
{ {
ftolerance = minRes/tol; ftolerance = minRes / tol;
rctolerance = minRes/rctol; rctolerance = minRes / rctol;
} }
/* /*
@ -1049,7 +1060,7 @@ ResCheckSimNodes(celldef, resisdata)
* resistance? If so, extract net. * resistance? If so, extract net.
*/ */
if (node->resistance > ftolerance || node->status & FORCE || if ((node->resistance > ftolerance) || (node->status & FORCE) ||
(ResOpt_ExtractAll & ResOptionsFlags)) (ResOpt_ExtractAll & ResOptionsFlags))
{ {
ResFixPoint fp; ResFixPoint fp;
@ -1200,7 +1211,7 @@ ResFixUpConnections(simDev, layoutDev, simNode, nodename)
if (simDev->gate == simNode) if (simDev->gate == simNode)
{ {
if ((gate=layoutDev->rd_fet_gate) != NULL) 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 */ /* name, the new one won't be used, so we decrement resNodeNum */

File diff suppressed because it is too large Load Diff

View File

@ -417,11 +417,12 @@ HeapAdd(heap, pKey, id)
{ {
/* If odd then new entry is the right half of a pair */ /* If odd then new entry is the right half of a pair */
cmp = i; cmp = i;
if (i & 1) if ((i & 1) && (i != 1))
KEY_LE_COND(keyType, list, i, i-1, cmp = i-1); KEY_LE_COND(keyType, list, i, i-1, cmp = i-1);
/* Find parent. If 0 then at the root so quit */ /* Find parent. If 0 then at the root so quit */
if ((i >>= 1) == 0) return; if ((i >>= 1) == 0) return;
KEY_LE_COND(keyType, list, cmp, i, return); KEY_LE_COND(keyType, list, cmp, i, return);
list[0] = list[cmp]; list[cmp] = list[i]; list[i] = list[0]; list[0] = list[cmp]; list[cmp] = list[i]; list[i] = list[0];
heapify(heap, cmp); heapify(heap, cmp);
@ -434,11 +435,12 @@ HeapAdd(heap, pKey, id)
{ {
/* If odd then new entry is the right half of a pair */ /* If odd then new entry is the right half of a pair */
cmp = i; cmp = i;
if (i & 1) if ((i & 1) && (i != 1))
KEY_GE_COND(keyType, list, i, i-1, cmp = i-1); KEY_GE_COND(keyType, list, i, i-1, cmp = i-1);
/* Find parent. If 0 then at the root so quit */ /* Find parent. If 0 then at the root so quit */
if ((i >>= 1) == 0) return; if ((i >>= 1) == 0) return;
KEY_GE_COND(keyType, list, cmp, i, return); KEY_GE_COND(keyType, list, cmp, i, return);
list[0] = list[cmp]; list[cmp] = list[i]; list[i] = list[0]; list[0] = list[cmp]; list[cmp] = list[i]; list[i] = list[0];
heapify(heap, cmp); heapify(heap, cmp);