1 /****************************************************************************/
3 /* Chaine de CAO & VLSI AVERTEC */
5 /* Produit : Grammar for Verilog */
6 /* Fichier : bgl_error.c */
8 /* (c) copyright 2000 AVERTEC */
9 /* Tous droits reserves */
11 /* Auteur(s) : Anthony LESTER */
14 /****************************************************************************/
21 #include "bgl_parse.h"
23 /* ###--------------------------------------------------------------### */
24 /* function : bgl_error */
25 /* ###--------------------------------------------------------------### */
27 bgl_error(int code
, char *str1
, bgl_bcompcontext
*context
)
33 avt_errmsg(BGL_ERRMSG
,"001",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
,str1
);
34 // fprintf(stderr, "`%s` is incompatible with the entity name\n", str1);
37 avt_errmsg(BGL_ERRMSG
,"002",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
);
38 // fprintf(stderr, "bad entity declaration\n");
41 avt_errmsg(BGL_ERRMSG
,"003",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
);
42 // fprintf(stderr, "bad port clause declaration\n");
45 avt_errmsg(BGL_ERRMSG
,"004",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
,str1
);
46 // fprintf(stderr, "port `%s` already declared\n", str1);
49 avt_errmsg(BGL_ERRMSG
,"005",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
,str1
);
50 // fprintf(stderr, "illegal port declaration `%s` (mode, type, guard mark)\n", str1);
53 avt_errmsg(BGL_ERRMSG
,"006",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
);
54 // fprintf(stderr, "bad port declaration\n");
57 avt_errmsg(BGL_ERRMSG
,"007",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
,str1
);
58 // fprintf(stderr, "`%s` is incompatible with the architecture name\n", str1);
61 avt_errmsg(BGL_ERRMSG
,"008",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
);
62 // fprintf(stderr, "bad architecture declaration\n");
65 avt_errmsg(BGL_ERRMSG
,"009",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
);
66 // fprintf(stderr, "illegal declaration\n");
69 avt_errmsg(BGL_ERRMSG
,"010",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
,str1
);
70 // fprintf(stderr, "signal `%s` already declared\n", str1);
73 avt_errmsg(BGL_ERRMSG
,"011",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
,str1
);
74 // fprintf(stderr, "illegal signal declaration `%s` (type, guard mark)\n", str1);
77 avt_errmsg(BGL_ERRMSG
,"012",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
,str1
);
78 // fprintf(stderr, "component `%s` already declared\n", str1);
81 avt_errmsg(BGL_ERRMSG
,"013",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
,str1
);
82 // fprintf(stderr, "instance `%s` already declared\n", str1);
85 avt_errmsg(BGL_ERRMSG
,"014",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
,str1
);
86 // fprintf(stderr, "`%s` unknown component\n", str1);
89 avt_errmsg(BGL_ERRMSG
,"015",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
);
90 // fprintf(stderr, "illegal usage of implicit port map description\n");
93 avt_errmsg(BGL_ERRMSG
,"016",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
,str1
);
94 // fprintf(stderr, "`%s` unknown local port\n", str1);
97 avt_errmsg(BGL_ERRMSG
,"017",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
,str1
);
98 // fprintf(stderr, "`%s` unknown port or signal\n", str1);
101 avt_errmsg(BGL_ERRMSG
,"018",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
);
102 // fprintf(stderr, "illegal concurrent statement\n");
105 avt_errmsg(BGL_ERRMSG
,"019",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
);
106 // fprintf(stderr, "bad signal association\n");
109 avt_errmsg(BGL_ERRMSG
,"020",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
);
110 // fprintf(stderr, "null array not supported\n");
113 avt_errmsg(BGL_ERRMSG
,"021",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
);
114 // fprintf(stderr, "illegal constraint in declaration of type\n");
117 avt_errmsg(BGL_ERRMSG
,"022",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
,str1
);
118 // fprintf(stderr, "signal `%s` used out of declared range\n", str1);
121 avt_errmsg(BGL_ERRMSG
,"023",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
);
122 // fprintf(stderr, "width or/and type mismatch\n");
125 avt_errmsg(BGL_ERRMSG
,"024",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
,str1
);
126 // fprintf(stderr, "port `%s` connected to more than one signal\n", str1);
129 avt_errmsg(BGL_ERRMSG
,"025",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
);
130 // fprintf(stderr, "can only assign to/from an external connector\n");
133 avt_errmsg(BGL_ERRMSG
,"026",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
,str1
);
134 // fprintf(stderr, "instance %s mismatch with the model\n", str1);
137 avt_errmsg(BGL_ERRMSG
,"027",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
);
138 // fprintf(stderr, "Unhandled feature\n");
141 avt_errmsg(BGL_ERRMSG
,"028",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
,str1
);
142 // fprintf(stderr, "%s\n",str1);
145 avt_errmsg(BGL_ERRMSG
,"029",AVT_FATAL
);
146 // fprintf(stderr, "Cannot open result file\n");
149 avt_errmsg(BGL_ERRMSG
,"030",AVT_FATAL
);
150 // fprintf(stderr, "\n cannot continue further more.\n");
151 // fprintf(stderr, "\n Have a nice day...\n");
155 avt_errmsg(BGL_ERRMSG
,"031",AVT_FATAL
,context
->FILENAME
,context
->LINENUM
);
156 // fprintf(stderr, "syntax error\n");
160 if (context
->ERRFLG
> V_INT_TAB
[__VERILOG_MAXERR
].VALUE
) {
161 // fprintf(stderr, "Too many errors. Cannot continue further more\n");
162 // fprintf(stderr, "\n Have a nice day...\n");
163 bgl_bcompclean(context
);
164 avt_errmsg(BGL_ERRMSG
,"032",AVT_FATAL
);
170 /* ###--------------------------------------------------------------### */
171 /* function : bgl_warning */
172 /* content : print out warning messages on the standard error output */
173 /* ###--------------------------------------------------------------### */
175 bgl_warning(int code
, char *str1
)
177 static char first_time
= 0;
181 if (first_time
!= 1) {
182 avt_errmsg(BGL_ERRMSG
,"036",AVT_WARNING
);
183 // fprintf(stderr, "Warning %d : ", code);
184 // fprintf(stderr, "consistency checks will be disabled\n");
190 avt_errmsg(BGL_ERRMSG
,"038",AVT_WARNING
,"500",str1
);
191 // fprintf(stderr, "Warning : connection missing on port `%s`\n",
197 // fprintf(stderr, "Warning %d : ", code);
198 // fprintf(stderr, "unknown Warning code\n");
203 /* ###--------------------------------------------------------------### */
204 /* function : bgl_toolbug */
205 /* content : print out bugs messages on the standard error output */
206 /* ###--------------------------------------------------------------### */
208 bgl_toolbug(int code
, char *str1
, char *str2
, int nbr1
, bgl_bcompcontext
*context
)
210 // fprintf(stderr, "Fatal error %d executing `%s`: ", code, str1);
213 bgl_bcompclean(context
);
214 avt_errmsg(BGL_ERRMSG
,"038",AVT_FATAL
,"000",str1
);
215 // fprintf(stderr, "decompiler called on empty lofig\n");
218 bgl_bcompclean(context
);
219 avt_errmsg(BGL_ERRMSG
,"038",AVT_FATAL
,"001",str1
);
222 #ifndef __ALL__WARNING__
223 // prevent warning ..anto..
229 /* ###--------------------------------------------------------------### */
230 /* function : bgl_message */
231 /* content : print out messages on the standard error output */
232 /* ###--------------------------------------------------------------### */
234 bgl_message(int code
, char *str1
, int nmb1
)
238 // fprintf(stderr, "bgl_message : code %d unknown.\n", code);
240 #ifndef __ALL__WARNING__
241 // prevent warning ..anto..
242 str1
=NULL
;nmb1
=0;code
=0;