FreeCalypso > hg > ueda-linux
annotate ueda/sverp-bind/outcomp.c @ 52:727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Sun, 31 Jan 2016 01:26:11 +0000 |
parents | c59f52e4bacf |
children |
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 "../libueda/mcl.h" |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 #include "../libueda/xga.h" |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 #include "struct.h" |
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 extern struct component components[]; |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 extern int ncomponents; |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 extern char *get_comp_attr(); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 extern struct grid_pkg_desc *read_grid_pkg_file(); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 |
15
c59f52e4bacf
unet-bind option -c reports MCL components with no binding
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
14
diff
changeset
|
15 extern int check_completeness; |
c59f52e4bacf
unet-bind option -c reports MCL components with no binding
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
14
diff
changeset
|
16 |
12
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 struct outcomp *netlist_comps; |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 static int |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 try_numpins(oc) |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 register struct outcomp *oc; |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 { |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 char *npins_attr; |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 register int n; |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 npins_attr = get_comp_attr(oc->mclcomp, "npins"); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 if (!npins_attr) |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 return(0); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 n = atoi(npins_attr); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 if (n <= 0) { |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 fprintf(stderr, "component %s: invalid npins attribute\n", |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 oc->name); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 exit(1); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 } |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 oc->npins = n; |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 return(1); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 } |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 static int |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 try_gridpkg(oc) |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 register struct outcomp *oc; |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 { |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 char *attr; |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 register struct grid_pkg_desc *desc; |
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 attr = get_comp_attr(oc->mclcomp, "grid_pkg"); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 if (!attr) |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 return(0); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 desc = read_grid_pkg_file(attr); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 oc->grid_pkg = desc; |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 oc->npins = desc->nrows * desc->ncolumns; |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 return(1); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 } |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 static void |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 init_one_outcomp(oc) |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 register struct outcomp *oc; |
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 register struct pinconn **conn_array; |
14
068ea2458c5d
unet-bind: instance entry implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
12
diff
changeset
|
60 register char *attr; |
12
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 oc->name = oc->mclcomp->name; |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 try_numpins(oc); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 if (!oc->npins) |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 try_gridpkg(oc); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 if (!oc->npins) { |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 fprintf(stderr, |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 "error: %s has neither npins nor grid_pkg attribute\n", |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 oc->name); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 exit(1); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 } |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 conn_array = (struct pinconn **) malloc(sizeof(struct pinconn *) * |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 oc->npins); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 if (!conn_array) { |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 perror("malloc"); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 exit(1); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 } |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 bzero(conn_array, sizeof(struct pinconn *) * oc->npins); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 oc->conn_array = conn_array; |
14
068ea2458c5d
unet-bind: instance entry implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
12
diff
changeset
|
80 if (attr = get_comp_attr(oc->mclcomp, "hier")) |
068ea2458c5d
unet-bind: instance entry implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
12
diff
changeset
|
81 process_hier_attr(oc, attr); |
068ea2458c5d
unet-bind: instance entry implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
12
diff
changeset
|
82 else if (attr = get_comp_attr(oc->mclcomp, "slotmap")) |
068ea2458c5d
unet-bind: instance entry implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
12
diff
changeset
|
83 process_slotmap_attr(oc, attr); |
15
c59f52e4bacf
unet-bind option -c reports MCL components with no binding
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
14
diff
changeset
|
84 else if (check_completeness) |
c59f52e4bacf
unet-bind option -c reports MCL components with no binding
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
14
diff
changeset
|
85 fprintf(stderr, "MCL component %s has no binding\n", oc->name); |
12
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 } |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 init_outcomp_from_MCL() |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 { |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 register int i; |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 netlist_comps = (struct outcomp *) |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
93 malloc(sizeof(struct outcomp) * ncomponents); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 if (!netlist_comps) { |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 perror("malloc"); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 exit(1); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 } |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 bzero(netlist_comps, sizeof(struct outcomp) * ncomponents); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 for (i = 0; i < ncomponents; i++) { |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 netlist_comps[i].mclcomp = components + i; |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 init_one_outcomp(netlist_comps + i); |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 } |
51893347bc42
unet-bind implementation started
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 } |