Skip to content

Commit 814fb6f

Browse files
Corrected two separate issues with R-C extraction: (1) There was
a method that failed to work on devices with complex shapes on the device recognition layer, such as snake-geometry resistors. (2) The use of contact type "xpc" in the sky130 tech file as its own contact residue caused the contact tracing in extresist to fail. I opted to keep the unorthodox contact description in the tech file and wrote an extension to a routine in extresist to handle the case.
1 parent 038f02d commit 814fb6f

File tree

4 files changed

+246
-12
lines changed

4 files changed

+246
-12
lines changed

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.3.460
1+
8.3.461

resis/ResMain.c

+198-9
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,31 @@ extern HashTable ResNodeTable;
6666
void
6767
ResInitializeConn()
6868
{
69-
TileType dev, diff;
69+
TileType dev, ttype;
7070
char *dev_name;
71+
int i;
7172
ExtDevice *devptr;
7273

7374
for (dev = TT_TECHDEPBASE; dev < TT_MAXTYPES; dev++)
7475
{
75-
devptr = ExtCurStyle->exts_device[dev];
76-
if ((devptr != NULL) && ((dev_name = devptr->exts_deviceName) != NULL)
77-
&& (strcmp(dev_name, "None")))
76+
for (devptr = ExtCurStyle->exts_device[dev]; devptr; devptr = devptr->exts_next)
7877
{
79-
for (diff = TT_TECHDEPBASE; diff < TT_MAXTYPES; diff++)
78+
if ((devptr != NULL) && ((dev_name = devptr->exts_deviceName) != NULL)
79+
&& (strcmp(dev_name, "None")))
8080
{
81-
if TTMaskHasType(&(devptr->exts_deviceSDTypes[0]), diff)
82-
TTMaskSetType(&ResConnectWithSD[diff], dev);
81+
for (ttype = TT_TECHDEPBASE; ttype < TT_MAXTYPES; ttype++)
82+
{
83+
for (i = 0; ; i++)
84+
{
85+
if (TTMaskIsZero(&(devptr->exts_deviceSDTypes[i])))
86+
break;
87+
if TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), ttype)
88+
TTMaskSetType(&ResConnectWithSD[ttype], dev);
89+
}
8390

84-
if TTMaskHasType(&(devptr->exts_deviceSubstrateTypes), diff)
85-
TTMaskSetType(&ResConnectWithSD[diff], dev);
91+
if TTMaskHasType(&(devptr->exts_deviceSubstrateTypes), ttype)
92+
TTMaskSetType(&ResConnectWithSD[ttype], dev);
93+
}
8694
}
8795
}
8896
TTMaskSetMask(&ResConnectWithSD[dev], &DBConnectTbl[dev]);
@@ -410,6 +418,7 @@ ResFindNewContactTiles(contacts)
410418
TxError("Error: setting contact tile to null\n");
411419
}
412420
#endif
421+
413422
if ((IsSplit(tile) && TTMaskHasType(&mask, TiGetRightType(tile)))
414423
|| TTMaskHasType(&mask, TiGetType(tile)))
415424
{
@@ -423,6 +432,30 @@ ResFindNewContactTiles(contacts)
423432
(contacts->cp_currentcontact) += 1;
424433
j->contactList = ce;
425434
}
435+
else
436+
{
437+
TileType ttype = TiGetTypeExact(tile);
438+
if (DBIsContact(ttype))
439+
{
440+
/* Handle the exceptional case in which a contact
441+
* type is its own residue. This can be used for
442+
* devices whose terminals are always a contact
443+
* and for which a non-contact type cannot be drawn.
444+
*/
445+
if (TTMaskIntersect(DBResidueMask(ttype), &mask))
446+
{
447+
tileJunk *j = (tileJunk *)tile->ti_client;
448+
cElement *ce;
449+
450+
ce = (cElement *) mallocMagic((unsigned) (sizeof(cElement)));
451+
contacts->cp_tile[contacts->cp_currentcontact] = tile;
452+
ce->ce_thisc = contacts;
453+
ce->ce_nextc = j->contactList;
454+
(contacts->cp_currentcontact) += 1;
455+
j->contactList = ce;
456+
}
457+
}
458+
}
426459
}
427460
#ifdef PARANOID
428461
if (contacts->cp_currentcontact >= LAYERS_PER_CONTACT)
@@ -1289,6 +1322,8 @@ FindStartTile(goodies, SourcePoint)
12891322
int pnum, t1, t2, i;
12901323
ExtDevice *devptr;
12911324
Rect r;
1325+
bool complex;
1326+
static Stack *devStack = NULL;
12921327

12931328
/* If the drive point is on a contact, check for the contact residues */
12941329
/* first, then the contact type itself. */
@@ -1391,6 +1426,8 @@ FindStartTile(goodies, SourcePoint)
13911426
{
13921427
for (i = 0; i < devptr->exts_deviceSDCount; i++)
13931428
{
1429+
complex = FALSE; /* Assume device is a single tile */
1430+
13941431
/* left */
13951432
for (tp = BL(tile); BOTTOM(tp) < TOP(tile); tp = RT(tp))
13961433
{
@@ -1403,6 +1440,9 @@ FindStartTile(goodies, SourcePoint)
14031440
MAX(BOTTOM(tile), BOTTOM(tp))) >> 1;
14041441
return(tp);
14051442
}
1443+
else if (tp->ti_client != CLIENTDEFAULT)
1444+
if (((tileJunk *)tp->ti_client)->tj_status & RES_TILE_DEV)
1445+
complex = TRUE;
14061446
}
14071447

14081448
/* right */
@@ -1417,6 +1457,9 @@ FindStartTile(goodies, SourcePoint)
14171457
MAX(BOTTOM(tile), BOTTOM(tp))) >> 1;
14181458
return(tp);
14191459
}
1460+
else if (tp->ti_client != CLIENTDEFAULT)
1461+
if (((tileJunk *)tp->ti_client)->tj_status & RES_TILE_DEV)
1462+
complex = TRUE;
14201463
}
14211464

14221465
/* top */
@@ -1431,6 +1474,9 @@ FindStartTile(goodies, SourcePoint)
14311474
MAX(LEFT(tile), LEFT(tp))) >> 1;
14321475
return(tp);
14331476
}
1477+
else if (tp->ti_client != CLIENTDEFAULT)
1478+
if (((tileJunk *)tp->ti_client)->tj_status & RES_TILE_DEV)
1479+
complex = TRUE;
14341480
}
14351481

14361482
/* bottom */
@@ -1445,6 +1491,149 @@ FindStartTile(goodies, SourcePoint)
14451491
MAX(LEFT(tile), LEFT(tp))) >> 1;
14461492
return(tp);
14471493
}
1494+
else if (tp->ti_client != CLIENTDEFAULT)
1495+
if (((tileJunk *)tp->ti_client)->tj_status & RES_TILE_DEV)
1496+
complex = TRUE;
1497+
}
1498+
1499+
if (complex == TRUE)
1500+
{
1501+
/* Didn't find a terminal but device has multiple */
1502+
/* tiles, so make a secondary search looking at all */
1503+
/* tiles of the device. */
1504+
1505+
if (devStack == NULL) devStack = StackNew(8);
1506+
1507+
((tileJunk *)tile->ti_client)->tj_status |= RES_TILE_PUSHED;
1508+
STACKPUSH((ClientData)tile, devStack);
1509+
while (!StackEmpty(devStack))
1510+
{
1511+
tile = (Tile *)STACKPOP(devStack);
1512+
1513+
/* left */
1514+
for (tp = BL(tile); BOTTOM(tp) < TOP(tile); tp = RT(tp))
1515+
{
1516+
t2 = TiGetRightType(tp);
1517+
if ((t2 != TT_SPACE) &&
1518+
TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2))
1519+
{
1520+
SourcePoint->p_x = LEFT(tile);
1521+
SourcePoint->p_y = (MIN(TOP(tile),TOP(tp)) +
1522+
MAX(BOTTOM(tile), BOTTOM(tp))) >> 1;
1523+
while (!StackEmpty(devStack))
1524+
{
1525+
STACKPOP(devStack);
1526+
}
1527+
return(tp);
1528+
}
1529+
else if (tp->ti_client != CLIENTDEFAULT)
1530+
{
1531+
if (((tileJunk *)tp->ti_client)->tj_status & RES_TILE_DEV)
1532+
{
1533+
if (!(((tileJunk *)tp->ti_client)->tj_status
1534+
& RES_TILE_PUSHED))
1535+
{
1536+
((tileJunk *)tp->ti_client)->tj_status
1537+
|= RES_TILE_PUSHED;
1538+
STACKPUSH((ClientData)tp, devStack);
1539+
}
1540+
}
1541+
}
1542+
}
1543+
1544+
/* right */
1545+
for (tp = TR(tile); TOP(tp) > BOTTOM(tile); tp = LB(tp))
1546+
{
1547+
t2 = TiGetLeftType(tp);
1548+
if ((t2 != TT_SPACE) &&
1549+
TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2))
1550+
{
1551+
SourcePoint->p_x = RIGHT(tile);
1552+
SourcePoint->p_y = (MIN(TOP(tile), TOP(tp))+
1553+
MAX(BOTTOM(tile), BOTTOM(tp))) >> 1;
1554+
while (!StackEmpty(devStack))
1555+
{
1556+
STACKPOP(devStack);
1557+
}
1558+
return(tp);
1559+
}
1560+
else if (tp->ti_client != CLIENTDEFAULT)
1561+
{
1562+
if (((tileJunk *)tp->ti_client)->tj_status & RES_TILE_DEV)
1563+
{
1564+
if (!(((tileJunk *)tp->ti_client)->tj_status
1565+
& RES_TILE_PUSHED))
1566+
{
1567+
((tileJunk *)tp->ti_client)->tj_status
1568+
|= RES_TILE_PUSHED;
1569+
STACKPUSH((ClientData)tp, devStack);
1570+
}
1571+
}
1572+
}
1573+
}
1574+
1575+
/* top */
1576+
for (tp = RT(tile); RIGHT(tp) > LEFT(tile); tp = BL(tp))
1577+
{
1578+
t2 = TiGetBottomType(tp);
1579+
if ((t2 != TT_SPACE) &&
1580+
TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2))
1581+
{
1582+
SourcePoint->p_y = TOP(tile);
1583+
SourcePoint->p_x = (MIN(RIGHT(tile),RIGHT(tp)) +
1584+
MAX(LEFT(tile), LEFT(tp))) >> 1;
1585+
while (!StackEmpty(devStack))
1586+
{
1587+
STACKPOP(devStack);
1588+
}
1589+
return(tp);
1590+
}
1591+
else if (tp->ti_client != CLIENTDEFAULT)
1592+
{
1593+
if (((tileJunk *)tp->ti_client)->tj_status & RES_TILE_DEV)
1594+
{
1595+
if (!(((tileJunk *)tp->ti_client)->tj_status
1596+
& RES_TILE_PUSHED))
1597+
{
1598+
((tileJunk *)tp->ti_client)->tj_status
1599+
|= RES_TILE_PUSHED;
1600+
STACKPUSH((ClientData)tp, devStack);
1601+
}
1602+
}
1603+
}
1604+
}
1605+
1606+
/* bottom */
1607+
for (tp = LB(tile); LEFT(tp) < RIGHT(tile); tp = TR(tp))
1608+
{
1609+
t2 = TiGetTopType(tp);
1610+
if ((t2 != TT_SPACE) &&
1611+
TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2))
1612+
{
1613+
SourcePoint->p_y = BOTTOM(tile);
1614+
SourcePoint->p_x = (MIN(RIGHT(tile), RIGHT(tp)) +
1615+
MAX(LEFT(tile), LEFT(tp))) >> 1;
1616+
while (!StackEmpty(devStack))
1617+
{
1618+
STACKPOP(devStack);
1619+
}
1620+
return(tp);
1621+
}
1622+
else if (tp->ti_client != CLIENTDEFAULT)
1623+
{
1624+
if (((tileJunk *)tp->ti_client)->tj_status & RES_TILE_DEV)
1625+
{
1626+
if (!(((tileJunk *)tp->ti_client)->tj_status
1627+
& RES_TILE_PUSHED))
1628+
{
1629+
((tileJunk *)tp->ti_client)->tj_status
1630+
|= RES_TILE_PUSHED;
1631+
STACKPUSH((ClientData)tp, devStack);
1632+
}
1633+
}
1634+
}
1635+
}
1636+
}
14481637
}
14491638
}
14501639

resis/ResUtils.c

+43
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,16 @@ ResAddPlumbing(tile, arg)
445445
Junk->deviceList = resDev;
446446
Junk->tj_status |= RES_TILE_DEV;
447447

448+
/* Update device position to point to the lower-leftmost tile */
449+
if ((tp2->ti_ll.p_x < resDev->rd_inside.r_ll.p_x) ||
450+
((tp2->ti_ll.p_x == resDev->rd_inside.r_ll.p_x) &&
451+
(tp2->ti_ll.p_y < resDev->rd_inside.r_ll.p_y)))
452+
{
453+
resDev->rd_inside.r_ll.p_x = LEFT(tp2);
454+
resDev->rd_inside.r_ll.p_y = BOTTOM(tp2);
455+
resDev->rd_inside.r_ur.p_x = RIGHT(tp2);
456+
resDev->rd_inside.r_ur.p_y = TOP(tp2);
457+
}
448458
}
449459
else if TTMaskHasType(&(devptr->exts_deviceSDTypes[0]),
450460
TiGetBottomType(tp2))
@@ -464,6 +474,17 @@ ResAddPlumbing(tile, arg)
464474
STACKPUSH((ClientData)tp2, resDevStack);
465475
Junk->deviceList = resDev;
466476
Junk->tj_status |= RES_TILE_DEV;
477+
478+
/* Update device position to point to the lower-leftmost tile */
479+
if ((tp2->ti_ll.p_x < resDev->rd_inside.r_ll.p_x) ||
480+
((tp2->ti_ll.p_x == resDev->rd_inside.r_ll.p_x) &&
481+
(tp2->ti_ll.p_y < resDev->rd_inside.r_ll.p_y)))
482+
{
483+
resDev->rd_inside.r_ll.p_x = LEFT(tp2);
484+
resDev->rd_inside.r_ll.p_y = BOTTOM(tp2);
485+
resDev->rd_inside.r_ur.p_x = RIGHT(tp2);
486+
resDev->rd_inside.r_ur.p_y = TOP(tp2);
487+
}
467488
}
468489
else if TTMaskHasType(&(devptr->exts_deviceSDTypes[0]),
469490
TiGetTopType(tp2))
@@ -483,6 +504,17 @@ ResAddPlumbing(tile, arg)
483504
STACKPUSH((ClientData)tp2, resDevStack);
484505
Junk->deviceList = resDev;
485506
Junk->tj_status |= RES_TILE_DEV;
507+
508+
/* Update device position to point to the lower-leftmost tile */
509+
if ((tp2->ti_ll.p_x < resDev->rd_inside.r_ll.p_x) ||
510+
((tp2->ti_ll.p_x == resDev->rd_inside.r_ll.p_x) &&
511+
(tp2->ti_ll.p_y < resDev->rd_inside.r_ll.p_y)))
512+
{
513+
resDev->rd_inside.r_ll.p_x = LEFT(tp2);
514+
resDev->rd_inside.r_ll.p_y = BOTTOM(tp2);
515+
resDev->rd_inside.r_ur.p_x = RIGHT(tp2);
516+
resDev->rd_inside.r_ur.p_y = TOP(tp2);
517+
}
486518
}
487519
else if TTMaskHasType(&(devptr->exts_deviceSDTypes[0]),
488520
TiGetLeftType(tp2))
@@ -502,6 +534,17 @@ ResAddPlumbing(tile, arg)
502534
STACKPUSH((ClientData)tp2, resDevStack);
503535
Junk->deviceList = resDev;
504536
Junk->tj_status |= RES_TILE_DEV;
537+
538+
/* Update device position to point to the lower-leftmost tile */
539+
if ((tp2->ti_ll.p_x < resDev->rd_inside.r_ll.p_x) ||
540+
((tp2->ti_ll.p_x == resDev->rd_inside.r_ll.p_x) &&
541+
(tp2->ti_ll.p_y < resDev->rd_inside.r_ll.p_y)))
542+
{
543+
resDev->rd_inside.r_ll.p_x = LEFT(tp2);
544+
resDev->rd_inside.r_ll.p_y = BOTTOM(tp2);
545+
resDev->rd_inside.r_ur.p_x = RIGHT(tp2);
546+
resDev->rd_inside.r_ur.p_y = TOP(tp2);
547+
}
505548
}
506549
else if TTMaskHasType(&(devptr->exts_deviceSDTypes[0]),
507550
TiGetRightType(tp2))

resis/resis.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -471,10 +471,12 @@ typedef struct capval
471471
#define RES_TILE_DONE 0x08
472472
/*a temporary marking flag */
473473
#define RES_TILE_MARK 0x10
474+
/*another temporary marking flag */
475+
#define RES_TILE_PUSHED 0x20
474476
/* indicates that tile has unidirectional current flow */
475477
#ifdef LAPLACE
476-
#define RES_TILE_1D 0x20
477-
#define RES_TILE_GDONE 0x40
478+
#define RES_TILE_1D 0x40
479+
#define RES_TILE_GDONE 0x80
478480
#endif
479481
/* tree walking flags */
480482
#define RES_LOOP_OK 1

0 commit comments

Comments
 (0)