Additional changes, almost all stylistic, to make the resis/ section
style conform to the rest of the database. It is difficult to work with code written in a sloppy, random style.
This commit is contained in:
parent
9aa39f820f
commit
7f11020ab4
|
|
@ -43,111 +43,113 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
|||
*/
|
||||
|
||||
void
|
||||
ResSanityChecks(nodename,resistorList,nodeList,devlist)
|
||||
char *nodename;
|
||||
resResistor *resistorList;
|
||||
resNode *nodeList;
|
||||
resDevice *devlist;
|
||||
ResSanityChecks(nodename, resistorList, nodeList, devlist)
|
||||
char *nodename;
|
||||
resResistor *resistorList;
|
||||
resNode *nodeList;
|
||||
resDevice *devlist;
|
||||
|
||||
{
|
||||
resResistor *resistor;
|
||||
resNode *node;
|
||||
resDevice *dev;
|
||||
resElement *rcell;
|
||||
static Stack *resSanityStack = NULL;
|
||||
int reached,foundorigin;
|
||||
resResistor *resistor;
|
||||
resNode *node;
|
||||
resDevice *dev;
|
||||
resElement *rcell;
|
||||
static Stack *resSanityStack = NULL;
|
||||
int reached, foundorigin;
|
||||
|
||||
if (resSanityStack == NULL)
|
||||
{
|
||||
resSanityStack = StackNew(64);
|
||||
}
|
||||
for (node = nodeList; node != NULL; node=node->rn_more)
|
||||
{
|
||||
node->rn_status &= ~RES_REACHED_NODE;
|
||||
if (node->rn_why == RES_NODE_ORIGIN)
|
||||
if (resSanityStack == NULL)
|
||||
{
|
||||
resSanityStack = StackNew(64);
|
||||
}
|
||||
for (node = nodeList; node != NULL; node=node->rn_more)
|
||||
{
|
||||
node->rn_status &= ~RES_REACHED_NODE;
|
||||
if (node->rn_why == RES_NODE_ORIGIN)
|
||||
STACKPUSH((ClientData) node, resSanityStack);
|
||||
}
|
||||
for (resistor = resistorList; resistor != NULL; resistor = resistor->rr_nextResistor)
|
||||
{
|
||||
resistor->rr_status &= ~RES_REACHED_RESISTOR;
|
||||
}
|
||||
}
|
||||
for (resistor = resistorList; resistor != NULL; resistor = resistor->rr_nextResistor)
|
||||
{
|
||||
resistor->rr_status &= ~RES_REACHED_RESISTOR;
|
||||
}
|
||||
|
||||
/* Check 1- Are the resistors and nodes all connected? */
|
||||
while (!StackEmpty(resSanityStack))
|
||||
{
|
||||
node = (resNode *)STACKPOP(resSanityStack);
|
||||
if (node->rn_status & RES_REACHED_NODE) continue;
|
||||
node->rn_status |= RES_REACHED_NODE;
|
||||
for (rcell = node->rn_re; rcell != NULL; rcell=rcell->re_nextEl)
|
||||
{
|
||||
resistor = rcell->re_thisEl;
|
||||
if (resistor->rr_status & RES_REACHED_RESISTOR) continue;
|
||||
resistor->rr_status |= RES_REACHED_RESISTOR;
|
||||
if (resistor->rr_connection1 != node &&
|
||||
/* Check: Are the resistors and nodes all connected? */
|
||||
while (!StackEmpty(resSanityStack))
|
||||
{
|
||||
node = (resNode *)STACKPOP(resSanityStack);
|
||||
if (node->rn_status & RES_REACHED_NODE) continue;
|
||||
node->rn_status |= RES_REACHED_NODE;
|
||||
for (rcell = node->rn_re; rcell != NULL; rcell = rcell->re_nextEl)
|
||||
{
|
||||
resistor = rcell->re_thisEl;
|
||||
if (resistor->rr_status & RES_REACHED_RESISTOR) continue;
|
||||
resistor->rr_status |= RES_REACHED_RESISTOR;
|
||||
if (resistor->rr_connection1 != node &&
|
||||
resistor->rr_connection2 != node)
|
||||
{
|
||||
TxError("Stray resElement pointer- node %s, pointer %d\n",nodename,rcell);
|
||||
continue;
|
||||
}
|
||||
if ((resistor->rr_connection1->rn_status & RES_REACHED_NODE) == 0)
|
||||
{
|
||||
STACKPUSH((ClientData)resistor->rr_connection1,resSanityStack);
|
||||
}
|
||||
if ((resistor->rr_connection2->rn_status & RES_REACHED_NODE) == 0)
|
||||
{
|
||||
STACKPUSH((ClientData)resistor->rr_connection2,resSanityStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (resistor = resistorList; resistor != NULL; resistor = resistor->rr_nextResistor)
|
||||
{
|
||||
if ((resistor->rr_status & RES_REACHED_RESISTOR) == 0)
|
||||
{
|
||||
TxError("Unreached resistor in %s\n",nodename);
|
||||
}
|
||||
resistor->rr_status &= ~RES_REACHED_RESISTOR;
|
||||
{
|
||||
TxError("Stray resElement pointer- node %s, pointer %d\n",
|
||||
nodename, rcell);
|
||||
continue;
|
||||
}
|
||||
if ((resistor->rr_connection1->rn_status & RES_REACHED_NODE) == 0)
|
||||
{
|
||||
STACKPUSH((ClientData)resistor->rr_connection1, resSanityStack);
|
||||
}
|
||||
if ((resistor->rr_connection2->rn_status & RES_REACHED_NODE) == 0)
|
||||
{
|
||||
STACKPUSH((ClientData)resistor->rr_connection2, resSanityStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (resistor = resistorList; resistor != NULL; resistor = resistor->rr_nextResistor)
|
||||
{
|
||||
if ((resistor->rr_status & RES_REACHED_RESISTOR) == 0)
|
||||
{
|
||||
TxError("Unreached resistor in %s\n", nodename);
|
||||
}
|
||||
resistor->rr_status &= ~RES_REACHED_RESISTOR;
|
||||
}
|
||||
for (dev = devlist; dev != NULL; dev = dev->rd_nextDev)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if (dev->rd_status & RES_DEV_PLUG) continue;
|
||||
reached = FALSE;
|
||||
for (i=0;i != dev->rd_nterms;i++)
|
||||
{
|
||||
if (dev->rd_terminals[i] != NULL)
|
||||
{
|
||||
reached = TRUE;
|
||||
if ((dev->rd_terminals[i]->rn_status & RES_REACHED_NODE) == 0)
|
||||
{
|
||||
TxError("Device node %d unreached in %s\n",i,nodename);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (reached == 0)
|
||||
{
|
||||
TxError("Unreached device in %s at %d %d\n",
|
||||
nodename,
|
||||
dev->rd_inside.r_xbot,
|
||||
dev->rd_inside.r_ybot);
|
||||
}
|
||||
}
|
||||
foundorigin = 0;
|
||||
for (node = nodeList; node != NULL; node=node->rn_more)
|
||||
{
|
||||
if ((node->rn_status & RES_REACHED_NODE) == 0)
|
||||
{
|
||||
TxError("Unreached node in %s at %d, %d\n",nodename,node->rn_loc.p_x,node->rn_loc.p_y);
|
||||
}
|
||||
node->rn_status &= ~RES_REACHED_NODE;
|
||||
if (node->rn_why & RES_NODE_ORIGIN)
|
||||
{
|
||||
foundorigin = 1;
|
||||
}
|
||||
}
|
||||
if (foundorigin == 0)
|
||||
{
|
||||
TxError("Starting node not found in %s\n",nodename);
|
||||
}
|
||||
if (dev->rd_status & RES_DEV_PLUG) continue;
|
||||
reached = FALSE;
|
||||
for (i = 0; i != dev->rd_nterms; i++)
|
||||
{
|
||||
if (dev->rd_terminals[i] != NULL)
|
||||
{
|
||||
reached = TRUE;
|
||||
if ((dev->rd_terminals[i]->rn_status & RES_REACHED_NODE) == 0)
|
||||
{
|
||||
TxError("Device node %d unreached in %s\n", i, nodename);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (reached == 0)
|
||||
{
|
||||
TxError("Unreached device in %s at %d %d\n",
|
||||
nodename,
|
||||
dev->rd_inside.r_xbot,
|
||||
dev->rd_inside.r_ybot);
|
||||
}
|
||||
}
|
||||
foundorigin = 0;
|
||||
for (node = nodeList; node != NULL; node=node->rn_more)
|
||||
{
|
||||
if ((node->rn_status & RES_REACHED_NODE) == 0)
|
||||
{
|
||||
TxError("Unreached node in %s at %d, %d\n", nodename,
|
||||
node->rn_loc.p_x, node->rn_loc.p_y);
|
||||
}
|
||||
node->rn_status &= ~RES_REACHED_NODE;
|
||||
if (node->rn_why & RES_NODE_ORIGIN)
|
||||
{
|
||||
foundorigin = 1;
|
||||
}
|
||||
}
|
||||
if (foundorigin == 0)
|
||||
{
|
||||
TxError("Starting node not found in %s\n", nodename);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ int
|
|||
dbcConnectFuncDCS(tile, cx)
|
||||
Tile *tile;
|
||||
TreeContext *cx;
|
||||
|
||||
{
|
||||
struct conSrArg2 *csa2;
|
||||
Rect tileArea, *srArea, devArea, newarea;
|
||||
|
|
@ -85,112 +84,116 @@ dbcConnectFuncDCS(tile, cx)
|
|||
TiToRect(tile, &tileArea);
|
||||
srArea = &scx->scx_area;
|
||||
|
||||
if (((tileArea.r_xbot >= srArea->r_xtop-1) ||
|
||||
(tileArea.r_xtop <= srArea->r_xbot+1)) &&
|
||||
((tileArea.r_ybot >= srArea->r_ytop-1) ||
|
||||
(tileArea.r_ytop <= srArea->r_ybot+1)))
|
||||
if (((tileArea.r_xbot >= srArea->r_xtop - 1) ||
|
||||
(tileArea.r_xtop <= srArea->r_xbot + 1)) &&
|
||||
((tileArea.r_ybot >= srArea->r_ytop - 1) ||
|
||||
(tileArea.r_ytop <= srArea->r_ybot + 1)))
|
||||
return 0;
|
||||
|
||||
t1 = TiGetType(tile);
|
||||
if TTMaskHasType(&DiffTypeBitMask,t1)
|
||||
if TTMaskHasType(&DiffTypeBitMask, t1)
|
||||
{
|
||||
/* left */
|
||||
for (tp = BL(tile); BOTTOM(tp) < TOP(tile); tp=RT(tp))
|
||||
/* left */
|
||||
for (tp = BL(tile); BOTTOM(tp) < TOP(tile); tp = RT(tp))
|
||||
{
|
||||
t2 = TiGetType(tp);
|
||||
devptr = ExtCurStyle->exts_device[t2];
|
||||
if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask), t2) &&
|
||||
TTMaskHasType(&(devptr->exts_deviceSDTypes[0]), t1))
|
||||
{
|
||||
TiToRect(tp, &devArea);
|
||||
thisDev = (ResDevTile *) mallocMagic((unsigned)(sizeof(ResDevTile)));
|
||||
GeoTransRect(&scx->scx_trans, &devArea, &thisDev->area);
|
||||
thisDev->type = TiGetType(tp);
|
||||
thisDev->nextDev = DevList;
|
||||
DevList = thisDev;
|
||||
ResCalcPerimOverlap(thisDev, tp);
|
||||
}
|
||||
}
|
||||
|
||||
/* right */
|
||||
for (tp = TR(tile); TOP(tp) > BOTTOM(tile); tp=LB(tp))
|
||||
{
|
||||
t2 = TiGetType(tp);
|
||||
devptr = ExtCurStyle->exts_device[t2];
|
||||
if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask), t2) &&
|
||||
TTMaskHasType(&(devptr->exts_deviceSDTypes[0]), t1))
|
||||
{
|
||||
TiToRect(tp, &devArea);
|
||||
thisDev = (ResDevTile *) mallocMagic((unsigned)(sizeof(ResDevTile)));
|
||||
GeoTransRect(&scx->scx_trans, &devArea, &thisDev->area);
|
||||
thisDev->type = TiGetType(tp);
|
||||
thisDev->nextDev = DevList;
|
||||
DevList = thisDev;
|
||||
ResCalcPerimOverlap(thisDev, tp);
|
||||
}
|
||||
}
|
||||
|
||||
/* top */
|
||||
for (tp = RT(tile); RIGHT(tp) > LEFT(tile); tp = BL(tp))
|
||||
{
|
||||
t2 = TiGetType(tp);
|
||||
devptr = ExtCurStyle->exts_device[t2];
|
||||
if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask), t2) &&
|
||||
TTMaskHasType(&(devptr->exts_deviceSDTypes[0]), t1))
|
||||
{
|
||||
TiToRect(tp, &devArea);
|
||||
thisDev = (ResDevTile *) mallocMagic((unsigned)(sizeof(ResDevTile)));
|
||||
GeoTransRect(&scx->scx_trans, &devArea, &thisDev->area);
|
||||
thisDev->type = TiGetType(tp);
|
||||
thisDev->nextDev = DevList;
|
||||
DevList = thisDev;
|
||||
ResCalcPerimOverlap(thisDev, tp);
|
||||
}
|
||||
}
|
||||
|
||||
/* bottom */
|
||||
for (tp = LB(tile); LEFT(tp) < RIGHT(tile); tp = TR(tp))
|
||||
{
|
||||
t2 = TiGetType(tp);
|
||||
devptr = ExtCurStyle->exts_device[t2];
|
||||
if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask), t2) &&
|
||||
TTMaskHasType(&(devptr->exts_deviceSDTypes[0]), t1))
|
||||
{
|
||||
TiToRect(tp, &devArea);
|
||||
thisDev = (ResDevTile *) mallocMagic((unsigned)(sizeof(ResDevTile)));
|
||||
GeoTransRect(&scx->scx_trans, &devArea, &thisDev->area);
|
||||
thisDev->type = TiGetType(tp);
|
||||
thisDev->nextDev = DevList;
|
||||
DevList = thisDev;
|
||||
ResCalcPerimOverlap(thisDev, tp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if TTMaskHasType(&(ExtCurStyle->exts_deviceMask), t1)
|
||||
{
|
||||
t2 = TiGetType(tp);
|
||||
devptr = ExtCurStyle->exts_device[t2];
|
||||
if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask),t2) &&
|
||||
TTMaskHasType(&(devptr->exts_deviceSDTypes[0]),t1))
|
||||
{
|
||||
TiToRect(tp, &devArea);
|
||||
thisDev = (ResDevTile *) mallocMagic((unsigned)(sizeof(ResDevTile)));
|
||||
ResCalcPerimOverlap(thisDev,tp);
|
||||
GeoTransRect(&scx->scx_trans, &devArea, &thisDev->area);
|
||||
thisDev->type = TiGetType(tp);
|
||||
thisDev->nextDev = DevList;
|
||||
DevList = thisDev;
|
||||
}
|
||||
}
|
||||
/*right*/
|
||||
for (tp = TR(tile); TOP(tp) > BOTTOM(tile); tp=LB(tp))
|
||||
{
|
||||
t2 = TiGetType(tp);
|
||||
devptr = ExtCurStyle->exts_device[t2];
|
||||
if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask),t2) &&
|
||||
TTMaskHasType(&(devptr->exts_deviceSDTypes[0]),t1))
|
||||
{
|
||||
TiToRect(tp, &devArea);
|
||||
thisDev = (ResDevTile *) mallocMagic((unsigned)(sizeof(ResDevTile)));
|
||||
GeoTransRect(&scx->scx_trans, &devArea, &thisDev->area);
|
||||
thisDev->type = TiGetType(tp);
|
||||
thisDev->nextDev = DevList;
|
||||
DevList = thisDev;
|
||||
ResCalcPerimOverlap(thisDev,tp);
|
||||
}
|
||||
}
|
||||
/*top*/
|
||||
for (tp = RT(tile); RIGHT(tp) > LEFT(tile); tp=BL(tp))
|
||||
{
|
||||
t2 = TiGetType(tp);
|
||||
devptr = ExtCurStyle->exts_device[t2];
|
||||
if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask),t2) &&
|
||||
TTMaskHasType(&(devptr->exts_deviceSDTypes[0]),t1))
|
||||
{
|
||||
TiToRect(tp, &devArea);
|
||||
thisDev = (ResDevTile *) mallocMagic((unsigned)(sizeof(ResDevTile)));
|
||||
GeoTransRect(&scx->scx_trans, &devArea, &thisDev->area);
|
||||
thisDev->type = TiGetType(tp);
|
||||
thisDev->nextDev = DevList;
|
||||
DevList = thisDev;
|
||||
ResCalcPerimOverlap(thisDev,tp);
|
||||
}
|
||||
}
|
||||
/*bottom */
|
||||
for (tp = LB(tile); LEFT(tp) < RIGHT(tile); tp=TR(tp))
|
||||
{
|
||||
t2 = TiGetType(tp);
|
||||
devptr = ExtCurStyle->exts_device[t2];
|
||||
if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask),t2) &&
|
||||
TTMaskHasType(&(devptr->exts_deviceSDTypes[0]),t1))
|
||||
{
|
||||
TiToRect(tp, &devArea);
|
||||
thisDev = (ResDevTile *) mallocMagic((unsigned)(sizeof(ResDevTile)));
|
||||
GeoTransRect(&scx->scx_trans, &devArea, &thisDev->area);
|
||||
thisDev->type = TiGetType(tp);
|
||||
thisDev->nextDev = DevList;
|
||||
DevList = thisDev;
|
||||
ResCalcPerimOverlap(thisDev,tp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if TTMaskHasType(&(ExtCurStyle->exts_deviceMask),t1)
|
||||
{
|
||||
TiToRect(tile, &devArea);
|
||||
thisDev = (ResDevTile *) mallocMagic((unsigned)(sizeof(ResDevTile)));
|
||||
ResCalcPerimOverlap(thisDev,tile);
|
||||
GeoTransRect(&scx->scx_trans, &devArea, &thisDev->area);
|
||||
thisDev->type = TiGetType(tile);
|
||||
thisDev->nextDev = DevList;
|
||||
DevList = thisDev;
|
||||
TiToRect(tile, &devArea);
|
||||
thisDev = (ResDevTile *) mallocMagic((unsigned)(sizeof(ResDevTile)));
|
||||
ResCalcPerimOverlap(thisDev,tile);
|
||||
GeoTransRect(&scx->scx_trans, &devArea, &thisDev->area);
|
||||
thisDev->type = TiGetType(tile);
|
||||
thisDev->nextDev = DevList;
|
||||
DevList = thisDev;
|
||||
}
|
||||
|
||||
/* in some cases (primarily bipolar technology), we'll want to extract
|
||||
devices whose substrate terminals are part of the given region.
|
||||
The following does that check. (10-11-88)
|
||||
*/
|
||||
* devices whose substrate terminals are part of the given region.
|
||||
* The following does that check. (10-11-88)
|
||||
*/
|
||||
#ifdef ARIEL
|
||||
if (TTMaskHasType(&ResSubsTypeBitMask,t1) && (ResOptionsFlags & ResOpt_DoSubstrate))
|
||||
{
|
||||
TileTypeBitMask *mask = &ExtCurStyle->exts_subsTransistorTypes[t1];
|
||||
TileTypeBitMask *mask = &ExtCurStyle->exts_subsTransistorTypes[t1];
|
||||
|
||||
for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++)
|
||||
{
|
||||
if (TTMaskIntersect(&DBPlaneTypes[pNum], mask))
|
||||
{
|
||||
(void)DBSrPaintArea((Tile *) NULL,
|
||||
for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++)
|
||||
{
|
||||
if (TTMaskIntersect(&DBPlaneTypes[pNum], mask))
|
||||
{
|
||||
DBSrPaintArea((Tile *) NULL,
|
||||
scx->scx_use->cu_def->cd_planes[pNum],
|
||||
&tileArea,mask,resSubSearchFunc, (ClientData) cx);
|
||||
}
|
||||
}
|
||||
&tileArea, mask, resSubSearchFunc, (ClientData)cx);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
GeoTransRect(&scx->scx_trans, &tileArea, &newarea);
|
||||
|
|
@ -248,7 +251,6 @@ dbcConnectFuncDCS(tile, cx)
|
|||
DBTreeSrLabels(&scx2, connectMask, csa2->csa2_xMask, &tpath,
|
||||
TF_LABEL_ATTACH, dbcConnectLabelFunc,
|
||||
(ClientData)csa2);
|
||||
// DBCellCopyLabels(&scx2, connectMask, csa2->csa2_xMask, csa2->csa2_use, NULL);
|
||||
|
||||
/* Only extend those sides bordering the diagonal tile */
|
||||
|
||||
|
|
@ -256,12 +258,12 @@ dbcConnectFuncDCS(tile, cx)
|
|||
{
|
||||
if (dinfo & TT_SIDE) /* right */
|
||||
newarea.r_xtop += 1;
|
||||
else /* left */
|
||||
else /* left */
|
||||
newarea.r_xbot -= 1;
|
||||
if (((dinfo & TT_SIDE) >> 1)
|
||||
== (dinfo & TT_DIRECTION)) /* top */
|
||||
newarea.r_ytop += 1;
|
||||
else /* bottom */
|
||||
else /* bottom */
|
||||
newarea.r_ybot -= 1;
|
||||
}
|
||||
else
|
||||
|
|
@ -322,55 +324,43 @@ void
|
|||
ResCalcPerimOverlap(dev, tile)
|
||||
ResDevTile *dev;
|
||||
Tile *tile;
|
||||
|
||||
{
|
||||
Tile *tp;
|
||||
int t1;
|
||||
int overlap;
|
||||
|
||||
dev->perim = (TOP(tile)-BOTTOM(tile)-LEFT(tile)+RIGHT(tile))<<1;
|
||||
dev->perim = (TOP(tile) - BOTTOM(tile) - LEFT(tile) + RIGHT(tile)) << 1;
|
||||
overlap =0;
|
||||
|
||||
t1 = TiGetType(tile);
|
||||
/* left */
|
||||
for (tp = BL(tile); BOTTOM(tp) < TOP(tile); tp=RT(tp))
|
||||
{
|
||||
if TTMaskHasType(&(ExtCurStyle->exts_nodeConn[t1]),TiGetType(tp))
|
||||
{
|
||||
overlap += MIN(TOP(tile),TOP(tp))-
|
||||
MAX(BOTTOM(tile),BOTTOM(tp));
|
||||
}
|
||||
|
||||
/* left */
|
||||
for (tp = BL(tile); BOTTOM(tp) < TOP(tile); tp = RT(tp))
|
||||
{
|
||||
if TTMaskHasType(&(ExtCurStyle->exts_nodeConn[t1]), TiGetType(tp))
|
||||
overlap += MIN(TOP(tile), TOP(tp)) -
|
||||
MAX(BOTTOM(tile), BOTTOM(tp));
|
||||
}
|
||||
/*right*/
|
||||
|
||||
/* right */
|
||||
for (tp = TR(tile); TOP(tp) > BOTTOM(tile); tp=LB(tp))
|
||||
{
|
||||
if TTMaskHasType(&(ExtCurStyle->exts_nodeConn[t1]),TiGetType(tp))
|
||||
{
|
||||
overlap += MIN(TOP(tile),TOP(tp))-
|
||||
MAX(BOTTOM(tile),BOTTOM(tp));
|
||||
}
|
||||
|
||||
if TTMaskHasType(&(ExtCurStyle->exts_nodeConn[t1]), TiGetType(tp))
|
||||
overlap += MIN(TOP(tile), TOP(tp)) - MAX(BOTTOM(tile), BOTTOM(tp));
|
||||
}
|
||||
/*top*/
|
||||
for (tp = RT(tile); RIGHT(tp) > LEFT(tile); tp=BL(tp))
|
||||
|
||||
/* top */
|
||||
for (tp = RT(tile); RIGHT(tp) > LEFT(tile); tp = BL(tp))
|
||||
{
|
||||
if TTMaskHasType(&(ExtCurStyle->exts_nodeConn[t1]),TiGetType(tp))
|
||||
{
|
||||
overlap += MIN(RIGHT(tile),RIGHT(tp))-
|
||||
MAX(LEFT(tile),LEFT(tp));
|
||||
}
|
||||
|
||||
if TTMaskHasType(&(ExtCurStyle->exts_nodeConn[t1]), TiGetType(tp))
|
||||
overlap += MIN(RIGHT(tile), RIGHT(tp)) - MAX(LEFT(tile), LEFT(tp));
|
||||
}
|
||||
/*bottom */
|
||||
|
||||
/* bottom */
|
||||
for (tp = LB(tile); LEFT(tp) < RIGHT(tile); tp=TR(tp))
|
||||
{
|
||||
if TTMaskHasType(&(ExtCurStyle->exts_nodeConn[t1]),TiGetType(tp))
|
||||
{
|
||||
overlap += MIN(RIGHT(tile),RIGHT(tp))-
|
||||
MAX(LEFT(tile),LEFT(tp));
|
||||
}
|
||||
|
||||
if TTMaskHasType(&(ExtCurStyle->exts_nodeConn[t1]), TiGetType(tp))
|
||||
overlap += MIN(RIGHT(tile), RIGHT(tp)) - MAX(LEFT(tile), LEFT(tp));
|
||||
}
|
||||
dev->overlap = overlap;
|
||||
}
|
||||
|
|
@ -516,30 +506,28 @@ DBTreeCopyConnectDCS(scx, mask, xMask, connect, area, destUse)
|
|||
*/
|
||||
|
||||
int
|
||||
resSubSearchFunc(tile,cx)
|
||||
Tile *tile;
|
||||
TreeContext *cx;
|
||||
|
||||
|
||||
resSubSearchFunc(tile, cx)
|
||||
Tile *tile;
|
||||
TreeContext *cx;
|
||||
{
|
||||
ResDevTile *thisDev;
|
||||
Rect devArea;
|
||||
TileType t = TiGetType(tile);
|
||||
ExtDevice *devptr;
|
||||
ResDevTile *thisDev;
|
||||
Rect devArea;
|
||||
TileType t = TiGetType(tile);
|
||||
ExtDevice *devptr;
|
||||
|
||||
/* Right now, we're only going to extract substrate terminals for
|
||||
devices with only one diffusion terminal, principally bipolar
|
||||
devices.
|
||||
/* Right now, we're only going to extract substrate terminals for
|
||||
* devices with only one diffusion terminal, principally bipolar
|
||||
* devices.
|
||||
*/
|
||||
devptr = ExtCurStyle->exts_device[t]
|
||||
if (devptr->exts_deviceSDCount >1) return 0;
|
||||
devptr = ExtCurStyle->exts_device[t];
|
||||
if (devptr->exts_deviceSDCount > 1) return 0;
|
||||
TiToRect(tile, &devArea);
|
||||
thisDev = (ResDevTile *) mallocMagic((unsigned)(sizeof(ResDevTile)));
|
||||
GeoTransRect(&cx->tc_scx->scx_trans, &devArea, &thisDev->area);
|
||||
thisDev->type = t;
|
||||
thisDev->nextDev = DevList;
|
||||
DevList = thisDev;
|
||||
ResCalcPerimOverlap(thisDev,tile);
|
||||
ResCalcPerimOverlap(thisDev, tile);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,17 +46,16 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
|||
*/
|
||||
|
||||
void
|
||||
ResPrintNodeList(fp,list)
|
||||
FILE *fp;
|
||||
resNode *list;
|
||||
|
||||
ResPrintNodeList(fp, list)
|
||||
FILE *fp;
|
||||
resNode *list;
|
||||
{
|
||||
|
||||
for (; list != NULL; list = list->rn_more)
|
||||
{
|
||||
fprintf(fp, "node %p: (%d %d) r= %d\n",
|
||||
list,list->rn_loc.p_x,list->rn_loc.p_y,list->rn_noderes);
|
||||
}
|
||||
for (; list != NULL; list = list->rn_more)
|
||||
{
|
||||
fprintf(fp, "node %p: (%d %d) r= %d\n",
|
||||
list, list->rn_loc.p_x, list->rn_loc.p_y, list->rn_noderes);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -73,7 +72,7 @@ ResPrintNodeList(fp,list)
|
|||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
ResPrintResistorList(fp,list)
|
||||
ResPrintResistorList(fp, list)
|
||||
FILE *fp;
|
||||
resResistor *list;
|
||||
|
||||
|
|
@ -112,9 +111,9 @@ ResPrintResistorList(fp,list)
|
|||
*/
|
||||
|
||||
void
|
||||
ResPrintDeviceList(fp,list)
|
||||
FILE *fp;
|
||||
resDevice *list;
|
||||
ResPrintDeviceList(fp, list)
|
||||
FILE *fp;
|
||||
resDevice *list;
|
||||
|
||||
{
|
||||
static char termtype[] = {'g','s','d','c'};
|
||||
|
|
|
|||
565
resis/ResFract.c
565
resis/ResFract.c
|
|
@ -81,31 +81,30 @@ enumerate:
|
|||
if (SigInterruptPending)
|
||||
return (1);
|
||||
|
||||
if ((tt=TiGetType(resSrTile)) != TT_SPACE)
|
||||
if ((tt = TiGetType(resSrTile)) != TT_SPACE)
|
||||
{
|
||||
resTopTile = RT(resSrTile);
|
||||
while (RIGHT(resTopTile) > LEFT(resSrTile))
|
||||
{
|
||||
TileType ntt = TiGetType(resTopTile);
|
||||
|
||||
if (ntt != tt)
|
||||
{
|
||||
resTopTile=BL(resTopTile);
|
||||
continue;
|
||||
}
|
||||
/* ok, we may have found a concave corner */
|
||||
ResCheckConcavity(resSrTile,resTopTile,tt);
|
||||
if (resTopTile == NULL) break;
|
||||
if (BOTTOM(resTopTile) != TOP(resSrTile))
|
||||
{
|
||||
resTopTile = RT(resSrTile);
|
||||
}
|
||||
else
|
||||
{
|
||||
resTopTile=BL(resTopTile);
|
||||
}
|
||||
}
|
||||
resTopTile = RT(resSrTile);
|
||||
while (RIGHT(resTopTile) > LEFT(resSrTile))
|
||||
{
|
||||
TileType ntt = TiGetType(resTopTile);
|
||||
|
||||
if (ntt != tt)
|
||||
{
|
||||
resTopTile = BL(resTopTile);
|
||||
continue;
|
||||
}
|
||||
/* ok, we may have found a concave corner */
|
||||
ResCheckConcavity(resSrTile, resTopTile, tt);
|
||||
if (resTopTile == NULL) break;
|
||||
if (BOTTOM(resTopTile) != TOP(resSrTile))
|
||||
{
|
||||
resTopTile = RT(resSrTile);
|
||||
}
|
||||
else
|
||||
{
|
||||
resTopTile=BL(resTopTile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tpnew = TR(resSrTile);
|
||||
|
|
@ -134,7 +133,8 @@ enumerate:
|
|||
}
|
||||
|
||||
/* At left edge -- walk down to next tile along the left edge */
|
||||
for (resSrTile = LB(resSrTile); RIGHT(resSrTile) <= rect->r_xbot; resSrTile = TR(resSrTile))
|
||||
for (resSrTile = LB(resSrTile); RIGHT(resSrTile) <= rect->r_xbot;
|
||||
resSrTile = TR(resSrTile))
|
||||
/* Nothing */;
|
||||
}
|
||||
return (0);
|
||||
|
|
@ -157,88 +157,96 @@ enumerate:
|
|||
*/
|
||||
|
||||
void
|
||||
ResCheckConcavity(bot,top,tt)
|
||||
Tile *bot,*top;
|
||||
TileType tt;
|
||||
ResCheckConcavity(bot, top, tt)
|
||||
Tile *bot, *top;
|
||||
TileType tt;
|
||||
|
||||
{
|
||||
Tile *tp;
|
||||
int xlen,ylen;
|
||||
/* corner #1:
|
||||
XXXXXXX
|
||||
YYYYYYY
|
||||
^--here
|
||||
*/
|
||||
if (RIGHT(top) > RIGHT(bot) && TiGetType(TR(bot)) != tt)
|
||||
{
|
||||
int xpos = RIGHT(bot);
|
||||
int ypos = BOTTOM(top);
|
||||
xlen = xpos - resWalkleft(top,tt,xpos,ypos,NULL);
|
||||
ylen = resWalkup(top,tt,xpos,ypos,NULL) - ypos;
|
||||
if (xlen > ylen)
|
||||
{
|
||||
(void) resWalkup(top,tt,xpos,ypos,ResSplitX);
|
||||
}
|
||||
}
|
||||
if (resTopTile == NULL) return;
|
||||
/* corner #2:
|
||||
v--here
|
||||
XXXXXXX
|
||||
YYYYYYY
|
||||
*/
|
||||
if (RIGHT(top) < RIGHT(bot))
|
||||
{
|
||||
for (tp = TR(top);BOTTOM(tp) > BOTTOM(top);tp=LB(tp));
|
||||
if (TiGetType(tp) != tt)
|
||||
{
|
||||
int xpos = RIGHT(top);
|
||||
int ypos = BOTTOM(top);
|
||||
xlen = xpos-resWalkleft(top,tt,xpos,ypos,NULL);
|
||||
ylen = ypos-resWalkdown(bot,tt,xpos,ypos,NULL);
|
||||
if (xlen > ylen)
|
||||
{
|
||||
(void) resWalkdown(bot,tt,xpos,ypos,ResSplitX);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (resTopTile == NULL) return;
|
||||
/* corner #3:
|
||||
XXXXXXX
|
||||
YYYYYYY
|
||||
^--here
|
||||
*/
|
||||
if (LEFT(top) < LEFT(bot))
|
||||
{
|
||||
for (tp = BL(bot);TOP(tp) < TOP(bot);tp=RT(tp));
|
||||
if (TiGetType(tp) != tt)
|
||||
{
|
||||
int xpos = LEFT(bot);
|
||||
int ypos = BOTTOM(top);
|
||||
xlen = resWalkright(top,tt,xpos,ypos,NULL)- xpos;
|
||||
ylen = resWalkup(top,tt,xpos,ypos,NULL) - ypos;
|
||||
if (xlen > ylen)
|
||||
{
|
||||
(void) resWalkup(top,tt,xpos,ypos,ResSplitX);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (resTopTile == NULL) return;
|
||||
/* corner #4:
|
||||
v--here
|
||||
XXXXXXX
|
||||
YYYYYYY
|
||||
Tile *tp;
|
||||
int xlen, ylen;
|
||||
|
||||
/* corner #1:
|
||||
* XXXXXXX
|
||||
* YYYYYYY
|
||||
* ^--here
|
||||
*/
|
||||
if (LEFT(top) > LEFT(bot) && TiGetType(BL(top)) != tt)
|
||||
{
|
||||
int xpos = LEFT(top);
|
||||
int ypos = BOTTOM(top);
|
||||
xlen = resWalkright(top,tt,xpos,ypos,NULL)- xpos;
|
||||
ylen = ypos-resWalkdown(bot,tt,xpos,ypos,NULL);
|
||||
if (xlen > ylen)
|
||||
{
|
||||
(void) resWalkdown(bot,tt,xpos,ypos,ResSplitX);
|
||||
}
|
||||
}
|
||||
|
||||
if (RIGHT(top) > RIGHT(bot) && TiGetType(TR(bot)) != tt)
|
||||
{
|
||||
int xpos = RIGHT(bot);
|
||||
int ypos = BOTTOM(top);
|
||||
xlen = xpos - resWalkleft(top, tt, xpos, ypos, NULL);
|
||||
ylen = resWalkup(top, tt, xpos, ypos, NULL) - ypos;
|
||||
if (xlen > ylen)
|
||||
{
|
||||
(void) resWalkup(top, tt, xpos, ypos, ResSplitX);
|
||||
}
|
||||
}
|
||||
if (resTopTile == NULL) return;
|
||||
|
||||
/* corner #2:
|
||||
* v--here
|
||||
* XXXXXXX
|
||||
* YYYYYYY
|
||||
*/
|
||||
|
||||
if (RIGHT(top) < RIGHT(bot))
|
||||
{
|
||||
for (tp = TR(top); BOTTOM(tp) > BOTTOM(top); tp = LB(tp));
|
||||
if (TiGetType(tp) != tt)
|
||||
{
|
||||
int xpos = RIGHT(top);
|
||||
int ypos = BOTTOM(top);
|
||||
xlen = xpos - resWalkleft(top, tt, xpos, ypos, NULL);
|
||||
ylen = ypos - resWalkdown(bot, tt, xpos, ypos, NULL);
|
||||
if (xlen > ylen)
|
||||
{
|
||||
(void) resWalkdown(bot,tt,xpos,ypos,ResSplitX);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (resTopTile == NULL) return;
|
||||
|
||||
/* corner #3:
|
||||
* XXXXXXX
|
||||
* YYYYYYY
|
||||
* ^--here
|
||||
*/
|
||||
|
||||
if (LEFT(top) < LEFT(bot))
|
||||
{
|
||||
for (tp = BL(bot); TOP(tp) < TOP(bot); tp = RT(tp));
|
||||
if (TiGetType(tp) != tt)
|
||||
{
|
||||
int xpos = LEFT(bot);
|
||||
int ypos = BOTTOM(top);
|
||||
xlen = resWalkright(top, tt, xpos, ypos, NULL) - xpos;
|
||||
ylen = resWalkup(top, tt, xpos, ypos, NULL) - ypos;
|
||||
if (xlen > ylen)
|
||||
{
|
||||
(void) resWalkup(top, tt, xpos, ypos, ResSplitX);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (resTopTile == NULL) return;
|
||||
|
||||
/* corner #4:
|
||||
* v--here
|
||||
* XXXXXXX
|
||||
* YYYYYYY
|
||||
*/
|
||||
|
||||
if (LEFT(top) > LEFT(bot) && TiGetType(BL(top)) != tt)
|
||||
{
|
||||
int xpos = LEFT(top);
|
||||
int ypos = BOTTOM(top);
|
||||
xlen = resWalkright(top, tt, xpos, ypos, NULL) - xpos;
|
||||
ylen = ypos - resWalkdown(bot, tt, xpos, ypos, NULL);
|
||||
if (xlen > ylen)
|
||||
{
|
||||
(void) resWalkdown(bot, tt, xpos, ypos, ResSplitX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -259,151 +267,151 @@ ResCheckConcavity(bot,top,tt)
|
|||
*/
|
||||
|
||||
int
|
||||
resWalkup(tile,tt,xpos,ypos,func)
|
||||
Tile *tile;
|
||||
TileType tt;
|
||||
int xpos,ypos;
|
||||
Tile * (*func)();
|
||||
resWalkup(tile, tt, xpos, ypos, func)
|
||||
Tile *tile;
|
||||
TileType tt;
|
||||
int xpos,ypos;
|
||||
Tile * (*func)();
|
||||
|
||||
{
|
||||
Point pt;
|
||||
Tile *tp;
|
||||
Point pt;
|
||||
Tile *tp;
|
||||
|
||||
pt.p_x = xpos;
|
||||
while (TiGetType(tile) == tt)
|
||||
{
|
||||
if (xpos == LEFT(tile))
|
||||
{
|
||||
/* walk up left edge */
|
||||
for (tp = BL(tile);TOP(tp) <= ypos;tp=RT(tp));
|
||||
for (;BOTTOM(tp) < TOP(tile);tp=RT(tp))
|
||||
{
|
||||
if (TiGetType(tp) != tt) return(BOTTOM(tp));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (func) tile = (*func)(tile,xpos);
|
||||
}
|
||||
pt.p_y = TOP(tile);
|
||||
GOTOPOINT(tile,&pt);
|
||||
}
|
||||
return(BOTTOM(tile));
|
||||
pt.p_x = xpos;
|
||||
while (TiGetType(tile) == tt)
|
||||
{
|
||||
if (xpos == LEFT(tile))
|
||||
{
|
||||
/* walk up left edge */
|
||||
for (tp = BL(tile); TOP(tp) <= ypos; tp = RT(tp));
|
||||
for (; BOTTOM(tp) < TOP(tile); tp = RT(tp))
|
||||
{
|
||||
if (TiGetType(tp) != tt) return(BOTTOM(tp));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (func) tile = (*func)(tile,xpos);
|
||||
}
|
||||
pt.p_y = TOP(tile);
|
||||
GOTOPOINT(tile, &pt);
|
||||
}
|
||||
return(BOTTOM(tile));
|
||||
}
|
||||
|
||||
int
|
||||
resWalkdown(tile,tt,xpos,ypos,func)
|
||||
Tile *tile;
|
||||
TileType tt;
|
||||
int xpos,ypos;
|
||||
Tile * (*func)();
|
||||
resWalkdown(tile, tt, xpos, ypos, func)
|
||||
Tile *tile;
|
||||
TileType tt;
|
||||
int xpos, ypos;
|
||||
Tile * (*func)();
|
||||
|
||||
{
|
||||
Point pt;
|
||||
Tile *tp;
|
||||
Tile *endt;
|
||||
Point pt;
|
||||
Tile *tp;
|
||||
Tile *endt;
|
||||
|
||||
pt.p_x = xpos;
|
||||
while (TiGetType(tile) == tt)
|
||||
{
|
||||
if (xpos == LEFT(tile))
|
||||
{
|
||||
/* walk up left edge */
|
||||
endt = NULL;
|
||||
for (tp = BL(tile);BOTTOM(tp) < TOP(tile);tp=RT(tp))
|
||||
{
|
||||
if (TiGetType(tp) != tt)
|
||||
{
|
||||
if (BOTTOM(tp) < ypos) endt = tp;
|
||||
}
|
||||
}
|
||||
if (endt)
|
||||
{
|
||||
return TOP(endt);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (func) tile = (*func)(tile,xpos);
|
||||
}
|
||||
pt.p_y = BOTTOM(tile)-1;
|
||||
GOTOPOINT(tile,&pt);
|
||||
}
|
||||
return(TOP(tile));
|
||||
pt.p_x = xpos;
|
||||
while (TiGetType(tile) == tt)
|
||||
{
|
||||
if (xpos == LEFT(tile))
|
||||
{
|
||||
/* walk up left edge */
|
||||
endt = NULL;
|
||||
for (tp = BL(tile); BOTTOM(tp) < TOP(tile); tp = RT(tp))
|
||||
{
|
||||
if (TiGetType(tp) != tt)
|
||||
{
|
||||
if (BOTTOM(tp) < ypos) endt = tp;
|
||||
}
|
||||
}
|
||||
if (endt)
|
||||
{
|
||||
return TOP(endt);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (func) tile = (*func)(tile, xpos);
|
||||
}
|
||||
pt.p_y = BOTTOM(tile) - 1;
|
||||
GOTOPOINT(tile, &pt);
|
||||
}
|
||||
return(TOP(tile));
|
||||
}
|
||||
|
||||
int
|
||||
resWalkright(tile,tt,xpos,ypos,func)
|
||||
Tile *tile;
|
||||
TileType tt;
|
||||
int xpos,ypos;
|
||||
Tile * (*func)();
|
||||
resWalkright(tile, tt, xpos, ypos, func)
|
||||
Tile *tile;
|
||||
TileType tt;
|
||||
int xpos, ypos;
|
||||
Tile * (*func)();
|
||||
|
||||
{
|
||||
Point pt;
|
||||
Tile *tp;
|
||||
Point pt;
|
||||
Tile *tp;
|
||||
|
||||
pt.p_y = ypos;
|
||||
while (TiGetType(tile) == tt)
|
||||
{
|
||||
if (ypos == BOTTOM(tile))
|
||||
{
|
||||
/* walk along bottom edge */
|
||||
for (tp = LB(tile);LEFT(tp) < xpos;tp=TR(tp));
|
||||
for (;LEFT(tp) < RIGHT(tile);tp=TR(tp))
|
||||
{
|
||||
if (TiGetType(tp) != tt) return(LEFT(tp));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (func) tile = (*func)(tile,ypos);
|
||||
}
|
||||
pt.p_x = RIGHT(tile);
|
||||
GOTOPOINT(tile,&pt);
|
||||
}
|
||||
return(LEFT(tile));
|
||||
pt.p_y = ypos;
|
||||
while (TiGetType(tile) == tt)
|
||||
{
|
||||
if (ypos == BOTTOM(tile))
|
||||
{
|
||||
/* walk along bottom edge */
|
||||
for (tp = LB(tile); LEFT(tp) < xpos; tp = TR(tp));
|
||||
for (; LEFT(tp) < RIGHT(tile); tp = TR(tp))
|
||||
{
|
||||
if (TiGetType(tp) != tt) return(LEFT(tp));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (func) tile = (*func)(tile, ypos);
|
||||
}
|
||||
pt.p_x = RIGHT(tile);
|
||||
GOTOPOINT(tile, &pt);
|
||||
}
|
||||
return(LEFT(tile));
|
||||
}
|
||||
|
||||
int
|
||||
resWalkleft(tile,tt,xpos,ypos,func)
|
||||
Tile *tile;
|
||||
TileType tt;
|
||||
int xpos,ypos;
|
||||
Tile * (*func)();
|
||||
resWalkleft(tile, tt, xpos, ypos, func)
|
||||
Tile *tile;
|
||||
TileType tt;
|
||||
int xpos, ypos;
|
||||
Tile * (*func)();
|
||||
|
||||
{
|
||||
Point pt;
|
||||
Tile *tp;
|
||||
Tile *endt;
|
||||
Point pt;
|
||||
Tile *tp;
|
||||
Tile *endt;
|
||||
|
||||
pt.p_y = ypos;
|
||||
while (TiGetType(tile) == tt)
|
||||
{
|
||||
if (ypos == BOTTOM(tile))
|
||||
{
|
||||
/* walk along bottom edge */
|
||||
endt = NULL;
|
||||
for (tp = LB(tile);LEFT(tp) < RIGHT(tile);tp=TR(tp))
|
||||
{
|
||||
if (TiGetType(tp) != tt)
|
||||
{
|
||||
if (LEFT(tp) < xpos) endt = tp;
|
||||
}
|
||||
}
|
||||
if (endt)
|
||||
{
|
||||
return RIGHT(endt);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (func) tile = (*func)(tile,ypos);
|
||||
}
|
||||
pt.p_x = LEFT(tile)-1;
|
||||
GOTOPOINT(tile,&pt);
|
||||
}
|
||||
return(RIGHT(tile));
|
||||
pt.p_y = ypos;
|
||||
while (TiGetType(tile) == tt)
|
||||
{
|
||||
if (ypos == BOTTOM(tile))
|
||||
{
|
||||
/* walk along bottom edge */
|
||||
endt = NULL;
|
||||
for (tp = LB(tile); LEFT(tp) < RIGHT(tile); tp = TR(tp))
|
||||
{
|
||||
if (TiGetType(tp) != tt)
|
||||
{
|
||||
if (LEFT(tp) < xpos) endt = tp;
|
||||
}
|
||||
}
|
||||
if (endt)
|
||||
{
|
||||
return RIGHT(endt);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (func) tile = (*func)(tile, ypos);
|
||||
}
|
||||
pt.p_x = LEFT(tile) - 1;
|
||||
GOTOPOINT(tile, &pt);
|
||||
}
|
||||
return(RIGHT(tile));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -419,59 +427,60 @@ resWalkleft(tile,tt,xpos,ypos,func)
|
|||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
Tile *
|
||||
ResSplitX(tile,x)
|
||||
Tile *tile;
|
||||
int x;
|
||||
ResSplitX(tile, x)
|
||||
Tile *tile;
|
||||
int x;
|
||||
|
||||
{
|
||||
TileType tt = TiGetType(tile);
|
||||
Tile *tp = TiSplitX(tile,x);
|
||||
Tile *tp2;
|
||||
TileType tt = TiGetType(tile);
|
||||
Tile *tp = TiSplitX(tile, x);
|
||||
Tile *tp2;
|
||||
|
||||
TiSetBody(tp,tt);
|
||||
/* check to see if we can combine with the tiles above or below us */
|
||||
tp2 = RT(tile);
|
||||
if (TiGetType(tp2) == tt && LEFT(tp2) == LEFT(tile) && RIGHT(tp2) == RIGHT(tile))
|
||||
{
|
||||
if (tp2 == resSrTile)
|
||||
{
|
||||
if (resTopTile == tile) resTopTile = NULL;
|
||||
TiJoinY(tp2,tile,resFracPlane);
|
||||
tile = tp2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (resTopTile == tp2) resTopTile = NULL;
|
||||
TiJoinY(tile,tp2,resFracPlane);
|
||||
}
|
||||
}
|
||||
tp2 = LB(tile);
|
||||
if (TiGetType(tp2) == tt && LEFT(tp2) == LEFT(tile) && RIGHT(tp2) == RIGHT(tile))
|
||||
{
|
||||
if (tp2 == resSrTile)
|
||||
{
|
||||
if (resTopTile == tile) resTopTile = NULL;
|
||||
TiJoinY(tp2,tile,resFracPlane);
|
||||
tile = tp2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (resTopTile == tp2) resTopTile = NULL;
|
||||
TiJoinY(tile,tp2,resFracPlane);
|
||||
}
|
||||
}
|
||||
/* do the same checks with the newly created tile */
|
||||
tp2 = RT(tp);
|
||||
if (TiGetType(tp2) == tt && LEFT(tp2) == LEFT(tp) && RIGHT(tp2) == RIGHT(tp))
|
||||
{
|
||||
TiJoinY(tp2,tp,resFracPlane);
|
||||
tp = tp2;
|
||||
}
|
||||
tp2 = LB(tp);
|
||||
if (TiGetType(tp2) == tt && LEFT(tp2) == LEFT(tp) && RIGHT(tp2) == RIGHT(tp))
|
||||
{
|
||||
TiJoinY(tp2,tp,resFracPlane);
|
||||
}
|
||||
return tile;
|
||||
TiSetBody(tp,tt);
|
||||
/* check to see if we can combine with the tiles above or below us */
|
||||
tp2 = RT(tile);
|
||||
if (TiGetType(tp2) == tt && LEFT(tp2) == LEFT(tile) && RIGHT(tp2) == RIGHT(tile))
|
||||
{
|
||||
if (tp2 == resSrTile)
|
||||
{
|
||||
if (resTopTile == tile) resTopTile = NULL;
|
||||
TiJoinY(tp2, tile, resFracPlane);
|
||||
tile = tp2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (resTopTile == tp2) resTopTile = NULL;
|
||||
TiJoinY(tile, tp2, resFracPlane);
|
||||
}
|
||||
}
|
||||
tp2 = LB(tile);
|
||||
if (TiGetType(tp2) == tt && LEFT(tp2) == LEFT(tile) && RIGHT(tp2) == RIGHT(tile))
|
||||
{
|
||||
if (tp2 == resSrTile)
|
||||
{
|
||||
if (resTopTile == tile) resTopTile = NULL;
|
||||
TiJoinY(tp2, tile, resFracPlane);
|
||||
tile = tp2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (resTopTile == tp2) resTopTile = NULL;
|
||||
TiJoinY(tile, tp2, resFracPlane);
|
||||
}
|
||||
}
|
||||
/* do the same checks with the newly created tile */
|
||||
tp2 = RT(tp);
|
||||
if (TiGetType(tp2) == tt && LEFT(tp2) == LEFT(tp) && RIGHT(tp2) == RIGHT(tp))
|
||||
{
|
||||
TiJoinY(tp2, tp, resFracPlane);
|
||||
tp = tp2;
|
||||
}
|
||||
tp2 = LB(tp);
|
||||
if (TiGetType(tp2) == tt && LEFT(tp2) == LEFT(tp) && RIGHT(tp2) == RIGHT(tp))
|
||||
{
|
||||
TiJoinY(tp2, tp, resFracPlane);
|
||||
}
|
||||
return tile;
|
||||
}
|
||||
|
|
|
|||
158
resis/ResJunct.c
158
resis/ResJunct.c
|
|
@ -26,8 +26,6 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
|||
#include "textio/txcommands.h"
|
||||
#include "resis/resis.h"
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*-------------------------------------------------------------------------
|
||||
*
|
||||
|
|
@ -45,56 +43,56 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
|||
*/
|
||||
|
||||
void
|
||||
ResNewSDDevice(tile,tp,xj,yj,direction,PendingList)
|
||||
Tile *tile,*tp;
|
||||
int xj,yj,direction;
|
||||
resNode **PendingList;
|
||||
ResNewSDDevice(tile, tp, xj, yj, direction, PendingList)
|
||||
Tile *tile, *tp;
|
||||
int xj, yj, direction;
|
||||
resNode **PendingList;
|
||||
{
|
||||
resNode *resptr;
|
||||
resDevice *resDev;
|
||||
tElement *tcell;
|
||||
int newnode;
|
||||
tileJunk *j;
|
||||
resNode *resptr;
|
||||
resDevice *resDev;
|
||||
tElement *tcell;
|
||||
int newnode;
|
||||
tileJunk *j;
|
||||
|
||||
newnode = FALSE;
|
||||
j = (tileJunk *) tp->ti_client;
|
||||
resDev = j->deviceList;
|
||||
if ((j->sourceEdge & direction) != 0)
|
||||
newnode = FALSE;
|
||||
j = (tileJunk *) tp->ti_client;
|
||||
resDev = j->deviceList;
|
||||
if ((j->sourceEdge & direction) != 0)
|
||||
{
|
||||
if (resDev->rd_fet_source == (resNode *) NULL)
|
||||
{
|
||||
if (resDev->rd_fet_source == (resNode *) NULL)
|
||||
{
|
||||
resptr = (resNode *) mallocMagic((unsigned)(sizeof(resNode)));
|
||||
newnode = TRUE;
|
||||
resDev->rd_fet_source = resptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
resptr = resDev->rd_fet_source;
|
||||
}
|
||||
resptr = (resNode *) mallocMagic((unsigned)(sizeof(resNode)));
|
||||
newnode = TRUE;
|
||||
resDev->rd_fet_source = resptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (resDev->rd_fet_drain == (resNode *) NULL)
|
||||
{
|
||||
resptr = (resNode *) mallocMagic((unsigned)(sizeof(resNode)));
|
||||
newnode = TRUE;
|
||||
resDev->rd_fet_drain = resptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
resptr = resDev->rd_fet_drain;
|
||||
}
|
||||
resptr = resDev->rd_fet_source;
|
||||
}
|
||||
if (newnode)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (resDev->rd_fet_drain == (resNode *) NULL)
|
||||
{
|
||||
tcell = (tElement *) mallocMagic((unsigned)(sizeof(tElement)));
|
||||
tcell->te_nextt = NULL;
|
||||
tcell->te_thist = j->deviceList;
|
||||
InitializeNode(resptr,xj,yj,RES_NODE_DEVICE);
|
||||
resptr->rn_te = tcell;
|
||||
ResAddToQueue(resptr,PendingList);
|
||||
resptr = (resNode *) mallocMagic((unsigned)(sizeof(resNode)));
|
||||
newnode = TRUE;
|
||||
resDev->rd_fet_drain = resptr;
|
||||
}
|
||||
NEWBREAK(resptr,tile,xj,yj,NULL);
|
||||
else
|
||||
{
|
||||
resptr = resDev->rd_fet_drain;
|
||||
}
|
||||
}
|
||||
if (newnode)
|
||||
{
|
||||
tcell = (tElement *) mallocMagic((unsigned)(sizeof(tElement)));
|
||||
tcell->te_nextt = NULL;
|
||||
tcell->te_thist = j->deviceList;
|
||||
InitializeNode(resptr, xj, yj, RES_NODE_DEVICE);
|
||||
resptr->rn_te = tcell;
|
||||
ResAddToQueue(resptr, PendingList);
|
||||
}
|
||||
NEWBREAK(resptr, tile, xj, yj, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -113,49 +111,49 @@ ResNewSDDevice(tile,tp,xj,yj,direction,PendingList)
|
|||
|
||||
void
|
||||
ResProcessJunction(tile, tp, xj, yj, NodeList)
|
||||
Tile *tile, *tp;
|
||||
int xj,yj;
|
||||
resNode **NodeList;
|
||||
Tile *tile, *tp;
|
||||
int xj, yj;
|
||||
resNode **NodeList;
|
||||
{
|
||||
ResJunction *junction;
|
||||
resNode *resptr;
|
||||
jElement *jcell;
|
||||
tileJunk *j0 = (tileJunk *)tile->ti_client;
|
||||
tileJunk *j2 = (tileJunk *)tp->ti_client;
|
||||
ResJunction *junction;
|
||||
resNode *resptr;
|
||||
jElement *jcell;
|
||||
tileJunk *j0 = (tileJunk *)tile->ti_client;
|
||||
tileJunk *j2 = (tileJunk *)tp->ti_client;
|
||||
|
||||
#ifdef PARANOID
|
||||
if (tile == tp)
|
||||
{
|
||||
TxError("Junction being made between tile and itself \n");
|
||||
return;
|
||||
}
|
||||
if (tile == tp)
|
||||
{
|
||||
TxError("Junction being made between tile and itself \n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (j2->tj_status & RES_TILE_DONE) return;
|
||||
resptr = (resNode *) mallocMagic((unsigned)(sizeof(resNode)));
|
||||
resptr->rn_te = (tElement *) NULL;
|
||||
junction = (ResJunction *) mallocMagic((unsigned)(sizeof(ResJunction)));
|
||||
jcell = (jElement *) mallocMagic((unsigned)(sizeof(jElement)));
|
||||
InitializeNode(resptr,xj,yj,RES_NODE_JUNCTION);
|
||||
resptr->rn_je = jcell;
|
||||
ResAddToQueue(resptr,NodeList);
|
||||
if (j2->tj_status & RES_TILE_DONE) return;
|
||||
resptr = (resNode *) mallocMagic((unsigned)(sizeof(resNode)));
|
||||
resptr->rn_te = (tElement *) NULL;
|
||||
junction = (ResJunction *) mallocMagic((unsigned)(sizeof(ResJunction)));
|
||||
jcell = (jElement *) mallocMagic((unsigned)(sizeof(jElement)));
|
||||
InitializeNode(resptr, xj, yj, RES_NODE_JUNCTION);
|
||||
resptr->rn_je = jcell;
|
||||
ResAddToQueue(resptr, NodeList);
|
||||
|
||||
jcell->je_thisj = junction;
|
||||
jcell->je_nextj = NULL;
|
||||
junction->rj_status = FALSE;
|
||||
junction->rj_jnode = resptr;
|
||||
junction->rj_Tile[0] = tile;
|
||||
junction->rj_Tile[1] = tp;
|
||||
junction->rj_loc.p_x =xj;
|
||||
junction->rj_loc.p_y =yj;
|
||||
junction->rj_nextjunction[0] = j0->junctionList;
|
||||
j0->junctionList = junction;
|
||||
junction->rj_nextjunction[1] = j2->junctionList;
|
||||
j2->junctionList = junction;
|
||||
jcell->je_thisj = junction;
|
||||
jcell->je_nextj = NULL;
|
||||
junction->rj_status = FALSE;
|
||||
junction->rj_jnode = resptr;
|
||||
junction->rj_Tile[0] = tile;
|
||||
junction->rj_Tile[1] = tp;
|
||||
junction->rj_loc.p_x =xj;
|
||||
junction->rj_loc.p_y =yj;
|
||||
junction->rj_nextjunction[0] = j0->junctionList;
|
||||
j0->junctionList = junction;
|
||||
junction->rj_nextjunction[1] = j2->junctionList;
|
||||
j2->junctionList = junction;
|
||||
|
||||
NEWBREAK(junction->rj_jnode,tile,
|
||||
junction->rj_loc.p_x,junction->rj_loc.p_y,NULL);
|
||||
NEWBREAK(junction->rj_jnode,tile, junction->rj_loc.p_x,
|
||||
junction->rj_loc.p_y, NULL);
|
||||
|
||||
NEWBREAK(junction->rj_jnode,tp,
|
||||
junction->rj_loc.p_x,junction->rj_loc.p_y,NULL);
|
||||
NEWBREAK(junction->rj_jnode,tp, junction->rj_loc.p_x,
|
||||
junction->rj_loc.p_y, NULL);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -574,18 +574,18 @@ ResProcessTiles(goodies, origin)
|
|||
*/
|
||||
|
||||
bool
|
||||
ResExtractNet(startlist, goodies, cellname)
|
||||
ResFixPoint *startlist;
|
||||
ResExtractNet(fix, goodies, cellname)
|
||||
ResFixPoint *fix;
|
||||
ResGlobalParams *goodies;
|
||||
char *cellname;
|
||||
{
|
||||
SearchContext scx;
|
||||
int pNum;
|
||||
ResDevTile *DevTiles, *lasttile;
|
||||
ResDevTile *DevTiles;
|
||||
TileTypeBitMask FirstTileMask;
|
||||
Point startpoint;
|
||||
ResFixPoint *fix;
|
||||
static int first = 1;
|
||||
ResDevTile *newdevtiles, *tmp;
|
||||
|
||||
/* Make sure all global network variables are reset */
|
||||
|
||||
|
|
@ -601,7 +601,7 @@ ResExtractNet(startlist, goodies, cellname)
|
|||
goodies->rg_maxres = 0;
|
||||
goodies->rg_tilecount = 0;
|
||||
|
||||
/*set up internal stuff if this is the first time through */
|
||||
/* Set up internal stuff if this is the first time through */
|
||||
|
||||
if (first)
|
||||
{
|
||||
|
|
@ -640,43 +640,28 @@ ResExtractNet(startlist, goodies, cellname)
|
|||
|
||||
/* Copy Paint */
|
||||
DevTiles = NULL;
|
||||
lasttile = NULL;
|
||||
for (fix = startlist; fix != NULL; fix = fix->fp_next)
|
||||
{
|
||||
ResDevTile *newdevtiles, *tmp;
|
||||
|
||||
#ifdef ARIEL
|
||||
if ((ResOptionsFlags & ResOpt_Power) &&
|
||||
if ((ResOptionsFlags & ResOpt_Power) &&
|
||||
strcmp(fix->fp_name, goodies->rg_name) != 0) continue;
|
||||
#endif
|
||||
|
||||
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_ur.p_x = fix->fp_loc.p_x+2;
|
||||
scx.scx_area.r_ur.p_y = fix->fp_loc.p_y+2;
|
||||
startpoint = fix->fp_loc;
|
||||
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_ur.p_x = fix->fp_loc.p_x+2;
|
||||
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.
|
||||
*/
|
||||
TTMaskZero(&FirstTileMask);
|
||||
TTMaskSetMask(&FirstTileMask, &DBConnectTbl[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.
|
||||
*/
|
||||
TTMaskZero(&FirstTileMask);
|
||||
TTMaskSetMask(&FirstTileMask, &DBConnectTbl[fix->fp_ttype]);
|
||||
|
||||
newdevtiles = DBTreeCopyConnectDCS(&scx, &FirstTileMask, 0,
|
||||
DevTiles = DBTreeCopyConnectDCS(&scx, &FirstTileMask, 0,
|
||||
ResCopyMask, &TiPlaneRect, ResUse);
|
||||
|
||||
for (tmp = newdevtiles; tmp && tmp->nextDev; tmp = tmp->nextDev);
|
||||
if (newdevtiles)
|
||||
{
|
||||
if (DevTiles)
|
||||
lasttile->nextDev = newdevtiles;
|
||||
else
|
||||
DevTiles = newdevtiles;
|
||||
lasttile = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
ExtResetTiles(scx.scx_use->cu_def, extUnInit);
|
||||
|
||||
/* Find all contacts in design and note their position */
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ ResCalcNorthSouth(tile, pendingList, doneList, resList)
|
|||
*/
|
||||
|
||||
p1 = junk->breakList;
|
||||
if (p1->br_next == NULL)
|
||||
if (p1->br_next == NULL)
|
||||
{
|
||||
p1->br_this->rn_float.rn_area += width * (TOP(tile) - BOTTOM(tile));
|
||||
freeMagic((char *)p1);
|
||||
|
|
|
|||
|
|
@ -53,9 +53,10 @@ extern ResSimNode *ResOriginalNodes; /*Linked List of Nodes */
|
|||
int resNodeNum;
|
||||
|
||||
#ifdef LAPLACE
|
||||
int ResOptionsFlags = ResOpt_Simplify|ResOpt_Tdi|ResOpt_DoExtFile|ResOpt_CacheLaplace;
|
||||
int ResOptionsFlags = ResOpt_Simplify | ResOpt_Tdi | ResOpt_DoExtFile
|
||||
| ResOpt_CacheLaplace;
|
||||
#else
|
||||
int ResOptionsFlags = ResOpt_Simplify|ResOpt_Tdi|ResOpt_DoExtFile;
|
||||
int ResOptionsFlags = ResOpt_Simplify | ResOpt_Tdi | ResOpt_DoExtFile;
|
||||
#endif
|
||||
char *ResCurrentNode;
|
||||
|
||||
|
|
@ -478,9 +479,10 @@ typedef enum {
|
|||
gparams.rg_ttype = tt;
|
||||
gparams.rg_status = DRIVEONLY;
|
||||
oldoptions = ResOptionsFlags;
|
||||
ResOptionsFlags = ResOpt_DoSubstrate|ResOpt_Signal|ResOpt_Box;
|
||||
ResOptionsFlags = ResOpt_DoSubstrate | ResOpt_Signal | ResOpt_Box;
|
||||
#ifdef LAPLACE
|
||||
ResOptionsFlags |= (oldoptions & (ResOpt_CacheLaplace|ResOpt_DoLaplace));
|
||||
ResOptionsFlags |= (oldoptions &
|
||||
(ResOpt_CacheLaplace | ResOpt_DoLaplace));
|
||||
LaplaceMatchCount = 0;
|
||||
LaplaceMissCount = 0;
|
||||
#endif
|
||||
|
|
@ -488,13 +490,13 @@ typedef enum {
|
|||
fp.fp_loc = rect.r_ll;
|
||||
fp.fp_next = NULL;
|
||||
if (ResExtractNet(&fp, &gparams, NULL) != 0) return;
|
||||
ResPrintResistorList(stdout,ResResList);
|
||||
ResPrintDeviceList(stdout,ResRDevList);
|
||||
ResPrintResistorList(stdout, ResResList);
|
||||
ResPrintDeviceList(stdout, ResRDevList);
|
||||
#ifdef LAPLACE
|
||||
if (ResOptionsFlags & ResOpt_DoLaplace)
|
||||
{
|
||||
TxPrintf("Laplace solved: %d matched %d\n",
|
||||
LaplaceMissCount,LaplaceMatchCount);
|
||||
LaplaceMissCount, LaplaceMatchCount);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -521,11 +523,11 @@ typedef enum {
|
|||
return;
|
||||
#endif
|
||||
case RES_AMBIG:
|
||||
TxPrintf("Ambiguous option: %s\n",cmd->tx_argv[1]);
|
||||
TxPrintf("Ambiguous option: %s\n", cmd->tx_argv[1]);
|
||||
TxFlushOut();
|
||||
return;
|
||||
case RES_BAD:
|
||||
TxPrintf("Unknown option: %s\n",cmd->tx_argv[1]);
|
||||
TxPrintf("Unknown option: %s\n", cmd->tx_argv[1]);
|
||||
TxFlushOut();
|
||||
return;
|
||||
default:
|
||||
|
|
@ -548,7 +550,7 @@ typedef enum {
|
|||
}
|
||||
ResOptionsFlags |= ResOpt_Signal;
|
||||
#ifdef ARIEL
|
||||
ResOptionsFlags &= ~ResOpt_Power;
|
||||
ResOptionsFlags &= ~ResOpt_Power;
|
||||
#endif
|
||||
|
||||
resisdata.tolerance = tolerance;
|
||||
|
|
@ -610,8 +612,6 @@ resSubcircuitFunc(cellDef, rdata)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*-------------------------------------------------------------------------
|
||||
*
|
||||
|
|
@ -870,7 +870,7 @@ ResCheckSimNodes(celldef, resisdata)
|
|||
}
|
||||
if (ResOptionsFlags & ResOpt_DoLumpFile)
|
||||
{
|
||||
ResLumpFile = PaOpen(outfile,"w",".res.lump",".",(char *) NULL, (char **) NULL);
|
||||
ResLumpFile = PaOpen(outfile, "w", ".res.lump", ".", (char *)NULL, (char **)NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -879,7 +879,7 @@ ResCheckSimNodes(celldef, resisdata)
|
|||
if (ResOptionsFlags & ResOpt_FastHenry)
|
||||
{
|
||||
char *geofilename;
|
||||
ResFHFile = PaOpen(outfile,"w",".fh",".",(char *) NULL, &geofilename);
|
||||
ResFHFile = PaOpen(outfile, "w", ".fh", ".", (char *)NULL, &geofilename);
|
||||
TxPrintf("Writing FastHenry-format geometry file \"%s\"\n", geofilename);
|
||||
ResPortIndex = 0;
|
||||
}
|
||||
|
|
@ -1071,8 +1071,8 @@ ResCheckSimNodes(celldef, resisdata)
|
|||
fp.fp_next = NULL;
|
||||
if (ResExtractNet(&fp, &gparams, outfile) != 0)
|
||||
{
|
||||
TxError("Error in extracting node %s\n",node->name);
|
||||
// break; // Don't stop for one error. . .
|
||||
/* On error, don't output this net, but keep going */
|
||||
TxError("Error in extracting node %s\n", node->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1091,7 +1091,7 @@ ResCheckSimNodes(celldef, resisdata)
|
|||
}
|
||||
}
|
||||
#ifdef PARANOID
|
||||
ResSanityChecks(node->name,ResResList,ResNodeList,ResDevList);
|
||||
ResSanityChecks(node->name, ResResList, ResNodeList, ResDevList);
|
||||
#endif
|
||||
ResCleanUpEverything();
|
||||
}
|
||||
|
|
@ -1104,7 +1104,7 @@ ResCheckSimNodes(celldef, resisdata)
|
|||
|
||||
if (ResOptionsFlags & ResOpt_DoExtFile)
|
||||
{
|
||||
ResPrintExtDev(ResExtFile,ResRDevList);
|
||||
ResPrintExtDev(ResExtFile, ResRDevList);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1427,9 +1427,10 @@ void
|
|||
ResSortByGate(DevpointerList)
|
||||
devPtr **DevpointerList;
|
||||
{
|
||||
int changed=TRUE;
|
||||
int localchange=TRUE;
|
||||
devPtr *working, *last=NULL, *current, *gatelist=NULL;
|
||||
int changed = TRUE;
|
||||
int localchange = TRUE;
|
||||
devPtr *working, *current;
|
||||
devPtr *last = NULL, *gatelist = NULL;
|
||||
|
||||
working = *DevpointerList;
|
||||
while (working != NULL)
|
||||
|
|
@ -1555,7 +1556,7 @@ ResWriteLumpFile(node)
|
|||
{
|
||||
lumpedres = gparams.rg_maxres;
|
||||
}
|
||||
fprintf(ResLumpFile,"R %s %d\n", node->name, lumpedres);
|
||||
fprintf(ResLumpFile, "R %s %d\n", node->name, lumpedres);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
298
resis/ResUtils.c
298
resis/ResUtils.c
|
|
@ -62,27 +62,27 @@ ResFirst(tile, arg)
|
|||
|
||||
if (DBIsContact(t))
|
||||
{
|
||||
reg = (ResContactPoint *) mallocMagic((unsigned) (sizeof(ResContactPoint)));
|
||||
reg->cp_center.p_x = (LEFT(tile)+RIGHT(tile))>>1;
|
||||
reg->cp_center.p_y = (TOP(tile)+BOTTOM(tile))>>1;
|
||||
reg->cp_status = FALSE;
|
||||
reg->cp_type = t;
|
||||
reg->cp_width = RIGHT(tile)-LEFT(tile);
|
||||
reg->cp_height = TOP(tile)-BOTTOM(tile);
|
||||
for (i=0; i< LAYERS_PER_CONTACT; i++)
|
||||
{
|
||||
reg->cp_tile[i] = (Tile *) NULL;
|
||||
reg->cp_cnode[i] = (resNode *) NULL;
|
||||
}
|
||||
reg->cp_currentcontact = 0;
|
||||
reg->cp_rect.r_ll.p_x = tile->ti_ll.p_x;
|
||||
reg->cp_rect.r_ll.p_y = tile->ti_ll.p_y;
|
||||
reg->cp_rect.r_ur.p_x = RIGHT(tile);
|
||||
reg->cp_rect.r_ur.p_y = TOP(tile);
|
||||
reg->cp_contactTile = tile;
|
||||
/* Prepend it to the region list */
|
||||
reg->cp_nextcontact = (ResContactPoint *) arg->fra_region;
|
||||
arg->fra_region = (Region *) reg;
|
||||
reg = (ResContactPoint *) mallocMagic((unsigned) (sizeof(ResContactPoint)));
|
||||
reg->cp_center.p_x = (LEFT(tile) + RIGHT(tile)) >> 1;
|
||||
reg->cp_center.p_y = (TOP(tile) + BOTTOM(tile)) >> 1;
|
||||
reg->cp_status = FALSE;
|
||||
reg->cp_type = t;
|
||||
reg->cp_width = RIGHT(tile) - LEFT(tile);
|
||||
reg->cp_height = TOP(tile) - BOTTOM(tile);
|
||||
for (i = 0; i < LAYERS_PER_CONTACT; i++)
|
||||
{
|
||||
reg->cp_tile[i] = (Tile *) NULL;
|
||||
reg->cp_cnode[i] = (resNode *) NULL;
|
||||
}
|
||||
reg->cp_currentcontact = 0;
|
||||
reg->cp_rect.r_ll.p_x = tile->ti_ll.p_x;
|
||||
reg->cp_rect.r_ll.p_y = tile->ti_ll.p_y;
|
||||
reg->cp_rect.r_ur.p_x = RIGHT(tile);
|
||||
reg->cp_rect.r_ur.p_y = TOP(tile);
|
||||
reg->cp_contactTile = tile;
|
||||
/* Prepend it to the region list */
|
||||
reg->cp_nextcontact = (ResContactPoint *) arg->fra_region;
|
||||
arg->fra_region = (Region *) reg;
|
||||
}
|
||||
return((Region *) NULL);
|
||||
}
|
||||
|
|
@ -104,16 +104,16 @@ ResFirst(tile, arg)
|
|||
|
||||
int
|
||||
ResEach(tile, pNum, arg)
|
||||
Tile *tile;
|
||||
int pNum;
|
||||
FindRegion *arg;
|
||||
Tile *tile;
|
||||
int pNum;
|
||||
FindRegion *arg;
|
||||
{
|
||||
|
||||
if ( ((ResContactPoint *)(arg->fra_region))->cp_contactTile != tile)
|
||||
{
|
||||
(void) ResFirst(tile, arg);
|
||||
}
|
||||
return(0);
|
||||
if (((ResContactPoint *)(arg->fra_region))->cp_contactTile != tile)
|
||||
{
|
||||
ResFirst(tile, arg);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -135,22 +135,21 @@ ResEach(tile, pNum, arg)
|
|||
|
||||
int
|
||||
ResAddPlumbing(tile, arg)
|
||||
Tile *tile;
|
||||
ClientData *arg;
|
||||
|
||||
Tile *tile;
|
||||
ClientData *arg;
|
||||
{
|
||||
tileJunk *Junk,*junk2;
|
||||
static Stack *resDevStack=NULL;
|
||||
TileType loctype, t1;
|
||||
Tile *tp1,*tp2,*source;
|
||||
resDevice *resDev;
|
||||
ExtDevice *devptr;
|
||||
tileJunk *Junk, *junk2;
|
||||
static Stack *resDevStack = NULL;
|
||||
TileType loctype, t1;
|
||||
Tile *tp1, *tp2, *source;
|
||||
resDevice *resDev;
|
||||
ExtDevice *devptr;
|
||||
|
||||
if (resDevStack == NULL)
|
||||
resDevStack = StackNew(64);
|
||||
if (resDevStack == NULL)
|
||||
resDevStack = StackNew(64);
|
||||
|
||||
if (tile->ti_client == (ClientData) CLIENTDEFAULT)
|
||||
{
|
||||
if (tile->ti_client == (ClientData) CLIENTDEFAULT)
|
||||
{
|
||||
if (IsSplit(tile))
|
||||
loctype = (SplitSide(tile)) ? SplitRightType(tile) :
|
||||
SplitLeftType(tile);
|
||||
|
|
@ -165,7 +164,7 @@ ResAddPlumbing(tile, arg)
|
|||
|
||||
/* Count SD terminals of the device */
|
||||
nterms = 0;
|
||||
for (i = 0; ; i++)
|
||||
for (i = 0;; i++)
|
||||
{
|
||||
if (TTMaskIsZero(&(devptr->exts_deviceSDTypes[i]))) break;
|
||||
nterms++;
|
||||
|
|
@ -181,7 +180,7 @@ ResAddPlumbing(tile, arg)
|
|||
resDev = (resDevice *) mallocMagic((unsigned)(sizeof(resDevice)));
|
||||
resDev->rd_nterms = nterms;
|
||||
resDev->rd_terminals = (resNode **) mallocMagic(nterms * sizeof(resNode *));
|
||||
for (i=0; i != nterms;i++)
|
||||
for (i = 0; i != nterms; i++)
|
||||
resDev->rd_terminals[i] = (resNode *) NULL;
|
||||
|
||||
resDev->rd_tile = tile;
|
||||
|
|
@ -205,7 +204,7 @@ ResAddPlumbing(tile, arg)
|
|||
/* find diffusion (if present) to be source contact */
|
||||
|
||||
/* top */
|
||||
for (tp2= RT(tile); RIGHT(tp2) > LEFT(tile); tp2 = BL(tp2))
|
||||
for (tp2 = RT(tile); RIGHT(tp2) > LEFT(tile); tp2 = BL(tp2))
|
||||
{
|
||||
if TTMaskHasType(&(devptr->exts_deviceSDTypes[0]),
|
||||
TiGetBottomType(tp2))
|
||||
|
|
@ -218,9 +217,9 @@ ResAddPlumbing(tile, arg)
|
|||
}
|
||||
}
|
||||
|
||||
/*bottom*/
|
||||
/* bottom */
|
||||
if (source == NULL)
|
||||
for (tp2= LB(tile); LEFT(tp2) < RIGHT(tile); tp2 = TR(tp2))
|
||||
for (tp2 = LB(tile); LEFT(tp2) < RIGHT(tile); tp2 = TR(tp2))
|
||||
{
|
||||
if TTMaskHasType(&(devptr->exts_deviceSDTypes[0]),
|
||||
TiGetTopType(tp2))
|
||||
|
|
@ -233,9 +232,9 @@ ResAddPlumbing(tile, arg)
|
|||
}
|
||||
}
|
||||
|
||||
/*right*/
|
||||
/* right */
|
||||
if (source == NULL)
|
||||
for (tp2= TR(tile); TOP(tp2) > BOTTOM(tile); tp2 = LB(tp2))
|
||||
for (tp2 = TR(tile); TOP(tp2) > BOTTOM(tile); tp2 = LB(tp2))
|
||||
{
|
||||
if TTMaskHasType(&(devptr->exts_deviceSDTypes[0]),
|
||||
TiGetLeftType(tp2))
|
||||
|
|
@ -248,9 +247,9 @@ ResAddPlumbing(tile, arg)
|
|||
}
|
||||
}
|
||||
|
||||
/*left*/
|
||||
/* left */
|
||||
if (source == NULL)
|
||||
for (tp2= BL(tile); BOTTOM(tp2) < TOP(tile); tp2 = RT(tp2))
|
||||
for (tp2 = BL(tile); BOTTOM(tp2) < TOP(tile); tp2 = RT(tp2))
|
||||
{
|
||||
if TTMaskHasType(&(devptr->exts_deviceSDTypes[0]),
|
||||
TiGetRightType(tp2))
|
||||
|
|
@ -273,7 +272,7 @@ ResAddPlumbing(tile, arg)
|
|||
|
||||
if (source != (Tile *) NULL)
|
||||
{
|
||||
STACKPUSH((ClientData) (source),resDevStack);
|
||||
STACKPUSH((ClientData)source, resDevStack);
|
||||
}
|
||||
while (!StackEmpty(resDevStack))
|
||||
{
|
||||
|
|
@ -287,54 +286,54 @@ ResAddPlumbing(tile, arg)
|
|||
t1 = TiGetTypeExact(tp1);
|
||||
|
||||
/* top */
|
||||
for (tp2= RT(tp1); RIGHT(tp2) > LEFT(tp1); tp2 = BL(tp2))
|
||||
for (tp2 = RT(tp1); RIGHT(tp2) > LEFT(tp1); tp2 = BL(tp2))
|
||||
{
|
||||
if (TiGetBottomType(tp2) == t1)
|
||||
{
|
||||
tileJunk *j= resAddField(tp2);
|
||||
tileJunk *j = resAddField(tp2);
|
||||
if ((j->tj_status & RES_TILE_SD) ==0)
|
||||
{
|
||||
j->tj_status |= RES_TILE_SD;
|
||||
STACKPUSH((ClientData)tp2,resDevStack);
|
||||
STACKPUSH((ClientData)tp2, resDevStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*bottom*/
|
||||
for (tp2= LB(tp1); LEFT(tp2) < RIGHT(tp1); tp2 = TR(tp2))
|
||||
/* bottom */
|
||||
for (tp2 = LB(tp1); LEFT(tp2) < RIGHT(tp1); tp2 = TR(tp2))
|
||||
{
|
||||
if (TiGetTopType(tp2) == t1)
|
||||
{
|
||||
tileJunk *j= resAddField(tp2);
|
||||
tileJunk *j= resAddField(tp2);
|
||||
if ((j->tj_status & RES_TILE_SD) == 0)
|
||||
{
|
||||
j->tj_status |= RES_TILE_SD;
|
||||
STACKPUSH((ClientData) (tp2),resDevStack);
|
||||
STACKPUSH((ClientData)tp2, resDevStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*right*/
|
||||
for (tp2= TR(tp1); TOP(tp2) > BOTTOM(tp1); tp2 = LB(tp2))
|
||||
/* right */
|
||||
for (tp2 = TR(tp1); TOP(tp2) > BOTTOM(tp1); tp2 = LB(tp2))
|
||||
{
|
||||
if (TiGetLeftType(tp2) == t1)
|
||||
{
|
||||
tileJunk *j= resAddField(tp2);
|
||||
tileJunk *j= resAddField(tp2);
|
||||
if ((j->tj_status & RES_TILE_SD) == 0)
|
||||
{
|
||||
j->tj_status |= RES_TILE_SD;
|
||||
STACKPUSH((ClientData) (tp2),resDevStack);
|
||||
STACKPUSH((ClientData)tp2, resDevStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*left*/
|
||||
for (tp2= BL(tp1); BOTTOM(tp2) < TOP(tp1); tp2 = RT(tp2))
|
||||
/* left */
|
||||
for (tp2 = BL(tp1); BOTTOM(tp2) < TOP(tp1); tp2 = RT(tp2))
|
||||
{
|
||||
if (TiGetRightType(tp2) == t1)
|
||||
{
|
||||
tileJunk *j= resAddField(tp2);
|
||||
tileJunk *j= resAddField(tp2);
|
||||
if ((j->tj_status & RES_TILE_SD) == 0)
|
||||
{
|
||||
j->tj_status |= RES_TILE_SD;
|
||||
STACKPUSH((ClientData) (tp2),resDevStack);
|
||||
STACKPUSH((ClientData)tp2, resDevStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -342,12 +341,12 @@ ResAddPlumbing(tile, arg)
|
|||
|
||||
/* find rest of device; search for source edges */
|
||||
|
||||
STACKPUSH((ClientData) (tile), resDevStack);
|
||||
STACKPUSH((ClientData)tile, resDevStack);
|
||||
while (!StackEmpty(resDevStack))
|
||||
{
|
||||
tileJunk *j0;
|
||||
tileJunk *j0;
|
||||
|
||||
tp1= (Tile *) STACKPOP(resDevStack);
|
||||
tp1 = (Tile *) STACKPOP(resDevStack);
|
||||
if (IsSplit(tp1))
|
||||
{
|
||||
t1 = (SplitSide(tp1)) ? SplitRightType(tp1) :
|
||||
|
|
@ -359,13 +358,13 @@ ResAddPlumbing(tile, arg)
|
|||
devptr = ExtCurStyle->exts_device[t1];
|
||||
j0 = (tileJunk *) tp1->ti_client;
|
||||
/* top */
|
||||
for (tp2= RT(tp1); RIGHT(tp2) > LEFT(tp1); tp2 = BL(tp2))
|
||||
for (tp2 = RT(tp1); RIGHT(tp2) > LEFT(tp1); tp2 = BL(tp2))
|
||||
{
|
||||
if ((TiGetBottomType(tp2) == t1) &&
|
||||
(tp2->ti_client == (ClientData) CLIENTDEFAULT))
|
||||
{
|
||||
Junk = resAddField(tp2);
|
||||
STACKPUSH((ClientData)(tp2),resDevStack);
|
||||
STACKPUSH((ClientData)tp2, resDevStack);
|
||||
Junk->deviceList = resDev;
|
||||
Junk->tj_status |= RES_TILE_DEV;
|
||||
|
||||
|
|
@ -378,14 +377,14 @@ ResAddPlumbing(tile, arg)
|
|||
j0->sourceEdge |= TOPEDGE;
|
||||
}
|
||||
}
|
||||
/*bottom*/
|
||||
for (tp2= LB(tp1); LEFT(tp2) < RIGHT(tp1); tp2 = TR(tp2))
|
||||
/* bottom */
|
||||
for (tp2 = LB(tp1); LEFT(tp2) < RIGHT(tp1); tp2 = TR(tp2))
|
||||
{
|
||||
if ((TiGetTopType(tp2) == t1) &&
|
||||
(tp2->ti_client == (ClientData) CLIENTDEFAULT))
|
||||
{
|
||||
Junk = resAddField(tp2);
|
||||
STACKPUSH((ClientData)(tp2),resDevStack);
|
||||
STACKPUSH((ClientData)tp2, resDevStack);
|
||||
Junk->deviceList = resDev;
|
||||
Junk->tj_status |= RES_TILE_DEV;
|
||||
}
|
||||
|
|
@ -397,33 +396,33 @@ ResAddPlumbing(tile, arg)
|
|||
j0->sourceEdge |= BOTTOMEDGE;
|
||||
}
|
||||
}
|
||||
/*right*/
|
||||
for (tp2= TR(tp1); TOP(tp2) > BOTTOM(tp1); tp2 = LB(tp2))
|
||||
/* right */
|
||||
for (tp2 = TR(tp1); TOP(tp2) > BOTTOM(tp1); tp2 = LB(tp2))
|
||||
{
|
||||
if ((TiGetLeftType(tp2) == t1) &&
|
||||
(tp2->ti_client == (ClientData) CLIENTDEFAULT))
|
||||
{
|
||||
Junk = resAddField(tp2);
|
||||
STACKPUSH((ClientData)(tp2),resDevStack);
|
||||
STACKPUSH((ClientData)tp2, resDevStack);
|
||||
Junk->deviceList = resDev;
|
||||
Junk->tj_status |= RES_TILE_DEV;
|
||||
}
|
||||
else if TTMaskHasType(&(devptr->exts_deviceSDTypes[0]),
|
||||
TiGetLeftType(tp2))
|
||||
{
|
||||
{
|
||||
Junk = resAddField(tp2);
|
||||
if (Junk->tj_status & RES_TILE_SD)
|
||||
j0->sourceEdge |= RIGHTEDGE;
|
||||
}
|
||||
}
|
||||
/*left*/
|
||||
for (tp2= BL(tp1); BOTTOM(tp2) < TOP(tp1); tp2 = RT(tp2))
|
||||
/* left */
|
||||
for (tp2 = BL(tp1); BOTTOM(tp2) < TOP(tp1); tp2 = RT(tp2))
|
||||
{
|
||||
if ((TiGetRightType(tp2) == t1) &&
|
||||
(tp2->ti_client == (ClientData) CLIENTDEFAULT))
|
||||
{
|
||||
Junk = resAddField(tp2);
|
||||
STACKPUSH((ClientData)(tp2),resDevStack);
|
||||
STACKPUSH((ClientData)tp2, resDevStack);
|
||||
Junk->deviceList = resDev;
|
||||
Junk->tj_status |= RES_TILE_DEV;
|
||||
}
|
||||
|
|
@ -441,9 +440,9 @@ ResAddPlumbing(tile, arg)
|
|||
|
||||
if (source != (Tile *) NULL)
|
||||
{
|
||||
tileJunk *j = (tileJunk *) source->ti_client;
|
||||
tileJunk *j = (tileJunk *) source->ti_client;
|
||||
|
||||
STACKPUSH((ClientData) (source),resDevStack);
|
||||
STACKPUSH((ClientData)source, resDevStack);
|
||||
j->tj_status &= ~RES_TILE_SD;
|
||||
}
|
||||
while (!StackEmpty(resDevStack))
|
||||
|
|
@ -458,54 +457,54 @@ ResAddPlumbing(tile, arg)
|
|||
t1 = TiGetTypeExact(tp1);
|
||||
|
||||
/* top */
|
||||
for (tp2= RT(tp1); RIGHT(tp2) > LEFT(tp1); tp2 = BL(tp2))
|
||||
for (tp2 = RT(tp1); RIGHT(tp2) > LEFT(tp1); tp2 = BL(tp2))
|
||||
{
|
||||
tileJunk *j2 = (tileJunk *) tp2->ti_client;
|
||||
tileJunk *j2 = (tileJunk *) tp2->ti_client;
|
||||
if (TiGetBottomType(tp2) == t1)
|
||||
{
|
||||
if (j2->tj_status & RES_TILE_SD)
|
||||
{
|
||||
j2->tj_status &= ~RES_TILE_SD;
|
||||
STACKPUSH((ClientData) tp2,resDevStack);
|
||||
STACKPUSH((ClientData)tp2 ,resDevStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*bottom*/
|
||||
for(tp2= LB(tp1); LEFT(tp2) < RIGHT(tp1); tp2 = TR(tp2))
|
||||
/* bottom */
|
||||
for(tp2 = LB(tp1); LEFT(tp2) < RIGHT(tp1); tp2 = TR(tp2))
|
||||
{
|
||||
tileJunk *j2 = (tileJunk *) tp2->ti_client;
|
||||
tileJunk *j2 = (tileJunk *) tp2->ti_client;
|
||||
if (TiGetTopType(tp2) == t1)
|
||||
{
|
||||
if (j2->tj_status & RES_TILE_SD)
|
||||
{
|
||||
j2->tj_status &= ~RES_TILE_SD;
|
||||
STACKPUSH((ClientData) tp2,resDevStack);
|
||||
STACKPUSH((ClientData)tp2, resDevStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*right*/
|
||||
for (tp2= TR(tp1); TOP(tp2) > BOTTOM(tp1); tp2 = LB(tp2))
|
||||
/* right */
|
||||
for (tp2 = TR(tp1); TOP(tp2) > BOTTOM(tp1); tp2 = LB(tp2))
|
||||
{
|
||||
tileJunk *j2 = (tileJunk *) tp2->ti_client;
|
||||
tileJunk *j2 = (tileJunk *) tp2->ti_client;
|
||||
if (TiGetLeftType(tp2) == t1)
|
||||
{
|
||||
if (j2->tj_status & RES_TILE_SD)
|
||||
{
|
||||
j2->tj_status &= ~RES_TILE_SD;
|
||||
STACKPUSH((ClientData) tp2,resDevStack);
|
||||
STACKPUSH((ClientData)tp2, resDevStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*left*/
|
||||
for (tp2= BL(tp1); BOTTOM(tp2) < TOP(tp1); tp2 = RT(tp2))
|
||||
/* left */
|
||||
for (tp2 = BL(tp1); BOTTOM(tp2) < TOP(tp1); tp2 = RT(tp2))
|
||||
{
|
||||
tileJunk *j2 = (tileJunk *) tp2->ti_client;
|
||||
tileJunk *j2 = (tileJunk *) tp2->ti_client;
|
||||
if (TiGetRightType(tp2) == t1)
|
||||
{
|
||||
if (j2->tj_status & RES_TILE_SD)
|
||||
{
|
||||
j2->tj_status &= ~RES_TILE_SD;
|
||||
STACKPUSH((ClientData) tp2,resDevStack);
|
||||
STACKPUSH((ClientData)tp2, resDevStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -529,17 +528,17 @@ ResAddPlumbing(tile, arg)
|
|||
|
||||
int
|
||||
ResRemovePlumbing(tile, arg)
|
||||
Tile *tile;
|
||||
ClientData *arg;
|
||||
Tile *tile;
|
||||
ClientData *arg;
|
||||
|
||||
{
|
||||
|
||||
if (tile->ti_client != (ClientData) CLIENTDEFAULT)
|
||||
{
|
||||
freeMagic(((char *)(tile->ti_client)));
|
||||
tile->ti_client = (ClientData) CLIENTDEFAULT;
|
||||
}
|
||||
return(0);
|
||||
if (tile->ti_client != (ClientData) CLIENTDEFAULT)
|
||||
{
|
||||
freeMagic(((char *)(tile->ti_client)));
|
||||
tile->ti_client = (ClientData) CLIENTDEFAULT;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -627,7 +626,7 @@ ResPreProcessDevices(TileList, DeviceList, Def)
|
|||
freeMagic((char *)oldTile);
|
||||
}
|
||||
|
||||
for(; DeviceList != NULL;DeviceList = DeviceList->rd_nextDev)
|
||||
for (; DeviceList != NULL;DeviceList = DeviceList->rd_nextDev)
|
||||
{
|
||||
int width = DeviceList->rd_perim;
|
||||
int length = DeviceList->rd_length;
|
||||
|
|
@ -666,18 +665,17 @@ ResPreProcessDevices(TileList, DeviceList, Def)
|
|||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
ResAddToQueue(node,list)
|
||||
resNode *node,**list;
|
||||
ResAddToQueue(node, list)
|
||||
resNode *node, **list;
|
||||
{
|
||||
|
||||
node->rn_more = *list;
|
||||
node->rn_less = NULL;
|
||||
if (*list) (*list)->rn_less = node;
|
||||
*list = node;
|
||||
node->rn_more = *list;
|
||||
node->rn_less = NULL;
|
||||
if (*list) (*list)->rn_less = node;
|
||||
*list = node;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*-------------------------------------------------------------------------
|
||||
*
|
||||
|
|
@ -692,44 +690,42 @@ ResAddToQueue(node,list)
|
|||
*/
|
||||
|
||||
void
|
||||
ResRemoveFromQueue(node,list)
|
||||
resNode *node,**list;
|
||||
|
||||
ResRemoveFromQueue(node, list)
|
||||
resNode *node, **list;
|
||||
{
|
||||
|
||||
if (node->rn_less != NULL)
|
||||
{
|
||||
node->rn_less->rn_more = node->rn_more;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (node != (*list))
|
||||
{
|
||||
TxError("Error: Attempt to remove node from wrong list\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
*list = node->rn_more;
|
||||
}
|
||||
}
|
||||
if (node->rn_more != NULL)
|
||||
{
|
||||
node->rn_more->rn_less = node->rn_less;
|
||||
}
|
||||
node->rn_more = NULL;
|
||||
node->rn_less = NULL;
|
||||
if (node->rn_less != NULL)
|
||||
{
|
||||
node->rn_less->rn_more = node->rn_more;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (node != (*list))
|
||||
{
|
||||
TxError("Error: Attempt to remove node from wrong list\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
*list = node->rn_more;
|
||||
}
|
||||
}
|
||||
if (node->rn_more != NULL)
|
||||
{
|
||||
node->rn_more->rn_less = node->rn_less;
|
||||
}
|
||||
node->rn_more = NULL;
|
||||
node->rn_less = NULL;
|
||||
}
|
||||
|
||||
tileJunk *
|
||||
resAddField(tile)
|
||||
Tile *tile;
|
||||
|
||||
Tile *tile;
|
||||
{
|
||||
tileJunk *Junk;
|
||||
if ((Junk=(tileJunk *)tile->ti_client) == (tileJunk *) CLIENTDEFAULT)
|
||||
{
|
||||
Junk = (tileJunk *) mallocMagic((unsigned) (sizeof(tileJunk)));
|
||||
ResJunkInit(Junk);
|
||||
tile->ti_client = (ClientData) Junk;
|
||||
}
|
||||
return Junk;
|
||||
tileJunk *Junk;
|
||||
if ((Junk = (tileJunk *)tile->ti_client) == (tileJunk *) CLIENTDEFAULT)
|
||||
{
|
||||
Junk = (tileJunk *) mallocMagic((unsigned) (sizeof(tileJunk)));
|
||||
ResJunkInit(Junk);
|
||||
tile->ti_client = (ClientData) Junk;
|
||||
}
|
||||
return Junk;
|
||||
}
|
||||
|
|
|
|||
246
resis/ResWrite.c
246
resis/ResWrite.c
|
|
@ -47,78 +47,76 @@ ResPrintNetwork(filename, reslist)
|
|||
resResistor *reslist;
|
||||
|
||||
{
|
||||
char bigname[255],name1[255],name2[255];
|
||||
|
||||
char bigname[255], name1[255], name2[255];
|
||||
FILE *fp;
|
||||
int i=1;
|
||||
int i = 1;
|
||||
|
||||
sprintf(bigname,"%s.%s",filename,"res");
|
||||
fp = fopen(bigname,"w");
|
||||
sprintf(bigname, "%s.%s", filename, "res");
|
||||
fp = fopen(bigname, "w");
|
||||
if (fp != NULL)
|
||||
{
|
||||
for (;reslist;reslist=reslist->rr_nextResistor)
|
||||
{
|
||||
if (reslist->rr_connection1->rn_id == 0)
|
||||
{
|
||||
reslist->rr_connection1->rn_id = i++;
|
||||
}
|
||||
if (reslist->rr_connection2->rn_id == 0)
|
||||
{
|
||||
reslist->rr_connection2->rn_id = i++;
|
||||
}
|
||||
if (reslist->rr_connection1->rn_why == RES_NODE_ORIGIN)
|
||||
{
|
||||
sprintf(name1,"gnd");
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(name1,"n%d_%d_%d",
|
||||
for (; reslist; reslist = reslist->rr_nextResistor)
|
||||
{
|
||||
if (reslist->rr_connection1->rn_id == 0)
|
||||
{
|
||||
reslist->rr_connection1->rn_id = i++;
|
||||
}
|
||||
if (reslist->rr_connection2->rn_id == 0)
|
||||
{
|
||||
reslist->rr_connection2->rn_id = i++;
|
||||
}
|
||||
if (reslist->rr_connection1->rn_why == RES_NODE_ORIGIN)
|
||||
{
|
||||
sprintf(name1, "gnd");
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(name1, "n%d_%d_%d",
|
||||
reslist->rr_connection1->rn_id,
|
||||
reslist->rr_connection1->rn_loc.p_x,
|
||||
reslist->rr_connection1->rn_loc.p_y);
|
||||
}
|
||||
if (reslist->rr_connection2->rn_why == RES_NODE_ORIGIN)
|
||||
{
|
||||
sprintf(name2,"gnd");
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(name2,"n%d_%d_%d",
|
||||
}
|
||||
if (reslist->rr_connection2->rn_why == RES_NODE_ORIGIN)
|
||||
{
|
||||
sprintf(name2,"gnd");
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(name2, "n%d_%d_%d",
|
||||
reslist->rr_connection2->rn_id,
|
||||
reslist->rr_connection2->rn_loc.p_x,
|
||||
reslist->rr_connection2->rn_loc.p_y);
|
||||
}
|
||||
fprintf(fp,"r %s %s %f\n",name1,name2,
|
||||
(float)(reslist->rr_value)*MILLITOKILO);
|
||||
}
|
||||
}
|
||||
fprintf(fp, "r %s %s %f\n", name1, name2,
|
||||
(float)(reslist->rr_value) * MILLITOKILO);
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
void
|
||||
ResPrintCurrents(filename,extension,node)
|
||||
char *filename;
|
||||
float extension;
|
||||
resNode *node;
|
||||
ResPrintCurrents(filename, extension, node)
|
||||
char *filename;
|
||||
float extension;
|
||||
resNode *node;
|
||||
|
||||
{
|
||||
char bigname[255];
|
||||
FILE *fp;
|
||||
int resCurrentPrintFunc();
|
||||
char bigname[255];
|
||||
FILE *fp;
|
||||
int resCurrentPrintFunc();
|
||||
|
||||
sprintf(bigname,"%s.%d",filename,abs((int)(extension)));
|
||||
sprintf(bigname, "%s.%d", filename, abs((int)(extension)));
|
||||
|
||||
fp = fopen(bigname,"w");
|
||||
if (fp != NULL)
|
||||
{
|
||||
(void) ResTreeWalk(node,NULL,resCurrentPrintFunc,
|
||||
RES_DO_FIRST,RES_NO_LOOP,RES_NO_FLAGS,fp);
|
||||
}
|
||||
fclose(fp);
|
||||
fp = fopen(bigname, "w");
|
||||
if (fp != NULL)
|
||||
{
|
||||
(void) ResTreeWalk(node, NULL, resCurrentPrintFunc,
|
||||
RES_DO_FIRST, RES_NO_LOOP, RES_NO_FLAGS, fp);
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*-------------------------------------------------------------------------
|
||||
*
|
||||
|
|
@ -130,100 +128,98 @@ ResPrintCurrents(filename,extension,node)
|
|||
*/
|
||||
|
||||
void
|
||||
resCurrentPrintFunc(node,resistor,filename)
|
||||
resNode *node;
|
||||
resResistor *resistor;
|
||||
FILE *filename;
|
||||
resCurrentPrintFunc(node, resistor, filename)
|
||||
resNode *node;
|
||||
resResistor *resistor;
|
||||
FILE *filename;
|
||||
|
||||
{
|
||||
tElement *workingDev;
|
||||
float i_sum=0.0;
|
||||
tElement *workingDev;
|
||||
float i_sum = 0.0;
|
||||
|
||||
for (workingDev = node->rn_te; workingDev != NULL;
|
||||
workingDev=workingDev->te_nextt)
|
||||
{
|
||||
for (workingDev = node->rn_te; workingDev != NULL;
|
||||
workingDev = workingDev->te_nextt)
|
||||
{
|
||||
if ((workingDev->te_thist->rd_status & RES_DEV_PLUG) ||
|
||||
workingDev->te_thist->rd_gate != node)
|
||||
i_sum += workingDev->te_thist->rd_i;
|
||||
}
|
||||
if (i_sum != 0.0)
|
||||
{
|
||||
if (node->rn_why == RES_NODE_ORIGIN)
|
||||
{
|
||||
fprintf(filename,"i gnd %f\n",i_sum);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(filename,"i n%d_%d %f\n",node->rn_loc.p_x,
|
||||
node->rn_loc.p_y,i_sum);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (i_sum != 0.0)
|
||||
{
|
||||
if (node->rn_why == RES_NODE_ORIGIN)
|
||||
{
|
||||
fprintf(filename, "i gnd %f\n", i_sum);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(filename, "i n%d_%d %f\n", node->rn_loc.p_x,
|
||||
node->rn_loc.p_y, i_sum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ResDeviceCounts()
|
||||
{
|
||||
int i,j,k;
|
||||
resNode *n;
|
||||
resDevice *t;
|
||||
resResistor *r;
|
||||
int i,j,k;
|
||||
resNode *n;
|
||||
resDevice *t;
|
||||
resResistor *r;
|
||||
|
||||
for (n=ResNodeList,i=0;n!=NULL;n=n->rn_more,i++);
|
||||
for (t=ResDevList,j=0;t!=NULL;t=t->rd_nextDev,j++);
|
||||
for (r=ResResList,k=0;r!=NULL;r=r->rr_nextResistor,k++);
|
||||
TxError("n=%d t=%d r=%d\n",i,j,k);
|
||||
TxFlushErr();
|
||||
for (n = ResNodeList, i = 0; n != NULL; n = n->rn_more, i++);
|
||||
for (t = ResDevList, j = 0; t != NULL; t = t->rd_nextDev, j++);
|
||||
for (r = ResResList, k = 0; r != NULL; r = r->rr_nextResistor, k++);
|
||||
TxError("n=%d t=%d r=%d\n", i, j, k);
|
||||
TxFlushErr();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ResWriteECLFile(filename,reslist,nodelist)
|
||||
char *filename;
|
||||
resResistor *reslist;
|
||||
resNode *nodelist;
|
||||
ResWriteECLFile(filename, reslist, nodelist)
|
||||
char *filename;
|
||||
resResistor *reslist;
|
||||
resNode *nodelist;
|
||||
|
||||
{
|
||||
char newname[100],*tmpname,*per;
|
||||
FILE *fp;
|
||||
int nodenum = 0;
|
||||
char newname[100], *tmpname, *per;
|
||||
FILE *fp;
|
||||
int nodenum = 0;
|
||||
|
||||
strcpy(newname,filename);
|
||||
if (per = strrchr(newname,'.')) *per = '\0';
|
||||
strcat(newname,".res");
|
||||
strcpy(newname, filename);
|
||||
if (per = strrchr(newname,'.')) *per = '\0';
|
||||
strcat(newname, ".res");
|
||||
|
||||
if ((fp = fopen(newname,"w")) == NULL)
|
||||
{
|
||||
TxError("Can't open %s\n",newname);
|
||||
return;
|
||||
}
|
||||
for (;nodelist;nodelist=nodelist->rn_more)
|
||||
{
|
||||
if (nodelist->rn_name == NULL)
|
||||
{
|
||||
if (nodelist->rn_noderes == 0)
|
||||
{
|
||||
strcpy(newname,"gnd");
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)sprintf(newname,"n%d_%d_%d",nodelist->rn_loc.p_x,
|
||||
nodelist->rn_loc.p_y,nodenum++);
|
||||
}
|
||||
tmpname = (char *) mallocMagic((unsigned) (strlen(newname)+1));
|
||||
strcpy(tmpname,newname);
|
||||
nodelist->rn_name = tmpname;
|
||||
}
|
||||
}
|
||||
for (;reslist;reslist = reslist->rr_nextResistor)
|
||||
{
|
||||
|
||||
fprintf(fp,"r %s %s %f %s %d\n",
|
||||
reslist->rr_node[0]->rn_name,reslist->rr_node[1]->rn_name,
|
||||
if ((fp = fopen(newname, "w")) == NULL)
|
||||
{
|
||||
TxError("Can't open %s\n", newname);
|
||||
return;
|
||||
}
|
||||
for (; nodelist; nodelist = nodelist->rn_more)
|
||||
{
|
||||
if (nodelist->rn_name == NULL)
|
||||
{
|
||||
if (nodelist->rn_noderes == 0)
|
||||
{
|
||||
strcpy(newname, "gnd");
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)sprintf(newname, "n%d_%d_%d", nodelist->rn_loc.p_x,
|
||||
nodelist->rn_loc.p_y, nodenum++);
|
||||
}
|
||||
tmpname = (char *)mallocMagic((unsigned) (strlen(newname) + 1));
|
||||
strcpy(tmpname, newname);
|
||||
nodelist->rn_name = tmpname;
|
||||
}
|
||||
}
|
||||
for (; reslist; reslist = reslist->rr_nextResistor)
|
||||
{
|
||||
fprintf(fp, "r %s %s %f %s %d\n",
|
||||
reslist->rr_node[0]->rn_name,
|
||||
reslist->rr_node[1]->rn_name,
|
||||
/* /1000.0 gets ohms from milliohms */
|
||||
(float)(reslist->rr_value)/1000.0,
|
||||
DBTypeShortName(reslist->rr_tt),reslist->rr_csArea);
|
||||
}
|
||||
fclose(fp);
|
||||
(float)(reslist->rr_value) / 1000.0,
|
||||
DBTypeShortName(reslist->rr_tt), reslist->rr_csArea);
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue