1 /*
2  * This file is part of the Alliance CAD System
3  * Copyright (C) Laboratoire LIP6 - D�partement ASIM
4  * Universite Pierre et Marie Curie
5  *
6  * Home page          : http://www-asim.lip6.fr/alliance/
7  * E-mail             : mailto:alliance-users@asim.lip6.fr
8  *
9  * This library is free software; you  can redistribute it and/or modify it
10  * under the terms  of the GNU Library General Public  License as published
11  * by the Free Software Foundation; either version 2 of the License, or (at
12  * your option) any later version.
13  *
14  * Alliance VLSI  CAD System  is distributed  in the hope  that it  will be
15  * useful, but WITHOUT  ANY WARRANTY; without even the  implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
17  * Public License for more details.
18  *
19  * You should have received a copy  of the GNU General Public License along
20  * with the GNU C Library; see the  file COPYING. If not, write to the Free
21  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 
24 #ident "$Id: rcn.h,v 1.5 2012/05/14 14:20:23 alliance Exp $"
25 
26 /*******************************************************************************
27 * rcn     : constantes, externs, and data-structures                           *
28 *                                                                              *
29 * version : 2.00                                                               *
30 * date    : 09/01/98                                                           *
31 *******************************************************************************/
32 
33 /*******************************************************************************
34 * Gregoire AVOT                                                                *
35 * Laboratoire LIP6 - Departement ASIM                                          *
36 * Universite Paris 6 - Pierre et Marie Curie                                   *
37 * 4, Place Jussieu                                                             *
38 * Paris Cedex 05.                                                              *
39 *******************************************************************************/
40 
41 #ifndef RCNH
42 #define RCNH
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif /* __cplusplus */
47 
48 #ifndef __P
49 # if defined(__STDC__) ||  defined(__GNUC__) || defined(__cplusplus)
50 #  define __P(x) x
51 # else
52 #  define __P(x) ()
53 # endif
54 #endif
55 
56 /* layer of wire */
57 #define RCN_WIRE_UNKNOW       ((unsigned char) 0x00000001)
58 #define RCN_WIRE_POLY         ((unsigned char) 0x00000002)
59 #define RCN_WIRE_ALU1         ((unsigned char) 0x00000003)
60 #define RCN_WIRE_ALU2         ((unsigned char) 0x00000004)
61 #define RCN_WIRE_CONT_POLY    ((unsigned char) 0x00000005)
62 #define RCN_WIRE_CONT_DIF_N   ((unsigned char) 0x00000006)
63 #define RCN_WIRE_CONT_DIF_P   ((unsigned char) 0x00000007)
64 #define RCN_WIRE_CONT_VIA     ((unsigned char) 0x00000008)
65 #define RCN_WIRE_CONT_VIA2    ((unsigned char) 0x00000009)
66 #define RCN_WIRE_CAPA         ((unsigned char) 0x00000010)
67 #define RCN_WIRE_RESI         ((unsigned char) 0x00000020)
68 
69 /* Heap allocation */
70 #define RCNBUFSIZE 64
71 
72 /* State of a losig */
73 #define MBK_RC_A ((int) 1)
74 #define MBK_RC_B ((int) 2)
75 #define MBK_RC_C ((int) 3)
76 #define MBK_RC_D ((int) 4)
77 #define MBK_RC_E ((int) 5)
78 
79 /* node type for lonode ptype */
80 #define RCN_LOCON             ((long) 19981201)
81 #define RCN_REPORTED          ((long) 19981301)
82 
83 /* flags for lonode */
84 
85 #define RCN_FLAG_ONE     ((unsigned char) 0x00000001) /* Terminal node        */
86 #define RCN_FLAG_TWO     ((unsigned char) 0x00000002) /* two wires connected  */
87 #define RCN_FLAG_CROSS   ((unsigned char) 0x00000004) /* many wires connected */
88 #define RCN_FLAG_LOCON   ((unsigned char) 0x00000008) /* the node is a locon  */
89 #define RCN_FLAG_PASS    ((unsigned char) 0x00000010) /* yet treated          */
90 
91 #define RCN_FLAG_TRUE    ((unsigned char) 0x0000000F) /* true node            */
92 
93 /* flags for lowire */
94 
95 #define RCN_FLAG_PASS    ((unsigned char) 0x00000010) /* yet treated          */
96 #define RCN_FLAG_DEL     ((unsigned char) 0x00000020) /* not a valid wire     */
97 
98 /* macro to use with flags */
99 
100 #define RCN_SETFLAG(m,b)        (m=(m)|(b))
101 #define RCN_CLEARFLAG(m,b)      (m=(m)&(~b))
102 #define RCN_GETFLAG(m,b)        ((m)&(b))
103 
104 /* Macro to get the node table */
105 #define RCN_LONODE              15543
106 #define RCN_SIZETAB		15544
107 
108 /* Ptype in lofig for order of physical order of locon on figure */
109 #define PH_INTERF 19980318
110 
111 /* Ptype in locon for name of physical connector (spice parser) */
112 #define PNODENAME 19981103
113 
114 /* Ptype in lonode for retreive the component connexe */
115 #define CONNEXE 19990808
116 /*******************************************************************************
117 * interconnect network  structures                                             *
118 *******************************************************************************/
119 
120 typedef struct lorcnet                        /* logical rc network           */
121 {
122 float              CAPA;                      /* total capacitance            */
123 struct lowire     *PWIRE;                     /* wire list                    */
124 long               NBNODE;                    /* number of lonode             */
125 chain_list        *PCTC;                      /* cross talk capacitance       */
126 struct ptype      *USER;                      /* Application specific         */
127 }
128 lorcnet_list;
129 
130 typedef struct lowire                         /* logical wire                 */
131 {
132 struct lowire           *NEXT;          /* next wire                          */
133 long                     NODE1;         /* interconnect network node1         */
134 long                     NODE2;         /* interconnect network node2         */
135 unsigned char            LAYER;         /* physical layer                     */
136 unsigned char            FLAG;          /* flags                              */
137 float                    RESI;          /* wire resistance                    */
138 float                    CAPA;          /* wire capacitance                   */
139 long                     X;             /* x position                         */
140 long                     Y;             /* y position                         */
141 long                     DX;            /* x rectangle wide                   */
142 long                     DY;            /* y rectangle length                 */
143 struct ptype            *USER;          /* Application specific               */
144 }
145 lowire_list;
146 
147 typedef struct lonode                   /* logical node                       */
148 {
149 struct chain            *WIRELIST;      /* wire list                          */
150 struct chain            *CTCLIST;       /* cross talk capacitance list        */
151 long                     FLAG;          /* Flags                              */
152 long                     INDEX;         /* node index                         */
153 struct ptype            *USER;          /* wire list                          */
154 }
155 lonode_list;
156 
157 typedef struct loctc                           /* cross talk capacitance      */
158 {
159 struct losig  *SIG1;                           /* First losig                 */
160 struct losig  *SIG2;                           /* Second losig                */
161 long           NODE1;                          /* first lonode                */
162 long           NODE2;                          /* first lonode                */
163 float          CAPA;                           /* cross talk capacitance      */
164 struct ptype  *USER;                           /* application specific        */
165 } loctc_list;
166 
167 /*******************************************************************************
168 * externals for rcn view                                                       *
169 *******************************************************************************/
170 
171 extern int               rclevel __P((losig_list*));
172 extern chain_list  *gettabnode __P((lorcnet_list*));
173 extern lorcnet_list     *addlorcnet __P((losig_list *ptsig));
174 extern lorcnet_list     *givelorcnet __P((losig_list *ptsig));
175 extern int               freelorcnet __P((losig_list *ptsig));
176                         /* Il faut qu'il y ait un lofigchain */
177 
178 extern float             addcapa   __P((losig_list *ptsig,float value));
179 extern float             setcapa   __P((losig_list *ptsig,float value));
180 extern float             getcapa   __P((losig_list *ptsig));
181 extern float             rcncalccapa __P((losig_list *ptsig));
182 extern long              addonode  __P((losig_list *ptsig,locon_list *ptlocon));
183 extern long              addlonode __P((losig_list *ptsig,locon_list *ptlocon));
184 extern lonode_list      *getlonode __P((losig_list *ptsig, long index));
185 extern lowire_list      *addlowire __P((losig_list *ptsig, unsigned char layer,
186                                        unsigned char flag, float resi,
187                                        float capa, long x, long y, long dx,
188                                        long dy, long n1, long n2 ));
189 extern int               dellowire __P((losig_list *ptsig, long node1,
190                                        long node2 ));
191 extern lowire_list      *getlowire __P((losig_list *ptsig, long node1,
192                                        long node2 ));
193 extern loctc_list       *addloctc __P((losig_list *ptsig1, long node1,
194                                        losig_list *ptsig2, long node2,
195                                        float value ));
196 extern int               delloctc __P(( losig_list *ptsig1, long node1,
197                                         losig_list *ptsig2, long node2 ));
198 extern loctc_list       *getloctc __P(( losig_list *ptsig1, long node1,
199                                         losig_list *ptsig2, long node2 ));
200 extern chain_list       *getallctc __P(( lofig_list *ptfig ));
201 extern void              freectclist __P(( lofig_list*, chain_list* ));
202 extern void              freectcsig  __P(( chain_list* ));
203 extern void              setloconnode __P((locon_list *ptlocon, long node));
204 extern void              delloconnode __P((locon_list *ptcon, long index));
205 extern chain_list       *getloconnode __P((lonode_list *node));
206 extern void              delrcnlocon __P((locon_list *ptloc));
207 extern void              addcapawire __P((lowire_list *ptwire,float capa));
208 extern void              setcapawire __P((lowire_list *ptwire,float capa));
209 extern void              addresiwire __P((lowire_list *ptwire,float resi));
210 extern void              setresiwire __P((lowire_list *ptwire,float resi));
211 extern void              addpararesiwire __P((lowire_list *ptwire, float resi));
212 
213 extern void              buildtable __P((losig_list *ptsig));
214 extern void              freetable __P((losig_list *ptsig));
215 extern int               chkloop __P((losig_list *ptsig));
216 /* 0 : no loop, 1 no node table, 2 : loop */
217 extern lonode_list      *givelonode __P((losig_list *ptsig, long index));
218 
219 extern void              chkrcn __P((losig_list *ptsig));
220 void		         clearallwireflag __P(( lorcnet_list *ptrcnet,
221 		                                unsigned char flag ));
222 extern void              statrcn __P((void));
223 extern void              setdellowire __P(( losig_list*, lowire_list* ));
224 extern void              mergedellowire __P(( losig_list* ));
225 
226 /*******************************************************************************
227 * Include for rcn_lo_util.c                                                    *
228 *******************************************************************************/
229 
230 extern void             duplorcnet __P((losig_list*, losig_list*));
231 extern int              breakloop  __P(( losig_list* ));
232 extern int              reduce_rcn __P(( losig_list* ));
233 extern int              connexe    __P(( losig_list* ));
234 extern int              cleanrcnet __P(( losig_list* ));
235 
236 #ifdef __cplusplus
237 }
238 #endif /* __cplusplus */
239 
240 #endif /* !RCNH */
241