source: trunk/IPs/systemC/processor/Morpheo/Configuration/src/Configuration_files.y @ 2

Last change on this file since 2 was 2, checked in by kane, 17 years ago

Import Morpheo

File size: 42.6 KB
Line 
1%{
2#include <iostream>
3#include <list>
4
5  using namespace std;
6 
7  list<int> list_token;
8     
9  // define in the lexer
10  extern unsigned int lineno;
11 
12  int  yylex   ();
13  void yyerror ( const char *);
14%}
15
16// Type of yylval
17%union
18{
19  unsigned int value_int;
20  float        value_float;
21  char *       name ;
22  char *       token;
23}
24
25// Définition des Tokens
26// TOKEN
27
28// Nom de balises
29%token BEGIN_XML                END_XML
30%token BEGIN_CPU                END_CPU
31%token BEGIN_DEFINITION         END_DEFINITION
32%token BEGIN_INTERNAL           END_INTERNAL
33%token BEGIN_TYPE               END_TYPE     
34%token BEGIN_LATENCE            END_LATENCE   
35%token BEGIN_GLOBAL             END_GLOBAL
36%token BEGIN_ISA                END_ISA
37%token BEGIN_CACHE              END_CACHE
38%token BEGIN_ICACHE             END_ICACHE
39%token BEGIN_DCACHE             END_DCACHE
40%token BEGIN_IFETCH             END_IFETCH
41%token BEGIN_AFFECTATION
42%token BEGIN_OPERATION
43%token BEGIN_ALLOW
44%token BEGIN_ORBIS
45%token BEGIN_ORFPX
46%token BEGIN_ORVDX
47%token BEGIN_SIZE_DATA   
48%token BEGIN_SCHEME_BYPASS
49%token BEGIN_ARBITER
50%token BEGIN_NB_PORT
51%token BEGIN_NB_INST_FETCH   
52%token BEGIN_SIZE_FETCH_QUEUE
53%token BEGIN_LINK_ICACHE     
54%token BEGIN_LINK_PREDICTOR 
55%token BEGIN_LINK_DECOD     
56%token                          END_SINGLETON
57%token                          END_BALISE_DUAL
58
59// Nom d'attribut
60%token VERSION ENCODING NAME ID DELAY LATENCE TYPE VALUE ALGO
61
62// Symbole
63%token EQUAL QUOTE
64// Type
65%token INTEGER FLOAT STRING;
66
67%type  <value_float> FLOAT   attribut_float;
68%type  <value_int>   INTEGER attribut_integer;
69%type  <name>        STRING  attribut_string;
70
71%type  <value_int>   attribut_id attribut_delay attribut_latence attribut_type attribut_value
72%type  <name>        attribut_name attribut_algo
73
74%start file
75
76// Rule to the grammar
77%%
78
79// *****{ Fichier }*****
80file                             : file_header file_body
81                                 {
82                                   cout << "file" << endl;
83                                 }
84                                 ;
85                                 
86file_header                      : balise_xml
87                                 ;                     
88                                 
89file_body                        : balise_cpu
90                                 ;
91
92// ====={ Balise "xml" }=====
93balise_xml                       : begin_xml liste_attributs_xml end_xml
94                                 ;
95                                 
96begin_xml                        : _begin_xml
97                                 ;
98                                 
99_begin_xml                       : BEGIN_XML
100                                 {
101                                   list_token.push_back(BEGIN_XML);
102                                 }
103                                 ;
104
105liste_attributs_xml              : VERSION attribut_float ENCODING attribut_string
106                                 {
107                                   // Test
108                                   if ($2 != 1.0)
109                                     yyerror ("balise \"xml\" - attribut \"version\" - value is always equal at \"1.0\"");
110                                   
111                                   if (strcmp($4,"ISO-8859-1") != 0)
112                                     yyerror ("balise \"xml\" - attribut \"version\" - value is always equal at \"ISO-8859-1\"");
113                                 }
114                                 ;
115                                 
116end_xml                          : _end_xml
117                                 ;
118
119// ====={ Balise "cpu" }=====
120// <cpu>
121balise_cpu                       : begin_cpu body_cpu end_cpu
122                                 ;
123                                 
124begin_cpu                        : _begin_cpu liste_attributs_cpu END_BALISE_DUAL
125                                 ;
126                                 
127_begin_cpu                       : BEGIN_CPU
128                                 {
129                                   list_token.push_back(BEGIN_CPU);
130                                 }
131                                 ;
132
133liste_attributs_cpu              : attribut_optionnel_name
134                                 ;
135                                 
136body_cpu                         : empty
137                                 | balise_internal body_cpu
138                                 | balise_type     body_cpu
139                                 | balises_latence body_cpu
140                                 ;
141                                 
142end_cpu                          : END_CPU _end_balise_dual
143                                 ;
144                         
145// ====={ Balise "type" }=====
146// <cpu>
147// +- <type>
148
149balise_type                      : begin_type body_type end_type
150                                 ;
151                                             
152begin_type                       : _begin_type liste_attributs_type END_BALISE_DUAL
153                                 ;
154                                             
155_begin_type                      : BEGIN_TYPE
156                                 {
157                                   list_token.push_back(BEGIN_TYPE);
158                                 }
159                                 ;
160
161liste_attributs_type             : empty
162                                 ;
163                                             
164body_type                        : empty
165                                 | balises_definition           body_type
166                                 | balise_optionnel_affectation body_type
167                                 ;
168
169end_type                         : END_TYPE _end_balise_dual
170                                 ;
171
172// ====={ Balise "definition" }=====
173// <cpu>
174// +- <type>
175//    +- <definition>
176
177balises_definition               : balise_definition
178                                 | balise_definition balises_definition
179                                 ;
180                                 
181balise_definition                : begin_definition body_definition end_definition
182                                 ;
183                                   
184begin_definition                 : _begin_definition liste_attributs_definition END_BALISE_DUAL
185                                 ;
186                                   
187_begin_definition                : BEGIN_DEFINITION
188                                 {
189                                   list_token.push_back(BEGIN_DEFINITION);
190                                 }
191                                 ;
192
193liste_attributs_definition       : attribut_id
194                                 ;
195
196body_definition                  : balises_allow
197                                 ;
198
199end_definition                   : END_DEFINITION _end_balise_dual
200                                 ;
201
202// ====={ Balise "allow" }=====
203// <cpu>
204// +- <type>
205//    +- <definition>
206//       +- <allow>
207
208balises_allow                    : balise_allow
209                                 | balise_allow balises_allow
210                                 ;
211                                 
212balise_allow                     : _begin_allow liste_attributs_allow _end_singleton
213                                 ;
214                                   
215_begin_allow                     : BEGIN_ALLOW
216                                 {
217                                   list_token.push_back(BEGIN_ALLOW);
218                                 }
219                                 ;
220
221liste_attributs_allow            : attribut_id
222                                 ;
223
224// ====={ Balise "affectation" }=====
225// <cpu>
226// +- <type>
227//    +- <affectation>
228
229balise_optionnel_affectation     : empty
230                                 | balise_affectation balise_optionnel_affectation
231                                 ;
232                                   
233balise_affectation               : _begin_affectation liste_attributs_affectation _end_singleton
234                                 ;
235                                   
236_begin_affectation               : BEGIN_AFFECTATION
237                                 {
238                                   list_token.push_back(BEGIN_AFFECTATION);
239                                 }
240                                 ;
241
242liste_attributs_affectation      : attribut_name           attribut_optionnel_type   
243                                 | attribut_optionnel_type attribut_name
244                                 ;
245
246// ====={ Balise "latence" }=====
247// <cpu>
248// +- <latence>
249
250balises_latence                  : balise_latence
251                                 | balise_latence balises_latence
252                                 ;
253
254balise_latence                   : begin_latence body_latence end_latence
255                                 ;
256                                   
257begin_latence                    : _begin_latence liste_attributs_latence END_BALISE_DUAL
258                                 ;
259                                   
260_begin_latence                   : BEGIN_LATENCE
261                                 {
262                                   list_token.push_back(BEGIN_LATENCE);
263                                 }
264                                 ;
265
266liste_attributs_latence          : attribut_id
267                                 ;
268                                   
269body_latence                     : balises_operation
270                                 ;
271                                   
272end_latence                      : END_LATENCE _end_balise_dual
273                                 ;
274
275// ====={ Balise "operation" }=====
276// <cpu>
277// +- <latence>
278//    +- <operation>
279
280balises_operation                : empty
281                                 | balise_operation balises_operation
282                                 ;
283                                 
284balise_operation                 : _begin_operation liste_attributs_operation _end_singleton
285                                 ;
286
287_begin_operation                 : BEGIN_OPERATION
288                                 {
289                                   list_token.push_back(BEGIN_OPERATION);
290                                 }
291                                 ;
292                                   
293liste_attributs_operation        : attribut_name              attribut_optionnel_delay   attribut_optionnel_latence
294                                 | attribut_name              attribut_optionnel_latence attribut_optionnel_delay
295                                 | attribut_optionnel_delay   attribut_optionnel_latence attribut_name
296                                 | attribut_optionnel_delay   attribut_name              attribut_optionnel_latence
297                                 | attribut_optionnel_latence attribut_optionnel_delay   attribut_name
298                                 | attribut_optionnel_latence attribut_name              attribut_optionnel_delay   
299                                 ;
300
301// ====={ Balise "internal" }=====
302// <cpu>
303// +- <internal>
304
305balise_internal                  : begin_internal body_internal end_internal
306                                 ;
307
308begin_internal                   : _begin_internal liste_attributs_internal END_BALISE_DUAL
309                                 ;
310
311_begin_internal                  : BEGIN_INTERNAL
312                                 {
313                                   list_token.push_back(BEGIN_INTERNAL);
314                                 }
315                                 ;
316                                   
317liste_attributs_internal         : empty
318                                 ;
319                                   
320body_internal                    : empty
321                                 | balise_global  body_internal
322                                 | balise_cache   body_internal
323                                 | balises_ifetch body_internal
324                                 ;
325
326end_internal                     : END_INTERNAL _end_balise_dual
327                                 ;
328
329// ====={ Balise "global" }=====
330// <cpu>
331// +- <internal>
332//    +- <global>
333
334balise_global                    : begin_global body_global end_global
335                                 ;
336                                   
337begin_global                     : _begin_global liste_attributs_global END_BALISE_DUAL
338                                 ;
339
340_begin_global                    : BEGIN_GLOBAL
341                                 {
342                                   list_token.push_back(BEGIN_GLOBAL);
343                                 }
344                                 ;
345                                   
346liste_attributs_global           : empty
347                                 ;
348                                   
349body_global                      : empty
350                                 | balise_optionnel_isa body_global
351                                 | balise_size_data     body_global
352                                 | balise_scheme_bypass body_global
353                                 ;
354                                   
355end_global                       : END_GLOBAL _end_balise_dual
356                                 ;
357
358// ====={ Balise "isa" }=====
359// <cpu>
360// +- <internal>
361//    +- <global>
362//       +- <isa>
363
364balise_optionnel_isa             : empty
365                                 | balise_isa 
366                                 ;
367
368balise_isa                       : begin_isa body_isa end_isa
369                                 ;
370                                   
371begin_isa                        : _begin_isa liste_attributs_isa END_BALISE_DUAL
372                                 ;
373                                   
374_begin_isa                       : BEGIN_ISA 
375                                 {
376                                   list_token.push_back(BEGIN_ISA);
377                                 }
378                                 ;
379
380liste_attributs_isa              : empty
381                                 ;
382                                   
383body_isa                         : empty
384                                 | balise_optionnel_orbis body_isa
385                                 | balise_optionnel_orfpx body_isa
386                                 | balise_optionnel_orvdx body_isa
387                                 ;
388                                   
389end_isa                          : END_ISA _end_balise_dual
390                                 ;
391
392// ====={ Balise "orbis" }=====
393// <cpu>
394// +- <internal>
395//    +- <global>
396//       +- <isa>
397//          +- <orbis>
398
399balise_optionnel_orbis           : empty
400                                 | balise_orbis
401                                 ;
402                                 
403balise_orbis                     : _begin_orbis liste_attributs_orbis _end_singleton
404                                 ;
405
406_begin_orbis                     : BEGIN_ORBIS
407                                 {
408                                   list_token.push_back(BEGIN_ORBIS);
409                                 }
410                                 ;
411                                   
412liste_attributs_orbis            : attribut_value          attribut_optionnel_type
413                                 | attribut_optionnel_type attribut_value
414                                 ;
415
416// ====={ Balise "orfpx" }=====
417// <cpu>
418// +- <internal>
419//    +- <global>
420//       +- <isa>
421//          +- <orfpx>
422
423balise_optionnel_orfpx           : empty
424                                 | balise_orfpx
425                                 ;
426                                 
427balise_orfpx                     : _begin_orfpx liste_attributs_orfpx _end_singleton
428                                 ;
429                                   
430_begin_orfpx                     : BEGIN_ORFPX
431                                 {
432                                   list_token.push_back(BEGIN_ORFPX);
433                                 }
434                                 ;
435
436liste_attributs_orfpx            : attribut_value          attribut_optionnel_type
437                                 | attribut_optionnel_type attribut_value
438                                 ;
439
440// ====={ Balise "orvdx" }=====
441// <cpu>
442// +- <internal>
443//    +- <global>
444//       +- <isa>
445//          +- <orvdx>
446
447balise_optionnel_orvdx           : empty
448                                 | balise_orvdx
449                                 ;
450                                 
451balise_orvdx                     : _begin_orvdx liste_attributs_orvdx _end_singleton
452                                 ;
453
454_begin_orvdx                     : BEGIN_ORVDX
455                                 {
456                                   list_token.push_back(BEGIN_ORVDX);
457                                 }
458                                 ;
459                                   
460liste_attributs_orvdx            : attribut_value          attribut_optionnel_type
461                                 | attribut_optionnel_type attribut_value
462                                 ;
463
464// ====={ Balise "size_data" }=====
465// <cpu>
466// +- <internal>
467//    +- <global>
468//       +- <size_data>
469
470balise_size_data                 : _begin_size_data liste_attributs_size_data _end_singleton
471                                 ;
472
473_begin_size_data                 : BEGIN_SIZE_DATA
474                                 {
475                                   list_token.push_back(BEGIN_SIZE_DATA);
476                                 }
477                                 ;
478                                   
479liste_attributs_size_data        : attribut_value
480                                 ;
481
482// ====={ Balise "scheme_bypass" }=====
483// <cpu>
484// +- <internal>
485//    +- <global>
486//       +- <scheme_bypass>
487
488balise_scheme_bypass             : _begin_scheme_bypass liste_attributs_scheme_bypass _end_singleton
489                                 ;
490
491_begin_scheme_bypass             : BEGIN_SCHEME_BYPASS
492                                 {
493                                   list_token.push_back(BEGIN_SCHEME_BYPASS);
494                                 }
495                                 ;
496                                   
497liste_attributs_scheme_bypass    : attribut_algo
498                                 ;
499
500// ====={ Balise "cache" }=====
501// <cpu>
502// +- <internal>
503//    +- <cache>
504
505balise_cache                     : begin_cache body_cache end_cache
506                                 ;
507                                   
508begin_cache                      : _begin_cache liste_attributs_cache END_BALISE_DUAL
509                                 ;
510                                   
511_begin_cache                     : BEGIN_CACHE
512                                 {
513                                   list_token.push_back(BEGIN_CACHE);
514                                 }
515                                 ;
516
517liste_attributs_cache            : empty
518                                 ;
519                                   
520body_cache                       : empty
521                                 | balises_icache body_cache
522                                 | balises_dcache body_cache
523                                 ;
524                                   
525end_cache                        : END_CACHE _end_balise_dual
526                                 ;
527
528// ====={ Balise "icache" }=====
529// <cpu>
530// +- <internal>
531//    +- <cache>
532//       +- <icache>
533
534balises_icache                   : balise_icache
535                                 | balise_icache balises_icache
536                                 ;
537
538balise_icache                    : begin_icache body_icache end_icache
539                                 ;
540                                   
541begin_icache                     : _begin_icache liste_attributs_icache END_BALISE_DUAL
542                                 ;
543
544_begin_icache                    : BEGIN_ICACHE
545                                 {
546                                   list_token.push_back(BEGIN_ICACHE);
547                                 }
548                                 ;
549                                   
550liste_attributs_icache           : attribut_id
551                                 ;
552                                   
553body_icache                      : empty
554                                 | balise_optionnel_arbiter body_icache
555                                 | balise_optionnel_nb_port body_icache
556                                 ;
557                                   
558end_icache                       : END_ICACHE _end_balise_dual
559                                 ;
560
561// ====={ Balise "dcache" }=====
562// <cpu>
563// +- <internal>
564//    +- <cache>
565//       +- <dcache>
566
567balises_dcache                   : balise_dcache
568                                 | balise_dcache balises_dcache
569                                 ;
570
571balise_dcache                    : begin_dcache body_dcache end_dcache
572                                 ;
573                                   
574begin_dcache                     : _begin_dcache liste_attributs_dcache END_BALISE_DUAL
575                                 ;
576                                   
577_begin_dcache                    : BEGIN_DCACHE
578                                 {
579                                   list_token.push_back(BEGIN_DCACHE);
580                                 }
581                                 ;
582
583liste_attributs_dcache           : attribut_id
584                                 ;
585                                   
586body_dcache                      : body_icache
587                                 ;
588                                   
589end_dcache                       : END_DCACHE _end_balise_dual
590                                 ;
591
592// ====={ Balise "arbiter" }=====
593// <cpu>
594// +- <internal>
595//    +- <cache>
596//       +- <icache>
597//       |  +- <arbiter>
598//       +- <dcache>
599//          +- <arbiter>
600
601balise_optionnel_arbiter         : empty
602                                 | balise_arbiter
603                                 ;
604                                 
605balise_arbiter                   : _begin_arbiter liste_attributs_arbiter _end_singleton
606                                 ;
607                                   
608_begin_arbiter                   : BEGIN_ARBITER
609                                 {
610                                   list_token.push_back(BEGIN_ARBITER);
611                                 }
612                                 ;
613
614liste_attributs_arbiter          : attribut_algo
615                                 ;
616
617// ====={ Balise "nb_port" }=====
618// <cpu>
619// +- <internal>
620//    +- <cache>
621//       +- <icache>
622//       |  +- <arbiter>
623//       +- <dcache>
624//          +- <arbiter>
625
626balise_optionnel_nb_port         : empty
627                                 | balise_nb_port
628                                 ;
629                                 
630balise_nb_port                   : _begin_nb_port liste_attributs_nb_port _end_singleton
631                                 ;
632
633_begin_nb_port                   : BEGIN_NB_PORT
634                                 {
635                                   list_token.push_back(BEGIN_NB_PORT);
636                                 }
637                                 ;
638                                   
639liste_attributs_nb_port          : attribut_value
640                                 ;
641
642// ====={ Balise "ifetch" }=====
643// <cpu>
644// +- <internal>
645//     +- <ifetch>
646
647balises_ifetch                   : balise_ifetch
648                                 | balise_ifetch balises_ifetch
649                                 ;
650
651balise_ifetch                    : begin_ifetch body_ifetch end_ifetch
652                                 ;
653                                   
654begin_ifetch                     : _begin_ifetch liste_attributs_ifetch END_BALISE_DUAL
655                                 ;
656
657_begin_ifetch                    : BEGIN_IFETCH
658                                 {
659                                   list_token.push_back(BEGIN_IFETCH);
660                                 }
661                                 ;
662                                   
663liste_attributs_ifetch           : attribut_id
664                                 ;
665                                   
666body_ifetch                      : empty
667                                 | balise_optionnel_nb_inst_fetch    body_ifetch
668                                 | balise_optionnel_size_fetch_queue body_ifetch
669                                 | balise_link_icache                body_ifetch
670                                 | balise_link_predictor             body_ifetch
671                                 | balise_link_decod                 body_ifetch
672                                 ;
673                                   
674end_ifetch                       : END_IFETCH _end_balise_dual
675                                 ;
676
677// ====={ Balise "nb_inst_fetch" }=====
678// <cpu>
679// +- <internal>
680//     +- <ifetch>
681//        +- <nb_inst_fetch>
682
683balise_optionnel_nb_inst_fetch   : empty
684                                 | balise_nb_inst_fetch
685                                 ;
686                                 
687balise_nb_inst_fetch             : _begin_nb_inst_fetch liste_attributs_nb_inst_fetch _end_singleton
688                                 ;
689
690_begin_nb_inst_fetch             : BEGIN_NB_INST_FETCH
691                                 {
692                                   list_token.push_back(BEGIN_NB_INST_FETCH);
693                                 }
694                                 ;
695                                   
696liste_attributs_nb_inst_fetch    : attribut_value
697                                 ;
698
699// ====={ Balise "size_fetch_queue" }=====
700// <cpu>
701// +- <internal>
702//     +- <ifetch>
703//        +- <size_fetch_queue>
704
705balise_optionnel_size_fetch_queue: empty
706                                 | balise_size_fetch_queue
707                                 ;
708                                 
709balise_size_fetch_queue          : _begin_size_fetch_queue liste_attributs_size_fetch_queue _end_singleton
710                                 ;
711
712_begin_size_fetch_queue          : BEGIN_SIZE_FETCH_QUEUE
713                                 {
714                                   list_token.push_back(BEGIN_SIZE_FETCH_QUEUE);
715                                 }
716                                 ;
717                                   
718liste_attributs_size_fetch_queue : attribut_value
719                                 ;
720// ====={ Balise "link_icache" }=====
721// <cpu>
722// +- <internal>
723//     +- <ifetch>
724//        +- <link_icache>
725                                 
726balise_link_icache               : _begin_link_icache liste_attributs_link_icache _end_singleton
727                                 ;
728
729_begin_link_icache               : BEGIN_LINK_ICACHE
730                                 {
731                                   list_token.push_back(BEGIN_LINK_ICACHE);
732                                 }
733                                 ;
734                                   
735liste_attributs_link_icache      : attribut_id
736                                 ;
737
738// ====={ Balise "link_predictor" }=====
739// <cpu>
740// +- <internal>
741//     +- <ifetch>
742//        +- <link_predictor>
743                                 
744balise_link_predictor            : _begin_link_predictor liste_attributs_link_predictor _end_singleton
745                                 ;
746
747_begin_link_predictor            : BEGIN_LINK_PREDICTOR
748                                 {
749                                   list_token.push_back(BEGIN_LINK_PREDICTOR);
750                                 }
751                                 ;
752                                   
753liste_attributs_link_predictor   : attribut_id
754                                 ;
755
756// ====={ Balise "link_decod" }=====
757// <cpu>
758// +- <internal>
759//     +- <ifetch>
760//        +- <link_decod>
761                                 
762balise_link_decod                : _begin_link_decod liste_attributs_link_decod _end_singleton
763                                 ;
764
765_begin_link_decod                : BEGIN_LINK_DECOD
766                                 {
767                                   list_token.push_back(BEGIN_LINK_DECOD);
768                                 }
769                                 ;
770                                   
771liste_attributs_link_decod       : attribut_id
772                                 ;
773
774// *****{ balise "_end_xml" }*****                     
775
776_end_xml                         : END_XML       
777                                 {
778                                   list_token.pop_back();
779                                 }
780
781// *****{ balise "_end_balise_dual" }*****                     
782
783_end_balise_dual                 : END_BALISE_DUAL
784                                 {
785                                   list_token.pop_back();
786                                 }
787
788// *****{ balise "_end_singleton" }*****                       
789
790_end_singleton                   : END_SINGLETON
791                                 {
792                                   list_token.pop_back();
793                                 }
794
795// *****{ Attribut_Optionnel }*****                   
796attribut_optionnel_name          : empty
797                                 | attribut_name   
798                                 ;
799
800attribut_optionnel_delay         : empty
801                                 | attribut_delay
802                                 ;
803
804attribut_optionnel_latence       : empty
805                                 | attribut_latence
806                                 ;
807
808attribut_optionnel_type          : empty
809                                 | attribut_type
810                                 ;
811
812// *****{ Type Attribut - Top level }*****
813attribut_name                    : NAME    attribut_string
814                                 {
815                                   $$ = $2;
816                                 }
817                                 ;
818
819attribut_algo                    : ALGO    attribut_string
820                                 {
821                                   $$ = $2;
822                                 }
823                                 ;
824
825attribut_value                   : VALUE   attribut_integer
826                                 {
827                                   $$ = $2;
828                                 }
829                                 ;
830
831attribut_type                    : TYPE    attribut_integer
832                                 {
833                                   $$ = $2;
834                                 }
835                                 ;
836                                 
837attribut_id                      : ID      attribut_integer
838                                 {
839                                   $$ = $2;
840                                 }
841                                 ;
842                                 
843attribut_delay                   : DELAY   attribut_integer
844                                 {
845                                   $$ = $2;
846                                 }
847                                 ;
848                                 
849attribut_latence                 : LATENCE attribut_integer
850                                 {
851                                   $$ = $2;
852                                 }
853                                 ;
854
855// *****{ Type Attribut - Bottom Level }*****
856attribut_string                  : EQUAL QUOTE STRING QUOTE
857                                 {
858                                   $$ = $3;
859                                 }
860                                 ;
861                                 
862attribut_integer                 : EQUAL QUOTE INTEGER QUOTE
863                                 {
864                                   $$ = $3;
865                                 }
866                                 ;
867                                 
868attribut_float                   : EQUAL QUOTE FLOAT QUOTE
869                                 {
870                                   $$ = $3;
871                                 }
872                                 ;
873
874empty                            : /* vide */
875%%
876
877// *** Fct auxilaire
878
879void yyerror (const char * message)
880{
881  cerr << "Line " << lineno << " : " << message << endl;
882  cerr << "Near of token \"" << yylval.token << "\"" << endl;
883  cerr << endl;
884 
885  if (list_token.empty() == true)
886    {
887      cerr << "Invalid file, the format is :" << endl;
888      cerr << endl;
889      cerr << "  <?xml _attributs_xml ?>" << endl;
890      cerr << "  <cpu  _attributs_cpu  > _body_cpu </cpu>" << endl;
891
892      exit(-1);
893    }
894 
895  int token = list_token.back();
896 
897  switch (token)
898    {
899    case BEGIN_XML           :
900      {
901        cerr << "In balise <xml>, the format is :" << endl;
902        cerr << endl;
903        cerr << "  <?xml _attribut ?>" << endl;
904        cerr << endl;
905        cerr << "  _attribut ::= _value _encoding" << endl;
906        cerr << "  _value    ::= value=\"_float\"" << endl;
907        cerr << "  _encoding ::= encoding=\"_string\"" << endl;
908        cerr << endl;
909        break;
910      }
911    case BEGIN_CPU           :
912      {
913        cerr << "In balise <cpu>, the format is :"         << endl;
914        cerr << endl;
915        cerr << "  <cpu _attribut_cpu > _body_cpu </cpu>"  << endl;
916        cerr << endl;
917        cerr << "  _attribut_cpu ::= _name"                << endl;
918        cerr << "  _name         ::= name=\"_string\""     << endl;
919        cerr << endl;
920        cerr << "  _body_cpu     ::= _type"                << endl;
921        cerr << "                  | _latence"              << endl;
922        cerr << "                  | _internal"             << endl;
923        cerr << "  _type         ::= <type     _attribut_type >     _body_type     </type>"     << endl;
924        cerr << "  _latence      ::= <latence  _attribut_latence >  _body_latence  </latence>"  << endl;
925        cerr << "  _internal     ::= <internal _attribut_internal > _body_internal </internal>" << endl;
926        cerr << endl;
927        break;
928      }
929    case BEGIN_TYPE          :
930      {
931        cerr << "In balise <type>, the format is :"    << endl;
932        cerr << endl;
933        cerr << "  <type> _body_type </type>"          << endl;
934        cerr << endl;
935        cerr << "  _body_type    ::= [_definition]+"   << endl;
936        cerr << "                  | [_affectation]*"  << endl;
937        cerr << "  _definition   ::= <definition  _attribut_definition >  _body_definition  </definition>"  << endl;
938        cerr << "  _affectation  ::= <affectation _attribut_affectation />"                                 << endl;
939        cerr << endl;
940        break;
941      }
942    case BEGIN_DEFINITION    :
943      {
944        cerr << "In balise <definition>, the format is :"         << endl;
945        cerr << endl;
946        cerr << "  <definition _attribut_definition > _body_definition </definition>"  << endl;
947        cerr << endl;
948        cerr << "  _attribut_definition ::= _id"                                           << endl;
949        cerr << "  _id                  ::= id=\"_integer\""                               << endl;
950        cerr << endl;
951        cerr << "  _body_definition     ::= [_allow]+"                                     << endl;
952        cerr << "  _allow               ::= <allow _attribut_allow />"                     << endl;
953        cerr << endl;
954        break;
955      }
956    case BEGIN_ALLOW         :
957      {
958        cerr << "In balise <allow>, the format is :"         << endl;
959        cerr << endl;
960        cerr << "  <allow _attribut_allow />"  << endl;
961        cerr << endl;
962        cerr << "  _attribut_allow ::= _id"               << endl;
963        cerr << "  _id             ::= type=\"_integer\"" << endl;
964        cerr << endl;
965        break;
966      }
967    case BEGIN_AFFECTATION   :
968      {
969        cerr << "In balise <affectation>, the format is :"         << endl;
970        cerr << endl;
971        cerr << "  <affectation _attribut_affectation />"  << endl;
972        cerr << endl;
973        cerr << "  _attribut_affectation ::= [_name]"           << endl;
974        cerr << "                          | [_type]"           << endl;
975        cerr << "  _name                 ::= name=\"_string\""  << endl;
976        cerr << "  _type                 ::= type=\"_integer\"" << endl;
977        cerr << endl;
978        break;
979      }
980    case BEGIN_LATENCE       :
981      {
982        cerr << "In balise <latence>, the format is :"         << endl;
983        cerr << endl;
984        cerr << "  <latence _attribut_latence > _body_latence </latence>"  << endl;
985        cerr << endl;
986        cerr << "  _attribut_latence ::= _id"                               << endl;
987        cerr << "  _id               ::= id=\"_integer\""                   << endl;
988        cerr << endl;
989        cerr << "  _body_latence     ::= [_operation]*"                     << endl;
990        cerr << "  _operation        ::= <operation _attribut_operation />" << endl;
991        cerr << endl;
992        break;
993      }
994    case BEGIN_OPERATION     :
995      {
996        cerr << "In balise <operation>, the format is :"         << endl;
997        cerr << endl;
998        cerr << "  <operation _attribut_operation />"  << endl;
999        cerr << endl;
1000        cerr << "  _attribut_operation ::= [_name]"              << endl;
1001        cerr << "                        | [_delay]"             << endl;
1002        cerr << "                        | [_latence]"           << endl;
1003        cerr << "  _name               ::= name=\"_string\""     << endl;
1004        cerr << "  _delay              ::= delay=\"_integer\""   << endl;
1005        cerr << "  _latence            ::= latence=\"_integer\"" << endl;
1006        cerr << endl;
1007        break;
1008      }
1009    case BEGIN_INTERNAL      :
1010      {
1011        cerr << "In balise <internal>, the format is :"         << endl;
1012        cerr << endl;
1013        cerr << "  <internal> _body_internal </internal>"  << endl;
1014        cerr << endl;
1015        cerr << "  _body_internal    ::= _global"                           << endl;
1016        cerr << "                      | _cache"                            << endl;
1017        cerr << "                      | _ifetch"                           << endl;
1018        cerr << "                      | ..."                               << endl;
1019        cerr << "  _global           ::= <global _attribut_global> _body_global </global>" << endl;
1020        cerr << "  _cache            ::= <cache _attribut_cache>   _body_cache  </cache>" << endl;
1021        cerr << "  _ifetch           ::= <ifetch _attribut_ifetch> _body_ifetch </ifetch>" << endl;
1022        cerr << endl;
1023        break;
1024      }
1025    case BEGIN_GLOBAL        :
1026      {
1027        cerr << "In balise <global>, the format is :"         << endl;
1028        cerr << endl;
1029        cerr << "  <global> _body_global </global>"  << endl;
1030        cerr << endl;
1031        cerr << "  _body_global    ::= _size_data"                       << endl;
1032        cerr << "                    | _scheme_bypass"                   << endl;
1033        cerr << "                    | [_isa]*"                          << endl;
1034        cerr << "  _size_data        ::= <size_data     _attribut_size_data />" << endl;
1035        cerr << "  _scheme_bypass    ::= <scheme_bypass _attribut_scheme_bypass />" << endl;
1036        cerr << "  _isa              ::= <isa           _attribut_isa> _body_isa </isa>" << endl;
1037        cerr << endl;
1038        break;
1039      }
1040    case BEGIN_SIZE_DATA     :
1041      {
1042        cerr << "In balise <size_data>, the format is :"         << endl;
1043        cerr << endl;
1044        cerr << "  <size_data _attribut_size_data />"  << endl;
1045        cerr << endl;
1046        cerr << "  _attribut_size_data ::= _value"             << endl;
1047        cerr << "  _value              ::= value=\"_integer\"" << endl;
1048        cerr << endl;
1049        break;
1050      }
1051    case BEGIN_SCHEME_BYPASS :
1052      {
1053        cerr << "In balise <scheme_bypass>, the format is :"         << endl;
1054        cerr << endl;
1055        cerr << "  <scheme_bypass _attribut_scheme_bypass />"  << endl;
1056        cerr << endl;
1057        cerr << "  _attribut_scheme_bypass ::= _algo"             << endl;
1058        cerr << "  _algo                   ::= algo =\"_string\"" << endl;
1059        cerr << endl;
1060        break;
1061      }
1062    case BEGIN_ISA           :
1063      {
1064        cerr << "In balise <isa>, the format is :"         << endl;
1065        cerr << endl;
1066        cerr << "  <isa> _body_isa </isa>"  << endl;
1067        cerr << endl;
1068        cerr << "  _body_isa    ::= [_orbis]"                  << endl;
1069        cerr << "                 | [_orfpx]"                  << endl;
1070        cerr << "                 | [_orvdx]"                  << endl;
1071        cerr << "  _orbis       ::= <ORBIS _attribut_orbis />" << endl;
1072        cerr << "  _orfpx       ::= <ORFPX _attribut_orfpx />" << endl;
1073        cerr << "  _orvdx       ::= <ORVDX _attribut_orvdx />" << endl;
1074        cerr << endl;
1075        break;
1076      }
1077    case BEGIN_ORBIS         :
1078      {
1079        cerr << "In balise <ORBIS>, the format is :"         << endl;
1080        cerr << endl;
1081        cerr << "  <ORBIS _attribut_orbis />"  << endl;
1082        cerr << endl;
1083        cerr << "  _attribut_orbis ::= _value"             << endl;
1084        cerr << "                    | [_type]"            << endl;
1085        cerr << "  _type           ::= type=\"_integer\""  << endl;
1086        cerr << "  _value          ::= value=\"_integer\"" << endl;
1087        cerr << endl;
1088        break;
1089      }
1090    case BEGIN_ORFPX         :
1091      {
1092        cerr << "In balise <ORFPX>, the format is :"         << endl;
1093        cerr << endl;
1094        cerr << "  <ORFPX _attribut_orfpx />"  << endl;
1095        cerr << endl;
1096        cerr << "  _attribut_orfpx ::= [_type]"            << endl;
1097        cerr << "                    | [_value]"           << endl;
1098        cerr << "  _type           ::= type=\"_integer\""  << endl;
1099        cerr << "  _value          ::= value=\"_integer\"" << endl;
1100        cerr << endl;
1101        break;
1102      }
1103    case BEGIN_ORVDX         :
1104      {
1105        cerr << "In balise <ORVDX>, the format is :"         << endl;
1106        cerr << endl;
1107        cerr << "  <ORVDX _attribut_orvdx />"  << endl;
1108        cerr << endl;
1109        cerr << "  _attribut_orvdx ::= [_type]"            << endl;
1110        cerr << "                    | [_value]"           << endl;
1111        cerr << "  _type           ::= type=\"_integer\""  << endl;
1112        cerr << "  _value          ::= value=\"_integer\"" << endl;
1113        cerr << endl;
1114        break;
1115      }
1116    case BEGIN_CACHE         :
1117      {
1118        cerr << "In balise <cache>, the format is :"         << endl;
1119        cerr << endl;
1120        cerr << "  <cache> _body_cache </cache>"  << endl;
1121        cerr << endl;
1122        cerr << "  _body_cache    ::= [_icache]+"                  << endl;
1123        cerr << "                   | [_dcache]+"                  << endl;
1124        cerr << "  _icache        ::= <icache _attribut_icache /> _body_icache </icache>" << endl;
1125        cerr << "  _dcache        ::= <dcache _attribut_dcache /> _body_dcache </dcache>" << endl;
1126        cerr << endl;
1127        break;
1128      }
1129    case BEGIN_ICACHE        :
1130      {
1131        cerr << "In balise <icache>, the format is :"         << endl;
1132        cerr << endl;
1133        cerr << "  <icache _attribut_icache > _body_icache </icache>"  << endl;
1134        cerr << endl;
1135        cerr << "  _attribut_icache ::= _id"                           << endl;
1136        cerr << "  _id              ::= id=\"_integer\""               << endl;
1137        cerr << endl;
1138        cerr << "  _body_icache     ::= [_arbiter]"                    << endl;
1139        cerr << "                     | [_nb_port]"                    << endl;
1140        cerr << "  _arbiter         ::= <arbiter _attribut_arbiter />" << endl;
1141        cerr << "  _nb_port         ::= <nb_port _attribut_nb_port />" << endl;
1142        cerr << endl;
1143        break;
1144      }
1145    case BEGIN_DCACHE        :
1146      {
1147        cerr << "In balise <dcache>, the format is :"         << endl;
1148        cerr << endl;
1149        cerr << "  <dcache _attribut_dcache > _body_dcache </dcache>"  << endl;
1150        cerr << endl;
1151        cerr << "  _attribut_dcache ::= _id"                           << endl;
1152        cerr << "  _id              ::= id=\"_integer\""               << endl;
1153        cerr << endl;
1154        cerr << "  _body_dcache     ::= [_arbiter]"                    << endl;
1155        cerr << "                     | [_nb_port]"                    << endl;
1156        cerr << "  _arbiter         ::= <arbiter _attribut_arbiter />" << endl;
1157        cerr << "  _nb_port         ::= <nb_port _attribut_nb_port />" << endl;
1158        cerr << endl;
1159        break;
1160      }
1161    case BEGIN_ARBITER       :
1162      {
1163        cerr << "In balise <arbiter>, the format is :"         << endl;
1164        cerr << endl;
1165        cerr << "  <arbiter _attribut_arbiter />"  << endl;
1166        cerr << endl;
1167        cerr << "  _attribut_arbiter ::= _algo"            << endl;
1168        cerr << "  _algo             ::= algo=\"_string\"" << endl;
1169        cerr << endl;
1170        break;
1171      }
1172    case BEGIN_NB_PORT       :
1173      {
1174        cerr << "In balise <nb_port>, the format is :"         << endl;
1175        cerr << endl;
1176        cerr << "  <nb_port _attribut_nb_port />"  << endl;
1177        cerr << endl;
1178        cerr << "  _attribut_nb_port ::= _value"             << endl;
1179        cerr << "  _value            ::= value=\"_integer\"" << endl;
1180        cerr << endl;
1181        break;
1182      }
1183    case BEGIN_IFETCH        :
1184      {
1185        cerr << "In balise <ifetch>, the format is :"         << endl;
1186        cerr << endl;
1187        cerr << "  <ifetch _attribut_ifetch > _body_ifetch </ifetch>"  << endl;
1188        cerr << endl;
1189        cerr << "  _attribut_ifetch  ::= _id"                           << endl;
1190        cerr << "  _id               ::= id=\"_integer\""               << endl;
1191        cerr << endl;
1192        cerr << "  _body_ifetch      ::= [_nb_inst_fetch]"              << endl;
1193        cerr << "                      | [_size_fetch_queue]"           << endl;
1194        cerr << "                      | _link_icache"                  << endl;
1195        cerr << "                      | _link_predictor"               << endl;
1196        cerr << "                      | _link_decod"                   << endl;
1197        cerr << "  _nb_inst_fetch    ::= <nb_inst_fetch    _attribut_nb_inst_fetch    />" << endl;
1198        cerr << "  _size_fetch_queue ::= <size_fetch_queue _attribut_size_fetch_queue />" << endl;
1199        cerr << "  _link_icache      ::= <link_icache      _attribut_link_icache      />" << endl;
1200        cerr << "  _link_predictor   ::= <link_predictor   _attribut_link_predictor   />" << endl;
1201        cerr << "  _link_decod       ::= <link_decod       _attribut_link_decod       />" << endl;
1202        cerr << endl;
1203        break;
1204      }
1205    case BEGIN_NB_INST_FETCH :
1206      {
1207        cerr << "In balise <nb_inst_fetch>, the format is :"       << endl;
1208        cerr << endl;
1209        cerr << "  <nb_inst_fetch _attribut_nb_inst_fetch />"      << endl;
1210        cerr << endl;
1211        cerr << "  _attribut_nb_inst_fetch ::= _value"             << endl;
1212        cerr << "  _value                  ::= value=\"_integer\"" << endl;
1213        cerr << endl;
1214        break;
1215      }
1216    case BEGIN_SIZE_FETCH_QUEUE :
1217      {
1218        cerr << "In balise <size_fetch_queue>, the format is :"       << endl;
1219        cerr << endl;
1220        cerr << "  <size_fetch_queue _attribut_size_fetch_queue />"   << endl;
1221        cerr << endl;
1222        cerr << "  _attribut_size_fetch_queue ::= _value"             << endl;
1223        cerr << "  _value                     ::= value=\"_integer\"" << endl;
1224        cerr << endl;
1225        break;
1226      }
1227    case BEGIN_LINK_ICACHE         :
1228      {
1229        cerr << "In balise <link_icache>, the format is :"      << endl;
1230        cerr << endl;
1231        cerr << "  <link_icache _attribut_link_icache />"       << endl;
1232        cerr << endl;
1233        cerr << "  _attribut_link_icache ::= _id"               << endl;
1234        cerr << "  _id                   ::= type=\"_integer\"" << endl;
1235        cerr << endl;
1236        break;
1237      }
1238    case BEGIN_LINK_PREDICTOR         :
1239      {
1240        cerr << "In balise <link_predictor>, the format is :"      << endl;
1241        cerr << endl;
1242        cerr << "  <link_predictor _attribut_link_predictor />"    << endl;
1243        cerr << endl;
1244        cerr << "  _attribut_link_predictor ::= _id"               << endl;
1245        cerr << "  _id                      ::= type=\"_integer\"" << endl;
1246        cerr << endl;
1247        break;
1248      }
1249    case BEGIN_LINK_DECOD         :
1250      {
1251        cerr << "In balise <link_decod>, the format is :"      << endl;
1252        cerr << endl;
1253        cerr << "  <link_decod _attribut_link_decod />"        << endl;
1254        cerr << endl;
1255        cerr << "  _attribut_link_decod ::= _id"               << endl;
1256        cerr << "  _id                  ::= type=\"_integer\"" << endl;
1257        cerr << endl;
1258        break;
1259      }
1260    default                  :
1261      {
1262        cerr << "Internal error : Unknow token (" << token << "). Please contact the Tools maintener" << endl;
1263      }
1264    }// end switch
1265 
1266  exit (1);
1267}
Note: See TracBrowser for help on using the repository browser.