1 /*------------------------------------------------------------\
2 |                                                             |
3 | This file is part of the Alliance CAD System Copyright      |
4 | (C) Laboratoire LIP6 - D�partement ASIM Universite P&M Curie|
5 |                                                             |
6 | Home page      : http://www-asim.lip6.fr/alliance/          |
7 | E-mail         : mailto:alliance-users@asim.lip6.fr       |
8 |                                                             |
9 | This progam is  free software; you can redistribute it      |
10 | and/or modify it under the  terms of the GNU Library General|
11 | Public License as published by the Free Software Foundation |
12 | either version 2 of the License, or (at your option) any    |
13 | later version.                                              |
14 |                                                             |
15 | Alliance VLSI  CAD System  is distributed  in the hope that |
16 | it  will be useful, but WITHOUT  ANY WARRANTY;              |
17 | without even the  implied warranty of MERCHANTABILITY or    |
18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General       |
19 | Public License for more details.                            |
20 |                                                             |
21 | You should have received a copy  of the GNU General Public  |
22 | License along with the GNU C Library; see the file COPYING. |
23 | If not, write to the Free Software Foundation, Inc.,        |
24 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.                     |
25 |                                                             |
26 \------------------------------------------------------------*/
27 /*------------------------------------------------------------\
28 |                                                             |
29 | Tool    :                     Bdd                           |
30 |                                                             |
31 | File    :                   bddalloc.c                      |
32 |                                                             |
33 | Date    :                   03.12.96                        |
34 |                                                             |
35 | Bddhor  :               Jacomme Ludovic                     |
36 |                                                             |
37 \------------------------------------------------------------*/
38 /*------------------------------------------------------------\
39 |                                                             |
40 |                         Include Files                       |
41 |                                                             |
42 \------------------------------------------------------------*/
43 
44 # include "mut.h"
45 # include "aut.h"
46 # include "abl.h"
47 # include "bdd.h"
48 
49 # include <stdio.h>
50 # include "bddalloc.h"
51 # include "bdderror.h"
52 
53 /*------------------------------------------------------------\
54 |                                                             |
55 |                           Constants                         |
56 |                                                             |
57 \------------------------------------------------------------*/
58 /*------------------------------------------------------------\
59 |                                                             |
60 |                            Types                            |
61 |                                                             |
62 \------------------------------------------------------------*/
63 /*------------------------------------------------------------\
64 |                                                             |
65 |                          Variables                          |
66 |                                                             |
67 \------------------------------------------------------------*/
68 
69    bddallocinfo BddAllocInfo =
70 
71    {
72      0, /*  CIRCUIT          */
73      0, /*  SYSTEM           */
74      0, /*  BLOCK            */
75      0, /*  NODE_BLOCK       */
76      0, /*  HASH_NODE_TABLE  */
77      0, /*  HASH_NODE        */
78      0, /*  HASH_OPER_TABLE  */
79      0, /*  HASH_OPER        */
80      0, /*  VAR              */
81      0, /*  VAR_NODE         */
82      0, /*  INDEX_NODE       */
83      0, /*  INDEX            */
84      0, /*  ASSOC            */
85      0, /*  ASSOC_NODE       */
86      0, /*  NAME_IN          */
87      0, /*  INDEX_IN         */
88      0, /*  HEATH            */
89      0  /*  USER_FUNC        */
90    };
91 
92 /*------------------------------------------------------------\
93 |                                                             |
94 |                          Functions                          |
95 |                                                             |
96 \------------------------------------------------------------*/
97 /*------------------------------------------------------------\
98 |                                                             |
99 |                       Bdd Alloc User Func                   |
100 |                                                             |
101 \------------------------------------------------------------*/
102 
allocbdduserfunc()103 bdduserfunc *allocbdduserfunc()
104 {
105   BddAllocInfo.USER_FUNC++;
106 
107   return( (bdduserfunc *)autallocheap( sizeof( bdduserfunc ) ) );
108 }
109 
110 /*------------------------------------------------------------\
111 |                                                             |
112 |                       Bdd Alloc Heath                       |
113 |                                                             |
114 \------------------------------------------------------------*/
115 
allocbddheath()116 bddheath *allocbddheath()
117 {
118   BddAllocInfo.HEATH++;
119 
120   return( (bddheath *)autallocheap( sizeof( bddheath ) ) );
121 }
122 
123 /*------------------------------------------------------------\
124 |                                                             |
125 |                        Bdd Alloc Hash Node                  |
126 |                                                             |
127 \------------------------------------------------------------*/
128 
allocbddhnode(Number)129 bddhnode *allocbddhnode( Number )
130 
131   long Number;
132 {
133   BddAllocInfo.HASH_NODE += Number;
134 
135   return( (bddhnode *)autallocblock( sizeof( bddhnode ) * Number ) );
136 }
137 
138 /*------------------------------------------------------------\
139 |                                                             |
140 |                        Bdd Alloc Hash Oper                  |
141 |                                                             |
142 \------------------------------------------------------------*/
143 
allocbddhoper(Number)144 bddhoper *allocbddhoper( Number )
145 
146   long Number;
147 {
148   BddAllocInfo.HASH_OPER += Number;
149 
150   return( (bddhoper *)autallocblock( sizeof( bddhoper ) * Number ) );
151 }
152 
153 /*------------------------------------------------------------\
154 |                                                             |
155 |                   Bdd Alloc Hash Node Table                 |
156 |                                                             |
157 \------------------------------------------------------------*/
158 
allocbddhnodetable()159 bddhnodetable *allocbddhnodetable()
160 {
161   BddAllocInfo.HASH_NODE_TABLE++;
162 
163   return( (bddhnodetable *)autallocheap( sizeof( bddhnodetable ) ) );
164 }
165 
166 /*------------------------------------------------------------\
167 |                                                             |
168 |                   Bdd Alloc Hash Oper Table                 |
169 |                                                             |
170 \------------------------------------------------------------*/
171 
allocbddhopertable()172 bddhopertable *allocbddhopertable()
173 {
174   BddAllocInfo.HASH_OPER_TABLE++;
175 
176   return( (bddhopertable *)autallocblock( sizeof( bddhopertable ) ) );
177 }
178 
179 /*------------------------------------------------------------\
180 |                                                             |
181 |                       Bdd Alloc Block                       |
182 |                                                             |
183 \------------------------------------------------------------*/
184 
allocbddblock()185 bddblock *allocbddblock()
186 {
187   BddAllocInfo.BLOCK++;
188 
189   return( (bddblock *)autallocheap( sizeof( bddblock ) ) );
190 }
191 
192 /*------------------------------------------------------------\
193 |                                                             |
194 |                       Bdd Alloc Node Block                  |
195 |                                                             |
196 \------------------------------------------------------------*/
197 
allocbddnodeblock(Number)198 bddnode *allocbddnodeblock( Number )
199 
200   long Number;
201 {
202   BddAllocInfo.NODE_BLOCK += Number;
203 
204   return( (bddnode *)autallocblock( sizeof( bddnode ) * Number ) );
205 }
206 
207 /*------------------------------------------------------------\
208 |                                                             |
209 |                       Bdd Alloc Variable Node               |
210 |                                                             |
211 \------------------------------------------------------------*/
212 
allocbddvarnode(Number)213 bddvarnode *allocbddvarnode( Number )
214 
215   long Number;
216 {
217   BddAllocInfo.VAR_NODE += Number;
218 
219   return( (bddvarnode *)autallocblock( sizeof( bddvarnode ) * Number ) );
220 }
221 
222 /*------------------------------------------------------------\
223 |                                                             |
224 |                       Bdd Alloc Index Node                  |
225 |                                                             |
226 \------------------------------------------------------------*/
227 
allocbddindexnode(Number)228 bddindexnode *allocbddindexnode( Number )
229 
230   long Number;
231 {
232   BddAllocInfo.INDEX_NODE += Number;
233 
234   return( (bddindexnode *)autallocblock( sizeof( bddindexnode ) * Number ) );
235 }
236 
237 /*------------------------------------------------------------\
238 |                                                             |
239 |                       Bdd Alloc Variable                    |
240 |                                                             |
241 \------------------------------------------------------------*/
242 
allocbddvar(Number)243 bddvar *allocbddvar( Number )
244 
245   long Number;
246 {
247   BddAllocInfo.VAR += Number;
248 
249   return( (bddvar *)autallocblock( sizeof( bddvar ) * Number ) );
250 }
251 
252 /*------------------------------------------------------------\
253 |                                                             |
254 |                       Bdd Alloc Index                       |
255 |                                                             |
256 \------------------------------------------------------------*/
257 
allocbddindex(Number)258 bddindex *allocbddindex( Number )
259 
260   long Number;
261 {
262   BddAllocInfo.INDEX += Number;
263 
264   return( (bddindex *)autallocblock( sizeof( bddindex ) * Number ) );
265 }
266 
267 /*------------------------------------------------------------\
268 |                                                             |
269 |                        Bdd Alloc Assoc                      |
270 |                                                             |
271 \------------------------------------------------------------*/
272 
allocbddassoc()273 bddassoc *allocbddassoc()
274 {
275   BddAllocInfo.ASSOC++;
276 
277   return( (bddassoc *)autallocheap( sizeof( bddassoc ) ) );
278 }
279 
280 /*------------------------------------------------------------\
281 |                                                             |
282 |                        Bdd Alloc Assoc Node                 |
283 |                                                             |
284 \------------------------------------------------------------*/
285 
allocbddassocnode(Number)286 bddassocnode *allocbddassocnode( Number )
287 
288   long Number;
289 {
290   BddAllocInfo.ASSOC_NODE += Number;
291 
292   return( (bddassocnode *)autallocblock( sizeof( bddassocnode ) * Number ) );
293 }
294 
295 /*------------------------------------------------------------\
296 |                                                             |
297 |                       Bdd Alloc Name Input                  |
298 |                                                             |
299 \------------------------------------------------------------*/
300 
allocbddnamein(Number)301 bddnamein *allocbddnamein( Number )
302 
303   long Number;
304 {
305   BddAllocInfo.NAME_IN += Number;
306 
307   return( (bddnamein *)autallocblock( sizeof( bddnamein ) * Number ) );
308 }
309 
310 /*------------------------------------------------------------\
311 |                                                             |
312 |                       Bdd Alloc Index Input                 |
313 |                                                             |
314 \------------------------------------------------------------*/
315 
allocbddindexin(Number)316 bddindex *allocbddindexin( Number )
317 
318   long Number;
319 {
320   BddAllocInfo.INDEX_IN += Number;
321 
322   return( (bddindex *)autallocblock( sizeof( bddindex ) * Number ) );
323 }
324 
325 /*------------------------------------------------------------\
326 |                                                             |
327 |                       Bdd Alloc System                      |
328 |                                                             |
329 \------------------------------------------------------------*/
330 
allocbddsystem()331 bddsystem *allocbddsystem()
332 {
333   BddAllocInfo.SYSTEM++;
334 
335   return( (bddsystem *)autallocblock( sizeof( bddsystem ) ) );
336 }
337 
338 /*------------------------------------------------------------\
339 |                                                             |
340 |                       Bdd Alloc Circuit                     |
341 |                                                             |
342 \------------------------------------------------------------*/
343 
allocbddcircuit()344 bddcircuit *allocbddcircuit()
345 {
346   BddAllocInfo.CIRCUIT++;
347 
348   return( (bddcircuit *)autallocblock( sizeof( bddcircuit ) ) );
349 }
350 
351 /*------------------------------------------------------------\
352 |                                                             |
353 |                       View Bdd Alloc Info                   |
354 |                                                             |
355 \------------------------------------------------------------*/
356 
viewbddallocinfo()357 void viewbddallocinfo()
358 {
359   fprintf( stdout, "--> BddAllocInfo\n" );
360   fprintf( stdout, "  CIRCUIT         : %ld bytes\n",
361            BddAllocInfo.CIRCUIT * sizeof( bddcircuit ) );
362   fprintf( stdout, "  SYSTEM          : %ld bytes\n",
363            BddAllocInfo.SYSTEM * sizeof( bddsystem ) );
364   fprintf( stdout, "  BLOCK           : %ld bytes\n",
365            BddAllocInfo.BLOCK * sizeof( bddblock ) );
366   fprintf( stdout, "  NODE_BLOCK      : %ld bytes\n",
367            BddAllocInfo.NODE_BLOCK * sizeof( bddnode ) );
368   fprintf( stdout, "  HASH_NODE_TABLE : %ld bytes\n",
369            BddAllocInfo.HASH_NODE_TABLE * sizeof( bddhnodetable ) );
370   fprintf( stdout, "  HASH_NODE       : %ld bytes\n",
371            BddAllocInfo.HASH_NODE * sizeof( bddhnode ) );
372   fprintf( stdout, "  HASH_OPER_TABLE : %ld bytes\n",
373            BddAllocInfo.HASH_OPER_TABLE * sizeof( bddhopertable ) );
374   fprintf( stdout, "  HASH_OPER       : %ld bytes\n",
375            BddAllocInfo.HASH_OPER * sizeof( bddhoper ) );
376   fprintf( stdout, "  VAR             : %ld bytes\n",
377            BddAllocInfo.VAR * sizeof( bddvar ) );
378   fprintf( stdout, "  VAR_NODE        : %ld bytes\n",
379            BddAllocInfo.VAR_NODE * sizeof( bddvarnode ) );
380   fprintf( stdout, "  INDEX_NODE      : %ld bytes\n",
381            BddAllocInfo.INDEX_NODE * sizeof( bddindexnode ) );
382   fprintf( stdout, "  INDEX           : %ld bytes\n",
383            BddAllocInfo.INDEX * sizeof( bddindex ) );
384   fprintf( stdout, "  ASSOC           : %ld bytes\n",
385            BddAllocInfo.ASSOC * sizeof( bddassoc ) );
386   fprintf( stdout, "  ASSOC_NODE      : %ld bytes\n",
387            BddAllocInfo.ASSOC_NODE * sizeof( bddassocnode ) );
388   fprintf( stdout, "  NAME_IN         : %ld bytes\n",
389            BddAllocInfo.NAME_IN * sizeof( bddnamein ) );
390   fprintf( stdout, "  INDEX_IN        : %ld bytes\n",
391            BddAllocInfo.INDEX_IN * sizeof( bddindex ) );
392   fprintf( stdout, "  HEATH           : %ld bytes\n",
393            BddAllocInfo.HEATH * sizeof( bddheath ) );
394   fprintf( stdout, "  USER_FUNC       : %ld bytes\n",
395            BddAllocInfo.USER_FUNC * sizeof( bdduserfunc ) );
396   fprintf( stdout, "<-- BddAllocInfo\n" );
397 
398 }
399