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  * $Id: mph.h,v 1.5 2012/05/14 14:20:23 alliance Exp $
30  */
31 
32 #ifndef _MPH_H_
33 #define _MPH_H_
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif /* __cplusplus */
38 
39 #ifndef __P
40 # if defined(__STDC__) ||  defined(__GNUC__) || defined(__cplusplus)
41 #  define __P(x) x
42 # else
43 #  define __P(x) ()
44 # endif
45 #endif
46 
47 /* physical connector orientation  */
48 #define NORTH       'N'
49 #define EAST        'E'
50 #define SOUTH       'S'
51 #define WEST        'W'
52 
53 /* physical segment type */
54 #define LEFT         'L'
55 #define UP           'U'
56 #define RIGHT        'R'
57 #define DOWN         'D'
58 
59 /* physical symetry type  */
60 #define NOSYM        0  /* vti : standart  */
61 #define ROT_P        1  /* vti : Rot90cc   */
62 #define SYMXY        2  /* vti : Rot180    */
63 #define ROT_M        3  /* vti : Rot90c    */
64 #define SYM_X        4  /* vti : mx(x=-x)  */
65 #define SY_RM        5  /* vti : mxRot90cc */
66 #define SYM_Y        6  /* vti : my(y=-y)  */
67 #define SY_RP        7  /* vti : myRot90cc */
68 
69 enum {
70 /* physical contact type  */
71    CONT_POLY,
72    CONT_DIF_N,
73    CONT_DIF_P,
74    CONT_BODY_N,
75    CONT_BODY_P,
76    CONT_VIA,
77    CONT_VIA2,
78    CONT_VIA3,
79    CONT_VIA4,
80    CONT_VIA5,
81    CONT_VIA6,
82    CONT_VIA7,
83    CONT_VIA8,
84    CONT_POLY2,
85 
86 /* physical transistor flood fill macros */
87    C_X_N,
88    C_X_P,
89 
90 /* turn via */
91    CONT_TURN1,
92    CONT_TURN2,
93    CONT_TURN3,
94    CONT_TURN4,
95    CONT_TURN5,
96    CONT_TURN6,
97    CONT_TURN7,
98    CONT_TURN8,
99    CONT_TURN9
100 };
101 
102 #define LAST_CONTACT  CONT_TURN9
103 
104 enum {
105 /* physical layer code */
106    NWELL,
107    PWELL,
108    NTIE,
109    PTIE,
110    NDIF,
111    PDIF,
112    NTRANS,
113    PTRANS,
114    NTRANS_FAST,
115    PTRANS_FAST,
116    NTRANS_HVIO,
117    PTRANS_HVIO,
118    POLY,
119    POLY2,
120    ALU1,
121    ALU2,
122    ALU3,
123    ALU4,
124    ALU5,
125    ALU6,
126    ALU7,
127    ALU8,
128    ALU9,
129 /* lack of layer */
130    TPOLY,
131    TPOLY2,
132    TALU1,
133    TALU2,
134    TALU3,
135    TALU4,
136    TALU5,
137    TALU6,
138    TALU7,
139    TALU8,
140    TALU9,
141 /* connector segment layer code */
142    CALU1,
143    CALU2,
144    CALU3,
145    CALU4,
146    CALU5,
147    CALU6,
148    CALU7,
149    CALU8,
150    CALU9
151 };
152 
153 #define LAST_LAYER   CALU9
154 
155 /*******************************************************************************
156 * layout structures types                                                      *
157 *******************************************************************************/
158 typedef struct phfig                           /* physical figure             */
159 {
160 struct phfig *NEXT;                            /* next figure                 */
161 struct chain *MODELCHAIN;                      /* list of models              */
162 struct phseg *PHSEG;                           /* segment list head           */
163 struct phvia *PHVIA;                           /* contact list head           */
164 struct phref *PHREF;                           /* reference list head         */
165 struct phins *PHINS;                           /* instance list head          */
166 struct phcon *PHCON;                           /* connector list head         */
167 char         *NAME;                            /* figure name (unique)        */
168 char         MODE;                             /* if 'A' all , else perif     */
169 long         XAB1,YAB1,XAB2,YAB2;              /* abutment box coordinates    */
170 struct ptype *USER;                            /* Application specific        */
171 }
172 phfig_list;
173 
174 typedef struct phcon                           /* physical connector          */
175 {
176 struct phcon *NEXT;                            /* next connector              */
177 char         *NAME;                            /* connector name              */
178 long         INDEX;                            /* connector index(unique)     */
179 long         XCON,YCON;                        /* connector coordinates       */
180 long         WIDTH;                            /* connector width             */
181 char         ORIENT;                           /* possible values: N E S W    */
182 char         LAYER;                            /* physical layer              */
183 struct ptype *USER;                            /* Application specific        */
184 }
185 phcon_list;
186 
187 typedef struct phseg                           /* physical (symbolic) segment */
188 {
189 struct phseg    *NEXT;                         /* next segment                */
190 char            *NAME;                         /* segment name                */
191 long             X1,Y1,X2,Y2;                  /* segment coordinates         */
192 long             WIDTH;                        /* segment width               */
193 char             TYPE;                         /* possibles values: L U R D   */
194 char             LAYER;                        /* physical layer              */
195 struct ptype    *USER;                         /* Application specific        */
196 }
197 phseg_list;
198 
199 typedef struct phvia                           /* physical contact            */
200 {
201 struct phvia    *NEXT;                         /* next contact                */
202 char            *NAME;                         /* via name                    */
203 char             TYPE;                         /* contact type: see define    */
204 long             XVIA,YVIA;                    /* coordinates                 */
205 long             DX,DY;                        /* size of big vias            */
206 struct ptype    *USER;                         /* Application specific        */
207 }
208 phvia_list;
209 
210 typedef struct phref                           /* physical reference          */
211 {
212 struct phref    *NEXT;                         /* next reference              */
213 char            *FIGNAME;                      /* reference type              */
214 char            *NAME;                         /* reference name (unique)     */
215 long             XREF,YREF;                    /* coordinates                 */
216 struct ptype    *USER;                         /* Application specific        */
217 }
218 phref_list;
219 
220 typedef struct phins                           /* physical instance           */
221 {
222 struct phins    *NEXT;                         /* next instance               */
223 char            *INSNAME;                      /* instance name (unique)      */
224 char            *FIGNAME;                      /* model name                  */
225 long             XINS,YINS;                    /* coordinates                 */
226 char             TRANSF;                       /* possible values: cf define  */
227 struct ptype    *USER;                         /* Application specific        */
228 }
229 phins_list;
230 
231 /*******************************************************************************
232 * externals for physical view                                                  *
233 *******************************************************************************/
234 extern phfig_list *HEAD_PHFIG;                 /* physical figure list head   */
235   extern    phfig_list * addphfig __P((const char *figname));
236   extern    phins_list * addphins __P((phfig_list *ptfig, const char *figname, const char *insname, char sym, long x, long y));
237   extern    phvia_list * addphvia __P((phfig_list *ptfig, char viatype, long x, long y, long dx, long dy, const char *name));
238   extern    phref_list * addphref __P((phfig_list *ptfig, const char *type, const char *name, long x, long y));
239   extern    phseg_list * addphseg __P((phfig_list *ptfig, char layer, long width, long x1, long y1, long x2, long y2, const char *nodename));
240   extern    phcon_list * addphcon __P((phfig_list *ptfig, char orient, const char *conname, long x, long y, char layer, long width));
241   extern           void  defab __P((phfig_list *ptfig, long x1, long y1, long x2, long y2));
242   extern    phfig_list * getphfig __P((const char *figname, char mode));
243   extern    phins_list * getphins __P((phfig_list *ptfig, const char *insname));
244   extern    phcon_list * getphcon __P((phfig_list *ptfig, const char *conname, long index));
245   extern    phref_list * getphref __P((phfig_list *ptfig, const char *refname));
246   extern            int  delphcon __P((phfig_list *ptfig, phcon_list *ptdelcon));
247   extern            int  delphins __P((phfig_list *ptfig, const char *insname));
248   extern            int  delphfig __P((const char *name));
249   extern            int  delphvia __P((phfig_list *ptfig, phvia_list *ptvia));
250   extern            int  delphseg __P((phfig_list *ptfig, phseg_list *ptseg));
251   extern            int  delphref __P((phfig_list *ptfig, phref_list *ptref));
252   extern           void  xyflat __P((long *xout, long *yout, long x, long y, long xins, long yins, long x1, long y1, long x2, long y2, char trsf));
253   extern           void  invxyflat __P((long *x, long *y, long xout, long yout, long xins, long yins, long x1, long y1, long x2, long y2, char trsf));
254   extern           void  viewph __P(());
255 
256 #ifdef __cplusplus
257 }
258 #endif /* __cplusplus */
259 
260 #endif /* !MPH */
261