mirror of
https://github.com/RTimothyEdwards/netgen.git
synced 2026-08-22 22:17:22 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b5b117100 | ||
|
|
98e6a4bd8f | ||
|
|
c73d9ec4ff | ||
|
|
a5375177c5 | ||
|
|
935e54abe6 | ||
|
|
27b095754e | ||
|
|
49ccf1949a | ||
|
|
db457c562b | ||
|
|
9b84776374 | ||
|
|
06386bee1b | ||
|
|
2af3f2a3f7 | ||
|
|
7cd8d82964 | ||
|
|
738abbdad9 | ||
|
|
3aeea9d164 | ||
|
|
12e1ff295f |
+1
-1
@@ -131,7 +131,7 @@ if format = 1, use the actel .pin file format
|
||||
struct nlist *tp;
|
||||
struct objlist *ob, *ob2;
|
||||
char *ptr;
|
||||
char physicalpin[200];
|
||||
char physicalpin[MAX_STR_LEN];
|
||||
|
||||
tp = LookupCell(name);
|
||||
if (tp == NULL) return;
|
||||
|
||||
@@ -176,4 +176,6 @@ extern int open(char *path, int oflag, ...); /* HPUX has it in <sys/fcntl.h> */
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#define MAX_STR_LEN 256
|
||||
|
||||
#endif /* _CONFIG_H */
|
||||
|
||||
+3
-3
@@ -629,7 +629,7 @@ struct embed *FlattenEmbeddingTree(struct embed *E)
|
||||
int LenEmbed(char *prefix, struct nlist *np, struct embed *E, int flatten)
|
||||
/* return the number of characters required to print element E */
|
||||
{
|
||||
char longstr[200];
|
||||
char longstr[MAX_STR_LEN];
|
||||
|
||||
if (E == NULL) return(0);
|
||||
if (E->left == NULL && E->right == NULL) {
|
||||
@@ -668,7 +668,7 @@ void PrintEmb(FILE *outfile, char *prefix, struct nlist *np,
|
||||
struct objlist *ob;
|
||||
char *instancename;
|
||||
struct nlist *np2;
|
||||
char name[200];
|
||||
char name[MAX_STR_LEN];
|
||||
|
||||
ob = InstanceNumber(np,E->instancenumber);
|
||||
instancename = ob->instance.name;
|
||||
@@ -706,7 +706,7 @@ void PrintEmbed(FILE *outfile, char *prefix, struct nlist *np,
|
||||
struct objlist *ob;
|
||||
char *instancename;
|
||||
struct nlist *np2;
|
||||
char name[200];
|
||||
char name[MAX_STR_LEN];
|
||||
|
||||
ob = InstanceNumber(np,E->instancenumber);
|
||||
instancename = ob->instance.name;
|
||||
|
||||
+23
-23
@@ -167,7 +167,7 @@ char *ReadExt(char *fname, int doflat, int *fnum)
|
||||
int filenum;
|
||||
|
||||
if ((filenum = OpenParseFile(fname, *fnum)) < 0) {
|
||||
char name[100];
|
||||
char name[MAX_STR_LEN];
|
||||
|
||||
SetExtension(name, fname, EXT_EXTENSION);
|
||||
if ((filenum = OpenParseFile(name, *fnum)) < 0) {
|
||||
@@ -208,7 +208,7 @@ char *ReadExt(char *fname, int doflat, int *fnum)
|
||||
else if (match(nexttok, "style")) SkipNewLine(NULL);
|
||||
else if (match(nexttok, "resistclasses")) SkipNewLine(NULL);
|
||||
else if (match(nexttok, "node")) {
|
||||
char name[200];
|
||||
char name[MAX_STR_LEN];
|
||||
|
||||
/* No cell is generated until at least one valid "node" or "use" */
|
||||
/* has been read in the file. */
|
||||
@@ -223,8 +223,8 @@ char *ReadExt(char *fname, int doflat, int *fnum)
|
||||
SkipNewLine(NULL);
|
||||
}
|
||||
else if (match(nexttok, "equiv")) {
|
||||
char name[200];
|
||||
char name2[200];
|
||||
char name[MAX_STR_LEN];
|
||||
char name2[MAX_STR_LEN];
|
||||
SkipTok(NULL);
|
||||
GetExtName(name, nexttok);
|
||||
if (LookupObject(name,CurrentCell) == NULL) Node(name);
|
||||
@@ -235,8 +235,8 @@ char *ReadExt(char *fname, int doflat, int *fnum)
|
||||
SkipNewLine(NULL);
|
||||
}
|
||||
else if (match(nexttok, "device")) {
|
||||
char dev_name[100], dev_class[100];
|
||||
char gate[200], drain[200], source[200], subs[200];
|
||||
char dev_name[MAX_STR_LEN], dev_class[MAX_STR_LEN];
|
||||
char gate[MAX_STR_LEN], drain[MAX_STR_LEN], source[MAX_STR_LEN], subs[MAX_STR_LEN];
|
||||
char inststr[64];
|
||||
SkipTok(NULL);
|
||||
strcpy(dev_class, nexttok);
|
||||
@@ -306,8 +306,8 @@ char *ReadExt(char *fname, int doflat, int *fnum)
|
||||
SkipNewLine(NULL);
|
||||
}
|
||||
else if (match(nexttok, "fet")) { /* old-style FET record */
|
||||
char fet_class[100];
|
||||
char gate[200], drain[200], source[200], subs[200];
|
||||
char fet_class[MAX_STR_LEN];
|
||||
char gate[MAX_STR_LEN], drain[MAX_STR_LEN], source[MAX_STR_LEN], subs[MAX_STR_LEN];
|
||||
char inststr[64];
|
||||
SkipTok(NULL);
|
||||
strcpy(fet_class, nexttok);
|
||||
@@ -365,7 +365,7 @@ char *ReadExt(char *fname, int doflat, int *fnum)
|
||||
SkipNewLine(NULL);
|
||||
}
|
||||
else {
|
||||
char ctop[200], cbot[200], cdummy[200];
|
||||
char ctop[MAX_STR_LEN], cbot[MAX_STR_LEN], cdummy[MAX_STR_LEN];
|
||||
SkipTok(NULL);
|
||||
GetExtName(ctop, nexttok);
|
||||
SkipTok(NULL);
|
||||
@@ -375,8 +375,8 @@ char *ReadExt(char *fname, int doflat, int *fnum)
|
||||
}
|
||||
}
|
||||
else if (match(nexttok, "use")) {
|
||||
char name[200];
|
||||
char instancename[200];
|
||||
char name[MAX_STR_LEN];
|
||||
char instancename[MAX_STR_LEN];
|
||||
char *basename;
|
||||
|
||||
/* No cell is generated until at least one valid "node" or "use" */
|
||||
@@ -390,7 +390,7 @@ char *ReadExt(char *fname, int doflat, int *fnum)
|
||||
SkipTok(NULL);
|
||||
GetExtName(name, nexttok);
|
||||
if ((basename = strrchr(name,'/')) != NULL) {
|
||||
char tmp[200];
|
||||
char tmp[MAX_STR_LEN];
|
||||
strcpy(tmp, basename+1);
|
||||
strcpy(name, tmp);
|
||||
}
|
||||
@@ -405,8 +405,8 @@ char *ReadExt(char *fname, int doflat, int *fnum)
|
||||
SkipNewLine(NULL);
|
||||
}
|
||||
else if (match(nexttok, "merge")) {
|
||||
char name[200];
|
||||
char name2[200];
|
||||
char name[MAX_STR_LEN];
|
||||
char name2[MAX_STR_LEN];
|
||||
SkipTok(NULL);
|
||||
GetExtName(name, nexttok);
|
||||
SkipTok(NULL);
|
||||
@@ -640,7 +640,7 @@ char *ReadSim(char *fname, int *fnum)
|
||||
double simscale = 1.0;
|
||||
|
||||
if ((filenum = OpenParseFile(fname, *fnum)) < 0) {
|
||||
char name[100];
|
||||
char name[MAX_STR_LEN];
|
||||
|
||||
SetExtension(name, fname, SIM_EXTENSION);
|
||||
if (OpenParseFile(name, *fnum) < 0) {
|
||||
@@ -670,7 +670,7 @@ char *ReadSim(char *fname, int *fnum)
|
||||
SkipNewLine(NULL);
|
||||
}
|
||||
else if (match(nexttok, "n")) {
|
||||
char gate[200], drain[200], source[200];
|
||||
char gate[MAX_STR_LEN], drain[MAX_STR_LEN], source[MAX_STR_LEN];
|
||||
char inststr[25], *instptr = NULL;
|
||||
|
||||
SkipTok(NULL);
|
||||
@@ -714,7 +714,7 @@ char *ReadSim(char *fname, int *fnum)
|
||||
LinkProperties("n", kvlist);
|
||||
}
|
||||
else if (match(nexttok, "p")) {
|
||||
char gate[200], drain[200], source[200];
|
||||
char gate[MAX_STR_LEN], drain[MAX_STR_LEN], source[MAX_STR_LEN];
|
||||
char inststr[25], *instptr = NULL;
|
||||
SkipTok(NULL);
|
||||
GetExtName(gate, nexttok);
|
||||
@@ -754,7 +754,7 @@ char *ReadSim(char *fname, int *fnum)
|
||||
LinkProperties("p", kvlist);
|
||||
}
|
||||
else if (match(nexttok, "e")) { /* 3-port capacitors (poly/poly2) */
|
||||
char gate[200], drain[200], source[200];
|
||||
char gate[MAX_STR_LEN], drain[MAX_STR_LEN], source[MAX_STR_LEN];
|
||||
char inststr[25], *instptr = NULL;
|
||||
SkipTok(NULL);
|
||||
GetExtName(gate, nexttok);
|
||||
@@ -788,7 +788,7 @@ char *ReadSim(char *fname, int *fnum)
|
||||
E(fname, instptr, gate, drain, source);
|
||||
}
|
||||
else if (match(nexttok, "b")) { /* bipolars added by Tim 7/16/96 */
|
||||
char base[200], emitter[200], collector[200];
|
||||
char base[MAX_STR_LEN], emitter[MAX_STR_LEN], collector[MAX_STR_LEN];
|
||||
char inststr[25], *instptr = NULL;
|
||||
SkipTok(NULL);
|
||||
GetExtName(base, nexttok);
|
||||
@@ -826,7 +826,7 @@ char *ReadSim(char *fname, int *fnum)
|
||||
SkipNewLine(NULL);
|
||||
}
|
||||
else {
|
||||
char ctop[200], cbot[200], cdummy[200];
|
||||
char ctop[MAX_STR_LEN], cbot[MAX_STR_LEN], cdummy[MAX_STR_LEN];
|
||||
SkipTok(NULL);
|
||||
GetExtName(ctop, nexttok);
|
||||
if (LookupObject(ctop, CurrentCell) == NULL)
|
||||
@@ -851,7 +851,7 @@ char *ReadSim(char *fname, int *fnum)
|
||||
SkipNewLine(NULL);
|
||||
}
|
||||
else {
|
||||
char rtop[200], rbot[200];
|
||||
char rtop[MAX_STR_LEN], rbot[MAX_STR_LEN];
|
||||
SkipTok(NULL);
|
||||
GetExtName(rtop, nexttok);
|
||||
if (LookupObject(rtop, CurrentCell) == NULL)
|
||||
@@ -875,7 +875,7 @@ char *ReadSim(char *fname, int *fnum)
|
||||
SkipNewLine(NULL);
|
||||
}
|
||||
else {
|
||||
char rtop[200], rbot[200], rdummy[200];
|
||||
char rtop[MAX_STR_LEN], rbot[MAX_STR_LEN], rdummy[MAX_STR_LEN];
|
||||
char inststr[25], *instptr = NULL;
|
||||
SkipTok(NULL);
|
||||
GetExtName(rdummy, nexttok);
|
||||
@@ -917,7 +917,7 @@ char *ReadSim(char *fname, int *fnum)
|
||||
SkipNewLine(NULL);
|
||||
}
|
||||
else if (match(nexttok, "=")) {
|
||||
char node1[200], node2[200];
|
||||
char node1[MAX_STR_LEN], node2[MAX_STR_LEN];
|
||||
SkipTok(NULL);
|
||||
GetExtName(node1, nexttok);
|
||||
SkipTok(NULL);
|
||||
|
||||
+42
-1
@@ -53,7 +53,7 @@ void flattenCell(char *name, int file)
|
||||
struct nlist *ChildCell;
|
||||
struct objlist *tmp, *ob2, *ob3;
|
||||
int notdone, rnodenum;
|
||||
char tmpstr[200];
|
||||
char tmpstr[MAX_STR_LEN];
|
||||
int nextnode, oldmax;
|
||||
#if !OLDPREFIX
|
||||
int prefixlength;
|
||||
@@ -243,6 +243,13 @@ void flattenCell(char *name, int file)
|
||||
ThisCell->dumped = 1; /* indicate cell has been flattened */
|
||||
}
|
||||
|
||||
/* Structure used to keep track of nodes needing checking */
|
||||
|
||||
struct linkednode {
|
||||
int node;
|
||||
struct linkednode *next;
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------*/
|
||||
/* flattenInstancesOf -- */
|
||||
/* */
|
||||
@@ -265,6 +272,7 @@ int flattenInstancesOf(char *name, int fnum, char *instance)
|
||||
struct nlist *ThisCell;
|
||||
struct nlist *ChildCell;
|
||||
struct objlist *tmp, *ob2, *ob3;
|
||||
struct linkednode *checknodes = NULL, *newlnode, *chknode;
|
||||
int notdone, rnodenum;
|
||||
char tmpstr[1024];
|
||||
int nextnode, oldmax, numflat = 0;
|
||||
@@ -416,6 +424,16 @@ int flattenInstancesOf(char *name, int fnum, char *instance)
|
||||
}
|
||||
UpdateNodeNumbers(ChildStart, tmp->node, ob2->node);
|
||||
}
|
||||
else if (tmp->node == -1) {
|
||||
/* Opposite case: If child port is an unconnected node, then */
|
||||
/* removing the instance may make the parent node become */
|
||||
/* unconnected. For now, just record the node number. At the */
|
||||
/* end we'll check if these nodes are actually disconnected. */
|
||||
newlnode = (struct linkednode *)MALLOC(sizeof(struct linkednode));
|
||||
newlnode->node = ob2->node;
|
||||
newlnode->next = checknodes;
|
||||
checknodes = newlnode;
|
||||
}
|
||||
|
||||
/* in pathological cases, the lengths of the port lists may
|
||||
* change. This is an error, but that is no reason to allow
|
||||
@@ -598,6 +616,29 @@ int flattenInstancesOf(char *name, int fnum, char *instance)
|
||||
NextObj = ParentParams;
|
||||
} /* repeat until no more instances found */
|
||||
}
|
||||
|
||||
/* Check nodes that may have become disconnected after child flattening */
|
||||
while (checknodes != NULL) {
|
||||
struct objlist *portnode = NULL;
|
||||
|
||||
chknode = checknodes;
|
||||
checknodes = checknodes->next;
|
||||
|
||||
for (ob3 = ThisCell->cell; ob3; ob3 = ob3->next) {
|
||||
if ((ob3->type != PORT) && (portnode == NULL))
|
||||
break;
|
||||
else if ((ob3->type == PORT) && (ob3->node == chknode->node))
|
||||
portnode = ob3;
|
||||
else if ((ob3->type >= FIRSTPIN) && (ob3->node == chknode->node))
|
||||
break;
|
||||
}
|
||||
if ((ob3 == NULL) && (portnode != NULL)) {
|
||||
/* Port became disconnected when child was flattened */
|
||||
portnode->node = -1;
|
||||
}
|
||||
FREE(chknode);
|
||||
}
|
||||
|
||||
CacheNodeNames(ThisCell);
|
||||
ThisCell->dumped = 1; /* indicate cell has been flattened */
|
||||
return numflat;
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ void STRCPY(char *dest, char *source)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char cell1[200], cell2[200];
|
||||
char cell1[MAX_STR_LEN], cell2[MAX_STR_LEN];
|
||||
|
||||
Debug = 0;
|
||||
if (argc != 1) {
|
||||
|
||||
+346
-211
@@ -5005,6 +5005,11 @@ int PropertyOptimize(struct objlist *ob, struct nlist *tp, int run, int series,
|
||||
// find ith record in ob
|
||||
p = 0;
|
||||
for (ob2 = ob; p != i; ob2 = ob2->next, p++);
|
||||
/* Sanity check */
|
||||
if (ob2->type != PROPERTY) {
|
||||
Fprintf(stderr, "Incorrect property run count!\n");
|
||||
continue;
|
||||
}
|
||||
// Count entries, add one, reallocate
|
||||
for (p = 0;; p++) {
|
||||
vl = &ob2->instance.props[p];
|
||||
@@ -5994,10 +5999,12 @@ PropertyMatch(struct objlist *ob1, int file1,
|
||||
else if ((t2type != PROPERTY) && (checked_one == TRUE)) {
|
||||
// t1 has more property records than t2, and they did not get
|
||||
// merged equally by PropertySortAndCombine().
|
||||
Fprintf(stdout, "Circuit 2 parallel/series network does not match"
|
||||
if (do_print) {
|
||||
Fprintf(stdout, "Circuit 2 parallel/series network does not match"
|
||||
" Circuit 1\n");
|
||||
DumpNetwork(ob1, 1);
|
||||
DumpNetwork(ob2, 2);
|
||||
DumpNetwork(ob1, 1);
|
||||
DumpNetwork(ob2, 2);
|
||||
}
|
||||
mismatches++;
|
||||
}
|
||||
else if (t2type != PROPERTY) {
|
||||
@@ -6945,7 +6952,8 @@ int EquivalenceClasses(char *name1, int file1, char *name2, int file2)
|
||||
/* 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)) {
|
||||
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);
|
||||
@@ -7250,23 +7258,20 @@ struct nlist *addproxies(struct hashlist *p, void *clientdata)
|
||||
/* Return codes: */
|
||||
/* 2: Neither cell had pins, so matching is unnecessary */
|
||||
/* 1: Exact match */
|
||||
/* 0: Circuit match w/pin name mismatch. Force a match. */
|
||||
/* -1: Pin mismatch. Flatten cell. */
|
||||
/* 0: Inexact match resolved by proxy pin insertion. */
|
||||
/*--------------------------------------------------------------*/
|
||||
|
||||
int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist)
|
||||
{
|
||||
char *cover1, *cover2, *ctemp;
|
||||
char *cover, *ctemp;
|
||||
char *bangptr1, *bangptr2, *backslashptr1, *backslashptr2;
|
||||
struct objlist *ob1, *ob2, *obn, *obp, *ob1s, *ob2s, *obt;
|
||||
struct NodeClass *NC;
|
||||
struct Node *N1, *N2;
|
||||
int i, j, k, m, a, b, swapped, numnodes, numnodes2, numorig;
|
||||
int i, j, k, m, a, b, swapped, numnodes, numorig;
|
||||
int result = 1, haspins = 0, notempty = 0;
|
||||
int hasproxy1 = 0, hasproxy2 = 0;
|
||||
int needclean1 = 0, needclean2 = 0;
|
||||
int hasDevices1, hasDevices2;
|
||||
int isBlackBox1, isBlackBox2;
|
||||
char *ostr;
|
||||
#ifdef TCL_NETGEN
|
||||
Tcl_Obj *mlist, *plist1, *plist2;
|
||||
@@ -7275,12 +7280,10 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist)
|
||||
if (tc1 == NULL) tc1 = Circuit1;
|
||||
if (tc2 == NULL) tc2 = Circuit2;
|
||||
|
||||
numnodes2 = 0;
|
||||
for (ob2 = tc2->cell; ob2 != NULL; ob2 = ob2->next) {
|
||||
if (ob2->type != PORT) break;
|
||||
else haspins = 1;
|
||||
ob2->model.port = -1;
|
||||
numnodes2++;
|
||||
}
|
||||
numnodes = 0;
|
||||
for (ob1 = tc1->cell; ob1 != NULL; ob1 = ob1->next) {
|
||||
@@ -7295,8 +7298,7 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist)
|
||||
return 2;
|
||||
}
|
||||
|
||||
cover1 = (char *)CALLOC(numnodes, sizeof(char));
|
||||
cover2 = (char *)CALLOC(numnodes2, sizeof(char));
|
||||
cover = (char *)CALLOC(numnodes, sizeof(char));
|
||||
numorig = numnodes;
|
||||
|
||||
#ifdef TCL_NETGEN
|
||||
@@ -7329,159 +7331,194 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist)
|
||||
}
|
||||
|
||||
for (NC = NodeClasses; NC != NULL; NC = NC->next) {
|
||||
a = 0; // circuit1 node offset
|
||||
a = 0;
|
||||
for (N1 = NC->nodes; N1 != NULL; N1 = N1->next) {
|
||||
if (N1->graph == Circuit1->file) {
|
||||
obn = N1->object;
|
||||
b = 0; // circuit2 node offset
|
||||
for (N2 = NC->nodes; N2 != NULL; N2 = N2->next) {
|
||||
if (N2->graph != Circuit1->file) {
|
||||
if (b == a) break;
|
||||
else b++;
|
||||
}
|
||||
}
|
||||
if (N2 == NULL) { // This should never occur in matched nets
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
obp = N2->object;
|
||||
}
|
||||
ob1 = NULL;
|
||||
if (IsPort(obn)) {
|
||||
i = 0;
|
||||
for (ob1 = tc1->cell; ob1 != NULL; ob1 = ob1->next, i++) {
|
||||
if ((IsPort(ob1)) && (*matchfunc)(ob1->name, obn->name)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
*(cover1 + i) = (char)1;
|
||||
}
|
||||
ob2 = NULL;
|
||||
if (obp && IsPort(obp)) {
|
||||
j = 0;
|
||||
for (ob2 = tc2->cell; ob2 != NULL; ob2 = ob2->next, j++) {
|
||||
if ((IsPort(ob2)) && (*matchfunc)(ob2->name, obp->name)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
*(cover2 + j) = (char)1;
|
||||
}
|
||||
|
||||
if (Debug == 0) {
|
||||
for (m = 0; m < left_col_end; m++) *(ostr + m) = ' ';
|
||||
for (m = left_col_end + 1; m < right_col_end; m++) *(ostr + m) = ' ';
|
||||
if (ob1 && ob2) { // both pins are in both circuits
|
||||
if (NC->legalpartition) { // nets match
|
||||
snprintf(ostr, left_col_end, "%s", obn->name);
|
||||
if ((*matchfunc)(obn->name, obp->name))
|
||||
/* MatchPins - case 1: portA(0) = portA(1)
|
||||
* Pin names match
|
||||
*/
|
||||
snprintf(ostr + left_col_end + 1, left_col_end,
|
||||
"%s", obp->name);
|
||||
else {
|
||||
/* MatchPins - case 2: portA(0) = portb(1)
|
||||
* circuits match but the pin names don't.
|
||||
*/
|
||||
snprintf(ostr + left_col_end + 1, left_col_end,
|
||||
"%s **Mismatch**", obp->name);
|
||||
/* Pins with different names are on different nets,
|
||||
* so this should trigger an error return code.
|
||||
*/
|
||||
result = (result == 1) ? 0 : result; // only set if 1
|
||||
if ((IsPort(ob1)) && (ob1->node == obn->node)) {
|
||||
b = 0;
|
||||
for (N2 = NC->nodes; N2 != NULL; N2 = N2->next) {
|
||||
if (N2->graph != Circuit1->file) {
|
||||
if (b == a) break;
|
||||
else b++;
|
||||
}
|
||||
}
|
||||
if (N2 == NULL) {
|
||||
#ifdef TCL_NETGEN
|
||||
if (dolist) {
|
||||
Tcl_SetVar2Ex(netgeninterp, "lvs_out", NULL,
|
||||
Tcl_NewStringObj("pins", -1),
|
||||
TCL_APPEND_VALUE | TCL_LIST_ELEMENT);
|
||||
Tcl_SetVar2Ex(netgeninterp, "lvs_out", NULL, mlist,
|
||||
TCL_APPEND_VALUE | TCL_LIST_ELEMENT);
|
||||
}
|
||||
#endif
|
||||
FREE(ostr);
|
||||
return 1;
|
||||
}
|
||||
ob2->model.port = i; /* save the order */
|
||||
|
||||
obp = N2->object;
|
||||
j = 0;
|
||||
for (ob2 = tc2->cell; ob2 != NULL; ob2 = ob2->next, j++) {
|
||||
if ((IsPort(ob2)) && (ob2->node == obp->node)) {
|
||||
if (Debug == 0) {
|
||||
for (m = 0; m < left_col_end; m++) *(ostr + m) = ' ';
|
||||
for (m = left_col_end + 1; m < right_col_end; m++) *(ostr + m) = ' ';
|
||||
snprintf(ostr, left_col_end, "%s", ob1->name);
|
||||
if ((*matchfunc)(ob1->name, ob2->name))
|
||||
snprintf(ostr + left_col_end + 1, left_col_end, "%s", ob2->name);
|
||||
else {
|
||||
/* 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,
|
||||
* so this should trigger an error return code.
|
||||
*/
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
for (m = 0; m < right_col_end + 1; m++)
|
||||
if (*(ostr + m) == '\0') *(ostr + m) = ' ';
|
||||
Fprintf(stdout, ostr);
|
||||
}
|
||||
else {
|
||||
Fprintf(stdout, "Circuit %s port %d \"%s\""
|
||||
" = cell %s port %d \"%s\"\n",
|
||||
tc1->name, i, obn->name,
|
||||
tc2->name, j, obp->name);
|
||||
}
|
||||
#ifdef TCL_NETGEN
|
||||
if (dolist) {
|
||||
Tcl_ListObjAppendElement(netgeninterp, plist1,
|
||||
Tcl_NewStringObj(obn->name, -1));
|
||||
Tcl_ListObjAppendElement(netgeninterp, plist2,
|
||||
Tcl_NewStringObj(obp->name, -1));
|
||||
}
|
||||
#endif
|
||||
ob2->model.port = i; /* save order */
|
||||
*(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->type == PORT) && (ob1->next->node == ob1->node)) {
|
||||
ob1 = ob1->next;
|
||||
ob2 = tc2->cell; /* Restart search for matching pin */
|
||||
i++;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ob2 == NULL) {
|
||||
if (Debug == 0) {
|
||||
// If first cell has no pins but 2nd cell
|
||||
// does, then "no matching pin" entries will
|
||||
// be generated for all pins in the 2nd cell,
|
||||
// so don't print out the "no pins" entry.
|
||||
|
||||
if (strcmp(obn->name, "(no pins)")) {
|
||||
for (m = 0; m < left_col_end; m++) *(ostr + m) = ' ';
|
||||
for (m = left_col_end + 1; m < right_col_end; m++) *(ostr + m) = ' ';
|
||||
snprintf(ostr, 32, "%s", obn->name);
|
||||
snprintf(ostr + left_col_end + 1, left_col_end, "(no matching pin)");
|
||||
for (m = 0; m < right_col_end + 1; m++)
|
||||
if (*(ostr + m) == '\0') *(ostr + m) = ' ';
|
||||
Fprintf(stdout, ostr);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Fprintf(stderr, "No matching pin in cell %s for "
|
||||
"cell %s pin %s\n",
|
||||
tc2->name, tc1->name, obn->name);
|
||||
}
|
||||
#ifdef TCL_NETGEN
|
||||
if (dolist && strcmp(obn->name, "(no pins)")) {
|
||||
Tcl_ListObjAppendElement(netgeninterp, plist1,
|
||||
Tcl_NewStringObj(obn->name, -1));
|
||||
Tcl_ListObjAppendElement(netgeninterp, plist2,
|
||||
Tcl_NewStringObj("(no matching pin)", -1));
|
||||
}
|
||||
#endif
|
||||
result = 0;
|
||||
|
||||
/* Make a pass through circuit 1 to find out if */
|
||||
/* the pin really is connected to anything, or */
|
||||
/* has been left orphaned after flattening. If */
|
||||
/* disconnected, set its node number to -2. */
|
||||
|
||||
notempty = 0;
|
||||
for (obt = ob1->next; obt; obt = obt->next) {
|
||||
if (obt->type >= FIRSTPIN) {
|
||||
notempty = 1;
|
||||
if (obt->node == ob1->node)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((obt == NULL) && (notempty == 1)) {
|
||||
ob1->node = -2; // Will run this through cleanuppins
|
||||
needclean1 = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
else {
|
||||
snprintf(ostr, left_col_end, "*%s", obn->name);
|
||||
snprintf(ostr + left_col_end + 1, left_col_end,
|
||||
"*%s **Mismatch**", obp->name);
|
||||
}
|
||||
|
||||
if (ob1 == NULL) {
|
||||
if (Debug == 0) {
|
||||
for (m = 0; m < left_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 + 1, left_col_end, "(no matching pin)");
|
||||
for (m = 0; m < right_col_end + 1; m++)
|
||||
if (*(ostr + m) == '\0') *(ostr + m) = ' ';
|
||||
result = -1;
|
||||
}
|
||||
}
|
||||
else if (ob1) { // implies (&& !ob2)
|
||||
/* MatchPins - case 3: portA(0) = netA(1)
|
||||
* circuits match but circuit2 is missing pin
|
||||
*/
|
||||
snprintf(ostr, left_col_end, "%s", obn->name);
|
||||
if (NC->legalpartition) { // net match
|
||||
snprintf(ostr + left_col_end + 1, left_col_end,
|
||||
"*%s **not a pin**", obp->name);
|
||||
Fprintf(stdout, ostr);
|
||||
}
|
||||
else {
|
||||
snprintf(ostr + left_col_end + 1, left_col_end,
|
||||
"*%s **Mismatch**", obp->name);
|
||||
Fprintf(stderr, "No netlist match for cell %s pin %s\n",
|
||||
tc1->name, obn->name);
|
||||
}
|
||||
result = -1;
|
||||
}
|
||||
else if (ob2) { // imples (&& !ob1)
|
||||
/* MatchPins - case 4: netA(0) = portA(1)
|
||||
* circuits match but circuit1 is missing pin
|
||||
*/
|
||||
if (NC->legalpartition) { // net match
|
||||
snprintf(ostr, left_col_end, "*%s **not pin**", obn->name);
|
||||
}
|
||||
else {
|
||||
snprintf(ostr, left_col_end, "*%s **Mismatch**", obn->name);
|
||||
}
|
||||
snprintf(ostr + left_col_end + 1, left_col_end, "%s", obp->name);
|
||||
result = -1;
|
||||
}
|
||||
if (ob1 || ob2) {
|
||||
for (m = 0; m < right_col_end + 1; m++)
|
||||
if (*(ostr + m) == '\0') *(ostr + m) = ' ';
|
||||
Fprintf(stdout, ostr);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Fprintf(stdout, "Circuit %s port %d \"%s\""
|
||||
" = cell %s port %d \"%s\"\n",
|
||||
tc1->name, i, (obn) ? obn->name : "",
|
||||
tc2->name, j, (obp) ? obp->name : "");
|
||||
}
|
||||
|
||||
|
||||
#ifdef TCL_NETGEN
|
||||
if (dolist) {
|
||||
Tcl_ListObjAppendElement(netgeninterp, plist1,
|
||||
Tcl_NewStringObj((obn) ? obn->name : "", -1));
|
||||
Tcl_ListObjAppendElement(netgeninterp, plist2,
|
||||
Tcl_NewStringObj((obp) ? obp->name : "", -1));
|
||||
}
|
||||
if (dolist) {
|
||||
Tcl_ListObjAppendElement(netgeninterp, plist1,
|
||||
Tcl_NewStringObj(obn->name, -1));
|
||||
Tcl_ListObjAppendElement(netgeninterp, plist2,
|
||||
Tcl_NewStringObj("(no matching pin)", -1));
|
||||
}
|
||||
#endif
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
a++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for unconnected nodes in tc1 */
|
||||
for (ob1 = tc1->cell; ob1 && IsPort(ob1); ob1 = ob1->next) {
|
||||
if (ob1->node >= 0) {
|
||||
/* Check if ob1->node might really be disconnected */
|
||||
for (obn = ob1->next; obn; obn = obn->next) {
|
||||
if (obn->node == ob1->node) break;
|
||||
}
|
||||
if (obn == NULL) ob1->node = -1; // Make disconnected
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for unconnected nodes in tc2 */
|
||||
for (ob2 = tc2->cell; ob2 && IsPort(ob2); ob2 = ob2->next) {
|
||||
if (ob2->node >= 0) {
|
||||
/* Check if ob2->node might really be disconnected */
|
||||
for (obp = ob2->next; obp; obp = obp->next) {
|
||||
if (obp->node == ob2->node) break;
|
||||
}
|
||||
if (obp == NULL) ob2->node = -1; // Make disconnected
|
||||
}
|
||||
}
|
||||
|
||||
/* Do any unmatched pins have the same name? */
|
||||
/* This should not happen if unconnected pins are eliminated */
|
||||
/* so apply only to black-box (CELL_PLACEHOLDER) entries. */
|
||||
/* (Semi-hack: Allow "!" global flag) */
|
||||
/* (Semi-hack: Allow "!" global flag) */
|
||||
/* (Another semi-hack: Ignore the leading backslash in */
|
||||
/* backslash-escaped verilog names. Removing the backslash */
|
||||
/* and ending space character is a common way to convert to */
|
||||
@@ -7489,11 +7526,7 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist)
|
||||
|
||||
ob1 = tc1->cell;
|
||||
|
||||
isBlackBox1 = (tc1->flags & CELL_PLACEHOLDER);
|
||||
isBlackBox2 = (tc2->flags & CELL_PLACEHOLDER);
|
||||
|
||||
for (i = 0; i < numorig; i++) {
|
||||
|
||||
bangptr1 = strrchr(ob1->name, '!');
|
||||
if (bangptr1 && (*(bangptr1 + 1) == '\0'))
|
||||
*bangptr1 = '\0';
|
||||
@@ -7501,13 +7534,12 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist)
|
||||
|
||||
backslashptr1 = (*(ob1->name) == '\\') ? ob1->name + 1 : ob1->name;
|
||||
|
||||
if (*(cover1 + i) == (char)0) {
|
||||
if (*(cover + i) == (char)0) {
|
||||
j = 0;
|
||||
for (ob2 = tc2->cell; ob2 != NULL; ob2 = ob2->next, j++) {
|
||||
for (ob2 = tc2->cell; ob2 != NULL; ob2 = ob2->next) {
|
||||
char *name1, *name2;
|
||||
|
||||
if (!IsPort(ob2)) break;
|
||||
if (*(cover2 + j) == (char)1) continue; // port was processed
|
||||
|
||||
bangptr2 = strrchr(ob2->name, '!');
|
||||
if (bangptr2 && (*(bangptr2 + 1) == '\0'))
|
||||
@@ -7531,23 +7563,18 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist)
|
||||
/* matched by name. */
|
||||
|
||||
if (((ob1->node == -1) && (ob2->node == -1)) ||
|
||||
(isBlackBox1 && isBlackBox2) ||
|
||||
(NodeClasses == NULL)) {
|
||||
(((tc1->flags & CELL_PLACEHOLDER) &&
|
||||
(tc2->flags & CELL_PLACEHOLDER)) ||
|
||||
(NodeClasses == NULL))) {
|
||||
|
||||
ob2->model.port = i; /* save order */
|
||||
*(cover1 + i) = (char)1;
|
||||
*(cover2 + j) = (char)1;
|
||||
*(cover + i) = (char)1;
|
||||
|
||||
if (Debug == 0) {
|
||||
for (m = 0; m < left_col_end; m++) *(ostr + m) = ' ';
|
||||
for (m = left_col_end + 1; m < right_col_end; m++) *(ostr + m) = ' ';
|
||||
snprintf(ostr, left_col_end, "%s%s", ob1->name,
|
||||
(ob1->node == -1 && !isBlackBox1) ?
|
||||
" (disconnected)" : "");
|
||||
snprintf(ostr + left_col_end + 1, left_col_end,
|
||||
"%s%s", ob2->name,
|
||||
(ob2->node == -1 && !isBlackBox2) ?
|
||||
" (disconnected)" : "");
|
||||
snprintf(ostr, left_col_end, "%s", ob1->name);
|
||||
snprintf(ostr + left_col_end + 1, left_col_end, "%s", ob2->name);
|
||||
for (m = 0; m < right_col_end + 1; m++)
|
||||
if (*(ostr + m) == '\0') *(ostr + m) = ' ';
|
||||
Fprintf(stdout, ostr);
|
||||
@@ -7571,6 +7598,7 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist)
|
||||
}
|
||||
}
|
||||
if (bangptr2) *bangptr2 = '!';
|
||||
j++;
|
||||
}
|
||||
}
|
||||
ob1 = ob1->next;
|
||||
@@ -7589,9 +7617,8 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist)
|
||||
/* connections in the cell to the end. Create pins */
|
||||
/* in tc1 to match. */
|
||||
|
||||
for (j = 0, ob2 = tc2->cell; ob2 != NULL; j++, ob2 = ob2->next) {
|
||||
for (ob2 = tc2->cell; ob2 != NULL; ob2 = ob2->next) {
|
||||
if (ob2->type != PORT) break;
|
||||
if (*(cover2 + j) == (char)1) continue; // port was processed
|
||||
if (ob2->model.port == -1) {
|
||||
|
||||
if (Debug == 0) {
|
||||
@@ -7599,10 +7626,8 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist)
|
||||
if (strcmp(ob2->name, "(no pins)")) {
|
||||
for (m = 0; m < left_col_end; m++) *(ostr + m) = ' ';
|
||||
for (m = left_col_end + 1; m < right_col_end; m++) *(ostr + m) = ' ';
|
||||
snprintf(ostr, left_col_end, "**no match**");
|
||||
snprintf(ostr + left_col_end + 1, left_col_end,
|
||||
"%s%s", ob2->name,
|
||||
(ob2->node == -1) ? " (disconnected)" : "");
|
||||
snprintf(ostr, left_col_end, "(no matching pin)");
|
||||
snprintf(ostr + left_col_end + 1, left_col_end, "%s", ob2->name);
|
||||
for (m = 0; m < right_col_end + 1; m++)
|
||||
if (*(ostr + m) == '\0') *(ostr + m) = ' ';
|
||||
Fprintf(stdout, ostr);
|
||||
@@ -7613,12 +7638,80 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist)
|
||||
tc2->name, ob2->name);
|
||||
}
|
||||
|
||||
/* Before making a proxy pin, check to see if */
|
||||
/* flattening instances has left a port with a */
|
||||
/* net number that doesn't connect to anything */
|
||||
|
||||
notempty = 0;
|
||||
for (obt = ob2->next; obt; obt = obt->next) {
|
||||
if (obt->type >= FIRSTPIN) {
|
||||
notempty = 1;
|
||||
if (obt->node == ob2->node)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((obt == NULL) && (notempty == 1)) {
|
||||
ob2->node = -2; // Will run this through cleanuppins
|
||||
needclean2 = 1;
|
||||
|
||||
/* On the top level, missing pins are an error, even if */
|
||||
/* they appear to match unconnected pins on the other side. */
|
||||
if (CompareQueue == NULL)
|
||||
result = 0;
|
||||
|
||||
#ifdef TCL_NETGEN
|
||||
if (dolist) {
|
||||
Tcl_ListObjAppendElement(netgeninterp, plist1,
|
||||
Tcl_NewStringObj("(no pin)", -1));
|
||||
Tcl_ListObjAppendElement(netgeninterp, plist2,
|
||||
Tcl_NewStringObj(ob2->name, -1));
|
||||
}
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
else if (notempty == 1) {
|
||||
/* Flag this as an error */
|
||||
result = 0;
|
||||
#ifdef TCL_NETGEN
|
||||
if (dolist) {
|
||||
Tcl_ListObjAppendElement(netgeninterp, plist1,
|
||||
Tcl_NewStringObj("(no matching pin)", -1));
|
||||
Tcl_ListObjAppendElement(netgeninterp, plist2,
|
||||
Tcl_NewStringObj(ob2->name, -1));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
ob2->model.port = numnodes++; // Assign a port order
|
||||
result = -1;
|
||||
|
||||
/* Add a proxy pin to tc1 */
|
||||
/* Technically, this should have a matching net number. */
|
||||
/* But nothing connects to it, so it is only needed to */
|
||||
/* make sure the "pin magic" numbers are correctly */
|
||||
/* assigned to both cells. */
|
||||
|
||||
obn = (struct objlist *)CALLOC(1, sizeof(struct objlist));
|
||||
obn->name = (char *)MALLOC(6 + strlen(ob2->name));
|
||||
sprintf(obn->name, "proxy%s", ob2->name);
|
||||
obn->type = UNKNOWN;
|
||||
// obn->model.port = -1;
|
||||
obn->instance.name = NULL;
|
||||
obn->node = -1;
|
||||
if (ob1 == tc1->cell) {
|
||||
obn->next = ob1;
|
||||
tc1->cell = obn;
|
||||
}
|
||||
else {
|
||||
obn->next = ob1->next;
|
||||
ob1->next = obn;
|
||||
}
|
||||
ob1 = obn;
|
||||
hasproxy1 = 1;
|
||||
|
||||
HashPtrInstall(obn->name, obn, &(tc1->objdict));
|
||||
}
|
||||
}
|
||||
|
||||
/* Find the end of the pin list in tc2 */
|
||||
/* Find the end of the pin list in tc2, for adding proxy pins */
|
||||
|
||||
for (ob2 = tc2->cell; ob2 != NULL; ob2 = ob2->next) {
|
||||
if (ob2 && ((ob2->next && ob2->next->type != PORT) || ob2->next == NULL))
|
||||
@@ -7631,55 +7724,97 @@ int MatchPins(struct nlist *tc1, struct nlist *tc2, int dolist)
|
||||
/* sequence, then fill in the missing numbers. Otherwise, add the */
|
||||
/* extra nodes to the end. */
|
||||
|
||||
for (i = 0, ob1 = tc1->cell; i < numorig; i++, ob1 = ob1->next) {
|
||||
if (*(cover1 + i) == (char)1) continue;
|
||||
j = 0;
|
||||
for (i = 0; i < numorig; i++) {
|
||||
if (*(cover + i) == (char)1) continue;
|
||||
|
||||
/* Note: Has this pin already been accounted for? */
|
||||
if (Debug == 0) {
|
||||
if (strcmp(ob1->name, "(no pins)")) {
|
||||
for (m = 0; m < left_col_end; m++) *(ostr + m) = ' ';
|
||||
for (m = left_col_end + 1; m < right_col_end; m++) *(ostr + m) = ' ';
|
||||
snprintf(ostr, left_col_end, "%s%s", ob1->name,
|
||||
(ob1->node == -1) ? " (disconnected)" : "");
|
||||
snprintf(ostr + left_col_end + 1, left_col_end, "**no match**");
|
||||
for (m = 0; m < right_col_end + 1; m++)
|
||||
if (*(ostr + m) == '\0') *(ostr + m) = ' ';
|
||||
Fprintf(stdout, ostr);
|
||||
/* If the equivalent node in tc1 is not disconnected */
|
||||
/* (node != -1) then we should report a match error, */
|
||||
/* although this does not necessarily imply an error in */
|
||||
/* netlist connectivity. */
|
||||
|
||||
ob1 = tc1->cell;
|
||||
for (k = i; k > 0 && ob1 != NULL; k--)
|
||||
ob1 = ob1->next;
|
||||
|
||||
if (ob1 == NULL || ob1->type != PORT || ob1->node >= 0) {
|
||||
/* Check if ob1->node might really be disconnected */
|
||||
for (obn = ob1->next; obn; obn = obn->next) {
|
||||
if (obn->node == ob1->node) break;
|
||||
}
|
||||
result = -1;
|
||||
if (obn == NULL) ob1->node = -1; /* Make disconnected */
|
||||
}
|
||||
else {
|
||||
Fprintf(stderr, "No netlist match for cell %s pin %s\n",
|
||||
tc1->name, ob1->name);
|
||||
|
||||
if (ob1 == NULL || ob1->type != PORT || ob1->node >= 0
|
||||
|| (ob1->node < 0 && tc1->class == CLASS_MODULE)
|
||||
|| (ob1->node < 0 && ob1->model.port == -1)) {
|
||||
|
||||
/* Add a proxy pin to tc2 */
|
||||
obn = (struct objlist *)CALLOC(1, sizeof(struct objlist));
|
||||
if (ob1 == NULL) {
|
||||
obn->name = (char *)MALLOC(15);
|
||||
sprintf(obn->name, "proxy%d", rand() & 0x3ffffff);
|
||||
}
|
||||
else {
|
||||
obn->name = (char *)MALLOC(6 + strlen(ob1->name));
|
||||
sprintf(obn->name, "proxy%s", ob1->name);
|
||||
}
|
||||
obn->type = UNKNOWN;
|
||||
obn->model.port = (i - j);
|
||||
obn->instance.name = NULL;
|
||||
obn->node = -1;
|
||||
|
||||
/* Note: Has this pin already been accounted for? */
|
||||
if (Debug == 0) {
|
||||
if (strcmp(ob1->name, "(no pins)")) {
|
||||
for (m = 0; m < left_col_end; m++) *(ostr + m) = ' ';
|
||||
for (m = left_col_end + 1; m < right_col_end; m++) *(ostr + m) = ' ';
|
||||
snprintf(ostr, left_col_end, "%s", ob1->name);
|
||||
snprintf(ostr + left_col_end + 1, left_col_end, "(no matching pin)");
|
||||
for (m = 0; m < right_col_end + 1; m++)
|
||||
if (*(ostr + m) == '\0') *(ostr + m) = ' ';
|
||||
Fprintf(stdout, ostr);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Fprintf(stderr, "No netlist match for cell %s pin %s\n",
|
||||
tc1->name, ob1->name);
|
||||
}
|
||||
|
||||
if (ob2 == tc2->cell) {
|
||||
obn->next = ob2;
|
||||
tc2->cell = obn;
|
||||
}
|
||||
else {
|
||||
obn->next = ob2->next;
|
||||
ob2->next = obn;
|
||||
}
|
||||
ob2 = obn;
|
||||
hasproxy2 = 1;
|
||||
|
||||
HashPtrInstall(obn->name, obn, &(tc2->objdict));
|
||||
}
|
||||
|
||||
else if (ob1 != NULL && ob1->type == PORT) {
|
||||
/* Disconnected node was not meaningful, has no pin match in */
|
||||
/* the compared circuit, and so should be discarded. */
|
||||
ob1->node = -2;
|
||||
needclean1 = 1;
|
||||
|
||||
/* Adjust numbering around removed node */
|
||||
for (ob2s = tc2->cell; ob2s != NULL && ob2s->type == PORT; ob2s = ob2s->next) {
|
||||
if (ob2s->model.port > (i - j)) ob2s->model.port--;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
FREE(cover1);
|
||||
FREE(cover2);
|
||||
FREE(cover);
|
||||
|
||||
if (Debug == 0) {
|
||||
for (i = 0; i < right_col_end; i++) *(ostr + i) = '-';
|
||||
Fprintf(stdout, ostr);
|
||||
}
|
||||
|
||||
hasDevices1 = hasDevices2 = 0;
|
||||
|
||||
for (ob1 = tc1->cell; ob1 != NULL; ob1 = ob1->next) {
|
||||
if (ob1->type == FIRSTPIN) {
|
||||
hasDevices1 = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (ob2 = tc2->cell; ob2 != NULL; ob2 = ob2->next) {
|
||||
if (ob2->type == FIRSTPIN) {
|
||||
hasDevices2 = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hasDevices1 != hasDevices2 && result != 1)
|
||||
result = -2; // Attempt to compare empty cell to non-empty cell fails if pins don't match exactly
|
||||
|
||||
if (result < 0) return result;
|
||||
|
||||
/* Run cleanuppins on circuit 1 */
|
||||
if (needclean1) {
|
||||
CleanupPins(tc1->name, tc1->file);
|
||||
@@ -8010,8 +8145,8 @@ int Compare(char *cell1, char *cell2)
|
||||
void NETCOMP(void)
|
||||
/* a simple command interpreter to manage embedding/routing */
|
||||
{
|
||||
char name[100];
|
||||
char name2[100];
|
||||
char name[MAX_STR_LEN];
|
||||
char name2[MAX_STR_LEN];
|
||||
char ch;
|
||||
|
||||
setjmp(jmpenv);
|
||||
@@ -8109,7 +8244,7 @@ void NETCOMP(void)
|
||||
break;
|
||||
case 'p':
|
||||
{
|
||||
char model[100];
|
||||
char model[MAX_STR_LEN];
|
||||
/* equivalence two pins on a given class of element */
|
||||
Printf("Allow permutation of two pins.\n");
|
||||
promptstring("Enter cellname: ",model);
|
||||
|
||||
+3
-3
@@ -914,7 +914,7 @@ char *ReadNetlist(char *fname, int *fnum)
|
||||
}
|
||||
/* try appending extensions in sequence, and testing for file existance */
|
||||
for (index = 0; formats[index].extension != NULL; index++) {
|
||||
char testname[200];
|
||||
char testname[MAX_STR_LEN];
|
||||
strcpy(testname, fname);
|
||||
strcat(testname, formats[index].extension);
|
||||
if (OpenParseFile(testname, *fnum) >= 0) {
|
||||
@@ -1019,7 +1019,7 @@ void WriteNetgenFile(char *name, char *filename)
|
||||
|
||||
char *ReadNetgenFile (char *fname, int *fnum)
|
||||
{
|
||||
char name[100];
|
||||
char name[MAX_STR_LEN];
|
||||
char *LastCellRead = NULL;
|
||||
int filenum;
|
||||
|
||||
@@ -1255,7 +1255,7 @@ int READ(void *buf, int bytes)
|
||||
|
||||
char *ReadNetgenFile (char *fname, int *fnum)
|
||||
{
|
||||
char name[100];
|
||||
char name[MAX_STR_LEN];
|
||||
int len, chars;
|
||||
char *LastCellRead = NULL;
|
||||
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ int AddToExistingDefinition = 0; /* default: overwrite cell when reopened */
|
||||
extern int errno; /* Defined in stdlib.h */
|
||||
|
||||
#define MAX_STATIC_STRINGS 5
|
||||
static char staticstrings[MAX_STATIC_STRINGS][200];
|
||||
static char staticstrings[MAX_STATIC_STRINGS][MAX_STR_LEN];
|
||||
static int laststring;
|
||||
|
||||
extern struct hashdict spiceparams; /* From spice.c */
|
||||
|
||||
+2
-2
@@ -181,7 +181,7 @@ void Ntk(char *name, char *filename)
|
||||
|
||||
char *ReadNtk (char *fname, int *fnum)
|
||||
{
|
||||
char model[100], instancename[100], name[100];
|
||||
char model[MAX_STR_LEN], instancename[MAX_STR_LEN], name[MAX_STR_LEN];
|
||||
struct objlist *ob;
|
||||
int CellDefInProgress = 0;
|
||||
int filenum;
|
||||
@@ -218,7 +218,7 @@ char *ReadNtk (char *fname, int *fnum)
|
||||
}
|
||||
}
|
||||
else if (match(nexttok, "s")) {
|
||||
char last[100];
|
||||
char last[MAX_STR_LEN];
|
||||
*last = '\0';
|
||||
if (!CellDefInProgress) {
|
||||
/* fake cell declaration for top-level call */
|
||||
|
||||
+44
-2
@@ -440,10 +440,25 @@ 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 */
|
||||
/* as flattenInstancesOf() in disconnecting the port of a */
|
||||
/* parent cell if it connected to nothing other than the */
|
||||
/* deleted instance. */
|
||||
|
||||
int deleteclass(struct hashlist *p, int file)
|
||||
{
|
||||
struct nlist *ptr;
|
||||
struct objlist *ob, *lob, *nob;
|
||||
struct linkednode *checknodes = NULL, *newlnode, *chknode;
|
||||
|
||||
ptr = (struct nlist *)(p->ptr);
|
||||
|
||||
@@ -456,6 +471,12 @@ 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;
|
||||
}
|
||||
FreeObjectAndHash(ob, ptr);
|
||||
ob = nob;
|
||||
if (ob == NULL) break;
|
||||
@@ -477,6 +498,27 @@ int deleteclass(struct hashlist *p, int file)
|
||||
ob = nob;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
if ((ob == NULL) && (portnode != NULL)) {
|
||||
/* Port became disconnected when child was deleted */
|
||||
portnode->node = -1;
|
||||
}
|
||||
FREE(chknode);
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove all instances of class "class" from the database */
|
||||
@@ -697,7 +739,7 @@ struct nlist *RecurseCellHashTable2(struct nlist *(*foo)(struct hashlist *,
|
||||
|
||||
char *FixTemplate(char *t)
|
||||
{
|
||||
char buffer[200];
|
||||
char buffer[MAX_STR_LEN];
|
||||
char *rstr;
|
||||
int i,j;
|
||||
int InsideBrace;
|
||||
@@ -1208,7 +1250,7 @@ static char *OldNodeName(struct nlist *tp, int node)
|
||||
struct objlist *firstuniqueglobal;
|
||||
struct objlist *firstglobal;
|
||||
struct objlist *firstpin;
|
||||
static char StrBuffer[100];
|
||||
static char StrBuffer[MAX_STR_LEN];
|
||||
|
||||
#if 0
|
||||
/* make second pass, looking for ports */
|
||||
|
||||
+9
-9
@@ -511,8 +511,8 @@ int OpenEmbeddingFile(char *cellname, char *filename)
|
||||
/* returns 1 if OK */
|
||||
{
|
||||
struct nlist *tp;
|
||||
char outfilename[200];
|
||||
char logfilename[200];
|
||||
char outfilename[MAX_STR_LEN];
|
||||
char logfilename[MAX_STR_LEN];
|
||||
|
||||
tp = LookupCell(cellname);
|
||||
if (tp == NULL) {
|
||||
@@ -783,7 +783,7 @@ void SetupArray(char *prompt1, char *prompt2, char *prompt3, int *data,
|
||||
void (*proc)(void))
|
||||
{
|
||||
int i, oldfanout;
|
||||
char name[100];
|
||||
char name[MAX_STR_LEN];
|
||||
|
||||
Printf(prompt1);
|
||||
for (i = 1; i <= MAX_TREE_DEPTH; i++)
|
||||
@@ -792,7 +792,7 @@ void SetupArray(char *prompt1, char *prompt2, char *prompt3, int *data,
|
||||
|
||||
oldfanout = 1;
|
||||
for (i = 1; i <= MAX_TREE_DEPTH; i++) {
|
||||
char prompt[100];
|
||||
char prompt[MAX_STR_LEN];
|
||||
int newfanout;
|
||||
sprintf(prompt, prompt2, i);
|
||||
promptstring(prompt, name);
|
||||
@@ -822,7 +822,7 @@ void SetupArrayFromString(char *prompt1, char *prompt3, int *data,
|
||||
void (*proc)(void), char *text)
|
||||
{
|
||||
int i, oldfanout, newfanout;
|
||||
char string[100];
|
||||
char string[MAX_STR_LEN];
|
||||
char *ch;
|
||||
char *endch;
|
||||
|
||||
@@ -962,7 +962,7 @@ void ProtoPrintParameters(void)
|
||||
void PROTOCHIP(void)
|
||||
/* a simple command interpreter to manage embedding/routing */
|
||||
{
|
||||
char name[100];
|
||||
char name[MAX_STR_LEN];
|
||||
char ch;
|
||||
|
||||
InitializeFanout();
|
||||
@@ -1136,7 +1136,7 @@ void PROTOCHIP(void)
|
||||
|
||||
oldfanout = 1;
|
||||
for (i = 1; i <= MAX_TREE_DEPTH; i++) {
|
||||
char prompt[100];
|
||||
char prompt[MAX_STR_LEN];
|
||||
int newfanout;
|
||||
sprintf(prompt,"Fanout for level %d (0 to quit): ",i);
|
||||
promptstring(prompt, name);
|
||||
@@ -1168,7 +1168,7 @@ void PROTOCHIP(void)
|
||||
|
||||
oldfanout = 1;
|
||||
for (i = 1; i <= MAX_TREE_DEPTH; i++) {
|
||||
char prompt[100];
|
||||
char prompt[MAX_STR_LEN];
|
||||
int newfanout;
|
||||
sprintf(prompt,"Common nodes for level %d (0 to quit): ",i);
|
||||
promptstring(prompt, name);
|
||||
@@ -1200,7 +1200,7 @@ void PROTOCHIP(void)
|
||||
|
||||
oldfanout = 1;
|
||||
for (i = 1; i <= MAX_TREE_DEPTH; i++) {
|
||||
char prompt[100];
|
||||
char prompt[MAX_STR_LEN];
|
||||
int newfanout;
|
||||
sprintf(prompt,"Used leaves for level %d (0 to quit): ",i);
|
||||
promptstring(prompt, name);
|
||||
|
||||
+3
-3
@@ -37,7 +37,7 @@ extern int ColumnBase;
|
||||
|
||||
struct filestr {
|
||||
FILE *f;
|
||||
char buffer[200];
|
||||
char buffer[MAX_STR_LEN];
|
||||
int wrap; /* column to wrap around in, or 0 if no wrap */
|
||||
} file_buffers[MAXFILES];
|
||||
|
||||
@@ -107,7 +107,7 @@ void Fprintf(FILE *f, char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int FileIndex;
|
||||
char tmpstr[200];
|
||||
char tmpstr[MAX_STR_LEN];
|
||||
int bufferlongenough;
|
||||
int linewrapexceeded;
|
||||
|
||||
@@ -203,7 +203,7 @@ void Printf(char *format, ...)
|
||||
void Printf(char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char tmpstr[200];
|
||||
char tmpstr[MAX_STR_LEN];
|
||||
|
||||
va_start(ap, format);
|
||||
vsprintf(tmpstr, format, ap);
|
||||
|
||||
+4
-4
@@ -52,7 +52,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
/*************************************************************************/
|
||||
|
||||
static int SuppressPrompts = 0;
|
||||
static char InputLine[200];
|
||||
static char InputLine[MAX_STR_LEN];
|
||||
|
||||
void typeahead(char *str)
|
||||
{
|
||||
@@ -73,7 +73,7 @@ but reads from 'promptstring_infile' if nec. */
|
||||
/* If interactive, puts out 'prompt' */
|
||||
{
|
||||
char *nexttok;
|
||||
char tmpstr[200];
|
||||
char tmpstr[MAX_STR_LEN];
|
||||
int echo;
|
||||
|
||||
if (promptstring_infile == NULL)
|
||||
@@ -959,8 +959,8 @@ void Query(void)
|
||||
{
|
||||
/* little interactive debugger */
|
||||
char reply;
|
||||
char repstr[100];
|
||||
char repstr2[100];
|
||||
char repstr[MAX_STR_LEN];
|
||||
char repstr2[MAX_STR_LEN];
|
||||
float StartTime; /* for elapsed CPU times */
|
||||
int Timing; /* if true, print times of each command */
|
||||
int filenum = -1;
|
||||
|
||||
+105
-105
@@ -518,13 +518,13 @@ void ReadSpiceFile(char *fname, int filenum, struct cellstack **CellStackPtr,
|
||||
int warnings = 0, update = 0, hasports = 0;
|
||||
char *eqptr, devtype, in_subckt;
|
||||
struct keyvalue *kvlist = NULL;
|
||||
char inst[256], model[256], instname[256];
|
||||
char inst[MAX_STR_LEN], model[MAX_STR_LEN], instname[MAX_STR_LEN];
|
||||
struct nlist *tp;
|
||||
struct objlist *parent, *sobj, *nobj, *lobj, *pobj;
|
||||
|
||||
inst[255] = '\0';
|
||||
model[255] = '\0';
|
||||
instname[255] = '\0';
|
||||
inst[MAX_STR_LEN-1] = '\0';
|
||||
model[MAX_STR_LEN-1] = '\0';
|
||||
instname[MAX_STR_LEN-1] = '\0';
|
||||
in_subckt = (char)0;
|
||||
|
||||
while (!EndParseFile()) {
|
||||
@@ -555,7 +555,7 @@ void ReadSpiceFile(char *fname, int filenum, struct cellstack **CellStackPtr,
|
||||
|
||||
/* Check for existence of the cell. We may need to rename it. */
|
||||
|
||||
snprintf(model, 99, "%s", nexttok);
|
||||
snprintf(model, MAX_STR_LEN-1, "%s", nexttok);
|
||||
tp = LookupCellFile(nexttok, filenum);
|
||||
|
||||
/* Check for name conflict with duplicate cell names */
|
||||
@@ -703,7 +703,7 @@ skip_ends:
|
||||
|
||||
SpiceTokNoNewline();
|
||||
if (nexttok == NULL) continue; /* Ignore if no model name */
|
||||
snprintf(model, 99, "%s", nexttok);
|
||||
snprintf(model, MAX_STR_LEN-1, "%s", nexttok);
|
||||
SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
|
||||
@@ -887,29 +887,29 @@ skip_ends:
|
||||
}
|
||||
|
||||
else if (toupper(nexttok[0]) == 'Q') {
|
||||
char emitter[100], base[100], collector[100];
|
||||
emitter[99] = '\0';
|
||||
base[99] = '\0';
|
||||
collector[99] = '\0';
|
||||
char emitter[MAX_STR_LEN], base[MAX_STR_LEN], collector[MAX_STR_LEN];
|
||||
emitter[MAX_STR_LEN-1] = '\0';
|
||||
base[MAX_STR_LEN-1] = '\0';
|
||||
collector[MAX_STR_LEN-1] = '\0';
|
||||
|
||||
if (!(*CellStackPtr)) {
|
||||
CellDef(fname, filenum);
|
||||
PushStack(fname, CellStackPtr);
|
||||
}
|
||||
strncpy(inst, nexttok + 1, 99); SpiceTokNoNewline();
|
||||
strncpy(inst, nexttok + 1, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(collector, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(collector, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(base, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(base, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(emitter, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(emitter, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
/* make sure all the nodes exist */
|
||||
if (LookupObject(collector, CurrentCell) == NULL) Node(collector);
|
||||
if (LookupObject(base, CurrentCell) == NULL) Node(base);
|
||||
if (LookupObject(emitter, CurrentCell) == NULL) Node(emitter);
|
||||
|
||||
/* Read the device model */
|
||||
snprintf(model, 99, "%s", nexttok);
|
||||
snprintf(model, MAX_STR_LEN-1, "%s", nexttok);
|
||||
|
||||
while (nexttok != NULL)
|
||||
{
|
||||
@@ -940,30 +940,30 @@ skip_ends:
|
||||
goto baddevice;
|
||||
}
|
||||
|
||||
snprintf(instname, 255, "%s:%s", model, inst);
|
||||
snprintf(instname, MAX_STR_LEN-1, "%s:%s", model, inst);
|
||||
Cell(instname, model, collector, base, emitter);
|
||||
pobj = LinkProperties(model, kvlist);
|
||||
ReduceExpressions(pobj, NULL, CurrentCell, TRUE);
|
||||
DeleteProperties(&kvlist);
|
||||
}
|
||||
else if (toupper(nexttok[0]) == 'M') {
|
||||
char drain[100], gate[100], source[100], bulk[100];
|
||||
drain[99] = '\0';
|
||||
gate[99] = '\0';
|
||||
source[99] = '\0';
|
||||
bulk[99] = '\0';
|
||||
char drain[MAX_STR_LEN], gate[MAX_STR_LEN], source[MAX_STR_LEN], bulk[MAX_STR_LEN];
|
||||
drain[MAX_STR_LEN-1] = '\0';
|
||||
gate[MAX_STR_LEN-1] = '\0';
|
||||
source[MAX_STR_LEN-1] = '\0';
|
||||
bulk[MAX_STR_LEN-1] = '\0';
|
||||
|
||||
if (!(*CellStackPtr)) {
|
||||
CellDef(fname, filenum);
|
||||
PushStack(fname, CellStackPtr);
|
||||
}
|
||||
strncpy(inst, nexttok + 1, 99); SpiceTokNoNewline();
|
||||
strncpy(inst, nexttok + 1, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(drain, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(drain, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(gate, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(gate, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(source, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(source, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
/* make sure all the nodes exist */
|
||||
if (LookupObject(drain, CurrentCell) == NULL) Node(drain);
|
||||
@@ -971,11 +971,11 @@ skip_ends:
|
||||
if (LookupObject(source, CurrentCell) == NULL) Node(source);
|
||||
|
||||
/* handle the substrate node */
|
||||
strncpy(bulk, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(bulk, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (LookupObject(bulk, CurrentCell) == NULL) Node(bulk);
|
||||
|
||||
/* Read the device model */
|
||||
snprintf(model, 99, "%s", nexttok);
|
||||
snprintf(model, MAX_STR_LEN-1, "%s", nexttok);
|
||||
|
||||
while (nexttok != NULL)
|
||||
{
|
||||
@@ -1013,7 +1013,7 @@ skip_ends:
|
||||
goto baddevice;
|
||||
}
|
||||
|
||||
snprintf(instname, 255, "%s:%s", model, inst);
|
||||
snprintf(instname, MAX_STR_LEN-1, "%s:%s", model, inst);
|
||||
Cell(instname, model, drain, gate, source, bulk);
|
||||
pobj = LinkProperties(model, kvlist);
|
||||
ReduceExpressions(pobj, NULL, CurrentCell, TRUE);
|
||||
@@ -1027,19 +1027,19 @@ skip_ends:
|
||||
SpiceSkipNewLine();
|
||||
}
|
||||
else {
|
||||
char ctop[100], cbot[100];
|
||||
ctop[99] = '\0';
|
||||
cbot[99] = '\0';
|
||||
char ctop[MAX_STR_LEN], cbot[MAX_STR_LEN];
|
||||
ctop[MAX_STR_LEN-1] = '\0';
|
||||
cbot[MAX_STR_LEN-1] = '\0';
|
||||
|
||||
if (!(*CellStackPtr)) {
|
||||
CellDef(fname, filenum);
|
||||
PushStack(fname, CellStackPtr);
|
||||
}
|
||||
strncpy(inst, nexttok + 1, 99); SpiceTokNoNewline();
|
||||
strncpy(inst, nexttok + 1, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(ctop, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(ctop, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(cbot, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(cbot, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
|
||||
/* make sure all the nodes exist */
|
||||
if (LookupObject(ctop, CurrentCell) == NULL) Node(ctop);
|
||||
@@ -1058,7 +1058,7 @@ skip_ends:
|
||||
|
||||
model[0] = '\0';
|
||||
if ((nexttok != NULL) && ((eqptr = strchr(nexttok, '=')) == NULL))
|
||||
snprintf(model, 99, "%s", nexttok);
|
||||
snprintf(model, MAX_STR_LEN-1, "%s", nexttok);
|
||||
|
||||
/* Any other device properties? */
|
||||
while (nexttok != NULL)
|
||||
@@ -1071,7 +1071,7 @@ skip_ends:
|
||||
}
|
||||
else if (!strncmp(nexttok, "$[", 2)) {
|
||||
// Support for CDL modeled capacitor format
|
||||
snprintf(model, 99, "%s", nexttok + 2);
|
||||
snprintf(model, MAX_STR_LEN-1, "%s", nexttok + 2);
|
||||
if ((eqptr = strchr(model, ']')) != NULL)
|
||||
*eqptr = '\0';
|
||||
}
|
||||
@@ -1104,7 +1104,7 @@ skip_ends:
|
||||
usemodel = 1;
|
||||
}
|
||||
|
||||
snprintf(instname, 255, "%s:%s", model, inst);
|
||||
snprintf(instname, MAX_STR_LEN-1, "%s:%s", model, inst);
|
||||
if (usemodel)
|
||||
Cell(instname, model, ctop, cbot);
|
||||
else
|
||||
@@ -1121,19 +1121,19 @@ skip_ends:
|
||||
SpiceSkipNewLine();
|
||||
}
|
||||
else {
|
||||
char rtop[100], rbot[100];
|
||||
rtop[99] = '\0';
|
||||
rbot[99] = '\0';
|
||||
char rtop[MAX_STR_LEN], rbot[MAX_STR_LEN];
|
||||
rtop[MAX_STR_LEN-1] = '\0';
|
||||
rbot[MAX_STR_LEN-1] = '\0';
|
||||
|
||||
if (!(*CellStackPtr)) {
|
||||
CellDef(fname, filenum);
|
||||
PushStack(fname, CellStackPtr);
|
||||
}
|
||||
strncpy(inst, nexttok + 1, 99); SpiceTokNoNewline();
|
||||
strncpy(inst, nexttok + 1, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(rtop, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(rtop, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(rbot, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(rbot, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
/* make sure all the nodes exist */
|
||||
if (LookupObject(rtop, CurrentCell) == NULL) Node(rtop);
|
||||
if (LookupObject(rbot, CurrentCell) == NULL) Node(rbot);
|
||||
@@ -1152,7 +1152,7 @@ skip_ends:
|
||||
|
||||
model[0] = '\0';
|
||||
if ((nexttok != NULL) && ((eqptr = strchr(nexttok, '=')) == NULL))
|
||||
snprintf(model, 99, "%s", nexttok);
|
||||
snprintf(model, MAX_STR_LEN-1, "%s", nexttok);
|
||||
|
||||
/* Any other device properties? */
|
||||
while (nexttok != NULL) {
|
||||
@@ -1164,7 +1164,7 @@ skip_ends:
|
||||
}
|
||||
else if (!strncmp(nexttok, "$[", 2)) {
|
||||
// Support for CDL modeled resistor format
|
||||
snprintf(model, 99, "%s", nexttok + 2);
|
||||
snprintf(model, MAX_STR_LEN-1, "%s", nexttok + 2);
|
||||
if ((eqptr = strchr(model, ']')) != NULL)
|
||||
*eqptr = '\0';
|
||||
}
|
||||
@@ -1197,7 +1197,7 @@ skip_ends:
|
||||
else
|
||||
strcpy(model, "r"); /* Use default resistor model */
|
||||
|
||||
snprintf(instname, 255, "%s:%s", model, inst);
|
||||
snprintf(instname, MAX_STR_LEN-1, "%s:%s", model, inst);
|
||||
if (usemodel)
|
||||
Cell(instname, model, rtop, rbot);
|
||||
else
|
||||
@@ -1208,25 +1208,25 @@ skip_ends:
|
||||
}
|
||||
}
|
||||
else if (toupper(nexttok[0]) == 'D') { /* diode */
|
||||
char cathode[100], anode[100];
|
||||
cathode[99] = '\0';
|
||||
anode[99] = '\0';
|
||||
char cathode[MAX_STR_LEN], anode[MAX_STR_LEN];
|
||||
cathode[MAX_STR_LEN-1] = '\0';
|
||||
anode[MAX_STR_LEN-1] = '\0';
|
||||
|
||||
if (!(*CellStackPtr)) {
|
||||
CellDef(fname, filenum);
|
||||
PushStack(fname, CellStackPtr);
|
||||
}
|
||||
strncpy(inst, nexttok + 1, 99); SpiceTokNoNewline();
|
||||
strncpy(inst, nexttok + 1, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(anode, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(anode, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(cathode, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(cathode, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
/* make sure all the nodes exist */
|
||||
if (LookupObject(anode, CurrentCell) == NULL) Node(anode);
|
||||
if (LookupObject(cathode, CurrentCell) == NULL) Node(cathode);
|
||||
|
||||
/* Read the device model */
|
||||
snprintf(model, 99, "%s", nexttok);
|
||||
snprintf(model, MAX_STR_LEN-1, "%s", nexttok);
|
||||
|
||||
while (nexttok != NULL)
|
||||
{
|
||||
@@ -1255,7 +1255,7 @@ skip_ends:
|
||||
Fprintf(stderr, "Device \"%s\" has wrong number of ports for a diode.\n");
|
||||
goto baddevice;
|
||||
}
|
||||
snprintf(instname, 255, "%s:%s", model, inst);
|
||||
snprintf(instname, MAX_STR_LEN-1, "%s:%s", model, inst);
|
||||
Cell(instname, model, anode, cathode);
|
||||
pobj = LinkProperties(model, kvlist);
|
||||
ReduceExpressions(pobj, NULL, CurrentCell, TRUE);
|
||||
@@ -1268,25 +1268,25 @@ skip_ends:
|
||||
SpiceSkipNewLine();
|
||||
}
|
||||
else {
|
||||
char node1[100], node2[100], node3[100], node4[100];
|
||||
node1[99] = '\0';
|
||||
node2[99] = '\0';
|
||||
node3[99] = '\0';
|
||||
node4[99] = '\0';
|
||||
char node1[MAX_STR_LEN], node2[MAX_STR_LEN], node3[MAX_STR_LEN], node4[MAX_STR_LEN];
|
||||
node1[MAX_STR_LEN-1] = '\0';
|
||||
node2[MAX_STR_LEN-1] = '\0';
|
||||
node3[MAX_STR_LEN-1] = '\0';
|
||||
node4[MAX_STR_LEN-1] = '\0';
|
||||
|
||||
if (!(*CellStackPtr)) {
|
||||
CellDef(fname, filenum);
|
||||
PushStack(fname, CellStackPtr);
|
||||
}
|
||||
strncpy(inst, nexttok + 1, 99); SpiceTokNoNewline();
|
||||
strncpy(inst, nexttok + 1, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(node1, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(node1, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(node2, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(node2, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(node3, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(node3, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(node4, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(node4, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
/* make sure all the nodes exist */
|
||||
if (LookupObject(node1, CurrentCell) == NULL) Node(node1);
|
||||
if (LookupObject(node2, CurrentCell) == NULL) Node(node2);
|
||||
@@ -1298,7 +1298,7 @@ skip_ends:
|
||||
|
||||
model[0] = '\0';
|
||||
if ((nexttok != NULL) && ((eqptr = strchr(nexttok, '=')) == NULL))
|
||||
snprintf(model, 99, "%s", nexttok);
|
||||
snprintf(model, MAX_STR_LEN-1, "%s", nexttok);
|
||||
|
||||
/* Any other device properties? */
|
||||
while (nexttok != NULL) {
|
||||
@@ -1334,7 +1334,7 @@ skip_ends:
|
||||
else
|
||||
strcpy(model, "t"); /* Use default xline model */
|
||||
|
||||
snprintf(instname, 255, "%s:%s", model, inst);
|
||||
snprintf(instname, MAX_STR_LEN-1, "%s:%s", model, inst);
|
||||
|
||||
if (usemodel)
|
||||
Cell(instname, model, node1, node2, node3, node4);
|
||||
@@ -1347,20 +1347,20 @@ skip_ends:
|
||||
}
|
||||
}
|
||||
else if (toupper(nexttok[0]) == 'L') { /* inductor */
|
||||
char end_a[100], end_b[100];
|
||||
char end_a[MAX_STR_LEN], end_b[MAX_STR_LEN];
|
||||
int usemodel = 0;
|
||||
end_a[99] = '\0';
|
||||
end_b[99] = '\0';
|
||||
end_a[MAX_STR_LEN-1] = '\0';
|
||||
end_b[MAX_STR_LEN-1] = '\0';
|
||||
|
||||
if (!(*CellStackPtr)) {
|
||||
CellDef(fname, filenum);
|
||||
PushStack(fname, CellStackPtr);
|
||||
}
|
||||
strncpy(inst, nexttok + 1, 99); SpiceTokNoNewline();
|
||||
strncpy(inst, nexttok + 1, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(end_a, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(end_a, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(end_b, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(end_b, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
/* make sure all the nodes exist */
|
||||
if (LookupObject(end_a, CurrentCell) == NULL) Node(end_a);
|
||||
if (LookupObject(end_b, CurrentCell) == NULL) Node(end_b);
|
||||
@@ -1379,7 +1379,7 @@ skip_ends:
|
||||
|
||||
model[0] = '\0';
|
||||
if ((nexttok != NULL) && ((eqptr = strchr(nexttok, '=')) == NULL))
|
||||
snprintf(model, 99, "%s", nexttok);
|
||||
snprintf(model, MAX_STR_LEN-1, "%s", nexttok);
|
||||
|
||||
/* Any other device properties? */
|
||||
while (nexttok != NULL)
|
||||
@@ -1417,7 +1417,7 @@ skip_ends:
|
||||
else
|
||||
strcpy(model, "l"); /* Use default inductor model */
|
||||
|
||||
snprintf(instname, 255, "%s:%s", model, inst);
|
||||
snprintf(instname, MAX_STR_LEN-1, "%s:%s", model, inst);
|
||||
if (usemodel)
|
||||
Cell(instname, model, end_a, end_b);
|
||||
else
|
||||
@@ -1431,19 +1431,19 @@ skip_ends:
|
||||
/* black-box subcircuits (class MODULE): V, I, E */
|
||||
|
||||
else if (toupper(nexttok[0]) == 'V') { /* voltage source */
|
||||
char pos[100], neg[100];
|
||||
pos[99] = '\0';
|
||||
neg[99] = '\0';
|
||||
char pos[MAX_STR_LEN], neg[MAX_STR_LEN];
|
||||
pos[MAX_STR_LEN-1] = '\0';
|
||||
neg[MAX_STR_LEN-1] = '\0';
|
||||
|
||||
if (!(*CellStackPtr)) {
|
||||
CellDef(fname, filenum);
|
||||
PushStack(fname, CellStackPtr);
|
||||
}
|
||||
strncpy(inst, nexttok + 1, 99); SpiceTokNoNewline();
|
||||
strncpy(inst, nexttok + 1, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(pos, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(pos, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(neg, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(neg, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
/* make sure all the nodes exist */
|
||||
if (LookupObject(pos, CurrentCell) == NULL) Node(pos);
|
||||
@@ -1499,19 +1499,19 @@ skip_ends:
|
||||
DeleteProperties(&kvlist);
|
||||
}
|
||||
else if (toupper(nexttok[0]) == 'I') { /* current source */
|
||||
char pos[100], neg[100];
|
||||
pos[99] = '\0';
|
||||
neg[99] = '\0';
|
||||
char pos[MAX_STR_LEN], neg[MAX_STR_LEN];
|
||||
pos[MAX_STR_LEN-1] = '\0';
|
||||
neg[MAX_STR_LEN-1] = '\0';
|
||||
|
||||
if (!(*CellStackPtr)) {
|
||||
CellDef(fname, filenum);
|
||||
PushStack(fname, CellStackPtr);
|
||||
}
|
||||
strncpy(inst, nexttok + 1, 99); SpiceTokNoNewline();
|
||||
strncpy(inst, nexttok + 1, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(pos, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(pos, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(neg, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(neg, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
/* make sure all the nodes exist */
|
||||
if (LookupObject(pos, CurrentCell) == NULL) Node(pos);
|
||||
if (LookupObject(neg, CurrentCell) == NULL) Node(neg);
|
||||
@@ -1553,25 +1553,25 @@ skip_ends:
|
||||
DeleteProperties(&kvlist);
|
||||
}
|
||||
else if (toupper(nexttok[0]) == 'E') { /* controlled voltage source */
|
||||
char pos[100], neg[100], ctrlp[100], ctrln[100];
|
||||
pos[99] = '\0';
|
||||
neg[99] = '\0';
|
||||
ctrlp[99] = '\0';
|
||||
ctrln[99] = '\0';
|
||||
char pos[MAX_STR_LEN], neg[MAX_STR_LEN], ctrlp[MAX_STR_LEN], ctrln[MAX_STR_LEN];
|
||||
pos[MAX_STR_LEN-1] = '\0';
|
||||
neg[MAX_STR_LEN-1] = '\0';
|
||||
ctrlp[MAX_STR_LEN-1] = '\0';
|
||||
ctrln[MAX_STR_LEN-1] = '\0';
|
||||
|
||||
if (!(*CellStackPtr)) {
|
||||
CellDef(fname, filenum);
|
||||
PushStack(fname, CellStackPtr);
|
||||
}
|
||||
strncpy(inst, nexttok + 1, 99); SpiceTokNoNewline();
|
||||
strncpy(inst, nexttok + 1, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(pos, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(pos, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(neg, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(neg, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(ctrlp, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(ctrlp, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
if (nexttok == NULL) goto baddevice;
|
||||
strncpy(ctrln, nexttok, 99); SpiceTokNoNewline();
|
||||
strncpy(ctrln, nexttok, MAX_STR_LEN-1); SpiceTokNoNewline();
|
||||
|
||||
/* make sure all the nodes exist */
|
||||
if (LookupObject(pos, CurrentCell) == NULL) Node(pos);
|
||||
@@ -1619,11 +1619,11 @@ skip_ends:
|
||||
}
|
||||
|
||||
else if (toupper(nexttok[0]) == 'X') { /* subcircuit instances */
|
||||
char instancename[100], subcktname[100];
|
||||
char instancename[MAX_STR_LEN], subcktname[MAX_STR_LEN];
|
||||
int itype, in_props;
|
||||
|
||||
instancename[99] = '\0';
|
||||
subcktname[99] = '\0';
|
||||
instancename[MAX_STR_LEN-1] = '\0';
|
||||
subcktname[MAX_STR_LEN-1] = '\0';
|
||||
|
||||
struct portelement {
|
||||
char *name;
|
||||
@@ -1633,8 +1633,8 @@ skip_ends:
|
||||
struct portelement *head, *tail, *scan, *scannext;
|
||||
struct objlist *obptr;
|
||||
|
||||
snprintf(instancename, 99, "%s", nexttok + 1);
|
||||
strncpy(instancename, nexttok + 1, 99);
|
||||
snprintf(instancename, MAX_STR_LEN-1, "%s", nexttok + 1);
|
||||
strncpy(instancename, nexttok + 1, MAX_STR_LEN-1);
|
||||
if (!(*CellStackPtr)) {
|
||||
CellDef(fname, filenum);
|
||||
PushStack(fname, CellStackPtr);
|
||||
@@ -1742,14 +1742,14 @@ skip_ends:
|
||||
/* names. */
|
||||
|
||||
if (strncmp(instancename, scan->name, strlen(scan->name))) {
|
||||
snprintf(subcktname, 99, "%s:%s", scan->name, instancename);
|
||||
snprintf(subcktname, MAX_STR_LEN-1, "%s:%s", scan->name, instancename);
|
||||
strcpy(instancename, subcktname);
|
||||
}
|
||||
else {
|
||||
snprintf(subcktname, 99, "/%s", instancename);
|
||||
snprintf(subcktname, MAX_STR_LEN-1, "/%s", instancename);
|
||||
strcpy(instancename, subcktname);
|
||||
}
|
||||
snprintf(subcktname, 99, "%s", scan->name);
|
||||
snprintf(subcktname, MAX_STR_LEN-1, "%s", scan->name);
|
||||
|
||||
if (scan == head) {
|
||||
head = NULL;
|
||||
@@ -1985,7 +1985,7 @@ void IncludeSpice(char *fname, int parent, struct cellstack **CellStackPtr,
|
||||
int blackbox)
|
||||
{
|
||||
int filenum = -1;
|
||||
char name[256];
|
||||
char name[MAX_STR_LEN];
|
||||
|
||||
/* If fname does not begin with "/", then assume that it is */
|
||||
/* in the same relative path as its parent. */
|
||||
|
||||
+21
-21
@@ -816,13 +816,13 @@ void ReadVerilogFile(char *fname, int filenum, struct cellstack **CellStackPtr,
|
||||
char devtype, in_module, in_param;
|
||||
char *eqptr, *matchptr;
|
||||
struct keyvalue *kvlist = NULL;
|
||||
char inst[256], model[256], instname[256], portname[256], pkey[256];
|
||||
char inst[MAX_STR_LEN], model[MAX_STR_LEN], instname[MAX_STR_LEN], portname[MAX_STR_LEN], pkey[MAX_STR_LEN];
|
||||
struct nlist *tp;
|
||||
struct objlist *parent, *sobj, *nobj, *lobj, *pobj;
|
||||
|
||||
inst[255] = '\0';
|
||||
model[255] = '\0';
|
||||
instname[255] = '\0';
|
||||
inst[MAX_STR_LEN-1] = '\0';
|
||||
model[MAX_STR_LEN-1] = '\0';
|
||||
instname[MAX_STR_LEN-1] = '\0';
|
||||
in_module = (char)0;
|
||||
in_param = (char)0;
|
||||
|
||||
@@ -947,7 +947,7 @@ void ReadVerilogFile(char *fname, int filenum, struct cellstack **CellStackPtr,
|
||||
|
||||
/* Check for existence of the cell. We may need to rename it. */
|
||||
|
||||
snprintf(model, 99, "%s", nexttok);
|
||||
snprintf(model, MAX_STR_LEN-1, "%s", nexttok);
|
||||
tp = LookupCellFile(nexttok, filenum);
|
||||
|
||||
/* Check for name conflict with duplicate cell names */
|
||||
@@ -1340,7 +1340,7 @@ skip_endmodule:
|
||||
}
|
||||
else if (match(nexttok, "wire") || match(nexttok, "assign")) { /* wire = node */
|
||||
struct bus wb, wb2, *nb;
|
||||
char nodename[128], noderoot[100];
|
||||
char nodename[MAX_STR_LEN], noderoot[MAX_STR_LEN];
|
||||
int is_wire = match(nexttok, "wire");
|
||||
int j;
|
||||
struct objlist *lhs, *rhs;
|
||||
@@ -1438,7 +1438,7 @@ skip_endmodule:
|
||||
// "assign" using any boolean arithmetic is not structural verilog.
|
||||
|
||||
if (nexttok && match(nexttok, "=")) {
|
||||
char assignname[128], assignroot[100];
|
||||
char assignname[MAX_STR_LEN], assignroot[MAX_STR_LEN];
|
||||
|
||||
i = wb.start;
|
||||
while (1) {
|
||||
@@ -1552,12 +1552,12 @@ skip_endmodule:
|
||||
goto skip_endmodule;
|
||||
}
|
||||
else { /* module instances */
|
||||
char instancename[100], modulename[100];
|
||||
char instancename[MAX_STR_LEN], modulename[MAX_STR_LEN];
|
||||
int itype, arraystart, arrayend, arraymax, arraymin;
|
||||
char ignore;
|
||||
|
||||
instancename[99] = '\0';
|
||||
modulename[99] = '\0';
|
||||
instancename[MAX_STR_LEN-1] = '\0';
|
||||
modulename[MAX_STR_LEN-1] = '\0';
|
||||
|
||||
struct portelement {
|
||||
char *name; // Name of port in subcell
|
||||
@@ -1570,7 +1570,7 @@ skip_endmodule:
|
||||
struct portelement *head, *tail, *scan, *last, *scannext;
|
||||
struct objlist *obptr;
|
||||
|
||||
strncpy(modulename, nexttok, 99);
|
||||
strncpy(modulename, nexttok, MAX_STR_LEN-1);
|
||||
|
||||
/* If module name is a verilog primitive, then treat the module as a */
|
||||
/* black box (this is not a complete list. Preferable to use hash */
|
||||
@@ -1648,7 +1648,7 @@ nextinst:
|
||||
}
|
||||
}
|
||||
|
||||
strncpy(instancename, nexttok, 99);
|
||||
strncpy(instancename, nexttok, MAX_STR_LEN-1);
|
||||
/* Printf("Diagnostic: new instance is %s\n", instancename); */
|
||||
SkipTokComments(VLOG_DELIMITERS);
|
||||
|
||||
@@ -1698,7 +1698,7 @@ nextinst:
|
||||
}
|
||||
SkipTokComments(VLOG_PIN_CHECK_DELIMITERS);
|
||||
if (match(nexttok, ")")) {
|
||||
char localnet[100];
|
||||
char localnet[MAX_STR_LEN];
|
||||
// Empty parens, so create a new local node
|
||||
savetok = (char)1;
|
||||
if (arraystart != -1) {
|
||||
@@ -1830,7 +1830,7 @@ nextinst:
|
||||
tp = LookupCellFile(modulename, filenum);
|
||||
if (tp == NULL) {
|
||||
struct bus wb, pb;
|
||||
char defport[128];
|
||||
char defport[MAX_STR_LEN];
|
||||
|
||||
Fprintf(stdout, "Creating placeholder cell definition for "
|
||||
"module %s.\n", modulename);
|
||||
@@ -1921,7 +1921,7 @@ nextinst:
|
||||
if (portstart != -1) {
|
||||
struct bus wb;
|
||||
struct portelement *new_port;
|
||||
char vname[256];
|
||||
char vname[MAX_STR_LEN];
|
||||
int j, result;
|
||||
struct objlist *bobj;
|
||||
char *bptr;
|
||||
@@ -2074,7 +2074,7 @@ nextinst:
|
||||
for (i = arraymin; i <= arraymax; i++) {
|
||||
char *brackptr;
|
||||
int j;
|
||||
char locinst[128];
|
||||
char locinst[MAX_STR_LEN];
|
||||
|
||||
if (i != -1)
|
||||
sprintf(locinst, "%s[%d]", instancename, i);
|
||||
@@ -2109,7 +2109,7 @@ nextinst:
|
||||
scan = scan->next;
|
||||
}
|
||||
if (scan == NULL) {
|
||||
char localnet[100];
|
||||
char localnet[MAX_STR_LEN];
|
||||
|
||||
/* Assume an implicit unconnected pin */
|
||||
sprintf(localnet, "_noconnect_%d_", localcount++);
|
||||
@@ -2129,7 +2129,7 @@ nextinst:
|
||||
if (arraystart == -1) {
|
||||
// Port may be an array
|
||||
int range;
|
||||
char pinname[128];
|
||||
char pinname[MAX_STR_LEN];
|
||||
|
||||
// Check if port is an array
|
||||
if (obpinidx == -1) {
|
||||
@@ -2154,7 +2154,7 @@ nextinst:
|
||||
}
|
||||
else {
|
||||
// Instance must be an array
|
||||
char netname[128];
|
||||
char netname[MAX_STR_LEN];
|
||||
int slice, portlen, siglen;
|
||||
|
||||
/* Get the array size of the port for bit slicing */
|
||||
@@ -2204,7 +2204,7 @@ nextinst:
|
||||
for (scan = head; scan; scan = scan->next) {
|
||||
if (!(scan->flags & PORT_FOUND)) {
|
||||
if (tp->flags & CELL_PLACEHOLDER) {
|
||||
char tempname[128];
|
||||
char tempname[MAX_STR_LEN];
|
||||
int maxnode;
|
||||
|
||||
/* This pin was probably implicit in the first call */
|
||||
@@ -2432,7 +2432,7 @@ void IncludeVerilog(char *fname, int parent, struct cellstack **CellStackPtr,
|
||||
int blackbox)
|
||||
{
|
||||
int filenum = -1;
|
||||
char name[256];
|
||||
char name[MAX_STR_LEN];
|
||||
|
||||
/* If fname does not begin with "/", then assume that it is */
|
||||
/* in the same relative path as its parent. */
|
||||
|
||||
+5
-5
@@ -65,10 +65,10 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
Widget toplevel = NULL;
|
||||
|
||||
char GlobalFileName[100],
|
||||
GlobalCellName[100],
|
||||
GlobalOtherName[100],
|
||||
GlobalDataName[100];
|
||||
char GlobalFileName[MAX_STR_LEN],
|
||||
GlobalCellName[MAX_STR_LEN],
|
||||
GlobalOtherName[MAX_STR_LEN],
|
||||
GlobalDataName[MAX_STR_LEN];
|
||||
|
||||
/*********************************************************
|
||||
* Menu structure: attaches label string to a function,
|
||||
@@ -1708,7 +1708,7 @@ void X_main_loop(int argc, char *argv[])
|
||||
|
||||
XmStringCharSet cs = "ISOLatin1";
|
||||
|
||||
static char prompt_response[100];
|
||||
static char prompt_response[MAX_STR_LEN];
|
||||
int prompt_done;
|
||||
int calling_editor; /* which string are we trying to get ? */
|
||||
#define FILE_NAME 1
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ void STRCPY(char *dest, char *source)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char cell1[200], cell2[200];
|
||||
char cell1[MAX_STR_LEN], cell2[MAX_STR_LEN];
|
||||
|
||||
Debug = 0;
|
||||
if (argc != 1) {
|
||||
|
||||
+2
-2
@@ -51,7 +51,7 @@ void STRCPY(char *dest, char *source)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifndef HAVE_GETOPT
|
||||
char cell1[200], cell2[200];
|
||||
char cell1[MAX_STR_LEN], cell2[MAX_STR_LEN];
|
||||
int filenum = -1;
|
||||
|
||||
Debug = 0;
|
||||
@@ -67,7 +67,7 @@ int main(int argc, char *argv[])
|
||||
STRCPY(cell2, ReadNetlist(argv[2], &filenum));
|
||||
if (argc == 5) STRCPY(cell2, argv[4]); /* if explicit cell name specified */
|
||||
#else
|
||||
char cell1[200], cell2[200];
|
||||
char cell1[MAX_STR_LEN], cell2[MAX_STR_LEN];
|
||||
int usage = 0;
|
||||
int args;
|
||||
int c;
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ void STRCPY(char *dest, char *source)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char cellname[200];
|
||||
char cellname[MAX_STR_LEN];
|
||||
int filenum = -1;
|
||||
|
||||
Debug = 0;
|
||||
|
||||
+2
-2
@@ -62,7 +62,7 @@ proc netgen::convert_to_json {filename lvs_final} {
|
||||
puts $fjson " \["
|
||||
set cktval [lindex $value 0]
|
||||
foreach pin [lrange $cktval 0 end-1] {
|
||||
set pinstr [string map {"\\" "\\\\"} $pin]
|
||||
set pinstr [string map {"\\" "\\\\"} $pin]
|
||||
puts $fjson " \"$pinstr\","
|
||||
}
|
||||
set pin [string map {"\\" "\\\\"} [lindex $cktval end]]
|
||||
@@ -70,7 +70,7 @@ proc netgen::convert_to_json {filename lvs_final} {
|
||||
puts $fjson " \], \["
|
||||
set cktval [lindex $value 1]
|
||||
foreach pin [lrange $cktval 0 end-1] {
|
||||
set pinstr [string map {"\\" "\\\\"} $pin]
|
||||
set pinstr [string map {"\\" "\\\\"} $pin]
|
||||
puts $fjson " \"$pinstr\","
|
||||
}
|
||||
set pin [string map {"\\" "\\\\"} [lindex $cktval end]]
|
||||
|
||||
Reference in New Issue
Block a user