From d0f3aaeb598d1c28075772e5434b46a2b08998a4 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Mon, 16 Dec 2019 09:55:11 -0500 Subject: [PATCH] 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. --- ext2spice/ext2hier.c | 8 +++----- extflat/EFread.c | 6 +++++- lef/lefWrite.c | 3 ++- resis/ResPrint.c | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ext2spice/ext2hier.c b/ext2spice/ext2hier.c index 6f6fc555..fc010154 100644 --- a/ext2spice/ext2hier.c +++ b/ext2spice/ext2hier.c @@ -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; } diff --git a/extflat/EFread.c b/extflat/EFread.c index 810940d6..5cc53d43 100644 --- a/extflat/EFread.c +++ b/extflat/EFread.c @@ -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) */ diff --git a/lef/lefWrite.c b/lef/lefWrite.c index 3adfc12a..8c3f7530 100644 --- a/lef/lefWrite.c +++ b/lef/lefWrite.c @@ -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; diff --git a/resis/ResPrint.c b/resis/ResPrint.c index f3996339..49cc3db6 100644 --- a/resis/ResPrint.c +++ b/resis/ResPrint.c @@ -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); } } }