/* * icxref.ulp * * This Eagle User Language Program will create an HTML * cross-reference among the various entities on a board. * It should be run from a board context, or it will do * nothing. Output will be a series of .html files in your default * design directory; the file .html is the * top level document. Your board file should be in your * default design directory. You also must have the * schematic for the board open in another window. * * You may want to edit the list of common signals, * see below. * * This program is in the public domain. * This program is provided with NO WARRANTY whatsoever. * * Bob Drzyzgula, 10/30/00 * * Version 0.95, Bob D., 11/6/00 * * Added a signal map page; This page contains all * a record for every contact on every device your * board, sorted into groups by connected signal * and by entity/contact within these groups. * Signal references in the device pages now are * hyperlinked to the signal group on the signal * map page. This page can be pretty large and * can take a while to load. * * Version 0.9, Bob D., 11/3/00 * * Added the sheet number, pin function and * pin direction to the cross-reference tables * * Changed some appearance and heading defaults * * Change the default to *not* print the entity * text dumps. * * Version 0.6, Bob D., 11/2/00 * * Added chip-to-chip navigation links. * * Added summary file for unconnected and * singly-connected pins. * * Added switch to control printing of * entity text dumps. Set printtexts=0 if * you don't want them printed, any other * value if you do. * * Parameterized many of the appearance settings; * these are now set at the top of the program, * where they are easy to change. * * Added boilerplate footers. * * Changed the horrid default colors to another * horrid set of default colors. * * Cleaned up some of the filenames, to make * them more consistant and sensible. * * Changed a few other deafult settings. * * Version 0.5, Bob D., 11/1/00 * Fixed bug where pin-to-pin connections on the same * IC would not be reported in cross reference. * * Comments and suggestions, email bob@frb.gov * */ /* * Please don't change the following setting unless you * want to create a new version. If you do so, please * prefix the version with something besides that hopefully * that will give an indication of who made the new version. */ string icxrefver = "0.95"; /* * User settings follow... */ /* * Some signals are probably connected to very many * parts, and the cross-reference listing for those * will be too big to list at every connection. For * these signals, just list their names in the * string array comsigs[] below. The cross-reference * will be expanded only on the first reference; * later references will be hyperlinked back to the * first. * */ /* * First, the list of common signals */ string comsigs[] = {"VCC", "VSS"}; /* * Do you want the entity texts dumped? * 0 = no, anything else = yes. */ int printtexts = 0; /* * You can get rid of my horrid color choices here. */ string bodyopts = "BGCOLOR=\"#CC99CC\" TEXT=\"#191970\" VLINK= \"CC0099\" LINK=\"0000FF\""; /* * What color would you like the warning font? */ string warnopt = "COLOR=\"red\""; /* * You can tweak the tables here: */ string tableopts = "BORDER=\"1\" BGCOLOR=\"#CCCCFF\" CELLSPACING=\"1\" CELLPADDING=\"1\""; void printfoot() { printf("
Automatically generated by the Eagle User\n"); printf(" Language Program icxref.ulp.\n"); printf(" icxref was written by\n"); printf(" Bob Drzyzgula, <bob@frb.gov>\n"); printf(" and released to the public domain.\n"); printf(" This is icxref version %s, last modified by\n", icxrefver); /* * NB: If you create a new version of icxref, please change the * following few lines. */ /* * Put your name in the following line */ printf(" Bob Drzyzgula"); printf(" , <"); /* * Again, your email address in here */ printf("bob@frb.gov"); printf("> on "); /* * You can use your system's date command to fill in the next line */ printf("Nov 3, 2000"); printf(".\n Script run at %s within %s\n", t2string(time()), EAGLE_SIGNATURE); printf("
\n"); /* * End of release data */ /* * Close out the html file and return. */ printf("\n\n"); return; } /* * * you shouldn't have to change anything below this line, * but then, what do I know? * */ void printtabhd() { printf("\n", tableopts); printf("\t\n"); printf("\t\t\n"); printf("\t\t\n"); printf("\t\t\n"); printf("\t\t\n"); printf("\t\t\n"); printf("\t\t\n"); printf("\t\t\n"); printf("\t\n"); } if (board) board(B) { int i,j,k; int donesigs[] = {0, 0}; int doxref, numels=0, elcnt=0, numnocon=0, numonecon=0; int numsigs=0, numpins=0; numeric string pinsig[], cont[], ent[]; string commsgs[], pinrec[]; string elnext[], elprev[]; string nocon[], onecon[]; string sfn, linksf, linknm, tempstring, printstring, printstart, topfile, sigmap; string pss, tss; string lastuc=""; string lastoc=""; string dirmap[],fnmap[]; dirmap[PIN_DIRECTION_NC] = "NC"; dirmap[PIN_DIRECTION_IN] = "In"; dirmap[PIN_DIRECTION_OUT] = "Out"; dirmap[PIN_DIRECTION_IO] = "IO"; dirmap[PIN_DIRECTION_OC] = "OC"; dirmap[PIN_DIRECTION_PWR] = "PWR"; dirmap[PIN_DIRECTION_PAS] = "PAS"; dirmap[PIN_DIRECTION_HIZ] = "HIZ"; dirmap[PIN_DIRECTION_SUP] = "SUP"; fnmap[PIN_FUNCTION_FLAG_NONE] = "None"; fnmap[PIN_FUNCTION_FLAG_DOT] = "DOT"; fnmap[PIN_FUNCTION_FLAG_CLK] = "CLK"; topfile=filesetext(filename(B.name),".html"); sprintf(sfn,"S%s",topfile); sprintf(sigmap,"N%s",topfile); sprintf(linksf,"

Unconnected/Singly-connected summary file

\n",sfn); sprintf(linknm,"

Net map overview file

\n",sigmap); output(topfile) { string fn; printf("\n\n", bodyopts); printf("

Signal connection cross-reference for %s

\n",B.name); printf("%s",linksf); printf("%s",linknm); printf("\n"); printf("%s",linksf); printf("%s",linknm); printfoot(); } B.elements(E) { string fn; sprintf(fn,"E%sB%s",E.name,topfile); output(fn) { string rn; printf("\n\n", bodyopts); printf("

%s

\n",E.name); printf("

Back to Top

\n",topfile); printf("%s",elprev[elcnt]); printf("%s",elnext[elcnt]); printf("%s",linksf); printf("%s",linknm); printf("
ContactPinSignalSheet, GateFunct, DirectionDevice
\n", tableopts); printf("\t\n"); printf("\t\t\n"); printf("\t\t\n",E.name); printf("\t\n"); printf("\t\n"); printf("\t\t\n"); printf("\t\t\n",E.value); printf("\t\n"); printf("\t\n"); printf("\t\t\n"); printf("\t\t\n",E.package.name); printf("\t\n"); printf("\t\n"); printf("\t\t\n"); printf("\t\t\n",E.package.library); printf("\t\n"); printf("
Entity Name%s
Entity Value%s
Package Name%s
Library Name%s
\n"); if (printtexts) { printf("

Entity Texts

\n"); printf("\n"); printf("

Package Texts

\n"); printf("\n"); printf("

Part Texts

\n"); printf("\n"); } printf("

Cross Reference

"); printtabhd(); E.package.contacts(C) { string pinname; string gatename; int funct, direct, sheetnum; project.schematic(SCH) { SCH.parts(PART) { if (PART.name == E.name) { if (PART.device.package) { PART.instances(IN) { IN.gate.symbol.pins(PIN) { if (PIN.contact.name == C.name) { pinname = PIN.name; funct = PIN.function; direct = PIN.direction; gatename = IN.gate.name; sheetnum = IN.sheet; } } } } } } } if (C.signal != "") { doxref = 1; sprintf(printstart,"\t\n\t\t*\n",C.name); sprintf(printstring,"\t\t%s\n",C.name); sprintf(tempstring,"\t\t%s\n", pinname); printstring += tempstring; sprintf(tss,"\t\t%s\n", C.signal); sprintf(tempstring,"\t\t%s\n",topfile, C.signal, C.signal); pss = printstring + tss; printstring += tempstring; sprintf(tempstring,"\t\t%2d, %s\n", sheetnum, gatename); pss += tempstring; printstring += tempstring; sprintf(tempstring,"\t\t%s, %s\n", fnmap[funct], dirmap[direct]); pss += tempstring; printstring += tempstring; sprintf(tempstring,"\t\t%s-%s\n", E.name, E.value); pss += tempstring; printstring += tempstring; pss += "\t\n"; printstring += "\t\n"; printf("%s%s",printstart,printstring); i = 0; do { if (C.signal == comsigs[i]) { if (donesigs[i] == 1) { printf("%s",commsgs[i]); doxref = 0; } else { donesigs[i] = 1; doxref = 1; sprintf(commsgs[i], "\t For %s xref see %s contact %s\n", comsigs[i], fn, C.name, E.name, C.name); } } } while (comsigs[i++]); sprintf(printstart,"\t\n\t\t*\n", fn, C.name); pinrec[numpins] = printstart + pss; ent[numpins] = E.name; cont[numpins] = C.name; pinsig[numpins++] = C.signal; } else { sprintf(printstart,"\t\n\t\t*\n",C.name); sprintf(printstring,"\t\t%s\n",C.name); sprintf(tempstring,"\t\t%s\n", pinname); printstring += tempstring; sprintf(tss,"\t\tNot connected!\n", warnopt); sprintf(tempstring,"\t\tNot connected!*\n", warnopt, topfile); pss = printstring + tss; printstring += tempstring; sprintf(tempstring,"\t\t%2d, %s\n", sheetnum, gatename); pss += tempstring; printstring += tempstring; sprintf(tempstring,"\t\t%s, %s\n", fnmap[funct], dirmap[direct]); pss += tempstring; printstring += tempstring; sprintf(tempstring,"\t\t%s-%s\n",E.name, E.value); pss += tempstring; printstring += tempstring; pss += "\t\n"; printstring += "\t\n"; printf("%s%s",printstart,printstring); tempstring = ""; if (E.name != lastuc) { sprintf(tempstring, "\t\n\t\t \n\t\t" + "In entity %s\n\t\n", fn, E.name); lastuc = E.name; } sprintf(printstart,"\t\n\t\t*\n", fn, C.name); nocon[numnocon++] = tempstring + printstart + printstring; pinrec[numpins] = printstart + pss; ent[numpins] = E.name; cont[numpins] = C.name; pinsig[numpins++] = "Unconnected"; doxref = 0; } if (doxref == 1) { B.signals(S) { if (C.signal == S.name) { int numels=0; int index[]; numeric string elnames[], elvals[], conames[]; S.contactrefs(CR) { if (CR.element.name != E.name) { elvals[numels] = CR.element.value; elnames[numels] = CR.element.name; conames[numels] = CR.contact.name; numels++; } else { if (CR.contact.name != C.name) { elvals[numels] = CR.element.value; elnames[numels] = CR.element.name; conames[numels] = CR.contact.name; numels++; } } } if (numels > 0) { j = 1; sort(numels,index,elnames); for (k = 0; k < numels; k++) { if (j == 1) { printf("\t\n\t\t\n"); } sprintf(rn,"E%sB%s",elnames[index[k]],topfile); printf("\t\t%s, %s pin %s\n", elvals[index[k]], rn, elnames[index[k]], rn, conames[index[k]], conames[index[k]]); if (j == 6) { printf("\t\n"); j = 1; } else { j++; } } printf("\t\n"); } else { printf("\t\n"); printf("\t\t \n"); printf("\t\tNo other net connections!\n", warnopt); printf("\t\n"); tempstring = ""; if (E.name != lastoc) { sprintf(tempstring, "\t\n\t\t \n\t\t" + "In entity %s\n\t\n", fn, E.name); lastoc = E.name; } sprintf(printstart, "\t\n\t\t*\n", fn, C.name); onecon[numonecon++] = tempstring + printstart + printstring; doxref = 0; } } } } } printf("\n"); printf("

Back to Top

\n",topfile); printf("%s",elprev[elcnt]); printf("%s",elnext[elcnt]); printf("%s",linksf); printf("%s",linknm); printfoot(); elcnt++; } } output(sfn) { printf("\n\n", bodyopts); printf("

Summary of unconnected pins and pins on a net with no other connections

\n"); if (numnocon > 0) { printf("

Back to Top

\n",topfile); printf("%s",linknm); printf("

Unconnected Pins

\n"); printtabhd(); for (i=0; i\n"); } else { printf("

No unconnected pins

\n"); } if (numonecon > 0) { printf("

Pins on nets with no other connections

\n"); printtabhd(); for (i=0; i\n"); } else { printf("

No singly-connected nets

\n"); } printf("%s",linknm); printf("

Back to Top

\n",topfile); printfoot(); } output(sigmap) { int pindex[]; string lastsig=""; printf("\n\n", bodyopts); printf("

Network Map Overview

\n"); printf("

Back to Top

\n",topfile); printf("%s",linksf); sort(numpins,pindex,pinsig,ent,cont); printf("\n", tableopts); for (k = 0; k < numpins; k++) { if(pinsig[pindex[k]] != lastsig) { if (k != 0) { printf("\t\n"); printf("\t\n"); } printf("\t\n"); printf("\t\n", pinsig[pindex[k]], pinsig[pindex[k]]); printf("\t\n"); printf("\t\n"); printf("\t\t\n"); printf("\t\t\n"); printf("\t\t\n"); printf("\t\t\n"); printf("\t\t\n"); printf("\t\t\n"); printf("\t\t\n"); printf("\t\n"); lastsig=pinsig[pindex[k]]; } printf("%s",pinrec[pindex[k]]); } printf("
Signal %s
ContactPinSignalSheet, GateFunct, DirectionDevice
\n"); printf("%s",linksf); printf("

Back to Top

\n",topfile); printfoot(); } }