From 87702ac98ace172c05d891e15e9d66b0be13356d Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Mon, 13 Feb 2023 13:41:58 -0500 Subject: [PATCH] Reworked the previous commit in a way that makes more sense, as the problem only occurs when handling the legacy "fet" device. --- resis/ResPrint.c | 35 +---------------------------------- resis/ResReadSim.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 34 deletions(-) diff --git a/resis/ResPrint.c b/resis/ResPrint.c index 2f24b632..17b20db9 100644 --- a/resis/ResPrint.c +++ b/resis/ResPrint.c @@ -112,7 +112,6 @@ ResPrintExtDev(outextfile, devices) FILE *outextfile; RDev *devices; { - TileType t; char *subsName; ExtDevice *devptr, *devtest; @@ -122,39 +121,7 @@ ResPrintExtDev(outextfile, devices) { if (ResOptionsFlags & ResOpt_DoExtFile) { - t = devices->layout->rd_devtype; - devptr = ExtCurStyle->exts_device[t]; - - /* Make sure the number of S/D terminals matches for */ - /* the device record. */ - - if ((devices->drain == NULL) && (devptr->exts_deviceSDCount == 2)) - { - /* Check if there is a compatible device */ - /* with 2 terminals */ - - for (devtest = devptr->exts_next; devtest; - devtest = devtest->exts_next) - if (devtest->exts_deviceSDCount == 1) - { - devptr = devtest; - break; - } - } - else if ((devices->drain != NULL) && (devptr->exts_deviceSDCount == 1)) - { - /* Check if there is a compatible device */ - /* with 3 terminals */ - - for (devtest = devptr->exts_next; devtest; - devtest = devtest->exts_next) - if (devtest->exts_deviceSDCount == 2) - { - devptr = devtest; - break; - } - } - + devptr = devices->rs_devptr; subsName = devptr->exts_deviceSubstrateName; #ifdef MAGIC_WRAPPER diff --git a/resis/ResReadSim.c b/resis/ResReadSim.c index 4af35736..61007f2a 100644 --- a/resis/ResReadSim.c +++ b/resis/ResReadSim.c @@ -478,6 +478,7 @@ ResSimDevice(line, rpersquare, devptr) char *newattr, tmpattr[MAXTOKEN]; static int nowarning = TRUE; float lambda; + ExtDevice *devtest; if ((line[RDEV_WIDTH][0] == '\0') || (line[RDEV_LENGTH][0] == '\0')) { @@ -502,6 +503,19 @@ ResSimDevice(line, rpersquare, devptr) device->status = FALSE; device->nextDev = ResRDevList; + /* Check that devptr matches the device name and number of terminals */ + /* Note that this routine is only called for the original "fet" */ + /* types with fixed names, so the names must match and there must */ + /* always be three terminals (two source/drain terminals). */ + + if (devptr->exts_deviceSDCount != 2) + for (devtest = devptr->exts_next; devtest; devtest = devtest->exts_next) + if (devtest->exts_deviceSDCount == 2) + { + devptr = devtest; + break; + } + lambda = (float)ExtCurStyle->exts_unitsPerLambda / resscale; device->location.p_x = (int)((float)atof(line[RDEV_DEVX]) / lambda); device->location.p_y = (int)((float)atof(line[RDEV_DEVY]) / lambda);