Corrected errors in the extresist code and in extflat, both of which
can result in negative resistors due to integer overflow. In all cases, the target was floating-point and it was only necessary to recast everything to float first.
This commit is contained in:
parent
8fb96db14c
commit
fc62a63d41
|
|
@ -1453,14 +1453,14 @@ efBuildResistor(def, nodeName1, nodeName2, resistance)
|
||||||
Def *def; /* Def to which this connection is to be added */
|
Def *def; /* Def to which this connection is to be added */
|
||||||
char *nodeName1; /* Name of first node in resistor */
|
char *nodeName1; /* Name of first node in resistor */
|
||||||
char *nodeName2; /* Name of second node in resistor */
|
char *nodeName2; /* Name of second node in resistor */
|
||||||
int resistance; /* Resistor value */
|
float resistance; /* Resistor value */
|
||||||
{
|
{
|
||||||
Connection *conn;
|
Connection *conn;
|
||||||
|
|
||||||
conn = (Connection *) mallocMagic((unsigned)(sizeof (Connection)));
|
conn = (Connection *) mallocMagic((unsigned)(sizeof (Connection)));
|
||||||
if (efConnInitSubs(conn, nodeName1, nodeName2))
|
if (efConnInitSubs(conn, nodeName1, nodeName2))
|
||||||
{
|
{
|
||||||
conn->conn_res = (float)resistance;
|
conn->conn_res = resistance;
|
||||||
conn->conn_next = def->def_resistors;
|
conn->conn_next = def->def_resistors;
|
||||||
def->def_resistors = conn;
|
def->def_resistors = conn;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -596,11 +596,9 @@ resistChanged:
|
||||||
|
|
||||||
/* resistor node1 node2 resistance */
|
/* resistor node1 node2 resistance */
|
||||||
/* NOTE: Value changed to floating-point 12/16/2019; */
|
/* NOTE: Value changed to floating-point 12/16/2019; */
|
||||||
/* (value * rscale) is in milliohms which is integer as */
|
|
||||||
/* resolution finer than milliohms is deemed unnecessary. */
|
|
||||||
case RESISTOR:
|
case RESISTOR:
|
||||||
efBuildResistor(def, argv[1], argv[2],
|
efBuildResistor(def, argv[1], argv[2],
|
||||||
(int)(0.5 + (double)rscale * atof(argv[3])));
|
(float)(0.5 + (double)rscale * atof(argv[3])));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* abstract (no options/arguments) */
|
/* abstract (no options/arguments) */
|
||||||
|
|
|
||||||
|
|
@ -259,8 +259,9 @@ ResCalcEastWest(tile, pendingList, doneList, resList)
|
||||||
ExtCurStyle->exts_thick[resistor->rr_tt];
|
ExtCurStyle->exts_thick[resistor->rr_tt];
|
||||||
#endif
|
#endif
|
||||||
resistor->rr_value =
|
resistor->rr_value =
|
||||||
(ExtCurStyle->exts_sheetResist[resistor->rr_tt]
|
(float)ExtCurStyle->exts_sheetResist[resistor->rr_tt]
|
||||||
* (p2->br_loc.p_x - p1->br_loc.p_x)) / height;
|
* (float)(p2->br_loc.p_x - p1->br_loc.p_x)
|
||||||
|
/ (float)height;
|
||||||
rArea = ((p2->br_loc.p_x - p1->br_loc.p_x) * height) / 2;
|
rArea = ((p2->br_loc.p_x - p1->br_loc.p_x) * height) / 2;
|
||||||
resistor->rr_connection1->rn_float.rn_area += rArea;
|
resistor->rr_connection1->rn_float.rn_area += rArea;
|
||||||
resistor->rr_connection2->rn_float.rn_area += rArea;
|
resistor->rr_connection2->rn_float.rn_area += rArea;
|
||||||
|
|
@ -426,8 +427,9 @@ ResCalcNorthSouth(tile, pendingList, doneList, resList)
|
||||||
* ExtCurStyle->exts_thick[resistor->rr_tt];
|
* ExtCurStyle->exts_thick[resistor->rr_tt];
|
||||||
#endif
|
#endif
|
||||||
resistor->rr_value =
|
resistor->rr_value =
|
||||||
(ExtCurStyle->exts_sheetResist[resistor->rr_tt]
|
(float)ExtCurStyle->exts_sheetResist[resistor->rr_tt]
|
||||||
* (p2->br_loc.p_y - p1->br_loc.p_y)) / width;
|
* (float)(p2->br_loc.p_y - p1->br_loc.p_y)
|
||||||
|
/ (float)width;
|
||||||
rArea = ((p2->br_loc.p_y - p1->br_loc.p_y) * width) / 2;
|
rArea = ((p2->br_loc.p_y - p1->br_loc.p_y) * width) / 2;
|
||||||
resistor->rr_connection1->rn_float.rn_area += rArea;
|
resistor->rr_connection1->rn_float.rn_area += rArea;
|
||||||
resistor->rr_connection2->rn_float.rn_area += rArea;
|
resistor->rr_connection2->rn_float.rn_area += rArea;
|
||||||
|
|
@ -895,12 +897,12 @@ ResDoContacts(contact, nodes, resList)
|
||||||
resistor->rr_cl = squaresy;
|
resistor->rr_cl = squaresy;
|
||||||
resistor->rr_width = squaresx;
|
resistor->rr_width = squaresx;
|
||||||
resistor->rr_value =
|
resistor->rr_value =
|
||||||
ExtCurStyle->exts_viaResist[contact->cp_type] /
|
(float)ExtCurStyle->exts_viaResist[contact->cp_type] /
|
||||||
(squaresx * squaresy);
|
(float)(squaresx * squaresy);
|
||||||
#ifdef ARIEL
|
#ifdef ARIEL
|
||||||
resistor->rr_csArea =
|
resistor->rr_csArea =
|
||||||
ExtCurStyle->exts_thick[contact->cp_type] /
|
(float)ExtCurStyle->exts_thick[contact->cp_type] /
|
||||||
(squaresx * squaresy);
|
(float)(squaresx * squaresy);
|
||||||
#endif
|
#endif
|
||||||
resistor->rr_tt = contact->cp_type;
|
resistor->rr_tt = contact->cp_type;
|
||||||
resistor->rr_float.rr_area = 0;
|
resistor->rr_float.rr_area = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue