view ueda/sverp-bind/main.c @ 22:c7ebd6179f5d

ueda-bind: output implemented
author Space Falcon <falcon@ivan.Harhan.ORG>
date Sun, 02 Aug 2015 07:21:06 +0000
parents f7b09a54c2ce
children 61272ee5aadc
line wrap: on
line source

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>

extern char *MCLfile;

char *input_filename, *output_filename;
char *starpoints_file;
int check_completeness, unbound_instances;

static void
usage()
{
	fprintf(stderr,
		"usage: unet-bind [options] input.unet [output.unet]\n");
	exit(1);
}

static void
process_options(argc, argv)
	char **argv;
{
	extern char *optarg;
	register int c;

	while ((c = getopt(argc, argv, "cI:M:s:")) != EOF) {
		switch (c) {
		case 'c':
			check_completeness++;
			continue;
		case 'I':
			add_symfile_dir(optarg);
			continue;
		case 'M':
			MCLfile = optarg;
			continue;
		case 's':
			starpoints_file = optarg;
			continue;
		default:
			usage();
		}
	}
}

main(argc, argv)
	char **argv;
{
	extern int optind;

	process_options(argc, argv);
	if (argc < optind + 1 || argc > optind + 2)
		usage();
	input_filename = argv[optind];
	output_filename = argv[optind+1];

	/* process all inputs from the MCL */
	read_MCL();
	set_default_sympath();
	read_pinouts();
	init_outcomp_from_MCL();
	/* do we have any star points? */
	if (starpoints_file)
		process_starpoints_file();
	/* read the netlist from sverp */
	process_input_unet();
	if (unbound_instances) {
		fprintf(stderr,
		"error: %s input contains unbound instances, aborting\n",
			input_filename);
		exit(1);
	}
	check_unclaimed_instances();
	generate_output();
	exit(0);
}