Another major refactoring of code in extresist. This gets rid of
several more questionable methods and allows extresist to find devices above nets that are part of substrate planes or terminals that exist on planes other than the device (like diodes, often). There are still likely much better ways to do this.
This commit is contained in:
parent
0efed5813e
commit
1db2567841
|
|
@ -230,8 +230,9 @@ ResStartTile(tile, x, y)
|
|||
#define IGNORE_BOTTOM 8
|
||||
|
||||
bool
|
||||
ResEachTile(tile)
|
||||
Tile *tile;
|
||||
ResEachTile(tile, devTiles)
|
||||
Tile *tile; /* Tile being processed */
|
||||
ResDevTile *devTiles; /* List of device tiles for reference */
|
||||
{
|
||||
Tile *tp;
|
||||
resNode *resptr;
|
||||
|
|
@ -452,7 +453,9 @@ ResEachTile(tile)
|
|||
}
|
||||
}
|
||||
|
||||
/* Check for terminals on other planes (e.g., capacitors, bipolars, ...) */
|
||||
/* Check for terminals on other planes (e.g., capacitors, bipolars, ...) */
|
||||
/* Note: Need to tag these tiles per device to avoid checking through */
|
||||
/* the device list for each tile. (To be done) */
|
||||
|
||||
if (TTMaskHasType(&ResTermTypesBitMask, t1))
|
||||
{
|
||||
|
|
@ -460,33 +463,30 @@ ResEachTile(tile)
|
|||
int pNum;
|
||||
TileTypeBitMask devMask;
|
||||
TileAndTerm tat;
|
||||
ResDevTile *devtile;
|
||||
ExtDevice *devptr;
|
||||
|
||||
TiToRect(tile, &r);
|
||||
|
||||
for (pNum = 0; pNum < DBNumPlanes; pNum++)
|
||||
for (devtile = devTiles; devtile; devtile = devtile->nextDev)
|
||||
{
|
||||
if (DBTypeOnPlane(t1, pNum)) continue;
|
||||
Tile *tp;
|
||||
TileType devtype = devtile->type;
|
||||
|
||||
for (devptr = ExtCurStyle->exts_device[t2]; devptr;
|
||||
devptr = devptr->exts_next)
|
||||
devptr = devtile->devptr;
|
||||
for (i = 0; i < devptr->exts_deviceSDCount; i++)
|
||||
{
|
||||
for (i = 0; !TTMaskIsZero(&devptr->exts_deviceSDTypes[i]); i++)
|
||||
if (TTMaskHasType(&devptr->exts_deviceSDTypes[i], t1))
|
||||
{
|
||||
/* Check if any type in the terminal type list exists on this
|
||||
* plane before calling the search function.
|
||||
*/
|
||||
TileTypeBitMask termtypes;
|
||||
|
||||
TTMaskAndMask3(&termtypes, &devptr->exts_deviceSDTypes[i],
|
||||
&DBPlaneTypes[pNum]);
|
||||
|
||||
if (TTMaskIsZero(&termtypes))
|
||||
if (GEO_OVERLAP(&devtile->area, &r))
|
||||
{
|
||||
tat.tat_tile = tile;
|
||||
tat.tat_term = i;
|
||||
DBSrPaintArea((Tile *)NULL, ResUse->cu_def->cd_planes[pNum],
|
||||
&r, &devptr->exts_deviceSDTypes[i],
|
||||
ResMultiPlaneFunc, (ClientData)&tat);
|
||||
Plane *plane = ResUse->cu_def->cd_planes[DBPlane(devtype)];
|
||||
xj = (r.r_xtop + r.r_xbot) / 2;
|
||||
yj = (r.r_ytop + r.r_ybot) / 2;
|
||||
tp = PlaneGetHint(plane);
|
||||
GOTOPOINT(tp, &devtile->area.r_ll);
|
||||
PlaneSetHint(plane, tp);
|
||||
ResNewTermDevice(tile, tp, i, xj, yj, OTHERPLANE, &ResNodeQueue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -500,26 +500,31 @@ ResEachTile(tile)
|
|||
Rect r;
|
||||
int pNum;
|
||||
TileTypeBitMask devMask;
|
||||
ResDevTile *devtile;
|
||||
ExtDevice *devptr;
|
||||
|
||||
TiToRect(tile, &r);
|
||||
|
||||
for (pNum = 0; pNum < DBNumPlanes; pNum++)
|
||||
for (devtile = devTiles; devtile; devtile = devtile->nextDev)
|
||||
{
|
||||
if (DBTypeOnPlane(t1, pNum)) continue;
|
||||
Tile *tp;
|
||||
TileType devtype = devtile->type;
|
||||
|
||||
/* NOTE: This is ridiculously inefficient and should be done
|
||||
* in a different way.
|
||||
*/
|
||||
devptr = devtile->devptr;
|
||||
|
||||
TTMaskZero(&devMask);
|
||||
for (t2 = TT_TECHDEPBASE; t2 < DBNumUserLayers; t2++)
|
||||
for (devptr = ExtCurStyle->exts_device[t2]; devptr;
|
||||
devptr = devptr->exts_next)
|
||||
if (TTMaskHasType(&devptr->exts_deviceSubstrateTypes, t1))
|
||||
TTMaskSetType(&devMask, t2);
|
||||
|
||||
DBSrPaintArea((Tile *)NULL, ResUse->cu_def->cd_planes[pNum],
|
||||
&r, &devMask, ResSubstrateFunc, (ClientData)&tile);
|
||||
if (TTMaskHasType(&devptr->exts_deviceSubstrateTypes, t1))
|
||||
{
|
||||
if (GEO_OVERLAP(&devtile->area, &r))
|
||||
{
|
||||
Plane *plane = ResUse->cu_def->cd_planes[DBPlane(devtype)];
|
||||
xj = (r.r_xtop + r.r_xbot) / 2;
|
||||
yj = (r.r_ytop + r.r_ybot) / 2;
|
||||
tp = PlaneGetHint(plane);
|
||||
GOTOPOINT(tp, &devtile->area.r_ll);
|
||||
PlaneSetHint(plane, tp);
|
||||
ResNewSubDevice(tile, tp, xj, yj, OTHERPLANE, &ResNodeQueue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -697,10 +697,10 @@ ResFindNewContactTiles(contacts)
|
|||
*/
|
||||
|
||||
int
|
||||
ResProcessTiles(resisdata, origin)
|
||||
ResProcessTiles(resisdata, origin, devices)
|
||||
ResisData *resisdata;
|
||||
Point *origin;
|
||||
|
||||
ResDevTile *devices;
|
||||
{
|
||||
Tile *startTile;
|
||||
int tilenum, merged;
|
||||
|
|
@ -718,7 +718,7 @@ ResProcessTiles(resisdata, origin)
|
|||
return 1;
|
||||
resCurrentNode = NULL;
|
||||
ResStartTile(startTile, origin->p_x, origin->p_y);
|
||||
(void) ResEachTile(startTile);
|
||||
(void) ResEachTile(startTile, devices);
|
||||
}
|
||||
#ifdef PARANOID
|
||||
else
|
||||
|
|
@ -755,7 +755,7 @@ ResProcessTiles(resisdata, origin)
|
|||
if ((ri->ri_status & RES_TILE_DONE) == 0)
|
||||
{
|
||||
resCurrentNode = resptr2;
|
||||
merged |= ResEachTile(tile);
|
||||
merged |= ResEachTile(tile, devices);
|
||||
}
|
||||
}
|
||||
rj->rj_status = TRUE;
|
||||
|
|
@ -781,7 +781,7 @@ ResProcessTiles(resisdata, origin)
|
|||
if (cp->cp_cnode[tilenum] == resptr2)
|
||||
{
|
||||
resCurrentNode = resptr2;
|
||||
merged |= ResEachTile(tile);
|
||||
merged |= ResEachTile(tile, devices);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1209,6 +1209,7 @@ ResExtractNet(node, resisdata, cellname)
|
|||
int pNum;
|
||||
int resMakeDevFunc();
|
||||
int resExpandDevFunc();
|
||||
int result;
|
||||
|
||||
/* Make sure all global network variables are reset */
|
||||
|
||||
|
|
@ -1336,7 +1337,6 @@ ResExtractNet(node, resisdata, cellname)
|
|||
DevTiles = NULL;
|
||||
for (tptr = node->devices; tptr; tptr = tptr->nextDev)
|
||||
{
|
||||
int result;
|
||||
int i;
|
||||
ExtDevice *devptr;
|
||||
|
||||
|
|
@ -1456,7 +1456,9 @@ ResExtractNet(node, resisdata, cellname)
|
|||
ResPreProcessDevices(DevTiles, ResDevList, ResUse->cu_def);
|
||||
|
||||
/* do extraction */
|
||||
if (ResProcessTiles(resisdata, &startpoint) != 0) return TRUE;
|
||||
result = ResProcessTiles(resisdata, &startpoint, DevTiles);
|
||||
ResFreeDevTiles(DevTiles);
|
||||
if (result != 0) return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1529,7 +1529,9 @@ ResFixUpConnections(extDev, layoutDev, extNode, nodename)
|
|||
*/
|
||||
devptr = extDev->rs_devptr;
|
||||
if (devptr->exts_deviceSDCount > 1)
|
||||
if (TTMaskEqual(&devptr->exts_deviceSDTypes[0], &devptr->exts_deviceSDTypes[1]))
|
||||
if (TTMaskIsZero(&devptr->exts_deviceSDTypes[1]) ||
|
||||
TTMaskEqual(&devptr->exts_deviceSDTypes[0],
|
||||
&devptr->exts_deviceSDTypes[1]))
|
||||
doPermute = TRUE;
|
||||
|
||||
if (extDev->layout == NULL)
|
||||
|
|
|
|||
|
|
@ -827,6 +827,33 @@ ResRemovePlumbing(tile, dinfo, arg)
|
|||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
*-------------------------------------------------------------------------
|
||||
*
|
||||
* ResFreeDevTiles --
|
||||
*
|
||||
* Free memory allocated to the DevTiles list.
|
||||
*
|
||||
* Results: None.
|
||||
*
|
||||
* Side effects: Frees memory.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
ResFreeDevTiles(TileList)
|
||||
ResDevTile *TileList;
|
||||
{
|
||||
ResDevTile *oldTile;
|
||||
|
||||
while (TileList != (ResDevTile *) NULL)
|
||||
{
|
||||
oldTile = TileList;
|
||||
TileList = TileList->nextDev;
|
||||
freeMagic((char *)oldTile);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*-------------------------------------------------------------------------
|
||||
|
|
@ -840,8 +867,7 @@ ResRemovePlumbing(tile, dinfo, arg)
|
|||
*
|
||||
* Results: none
|
||||
*
|
||||
* Side Effects: sets length and width of devices. "ResDevTile"
|
||||
* structures are freed.
|
||||
* Side Effects: sets length and width of devices.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
@ -853,14 +879,14 @@ ResPreProcessDevices(TileList, DeviceList, Def)
|
|||
CellDef *Def;
|
||||
{
|
||||
Tile *tile;
|
||||
ResDevTile *oldTile;
|
||||
ResDevTile *devTile;
|
||||
resInfo *tstruct;
|
||||
TileType tt, residue;
|
||||
int pNum;
|
||||
|
||||
while (TileList != (ResDevTile *) NULL)
|
||||
for (devTile = TileList; devTile; devTile = devTile->nextDev)
|
||||
{
|
||||
tt = TileList->type;
|
||||
tt = devTile->type;
|
||||
if (DBIsContact(tt))
|
||||
{
|
||||
/* Find which residue of the contact is a device. */
|
||||
|
|
@ -884,7 +910,7 @@ ResPreProcessDevices(TileList, DeviceList, Def)
|
|||
pNum = DBPlane(tt); /* always correct for non-contact types */
|
||||
|
||||
tile = PlaneGetHint(Def->cd_planes[pNum]);
|
||||
GOTOPOINT(tile, &(TileList->area.r_ll));
|
||||
GOTOPOINT(tile, &(devTile->area.r_ll));
|
||||
PlaneSetHint(Def->cd_planes[pNum], tile);
|
||||
|
||||
tt = TiGetType(tile);
|
||||
|
|
@ -895,23 +921,20 @@ ResPreProcessDevices(TileList, DeviceList, Def)
|
|||
!TTMaskHasType(&ExtCurStyle->exts_deviceMask, tt))
|
||||
{
|
||||
TxError("Bad Device Location at %d,%d\n",
|
||||
TileList->area.r_ll.p_x,
|
||||
TileList->area.r_ll.p_y);
|
||||
devTile->area.r_ll.p_x,
|
||||
devTile->area.r_ll.p_y);
|
||||
}
|
||||
else if ((tstruct->ri_status & RES_TILE_MARK) == 0)
|
||||
{
|
||||
resDevice *rd = tstruct->deviceList;
|
||||
|
||||
tstruct->ri_status |= RES_TILE_MARK;
|
||||
rd->rd_perim += TileList->perim;
|
||||
rd->rd_length += TileList->overlap;
|
||||
rd->rd_area += (TileList->area.r_xtop - TileList->area.r_xbot)
|
||||
* (TileList->area.r_ytop - TileList->area.r_ybot);
|
||||
rd->rd_perim += devTile->perim;
|
||||
rd->rd_length += devTile->overlap;
|
||||
rd->rd_area += (devTile->area.r_xtop - devTile->area.r_xbot)
|
||||
* (devTile->area.r_ytop - devTile->area.r_ybot);
|
||||
rd->rd_tiles++;
|
||||
}
|
||||
oldTile = TileList;
|
||||
TileList = TileList->nextDev;
|
||||
freeMagic((char *)oldTile);
|
||||
}
|
||||
|
||||
for (; DeviceList != NULL; DeviceList = DeviceList->rd_nextDev)
|
||||
|
|
|
|||
|
|
@ -593,6 +593,7 @@ extern void ResMergeNodes();
|
|||
extern void ResNewTermDevice();
|
||||
extern void ResNewSubDevice();
|
||||
extern void ResPreProcessDevices();
|
||||
extern void ResFreeDevTiles();
|
||||
extern void ResPrintDeviceList();
|
||||
extern void ResPrintExtDev();
|
||||
extern void ResPrintReference();
|
||||
|
|
|
|||
Loading…
Reference in New Issue