view ueda/uschem-netlist/pinlist.c @ 13:1f3283f8e482

unet-bind: instance hash implemented
author Space Falcon <falcon@ivan.Harhan.ORG>
date Sun, 02 Aug 2015 00:00:15 +0000
parents cd92449fdb51
children
line wrap: on
line source

/*
 * 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);
}