2 * This file is part of the Alliance CAD System
3 * Copyright (C) Laboratoire LIP6 - Département ASIM
4 * Universite Pierre et Marie Curie
6 * Home page : http://www-asim.lip6.fr/alliance/
7 * E-mail support : mailto:alliance-support@asim.lip6.fr
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.
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.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
24 /* ###--------------------------------------------------------------### */
26 /* file : mvl_parse.c */
27 /* date : Feb 15 1995 */
28 /* author : L.A TABUSSE & H.N. VUONG & P. BAZARGAN-SABET */
29 /* description : Parser VHDL --> MBK */
31 /* ###--------------------------------------------------------------### */
37 #include <sys/types.h>
42 #include "mvl_parse.h"
43 #include "mvl_utdef.h"
45 char MVL_MBKMOD
; /* The mode of getlofig */
46 char MVL_ERRFLG
= 0; /* if = 1 no structure is made */
47 int MVL_LINNUM
= 1; /* file's line number */
48 char MVL_CURFIL
[200]; /* current file's name */
50 struct dct_entry
**MVL_HSHTAB
; /* dictionnary's entry points */
52 extern void mvl_scomprestart (FILE*);
54 static int MVL_PRELOAD
= 0;
56 parsevhdlnetlist(libname
)
60 vhdlloadlofig(NULL
, libname
, 'A');
64 void vhdlloadlofig (pt_lofig
, figname
, mode
)
66 struct lofig
*pt_lofig
;
71 struct lofig
*pt_lofig_tmp
;
72 struct loins
*pt_loins
;
73 struct loins
*pt_loinsaux
;
74 struct locon
*pt_locon
;
75 struct locon
*pt_loconaux
;
76 struct losig
*pt_losig
;
77 struct losig
*pt_losigaux
;
79 char local_mbk_fast_mode
;
80 static int call_nbr
= 0;
85 suffix
= V_STR_TAB
[__MVL_FILE_SUFFIX
].VALUE
;
86 if (suffix
== NULL
) suffix
= IN_LO
;
87 sprintf(filename
,"%s.%s",figname
,suffix
);
89 else sprintf(filename
,"%s",figname
);
91 /* Initialization of some variables */
94 strcpy (MVL_CURFIL
, figname
);
96 /* FAST_MODE asked for MBK */
97 local_mbk_fast_mode
= FAST_MODE
;
100 if ((mode
!= 'A') && (mode
!= 'P') && (mode
!= 'C'))
102 printf("vhdlloadfig : Bad mode '%c' asked\n", mode
);
103 FAST_MODE
= local_mbk_fast_mode
;
108 mvl_scompin
= (FILE *) mbkfopen(figname
, suffix
, READ_TEXT
);
110 if(mvl_scompin
== NULL
)
112 (void)fprintf(stderr
,"\n*** mbk error *** can't open file : %s\n",
114 FAST_MODE
= local_mbk_fast_mode
;
118 /* TRACE_MODE asked for MBK */
119 if(TRACE_MODE
== 'Y')
121 (void)printf("\n--- mbk --- parsing file : %s in mode : %c\n",
125 MVL_LOFPNT
= pt_lofig
; /* passing main parameter */
126 MVL_TOPPNT
= pt_lofig
; /* passing main parameter */
129 mvl_scomprestart (mvl_scompin
);
133 /* -------------------------------------------------------------------*/
134 /* Parsing : If mode is P or A, then normal parsing, if mode is C */
135 /* then parsing of a new figure, then from the new one, we fill the */
137 /* -------------------------------------------------------------------*/
139 if((mode
== 'P') || (mode
== 'A'))
141 if(mvl_scompparse() != 0)
143 (void)fprintf(stderr
,"\n*** mbk error *** abnormal parsing for : %s\n",filename
);
144 FAST_MODE
= local_mbk_fast_mode
;
151 /* ---------------------------------------------------------------- */
152 /* Saving the lofig pointer, creating a new one to allow the */
153 /* parsing of the figure in 'A' mode. */
154 /* ---------------------------------------------------------------- */
155 pt_lofig_tmp
= pt_lofig
;
156 MVL_LOFPNT
= (lofig_list
*)mbkalloc(sizeof(lofig_list
));
157 MVL_LOFPNT
->MODE
= 'A';
158 MVL_LOFPNT
->NAME
= namealloc(figname
);
159 MVL_LOFPNT
->MODELCHAIN
= NULL
;
160 MVL_LOFPNT
->LOINS
= NULL
;
161 MVL_LOFPNT
->LOTRS
= NULL
;
162 MVL_LOFPNT
->LOCON
= NULL
;
163 MVL_LOFPNT
->LOSIG
= NULL
;
164 mbk_init_NewBKSIG(&MVL_LOFPNT
->BKSIG
);
165 MVL_LOFPNT
->USER
= NULL
;
166 MVL_LOFPNT
->NEXT
= NULL
;
170 if(mvl_scompparse() != 0)
172 (void)fprintf(stderr
,"\n*** mbk error *** abnormal parsing for : %s\n",filename
);
173 FAST_MODE
= local_mbk_fast_mode
;
176 /* ---------------------------------------------------------------- */
177 /* Now, with the new figure, we duplicate the new informations */
178 /* to fill the old one. */
179 /* ---------------------------------------------------------------- */
180 pt_lofig
= mvl_fill(pt_lofig_tmp
, MVL_LOFPNT
);
185 if(fclose(mvl_scompin
) != 0)
187 (void)fprintf(stderr
,"\n*** mbk error *** can't close file : %s\n",filename
);
188 FAST_MODE
= local_mbk_fast_mode
;
192 if(strcmp(IN_LO
,"vbe") == 0)
200 pt_locon
= MVL_LOFPNT
->LOCON
;
201 while (pt_locon
!= NULL
)
203 if (pt_locon
->TYPE
== 'I')
205 pt_loconaux
= pt_locon
;
206 pt_locon
= pt_locon
->NEXT
;
207 dellocon(MVL_LOFPNT
, pt_loconaux
->NAME
);
211 /* pt_locon->SIG = NULL; */
212 pt_locon
= pt_locon
->NEXT
;
215 pt_losig
= MVL_LOFPNT
->LOSIG
;
216 while (pt_losig
!= NULL
)
218 if (pt_losig
->TYPE
== 'E')
220 pt_losig
= pt_losig
->NEXT
;
223 pt_losigaux
= pt_losig
;
224 pt_losig
= pt_losig
->NEXT
;
225 dellosig(MVL_LOFPNT
, pt_losigaux
->INDEX
);
227 pt_loins
= MVL_LOFPNT
->LOINS
;
228 while (pt_loins
!= NULL
)
230 pt_loinsaux
= pt_loins
;
231 pt_loins
= pt_loins
->NEXT
;
232 delloins(MVL_LOFPNT
, pt_loinsaux
->INSNAME
);
235 FAST_MODE
= local_mbk_fast_mode
;