Merge branch 'master' into netgen-1.5

This commit is contained in:
Tim Edwards 2022-06-13 02:00:18 -04:00
commit 0a94bec191
4 changed files with 79 additions and 16 deletions

View File

@ -1 +1 @@
1.5.222 1.5.223

View File

@ -1128,13 +1128,33 @@ int UniquePins(char *name, int filenum)
firstport = (struct objlist **)CALLOC(maxnode + 1, sizeof(struct objlist *)); firstport = (struct objlist **)CALLOC(maxnode + 1, sizeof(struct objlist *));
portcount = FIRSTPIN; portcount = FIRSTPIN;
lob = NULL;
for (ob = ThisCell->cell; ob != NULL; ob = ob->next) { for (ob = ThisCell->cell; ob != NULL; ob = ob->next) {
if (ob->type != PORT) break; if (ob->type != PORT) break;
if (ob->node > 0) { if (ob->node > 0) {
nodecount[ob->node]++; nodecount[ob->node]++;
if (nodecount[ob->node] == 2) { if (nodecount[ob->node] == 2) {
if (!(*matchfunc)(firstport[ob->node]->name, ob->name)) {
Printf("Pins %s and %s are shorted in cell %s (%d)\n", ob->name,
firstport[ob->node]->name, ThisCell->name, ThisCell->file);
/* Do not count this as a duplicate pin. */
nodecount[ob->node]--;
/* Move the pin adjacent to the one it is shorted to (if it
* isn't already); this will make the work of MatchPins() easier.
*/
if (firstport[ob->node]->next != ob) {
lob->next = ob->next;
ob->next = firstport[ob->node]->next;
firstport[ob->node]->next = ob;
ob = lob;
}
lob = ob;
continue;
}
else {
Printf("Duplicate pin %s in cell %s\n", ob->name, ThisCell->name); Printf("Duplicate pin %s in cell %s\n", ob->name, ThisCell->name);
} }
}
if (nodecount[ob->node] > 1) { if (nodecount[ob->node] > 1) {
/* Remove this node; prep for removal by marking with UNKNOWN */ /* Remove this node; prep for removal by marking with UNKNOWN */
ob->type = UNKNOWN; ob->type = UNKNOWN;
@ -1148,6 +1168,7 @@ int UniquePins(char *name, int filenum)
} }
} }
portcount++; portcount++;
lob = ob;
} }
if (needscleanup) if (needscleanup)

View File

@ -7297,8 +7297,7 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist)
if (IsPort(obn)) { if (IsPort(obn)) {
i = 0; i = 0;
for (ob1 = tc1->cell; ob1 != NULL; ob1 = ob1->next, i++) { for (ob1 = tc1->cell; ob1 != NULL; ob1 = ob1->next, i++) {
if ((IsPort(ob1)) if ((IsPort(ob1)) && (ob1->node == obn->node)) {
&& (*matchfunc)(ob1->name, obn->name)) {
b = 0; b = 0;
for (N2 = NC->nodes; N2 != NULL; N2 = N2->next) { for (N2 = NC->nodes; N2 != NULL; N2 = N2->next) {
if (N2->graph != Circuit1->file) { if (N2->graph != Circuit1->file) {
@ -7323,21 +7322,42 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist)
obp = N2->object; obp = N2->object;
j = 0; j = 0;
for (ob2 = tc2->cell; ob2 != NULL; ob2 = ob2->next, j++) { for (ob2 = tc2->cell; ob2 != NULL; ob2 = ob2->next, j++) {
if ((IsPort(ob2)) if ((IsPort(ob2)) && (ob2->node == obp->node)) {
&& (*matchfunc)(ob2->name, obp->name)) {
if (Debug == 0) { if (Debug == 0) {
for (m = 0; m < left_col_end; m++) *(ostr + m) = ' '; for (m = 0; m < left_col_end; m++) *(ostr + m) = ' ';
for (m = left_col_end + 1; m < right_col_end; m++) *(ostr + m) = ' '; for (m = left_col_end + 1; m < right_col_end; m++) *(ostr + m) = ' ';
snprintf(ostr, left_col_end, "%s", obn->name); snprintf(ostr, left_col_end, "%s", ob1->name);
if ((*matchfunc)(obn->name, obp->name)) if ((*matchfunc)(ob1->name, ob2->name))
snprintf(ostr + left_col_end + 1, left_col_end, "%s", obp->name); snprintf(ostr + left_col_end + 1, left_col_end, "%s", ob2->name);
else { else {
snprintf(ostr + left_col_end + 1, left_col_end, "%s **Mismatch**", obp->name); /* Check remainder of ports to see if there is a name match on the
* same net number (multiple ports tied to the same net)
*/
struct objlist *ob3;
for (ob3 = ob2->next, ++j; ob3 != NULL; ob3 = ob3->next, j++) {
if ((IsPort(ob3)) && (ob3->node == ob2->node)) {
if ((*matchfunc)(ob3->name, ob1->name)) {
ob2 = ob3;
snprintf(ostr + left_col_end + 1, left_col_end, "%s", ob2->name);
break;
}
}
else {
ob3 = NULL;
break; /* All pins w/the same node should be together */
}
}
if (ob3 == NULL) {
if (ob2->model.port == -1)
snprintf(ostr + left_col_end + 1, left_col_end, "%s **Mismatch**", ob2->name);
else
snprintf(ostr + left_col_end + 1, left_col_end, "(no matching pin)");
/* Pins with different names are on different nets, /* Pins with different names are on different nets,
* so this should trigger an error return code. * so this should trigger an error return code.
*/ */
result = 0; result = 0;
} }
}
for (m = 0; m < right_col_end + 1; m++) for (m = 0; m < right_col_end + 1; m++)
if (*(ostr + m) == '\0') *(ostr + m) = ' '; if (*(ostr + m) == '\0') *(ostr + m) = ' ';
Fprintf(stdout, ostr); Fprintf(stdout, ostr);
@ -7358,6 +7378,15 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist)
#endif #endif
ob2->model.port = i; /* save order */ ob2->model.port = i; /* save order */
*(cover + i) = (char)1; *(cover + i) = (char)1;
/* If there are multiple pins on the same net, cycle through them; */
/* otherwise, move to the next entry in the partition. */
if (ob1->next && (ob1->next->node == ob1->node)) {
ob1 = ob1->next;
ob2 = tc2->cell; /* Restart search for matching pin */
i++;
}
else
break; break;
} }
} }

View File

@ -1449,7 +1449,20 @@ skip_ends:
if (LookupObject(pos, CurrentCell) == NULL) Node(pos); if (LookupObject(pos, CurrentCell) == NULL) Node(pos);
if (LookupObject(neg, CurrentCell) == NULL) Node(neg); if (LookupObject(neg, CurrentCell) == NULL) Node(neg);
/* Any device properties? */ /* Get voltage value (if present); save as property "value" */
if (nexttok != NULL) {
if (matchnocase(nexttok, "DC")) {
SpiceTokNoNewline();
}
}
if (nexttok != NULL) {
if (StringIsValueOrExpression(nexttok)) {
AddProperty(&kvlist, "value", nexttok);
}
}
/* Any other device properties? */
while (nexttok != NULL) while (nexttok != NULL)
{ {
SpiceTokNoNewline(); SpiceTokNoNewline();
@ -1477,7 +1490,7 @@ skip_ends:
else if (CountPorts(model, filenum) != 2) { else if (CountPorts(model, filenum) != 2) {
/* Modeled device: Make sure it has the right number of ports */ /* Modeled device: Make sure it has the right number of ports */
Fprintf(stderr, "Device \"%s\" has wrong number of ports for a " Fprintf(stderr, "Device \"%s\" has wrong number of ports for a "
"voltage source.\n"); "voltage source.\n", inst);
goto baddevice; goto baddevice;
} }
Cell(instname, model, pos, neg); Cell(instname, model, pos, neg);