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 /*******************************************************************************
26 *                                                                              *
27 *  Tool        : Spice parser / driver v 7.00                                  *
28 *  Author(s)   : Gregoire AVOT                                                 *
29 *  Updates     : March, 18th 1998                                              *
30 *                                                                              *
31 *******************************************************************************/
32 
33 #ifndef SPI_PARSEH
34 #define SPI_PARSEH
35 
36 #define SPIEQUI 1664
37 
38 #define TAILLENOM 4096
39 
40 typedef struct s_circuit
41 {
42   struct s_noeud	*NOEUD;
43   struct s_trans	*TRANS;
44   struct s_resi		*RESI;
45   struct s_capa		*CAPA;
46   struct s_inst		*INST;
47   struct s_valim        *VALIM;
48   char			*NOM;
49   chain_list		*CINTERF;        /* DATA fiels : s_noeud */
50   chain_list		*FREE;
51   tableint		*INT_NOEUD;
52   thash                 *NOM_NOEUD;
53   thash			*HASHGNAME;
54   thash			*HASHCAPA;
55   thash			*HASHRESI;
56   thash			*HASHVALIM;
57   thash			*HASHINST;
58   thash			*HASHTRAN;
59   long                   TAILLE;
60   char                  *ALLOUENOM;
61   int                    RESTENOM;
62 } circuit;
63 
64 typedef struct s_noeud
65 {
66   struct s_noeud	*SUIV;
67   char			*NOM;
68   int			 SIGNAL;
69   int			 RCN;
70   int			 SPICE;
71 } noeud;
72 
73 typedef struct s_trans
74 {
75   struct s_trans	*SUIV;
76   struct s_noeud	*DRAIN;
77   struct s_noeud	*SOURCE;
78   struct s_noeud	*GRILLE;
79   struct s_noeud	*SUBST;
80   char			 TYPE;
81   char			*NOM;
82   float			 L;
83   float			 W;
84   float			 AS;
85   float			 AD;
86   float			 PS;
87   float			 PD;
88   float			 X;
89   float			 Y;
90 } trans;
91 
92 typedef struct s_inst
93 {
94   struct s_inst		*SUIV;
95   char			*NOM;
96   char			*MODELE;
97   chain_list		*IINTERF;
98 } inst;
99 
100 typedef struct s_resi
101 {
102   struct s_resi		*SUIV;
103   float			 RESI;
104   struct s_noeud	*N1;
105   struct s_noeud	*N2;
106   char			*NOM;
107   float			 CAPA;
108 } resi;
109 
110 typedef struct s_capa
111 {
112   struct s_capa		*SUIV;
113   float			 CAPA;
114   struct s_noeud	*N1;
115   struct s_noeud	*N2;
116   char			*NOM;
117 } capa;
118 
119 typedef struct s_valim
120 {
121   struct s_valim        *SUIV;
122   float                  TENSION;
123   struct s_noeud        *N1;
124   struct s_noeud        *N2;
125   char                  *NOM;
126 } valim;
127 
128 typedef struct s_interf
129 {
130    struct s_interf      *SUIV;
131    char                 *NOM;
132    chain_list           *GINTERF;        /* DATA field : char* nom des locons */
133 } ginterf;
134 
135 #define LONG_LIGNE 16384
136 
137 typedef struct s_spifile
138 {
139   FILE          *df;
140   chain_list    *decomp1;
141   chain_list    *decomp2;
142   char           file_line[LONG_LIGNE];
143   char           file_line1[LONG_LIGNE];
144   char           file_line2[LONG_LIGNE];
145   int		 msl_line;
146   char           *filename;
147 } spifile ;
148 
149 /* Fonctions d'allocation m�moire pour un circuit */
150 
151 void*		spiciralloue  __P(( circuit*, int ));
152 void		liberecircuit __P(( circuit* ));
153 
154 /* Fonctions pour parser le fichier au format Spice */
155 
156 circuit*	lirecircuit     __P(( spifile*, ginterf** ));
157 chain_list*	lireligne       __P(( spifile* ));
158 chain_list*	decompligne     __P(( spifile* ));
159 noeud*		ajoutenoeud     __P(( circuit*, char*, spifile* ));
160 void		nomenoeud       __P(( circuit*, noeud*, char*, spifile* ));
161 char*		spicenamealloc  __P(( circuit*, char* ));
162 void		affvuespice     __P(( circuit* ));
163 float		spicefloat      __P(( char*, int* ));
164 chain_list*     recupereinterf  __P(( char* ));
165 void            loconinterf     __P(( lofig_list*, chain_list* ));
166 ginterf*        traiteinclude   __P(( ginterf*, char* ));
167 char*		retireextention __P(( char *nom ));
168 lofig_list*	recuperemodele  __P(( lofig_list*, char*, chain_list* ));
169 ginterf*	constinterf     __P(( circuit*, ginterf* ));
170 ginterf*	spiceloading    __P(( lofig_list*, char*, char, ginterf* ));
171 spifile*        spifileopen     __P(( char* ));
172 void            spierror        __P(( int, char*, int ));
173 
174 /* Fonctions pour convertir la vue spice en vue Alliance */
175 
176 void		constequi      __P(( circuit*, ginterf* ));
177 void		constlofig     __P(( circuit*, lofig_list*, ginterf*, char));
178 void		triecapa       __P(( circuit* ));
179 long          	float2long     __P(( float ));
180 ptype_list*     constphinterf  __P(( ptype_list*, ginterf* ));
181 char*           spi_devect     __P(( char* ));
182 
183 int             nodenameisequi __P(( char*, char* ));
184 void            stopchainsepar __P(( char* ));
185 void            spi_dump_equi  __P(( char*, ptype_list* ));
186 void            taillevuespice __P(( circuit* ));
187 #endif
188