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 /*
25  * Purpose : constantes, externs, and data-structures
26  * Date    : 05/08/93
27  * Author  : Frederic Petrot <Frederic.Petrot@lip6.fr>
28  * Modified by Czo <Olivier.Sirol@lip6.fr> 1997,98
29  * Modified by pnt <Pierre.Nguyen-Tuong@lip6.fr> 2002
30  * $Id: mlo.h,v 1.9 2012/05/14 14:20:23 alliance Exp $
31  */
32 
33 #ifndef _MLO_H_
34 #define _MLO_H_
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39 
40 #ifndef __P
41 # if defined(__STDC__) ||  defined(__GNUC__) || defined(__cplusplus)
42 #  define __P(x) x
43 # else
44 #  define __P(x) ()
45 # endif
46 #endif
47 /* transistor type */
48 #define TRANSN      0
49 #define TRANSP      1
50 
51 #define TRANSFAST   (1 << 1)
52 #define TRANSHVIO   (1 << 3)
53 
54 #define TRANSN_FAST (TRANSN & TRANSFAST)
55 #define TRANSP_FAST (TRANSP & TRANSFAST)
56 
57 #define TRANSN_HVIO (TRANSN & TRANSHVIO)
58 #define TRANSP_HVIO (TRANSP & TRANSHVIO)
59 
60 #define IsTransP(type)    (type & 1)
61 #define IsTransN(type)    (!IsTransP(type))
62 #define IsTransFast(type) ((type >> 1) & 1)
63 #define IsTransSlow(type) (!IsTransFast(type))
64 #define IsTransHvio(type) ((type >> 3) & 1)
65 
66 /* connector & signal direction */
67 #define INTERNAL    'I' /* instance connector or signal on instances only */
68 #define EXTERNAL    'E' /* figure connector or signal on figure and instances */
69 
70 /* connector direction */
71 #define IN          'I'
72 #define OUT         'O'
73 #define INOUT       'B'
74 #define UNKNOWN     'X'
75 #define TRISTATE    'Z'
76 #define TRANSCV     'T'
77 #define TRANSCV2    'P'
78 #define TRANSCV3    'R'
79 #define TRANSCV4    'L'
80 
81 /*******************************************************************************
82 * netlist structures types                                                     *
83 *******************************************************************************/
84 typedef struct lofig                          /* logical figure               */
85 {
86 struct lofig  *NEXT;                          /* next figure                  */
87 struct chain  *MODELCHAIN;                    /* list of models               */
88 struct locon  *LOCON;                         /* connector list head          */
89 struct losig  *LOSIG;                         /* signal list head             */
90 struct ptype  *BKSIG;                         /* signal block list head       */
91 struct loins  *LOINS;                         /* instance list head           */
92 struct lotrs  *LOTRS;                         /* transistor list head         */
93 struct locap  *LOCAP      ;                   /* capacitance list head        */
94 struct lores  *LORES      ;                   /* resistance list head         */
95 struct loself *LOSELF     ;                   /* inductor list head           */
96 char          *NAME;                          /* figure name (unique)         */
97 char           MODE;                           /* 'A' or 'P'                  */
98 struct ptype  *USER;                          /* Application specific         */
99 }
100 lofig_list;
101 
102 typedef struct lotrs                           /* logical transistor          */
103 {
104 struct lotrs  *NEXT;                           /* next transistor             */
105 struct locon  *DRAIN;                          /* drain connector             */
106 struct locon  *GRID;                           /* grid connector              */
107 struct locon  *SOURCE;                         /* source connector            */
108 struct locon  *BULK;                           /* bulk connector              */
109 char          *TRNAME;                         /* transistor instance name    */
110 long           WIDTH,LENGTH;                   /* transistor width & length   */
111 long           PS, PD;                         /* source & drain perimeters   */
112 long           XS, XD;                         /* values for area computation */
113 long           X,Y;                            /* transistor coordinates      */
114 char           TYPE;                           /* transistor type             */
115 struct ptype  *USER;                           /* application specific        */
116 }
117 lotrs_list;
118 
119 typedef struct loins                           /* logical instance            */
120 {
121 struct loins  *NEXT;                           /* next figure                 */
122 struct locon  *LOCON;                          /* connector list head         */
123 char          *INSNAME;                        /* instance name               */
124 char          *FIGNAME;                        /* model name                  */
125 struct ptype  *USER;                           /* Application specific        */
126 }
127 loins_list;
128 
129 typedef struct locon                           /* logical connector           */
130 {
131 struct locon  *NEXT;                           /* next connector              */
132 char          *NAME;                           /* connector name (unique)     */
133 struct losig  *SIG;                            /* pointer on signal           */
134 void          *ROOT;                           /* pointer on figure/instance  */
135 char          DIRECTION;                       /* see defines for information */
136 char          TYPE;                            /* instance I  / figure E      */
137 struct num   *PNODE;                           /* nodes for physical connector*/
138 struct ptype  *USER;                           /* Application specific        */
139 }
140 locon_list;
141 
142 typedef struct losig                           /* logical signal              */
143 {
144 struct losig  *NEXT;                           /* next signal                 */
145 struct chain  *NAMECHAIN;                      /* list of alias name          */
146 long          INDEX;                           /* signal index (unique)       */
147 char          TYPE;                            /* internal I  / external E    */
148 struct lorcnet *PRCN;                          /* pointer on parasitic RC     */
149 struct ptype  *USER;                           /* application specific        */
150 }
151 losig_list;
152 
153 
154 /************************************************************************************/
155 /************************* Analogical specific structures ***************************/
156 /************************************************************************************/
157 
158 /********************** Complementary transitor informations ************************/
159 
160 /* The structure is put in the USER field of the transistor */
161 /* with the LOTRS_INFO ptype                                */
162 
163 #define LOTRS_INFO 200208071                       /* USER field code               */
164 
165 typedef struct s_lotrs_info
166   {
167     double AS,AD              ;                    /* Source and drain area         */
168     double PS,PD              ;                    /* Source and drain perimeter    */
169     int    M                  ;                    /* Number of fingers             */
170   } lotrs_info                ;
171 
172 
173 /********************************* Capacitance **************************************/
174 
175 #define CAPMIM    0                                /* Metal-Inter-Metal type        */
176 #define CAPPNWELL 1                                /* Poly-NWell type               */
177 
178 #define IsCapMIM(type)    ((type == CAPMIM)    ? 1 : 0)
179 #define IsCapPNWELL(type) ((type == CAPPNWELL) ? 1 : 0)
180 
181 typedef struct locap                               /* analog capacitance            */
182   {
183     struct locap  *NEXT       ;                    /* next capacitor                */
184     struct locon  *TCON       ;                    /* top plate connector           */
185     struct locon  *BCON       ;                    /* bottom plate connector        */
186     char          *NAME       ;                    /* capacitor instance name       */
187     double        CAPA        ;                    /* capacitor value (unite FF)    */
188     char          TYPE        ;                    /* capacitor type                */
189     struct ptype  *USER       ;                    /* application specific          */
190   } locap_list                ;
191 
192 
193 /************************* Complementary capacitance information ********************/
194 
195 /* The structure is put in the USER field of the capacitance */
196 /* with the LOCAP_INFO ptype                                 */
197 
198 #define LOCAP_INFO 200208072                       /* USER field code               */
199 
200 typedef struct s_locap_info
201   {
202     union
203        {
204          struct
205           {
206             double AT,AB      ;                    /* Top and bottom plate area     */
207             double PT,PB      ;                    /* Top et bottom plate perimeter */
208           } mim               ;
209          struct
210           {
211             double L,W        ;                    /* POLY/NWELL capacitance        */
212           } pnwell            ;
213        } data                 ;
214   } locap_info                ;
215 
216 
217 /*********************************** Resistor ***************************************/
218 
219 #define RESMIM    0                                /* Metal-Inter-Metal type        */
220 
221 #define IsResMIM(type)    ((type == RESMIM)    ? 1 : 0)
222 
223 
224 typedef struct lores                               /* analog resistor               */
225   {
226     struct lores  *NEXT       ;                    /* next resistor                 */
227     struct locon  *RCON1      ;                    /* first connector               */
228     struct locon  *RCON2      ;                    /* second connector              */
229     char          *NAME       ;                    /* resistor instance name        */
230     double        RESI        ;                    /* resistance value (ohms)       */
231     char          TYPE        ;                    /* resistor type                 */
232     struct ptype  *USER       ;                    /* application specific          */
233 } lores_list                  ;
234 
235 
236 /*************************** Complementary resistor information *********************/
237 
238 /* The structure is put in the USER field of the resistor */
239 /* with the LORES_INFO ptype                              */
240 
241 #define LORES_INFO 200208073                       /* USER field code               */
242 
243 typedef struct s_lores_info
244   {
245     double L,W                ;
246   } lores_info                ;
247 
248 
249 /************************************ Inductor **************************************/
250 
251 #define SELFMIM    0                               /* Metal-Inter-Metal type        */
252 
253 #define IsSelfMIM(type)    ((type == SELFMIM)    ? 1 : 0)
254 
255 typedef struct loself                              /* analog inductor               */
256   {
257     struct loself *NEXT       ;                    /* next inductor                 */
258     struct locon  *SCON1      ;                    /* first connector               */
259     struct locon  *SCON2      ;                    /* second connector              */
260     char          *NAME       ;                    /* inductor instance name        */
261     double        SELF        ;                    /* inductance value (unite H)    */
262     char          TYPE        ;                    /* inductor type                 */
263     struct ptype  *USER       ;                    /* application specific          */
264 } loself_list                 ;
265 
266 
267 
268 /************************************************************************************/
269 /************************************************************************************/
270 /************************************************************************************/
271 
272 
273 /*******************************************************************************
274 * externals for mbk netlist view                                               *
275 *******************************************************************************/
276   extern lofig_list *HEAD_LOFIG;                 /* physical figure list head   */
277   extern    lofig_list * addlofig __P((const char *name));
278   extern    lofig_list * addlomodel __P((lofig_list *model, const char *name));
279 
280   extern    loins_list * addloins __P((lofig_list *ptfig, const char *insname, lofig_list *ptnewfig, chain_list *sigchain));
281   extern    lotrs_list * addlotrs __P((lofig_list *ptfig, char type, long x, long y, long width, long length, long ps, long pd, long xs, long xd, losig_list *ptgrid, losig_list *ptsource, losig_list *ptdrain, losig_list *ptbulk, const char *name));
282   extern    locon_list * addlocon __P((lofig_list *ptfig, const char *name, losig_list *ptsig, char dir));
283   extern    losig_list * addlosig __P((lofig_list *ptfig, long index, chain_list *namechain, char type));
284   /* addlosig : field capa is not used */
285   /* addcapa disparait */
286   extern            int  dellofig __P((const char *name));
287   extern           void  freelomodel __P((lofig_list *ptmodel));
288   extern            int  dellosig __P((lofig_list *ptfig, long index));
289   extern            int  delloins __P((lofig_list *ptfig, const char *insname));
290   extern            int  dellotrs __P((lofig_list *ptfig, lotrs_list *pttrs));
291   extern            int  dellocon __P((lofig_list *ptfig, const char *name));
292   extern    lofig_list * getlofig __P((const char *figname, char mode));
293   extern    lofig_list * getlomodel __P((lofig_list *ptmodel, const char *name));
294   extern    loins_list * getloins __P((lofig_list *ptfig, const char *name));
295   extern    locon_list * getlocon __P((lofig_list *ptfig, const char *name));
296   extern    losig_list * getlosig __P((lofig_list *ptfig, long index));
297   extern    lotrs_list * getlotrs __P((lofig_list *ptfig, const char *name));
298   extern          char * getsigname __P((losig_list *ptsig));
299   extern           void  lofigchain __P((lofig_list *ptfig));
300   extern           void  viewlo __P(());
301   extern           void  setsigsize __P((lofig_list*, long));
302   extern           long  getsigsize __P((lofig_list* ));
303   extern           void  dellosiguser __P((losig_list*));
304   extern           void  dellotrsuser __P((lotrs_list*));
305   extern           void  delloinsuser __P((loins_list*));
306   extern           void  delloconuser __P((locon_list*));
307   extern           void  dellofiguser __P((lofig_list*));
308 
309 /*************************** Analogical world ***************************************/
310 
311 extern locap_list *addlocap __P((lofig_list *ptfig,char type,double capa,losig_list *pttplate,
312                                  losig_list *ptbplate,char *name))                                                       ;
313 extern int dellocap __P((lofig_list *ptfig,locap_list *ptcap))                                                           ;
314 extern locap_list *getlocap __P((lofig_list *ptfig,const char *name))                                                    ;
315 extern void setlocap __P((lofig_list *ptfig,const char *name,double capa))                                               ;
316 extern void dellocapuser __P((locap_list *))                                                                             ;
317 extern void  viewlocap __P((locap_list *ptcap))                                                                          ;
318 
319 extern lores_list *addlores __P((lofig_list *ptfig,char type,double resi,losig_list *ptrcon1,
320                                  losig_list *ptrcon2,char *name))                                                        ;
321 extern int dellores __P((lofig_list *ptfig,lores_list *ptres))                                                           ;
322 extern lores_list *getlores __P((lofig_list *ptfig,const char *name))                                                    ;
323 extern void setlores __P((lofig_list *ptfig,const char *name,double resi))                                               ;
324 extern void delloresuser __P((lores_list *))                                                                             ;
325 extern void  viewlores __P((lores_list *ptres))                                                                          ;
326 
327 extern loself_list *addloself __P((lofig_list *ptfig,char type,double self,losig_list *ptscon1,
328                                    losig_list *ptscon2,char *name))                                                      ;
329 extern int delloself __P((lofig_list *ptfig,loself_list *ptself))                                                        ;
330 extern loself_list *getloself __P((lofig_list *ptfig,const char *name))                                                  ;
331 extern void setloself __P((lofig_list *ptfig,const char *name,double self))                                              ;
332 extern void delloselfuser __P((loself_list *))                                                                           ;
333 extern void  viewloself __P((loself_list *ptself))                                                                       ;
334 
335 /************************************************************************************/
336 
337 #ifdef __cplusplus
338 }
339 #endif /* __cplusplus */
340 
341 #endif /* !MLO */
342