From e72f85fd105f2f87a809a0512f85b0da75b0350e Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 24 Feb 2023 12:58:46 -0500 Subject: [PATCH] Corrected the ext2sim output and extresist to properly handle 2-terminal devices without complaining. The previous handling seemed to be technically correct other than spitting out warnings about missing terminals. --- VERSION | 2 +- ext2sim/ext2sim.c | 34 ++++++++++++++++++++-------------- resis/ResRex.c | 11 +++++++++++ 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/VERSION b/VERSION index 68fe120c..02017a7a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.370 +8.3.371 diff --git a/ext2sim/ext2sim.c b/ext2sim/ext2sim.c index 40c5ad35..0916d047 100644 --- a/ext2sim/ext2sim.c +++ b/ext2sim/ext2sim.c @@ -1169,22 +1169,28 @@ simdevVisit(dev, hc, scale, trans) } } - if (is_subckt && subnode) + if (dev->dev_class != DEV_DIODE && dev->dev_class != DEV_NDIODE && + dev->dev_class != DEV_PDIODE) { - /* As a general policy on subcircuits supporting extresist, */ - /* output the subcircuit node as the last port of the */ - /* subcircuit definition. */ - putc(' ', esSimF); - simdevSubstrate(hierName, subnode->efnode_name->efnn_hier, - dev->dev_type, 0.0, FALSE, esSimF); - } + if (is_subckt && subnode) + { + /* As a general policy on subcircuits supporting extresist, */ + /* output the subcircuit node as the last port of the */ + /* subcircuit definition, *except* for the use of the 'x' */ + /* device type for diodes. */ - /* Support gemini's substrate comparison */ - else if (esFormat == LBL && subnode) - { - putc(' ', esSimF); - simdevSubstrate(hierName, subnode->efnode_name->efnn_hier, + putc(' ', esSimF); + simdevSubstrate(hierName, subnode->efnode_name->efnn_hier, dev->dev_type, 0.0, FALSE, esSimF); + } + + /* Support gemini's substrate comparison */ + else if (esFormat == LBL && subnode) + { + putc(' ', esSimF); + simdevSubstrate(hierName, subnode->efnode_name->efnn_hier, + dev->dev_type, 0.0, FALSE, esSimF); + } } GeoTransRect(trans, &dev->dev_rect, &r); @@ -1228,7 +1234,7 @@ simdevVisit(dev, hc, scale, trans) /* Output source and drain attributes */ if (source->dterm_attrs) fprintf(esSimF, " s=%s", source->dterm_attrs); - if (drain->dterm_attrs) + if ((source != drain) && drain->dterm_attrs) fprintf(esSimF, " d=%s", drain->dterm_attrs); /* Output length, width, and position as attributes */ diff --git a/resis/ResRex.c b/resis/ResRex.c index d9255771..ba424c05 100644 --- a/resis/ResRex.c +++ b/resis/ResRex.c @@ -1322,8 +1322,19 @@ ResFixUpConnections(simDev, layoutDev, simNode, nodename) layoutDev->rd_inside.r_xbot, layoutDev->rd_inside.r_ybot, nodename); } + if (simDev->source == simNode) { + /* Check for devices with only one terminal. If it was cast as drain, */ + /* then swap it with the source so that the code below handles it */ + /* correctly. */ + + if (layoutDev->rd_fet_source == NULL && layoutDev->rd_fet_drain != NULL) + { + layoutDev->rd_fet_source = layoutDev->rd_fet_drain; + layoutDev->rd_fet_drain = (struct resnode *)NULL; + } + if (simDev->drain == simNode) { if (((source = layoutDev->rd_fet_source) != NULL) &&