Resolved the case mentioned in a prior commit where the case of N

devices in parallel with unconnected pins would be confused with
N devices in parallel with those pins all tied together.  This is
treated as a property error.
This commit is contained in:
Tim Edwards 2021-03-02 16:49:03 -05:00
parent f92192efd4
commit 792c5e569a
5 changed files with 64 additions and 24 deletions

View File

@ -193,17 +193,19 @@ void flattenCell(char *name, int file)
if (Debug) Printf("Renaming %s to %s\n", tmp->name, tmpstr); if (Debug) Printf("Renaming %s to %s\n", tmp->name, tmpstr);
FreeString(tmp->name); FreeString(tmp->name);
tmp->name = strsave(tmpstr); tmp->name = strsave(tmpstr);
#if OLDPREFIX
sprintf(tmpstr, "%s%s%s", ParentParams->instance.name, SEPARATOR,
tmp->instance.name);
#else
strcpy(tmpstr+prefixlength,tmp->instance.name);
#endif
FreeString(tmp->instance.name);
tmp->instance.name = strsave(tmpstr);
HashPtrInstall(tmp->name, tmp, &(ThisCell->objdict)); HashPtrInstall(tmp->name, tmp, &(ThisCell->objdict));
if (tmp->type == FIRSTPIN) if ((tmp->type != NODE) && (tmp->instance.name != NULL)) {
HashPtrInstall(tmp->instance.name, tmp, &(ThisCell->instdict)); #if OLDPREFIX
sprintf(tmpstr, "%s%s%s", ParentParams->instance.name, SEPARATOR,
tmp->instance.name);
#else
strcpy(tmpstr+prefixlength,tmp->instance.name);
#endif
FreeString(tmp->instance.name);
tmp->instance.name = strsave(tmpstr);
if (tmp->type == FIRSTPIN)
HashPtrInstall(tmp->instance.name, tmp, &(ThisCell->instdict));
}
} }
/* splice instance out of parent */ /* splice instance out of parent */
@ -470,17 +472,19 @@ int flattenInstancesOf(char *name, int fnum, char *instance)
if (Debug) Printf("Renaming %s to %s\n", tmp->name, tmpstr); if (Debug) Printf("Renaming %s to %s\n", tmp->name, tmpstr);
FreeString(tmp->name); FreeString(tmp->name);
tmp->name = strsave(tmpstr); tmp->name = strsave(tmpstr);
#if OLDPREFIX
sprintf(tmpstr, "%s%s%s", ParentParams->instance.name, SEPARATOR,
tmp->instance.name);
#else
strcpy(tmpstr+prefixlength,tmp->instance.name);
#endif
FreeString(tmp->instance.name);
tmp->instance.name = strsave(tmpstr);
HashPtrInstall(tmp->name, tmp, &(ThisCell->objdict)); HashPtrInstall(tmp->name, tmp, &(ThisCell->objdict));
if (tmp->type == FIRSTPIN) if ((tmp->type != NODE) && (tmp->instance.name != NULL)) {
HashPtrInstall(tmp->instance.name, tmp, &(ThisCell->instdict)); #if OLDPREFIX
sprintf(tmpstr, "%s%s%s", ParentParams->instance.name, SEPARATOR,
tmp->instance.name);
#else
strcpy(tmpstr+prefixlength,tmp->instance.name);
#endif
FreeString(tmp->instance.name);
tmp->instance.name = strsave(tmpstr);
if (tmp->type == FIRSTPIN)
HashPtrInstall(tmp->instance.name, tmp, &(ThisCell->instdict));
}
} }
/* Do property inheritance */ /* Do property inheritance */

View File

@ -5360,6 +5360,32 @@ PropertyMatch(struct objlist *ob1, int file1,
#endif #endif
} }
/* WIP---Check for no-connect pins in merged devices on both sides. */
/* Both sides should either have no-connects marked, or neither. */
/* (Permutable pins may need to be handled correctly. . . */
for (tp1 = ob1, tp2 = ob2; (tp1 != NULL) && tp1->type >= FIRSTPIN &&
(tp2 != NULL) && tp2->type >= FIRSTPIN; tp1 = tp1->next, tp2 = tp2->next)
{
struct objlist *node1, *node2;
node1 = Circuit1->nodename_cache[tp1->node];
node2 = Circuit2->nodename_cache[tp2->node];
if (node1->instance.flags != node2->instance.flags)
{
Fprintf(stdout, " Parallelized instances disagree on pin connections.\n");
Fprintf(stdout, " Circuit1 instance %s pin %s connections are %s (%d)\n",
tp1->instance.name, node1->name,
(node1->instance.flags == 0) ? "tied together" : "no connects",
node1->instance.flags);
Fprintf(stdout, " Circuit2 instance %s pin %s connections are %s (%d)\n",
tp2->instance.name, node2->name,
(node2->instance.flags == 0) ? "tied together" : "no connects",
node2->instance.flags);
mismatches++;
}
}
// Attempt to organize devices by series and parallel combination // Attempt to organize devices by series and parallel combination
if (t1type == PROPERTY && t2type == PROPERTY) if (t1type == PROPERTY && t2type == PROPERTY)
PropertySortAndCombine(obn1, tc1, obn2, tc2); PropertySortAndCombine(obn1, tc1, obn2, tc2);

View File

@ -1337,7 +1337,7 @@ void Node(char *name)
tp->name = strsave(name); tp->name = strsave(name);
tp->type = NODE; /* internal node type */ tp->type = NODE; /* internal node type */
tp->model.class = NULL; tp->model.class = NULL;
tp->instance.name = NULL; tp->instance.flags = 0;
tp->node = -1; /* null node */ tp->node = -1; /* null node */
tp->next = NULL; tp->next = NULL;
AddToCurrentCell (tp); AddToCurrentCell (tp);
@ -3217,7 +3217,11 @@ int CombineParallel(char *model, int file)
for (ob2 = ob; ob2 && (ob2->type > FIRSTPIN || ob2 == ob); ob2 = ob2->next) { for (ob2 = ob; ob2 && (ob2->type > FIRSTPIN || ob2 == ob); ob2 = ob2->next) {
if ((ob2->node >= 0) && (nodecount[ob2->node] == 1)) if ((ob2->node >= 0) && (nodecount[ob2->node] == 1))
{
nob = (tp->nodename_cache)[ob2->node];
nob->instance.flags = NO_CONNECT;
strcat(pptr, "_nc"); strcat(pptr, "_nc");
}
else else
sprintf(pptr, "_%d", ob2->node); sprintf(pptr, "_%d", ob2->node);
pptr += strlen(pptr); pptr += strlen(pptr);

View File

@ -975,7 +975,10 @@ struct objlist *CopyObjList(struct objlist *oldlist, unsigned char doforall)
newob->model.class = NULL; newob->model.class = NULL;
else else
newob->model.class = strsave(tmp->model.class); newob->model.class = strsave(tmp->model.class);
newob->instance.name = (tmp->instance.name) ? if (newob->type == NODE)
newob->instance.flags = tmp->instance.flags;
else
newob->instance.name = (tmp->instance.name) ?
strsave(tmp->instance.name) : NULL; strsave(tmp->instance.name) : NULL;
} }
newob->node = tmp->node; newob->node = tmp->node;
@ -1095,8 +1098,8 @@ void FreeObject(struct objlist *ob)
FREE(ob->instance.props); FREE(ob->instance.props);
} }
} }
else { else if (ob->type != NODE) {
/* All other records */ /* All other records except NODE, which uses this for flags */
if (ob->instance.name != NULL) FreeString(ob->instance.name); if (ob->instance.name != NULL) FreeString(ob->instance.name);
} }
if (ob->model.class != NULL) FreeString(ob->model.class); if (ob->model.class != NULL) FreeString(ob->model.class);

View File

@ -28,6 +28,8 @@
#define PROXY (0) /* Used in model.port record of ports */ #define PROXY (0) /* Used in model.port record of ports */
#define NO_CONNECT 1 /* Use in object list to flag an isolated net */
/* Lists of device properties. Order is defined at the time of */ /* Lists of device properties. Order is defined at the time of */
/* the cell definition; values are sorted at the time instances */ /* the cell definition; values are sorted at the time instances */
/* are read. */ /* are read. */
@ -160,6 +162,7 @@ struct objlist {
union { union {
char *name; /* unique name for the instance, or */ char *name; /* unique name for the instance, or */
/* (string) value of property for properties */ /* (string) value of property for properties */
int flags; /* Used by NODE type to flag isolated net */
struct valuelist *props; /* Property record */ struct valuelist *props; /* Property record */
} instance; } instance;
int node; /* the electrical node number of the port/node/pin */ int node; /* the electrical node number of the port/node/pin */