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:
Tim Edwards 2023-03-23 15:38:31 -04:00
parent 6dd5f4d7e3
commit f0c94d59f3
5 changed files with 119 additions and 98 deletions

View File

@ -1 +1 @@
8.3.385 8.3.386

View File

@ -3106,38 +3106,38 @@ esSIvalue(file, value)
{ {
/* Do nothing---value is probably zero */ /* 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" */ /* NOTE: ngspice does not support "a" for "atto" */
suffix = 'f'; suffix = 'f';
value *= 1.0E15; value *= 1.0E15;
} }
else if (avalue < 1.0E-9) else if (avalue < 1.0001E-10)
{ {
suffix = 'p'; suffix = 'p';
value *= 1.0E12; value *= 1.0E12;
} }
else if (avalue < 1.0E-6) else if (avalue < 1.0001E-7)
{ {
suffix = 'n'; suffix = 'n';
value *= 1.0E9; value *= 1.0E9;
} }
else if (avalue < 1.0E-3) else if (avalue < 1.0001E-4)
{ {
suffix = 'u'; suffix = 'u';
value *= 1.0E6; value *= 1.0E6;
} }
else if (avalue <= 1.0E-3) else if (avalue < 1.0001E-2)
{ {
suffix = 'm'; suffix = 'm';
value *= 1.0E3; value *= 1.0E3;
} }
else if (avalue >= 1.0E9) else if (avalue > 0.9999E9)
{ {
suffix = 'G'; suffix = 'G';
value /= 1.0E9; value /= 1.0E9;
} }
else if (avalue >= 1.0E3) else if (avalue > 0.9999E3)
{ {
suffix = 'k'; suffix = 'k';
value /= 1.0E3; value /= 1.0E3;

View File

@ -284,7 +284,9 @@ ResEachTile(tile, startpoint)
t2 = TiGetRightType(tp); t2 = TiGetRightType(tp);
if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask), t2)) if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask), t2))
{ {
devptr = ExtCurStyle->exts_device[t2]; for (devptr = ExtCurStyle->exts_device[t2]; devptr;
devptr = devptr->exts_next)
{
for (i = 0; i < devptr->exts_deviceSDCount; i++) for (i = 0; i < devptr->exts_deviceSDCount; i++)
{ {
if (TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1)) if (TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1))
@ -296,6 +298,8 @@ ResEachTile(tile, startpoint)
break; break;
} }
} }
if (i < devptr->exts_deviceSDCount) break;
}
} }
if TTMaskHasType(&(ExtCurStyle->exts_nodeConn[t1]), t2) if TTMaskHasType(&(ExtCurStyle->exts_nodeConn[t1]), t2)
{ {
@ -312,7 +316,9 @@ ResEachTile(tile, startpoint)
t2 = TiGetLeftType(tp); t2 = TiGetLeftType(tp);
if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask), t2)) if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask), t2))
{ {
devptr = ExtCurStyle->exts_device[t2]; for (devptr = ExtCurStyle->exts_device[t2]; devptr;
devptr = devptr->exts_next)
{
for (i = 0; i < devptr->exts_deviceSDCount; i++) for (i = 0; i < devptr->exts_deviceSDCount; i++)
{ {
if (TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1)) if (TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1))
@ -324,6 +330,8 @@ ResEachTile(tile, startpoint)
break; break;
} }
} }
if (i < devptr->exts_deviceSDCount) break;
}
} }
if TTMaskHasType(&ExtCurStyle->exts_nodeConn[t1], t2) if TTMaskHasType(&ExtCurStyle->exts_nodeConn[t1], t2)
{ {
@ -335,25 +343,29 @@ ResEachTile(tile, startpoint)
} }
/* top */ /* 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); t2 = TiGetBottomType(tp);
if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask), t2)) if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask), t2))
{ {
devptr = ExtCurStyle->exts_device[t2]; for (devptr = ExtCurStyle->exts_device[t2]; devptr;
devptr = devptr->exts_next)
{
for (i = 0; i < devptr->exts_deviceSDCount; i++) for (i = 0; i < devptr->exts_deviceSDCount; i++)
{ {
if(TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1)) if(TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1))
{ {
/* found device */ /* found device */
yj = TOP(tile); yj = TOP(tile);
xj = (LEFT(tp)+RIGHT(tp))>>1; xj = (LEFT(tp) + RIGHT(tp)) >> 1;
ResNewSDDevice(tile, tp, xj, yj, BOTTOMEDGE, &ResNodeQueue); ResNewSDDevice(tile, tp, xj, yj, BOTTOMEDGE, &ResNodeQueue);
break; break;
} }
} }
if (i < devptr->exts_deviceSDCount) break;
} }
if TTMaskHasType(&ExtCurStyle->exts_nodeConn[t1],t2) }
if TTMaskHasType(&ExtCurStyle->exts_nodeConn[t1], t2)
{ {
/* tile is junction */ /* tile is junction */
yj = TOP(tile); yj = TOP(tile);
@ -368,7 +380,9 @@ ResEachTile(tile, startpoint)
t2 = TiGetTopType(tp); t2 = TiGetTopType(tp);
if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask), t2)) if (TTMaskHasType(&(ExtCurStyle->exts_deviceMask), t2))
{ {
devptr = ExtCurStyle->exts_device[t2]; for (devptr = ExtCurStyle->exts_device[t2]; devptr;
devptr = devptr->exts_next)
{
for (i = 0; i < devptr->exts_deviceSDCount; i++) for (i = 0; i < devptr->exts_deviceSDCount; i++)
{ {
if (TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1)) if (TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1))
@ -380,6 +394,8 @@ ResEachTile(tile, startpoint)
break; break;
} }
} }
if (i < devptr->exts_deviceSDCount) break;
}
} }
if TTMaskHasType(&(ExtCurStyle->exts_nodeConn[t1]), t2) if TTMaskHasType(&(ExtCurStyle->exts_nodeConn[t1]), t2)
{ {

View File

@ -1016,15 +1016,11 @@ ResExtractNet(node, goodies, cellname)
/* the device identifier type, then add the source/drain types to */ /* the device identifier type, then add the source/drain types to */
/* the mask ResSDTypesBitMask. */ /* the mask ResSDTypesBitMask. */
for (devptr = ExtCurStyle->exts_device[thisDev->type]; devptr; devptr = tptr->thisDev->rs_devptr;
devptr = devptr->exts_next)
for (i = 0; !TTMaskIsZero(&devptr->exts_deviceSDTypes[i]); i++) for (i = 0; !TTMaskIsZero(&devptr->exts_deviceSDTypes[i]); i++)
TTMaskSetMask(&ResSDTypesBitMask, &devptr->exts_deviceSDTypes[i]); TTMaskSetMask(&ResSDTypesBitMask, &devptr->exts_deviceSDTypes[i]);
/* Add the substrate types to the mask ResSubTypesBitMask */ /* 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 */ /* TT_SPACE should be removed from ResSubTypesBitMask */
@ -1314,15 +1310,20 @@ FindStartTile(goodies, SourcePoint)
else else
t1 = TiGetType(tile); 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 (devptr = ExtCurStyle->exts_device[t1]; devptr; devptr = devptr->exts_next)
{
for (i = 0; i < devptr->exts_deviceSDCount; i++) for (i = 0; i < devptr->exts_deviceSDCount; i++)
{ {
/* left */ /* left */
for (tp = BL(tile); BOTTOM(tp) < TOP(tile); tp = RT(tp)) for (tp = BL(tile); BOTTOM(tp) < TOP(tile); tp = RT(tp))
{ {
t2 = TiGetRightType(tp); t2 = TiGetRightType(tp);
if ((t2 != TT_SPACE) && TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2)) if ((t2 != TT_SPACE) &&
TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2))
{ {
SourcePoint->p_x = LEFT(tile); SourcePoint->p_x = LEFT(tile);
SourcePoint->p_y = (MIN(TOP(tile),TOP(tp)) + SourcePoint->p_y = (MIN(TOP(tile),TOP(tp)) +
@ -1335,7 +1336,8 @@ FindStartTile(goodies, SourcePoint)
for (tp = TR(tile); TOP(tp) > BOTTOM(tile); tp = LB(tp)) for (tp = TR(tile); TOP(tp) > BOTTOM(tile); tp = LB(tp))
{ {
t2 = TiGetLeftType(tp); t2 = TiGetLeftType(tp);
if ((t2 != TT_SPACE) && TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2)) if ((t2 != TT_SPACE) &&
TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2))
{ {
SourcePoint->p_x = RIGHT(tile); SourcePoint->p_x = RIGHT(tile);
SourcePoint->p_y = (MIN(TOP(tile), TOP(tp))+ SourcePoint->p_y = (MIN(TOP(tile), TOP(tp))+
@ -1348,7 +1350,8 @@ FindStartTile(goodies, SourcePoint)
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); t2 = TiGetBottomType(tp);
if ((t2 != TT_SPACE) && TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2)) if ((t2 != TT_SPACE) &&
TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2))
{ {
SourcePoint->p_y = TOP(tile); SourcePoint->p_y = TOP(tile);
SourcePoint->p_x = (MIN(RIGHT(tile),RIGHT(tp)) + SourcePoint->p_x = (MIN(RIGHT(tile),RIGHT(tp)) +
@ -1361,7 +1364,8 @@ FindStartTile(goodies, SourcePoint)
for (tp = LB(tile); LEFT(tp) < RIGHT(tile); tp = TR(tp)) for (tp = LB(tile); LEFT(tp) < RIGHT(tile); tp = TR(tp))
{ {
t2 = TiGetTopType(tp); t2 = TiGetTopType(tp);
if ((t2 != TT_SPACE) && TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2)) if ((t2 != TT_SPACE) &&
TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t2))
{ {
SourcePoint->p_y = BOTTOM(tile); SourcePoint->p_y = BOTTOM(tile);
SourcePoint->p_x = (MIN(RIGHT(tile), RIGHT(tp)) + SourcePoint->p_x = (MIN(RIGHT(tile), RIGHT(tp)) +
@ -1385,6 +1389,7 @@ FindStartTile(goodies, SourcePoint)
if (tp != NULL) return tp; if (tp != NULL) return tp;
} }
} }
}
/* Didn't find a terminal (S/D) type tile anywhere. Flag an error. */ /* Didn't find a terminal (S/D) type tile anywhere. Flag an error. */

View File

@ -1484,7 +1484,7 @@ ResFixUpConnections(simDev, layoutDev, simNode, nodename)
resNodeNum--; resNodeNum--;
notdecremented = FALSE; notdecremented = FALSE;
} }
ResFixDevName(newname,DRAIN,simDev,source); ResFixDevName(newname, DRAIN, simDev, source);
source->rn_name = simDev->drain->name; source->rn_name = simDev->drain->name;
} }
} }