diff --git a/VERSION b/VERSION index 4f1fcfd..275ebd9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.187 +1.5.188 diff --git a/base/flatten.c b/base/flatten.c index 89af7e2..58b3d78 100644 --- a/base/flatten.c +++ b/base/flatten.c @@ -257,7 +257,7 @@ int flattenInstancesOf(char *name, int fnum, char *instance) struct objlist *ParentProps, *CurrentProp; struct objlist *NextObj, *LastObj, *prepp; struct objlist *ChildObjList, *ChildListEnd; - struct objlist *ChildStart, *ChildEnd, *ParentEnd; + struct objlist *ChildStart, *ChildEnd, *ParentEnd, *ParentNext; struct nlist *ThisCell; struct nlist *ChildCell; struct objlist *tmp, *ob2, *ob3; @@ -445,6 +445,10 @@ int flattenInstancesOf(char *name, int fnum, char *instance) } else tmp = tmp->next; } + if (ChildStart == NULL) { + if (ChildListEnd == ChildEnd) ChildListEnd = NULL; + ChildEnd = NULL; + } } /* for each element in child, prepend 'prefix' */ @@ -542,8 +546,10 @@ int flattenInstancesOf(char *name, int fnum, char *instance) } /* Put the child cell at the start of ChildObjList */ - ChildEnd->next = ChildObjList; - ChildObjList = ChildStart; + if (ChildEnd) { + ChildEnd->next = ChildObjList; + ChildObjList = ChildStart; + } /* Pull the instance out of the parent */ @@ -552,7 +558,7 @@ int flattenInstancesOf(char *name, int fnum, char *instance) /* ParentParams are the very first thing in the list */ ThisCell->cell = ChildObjList; } - else { + else if (ChildObjList) { /* find ParentParams in ThisCell list. In most cases, LastObj */ /* should be pointing to it. */ if (LastObj && (LastObj->next == ParentParams)) { @@ -570,12 +576,17 @@ int flattenInstancesOf(char *name, int fnum, char *instance) ob2->next = ChildObjList; } } + else { + /* The child was completely optimized out, so close list around it */ + LastObj->next = ParentEnd->next; + } /* Link end of child list into the parent */ - if (ChildListEnd) + if (ChildListEnd && ParentEnd) ChildListEnd->next = ParentEnd->next; } - while (ParentParams != ChildListEnd->next) { + ParentNext = (ParentEnd) ? ParentEnd->next : NULL; + while (ParentParams != ParentNext) { ob2 = ParentParams->next; FreeObjectAndHash(ParentParams, ThisCell); ParentParams = ob2; diff --git a/base/netcmp.c b/base/netcmp.c index 8cb52db..f20dc1b 100644 --- a/base/netcmp.c +++ b/base/netcmp.c @@ -5601,7 +5601,6 @@ PropertyMatch(struct objlist *ob1, int file1, int t1type, t2type; int i, mismatches = 0, checked_one; int rval = 1; - int flags1, flags2; char *inst1, *inst2; #ifdef TCL_NETGEN Tcl_Obj *proplist = NULL, *mpair, *mlist; @@ -5714,22 +5713,16 @@ PropertyMatch(struct objlist *ob1, int file1, * single node) has non-zero flags. A non-node entry in the cache * implies a node with zero flags. */ - flags1 = flags2 = 0; - if ((node1->type <= NODE) && (node1->type >= UNIQUEGLOBAL)) - flags1 = node1->instance.flags; - if ((node2->type <= NODE) && (node2->type >= UNIQUEGLOBAL)) - flags2 = node2->instance.flags; - - if (flags1 != flags2) { + if (node1->flags != node1->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); + (node1->flags == 0) ? "tied together" : "no connects", + node1->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); + (node2->flags == 0) ? "tied together" : "no connects", + node2->flags); mismatches++; } } @@ -6815,6 +6808,11 @@ int reorderpins(struct hashlist *p, int file) "Ordering will be arbitrary.\n", tc2->name); for (ob = ptr->cell; ob != NULL; ) { + /* Catch badness */ + if (ob->next && (ob->next->node > 100000)) { + Fprintf(stdout, "Bad.\n"); + } + if (ob->type == FIRSTPIN) { if ((*matchfunc)(ob->model.class, tc2->name)) { char *sptr = ob->instance.name; @@ -6833,6 +6831,7 @@ int reorderpins(struct hashlist *p, int file) nodes[ob2->model.port] = ob->node; names[ob2->model.port] = ob->name; } + ob = ob->next; ob2 = ob2->next; if (i < numports - 1) { diff --git a/base/netgen.c b/base/netgen.c index cc4d04d..405ed26 100644 --- a/base/netgen.c +++ b/base/netgen.c @@ -1352,7 +1352,8 @@ void Node(char *name) tp->name = strsave(name); tp->type = NODE; /* internal node type */ tp->model.class = NULL; - tp->instance.flags = 0; + tp->instance.name = NULL; + tp->flags = 0; tp->node = -1; /* null node */ tp->next = NULL; AddToCurrentCell (tp); @@ -3259,9 +3260,7 @@ int CombineParallel(char *model, int file) if ((ob2->node >= 0) && (nodecount[ob2->node] == 1)) { nob = (tp->nodename_cache)[ob2->node]; - /* NOTE: nob must be a pin type or NODE, so it's */ - /* okay to set the instance.flags record for it. */ - nob->instance.flags = NO_CONNECT; + nob->flags = NO_CONNECT; strcat(pptr, "_nc"); } else diff --git a/base/objlist.c b/base/objlist.c index 284c68e..17102f2 100644 --- a/base/objlist.c +++ b/base/objlist.c @@ -975,10 +975,8 @@ struct objlist *CopyObjList(struct objlist *oldlist, unsigned char doforall) newob->model.class = NULL; else newob->model.class = strsave(tmp->model.class); - if (newob->type == NODE) - newob->instance.flags = tmp->instance.flags; - else - newob->instance.name = (tmp->instance.name) ? + newob->flags = tmp->flags; + newob->instance.name = (tmp->instance.name) ? strsave(tmp->instance.name) : NULL; } newob->node = tmp->node; @@ -1098,8 +1096,8 @@ void FreeObject(struct objlist *ob) FREE(ob->instance.props); } } - else if (ob->type != NODE) { - /* All other records except NODE, which uses this for flags */ + else { + /* All other records */ if (ob->instance.name != NULL) FreeString(ob->instance.name); } if (ob->model.class != NULL) FreeString(ob->model.class); diff --git a/base/objlist.h b/base/objlist.h index 550ad2d..500018e 100644 --- a/base/objlist.h +++ b/base/objlist.h @@ -162,9 +162,9 @@ struct objlist { union { char *name; /* unique name for the instance, or */ /* (string) value of property for properties */ - int flags; /* Used by NODE type to flag isolated net */ struct valuelist *props; /* Property record */ } instance; + unsigned char flags; /* Used by NODE type to flag isolated net */ int node; /* the electrical node number of the port/node/pin */ struct objlist *next; };