mirror of
https://github.com/RTimothyEdwards/magic.git
synced 2026-09-04 16:40:49 +02:00
Minor adjustment to output from esSIvalue() to avoid round-off error
causing the SI suffix not to be the expected one. Adjusted the bounds where each SI suffix is used to keep output in the range of 0.1 to 100, although the boundary is very subjective. Made a correction to the extresist code to scan through all device records for a tile type. However, (1) there are cases being missed, and (2) this should not be necessary since all device types should be able to be known exactly from the contents of the .sim file. Needs more work.
This commit is contained in:
@@ -3106,38 +3106,38 @@ esSIvalue(file, value)
|
||||
{
|
||||
/* Do nothing---value is probably zero */
|
||||
}
|
||||
else if (avalue < 1.0E-12)
|
||||
else if (avalue < 0.9999E-13)
|
||||
{
|
||||
/* NOTE: ngspice does not support "a" for "atto" */
|
||||
suffix = 'f';
|
||||
value *= 1.0E15;
|
||||
}
|
||||
else if (avalue < 1.0E-9)
|
||||
else if (avalue < 1.0001E-10)
|
||||
{
|
||||
suffix = 'p';
|
||||
value *= 1.0E12;
|
||||
}
|
||||
else if (avalue < 1.0E-6)
|
||||
else if (avalue < 1.0001E-7)
|
||||
{
|
||||
suffix = 'n';
|
||||
value *= 1.0E9;
|
||||
}
|
||||
else if (avalue < 1.0E-3)
|
||||
else if (avalue < 1.0001E-4)
|
||||
{
|
||||
suffix = 'u';
|
||||
value *= 1.0E6;
|
||||
}
|
||||
else if (avalue <= 1.0E-3)
|
||||
else if (avalue < 1.0001E-2)
|
||||
{
|
||||
suffix = 'm';
|
||||
value *= 1.0E3;
|
||||
}
|
||||
else if (avalue >= 1.0E9)
|
||||
else if (avalue > 0.9999E9)
|
||||
{
|
||||
suffix = 'G';
|
||||
value /= 1.0E9;
|
||||
}
|
||||
else if (avalue >= 1.0E3)
|
||||
else if (avalue > 0.9999E3)
|
||||
{
|
||||
suffix = 'k';
|
||||
value /= 1.0E3;
|
||||
|
||||
+50
-34
@@ -284,17 +284,21 @@ ResEachTile(tile, startpoint)
|
||||
t2 = TiGetRightType(tp);
|
||||
if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask), t2))
|
||||
{
|
||||
devptr = ExtCurStyle->exts_device[t2];
|
||||
for (i = 0; i < devptr->exts_deviceSDCount; i++)
|
||||
for (devptr = ExtCurStyle->exts_device[t2]; devptr;
|
||||
devptr = devptr->exts_next)
|
||||
{
|
||||
if (TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1))
|
||||
for (i = 0; i < devptr->exts_deviceSDCount; i++)
|
||||
{
|
||||
/* found device */
|
||||
xj = LEFT(tile);
|
||||
yj = (TOP(tp) + BOTTOM(tp)) >> 1;
|
||||
ResNewSDDevice(tile, tp, xj, yj, RIGHTEDGE, &ResNodeQueue);
|
||||
break;
|
||||
if (TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1))
|
||||
{
|
||||
/* found device */
|
||||
xj = LEFT(tile);
|
||||
yj = (TOP(tp) + BOTTOM(tp)) >> 1;
|
||||
ResNewSDDevice(tile, tp, xj, yj, RIGHTEDGE, &ResNodeQueue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i < devptr->exts_deviceSDCount) break;
|
||||
}
|
||||
}
|
||||
if TTMaskHasType(&(ExtCurStyle->exts_nodeConn[t1]), t2)
|
||||
@@ -312,17 +316,21 @@ ResEachTile(tile, startpoint)
|
||||
t2 = TiGetLeftType(tp);
|
||||
if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask), t2))
|
||||
{
|
||||
devptr = ExtCurStyle->exts_device[t2];
|
||||
for (i = 0; i < devptr->exts_deviceSDCount; i++)
|
||||
for (devptr = ExtCurStyle->exts_device[t2]; devptr;
|
||||
devptr = devptr->exts_next)
|
||||
{
|
||||
if (TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1))
|
||||
for (i = 0; i < devptr->exts_deviceSDCount; i++)
|
||||
{
|
||||
/* found device */
|
||||
xj = RIGHT(tile);
|
||||
yj = (TOP(tp) + BOTTOM(tp)) >> 1;
|
||||
ResNewSDDevice(tile, tp, xj, yj, LEFTEDGE, &ResNodeQueue);
|
||||
break;
|
||||
if (TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1))
|
||||
{
|
||||
/* found device */
|
||||
xj = RIGHT(tile);
|
||||
yj = (TOP(tp) + BOTTOM(tp)) >> 1;
|
||||
ResNewSDDevice(tile, tp, xj, yj, LEFTEDGE, &ResNodeQueue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i < devptr->exts_deviceSDCount) break;
|
||||
}
|
||||
}
|
||||
if TTMaskHasType(&ExtCurStyle->exts_nodeConn[t1], t2)
|
||||
@@ -335,25 +343,29 @@ ResEachTile(tile, startpoint)
|
||||
}
|
||||
|
||||
/* top */
|
||||
for (tp = RT(tile); RIGHT(tp) > LEFT(tile); tp=BL(tp))
|
||||
for (tp = RT(tile); RIGHT(tp) > LEFT(tile); tp = BL(tp))
|
||||
{
|
||||
t2 = TiGetBottomType(tp);
|
||||
if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask), t2))
|
||||
{
|
||||
devptr = ExtCurStyle->exts_device[t2];
|
||||
for (i = 0; i < devptr->exts_deviceSDCount; i++)
|
||||
for (devptr = ExtCurStyle->exts_device[t2]; devptr;
|
||||
devptr = devptr->exts_next)
|
||||
{
|
||||
if(TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1))
|
||||
for (i = 0; i < devptr->exts_deviceSDCount; i++)
|
||||
{
|
||||
/* found device */
|
||||
yj = TOP(tile);
|
||||
xj = (LEFT(tp)+RIGHT(tp))>>1;
|
||||
ResNewSDDevice(tile, tp, xj, yj, BOTTOMEDGE, &ResNodeQueue);
|
||||
break;
|
||||
if(TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1))
|
||||
{
|
||||
/* found device */
|
||||
yj = TOP(tile);
|
||||
xj = (LEFT(tp) + RIGHT(tp)) >> 1;
|
||||
ResNewSDDevice(tile, tp, xj, yj, BOTTOMEDGE, &ResNodeQueue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i < devptr->exts_deviceSDCount) break;
|
||||
}
|
||||
}
|
||||
if TTMaskHasType(&ExtCurStyle->exts_nodeConn[t1],t2)
|
||||
if TTMaskHasType(&ExtCurStyle->exts_nodeConn[t1], t2)
|
||||
{
|
||||
/* tile is junction */
|
||||
yj = TOP(tile);
|
||||
@@ -368,17 +380,21 @@ ResEachTile(tile, startpoint)
|
||||
t2 = TiGetTopType(tp);
|
||||
if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask), t2))
|
||||
{
|
||||
devptr = ExtCurStyle->exts_device[t2];
|
||||
for (i = 0; i < devptr->exts_deviceSDCount; i++)
|
||||
for (devptr = ExtCurStyle->exts_device[t2]; devptr;
|
||||
devptr = devptr->exts_next)
|
||||
{
|
||||
if (TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1))
|
||||
for (i = 0; i < devptr->exts_deviceSDCount; i++)
|
||||
{
|
||||
/* found device */
|
||||
yj = BOTTOM(tile);
|
||||
xj = (LEFT(tp) + RIGHT(tp)) >> 1;
|
||||
ResNewSDDevice(tile, tp, xj, yj, TOPEDGE, &ResNodeQueue);
|
||||
break;
|
||||
if (TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1))
|
||||
{
|
||||
/* found device */
|
||||
yj = BOTTOM(tile);
|
||||
xj = (LEFT(tp) + RIGHT(tp)) >> 1;
|
||||
ResNewSDDevice(tile, tp, xj, yj, TOPEDGE, &ResNodeQueue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i < devptr->exts_deviceSDCount) break;
|
||||
}
|
||||
}
|
||||
if TTMaskHasType(&(ExtCurStyle->exts_nodeConn[t1]), t2)
|
||||
|
||||
+60
-55
@@ -1016,16 +1016,12 @@ ResExtractNet(node, goodies, cellname)
|
||||
/* the device identifier type, then add the source/drain types to */
|
||||
/* the mask ResSDTypesBitMask. */
|
||||
|
||||
for (devptr = ExtCurStyle->exts_device[thisDev->type]; devptr;
|
||||
devptr = devptr->exts_next)
|
||||
for (i = 0; !TTMaskIsZero(&devptr->exts_deviceSDTypes[i]); i++)
|
||||
TTMaskSetMask(&ResSDTypesBitMask, &devptr->exts_deviceSDTypes[i]);
|
||||
devptr = tptr->thisDev->rs_devptr;
|
||||
for (i = 0; !TTMaskIsZero(&devptr->exts_deviceSDTypes[i]); i++)
|
||||
TTMaskSetMask(&ResSDTypesBitMask, &devptr->exts_deviceSDTypes[i]);
|
||||
|
||||
/* Add the substrate types to the mask ResSubTypesBitMask */
|
||||
|
||||
for (devptr = ExtCurStyle->exts_device[thisDev->type]; devptr;
|
||||
devptr = devptr->exts_next)
|
||||
TTMaskSetMask(&ResSubTypesBitMask, &devptr->exts_deviceSubstrateTypes);
|
||||
TTMaskSetMask(&ResSubTypesBitMask, &devptr->exts_deviceSubstrateTypes);
|
||||
|
||||
/* TT_SPACE should be removed from ResSubTypesBitMask */
|
||||
TTMaskClearType(&ResSubTypesBitMask, TT_SPACE);
|
||||
@@ -1314,75 +1310,84 @@ FindStartTile(goodies, SourcePoint)
|
||||
else
|
||||
t1 = TiGetType(tile);
|
||||
|
||||
devptr = ExtCurStyle->exts_device[t1];
|
||||
/* NOTE: There must be a way to pass the device type from a device
|
||||
* record's rs_devptr instead of groping around for it.
|
||||
*/
|
||||
|
||||
for (i = 0; i < devptr->exts_deviceSDCount; i++)
|
||||
for (devptr = ExtCurStyle->exts_device[t1]; devptr; devptr = devptr->exts_next)
|
||||
{
|
||||
/* left */
|
||||
for (tp = BL(tile); BOTTOM(tp) < TOP(tile); tp = RT(tp))
|
||||
for (i = 0; i < devptr->exts_deviceSDCount; i++)
|
||||
{
|
||||
t2 = TiGetRightType(tp);
|
||||
if ((t2 != TT_SPACE) && TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2))
|
||||
/* left */
|
||||
for (tp = BL(tile); BOTTOM(tp) < TOP(tile); tp = RT(tp))
|
||||
{
|
||||
SourcePoint->p_x = LEFT(tile);
|
||||
SourcePoint->p_y = (MIN(TOP(tile),TOP(tp)) +
|
||||
t2 = TiGetRightType(tp);
|
||||
if ((t2 != TT_SPACE) &&
|
||||
TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2))
|
||||
{
|
||||
SourcePoint->p_x = LEFT(tile);
|
||||
SourcePoint->p_y = (MIN(TOP(tile),TOP(tp)) +
|
||||
MAX(BOTTOM(tile), BOTTOM(tp))) >> 1;
|
||||
return(tp);
|
||||
return(tp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* right */
|
||||
for (tp = TR(tile); TOP(tp) > BOTTOM(tile); tp = LB(tp))
|
||||
{
|
||||
t2 = TiGetLeftType(tp);
|
||||
if ((t2 != TT_SPACE) && TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2))
|
||||
/* right */
|
||||
for (tp = TR(tile); TOP(tp) > BOTTOM(tile); tp = LB(tp))
|
||||
{
|
||||
SourcePoint->p_x = RIGHT(tile);
|
||||
SourcePoint->p_y = (MIN(TOP(tile), TOP(tp))+
|
||||
t2 = TiGetLeftType(tp);
|
||||
if ((t2 != TT_SPACE) &&
|
||||
TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2))
|
||||
{
|
||||
SourcePoint->p_x = RIGHT(tile);
|
||||
SourcePoint->p_y = (MIN(TOP(tile), TOP(tp))+
|
||||
MAX(BOTTOM(tile), BOTTOM(tp))) >> 1;
|
||||
return(tp);
|
||||
return(tp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* top */
|
||||
for (tp = RT(tile); RIGHT(tp) > LEFT(tile); tp = BL(tp))
|
||||
{
|
||||
t2 = TiGetBottomType(tp);
|
||||
if ((t2 != TT_SPACE) && TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2))
|
||||
/* top */
|
||||
for (tp = RT(tile); RIGHT(tp) > LEFT(tile); tp = BL(tp))
|
||||
{
|
||||
SourcePoint->p_y = TOP(tile);
|
||||
SourcePoint->p_x = (MIN(RIGHT(tile),RIGHT(tp)) +
|
||||
t2 = TiGetBottomType(tp);
|
||||
if ((t2 != TT_SPACE) &&
|
||||
TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2))
|
||||
{
|
||||
SourcePoint->p_y = TOP(tile);
|
||||
SourcePoint->p_x = (MIN(RIGHT(tile),RIGHT(tp)) +
|
||||
MAX(LEFT(tile), LEFT(tp))) >> 1;
|
||||
return(tp);
|
||||
return(tp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* bottom */
|
||||
for (tp = LB(tile); LEFT(tp) < RIGHT(tile); tp = TR(tp))
|
||||
{
|
||||
t2 = TiGetTopType(tp);
|
||||
if ((t2 != TT_SPACE) && TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2))
|
||||
/* bottom */
|
||||
for (tp = LB(tile); LEFT(tp) < RIGHT(tile); tp = TR(tp))
|
||||
{
|
||||
SourcePoint->p_y = BOTTOM(tile);
|
||||
SourcePoint->p_x = (MIN(RIGHT(tile), RIGHT(tp)) +
|
||||
t2 = TiGetTopType(tp);
|
||||
if ((t2 != TT_SPACE) &&
|
||||
TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2))
|
||||
{
|
||||
SourcePoint->p_y = BOTTOM(tile);
|
||||
SourcePoint->p_x = (MIN(RIGHT(tile), RIGHT(tp)) +
|
||||
MAX(LEFT(tile), LEFT(tp))) >> 1;
|
||||
return(tp);
|
||||
return(tp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Didn't find a terminal (S/D) type tile in the perimeter search. */
|
||||
/* Check if S/D types are in a different plane from the identifier. */
|
||||
/* Didn't find a terminal (S/D) type tile in the perimeter search. */
|
||||
/* Check if S/D types are in a different plane from the identifier. */
|
||||
|
||||
TiToRect(tile, &r);
|
||||
tp = NULL;
|
||||
for (i = 0; i < devptr->exts_deviceSDCount; i++)
|
||||
{
|
||||
for (pnum = 0; pnum < DBNumPlanes; pnum++)
|
||||
TiToRect(tile, &r);
|
||||
tp = NULL;
|
||||
for (i = 0; i < devptr->exts_deviceSDCount; i++)
|
||||
{
|
||||
DBSrPaintArea((Tile *)NULL, ResUse->cu_def->cd_planes[pnum],
|
||||
&r, &(devptr->exts_deviceSDTypes[i]), ResGetTileFunc, &tp);
|
||||
if (tp != NULL) return tp;
|
||||
for (pnum = 0; pnum < DBNumPlanes; pnum++)
|
||||
{
|
||||
DBSrPaintArea((Tile *)NULL, ResUse->cu_def->cd_planes[pnum],
|
||||
&r, &(devptr->exts_deviceSDTypes[i]), ResGetTileFunc, &tp);
|
||||
if (tp != NULL) return tp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1484,7 +1484,7 @@ ResFixUpConnections(simDev, layoutDev, simNode, nodename)
|
||||
resNodeNum--;
|
||||
notdecremented = FALSE;
|
||||
}
|
||||
ResFixDevName(newname,DRAIN,simDev,source);
|
||||
ResFixDevName(newname, DRAIN, simDev, source);
|
||||
source->rn_name = simDev->drain->name;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user