Initial version of donated sources by Avertec, 3.4p5.
[tas-yagle.git] / distrib / sources / tas / tlf / gcf.y
1 /******************************************************************************/
2 /* */
3 /* Chaine de CAO & VLSI AVERTEC */
4 /* */
5 /* Produit : GCF Version 1.00 */
6 /* Fichier : gcf.y */
7 /* */
8 /* (c) copyright 2000 AVERTEC */
9 /* Tous droits reserves */
10 /* */
11 /* Auteur(s) : Gilles Augustins */
12 /* */
13 /******************************************************************************/
14
15 %{
16 #include "tlf_parse.h"
17
18 /******************************************************************************/
19 /* private */
20 /******************************************************************************/
21
22 typedef struct gcf_edge {
23 long POSEDGE ;
24 long NEGEDGE ;
25 } gcf_edge ;
26
27 gcf_edge *ed ;
28 ht *clockht, *vclockht ;
29 chain_list *ch, *vclockchain = NULL ;
30 chain_list *chfrom, *chto ;
31 char clocktype ;
32 char *ckname, *ckalias, *alckalias, *chipname ;
33 char *srelative, *hrelative ;
34 long nfrom, nto ;
35 long tedge ;
36 float stablerise, unstablerise, stablefall, unstablefall ;
37 float setuprise, holdrise, setupfall, holdfall ;
38 float timescale ;
39
40 /******************************************************************************/
41 /* function declarations */
42 /******************************************************************************/
43
44 int yyerror ();
45 int yylex ();
46
47 %}
48
49 %union {
50 struct { struct chain *FROMLIST ; struct chain *TOLIST ; } arct ;
51 char *text ;
52 float real ;
53 struct chain *list ;
54 } ;
55
56 %start gcf_file
57
58 %token GCF_TOKEN_ARRIVAL
59 %token GCF_TOKEN_CELL
60 %token GCF_TOKEN_CLOCK
61 %token GCF_TOKEN_CSCALE
62 %token GCF_TOKEN_DATE
63 %token GCF_TOKEN_DELIM
64 %token GCF_TOKEN_DEPARTURE
65 %token GCF_TOKEN_DESIGN
66 %token GCF_TOKEN_DISABLE
67 %token <real> GCF_TOKEN_ENUMBER
68 %token GCF_TOKEN_ENVIRONMENT
69 %token GCF_TOKEN_EXCEPTIONS
70 %token GCF_TOKEN_FROM
71 %token GCF_TOKEN_GCF
72 %token GCF_TOKEN_GLOBALS
73 %token GCF_TOKEN_GLOBAL_SUBSET_TIMING
74 %token GCF_TOKEN_HEADER
75 %token <text> GCF_TOKEN_IDENT
76 %token GCF_TOKEN_LEFTPAR
77 %token GCF_TOKEN_NEGEDGE
78 %token <real> GCF_TOKEN_NUMBER
79 %token GCF_TOKEN_POSEDGE
80 %token <text> GCF_TOKEN_QSTRING
81 %token <text> GCF_TOKEN_QIDENT
82 %token GCF_TOKEN_RIGHTPAR
83 %token GCF_TOKEN_RSCALE
84 %token GCF_TOKEN_SUBSET_TIMING
85 %token GCF_TOKEN_STAR
86 %token GCF_TOKEN_TO
87 %token GCF_TOKEN_TSCALE
88 %token GCF_TOKEN_VERSION
89 %token GCF_TOKEN_VSCALE
90 %token GCF_TOKEN_WAVEFORM
91
92 %type <arct> arc
93 %type <text> clockspec
94 %type <text> nconnector
95 %type <list> from
96 %type <text> ident
97 %type <list> ident_list
98 %type <real> number
99 %type <list> to
100 %type <real> wnumber
101
102 %%
103
104 gcf_file : GCF_TOKEN_LEFTPAR gcf header globals cell GCF_TOKEN_RIGHTPAR
105 {
106 if (GCF_MODE == SPECOUT_DUMP) {
107 for (ch = vclockchain ; ch ; ch = ch->NEXT)
108 mbkfree(ch->DATA) ;
109 freechain (vclockchain) ;
110 }
111 }
112 ;
113
114 gcf : GCF_TOKEN_GCF
115 {
116 if (GCF_MODE == CLOCK_DETECT) {
117 clockht = addht (GCF_SIZEHCK) ;
118 vclockht = addht (GCF_SIZEHCK) ;
119 }
120
121 if (GCF_MODE == CLOCK_DUMP) {
122 fprintf (GCF_OUT, "\nclock connectors\nbegin\n") ;
123 }
124
125 if (GCF_MODE == SPECIN_DUMP) {
126 fprintf (GCF_OUT, "\nspecify input connectors\nbegin\n") ;
127 }
128
129 if (GCF_MODE == SPECOUT_DUMP) {
130 fprintf (GCF_OUT, "\nverify output connectors\nbegin\n") ;
131 }
132 }
133 ;
134
135 header : GCF_TOKEN_LEFTPAR GCF_TOKEN_HEADER version design date delimiters tscale cscale rscale vscale GCF_TOKEN_RIGHTPAR
136 {
137 if (GCF_MODE == CLOCK_DETECT) {
138 fprintf (GCF_OUT, "name %s ;\n", chipname) ;
139 fprintf (GCF_OUT, "version 1.00 ;\n") ;
140 fprintf (GCF_OUT, "setuptime 0 ;\n") ;
141 fprintf (GCF_OUT, "holdtime 0 ;\n") ;
142 }
143 }
144 ;
145
146 version : GCF_TOKEN_LEFTPAR GCF_TOKEN_VERSION GCF_TOKEN_QSTRING GCF_TOKEN_RIGHTPAR
147 | GCF_TOKEN_LEFTPAR GCF_TOKEN_VERSION GCF_TOKEN_QIDENT GCF_TOKEN_RIGHTPAR
148 ;
149
150 design : GCF_TOKEN_LEFTPAR GCF_TOKEN_DESIGN GCF_TOKEN_QSTRING GCF_TOKEN_RIGHTPAR
151 {
152 chipname = stm_unquote ($3) ;
153 }
154 | GCF_TOKEN_LEFTPAR GCF_TOKEN_DESIGN GCF_TOKEN_QIDENT GCF_TOKEN_RIGHTPAR
155 {
156 chipname = stm_unquote ($3) ;
157 }
158 ;
159
160 date : GCF_TOKEN_LEFTPAR GCF_TOKEN_DATE GCF_TOKEN_QSTRING GCF_TOKEN_RIGHTPAR
161 | GCF_TOKEN_LEFTPAR GCF_TOKEN_DATE GCF_TOKEN_QIDENT GCF_TOKEN_RIGHTPAR
162 ;
163
164 delimiters : GCF_TOKEN_LEFTPAR GCF_TOKEN_DELIM GCF_TOKEN_QSTRING GCF_TOKEN_RIGHTPAR
165 | GCF_TOKEN_LEFTPAR GCF_TOKEN_DELIM GCF_TOKEN_QIDENT GCF_TOKEN_RIGHTPAR
166 ;
167
168 tscale : GCF_TOKEN_LEFTPAR GCF_TOKEN_TSCALE number GCF_TOKEN_RIGHTPAR
169 {
170 timescale = $3 ;
171 }
172 ;
173
174 cscale : GCF_TOKEN_LEFTPAR GCF_TOKEN_CSCALE number GCF_TOKEN_RIGHTPAR
175 ;
176
177 rscale : GCF_TOKEN_LEFTPAR GCF_TOKEN_RSCALE number GCF_TOKEN_RIGHTPAR
178 ;
179
180 vscale : GCF_TOKEN_LEFTPAR GCF_TOKEN_VSCALE number GCF_TOKEN_RIGHTPAR
181 ;
182
183 globals : GCF_TOKEN_LEFTPAR GCF_TOKEN_GLOBALS globtmgsubset GCF_TOKEN_RIGHTPAR
184 ;
185
186 globtmgsubset : GCF_TOKEN_LEFTPAR GCF_TOKEN_GLOBAL_SUBSET_TIMING wave_list GCF_TOKEN_RIGHTPAR
187 {
188 if (GCF_MODE == CLOCK_DUMP) {
189 fprintf (GCF_OUT, "end ;\n") ;
190 }
191 }
192 ;
193
194 wave_list : empty
195 | wave_list wave
196 ;
197
198 wave : GCF_TOKEN_LEFTPAR GCF_TOKEN_WAVEFORM clockname number edges GCF_TOKEN_RIGHTPAR
199 {
200 if (GCF_MODE == CLOCK_DUMP && clocktype == REAL_CLOCK)
201 fprintf (GCF_OUT, " period %ld ;\n", ftol ($4 * (1e12 * timescale))) ;
202 }
203 ;
204
205 clockname : GCF_TOKEN_QIDENT
206 {
207 if (GCF_MODE == CLOCK_DUMP) {
208 ckalias = stm_unquote ($1) ;
209 alckalias = namealloc (ckalias) ;
210 ckname = (char*)gethtitem (clockht, alckalias) ;
211 if ((long)ckname == EMPTYHT) {
212 clocktype = VIRTUAL_CLOCK ;
213 ed = (gcf_edge*) mbkalloc (sizeof (struct gcf_edge)) ;
214 addhtitem (vclockht, alckalias, (long)ed) ;
215 vclockchain = addchain (vclockchain, ed) ;
216 } else {
217 fprintf (GCF_OUT, " %s :\n", ckname) ;
218 clocktype = REAL_CLOCK ;
219 }
220 }
221 }
222 ;
223
224 edges : posedge negedge
225 | negedge posedge
226 ;
227
228 posedge : GCF_TOKEN_LEFTPAR GCF_TOKEN_POSEDGE number GCF_TOKEN_RIGHTPAR
229 {
230 if (GCF_MODE == CLOCK_DUMP && clocktype == REAL_CLOCK)
231 fprintf (GCF_OUT, " up %ld ;\n", ftol ($3 * (1e12 * timescale))) ;
232 if (GCF_MODE == CLOCK_DUMP && clocktype == VIRTUAL_CLOCK) {
233 ed->POSEDGE = ftol ($3 * (1e12 * timescale)) ;
234 }
235 }
236 ;
237
238 negedge : GCF_TOKEN_LEFTPAR GCF_TOKEN_NEGEDGE number GCF_TOKEN_RIGHTPAR
239 {
240 if (GCF_MODE == CLOCK_DUMP && clocktype == REAL_CLOCK)
241 fprintf (GCF_OUT, " down %ld ;\n", ftol ($3 * (1e12 * timescale))) ;
242 if (GCF_MODE == CLOCK_DUMP && clocktype == VIRTUAL_CLOCK) {
243 ed->NEGEDGE = ftol ($3 * (1e12 * timescale)) ;
244 }
245 }
246 ;
247
248 cell : GCF_TOKEN_LEFTPAR GCF_TOKEN_CELL celldef tmgsubset parasubset GCF_TOKEN_RIGHTPAR
249 ;
250
251 celldef : GCF_TOKEN_LEFTPAR GCF_TOKEN_RIGHTPAR
252 ;
253
254 tmgsubset : GCF_TOKEN_LEFTPAR GCF_TOKEN_SUBSET_TIMING tmgsubsetenv tmgsubsetexc GCF_TOKEN_RIGHTPAR
255 ;
256
257 tmgsubsetenv : GCF_TOKEN_LEFTPAR GCF_TOKEN_ENVIRONMENT event_list GCF_TOKEN_RIGHTPAR
258 {
259 if (GCF_MODE == SPECIN_DUMP || GCF_MODE == SPECOUT_DUMP) {
260 fprintf (GCF_OUT, "end ;\n") ;
261 }
262 }
263 ;
264
265 tmgsubsetexc : GCF_TOKEN_LEFTPAR beginexcept except_list GCF_TOKEN_RIGHTPAR
266 {
267 if (GCF_MODE == DISABLE_DUMP)
268 fprintf (GCF_OUT, "end ;\n") ;
269 }
270 ;
271
272
273 beginexcept : GCF_TOKEN_EXCEPTIONS
274 {
275 if (GCF_MODE == DISABLE_DUMP)
276 fprintf (GCF_OUT, "\ndisable\nbegin\n") ;
277
278 }
279 ;
280 except_list : empty
281 | except_list except
282 ;
283
284 except : GCF_TOKEN_LEFTPAR GCF_TOKEN_DISABLE arc GCF_TOKEN_RIGHTPAR
285 {
286 if (GCF_MODE == DISABLE_DUMP) {
287 if ($3.FROMLIST && $3.TOLIST) {
288 for (chfrom = $3.FROMLIST ; chfrom ; chfrom = chfrom->NEXT) {
289 nfrom = gethtitem (clockht, namealloc ((char*)chfrom->DATA)) ;
290 for (chto = $3.TOLIST ; chto ; chto = chto->NEXT) {
291 nto = gethtitem (clockht, namealloc ((char*)chto->DATA)) ;
292 if (nfrom != EMPTYHT && nto != EMPTYHT)
293 fprintf (GCF_OUT, " from %s to %s ;\n", (char*)nfrom, (char*)nto) ;
294 }
295 }
296 freechain ($3.FROMLIST) ;
297 freechain ($3.TOLIST) ;
298 }
299 if (!$3.FROMLIST && $3.TOLIST) {
300 for (chto = $3.TOLIST ; chto ; chto = chto->NEXT) {
301 nto = gethtitem (clockht, namealloc ((char*)chto->DATA)) ;
302 if (nto != EMPTYHT)
303 fprintf (GCF_OUT, " to %s ;\n", (char*)nto) ;
304 }
305 freechain ($3.TOLIST) ;
306 }
307 if ($3.FROMLIST && !$3.TOLIST) {
308 for (chfrom = $3.FROMLIST ; chfrom ; chfrom = chfrom->NEXT) {
309 nfrom = gethtitem (clockht, namealloc ((char*)chfrom->DATA)) ;
310 if (nfrom != EMPTYHT)
311 fprintf (GCF_OUT, " from %s ;\n", (char*)nfrom) ;
312 }
313 freechain ($3.FROMLIST) ;
314 }
315 }
316 }
317 ;
318
319 arc : GCF_TOKEN_LEFTPAR from to GCF_TOKEN_RIGHTPAR
320 {
321 if (GCF_MODE == DISABLE_DUMP) {
322 $$.FROMLIST = $2 ;
323 $$.TOLIST = $3 ;
324 }
325 }
326 | from
327 {
328 if (GCF_MODE == DISABLE_DUMP) {
329 $$.FROMLIST = $1 ;
330 $$.TOLIST = NULL ;
331 }
332 }
333 | to
334 {
335 if (GCF_MODE == DISABLE_DUMP) {
336 $$.FROMLIST = NULL ;
337 $$.TOLIST = $1 ;
338 }
339 }
340 ;
341
342 from : GCF_TOKEN_LEFTPAR GCF_TOKEN_FROM ident_list GCF_TOKEN_RIGHTPAR
343 {
344 if (GCF_MODE == DISABLE_DUMP)
345 $$ = $3 ;
346 }
347 ;
348
349 to : GCF_TOKEN_LEFTPAR GCF_TOKEN_TO ident_list GCF_TOKEN_RIGHTPAR
350 {
351 if (GCF_MODE == DISABLE_DUMP)
352 $$ = $3 ;
353 }
354 ;
355
356 ident_list : ident
357 {
358 $$ = addchain (NULL, $1) ;
359 }
360 | ident ident_list
361 {
362 $$ = addchain ($2, $1) ;
363 }
364 ;
365
366 event_list : event
367 | event_list event
368 ;
369
370 event : arrival
371 | departure
372 | clock
373 ;
374
375 nconnector : GCF_TOKEN_IDENT
376 {
377 $$ = $1 ;
378 }
379 | empty
380 {
381 $$ = "default" ;
382 }
383 ;
384
385 arrival : GCF_TOKEN_LEFTPAR GCF_TOKEN_ARRIVAL clockspec number number number number nconnector GCF_TOKEN_RIGHTPAR
386 {
387 if (GCF_MODE == SPECIN_DUMP) {
388 stablerise = $4 ;
389 unstablerise = $5 ;
390 stablefall = $6 ;
391 unstablefall = $7 ;
392 alckalias = namealloc (ckalias) ;
393 ckname = (char*)gethtitem (clockht, alckalias) ;
394 fprintf (GCF_OUT, " %s rising :\n", $8) ;
395 if ((long)ckname == EMPTYHT) {
396 ed = (gcf_edge*)gethtitem (vclockht, alckalias) ;
397 if ((long)ed != EMPTYHT) {
398 if (!strcmp ("rising", $3))
399 tedge = ed->POSEDGE ;
400 else
401 tedge = ed->NEGEDGE ;
402 fprintf (GCF_OUT, " stable %ld ;\n",
403 ftolstretch (stablerise * (1e12 * timescale)) + tedge) ;
404 fprintf (GCF_OUT, " unstable %ld ;\n",
405 ftolstretch (unstablerise * (1e12 * timescale)) + tedge) ;
406 }
407 } else {
408 fprintf (GCF_OUT, " stable %ld after %s %s ;\n",
409 ftolstretch (stablerise * (1e12 * timescale)), ckname, $3) ;
410 fprintf (GCF_OUT, " unstable %ld after %s %s ;\n",
411 ftolstretch (unstablerise * (1e12 * timescale)), ckname, $3) ;
412 }
413 fprintf (GCF_OUT, " %s falling :\n", $8) ;
414 if ((long)ckname == EMPTYHT) {
415 ed = (gcf_edge*)gethtitem (vclockht, alckalias) ;
416 if ((long)ed != EMPTYHT) {
417 if (!strcmp ("rising", $3))
418 tedge = ed->POSEDGE ;
419 else
420 tedge = ed->NEGEDGE ;
421 fprintf (GCF_OUT, " stable %ld ;\n",
422 ftolstretch (stablefall * (1e12 * timescale)) + tedge) ;
423 fprintf (GCF_OUT, " unstable %ld ;\n",
424 ftolstretch (unstablefall * (1e12 * timescale)) + tedge) ;
425 }
426 } else {
427 fprintf (GCF_OUT, " stable %ld after %s %s ;\n",
428 ftolstretch (stablefall * (1e12 * timescale)), ckname, $3) ;
429 fprintf (GCF_OUT, " unstable %ld after %s %s ;\n",
430 ftolstretch (unstablefall * (1e12 * timescale)), ckname, $3) ;
431 }
432 }
433 }
434 ;
435
436 departure : GCF_TOKEN_LEFTPAR GCF_TOKEN_DEPARTURE clockspec wnumber wnumber wnumber wnumber nconnector GCF_TOKEN_RIGHTPAR
437 {
438 if (GCF_MODE == SPECOUT_DUMP) {
439 setuprise = $4 ;
440 setupfall = $5 ;
441 holdrise = $6 ;
442 holdfall = $7 ;
443 alckalias = namealloc (ckalias) ;
444 ckname = (char*)gethtitem (clockht, alckalias) ;
445
446 /* rising */
447
448 if ((long)ckname == EMPTYHT) {
449 ed = (gcf_edge*)gethtitem (vclockht, alckalias) ;
450 if ((long)ed != EMPTYHT) {
451 if (!strcmp ("rising", $3))
452 tedge = ed->POSEDGE ;
453 else
454 tedge = ed->NEGEDGE ;
455 if (holdrise == DC && holdfall == DC && setuprise != DC && setupfall != DC) {
456 fprintf (GCF_OUT, " %s rising :\n", $8) ;
457 fprintf (GCF_OUT, " stable %ld ;\n",
458 tedge - ftolstretch (setuprise * (1e12 * timescale))) ;
459 fprintf (GCF_OUT, " unstable %ld ;\n",
460 tedge - ftolstretch (setuprise * (1e12 * timescale)) - 1) ; /* hold = setup - 1 */
461 }
462 else if (holdrise != DC && holdfall != DC && setuprise != DC && setupfall != DC) {
463 fprintf (GCF_OUT, " %s rising :\n", $8) ;
464 fprintf (GCF_OUT, " stable %ld ;\n",
465 tedge - ftolstretch (setuprise * (1e12 * timescale))) ;
466 fprintf (GCF_OUT, " unstable %ld ;\n",
467 ftolstretch (holdrise * (1e12 * timescale)) + tedge) ;
468 }
469 else if (holdrise != DC && holdfall != DC && setuprise == DC && setupfall == DC) {
470 fprintf (GCF_OUT, " %s rising :\n", $8) ;
471 fprintf (GCF_OUT, " stable %ld ;\n",
472 ftolstretch (holdrise * (1e12 * timescale)) + tedge + 1) ; /* setup = hold + 1 */
473 fprintf (GCF_OUT, " unstable %ld ;\n",
474 ftolstretch (holdrise * (1e12 * timescale)) + tedge) ;
475 }
476 }
477 } else {
478 if (holdrise == DC && holdfall == DC && setuprise != DC && setupfall != DC) {
479 fprintf (GCF_OUT, " %s rising :\n", $8) ;
480 fprintf (GCF_OUT, " stable %ld before %s %s ;\n",
481 ftolstretch (setuprise * (1e12 * timescale)), ckname, $3) ;
482 fprintf (GCF_OUT, " unstable %ld before %s %s ;\n",
483 ftolstretch (setuprise * (1e12 * timescale)) - 1, ckname, $3) ; /* hold = setup - 1 */
484 }
485 else if (holdrise != DC && holdfall != DC && setuprise != DC && setupfall != DC) {
486 fprintf (GCF_OUT, " %s rising :\n", $8) ;
487 fprintf (GCF_OUT, " stable %ld before %s %s ;\n",
488 ftolstretch (setuprise * (1e12 * timescale)), ckname, $3) ;
489 fprintf (GCF_OUT, " unstable %ld after %s %s ;\n",
490 ftolstretch (holdrise * (1e12 * timescale)), ckname, $3) ;
491 }
492 else if (holdrise != DC && holdfall != DC && setuprise == DC && setupfall == DC) {
493 fprintf (GCF_OUT, " %s rising :\n", $8) ;
494 fprintf (GCF_OUT, " stable %ld after %s %s ;\n",
495 ftolstretch (setuprise * (1e12 * timescale)) + 1, ckname, $3) ; /* setup = hold + 1 */
496 fprintf (GCF_OUT, " unstable %ld after %s %s ;\n",
497 ftolstretch (holdrise * (1e12 * timescale)), ckname, $3) ;
498 }
499 }
500
501 /* falling */
502
503 if ((long)ckname == EMPTYHT) {
504 ed = (gcf_edge*)gethtitem (vclockht, alckalias) ;
505 if ((long)ed != EMPTYHT) {
506 if (!strcmp ("falling", $3))
507 tedge = ed->POSEDGE ;
508 else
509 tedge = ed->NEGEDGE ;
510 if (holdfall == DC && holdfall == DC && setupfall != DC && setupfall != DC) {
511 fprintf (GCF_OUT, " %s falling :\n", $8) ;
512 fprintf (GCF_OUT, " stable %ld ;\n",
513 tedge - ftolstretch (setupfall * (1e12 * timescale))) ;
514 fprintf (GCF_OUT, " unstable %ld ;\n",
515 tedge - ftolstretch (setupfall * (1e12 * timescale)) - 1) ; /* hold = setup - 1 */
516 }
517 else if (holdfall != DC && holdfall != DC && setupfall != DC && setupfall != DC) {
518 fprintf (GCF_OUT, " %s falling :\n", $8) ;
519 fprintf (GCF_OUT, " stable %ld ;\n",
520 tedge - ftolstretch (setupfall * (1e12 * timescale))) ;
521 fprintf (GCF_OUT, " unstable %ld ;\n",
522 ftolstretch (holdfall * (1e12 * timescale)) + tedge) ;
523 }
524 else if (holdfall != DC && holdfall != DC && setupfall == DC && setupfall == DC) {
525 fprintf (GCF_OUT, " %s falling :\n", $8) ;
526 fprintf (GCF_OUT, " stable %ld ;\n",
527 ftolstretch (holdfall * (1e12 * timescale)) + tedge + 1) ; /* setup = hold + 1 */
528 fprintf (GCF_OUT, " unstable %ld ;\n",
529 ftolstretch (holdfall * (1e12 * timescale)) + tedge) ;
530 }
531 }
532 } else {
533 if (holdfall == DC && holdfall == DC && setupfall != DC && setupfall != DC) {
534 fprintf (GCF_OUT, " %s falling :\n", $8) ;
535 fprintf (GCF_OUT, " stable %ld before %s %s ;\n",
536 ftolstretch (setupfall * (1e12 * timescale)), ckname, $3) ;
537 fprintf (GCF_OUT, " unstable %ld before %s %s ;\n",
538 ftolstretch (setupfall * (1e12 * timescale)) - 1, ckname, $3) ; /* hold = setup - 1 */
539 }
540 else if (holdfall != DC && holdfall != DC && setupfall != DC && setupfall != DC) {
541 fprintf (GCF_OUT, " %s falling :\n", $8) ;
542 fprintf (GCF_OUT, " stable %ld before %s %s ;\n",
543 ftolstretch (setupfall * (1e12 * timescale)), ckname, $3) ;
544 fprintf (GCF_OUT, " unstable %ld after %s %s ;\n",
545 ftolstretch (holdfall * (1e12 * timescale)), ckname, $3) ;
546 }
547 else if (holdfall != DC && holdfall != DC && setupfall == DC && setupfall == DC) {
548 fprintf (GCF_OUT, " %s falling :\n", $8) ;
549 fprintf (GCF_OUT, " stable %ld after %s %s ;\n",
550 ftolstretch (setupfall * (1e12 * timescale)) + 1, ckname, $3) ; /* setup = hold + 1 */
551 fprintf (GCF_OUT, " unstable %ld after %s %s ;\n",
552 ftolstretch (holdfall * (1e12 * timescale)), ckname, $3) ;
553 }
554 }
555 }
556 }
557 ;
558
559 clockspec : GCF_TOKEN_LEFTPAR GCF_TOKEN_POSEDGE GCF_TOKEN_QIDENT GCF_TOKEN_RIGHTPAR
560 {
561 $$ = "rising" ;
562 ckalias = stm_unquote ($3) ;
563 }
564 | GCF_TOKEN_LEFTPAR GCF_TOKEN_NEGEDGE GCF_TOKEN_QIDENT GCF_TOKEN_RIGHTPAR
565 {
566 $$ = "falling" ;
567 ckalias = stm_unquote ($3) ;
568 }
569 ;
570
571 clock : GCF_TOKEN_LEFTPAR GCF_TOKEN_CLOCK GCF_TOKEN_QIDENT GCF_TOKEN_IDENT GCF_TOKEN_RIGHTPAR
572 {
573 if (GCF_MODE == CLOCK_DETECT) {
574 ckalias = namealloc (stm_unquote ($3)) ;
575 ckname = $4 ;
576 addhtitem (clockht, ckalias, (long)ckname) ;
577 }
578 }
579 ;
580
581 ident : GCF_TOKEN_IDENT
582 {
583 $$ = $1 ;
584 }
585 | GCF_TOKEN_QIDENT
586 {
587 $$ = stm_unquote ($1) ;
588 }
589 ;
590
591 parasubset : empty
592 ;
593
594 empty : /* empty */
595 ;
596
597 wnumber : number
598 {
599 $$ = $1 ;
600 }
601 | GCF_TOKEN_STAR
602 {
603 $$ = DC ;
604 }
605 ;
606
607 number : GCF_TOKEN_NUMBER
608 {
609 $$ = $1 ;
610 }
611 | GCF_TOKEN_ENUMBER
612 {
613 $$ = $1 ;
614 }
615 ;
616 %%
617
618 int yyerror ()
619 {
620 printf ("*** gcf error\n") ;
621 printf ("*** parse error line %d\n", GCF_LINE) ;
622 //printf ("*** cannot match token '%s'\n", yylval.text) ;
623 return 0;
624 }
625