Initial version of donated sources by Avertec, 3.4p5.
[tas-yagle.git] / distrib / sources / beh / bhl / beh_indexbdd.c
1
2 /* ###--------------------------------------------------------------### */
3 /* file : beh_indexbdd.c */
4 /* date : Aug 28 1997 */
5 /* version : v110 */
6 /* authors : Pirouz BAZARGAN SABET */
7 /* description : high level function */
8 /* ###--------------------------------------------------------------### */
9
10 #include <stdio.h>
11 #include "bhl_lib.h"
12
13 /* ###--------------------------------------------------------------### */
14 /* function : beh_indexbdd */
15 /* description : initilize the index table for bdd */
16 /* called func. : initializeCct, addInputCct */
17 /* ###--------------------------------------------------------------### */
18
19 void beh_indexbdd (befig_list *pt_fig)
20
21 {
22 struct berin *pt_rin = NULL;
23 struct beout *pt_out = NULL;
24 struct bebus *pt_bus = NULL;
25 struct beaux *pt_aux = NULL;
26 struct bebux *pt_bux = NULL;
27 struct bereg *pt_reg = NULL;
28 struct bemsg *pt_msg = NULL;
29 struct biabl *pt_bia = NULL;
30 unsigned int cnt_in = 0 ;
31 unsigned int cnt_out = 0 ;
32
33 if ((pt_fig != NULL) && (pt_fig->CIRCUI == NULL))
34 {
35 /* ###--------------------------------------------------------### */
36 /* count inputs */
37 /* ###--------------------------------------------------------### */
38
39 pt_rin = pt_fig->BERIN;
40 while (pt_rin != NULL)
41 {
42 cnt_in ++;
43 pt_rin = pt_rin->NEXT;
44 }
45
46 /* ###--------------------------------------------------------### */
47 /* count outputs */
48 /* ###--------------------------------------------------------### */
49
50 pt_out = pt_fig->BEOUT;
51 while (pt_out != NULL)
52 {
53 cnt_out ++;
54 pt_out = pt_out->NEXT;
55 }
56
57 pt_bus = pt_fig->BEBUS;
58 while (pt_bus != NULL)
59 {
60 pt_bia = pt_bus->BIABL;
61 while (pt_bia != NULL)
62 {
63 cnt_out += 2;
64 pt_bia = pt_bia->NEXT;
65 }
66 pt_bus = pt_bus->NEXT;
67 }
68
69 pt_aux = pt_fig->BEAUX;
70 while (pt_aux != NULL)
71 {
72 cnt_out ++;
73 pt_aux = pt_aux->NEXT;
74 }
75
76 pt_aux = pt_fig->BEDLY;
77 while (pt_aux != NULL)
78 {
79 cnt_out ++;
80 pt_aux = pt_aux->NEXT;
81 }
82
83 pt_bux = pt_fig->BEBUX;
84 while (pt_bux != NULL)
85 {
86 pt_bia = pt_bux->BIABL;
87 while (pt_bia != NULL)
88 {
89 cnt_out += 2;
90 pt_bia = pt_bia->NEXT;
91 }
92 pt_bux = pt_bux->NEXT;
93 }
94
95 pt_reg = pt_fig->BEREG;
96 while (pt_reg != NULL)
97 {
98 pt_bia = pt_reg->BIABL;
99 while (pt_bia != NULL)
100 {
101 cnt_out += 2;
102 pt_bia = pt_bia->NEXT;
103 }
104 pt_reg = pt_reg->NEXT;
105 }
106
107 pt_msg = pt_fig->BEMSG;
108 while (pt_msg != NULL)
109 {
110 cnt_out ++;
111 pt_msg = pt_msg->NEXT;
112 }
113
114 /* ###--------------------------------------------------------### */
115 /* initialization */
116 /* ###--------------------------------------------------------### */
117
118 pt_fig->CIRCUI = initializeCct (pt_fig->NAME, cnt_in*2, cnt_out);
119
120 /* ###--------------------------------------------------------### */
121 /* define an index for each primary signal */
122 /* ###--------------------------------------------------------### */
123
124 pt_rin = pt_fig->BERIN;
125 while (pt_rin != NULL)
126 {
127 addInputCct (pt_fig->CIRCUI, pt_rin->NAME);
128 pt_rin = pt_rin->NEXT;
129 }
130 }
131 }