mirror of
https://github.com/RTimothyEdwards/netgen.git
synced 2026-08-25 15:37:39 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7870538ec9 | ||
|
|
e12883037c | ||
|
|
ee4e1e087f | ||
|
|
2d63fd63c1 | ||
|
|
7a8b5e835b | ||
|
|
e557e61a02 | ||
|
|
67da250615 | ||
|
|
77f7a773e3 | ||
|
|
cd013621a7 | ||
|
|
9a48a59f68 | ||
|
|
45712a04f1 | ||
|
|
535b8285e9 | ||
|
|
28a2950439 | ||
|
|
1e1d506697 | ||
|
|
013fff9f37 | ||
|
|
4edaf0813d | ||
|
|
2292ab813b |
@@ -17,6 +17,7 @@ along with this program; see the file copying. If not, write to
|
||||
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* inetcomp.c -- a simple wrapper to the NETCOMP() function */
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include "netgen.h"
|
||||
|
||||
+168
-58
@@ -17,7 +17,6 @@ along with this program; see the file copying. If not, write to
|
||||
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* netcmp.c -- graph isomorphism testing */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -162,6 +161,10 @@ int right_col_end = 87;
|
||||
/* if TRUE, always partition ALL classes */
|
||||
int ExhaustiveSubdivision = 0;
|
||||
|
||||
/* if TRUE, enforce that networks (e.g., resistor) must match */
|
||||
/* topologically, as opposed to just matching numerically. */
|
||||
int ExactTopology = 0;
|
||||
|
||||
#ifdef TEST
|
||||
static void PrintElement_List(struct Element *E)
|
||||
{
|
||||
@@ -4214,7 +4217,11 @@ void series_sort(struct objlist *ob1, struct nlist *tp1, int idx1, int run)
|
||||
struct property *kl;
|
||||
struct valuelist *vl, *sl;
|
||||
int i, p, sval, merge_type;
|
||||
double cval, slop;
|
||||
// double cval, slop;
|
||||
int has_crit;
|
||||
char ca, co;
|
||||
double tval, tslop;
|
||||
double aval, pval, oval, aslop, pslop;
|
||||
|
||||
obn = ob1->next;
|
||||
for (i = 0; i < idx1; i++) obn = obn->next;
|
||||
@@ -4227,55 +4234,94 @@ void series_sort(struct objlist *ob1, struct nlist *tp1, int idx1, int run)
|
||||
|
||||
obp = obn;
|
||||
sval = 1;
|
||||
cval = slop = 0.0;
|
||||
pval = aval = oval = 0.0;
|
||||
for (i = 0; i < run; i++) {
|
||||
sl = NULL;
|
||||
has_crit = FALSE;
|
||||
merge_type = MERGE_NONE;
|
||||
ca = co = (char)0;
|
||||
|
||||
for (p = 0;; p++) {
|
||||
vl = &(obp->instance.props[p]);
|
||||
if (vl->type == PROP_ENDLIST) break;
|
||||
if (vl->key == NULL) continue;
|
||||
if ((*matchfunc)(vl->key, "S")) {
|
||||
sval = vl->value.ival;
|
||||
sl = vl;
|
||||
continue;
|
||||
}
|
||||
kl = (struct property *)HashLookup(vl->key, &(tp1->propdict));
|
||||
if (kl == NULL) continue; /* Ignored property */
|
||||
|
||||
/* Get the property value and slop. Promote if needed. Save */
|
||||
/* property and slop as type double so they can be sorted. */
|
||||
|
||||
if ((vl->type == PROP_STRING || vl->type == PROP_EXPRESSION) &&
|
||||
(kl->type != vl->type))
|
||||
PromoteProperty(kl, vl, obp, tp1);
|
||||
if (vl->type == PROP_INTEGER) {
|
||||
tval = (double)vl->value.ival;
|
||||
tslop = (double)kl->slop.ival;
|
||||
}
|
||||
else if (vl->type == PROP_STRING) {
|
||||
/* This is unlikely---no method to merge string properties! */
|
||||
tval = (double)vl->value.string[0]
|
||||
+ (double)vl->value.string[1] / 10.0;
|
||||
tslop = (double)0;
|
||||
}
|
||||
else {
|
||||
kl = (struct property *)HashLookup(vl->key, &(tp1->propdict));
|
||||
if (kl && (kl->merge & (MERGE_S_ADD | MERGE_S_PAR))) {
|
||||
if (vl->type == PROP_INTEGER) {
|
||||
cval = (double)vl->value.ival;
|
||||
slop = (double)kl->slop.ival;
|
||||
}
|
||||
else {
|
||||
cval = vl->value.dval;
|
||||
slop = kl->slop.dval;
|
||||
}
|
||||
merge_type = kl->merge & (MERGE_S_ADD | MERGE_S_PAR);
|
||||
tval = vl->value.dval;
|
||||
tslop = kl->slop.dval;
|
||||
}
|
||||
|
||||
if (kl->merge & MERGE_S_CRIT) {
|
||||
has_crit = TRUE;
|
||||
pval = tval;
|
||||
pslop = tslop;
|
||||
}
|
||||
else if (kl->merge & (MERGE_S_ADD | MERGE_S_PAR)) {
|
||||
if ((ca == (char)0) || (toupper(vl->key[0]) > ca)) {
|
||||
merge_type = kl->merge & (MERGE_S_ADD | MERGE_S_PAR);
|
||||
aval = tval;
|
||||
aslop = tslop;
|
||||
ca = toupper(vl->key[0]);
|
||||
}
|
||||
}
|
||||
else if ((co == (char)0) || (toupper(vl->key[0]) > co)) {
|
||||
oval = tval;
|
||||
co = toupper(vl->key[0]);
|
||||
}
|
||||
}
|
||||
if (merge_type == MERGE_S_ADD) {
|
||||
proplist[i].value = cval * (double)sval;
|
||||
proplist[i].slop = slop;
|
||||
proplist[i].avalue = 0;
|
||||
if (sl) sl->value.ival = 1;
|
||||
}
|
||||
else if (merge_type == MERGE_S_PAR) {
|
||||
proplist[i].value = cval / (double)sval;
|
||||
proplist[i].slop = slop;
|
||||
proplist[i].avalue = 0;
|
||||
if (sl) sl->value.ival = 1;
|
||||
if (has_crit == TRUE) {
|
||||
/* If there is a critical value, then sort first */
|
||||
/* by critical value */
|
||||
proplist[i].value = pval;
|
||||
proplist[i].slop = pslop;
|
||||
|
||||
/* then sort on additive value times S */
|
||||
/* or on non-additive value. */
|
||||
if (merge_type == MERGE_S_ADD)
|
||||
proplist[i].avalue = aval * (double)sval;
|
||||
else if (merge_type == MERGE_S_PAR)
|
||||
proplist[i].avalue = aval / (double)sval;
|
||||
else
|
||||
proplist[i].avalue = (double)sval;
|
||||
}
|
||||
else {
|
||||
/* Components which declare no series addition method stay unsorted */
|
||||
proplist[i].value = (double)0;
|
||||
proplist[i].avalue = (double)0;
|
||||
proplist[i].slop = (double)1E-6;
|
||||
if (merge_type != MERGE_NONE) {
|
||||
proplist[i].value = aval;
|
||||
proplist[i].slop = aslop;
|
||||
proplist[i].avalue = (double)sval;
|
||||
}
|
||||
else {
|
||||
proplist[i].value = (double)sval;
|
||||
proplist[i].slop = (double)0;
|
||||
proplist[i].avalue = oval;
|
||||
}
|
||||
}
|
||||
proplist[i].idx = i;
|
||||
proplist[i].ob = obp;
|
||||
obp = obp->next;
|
||||
}
|
||||
|
||||
obn = obp; /* Link from last property */
|
||||
|
||||
qsort(&proplist[0], run, sizeof(propsort), compsort);
|
||||
@@ -4598,8 +4644,8 @@ void PropertySortAndCombine(struct objlist *pre1, struct nlist *tp1,
|
||||
/* and manage the topology. Note that at this point devices have */
|
||||
/* already been combined if all critical properties match, so any */
|
||||
/* parallel devices remaining are not considered mergeable unless as */
|
||||
/* a last resort. Parallel devices need to be checked for swapping, */
|
||||
/* however. So the steps are: */
|
||||
/* a last resort. Devices also need to be checked for swapping. */
|
||||
/* So the steps are: */
|
||||
/* 1) Find parallel devices with more elements in one circuit than */
|
||||
/* in the other. If non-summing parameters of interest match, */
|
||||
/* then merge all devices that can be merged until both sides */
|
||||
@@ -4612,6 +4658,10 @@ void PropertySortAndCombine(struct objlist *pre1, struct nlist *tp1,
|
||||
/* circuits. Check if critical parameters match between the */
|
||||
/* circuits. If not, check if swapping devices in circuit1 */
|
||||
/* makes a better match to circuit2. */
|
||||
/* 4) Find series devices that have the same number in both */
|
||||
/* circuits. Check if critical parameters match between the */
|
||||
/* circuits. If not, check if swapping devices in circuit1 */
|
||||
/* makes a better match to circuit2. */
|
||||
|
||||
/* Case 1: Parallel devices with more elements in one circuit */
|
||||
|
||||
@@ -4885,13 +4935,17 @@ int PropertyOptimize(struct objlist *ob, struct nlist *tp, int run, int series,
|
||||
}
|
||||
}
|
||||
if (kl == NULL) {
|
||||
/* Prevent setting both M > 1 and S > 1 in any one */
|
||||
/* device, as it is ambiguous. */
|
||||
/* Setting both M > 1 and S > 1 is topologically */
|
||||
/* ambiguous. If global option ExactTopology is */
|
||||
/* enabled, then this will cause a failure. */
|
||||
/* Otherwise, it is allowed. */
|
||||
|
||||
if ((*matchfunc)(vl->key, other)) {
|
||||
if (vl->type == PROP_INTEGER)
|
||||
if (vl->value.ival > 1)
|
||||
fail = 1;
|
||||
if (ExactTopology) {
|
||||
if ((*matchfunc)(vl->key, other)) {
|
||||
if (vl->type == PROP_INTEGER)
|
||||
if (vl->value.ival > 1)
|
||||
fail = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (kl != NULL) {
|
||||
@@ -5182,7 +5236,7 @@ int PropertyOptimize(struct objlist *ob, struct nlist *tp, int run, int series,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changed > 0) {
|
||||
if ((Debug == TRUE) && (changed > 0)) {
|
||||
if (series)
|
||||
Printf("Combined %d series devices.\n", changed);
|
||||
else
|
||||
@@ -5317,13 +5371,14 @@ void
|
||||
#endif
|
||||
PropertyCheckMismatch(struct objlist *tp1, struct nlist *tc1,
|
||||
char *inst1, struct objlist *tp2, struct nlist *tc2,
|
||||
char *inst2, int do_print, int do_list, int *count,
|
||||
int *rval)
|
||||
char *inst2, struct Element *E1, struct Element *E2,
|
||||
int do_print, int do_list, int *count, int *rval)
|
||||
{
|
||||
int mismatches = 0;
|
||||
int len2, *check2;
|
||||
struct property *kl1, *kl2, *klt;
|
||||
struct valuelist *vl1, *vl2;
|
||||
char *vl1key;
|
||||
int i, j;
|
||||
int islop;
|
||||
int ival1, ival2;
|
||||
@@ -5427,22 +5482,71 @@ PropertyCheckMismatch(struct objlist *tp1, struct nlist *tc1,
|
||||
}
|
||||
}
|
||||
|
||||
/* If the property is associated with a pin, then */
|
||||
/* determine if the pin is permutable; If so, then */
|
||||
/* determine if the pins are swapped between the two */
|
||||
/* elements. If so, then swap the property keys. */
|
||||
|
||||
vl1key = vl1->key;
|
||||
if (kl1->pin != NULL) {
|
||||
struct objlist *tob1, *tob2;
|
||||
struct NodeList *nl1, *nl2;
|
||||
struct property *kla;
|
||||
struct valuelist *vla;
|
||||
int k;
|
||||
|
||||
nl1 = E1->nodelist;
|
||||
for (tob1 = tc1->cell; tob1 && tob1->type == PORT; tob1 = tob1->next) {
|
||||
if ((*matchfunc)(tob1->name, kl1->pin)) break;
|
||||
nl1 = nl1->next;
|
||||
}
|
||||
if (tob1->type == PORT) {
|
||||
/* Found the node list record corresponding to the given pin. */
|
||||
/* Now find the pin corresponding to the matching node. */
|
||||
nl2 = E2->nodelist;
|
||||
for (tob2 = tc1->cell; tob2 && tob2->type == PORT; tob2 = tob2->next) {
|
||||
if (nl2->node->nodeclass == nl1->node->nodeclass) break;
|
||||
nl2 = nl2->next;
|
||||
}
|
||||
if (nl2->node->nodeclass == nl1->node->nodeclass) {
|
||||
if (tob2 != tob1) { /* Element pins were swapped */
|
||||
/* Find the other property to swap with */
|
||||
for (k = 0;; k++) {
|
||||
vla = &(tp1->instance.props[k]);
|
||||
if (vla->type == PROP_ENDLIST) break;
|
||||
if (vla != vl1) {
|
||||
kla = (struct property *)HashLookup(vla->key,
|
||||
&(tc1->propdict));
|
||||
if (kla && kla->pin)
|
||||
if ((*matchfunc)(tob2->name, kla->pin))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (vla->type != PROP_ENDLIST) {
|
||||
/* Swap vla->key and vl1->key */
|
||||
vl1key = vla->key;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Find the matching property in vl2. */
|
||||
|
||||
for (j = 0;; j++) {
|
||||
vl2 = &(tp2->instance.props[j]);
|
||||
if (vl2->type == PROP_ENDLIST) break;
|
||||
if (check2[j] == 0)
|
||||
if ((*matchfunc)(vl1->key, vl2->key)) break;
|
||||
if ((*matchfunc)(vl1key, vl2->key)) break;
|
||||
}
|
||||
if (vl2->type == PROP_ENDLIST) {
|
||||
/* Check against M and S records; a missing M or S */
|
||||
/* record is equivalent to M = 1 or S = 1. */
|
||||
|
||||
if (vl1 != &mvl)
|
||||
if ((*matchfunc)(vl1->key, mvl.key)) vl2 = &mvl;
|
||||
if ((*matchfunc)(vl1key, mvl.key)) vl2 = &mvl;
|
||||
if (vl1 != &svl)
|
||||
if ((*matchfunc)(vl1->key, svl.key)) vl2 = &svl;
|
||||
if ((*matchfunc)(vl1key, svl.key)) vl2 = &svl;
|
||||
}
|
||||
if (vl2->type == PROP_ENDLIST) {
|
||||
/* vl1 had a property of interest that was not found */
|
||||
@@ -5451,7 +5555,7 @@ PropertyCheckMismatch(struct objlist *tp1, struct nlist *tc1,
|
||||
if (do_print) {
|
||||
Fprintf(stdout, "%s vs. %s:\n", inst1, inst2);
|
||||
Fprintf(stdout, "Property %s in circuit1 has no matching "
|
||||
"property in circuit2\n", vl1->key);
|
||||
"property in circuit2\n", vl1key);
|
||||
}
|
||||
#ifdef TCL_NETGEN
|
||||
if (do_list) {
|
||||
@@ -6095,7 +6199,7 @@ PropertyMatch(struct Element *E1, struct Element *E2,
|
||||
else {
|
||||
int multmatch, count;
|
||||
PropertyCheckMismatch(tp1, tc1, inst1, tp2, tc2,
|
||||
inst2, FALSE, FALSE, &multmatch, NULL);
|
||||
inst2, E1, E2, FALSE, FALSE, &multmatch, NULL);
|
||||
if (multmatch == 1) {
|
||||
/* Final attempt: Reduce M to 1 on both devices */
|
||||
run1 = run2 = 0;
|
||||
@@ -6116,7 +6220,7 @@ PropertyMatch(struct Element *E1, struct Element *E2,
|
||||
mlist =
|
||||
#endif
|
||||
PropertyCheckMismatch(tp1, tc1, inst1, tp2, tc2,
|
||||
inst2, do_print, do_list, &count, &rval);
|
||||
inst2, E1, E2, do_print, do_list, &count, &rval);
|
||||
mismatches += count;
|
||||
#ifdef TCL_NETGEN
|
||||
if (do_list && (mlist != NULL)) {
|
||||
@@ -6964,12 +7068,15 @@ int IgnoreClass(char *name, int file, unsigned char type)
|
||||
/* If file1 and file2 are -1, then these are names to */
|
||||
/* be checked as netcmp works through the hierarchy. */
|
||||
/* Otherwise, look up the structure for each file and */
|
||||
/* set the classhash of the second to that of the first */
|
||||
/* set the classhash of the second to that of the */
|
||||
/* first. If "dounique" is 1, then give the two cells */
|
||||
/* their own class hash; they will not be compared */
|
||||
/* any other cells in either netlist. */
|
||||
/* */
|
||||
/* Return 1 on success, 0 on failure */
|
||||
/*------------------------------------------------------*/
|
||||
|
||||
int EquivalenceClasses(char *name1, int file1, char *name2, int file2)
|
||||
int EquivalenceClasses(char *name1, int file1, char *name2, int file2, int dounique)
|
||||
{
|
||||
char *class1, *class2;
|
||||
struct Correspond *newc;
|
||||
@@ -6994,16 +7101,19 @@ int EquivalenceClasses(char *name1, int file1, char *name2, int file2)
|
||||
if (tp->flags & CELL_DUPLICATE)
|
||||
reverse = 1;
|
||||
|
||||
/* Do a cross-check for each name in the other netlist. If */
|
||||
/* conflicting names exist, then alter the classhash to make it */
|
||||
/* unique. In the case of duplicate cells, don't do this. */
|
||||
if (dounique) {
|
||||
|
||||
if (!(tp->flags & CELL_DUPLICATE) && !(tp2->flags & CELL_DUPLICATE) &&
|
||||
/* Do a cross-check for each name in the other netlist. If */
|
||||
/* conflicting names exist, then alter the classhash to make */
|
||||
/* it unique. In the case of duplicate cells, don't do this. */
|
||||
|
||||
if (!(tp->flags & CELL_DUPLICATE) && !(tp2->flags & CELL_DUPLICATE) &&
|
||||
!(*matchfunc)(name1, name2)) {
|
||||
tpx = LookupCellFile(name1, file2);
|
||||
if (tpx != NULL) need_new_seed = 1;
|
||||
tpx = LookupCellFile(name2, file1);
|
||||
if (tpx != NULL) need_new_seed = 1;
|
||||
tpx = LookupCellFile(name1, file2);
|
||||
if (tpx != NULL) need_new_seed = 1;
|
||||
tpx = LookupCellFile(name2, file1);
|
||||
if (tpx != NULL) need_new_seed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now make the classhash values the same so that these cells */
|
||||
|
||||
+3
-1
@@ -7,6 +7,7 @@ extern struct nlist *Circuit1;
|
||||
extern struct nlist *Circuit2;
|
||||
|
||||
extern int ExhaustiveSubdivision;
|
||||
extern int ExactTopology;
|
||||
|
||||
extern int left_col_end;
|
||||
extern int right_col_end;
|
||||
@@ -37,7 +38,8 @@ extern int PermuteSetup(char *model, int filenum, char *pin1, char *pin2);
|
||||
extern int PermuteForget(char *model, int filenum, char *pin1, char *pin2);
|
||||
extern int EquivalenceElements(char *name1, int file1, char *name2, int file2);
|
||||
extern int EquivalenceNodes(char *name1, int file1, char *name2, int file2);
|
||||
extern int EquivalenceClasses(char *name1, int file1, char *name2, int file2);
|
||||
extern int EquivalenceClasses(char *name1, int file1, char *name2, int file2,
|
||||
int dounique);
|
||||
extern int IgnoreClass(char *name, int file, unsigned char type);
|
||||
extern int MatchPins(struct nlist *tp1, struct nlist *tp2, int dolist);
|
||||
extern int PropertyOptimize(struct objlist *ob, struct nlist *tp, int run,
|
||||
|
||||
@@ -984,6 +984,51 @@ PropertyDelete(char *name, int fnum, char *key)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* Associate a property with a specific pin */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
int
|
||||
PropertyAssociatePin(char *name, int fnum, char *key, char *pin)
|
||||
{
|
||||
struct property *kl = NULL;
|
||||
struct nlist *tc;
|
||||
struct objlist *ob;
|
||||
int result;
|
||||
|
||||
if ((fnum == -1) && (Circuit1 != NULL) && (Circuit2 != NULL)) {
|
||||
result = PropertyAssociatePin(name, Circuit1->file, key, pin);
|
||||
result = PropertyAssociatePin(name, Circuit2->file, key, pin);
|
||||
return result;
|
||||
}
|
||||
|
||||
tc = LookupCellFile(name, fnum);
|
||||
if (tc == NULL) {
|
||||
Printf("No device %s found for PropertyAssociatePin()\n", name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
kl = (struct property *)HashLookup(key, &(tc->propdict));
|
||||
if (kl == NULL) {
|
||||
Printf("No property %s found for device %s\n", key, name);
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
for (ob = tc->cell; ob != NULL; ob = ob->next) {
|
||||
if (ob->type != PORT) break;
|
||||
else if ((*matchfunc)(ob->name, pin)) {
|
||||
kl->pin = ob->name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ob == NULL) {
|
||||
Printf("No pin %s found for device %s\n", pin, name);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* Set the tolerance of a property in the master cell record. */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -39,6 +39,7 @@ extern void SetParallelCombine(int value);
|
||||
extern void SetSeriesCombine(int value);
|
||||
extern int PropertyTolerance(char *name, int fnum, char *key, int ival,
|
||||
double dval);
|
||||
extern int PropertyAssociatePin(char *name, int fnum, char *key, char *pin);
|
||||
extern int PropertyMerge(char *name, int fnum, char *key, int merge_type,
|
||||
int merge_mask);
|
||||
extern void ResolveProperties(char *name1, int file1, char *name2, int file2);
|
||||
|
||||
+30
-33
@@ -130,6 +130,7 @@ struct property *NewProperty(void)
|
||||
|
||||
kl = (struct property *)CALLOC(1,sizeof(struct property));
|
||||
if (kl == NULL) Fprintf(stderr,"NewProperty: Core allocation error\n");
|
||||
kl->pin = (char *)NULL;
|
||||
return (kl);
|
||||
}
|
||||
|
||||
@@ -440,13 +441,6 @@ void RemoveShorted(char *class, int file)
|
||||
RecurseCellFileHashTable(removeshorted, file);
|
||||
}
|
||||
|
||||
/* Structure used to keep track of nodes needing checking */
|
||||
|
||||
struct linkednode {
|
||||
int node;
|
||||
struct linkednode *next;
|
||||
};
|
||||
|
||||
/* Remove instances of a deleted class from the database. */
|
||||
/* NOTE: This treats deleted classes as not existing, so it */
|
||||
/* needs to take care of disconnected ports in the same manner */
|
||||
@@ -457,13 +451,22 @@ struct linkednode {
|
||||
int deleteclass(struct hashlist *p, int file)
|
||||
{
|
||||
struct nlist *ptr;
|
||||
struct objlist *ob, *lob, *nob;
|
||||
struct linkednode *checknodes = NULL, *newlnode, *chknode;
|
||||
struct objlist *ob, *lob, *nob, *portnode;
|
||||
unsigned char *checknodes;
|
||||
int i;
|
||||
|
||||
ptr = (struct nlist *)(p->ptr);
|
||||
|
||||
if ((file != -1) && (ptr->file != file)) return 0;
|
||||
|
||||
/* Note: This could be made faster by enumerating all times each
|
||||
* node is used during the full pass, then subtracting each time
|
||||
* the node is deleted in a child, then disconnecting all nodes
|
||||
* that ended up with a zero count.
|
||||
*/
|
||||
checknodes = (unsigned char *)CALLOC(ptr->nodename_cache_maxnodenum + 1,
|
||||
sizeof(unsigned char));
|
||||
|
||||
lob = NULL;
|
||||
for (ob = ptr->cell; ob != NULL;) {
|
||||
nob = ob->next;
|
||||
@@ -471,12 +474,8 @@ int deleteclass(struct hashlist *p, int file)
|
||||
if ((*matchfunc)(ob->model.class, OldCell->name)) {
|
||||
HashDelete(ob->instance.name, &(ptr->instdict));
|
||||
while (1) {
|
||||
if (ob->type >= FIRSTPIN) {
|
||||
newlnode = (struct linkednode *)MALLOC(sizeof(struct linkednode));
|
||||
newlnode->node = ob->node;
|
||||
newlnode->next = checknodes;
|
||||
checknodes = newlnode;
|
||||
}
|
||||
if (ob->type >= FIRSTPIN)
|
||||
checknodes[ob->node] = (unsigned char)1;
|
||||
FreeObjectAndHash(ob, ptr);
|
||||
ob = nob;
|
||||
if (ob == NULL) break;
|
||||
@@ -499,26 +498,24 @@ int deleteclass(struct hashlist *p, int file)
|
||||
}
|
||||
}
|
||||
|
||||
while (checknodes != NULL) {
|
||||
struct objlist *portnode = NULL;
|
||||
|
||||
chknode = checknodes;
|
||||
checknodes = checknodes->next;
|
||||
|
||||
for (ob = ptr->cell; ob != NULL; ob = ob->next) {
|
||||
if ((ob->type != PORT) && (portnode == NULL))
|
||||
break;
|
||||
else if ((ob->type == PORT) && (ob->node == chknode->node))
|
||||
portnode = ob;
|
||||
else if ((ob->type >= FIRSTPIN) && (ob->node == chknode->node))
|
||||
break;
|
||||
for (i = 0; i <= ptr->nodename_cache_maxnodenum; i++) {
|
||||
if (checknodes[i] != 0) {
|
||||
portnode = NULL;
|
||||
for (ob = ptr->cell; ob != NULL; ob = ob->next) {
|
||||
if ((ob->type != PORT) && (portnode == NULL))
|
||||
break;
|
||||
else if ((ob->type == PORT) && (ob->node == i))
|
||||
portnode = ob;
|
||||
else if ((ob->type >= FIRSTPIN) && (ob->node == i))
|
||||
break;
|
||||
}
|
||||
if ((ob == NULL) && (portnode != NULL)) {
|
||||
/* Port became disconnected when child was deleted */
|
||||
portnode->node = -1;
|
||||
}
|
||||
}
|
||||
if ((ob == NULL) && (portnode != NULL)) {
|
||||
/* Port became disconnected when child was deleted */
|
||||
portnode->node = -1;
|
||||
}
|
||||
FREE(chknode);
|
||||
}
|
||||
FREE(checknodes);
|
||||
}
|
||||
|
||||
/* Remove all instances of class "class" from the database */
|
||||
|
||||
@@ -135,6 +135,7 @@ struct property {
|
||||
unsigned char idx; /* index into valuelist */
|
||||
unsigned char type; /* string, integer, double, value, expression */
|
||||
unsigned char merge; /* how property changes when devices are merged */
|
||||
char *pin; /* associated pin (or NULL if not associated) */
|
||||
union {
|
||||
char *string;
|
||||
double dval;
|
||||
|
||||
@@ -34,6 +34,8 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#include "print.h"
|
||||
#endif
|
||||
|
||||
extern void Finsert(FILE *f);
|
||||
|
||||
void test_entry(void)
|
||||
{
|
||||
|
||||
|
||||
+4
-4
@@ -1588,13 +1588,13 @@ skip_endmodule:
|
||||
/* until bits in signal are exhausted or LHS is full. */
|
||||
|
||||
if (i != -1)
|
||||
sprintf(nodename, "%s[%d]", noderoot, i);
|
||||
snprintf(nodename, MAX_STR_LEN, "%s[%d]", noderoot, i);
|
||||
else
|
||||
sprintf(nodename, lhs->name);
|
||||
strncpy(nodename, lhs->name, MAX_STR_LEN - 1);
|
||||
if (j != -1)
|
||||
sprintf(assignname, "%s[%d]", assignroot, j);
|
||||
snprintf(assignname, MAX_STR_LEN, "%s[%d]", assignroot, j);
|
||||
else
|
||||
sprintf(assignname, rhs->name);
|
||||
strncpy(assignname, rhs->name, MAX_STR_LEN - 1);
|
||||
|
||||
join(nodename, assignname);
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program; see the file copying. If not, write to
|
||||
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* inetcomp.c -- a simple wrapper to the NETCOMP() function */
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include "netgen.h"
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program; see the file copying. If not, write to
|
||||
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* netcomp.c -- a simple wrapper to provide netlist comparison functionality */
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include "netgen.h"
|
||||
|
||||
@@ -23,6 +23,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#include <stdlib.h> /* for getenv */
|
||||
#endif
|
||||
#include "netgen.h"
|
||||
#include "print.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
@@ -20,9 +20,11 @@ along with this program; see the file copying. If not, write to
|
||||
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* ntk2xnf.c -- a simple wrapper to translate .ntk to Xilinx XNF format */
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include "netgen.h"
|
||||
#include "xilinx.h"
|
||||
|
||||
#ifdef HAVE_X11
|
||||
/* the following two X procedures are to permit linking
|
||||
|
||||
Vendored
+20
-3
@@ -712,6 +712,7 @@ infodir
|
||||
docdir
|
||||
oldincludedir
|
||||
includedir
|
||||
runstatedir
|
||||
localstatedir
|
||||
sharedstatedir
|
||||
sysconfdir
|
||||
@@ -794,6 +795,7 @@ datadir='${datarootdir}'
|
||||
sysconfdir='${prefix}/etc'
|
||||
sharedstatedir='${prefix}/com'
|
||||
localstatedir='${prefix}/var'
|
||||
runstatedir='${localstatedir}/run'
|
||||
includedir='${prefix}/include'
|
||||
oldincludedir='/usr/include'
|
||||
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
|
||||
@@ -1046,6 +1048,15 @@ do
|
||||
| -silent | --silent | --silen | --sile | --sil)
|
||||
silent=yes ;;
|
||||
|
||||
-runstatedir | --runstatedir | --runstatedi | --runstated \
|
||||
| --runstate | --runstat | --runsta | --runst | --runs \
|
||||
| --run | --ru | --r)
|
||||
ac_prev=runstatedir ;;
|
||||
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
|
||||
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
|
||||
| --run=* | --ru=* | --r=*)
|
||||
runstatedir=$ac_optarg ;;
|
||||
|
||||
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
||||
ac_prev=sbindir ;;
|
||||
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
||||
@@ -1183,7 +1194,7 @@ fi
|
||||
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
|
||||
datadir sysconfdir sharedstatedir localstatedir includedir \
|
||||
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
|
||||
libdir localedir mandir
|
||||
libdir localedir mandir runstatedir
|
||||
do
|
||||
eval ac_val=\$$ac_var
|
||||
# Remove trailing slashes.
|
||||
@@ -1336,6 +1347,7 @@ Fine tuning of the installation directories:
|
||||
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
||||
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
||||
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
||||
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
|
||||
--libdir=DIR object code libraries [EPREFIX/lib]
|
||||
--includedir=DIR C header files [PREFIX/include]
|
||||
--oldincludedir=DIR C header files for non-gcc [/usr/include]
|
||||
@@ -6065,7 +6077,6 @@ fi
|
||||
|
||||
|
||||
if test $usingTcl ; then
|
||||
usingX11=1
|
||||
cadinstall="$cadinstall tcltk"
|
||||
modules="$modules tcltk"
|
||||
programs="$programs tcltk"
|
||||
@@ -6075,7 +6086,11 @@ if test $usingTcl ; then
|
||||
|
||||
extra_libs="$extra_libs \${NETGENDIR}/tcltk/libtcltk.o"
|
||||
extra_defs="$extra_defs -DTCL_DIR=\\\"\${TCLDIR}\\\""
|
||||
stub_defs="$stub_defs -DUSE_TCL_STUBS -DUSE_TK_STUBS"
|
||||
if test $usingX11 ; then
|
||||
stub_defs="$stub_defs -DUSE_TCL_STUBS"
|
||||
else
|
||||
stub_defs="$stub_defs -DUSE_TCL_STUBS -DUSE_TK_STUBS"
|
||||
fi
|
||||
else
|
||||
programs="$programs netgen"
|
||||
unused="$unused tcltk"
|
||||
@@ -6160,6 +6175,7 @@ if test $usingTcl ; then
|
||||
# Tk libraries and header files
|
||||
#
|
||||
# -----------------------------------------------------------------------
|
||||
if test $usingX11 ; then
|
||||
if test "${TK_INC_DIR}" != "/usr/include" ; then
|
||||
INC_SPECS="${INC_SPECS} -I${TK_INC_DIR}"
|
||||
fi
|
||||
@@ -6176,6 +6192,7 @@ if test $usingTcl ; then
|
||||
loader_run_path="${TK_LIB_DIR}:${loader_run_path}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -807,7 +807,6 @@ dnl "make" instead of requiring "make tcl"
|
||||
dnl ----------------------------------------------------------------
|
||||
|
||||
if test $usingTcl ; then
|
||||
usingX11=1
|
||||
cadinstall="$cadinstall tcltk"
|
||||
modules="$modules tcltk"
|
||||
programs="$programs tcltk"
|
||||
@@ -816,7 +815,11 @@ if test $usingTcl ; then
|
||||
AC_DEFINE(TCL_NETGEN)
|
||||
extra_libs="$extra_libs \${NETGENDIR}/tcltk/libtcltk.o"
|
||||
extra_defs="$extra_defs -DTCL_DIR=\\\"\${TCLDIR}\\\""
|
||||
stub_defs="$stub_defs -DUSE_TCL_STUBS -DUSE_TK_STUBS"
|
||||
if test $usingX11 ; then
|
||||
stub_defs="$stub_defs -DUSE_TCL_STUBS"
|
||||
else
|
||||
stub_defs="$stub_defs -DUSE_TCL_STUBS -DUSE_TK_STUBS"
|
||||
fi
|
||||
else
|
||||
programs="$programs netgen"
|
||||
unused="$unused tcltk"
|
||||
@@ -903,6 +906,7 @@ if test $usingTcl ; then
|
||||
# Tk libraries and header files
|
||||
#
|
||||
# -----------------------------------------------------------------------
|
||||
if test $usingX11 ; then
|
||||
if test "${TK_INC_DIR}" != "/usr/include" ; then
|
||||
INC_SPECS="${INC_SPECS} -I${TK_INC_DIR}"
|
||||
fi
|
||||
@@ -919,6 +923,7 @@ if test $usingTcl ; then
|
||||
loader_run_path="${TK_LIB_DIR}:${loader_run_path}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
#
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+69
-14
@@ -2902,7 +2902,7 @@ _netcmp_equate(ClientData clientData,
|
||||
struct ElementClass *saveEclass = NULL;
|
||||
struct NodeClass *saveNclass = NULL;
|
||||
int file1, file2;
|
||||
int i, l1, l2, ltest, lent, dolist = 0, doforce = 0;
|
||||
int i, l1, l2, ltest, lent, dolist = 0, doforce = 0, dounique = 0;
|
||||
Tcl_Obj *tobj1, *tobj2, *tobj3;
|
||||
|
||||
while (objc > 1) {
|
||||
@@ -2918,6 +2918,11 @@ _netcmp_equate(ClientData clientData,
|
||||
objv++;
|
||||
objc--;
|
||||
}
|
||||
else if (!strcmp(optstart, "unique")) {
|
||||
dounique = 1;
|
||||
objv++;
|
||||
objc--;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
@@ -3342,19 +3347,9 @@ _netcmp_equate(ClientData clientData,
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now that all pins are assigned by name, reorder */
|
||||
/* the pin lists of the 2nd cell to match the */
|
||||
/* order of the 1st. */
|
||||
|
||||
/* Reorder the pin lists of instances of the 2nd */
|
||||
/* cell to match the order of the 1st. */
|
||||
|
||||
// pindata.cell2 = tp2;
|
||||
// RecurseCellHashTable2(pinorder, (void *)(&pindata));
|
||||
}
|
||||
|
||||
if (EquivalenceClasses(tp1->name, file1, tp2->name, file2)) {
|
||||
if (EquivalenceClasses(tp1->name, file1, tp2->name, file2, dounique)) {
|
||||
Fprintf(stdout, "Device classes %s and %s are equivalent.\n",
|
||||
tp1->name, tp2->name);
|
||||
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(1));
|
||||
@@ -3377,6 +3372,8 @@ _netcmp_equate(ClientData clientData,
|
||||
/* add --- add new property */
|
||||
/* remove --- delete existing property */
|
||||
/* tolerance --- set property tolerance */
|
||||
/* associate --- associate property with a pin */
|
||||
/* topology --- set exact/relaxed matching */
|
||||
/* merge --- (deprecated) */
|
||||
/* or */
|
||||
/* netgen::property default */
|
||||
@@ -3415,11 +3412,11 @@ _netcmp_property(ClientData clientData,
|
||||
|
||||
char *options[] = {
|
||||
"add", "create", "remove", "delete", "tolerance", "merge", "serial",
|
||||
"series", "parallel", NULL
|
||||
"series", "parallel", "associate", "topology", NULL
|
||||
};
|
||||
enum OptionIdx {
|
||||
ADD_IDX, CREATE_IDX, REMOVE_IDX, DELETE_IDX, TOLERANCE_IDX, MERGE_IDX,
|
||||
SERIAL_IDX, SERIES_IDX, PARALLEL_IDX
|
||||
SERIAL_IDX, SERIES_IDX, PARALLEL_IDX, ASSOCIATE_IDX, TOPOLOGY_IDX
|
||||
};
|
||||
int result, index, idx2;
|
||||
|
||||
@@ -3464,6 +3461,10 @@ _netcmp_property(ClientData clientData,
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
char *topo[] = {
|
||||
"strict", "relaxed", NULL
|
||||
};
|
||||
|
||||
/* Check for special command "property default" */
|
||||
if ((objc == 2) && (!strcmp(Tcl_GetString(objv[1]), "default"))) {
|
||||
|
||||
@@ -3549,6 +3550,36 @@ _netcmp_property(ClientData clientData,
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
else if ((objc > 1) && (!strcmp(Tcl_GetString(objv[1]), "topology"))) {
|
||||
if (objc == 2) {
|
||||
if (ExactTopology)
|
||||
Tcl_SetResult(interp, "Strict topology property matching.",
|
||||
NULL);
|
||||
else
|
||||
Tcl_SetResult(interp, "Relaxed topology property matching.",
|
||||
NULL);
|
||||
}
|
||||
else if (objc == 3) {
|
||||
if (Tcl_GetIndexFromObj(interp, objv[2],
|
||||
(CONST84 char **)topo,
|
||||
"topology", 0, &idx2) == TCL_OK) {
|
||||
if (idx2 == 0)
|
||||
ExactTopology = TRUE;
|
||||
else if (idx2 == 1)
|
||||
ExactTopology = FALSE;
|
||||
else {
|
||||
Tcl_SetResult(interp, "Topology matching type must be "
|
||||
"'strict' or 'relaxed'.", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "strict|relaxed");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
result = CommonParseCell(interp, objv[1], &tp, &fnum);
|
||||
if (result != TCL_OK) return result;
|
||||
@@ -3842,6 +3873,29 @@ _netcmp_property(ClientData clientData,
|
||||
}
|
||||
break;
|
||||
|
||||
case ASSOCIATE_IDX:
|
||||
if (objc == 3) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "{property_key pin_name} ...");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
for (i = 3; i < objc; i++) {
|
||||
// Each value must be a duplet
|
||||
result = Tcl_ListObjLength(interp, objv[i], &llen);
|
||||
if ((result != TCL_OK) || (llen != 2)) {
|
||||
Tcl_SetResult(interp, "Not a {key pin} pair list.",
|
||||
NULL);
|
||||
}
|
||||
else {
|
||||
result = Tcl_ListObjIndex(interp, objv[i], 0, &tobj1);
|
||||
if (result != TCL_OK) return result;
|
||||
result = Tcl_ListObjIndex(interp, objv[i], 1, &tobj2);
|
||||
if (result != TCL_OK) return result;
|
||||
PropertyAssociatePin(tp->name, fnum, Tcl_GetString(tobj1),
|
||||
Tcl_GetString(tobj2));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TOLERANCE_IDX:
|
||||
if (objc == 3) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "{property_key tolerance} ...");
|
||||
@@ -3941,6 +3995,7 @@ _netcmp_property(ClientData clientData,
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
return TCL_OK;
|
||||
|
||||
Reference in New Issue
Block a user