annotate ueda/sverp-bind/main.c @ 20:dda8e455c863

unet-bind works to the point of reporting unbound instances
author Space Falcon <falcon@ivan.Harhan.ORG>
date Sun, 02 Aug 2015 03:23:44 +0000
parents 1d4c693b8f35
children f7b09a54c2ce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
1 #include <stdio.h>
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
2 #include <stdlib.h>
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
3 #include <string.h>
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
4 #include <strings.h>
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
5 #include <unistd.h>
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
6
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
7 extern char *MCLfile;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
8
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
9 char *input_filename, *output_filename;
16
65a515c20db8 unet-bind: starpoint entry implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
10 char *starpoints_file;
19
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 16
diff changeset
11 int check_completeness, unbound_instances;
12
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
12
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
13 static void
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
14 usage()
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
15 {
16
65a515c20db8 unet-bind: starpoint entry implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
16 fprintf(stderr,
65a515c20db8 unet-bind: starpoint entry implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
17 "usage: unet-bind [options] input.unet [output.unet]\n");
12
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
18 exit(1);
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
19 }
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
20
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
21 static void
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
22 process_options(argc, argv)
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
23 char **argv;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
24 {
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
25 extern char *optarg;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
26 register int c;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
27
16
65a515c20db8 unet-bind: starpoint entry implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
28 while ((c = getopt(argc, argv, "cI:M:s:")) != EOF) {
12
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
29 switch (c) {
15
c59f52e4bacf unet-bind option -c reports MCL components with no binding
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 12
diff changeset
30 case 'c':
c59f52e4bacf unet-bind option -c reports MCL components with no binding
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 12
diff changeset
31 check_completeness++;
16
65a515c20db8 unet-bind: starpoint entry implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
32 continue;
12
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
33 case 'I':
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
34 add_symfile_dir(optarg);
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
35 continue;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
36 case 'M':
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
37 MCLfile = optarg;
16
65a515c20db8 unet-bind: starpoint entry implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
38 continue;
65a515c20db8 unet-bind: starpoint entry implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
39 case 's':
65a515c20db8 unet-bind: starpoint entry implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
40 starpoints_file = optarg;
65a515c20db8 unet-bind: starpoint entry implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
41 continue;
12
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
42 default:
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
43 usage();
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
44 }
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
45 }
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
46 }
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
47
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
48 main(argc, argv)
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
49 char **argv;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
50 {
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
51 extern int optind;
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
52
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
53 process_options(argc, argv);
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
54 if (argc < optind + 1 || argc > optind + 2)
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
55 usage();
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
56 input_filename = argv[optind];
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
57 output_filename = argv[optind+1];
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
58
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
59 /* process all inputs from the MCL */
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
60 read_MCL();
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
61 set_default_sympath();
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
62 read_pinouts();
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
63 init_outcomp_from_MCL();
16
65a515c20db8 unet-bind: starpoint entry implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
64 /* do we have any star points? */
65a515c20db8 unet-bind: starpoint entry implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
65 if (starpoints_file)
65a515c20db8 unet-bind: starpoint entry implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
66 process_starpoints_file();
19
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 16
diff changeset
67 /* read the netlist from sverp */
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 16
diff changeset
68 process_input_unet();
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 16
diff changeset
69 if (unbound_instances) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 16
diff changeset
70 fprintf(stderr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 16
diff changeset
71 "error: %s input contains unbound instances, aborting\n",
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 16
diff changeset
72 input_filename);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 16
diff changeset
73 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 16
diff changeset
74 }
16
65a515c20db8 unet-bind: starpoint entry implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
75
12
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
76 /* remaining functionality remains to be implemented */
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
77 exit(0);
51893347bc42 unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
78 }