diff ueda/uschem-netlist/pinlist.c @ 0:cd92449fdb51

initial import of ueda and ifctf-part-lib from ifctfvax CVS
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 20 Jul 2015 00:24:37 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ueda/uschem-netlist/pinlist.c	Mon Jul 20 00:24:37 2015 +0000
@@ -0,0 +1,86 @@
+/*
+ * Informal pin list output
+ */
+
+#include <stdio.h>
+#include "../libueda/mcl.h"
+#include "netlist.h"
+
+extern struct nlcomp *netlist_comps;
+extern int ncomponents;
+
+extern FILE *outfile;
+
+static
+list_pins_tab(comp)
+	struct nlcomp *comp;
+{
+	register struct pinconn **ppc, *pc;
+	register struct net *n;
+	int i, npins;
+
+	npins = comp->npins;
+	for (ppc = comp->pintab, i = 1; i <= npins; ppc++, i++) {
+		if (pc = *ppc) {
+			n = pc->net;
+			if (n->netname)
+				fprintf(outfile, "\tPin %d = %s (%s line %d)\n",
+					i, n->netname, pc->origin_file,
+					pc->origin_line);
+			else
+				fprintf(outfile,
+					"\tPin %d = unnamed net (%s line %d)\n",
+					i, pc->origin_file, pc->origin_line);
+		} else
+			fprintf(outfile, "\tPin %d left unconnected\n", i);
+	}
+}
+
+static
+list_pins_chain(comp)
+	struct nlcomp *comp;
+{
+	register struct pinconn *pc;
+	register struct net *n;
+
+	for (pc = comp->pinchain; pc; pc = pc->next_in_comp) {
+		n = pc->net;
+		if (n->netname)
+			fprintf(outfile, "\tPin %s = %s (%s line %d)\n",
+				pc->pinnum, n->netname, pc->origin_file,
+				pc->origin_line);
+		else
+			fprintf(outfile,
+				"\tPin %s = unnamed net (%s line %d)\n",
+				pc->pinnum, pc->origin_file, pc->origin_line);
+	}
+}
+
+pinlist_output()
+{
+	register struct nlcomp *comp;
+	register int i;
+
+	open_output_file();
+	for (comp = netlist_comps, i = 0; i < ncomponents; comp++, i++) {
+		fprintf(outfile, "%s:\n", comp->mclcomp->name);
+		if (!comp->nconnects)
+			fputs("\tNo connections\n", outfile);
+		else if (comp->pintab)
+			list_pins_tab(comp);
+		else
+			list_pins_chain(comp);
+	}
+}
+
+check_for_unused_comps()
+{
+	register struct nlcomp *comp;
+	register int i;
+
+	for (comp = netlist_comps, i = 0; i < ncomponents; comp++, i++)
+		if (!comp->nconnects)
+			fprintf(stderr,
+				"Warning: component %s has no connections\n",
+				comp->mclcomp->name);
+}