Corrections to the extresist code. Some of the changes are just

text formatting.  Made one critical correction to ResGetDevice() to
pass the device type;  otherwise, devices on different planes (e.g.,
MiM caps) with the same coordinate will always return the device on
the lowest plane, leading to incorrect results and an eventual crash
when the device record is free'd twice.
This commit is contained in:
Tim Edwards 2021-09-12 17:20:22 -04:00
parent 96b7c20c17
commit 02f42e7260
7 changed files with 131 additions and 136 deletions

View File

@ -1 +1 @@
8.3.205 8.3.206

View File

@ -291,7 +291,8 @@ ExtUnique(rootUse, option)
while (def = (CellDef *) StackPop(extDefStack)) while (def = (CellDef *) StackPop(extDefStack))
{ {
/* EXT_UNIQ_NOTOPPORTS: Use EXT_UNIQ_ALL on all cells other than the top */ /* EXT_UNIQ_NOTOPPORTS: Use EXT_UNIQ_ALL on all cells other than the top */
if ((option == EXT_UNIQ_NOTOPPORTS) && (StackLook(extDefStack) != NULL)) if ((option == EXT_UNIQ_NOTOPPORTS) &&
(StackLook(extDefStack) != (ClientData)NULL))
locoption = EXT_UNIQ_ALL; locoption = EXT_UNIQ_ALL;
else else
locoption = option; locoption = option;

View File

@ -1260,7 +1260,8 @@ FindStartTile(goodies, SourcePoint)
* *
* ResGetDevice -- Once the net is extracted, we still have to equate * ResGetDevice -- Once the net is extracted, we still have to equate
* the sim file devices with the layout devices. ResGetDevice * the sim file devices with the layout devices. ResGetDevice
* looks for a device at the given location. * looks for a device at the given location. "type" is also
* specified to that the right plane will be searched.
* *
* Results: returns device structure at location DevicePoint, if it * Results: returns device structure at location DevicePoint, if it
* exists. * exists.
@ -1271,9 +1272,9 @@ FindStartTile(goodies, SourcePoint)
*/ */
resDevice * resDevice *
ResGetDevice(pt) ResGetDevice(pt, type)
Point *pt; Point *pt;
TileType type;
{ {
Point workingPoint; Point workingPoint;
Tile *tile; Tile *tile;
@ -1282,10 +1283,7 @@ ResGetDevice(pt)
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++) pnum = DBPlane(type);
{
if (TTMaskIntersect(&ExtCurStyle->exts_deviceMask, &DBPlaneTypes[pnum]) == 0)
continue;
/* Start at hint tile for device plane */ /* Start at hint tile for device plane */
@ -1299,9 +1297,7 @@ ResGetDevice(pt)
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;
} }

View File

@ -257,8 +257,8 @@ ResCalcEastWest(tile, pendingList, doneList, resList)
#endif #endif
resistor->rr_value = resistor->rr_value =
(ExtCurStyle->exts_sheetResist[resistor->rr_tt] (ExtCurStyle->exts_sheetResist[resistor->rr_tt]
* (p2->br_loc.p_x-p1->br_loc.p_x)) / height; * (p2->br_loc.p_x - p1->br_loc.p_x)) / height;
rArea = ((p2->br_loc.p_x-p1->br_loc.p_x) * height) / 2; rArea = ((p2->br_loc.p_x - p1->br_loc.p_x) * height) / 2;
resistor->rr_connection1->rn_float.rn_area += rArea; resistor->rr_connection1->rn_float.rn_area += rArea;
resistor->rr_connection2->rn_float.rn_area += rArea; resistor->rr_connection2->rn_float.rn_area += rArea;
resistor->rr_float.rr_area = 0; resistor->rr_float.rr_area = 0;
@ -425,7 +425,7 @@ ResCalcNorthSouth(tile, pendingList, doneList, resList)
resistor->rr_value = resistor->rr_value =
(ExtCurStyle->exts_sheetResist[resistor->rr_tt] (ExtCurStyle->exts_sheetResist[resistor->rr_tt]
* (p2->br_loc.p_y - p1->br_loc.p_y)) / width; * (p2->br_loc.p_y - p1->br_loc.p_y)) / width;
rArea = ((p2->br_loc.p_y-p1->br_loc.p_y) * width) / 2; rArea = ((p2->br_loc.p_y - p1->br_loc.p_y) * width) / 2;
resistor->rr_connection1->rn_float.rn_area += rArea; resistor->rr_connection1->rn_float.rn_area += rArea;
resistor->rr_connection2->rn_float.rn_area += rArea; resistor->rr_connection2->rn_float.rn_area += rArea;
resistor->rr_float.rr_area = 0; resistor->rr_float.rr_area = 0;

View File

@ -86,12 +86,10 @@ ResDoneWithNode(resptr)
ResDeleteResPointer(rr1->rr_connection1, rr1); ResDeleteResPointer(rr1->rr_connection1, rr1);
ResDeleteResPointer(rr1->rr_connection2, rr1); ResDeleteResPointer(rr1->rr_connection2, rr1);
if (rr1->rr_connection1 == resptr) if (rr1->rr_connection1 == resptr)
{
resptr2 = rr1->rr_connection2; resptr2 = rr1->rr_connection2;
}else else
{
resptr2 = rr1->rr_connection1; resptr2 = rr1->rr_connection1;
}
ResMergeNodes(resptr2, resptr, &ResNodeQueue, &ResNodeList); ResMergeNodes(resptr2, resptr, &ResNodeQueue, &ResNodeList);
resptr2->rn_float.rn_area += rr1->rr_float.rr_area; resptr2->rn_float.rn_area += rr1->rr_float.rr_area;
ResEliminateResistor(rr1, &ResResList); ResEliminateResistor(rr1, &ResResList);
@ -144,9 +142,9 @@ ResFixRes(resptr, resptr2, resptr3, elimResis, newResis)
{ {
resElement *thisREl; resElement *thisREl;
resptr3->rn_float.rn_area += newResis->rr_value*resptr->rn_float.rn_area resptr3->rn_float.rn_area += newResis->rr_value * resptr->rn_float.rn_area
/ ((float)(newResis->rr_value + elimResis->rr_value)); / ((float)(newResis->rr_value + elimResis->rr_value));
resptr2->rn_float.rn_area += elimResis->rr_value*resptr->rn_float.rn_area resptr2->rn_float.rn_area += elimResis->rr_value * resptr->rn_float.rn_area
/ ((float)(newResis->rr_value + elimResis->rr_value)); / ((float)(newResis->rr_value + elimResis->rr_value));
newResis->rr_value += elimResis->rr_value; newResis->rr_value += elimResis->rr_value;
ASSERT(newResis->rr_value > 0, "series"); ASSERT(newResis->rr_value > 0, "series");
@ -435,7 +433,7 @@ ResParallelCheck(resptr)
{ {
r2 = rcell2->re_thisEl; r2 = rcell2->re_thisEl;
if (TTMaskHasType(ResNoMergeMask+r1->rr_tt,r2->rr_tt)) continue; if (TTMaskHasType(ResNoMergeMask+r1->rr_tt, r2->rr_tt)) continue;
if (((r1->rr_connection1 == r2->rr_connection1) && if (((r1->rr_connection1 == r2->rr_connection1) &&
(r1->rr_connection2 == r2->rr_connection2))|| (r1->rr_connection2 == r2->rr_connection2))||
((r1->rr_connection1 == r2->rr_connection2) && ((r1->rr_connection1 == r2->rr_connection2) &&
@ -540,7 +538,7 @@ ResTriangleCheck(resptr)
} }
n3 = (resNode *)mallocMagic((unsigned)(sizeof(resNode))); n3 = (resNode *)mallocMagic((unsigned)(sizeof(resNode)));
/* Where should the new node be `put'? It */ /* Where should the new node be put? It */
/* is arbitrarily assigned to the location */ /* is arbitrarily assigned to the location */
/* occupied by the first node. */ /* occupied by the first node. */

View File

@ -1660,7 +1660,7 @@ ResWriteExtFile(celldef, node, tol, rctol, nidx, eidx)
} }
for (ptr = node->firstDev; ptr != NULL; ptr=ptr->nextDev) for (ptr = node->firstDev; ptr != NULL; ptr=ptr->nextDev)
{ {
if (layoutDev = ResGetDevice(&ptr->thisDev->location)) if (layoutDev = ResGetDevice(&ptr->thisDev->location, ptr->thisDev->rs_ttype))
{ {
ResFixUpConnections(ptr->thisDev, layoutDev, node, newname); ResFixUpConnections(ptr->thisDev, layoutDev, node, newname);
} }

View File

@ -542,7 +542,7 @@ ResScrunchNet(reslist, pendingList, biglist, tolerance)
node1 = node2; node1 = node2;
} }
else else
ResMergeNodes(node1,node2,pendingList,biglist); ResMergeNodes(node1, node2, pendingList, biglist);
/* /*
* Try further simplification on net using ResDoneWithNode and * Try further simplification on net using ResDoneWithNode and
@ -553,7 +553,7 @@ ResScrunchNet(reslist, pendingList, biglist, tolerance)
node1->rn_status &= ~(RES_DONE_ONCE | FINISHED); node1->rn_status &= ~(RES_DONE_ONCE | FINISHED);
ResDoneWithNode(node1); ResDoneWithNode(node1);
while (*pendingList != NULL) while (*pendingList != NULL)
ResSimplifyNet(pendingList,biglist,reslist,tolerance); ResSimplifyNet(pendingList, biglist, reslist, tolerance);
} }
} }
@ -651,7 +651,7 @@ ResDistributeCapacitance(nodelist, totalcap)
} }
capperarea = FEMTOTOATTO * totalcap / totalarea; capperarea = FEMTOTOATTO * totalcap / totalarea;
for (workingNode = nodelist; workingNode != NULL; workingNode=workingNode->rn_more) for (workingNode = nodelist; workingNode != NULL; workingNode = workingNode->rn_more)
workingNode->rn_float.rn_area *= capperarea; workingNode->rn_float.rn_area *= capperarea;
} }
@ -719,7 +719,7 @@ ResCalculateChildCapacitance(me)
} }
/* Calculate child Capacitance */ /* Calculate child Capacitance */
for (workingRes = me->rn_re; workingRes != NULL; workingRes=workingRes->re_nextEl) for (workingRes = me->rn_re; workingRes != NULL; workingRes = workingRes->re_nextEl)
{ {
if (workingRes->re_thisEl->rr_connection1 == me && if (workingRes->re_thisEl->rr_connection1 == me &&
(workingRes->re_thisEl->rr_status & RES_TDI_IGNORE) == 0) (workingRes->re_thisEl->rr_status & RES_TDI_IGNORE) == 0)
@ -864,13 +864,13 @@ ResDoSimplify(tolerance, rctol, goodies)
resRemoveLoops = FALSE; resRemoveLoops = FALSE;
ResSetPathRes(); ResSetPathRes();
for (node = ResNodeList; node != NULL; node = node->rn_more) for (node = ResNodeList; node != NULL; node = node->rn_more)
bigres = MAX(bigres,node->rn_noderes); bigres = MAX(bigres, node->rn_noderes);
bigres /= OHMSTOMILLIOHMS; /* convert from milliohms to ohms */ bigres /= OHMSTOMILLIOHMS; /* convert from milliohms to ohms */
goodies->rg_maxres = bigres; goodies->rg_maxres = bigres;
#ifdef PARANOID #ifdef PARANOID
ResSanityChecks("ExtractSingleNet",ResResList,ResNodeList,ResDevList); ResSanityChecks("ExtractSingleNet", ResResList, ResNodeList, ResDevList);
#endif #endif
/* Is extracted network still greater than the tolerance? */ /* Is extracted network still greater than the tolerance? */
@ -986,13 +986,13 @@ ResDoSimplify(tolerance, rctol, goodies)
ResOriginNode->rn_less = NULL; ResOriginNode->rn_less = NULL;
ResNodeQueue = ResOriginNode; ResNodeQueue = ResOriginNode;
while (ResNodeQueue != NULL) while (ResNodeQueue != NULL)
ResSimplifyNet(&ResNodeQueue,&ResNodeList,&ResResList,millitolerance); ResSimplifyNet(&ResNodeQueue, &ResNodeList, &ResResList, millitolerance);
/* /*
* Call ResScrunchNet to eliminate any remaining under tolerance * Call ResScrunchNet to eliminate any remaining under tolerance
* resistors. * resistors.
*/ */
ResScrunchNet(&ResResList,&ResNodeQueue,&ResNodeList,millitolerance); ResScrunchNet(&ResResList, &ResNodeQueue, &ResNodeList, millitolerance);
} }
} }
return 0; return 0;