Reworked the previous commit in a way that makes more sense, as

the problem only occurs when handling the legacy "fet" device.
This commit is contained in:
Tim Edwards 2023-02-13 13:41:58 -05:00
parent 5fcd4441c1
commit 87702ac98a
2 changed files with 15 additions and 34 deletions

View File

@ -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

View File

@ -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);