From 619409556cd9b8ee63575cf9f8f6761e7ca10307 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Mon, 4 Sep 2023 14:40:30 -0400 Subject: [PATCH] Modified the handling of zero-valued resistors and voltage sources so that they are *not* removed to make a better match if they are shorting across two ports. If removed, then the port lists will get screwed up. It is better to let the subcircuits fail matching. Then, after the mismatched subcircuits are flattened, if the zero- valued resistor or voltage source no longer connects two ports, it can be safely removed to make a better match. --- base/flatten.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/base/flatten.c b/base/flatten.c index 1f3b7dc..63628fa 100644 --- a/base/flatten.c +++ b/base/flatten.c @@ -1948,6 +1948,29 @@ PrematchLists(char *name1, int file1, char *name2, int file2) break; } } + + /* Do NOT remove shorting devices that */ + /* connect two ports. Otherwise the */ + /* port lists get screwed up. It is */ + /* better in that case to force the */ + /* cells to be declared mismatched. */ + + if (ecomp->cell1->class != CLASS_ISOURCE) { + int found1 = FALSE; + int found2 = FALSE; + for (ob2 = tc1->cell; ob2; ob2 = ob2->next) { + if (!IsPort(ob2)) break; + else if (ob2->node == node1) + found1 = TRUE; + else if (ob2->node == node2) + found2 = TRUE; + if (found1 && found2) { + found = FALSE; + break; + } + } + } + if (found) break; } if (found) {