Corrected ext2hier.c so that resistance output from extresist takes

the right argument type (float, not int).  Otherwise all resistances
from extresist come out zero when doing "ext2spice extresist on"
and "ext2spice hierarchy on".  Also changed the format of the resistance
in the SPICE output to type float, since values are in standard units of
ohms, and rounding to the nearest ohm seems excessively coarse-grained.
This commit is contained in:
Tim Edwards 2019-12-16 09:55:11 -05:00
parent be38dac9fb
commit d0f3aaeb59
4 changed files with 12 additions and 9 deletions

View File

@ -1159,13 +1159,11 @@ spcresistHierVisit(hc, hierName1, hierName2, res)
HierContext *hc;
HierName *hierName1;
HierName *hierName2;
int res;
float res;
{
res = (res + 500) / 1000;
fprintf(esSpiceF, "R%d %s %s %d\n", esResNum++,
fprintf(esSpiceF, "R%d %s %s %g\n", esResNum++,
nodeSpiceHierName(hc, hierName1),
nodeSpiceHierName(hc, hierName2), res);
nodeSpiceHierName(hc, hierName2), res / 1000.);
return 0;
}

View File

@ -581,8 +581,12 @@ resistChanged:
break;
/* resistor node1 node2 resistance */
/* 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:
efBuildResistor(def, argv[1], argv[2], rscale*atoi(argv[3]));
efBuildResistor(def, argv[1], argv[2],
(int)(0.5 + (double)rscale * atof(argv[3])));
break;
/* abstract (no options/arguments) */

View File

@ -84,6 +84,7 @@ lefFileOpen(def, file, suffix, mode, prealfile)
{
char namebuf[512], *name, *endp, *ends;
char *locsuffix;
char *pptr;
int len;
FILE *rfile;
@ -109,7 +110,7 @@ lefFileOpen(def, file, suffix, mode, prealfile)
if (endp = strrchr(ends, '.'))
{
if (!strcmp(endp, suffix))
if (strcmp(endp, suffix))
{
len = endp - name;
if (len > sizeof namebuf - 1) len = sizeof namebuf - 1;

View File

@ -85,10 +85,10 @@ ResPrintExtRes(outextfile,resistors,nodename)
}
if (ResOptionsFlags & ResOpt_DoExtFile)
{
fprintf(outextfile, "resist \"%s\" \"%s\" %d\n",
fprintf(outextfile, "resist \"%s\" \"%s\" %g\n",
resistors->rr_connection1->rn_name,
resistors->rr_connection2->rn_name,
(int) (resistors->rr_value/ExtCurStyle->exts_resistScale));
resistors->rr_value / (float)ExtCurStyle->exts_resistScale);
}
}
}