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 #ifndef __P
28 # if defined(__STDC__) ||  defined(__GNUC__)
29 #  define __P(x) x
30 # else
31 #  define __P(x) ()
32 # endif
33 #endif
34 /*------------------------------------------------------\
35 |                                                       |
36 |  Title   :   Structures and fonctions for SCL         |
37 |                                                       |
38 |  File    :            sch105.h                        |
39 |                                                       |
40 |  Date    :            04.03.98                        |
41 |                                                       |
42 \------------------------------------------------------*/
43 
44 # ifndef SCL_105_H
45 # define SCL_105_H
46 
47 /*------------------------------------------------------\
48 |                                                       |
49 |                      Constants                        |
50 |                                                       |
51 \------------------------------------------------------*/
52 /*------------------------------------------------------\
53 |                                                       |
54 |                Box & Connectors Size / Step           |
55 |                                                       |
56 \------------------------------------------------------*/
57 
58 # define SCP_BOX_MIN_DX              8
59 
60 # define SCP_BOX_CON_BASE_Y          2
61 # define SCP_BOX_CON_STEP_Y          4
62 # define SCP_BOX_CON_X               0
63 
64 # define SCP_BOX_STEP_Y              5
65 # define SCP_CON_STEP_Y              3
66 # define SCP_CELL_MIN_DX             2
67 
68 # define SCP_PRIMARY_CON_DX          3
69 # define SCP_PRIMARY_CON_DY          2
70 # define SCP_CON_DY                  2
71 
72 # define SCP_CLUSTER_ROUTE_STEP_X    2
73 
74 /*------------------------------------------------------\
75 |                                                       |
76 |                      From Type                        |
77 |                                                       |
78 \------------------------------------------------------*/
79 
80 # define SCH_FROM_LOFIG     0x0001
81 # define SCH_FROM_BEFIG     0x0002
82 
83 /*------------------------------------------------------\
84 |                                                       |
85 |                       P Type Id                       |
86 |                                                       |
87 \------------------------------------------------------*/
88 
89 # define SCH_NET_TYPE       0x90000020
90 # define SCH_BOX_TYPE       0x90000200
91 
92 /*------------------------------------------------------\
93 |                                                       |
94 |                        Box Mask                       |
95 |                                                       |
96 \------------------------------------------------------*/
97 
98 # define SCH_BOX_TAGED         0x0001
99 # define SCH_BOX_CLUSTERED     0x0002
100 # define SCH_BOX_CLUSTER       0x0004
101 # define SCH_BOX_CLUSTER_NET   0x0008
102 
103 # define SCH_BOX_TRANSPARENCE  0x0010
104 # define SCH_BOX_RETAGED       0x0020
105 # define SCH_BOX_PLACED        0x0040
106 
107 /*------------------------------------------------------\
108 |                                                       |
109 |                        Con Mask                       |
110 |                                                       |
111 \------------------------------------------------------*/
112 
113 # define SCH_CON_IN         0x0001
114 # define SCH_CON_OUT        0x0002
115 # define SCH_CON_VEC        0x0004
116 # define SCH_CON_EXTERNAL   0x0008
117 # define SCH_CON_INTERNAL   0x0010
118 # define SCH_CON_VEC_FIRST  0x0020
119 # define SCH_CON_VEC_LAST   0x0040
120 
121 # define SCH_CON_TAGED      0x0100
122 # define SCH_CON_PLACED     0x0200
123 
124 # define SCH_NET_CANAL      0x0F
125 
126 # define SCH_NET_MAXDIR     0x20
127 # define SCH_NET_MINDIR     0x10
128 
129 # define SCH_ROOT_CON_BOX   0x0001
130 # define SCH_ROOT_CON_FIG   0x0002
131 
132 
133 # define SCH_SOURCE_LOSIG   1
134 # define SCH_SOURCE_LOINS   2
135 # define SCH_SOURCE_LOCON   3
136 # define SCH_SOURCE_LOFIG   4
137 # define SCH_SOURCE_LOTRS   5
138 
139 # define SCH_SOURCE_BEPOR   6
140 # define SCH_SOURCE_BEAUX   7
141 # define SCH_SOURCE_BEREG   8
142 # define SCH_SOURCE_BEBUX   9
143 # define SCH_SOURCE_BEBUS  10
144 # define SCH_SOURCE_BEOUT  11
145 # define SCH_SOURCE_BEFIG  12
146 
147 /*------------------------------------------------------\
148 |                                                       |
149 |                        Macros                         |
150 |                                                       |
151 \------------------------------------------------------*/
152 /*------------------------------------------------------\
153 |                                                       |
154 |                         Box                           |
155 |                                                       |
156 \------------------------------------------------------*/
157 
158 # define IsSchBoxClustered( X )     ( ( X )->FLAGS & SCH_BOX_CLUSTERED )
159 # define SetSchBoxClustered( X )    ( ( X )->FLAGS |= SCH_BOX_CLUSTERED )
160 # define ClearSchBoxClustered( X )  ( ( X )->FLAGS &= ~SCH_BOX_CLUSTERED )
161 
162 # define IsSchBoxTaged( X )         ( ( X )->FLAGS & SCH_BOX_TAGED )
163 # define SetSchBoxTaged( X )        ( ( X )->FLAGS |= SCH_BOX_TAGED )
164 # define ClearSchBoxTaged( X )      ( ( X )->FLAGS &= ~SCH_BOX_TAGED )
165 
166 # define IsSchBoxReTaged( X )       ( ( X )->FLAGS & SCH_BOX_RETAGED )
167 # define SetSchBoxReTaged( X )      ( ( X )->FLAGS |= SCH_BOX_RETAGED )
168 # define ClearSchBoxReTaged( X )    ( ( X )->FLAGS &= ~SCH_BOX_RETAGED )
169 
170 # define IsSchBoxCluster( X )       ( ( X )->FLAGS & SCH_BOX_CLUSTER )
171 # define SetSchBoxCluster( X )      ( ( X )->FLAGS |= SCH_BOX_CLUSTER )
172 # define ClearSchBoxCluster( X )    ( ( X )->FLAGS &= ~SCH_BOX_CLUSTER )
173 
174 # define IsSchBoxTransparence( X )  ( ( X )->FLAGS & SCH_BOX_TRANSPARENCE )
175 # define SetSchBoxTransparence( X ) ( ( X )->FLAGS |= SCH_BOX_TRANSPARENCE )
176 # define ClearSchBoxTransparence( X ) ( ( X )->FLAGS &= ~SCH_BOX_TRANSPARENCE )
177 
178 # define IsSchBoxPlaced( X )        ( ( X )->FLAGS & SCH_BOX_PLACED )
179 # define SetSchBoxPlaced( X )       ( ( X )->FLAGS |= SCH_BOX_PLACED )
180 # define ClearSchBoxPlaced( X )     ( ( X )->FLAGS &= ~SCH_BOX_PLACED )
181 
182 # define IsSchBoxClusterNet( X )    ( ( X )->FLAGS & SCH_BOX_CLUSTER_NET )
183 # define SetSchBoxClusterNet( X )   ( ( X )->FLAGS |= SCH_BOX_CLUSTER_NET )
184 # define ClearSchBoxClusterNet( X ) ( ( X )->FLAGS &= ~SCH_BOX_CLUSTER_NET )
185 
186 /*------------------------------------------------------\
187 |                                                       |
188 |                       Connector                       |
189 |                                                       |
190 \------------------------------------------------------*/
191 
192 # define IsSchConIn( X )          ( ( X )->TYPE & SCH_CON_IN )
193 # define SetSchConIn( X )         ( ( X )->TYPE |= SCH_CON_IN )
194 # define ClearSchConIn( X )       ( ( X )->TYPE &= ~SCH_CON_IN )
195 
196 # define IsSchConOut( X )         ( ( X )->TYPE & SCH_CON_OUT )
197 # define SetSchConOut( X )        ( ( X )->TYPE |= SCH_CON_OUT )
198 # define ClearSchConOut( X )       ( ( X )->TYPE &= ~SCH_CON_OUT )
199 
200 # define IsSchConVec( X )         ( ( X )->TYPE & SCH_CON_VEC )
201 # define SetSchConVec( X )        ( ( X )->TYPE |= SCH_CON_VEC )
202 # define ClearSchConVec( X )      ( ( X )->TYPE &= ~SCH_CON_VEC )
203 
204 # define IsSchConVecFirst( X )    ( ( X )->TYPE & SCH_CON_VEC_FIRST )
205 # define SetSchConVecFirst( X )   ( ( X )->TYPE |= SCH_CON_VEC_FIRST )
206 # define ClearSchConVecFirst( X ) ( ( X )->TYPE &= ~SCH_CON_VEC_FIRST )
207 
208 # define IsSchConVecLast( X )    ( ( X )->TYPE & SCH_CON_VEC_LAST )
209 # define SetSchConVecLast( X )   ( ( X )->TYPE |= SCH_CON_VEC_LAST )
210 # define ClearSchConVecLast( X ) ( ( X )->TYPE &= ~SCH_CON_VEC_LAST )
211 
212 # define IsSchConExternal( X )    ( ( X )->TYPE & SCH_CON_EXTERNAL )
213 # define SetSchConExternal( X )   ( ( X )->TYPE |= SCH_CON_EXTERNAL )
214 # define ClearSchConExternal( X ) ( ( X )->TYPE &= ~SCH_CON_EXTERNAL )
215 
216 # define IsSchConInternal( X )    ( ( X )->TYPE & SCH_CON_INTERNAL )
217 # define SetSchConInternal( X )   ( ( X )->TYPE |= SCH_CON_INTERNAL )
218 # define ClearSchConInternal( X ) ( ( X )->TYPE &= ~SCH_CON_INTERNAL )
219 
220 # define IsSchConPlaced( X )      ( ( X )->FLAGS & SCH_CON_PLACED )
221 # define SetSchConPlaced( X )     ( ( X )->FLAGS |= SCH_CON_PLACED )
222 # define ClearSchConPlaced( X )   ( ( X )->FLAGS &= ~SCH_CON_PLACED )
223 
224 # define IsSchConTaged( X )       ( ( X )->FLAGS & SCH_CON_TAGED )
225 # define SetSchConTaged( X )      ( ( X )->FLAGS |= SCH_CON_TAGED )
226 # define ClearSchConTaged( X )    ( ( X )->FLAGS &= ~SCH_CON_TAGED )
227 
228 /*------------------------------------------------------\
229 |                                                       |
230 |                           Net                         |
231 |                                                       |
232 \------------------------------------------------------*/
233 
234 # define IsSchNetCanal( X )        ( ( X )->FLAGS & SCH_NET_CANAL )
235 # define GetSchNetDirType( X )     ( ( X )->FLAGS & (SCH_NET_MAXDIR|SCH_NET_MINDIR) )
236 # define SetSchNetMaxOutput( X )     ( ( X )->FLAGS |= SCH_NET_MAXDIR )
237 # define SetSchNetMinOutput( X )     ( ( X )->FLAGS |= SCH_NET_MINDIR )
238 
239 # define SetSchNetCanal( X )       ( ( X )->FLAGS |= SCH_NET_CANAL )
240 
241 # define ClearSchNetCanal( X )     ( ( X )->FLAGS &= ~SCH_NET_CANAL )
242 # define ClearSchNetDir( X )       ( ( X )->FLAGS &= ~(SCH_NET_MINDIR|SCH_NET_MAXDIR) )
243 
244 /*------------------------------------------------------\
245 |                                                       |
246 |                       Add Connector                   |
247 |                                                       |
248 \------------------------------------------------------*/
249 
250 # define addschfigconin( F, N )  (addschfigcon( (F), (N), SCH_CON_IN ))
251 # define addschfigconout( F, N ) (addschfigcon( (F), (N), SCH_CON_OUT ))
252 
253 # define addschboxconin( F, B, N )  (addschboxcon( (F), (B), (N), SCH_CON_IN ))
254 # define addschboxconout( F, B, N ) (addschboxcon( (F), (B), (N), SCH_CON_OUT ))
255 
256 /*------------------------------------------------------\
257 |                                                       |
258 |                      Structures                       |
259 |                                                       |
260 \------------------------------------------------------*/
261 /*------------------------------------------------------\
262 |                                                       |
263 |                        Wires                          |
264 |                                                       |
265 \------------------------------------------------------*/
266 
267   typedef struct schwir_list
268   {
269     struct schwir_list  *NEXT;
270     struct schnet_list  *NET;
271     long                 X;
272     long                 Y;
273     long                 DX;
274     long                 DY;
275     long                 FLAGS;
276     void                *USER;
277 
278   } schwir_list;
279 
280 /*------------------------------------------------------\
281 |                                                       |
282 |                        Nets (Signals)                 |
283 |                                                       |
284 \------------------------------------------------------*/
285 
286   typedef struct schnet_list
287   {
288     struct schnet_list  *NEXT;
289     chain_list          *CON_NET;
290     struct schwir_list  *WIRE;
291     void                *SOURCE;
292     unsigned char        SOURCE_TYPE;
293     long                 FLAGS;
294     long                 NUMBER_IN;
295     long                 NUMBER_OUT;
296     long                 CANAL;
297     long                 YMIN;
298     long                 YMAX;
299     void                *USER;
300 
301   } schnet_list;
302 
303 /*------------------------------------------------------\
304 |                                                       |
305 |                      Connectors                       |
306 |                                                       |
307 \------------------------------------------------------*/
308 
309   typedef struct schcon_list
310   {
311     struct schcon_list  *NEXT;
312     char                *NAME;
313     unsigned short       TYPE;
314     unsigned char        DIR;
315     unsigned char        ROOT_TYPE;
316     void                *ROOT;
317     schnet_list         *NET;
318     void                *SOURCE;
319     unsigned char        SOURCE_TYPE;
320     long                 X_REL;
321     long                 Y_REL;
322     long                 FLAGS;
323     void                *USER;
324 
325   } schcon_list;
326 
327 
328 /*------------------------------------------------------\
329 |                                                       |
330 |                        Box (Instance)                 |
331 |                                                       |
332 \------------------------------------------------------*/
333 
334   typedef struct schbox_list
335   {
336     struct schbox_list  *NEXT;
337     char                *NAME;
338     struct schcon_list  *CON_IN;
339     long                 NUMBER_IN;
340     struct schcon_list  *CON_OUT;
341     long                 NUMBER_OUT;
342     void                *SOURCE;
343     unsigned char        SOURCE_TYPE;    /* type de la source */
344     long                 X;
345     long                 Y;
346     long                 DX;
347     long                 DY;
348     long                 FLAGS;
349     void                *USER;
350 
351   } schbox_list;
352 
353 /*------------------------------------------------------\
354 |                                                       |
355 |                        Figure                         |
356 |                                                       |
357 \------------------------------------------------------*/
358 
359   typedef struct schfig_list
360   {
361     struct schfig_list  *NEXT;
362     char                *NAME;
363     struct schcon_list  *CON_IN;
364     long                 NUMBER_IN;
365     struct schcon_list  *CON_OUT;
366     long                 NUMBER_OUT;
367     schbox_list         *BOX;
368     schnet_list         *NET;
369     void                *SOURCE;
370     unsigned char        SOURCE_TYPE;
371     long                 X;
372     long                 Y;
373     long                 FLAGS;
374     void                *USER;
375 
376   } schfig_list;
377 
378 /*------------------------------------------------------\
379 |                                                       |
380 |                     Global Variables                  |
381 |                                                       |
382 \------------------------------------------------------*/
383 
384  extern schfig_list   *HEAD_SCHFIG;
385  extern char          *SCH_IN;
386 
387 /*------------------------------------------------------\
388 |                                                       |
389 |                        Functions                      |
390 |                                                       |
391 \------------------------------------------------------*/
392 /*------------------------------------------------------\
393 |                                                       |
394 |                       Env Functions                   |
395 |                                                       |
396 \------------------------------------------------------*/
397 
398   extern void schenv();
399 
400 /*------------------------------------------------------\
401 |                                                       |
402 |                    Alloc Functions                    |
403 |                                                       |
404 \------------------------------------------------------*/
405 
406   extern schfig_list    *allocschfig();
407   extern schcon_list    *allocschcon();
408   extern schbox_list    *allocschbox();
409   extern schwir_list    *allocschwir();
410   extern schnet_list    *allocschnet();
411 
412 
413 /*------------------------------------------------------\
414 |                                                       |
415 |                      Free Functions                   |
416 |                                                       |
417 \------------------------------------------------------*/
418 
419   extern void  freeschfig();
420   extern void  freeschcon();
421   extern void  freeschbox();
422   extern void  freeschwir();
423   extern void  freeschnet();
424 
425 
426 /*------------------------------------------------------\
427 |                                                       |
428 |                      Add Functions                    |
429 |                                                       |
430 \------------------------------------------------------*/
431 
432   extern schnet_list    *addschnetcon();
433   extern schfig_list    *addschfig();
434   extern schcon_list    *addschfigcon();
435   extern schcon_list    *addschboxcon();
436   extern schbox_list    *addschbox();
437   extern schwir_list    *addschwir();
438   extern schnet_list    *addschnet();
439 
440 
441 /*------------------------------------------------------\
442 |                                                       |
443 |                      Del Functions                    |
444 |                                                       |
445 \------------------------------------------------------*/
446 
447   extern int   delschfig();
448 
449 /*------------------------------------------------------\
450 |                                                       |
451 |                     View Functions                    |
452 |                                                       |
453 \------------------------------------------------------*/
454 
455   extern void viewschfig();
456   extern void viewschbox();
457   extern void viewschcon();
458   extern void viewschwir();
459   extern void viewschnet();
460 
461 /*------------------------------------------------------\
462 |                                                       |
463 |                       Get Functions                   |
464 |                                                       |
465 \------------------------------------------------------*/
466 
467  extern char *getschvectorname();
468 
469 /*------------------------------------------------------\
470 |                                                       |
471 |                   Translate Functions                 |
472 |                                                       |
473 \------------------------------------------------------*/
474 
475   extern schfig_list *lofig2schfig();
476   extern schfig_list *befig2schfig();
477 
478 /*------------------------------------------------------\
479 |                                                       |
480 |                  Place / Route Functions              |
481 |                                                       |
482 \------------------------------------------------------*/
483 
484   extern void placerouteschfig();
485 
486 # endif
487