Main Page | Modules | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages | Examples

archc.parser.c

Go to the documentation of this file.
00001 /* A Bison parser, made by GNU Bison 1.875.  */
00002 
00003 /* Skeleton parser for Yacc-like parsing with Bison,
00004    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2, or (at your option)
00009    any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software
00018    Foundation, Inc., 59 Temple Place - Suite 330,
00019    Boston, MA 02111-1307, USA.  */
00020 
00021 /* As a special exception, when this file is copied by Bison into a
00022    Bison output file, you may use that output file without restriction.
00023    This special exception was added by the Free Software Foundation
00024    in version 1.24 of Bison.  */
00025 
00026 /* Written by Richard Stallman by simplifying the original so called
00027    ``semantic'' parser.  */
00028 
00029 /* All symbols defined below should begin with yy or YY, to avoid
00030    infringing on user name space.  This should be done even for local
00031    variables, as they might otherwise be expanded by user macros.
00032    There are some unavoidable exceptions within include files to
00033    define necessary library symbols; they are noted "INFRINGES ON
00034    USER NAME SPACE" below.  */
00035 
00036 /* Identify Bison output.  */
00037 #define YYBISON 1
00038 
00039 /* Skeleton name.  */
00040 #define YYSKELETON_NAME "yacc.c"
00041 
00042 /* Pure parsers.  */
00043 #define YYPURE 0
00044 
00045 /* Using locations.  */
00046 #define YYLSP_NEEDED 0
00047 
00048 
00049 
00050 /* Tokens.  */
00051 #ifndef YYTOKENTYPE
00052 # define YYTOKENTYPE
00053    /* Put the tokens into the symbol table, so that GDB and other debuggers
00054       know about them.  */
00055    enum yytokentype {
00056      INT = 258,
00057      STR = 259,
00058      DOT = 260,
00059      COMMA = 261,
00060      SEMICOLON = 262,
00061      COLON = 263,
00062      LT = 264,
00063      GT = 265,
00064      EQ = 266,
00065      RPAREN = 267,
00066      LPAREN = 268,
00067      LBRACK = 269,
00068      RBRACK = 270,
00069      LBRACE = 271,
00070      RBRACE = 272,
00071      SET_DECODER = 273,
00072      SET_ASM = 274,
00073      SET_CYCLES = 275,
00074      ID = 276,
00075      AC_ISA_UPPER = 277,
00076      ISA_CTOR = 278,
00077      AC_FORMAT = 279,
00078      AC_INSTR = 280,
00079      CYCLE_RANGE = 281,
00080      AC_ARCH = 282,
00081      AC_CACHE = 283,
00082      AC_ICACHE = 284,
00083      AC_DCACHE = 285,
00084      AC_MEM = 286,
00085      AC_PC = 287,
00086      AC_REGBANK = 288,
00087      AC_REG = 289,
00088      AC_STAGE = 290,
00089      AC_PIPE = 291,
00090      ARCH_CTOR = 292,
00091      AC_ISA = 293,
00092      AC_WORDSIZE = 294,
00093      AC_FETCHSIZE = 295,
00094      SET_ENDIAN = 296,
00095      BIND_TO = 297
00096    };
00097 #endif
00098 #define INT 258
00099 #define STR 259
00100 #define DOT 260
00101 #define COMMA 261
00102 #define SEMICOLON 262
00103 #define COLON 263
00104 #define LT 264
00105 #define GT 265
00106 #define EQ 266
00107 #define RPAREN 267
00108 #define LPAREN 268
00109 #define LBRACK 269
00110 #define RBRACK 270
00111 #define LBRACE 271
00112 #define RBRACE 272
00113 #define SET_DECODER 273
00114 #define SET_ASM 274
00115 #define SET_CYCLES 275
00116 #define ID 276
00117 #define AC_ISA_UPPER 277
00118 #define ISA_CTOR 278
00119 #define AC_FORMAT 279
00120 #define AC_INSTR 280
00121 #define CYCLE_RANGE 281
00122 #define AC_ARCH 282
00123 #define AC_CACHE 283
00124 #define AC_ICACHE 284
00125 #define AC_DCACHE 285
00126 #define AC_MEM 286
00127 #define AC_PC 287
00128 #define AC_REGBANK 288
00129 #define AC_REG 289
00130 #define AC_STAGE 290
00131 #define AC_PIPE 291
00132 #define ARCH_CTOR 292
00133 #define AC_ISA 293
00134 #define AC_WORDSIZE 294
00135 #define AC_FETCHSIZE 295
00136 #define SET_ENDIAN 296
00137 #define BIND_TO 297
00138 
00139 
00140 
00141 
00142 /* Copy the first part of user declarations.  */
00143 #line 15 "src/acpp/archc.bison"
00144 
00161 /***************
00162  C declarations 
00163 *****************/
00164 #include "acsim.h"
00165 #include <stdlib.h>
00166 #include <stdio.h>
00167 #include <string.h>
00168 #include <assert.h>
00169 #include <ctype.h>
00170 
00171 #define YYDEBUG 1
00172 #define YYERROR_VERBOSE
00173 #define ADD_DEBUG 1
00174 
00176 enum _commalist { INSTR_L, STAGE_L, REG_L, PIPE_L, REGBANK_L, CACHE_L, MEM_L};
00178 typedef enum _commalist commalist;
00179 
00181 enum _descr { ISA_D, ARCH_D};
00183 typedef enum _descr description;
00184 
00186 enum _sto_unit { BYTE=1, KBYTE=1024, MBYTE=1048576, GBYTE=1073741824};
00188 typedef enum _sto_unit sto_unit ;
00189 
00190 FILE *output = NULL;                  
00191 char *current_type;                   
00192 char *current_instr;                  
00193 char *project_name;                   
00194 char *isa_filename;                   
00195 char *aux;
00196 
00197 ac_dec_format *format_ins_list;       
00198 ac_dec_format *format_ins_list_tail;
00199 
00200 ac_dec_format *format_reg_list;      
00201 ac_dec_format *format_reg_list_tail;
00202 
00203 ac_dec_instr *instr_list;            
00204 ac_dec_instr *instr_list_tail;
00205 ac_dec_instr *pinstr;
00206 
00207 ac_dec_field *field_list= NULL;       
00208 
00209 ac_dec_list  *pdec_list;              
00210 
00212 
00213 ac_pipe_list  *pipe_list = NULL, *ppipe, *current_pipe=NULL, *pipe_list_tail = NULL;
00215 
00216 
00217 /******************************
00218  * This list is used for single pipe declarations like:
00219  * ac_stages ST1, ST2, ST3;
00220  */
00222 
00223 ac_stg_list  *stage_list = NULL, *pstage, *stage_list_tail = NULL;
00225 
00227 
00228 ac_sto_list  *storage_list, *pstorage, *storage_list_tail;
00230 
00232 
00233 ac_cache_parms  *parms_list, *pparms, *parms_list_tail;
00235 
00237 
00238 int HaveFormattedRegs = 0,  HaveMultiCycleIns = 0, HaveMemHier=0, HaveCycleRange=0; 
00240 
00241 commalist list_type;       
00242 description descrp;        
00243 sto_unit current_unit;     
00244 ac_sto_types cache_type;   
00245 ac_sto_list *fetch_device; 
00246 
00247 int instr_num;    
00248 int declist_num;  
00249 int format_num;   
00250 int const_count;  
00251 int stage_num;    
00252 int pipe_num;     
00253 int wordsize;     
00254 int reg_width;   
00255 int fetchsize;    
00256 int  line_num;    
00257 
00258 int ac_tgt_endian;  
00259 
00260 int first_format = 1, largest_format_size=0;
00261 
00263 
00264 
00265 /**************************/
00270 void yyerror (char *s)
00271 {
00272   fprintf (stderr, "ArchC ERROR: Line %d: %s.\n", line_num, s);
00273 }
00274 
00275 
00276 /**********************************************************/
00283 /**********************************************************/
00284 void print_comment( FILE* output, char* description ){
00285   fprintf( output, "/******************************************************\n");
00286   fprintf( output, " * %-50s *\n",description);
00287   fprintf( output, " * This file is automatically generated by ArchC      *\n");
00288   fprintf( output, " * WITHOUT WARRANTY OF ANY KIND, either express       *\n");
00289   fprintf( output, " * or implied.                                        *\n");
00290   fprintf( output, " * For more information on ArchC, please visit:       *\n");
00291   fprintf( output, " * http://www.archc.org                               *\n");
00292   fprintf( output, " *                                                    *\n");
00293   fprintf( output, " * The ArchC Team                                     *\n");
00294   fprintf( output, " * Computer Systems Laboratory (LSC)                  *\n");
00295   fprintf( output, " * IC-UNICAMP                                         *\n");
00296   fprintf( output, " * http://www.lsc.ic.unicamp.br                       *\n");
00297   fprintf( output, " ******************************************************/\n");
00298   fprintf( output, " \n\n");
00299 }
00300 
00301 
00302 /********************************************************/
00310 /********************************************************/
00311 int parse_format(char **fieldstr, int sum_size, int size_limit, ac_dec_field **field_list_head, ac_dec_field **field_list_tail)
00312 {
00313   char *str = *fieldstr;
00314   int first_bit = sum_size;
00315   char *fieldend;
00316   
00317   //Eat spaces
00318   for (; **fieldstr && isspace(**fieldstr); (*fieldstr)++);
00319 
00320   /* Building field_list */
00321   while (**fieldstr != 0) {
00322 
00323     //Start group?
00324     if (**fieldstr == '[') {
00325       (*fieldstr)++;
00326       sum_size = parse_format(fieldstr, sum_size, -1, field_list_head, field_list_tail);
00327     }
00328 
00329     //Close group?
00330     else if (**fieldstr == ']') {
00331       (*fieldstr)++;
00332       if ((size_limit != -1) && (size_limit != sum_size)) {
00333         AC_ERROR("Size mismatch in format choices for \"%s\".", str);
00334       }
00335       return sum_size;
00336     }
00337 
00338     //New choice?
00339     else if (**fieldstr == '|') {
00340       (*fieldstr)++;
00341       if (size_limit != -1) {
00342         if (size_limit != sum_size) {
00343           AC_ERROR("Size mismatch in format choices for \"%s\".", str);
00344         }
00345       }
00346       else {
00347         size_limit = sum_size;
00348       }
00349       sum_size = first_bit;
00350     }
00351 
00352     //This must be a kind of field
00353     else {
00354       int value;
00355       ac_dec_field *pfield = (ac_dec_field*) malloc( sizeof(ac_dec_field));
00356 
00357       //Is it a constant number?
00358       value == strtol(*fieldstr, &fieldend, 0);
00359       if (fieldend != *fieldstr) {
00360         //Set name
00361         pfield->name = (char*) calloc(10,sizeof(char));
00362         snprintf( pfield->name, 10, "CONST_%d", const_count);
00363         const_count++;
00364         //Set value
00365         pfield->val = value;
00366       }
00367 
00368       //It is a regular field
00369       else {
00370         if (**fieldstr == '%') (*fieldstr)++;
00371         for (fieldend = *fieldstr; *fieldend && *fieldend!=':'; fieldend++);
00372         //Set name
00373         pfield->name = (char*) calloc((fieldend-(*fieldstr)+1),sizeof(char));
00374         strncpy(pfield->name, *fieldstr, (fieldend-(*fieldstr)));
00375         //Set value
00376         pfield->val = 0;
00377       }
00378       
00379       //Set size
00380       if (*fieldend != ':') AC_ERROR("Size not given in \"%s\".", *fieldstr);
00381       *fieldstr = fieldend+1;
00382       value = strtol(*fieldstr, &fieldend, 0);
00383       if (fieldend == *fieldstr) AC_ERROR("Invalid size in \"%s\", character %d.", str, (*fieldstr)-str);
00384       pfield->size = value;
00385       //Set sign
00386       pfield->sign=0;
00387       *fieldstr = fieldend;
00388       if (**fieldstr == ':') {
00389         (*fieldstr)++;
00390         if ((**fieldstr == 's') || (**fieldstr == 'S'))
00391           pfield->sign=1;
00392         else if ((**fieldstr != 'u') && (**fieldstr != 'U'))
00393           AC_ERROR("Invalid sign specification in \"%s\", character %d.", str, (*fieldstr)-str);
00394         (*fieldstr)++;
00395       }
00396       //Set first bit
00397       sum_size += pfield->size;
00398       pfield->first_bit = sum_size-1;
00399       //Set id
00400       pfield->id = 0;
00401     
00402       //Put the new field in the list
00403       pfield->next = NULL;
00404       if(*field_list_head){
00405         (*field_list_tail)->next = pfield;
00406         (*field_list_tail) = pfield;
00407       }
00408       else{
00409         *field_list_tail = *field_list_head = pfield;
00410       }
00411     }
00412     
00413     //Eat spaces
00414     for (; **fieldstr && isspace(**fieldstr); (*fieldstr)++);
00415   }
00416     
00417   return sum_size;
00418 }
00419 
00420 
00421 /***************************************/
00428 /***************************************/
00429 void add_format( ac_dec_format **head, ac_dec_format **tail, char *name, char* str){
00430 
00431   ac_dec_field * field_list_tail = field_list;
00432   ac_dec_format *pformat;
00433   int sum_size = parse_format(&str, 0, -1, &field_list, &field_list_tail);
00434   
00435   //Create new format
00436   pformat = (ac_dec_format*) malloc( sizeof(ac_dec_format));
00437   pformat->name  = name;
00438   pformat->size  = sum_size;
00439   pformat->fields = field_list;
00440   pformat->next = NULL;
00441 
00442   //Clear field_list pointer
00443   field_list = 0;
00444 
00445   //Keeping track of the largest format
00446   if( sum_size >largest_format_size ) 
00447     largest_format_size = sum_size;
00448 
00449   //Put new format in the formats list
00450   if( (*tail) ){
00451     (*tail)->next = pformat;
00452     (*tail) = pformat;
00453   }
00454   else  { /*  First format being added to the list */
00455     (*tail) = (*head) = pformat;
00456   }
00457   
00458   //Increment format count if inside ISA description
00459   if( descrp == ISA_D )
00460     format_num++;
00461 }
00462  
00463 /***************************************/
00467 /***************************************/
00468 void add_instr( char* name){
00469 
00470   ac_dec_instr *ppins;
00471 
00472   pinstr = (ac_dec_instr*) malloc( sizeof(ac_dec_instr));
00473   pinstr->name = (char*) malloc( strlen(name)+1);
00474   pinstr->format = (char*) malloc( strlen(current_type)+1);
00475   strcpy(pinstr->name, name);
00476   strcpy(pinstr->format, current_type);
00477   pinstr->mnemonic = NULL;
00478   instr_num++;
00479   pinstr->id = instr_num;
00480   pinstr->cycles = 1;
00481   pinstr->min_latency = 1;
00482   pinstr->max_latency = 1;
00483   pinstr->dec_list = NULL;
00484   pinstr->next = NULL;
00485   if( instr_list_tail ){
00486 
00487     for( ppins =  instr_list; ppins!=NULL; ppins= ppins->next ){
00488       if( !strcmp( ppins->name, name )){
00489         AC_ERROR("Duplicated instruction name: %s at line: %d\n",name, line_num);
00490         exit(1);
00491       }
00492     }
00493     instr_list_tail->next = pinstr;
00494     instr_list_tail = pinstr;
00495   }
00496   else  { /*  First instruction being added to the list */
00497      instr_list_tail = instr_list = pinstr;
00498   }
00499 }
00500 
00501 
00502 /**************************************/
00505 /***************************************/
00506 void add_pipe( char* name ){
00507 
00508   pipe_num++;
00509   ppipe = (ac_pipe_list*) malloc( sizeof(ac_pipe_list));
00510   ppipe->name = (char*) malloc( strlen(name)+1);
00511   strcpy(ppipe->name, name);    
00512   ppipe->id = pipe_num;
00513   ppipe->stages = NULL;
00514   ppipe->next = NULL;
00515 
00516   if( pipe_list_tail ){
00517      pipe_list_tail->next = ppipe;
00518      pipe_list_tail = ppipe;
00519   }
00520   else  { /*  First pipe being added to the list */
00521      pipe_list_tail = pipe_list = ppipe;
00522   }
00523 
00524         /* Updating the current pipeline being declared */
00525         current_pipe = ppipe;
00526 
00527 }
00528 
00529 /**************************************/
00532 /***************************************/
00533 void add_stage( char* name, ac_stg_list** listp ){
00534 
00535         ac_stg_list* list;
00536 
00537   stage_num++;
00538   pstage = (ac_stg_list*) malloc( sizeof(ac_stg_list));
00539   pstage->name = (char*) malloc( strlen(name)+1);
00540   strcpy(pstage->name, name);   
00541   pstage->id = stage_num;
00542   pstage->next = NULL;
00543 
00544         list = *listp;
00545         /* Inserting at the tail */
00546         if( list ){
00547 
00548            /* finding list tail */
00549            for(; list->next != NULL; list= list->next ){}
00550 
00551      /* Adding stage */
00552      list->next = pstage;
00553   }
00554   else  { /*  First stage being added to the list */
00555      *listp = pstage;
00556   }
00557 
00558 }
00559 
00560 
00561 /**************************************/
00567 /***************************************/
00568 void add_storage( char* name, unsigned size, ac_sto_types type){
00569 
00570   pstorage = (ac_sto_list*) malloc( sizeof(ac_sto_list));
00571   pstorage->name = (char*) malloc( strlen(name)+1);
00572   strcpy(pstorage->name,name);
00573   if( type == REG && current_type){
00574     pstorage->format = (char*) malloc( strlen(current_type)+1);
00575     strcpy(pstorage->format,current_type);
00576   }
00577   else
00578     pstorage->format = NULL;
00579     
00580         if( type == MEM || type == CACHE || type == ICACHE || type == DCACHE)
00581         pstorage->size = size * current_unit;
00582         else
00583         pstorage->size = size;
00584 
00585 
00586         /* In this case we may have a cache declaration with a parameter list or a generic cache*/
00587         if( (type == CACHE || type == ICACHE || type == DCACHE)  ){
00588 
00589                 if( parms_list ){
00590                         /* Plugging paramenters for ac_cache instantiation. */
00591                         pstorage->parms = parms_list;
00592                         /* Reseting list for future declarations */
00593                         parms_list = parms_list_tail = NULL;
00594                 }
00595                 else{ /* Generic cache object */
00596                         if (pstorage->size==0){
00597                                 AC_ERROR("Line %d: Invalid size in cache declaration: %s.\n", line_num, name);
00598                                 exit(1);
00599                         }
00600                         else
00601                                 pstorage->parms = NULL;
00602                 }               
00603         }
00604 
00605   pstorage->type = type;
00606   pstorage->next = NULL;
00607   pstorage->higher = NULL;
00608   pstorage->level = 0;
00609 
00610         if(  type == ICACHE  ){
00611                 fetch_device = pstorage;
00612         }
00613 
00614         //Checking if the user declared a specific register width for this bank
00615         if(  type == REGBANK && reg_width != 0  ){
00616                 pstorage->width = reg_width;
00617         }
00618 
00619   if( storage_list_tail ){
00620      storage_list_tail->next = pstorage;
00621      storage_list_tail = pstorage;
00622   }
00623   else  { /*  First device being added to the list */
00624      storage_list_tail = storage_list = pstorage;
00625   }  
00626 }
00627 
00628 
00629 
00630 
00631 /* Enabling traces.  */
00632 #ifndef YYDEBUG
00633 # define YYDEBUG 0
00634 #endif
00635 
00636 /* Enabling verbose error messages.  */
00637 #ifdef YYERROR_VERBOSE
00638 # undef YYERROR_VERBOSE
00639 # define YYERROR_VERBOSE 1
00640 #else
00641 # define YYERROR_VERBOSE 0
00642 #endif
00643 
00644 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
00645 #line 578 "src/acpp/archc.bison"
00646 typedef union YYSTYPE {
00647   char* text;
00648   int value;
00649 } YYSTYPE;
00650 /* Line 191 of yacc.c.  */
00651 #line 651 "./src/acpp/archc.parser.c"
00652 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
00653 # define YYSTYPE_IS_DECLARED 1
00654 # define YYSTYPE_IS_TRIVIAL 1
00655 #endif
00656 
00657 
00658 
00659 /* Copy the second part of user declarations.  */
00660 
00661 
00662 /* Line 214 of yacc.c.  */
00663 #line 663 "./src/acpp/archc.parser.c"
00664 
00665 #if ! defined (yyoverflow) || YYERROR_VERBOSE
00666 
00667 /* The parser invokes alloca or malloc; define the necessary symbols.  */
00668 
00669 # if YYSTACK_USE_ALLOCA
00670 #  define YYSTACK_ALLOC alloca
00671 # else
00672 #  ifndef YYSTACK_USE_ALLOCA
00673 #   if defined (alloca) || defined (_ALLOCA_H)
00674 #    define YYSTACK_ALLOC alloca
00675 #   else
00676 #    ifdef __GNUC__
00677 #     define YYSTACK_ALLOC __builtin_alloca
00678 #    endif
00679 #   endif
00680 #  endif
00681 # endif
00682 
00683 # ifdef YYSTACK_ALLOC
00684    /* Pacify GCC's `empty if-body' warning. */
00685 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
00686 # else
00687 #  if defined (__STDC__) || defined (__cplusplus)
00688 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00689 #   define YYSIZE_T size_t
00690 #  endif
00691 #  define YYSTACK_ALLOC malloc
00692 #  define YYSTACK_FREE free
00693 # endif
00694 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
00695 
00696 
00697 #if (! defined (yyoverflow) \
00698      && (! defined (__cplusplus) \
00699          || (YYSTYPE_IS_TRIVIAL)))
00700 
00701 /* A type that is properly aligned for any stack member.  */
00702 union yyalloc
00703 {
00704   short yyss;
00705   YYSTYPE yyvs;
00706   };
00707 
00708 /* The size of the maximum gap between one aligned stack and the next.  */
00709 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
00710 
00711 /* The size of an array large to enough to hold all stacks, each with
00712    N elements.  */
00713 # define YYSTACK_BYTES(N) \
00714      ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
00715       + YYSTACK_GAP_MAXIMUM)
00716 
00717 /* Copy COUNT objects from FROM to TO.  The source and destination do
00718    not overlap.  */
00719 # ifndef YYCOPY
00720 #  if 1 < __GNUC__
00721 #   define YYCOPY(To, From, Count) \
00722       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00723 #  else
00724 #   define YYCOPY(To, From, Count)              \
00725       do                                        \
00726         {                                       \
00727           register YYSIZE_T yyi;                \
00728           for (yyi = 0; yyi < (Count); yyi++)   \
00729             (To)[yyi] = (From)[yyi];            \
00730         }                                       \
00731       while (0)
00732 #  endif
00733 # endif
00734 
00735 /* Relocate STACK from its old location to the new one.  The
00736    local variables YYSIZE and YYSTACKSIZE give the old and new number of
00737    elements in the stack, and YYPTR gives the new location of the
00738    stack.  Advance YYPTR to a properly aligned location for the next
00739    stack.  */
00740 # define YYSTACK_RELOCATE(Stack)                                        \
00741     do                                                                  \
00742       {                                                                 \
00743         YYSIZE_T yynewbytes;                                            \
00744         YYCOPY (&yyptr->Stack, Stack, yysize);                          \
00745         Stack = &yyptr->Stack;                                          \
00746         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
00747         yyptr += yynewbytes / sizeof (*yyptr);                          \
00748       }                                                                 \
00749     while (0)
00750 
00751 #endif
00752 
00753 #if defined (__STDC__) || defined (__cplusplus)
00754    typedef signed char yysigned_char;
00755 #else
00756    typedef short yysigned_char;
00757 #endif
00758 
00759 /* YYFINAL -- State number of the termination state. */
00760 #define YYFINAL  8
00761 /* YYLAST -- Last index in YYTABLE.  */
00762 #define YYLAST   177
00763 
00764 /* YYNTOKENS -- Number of terminals. */
00765 #define YYNTOKENS  43
00766 /* YYNNTS -- Number of nonterminals. */
00767 #define YYNNTS  55
00768 /* YYNRULES -- Number of rules. */
00769 #define YYNRULES  86
00770 /* YYNRULES -- Number of states. */
00771 #define YYNSTATES  231
00772 
00773 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
00774 #define YYUNDEFTOK  2
00775 #define YYMAXUTOK   297
00776 
00777 #define YYTRANSLATE(YYX)                                                \
00778   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
00779 
00780 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
00781 static const unsigned char yytranslate[] =
00782 {
00783        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00784        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00785        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00786        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00787        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00788        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00789        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00790        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00791        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00792        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00793        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00794        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00795        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00796        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00797        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00798        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00799        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00800        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00801        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00802        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00803        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00804        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00805        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00806        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00807        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00808        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
00809        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
00810       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
00811       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
00812       35,    36,    37,    38,    39,    40,    41,    42
00813 };
00814 
00815 #if YYDEBUG
00816 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
00817    YYRHS.  */
00818 static const unsigned short yyprhs[] =
00819 {
00820        0,     0,     3,     4,     6,     8,     9,    19,    23,    26,
00821       27,    33,    36,    37,    38,    47,    56,    59,    62,    65,
00822       68,    69,    77,    78,    90,    98,    99,   109,   112,   113,
00823      117,   118,   122,   123,   133,   136,   139,   142,   145,   148,
00824      151,   154,   155,   157,   158,   160,   162,   164,   166,   167,
00825      176,   177,   181,   182,   186,   187,   191,   192,   200,   213,
00826      218,   221,   223,   225,   226,   235,   236,   243,   248,   249,
00827      253,   254,   258,   259,   260,   266,   267,   277,   281,   285,
00828      294,   301,   308,   317,   318,   319,   324
00829 };
00830 
00831 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
00832 static const yysigned_char yyrhs[] =
00833 {
00834       44,     0,    -1,    -1,    45,    -1,    64,    -1,    -1,    22,
00835       13,    21,    12,    16,    46,    47,    17,     7,    -1,    48,
00836       50,    53,    -1,    48,    49,    -1,    -1,    24,    21,    11,
00837        4,     7,    -1,    50,    51,    -1,    -1,    -1,    25,     9,
00838       21,    10,    21,    52,    96,     7,    -1,    23,    13,    21,
00839       12,    16,    54,    17,     7,    -1,    55,    54,    -1,    56,
00840       54,    -1,    58,    54,    -1,    59,    54,    -1,    -1,    21,
00841        5,    19,    13,     4,    12,     7,    -1,    -1,    21,     5,
00842       18,    13,    21,    11,     3,    57,    62,    12,     7,    -1,
00843       21,     5,    20,    13,     3,    12,     7,    -1,    -1,    21,
00844        5,    26,    13,     3,    60,    61,    12,     7,    -1,     6,
00845        3,    -1,    -1,     6,    63,    62,    -1,    -1,    21,    11,
00846        3,    -1,    -1,    27,    13,    21,    12,    16,    65,    66,
00847       17,     7,    -1,    67,    94,    -1,    69,    67,    -1,    49,
00848       67,    -1,    88,    67,    -1,    92,    67,    -1,    93,    67,
00849       -1,    90,    67,    -1,    -1,    21,    -1,    -1,    72,    -1,
00850       70,    -1,    81,    -1,    83,    -1,    -1,    31,    21,     8,
00851        3,    68,    71,    85,     7,    -1,    -1,    28,    73,    76,
00852       -1,    -1,    29,    74,    76,    -1,    -1,    30,    75,    76,
00853       -1,    -1,    21,     8,     3,    68,    77,    85,     7,    -1,
00854       21,    13,    80,     6,    79,     6,    79,     6,    80,     6,
00855       80,    78,    -1,     6,    80,    12,     7,    -1,    12,     7,
00856       -1,     3,    -1,     4,    -1,    -1,    33,    87,    21,     8,
00857        3,    82,    85,     7,    -1,    -1,    34,    86,    21,    84,
00858       96,     7,    -1,     6,    21,     8,     3,    -1,    -1,     9,
00859       21,    10,    -1,    -1,     9,     3,    10,    -1,    -1,    -1,
00860       35,    21,    89,    96,     7,    -1,    -1,    36,    21,    11,
00861       16,    21,    91,    96,    17,     7,    -1,    39,     3,     7,
00862       -1,    40,     3,     7,    -1,    37,    13,    21,    12,    16,
00863       95,    17,     7,    -1,    38,    13,     4,    12,     7,    95,
00864       -1,    41,    13,     4,    12,     7,    95,    -1,    21,     5,
00865       42,    13,    21,    12,     7,    95,    -1,    -1,    -1,     6,
00866       21,    97,    96,    -1,    -1
00867 };
00868 
00869 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
00870 static const unsigned short yyrline[] =
00871 {
00872        0,   589,   589,   590,   593,   601,   600,   612,   615,   616,
00873      619,   635,   636,   640,   639,   658,   661,   662,   663,   664,
00874      665,   668,   688,   687,   717,   734,   731,   752,   765,   771,
00875      772,   775,   798,   797,   825,   833,   834,   835,   836,   837,
00876      838,   839,   847,   860,   866,   867,   868,   869,   874,   873,
00877      884,   884,   885,   885,   886,   886,   891,   890,   905,   913,
00878      914,   918,   935,   954,   953,   964,   963,   979,   994,  1000,
00879     1010,  1017,  1024,  1034,  1033,  1046,  1045,  1064,  1071,  1082,
00880     1085,  1091,  1104,  1133,  1140,  1140,  1174
00881 };
00882 #endif
00883 
00884 #if YYDEBUG || YYERROR_VERBOSE
00885 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
00886    First, the terminals, then, starting at YYNTOKENS, nonterminals. */
00887 static const char *const yytname[] =
00888 {
00889   "$end", "error", "$undefined", "INT", "STR", "\".\"", "\",\"", "\";\"", 
00890   "\":\"", "\"<\"", "\">\"", "\"=\"", "\")\"", "\"(\"", "\"[\"", "\"]\"", 
00891   "\"{\"", "\"}\"", "SET_DECODER", "SET_ASM", "SET_CYCLES", "ID", 
00892   "AC_ISA_UPPER", "ISA_CTOR", "AC_FORMAT", "AC_INSTR", "CYCLE_RANGE", 
00893   "AC_ARCH", "AC_CACHE", "AC_ICACHE", "AC_DCACHE", "AC_MEM", "AC_PC", 
00894   "AC_REGBANK", "AC_REG", "AC_STAGE", "AC_PIPE", "ARCH_CTOR", "AC_ISA", 
00895   "AC_WORDSIZE", "AC_FETCHSIZE", "SET_ENDIAN", "BIND_TO", "$accept", 
00896   "input", "isadec", "@1", "isadecbody", "formatdeclist", "formatdec", 
00897   "instrdeclist", "instrdec", "@2", "ctordec", "ctordecbody", "asmdec", 
00898   "decoderdec", "@3", "cyclesdec", "rangedec", "@4", "interval", 
00899   "fieldinitlist", "fieldinit", "archdec", "@5", "archdecbody", "declist", 
00900   "unit", "storagedec", "memdec", "@6", "cachedec", "@7", "@8", "@9", 
00901   "cacheobjdec", "@10", "cacheobjdec1", "cachenparm", "cachesparm", 
00902   "regbankdec", "@11", "regdec", "@12", "storagelist", "assignformat", 
00903   "assignwidth", "stagedec", "@13", "pipedec", "@14", "worddec", 
00904   "fetchdec", "archctordec", "archctordecbody", "commalist", "@15", 0
00905 };
00906 #endif
00907 
00908 # ifdef YYPRINT
00909 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
00910    token YYLEX-NUM.  */
00911 static const unsigned short yytoknum[] =
00912 {
00913        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
00914      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
00915      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
00916      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
00917      295,   296,   297
00918 };
00919 # endif
00920 
00921 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
00922 static const unsigned char yyr1[] =
00923 {
00924        0,    43,    44,    44,    44,    46,    45,    47,    48,    48,
00925       49,    50,    50,    52,    51,    53,    54,    54,    54,    54,
00926       54,    55,    57,    56,    58,    60,    59,    61,    61,    62,
00927       62,    63,    65,    64,    66,    67,    67,    67,    67,    67,
00928       67,    67,    68,    68,    69,    69,    69,    69,    71,    70,
00929       73,    72,    74,    72,    75,    72,    77,    76,    76,    78,
00930       78,    79,    80,    82,    81,    84,    83,    85,    85,    86,
00931       86,    87,    87,    89,    88,    91,    90,    92,    93,    94,
00932       95,    95,    95,    95,    97,    96,    96
00933 };
00934 
00935 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
00936 static const unsigned char yyr2[] =
00937 {
00938        0,     2,     0,     1,     1,     0,     9,     3,     2,     0,
00939        5,     2,     0,     0,     8,     8,     2,     2,     2,     2,
00940        0,     7,     0,    11,     7,     0,     9,     2,     0,     3,
00941        0,     3,     0,     9,     2,     2,     2,     2,     2,     2,
00942        2,     0,     1,     0,     1,     1,     1,     1,     0,     8,
00943        0,     3,     0,     3,     0,     3,     0,     7,    12,     4,
00944        2,     1,     1,     0,     8,     0,     6,     4,     0,     3,
00945        0,     3,     0,     0,     5,     0,     9,     3,     3,     8,
00946        6,     6,     8,     0,     0,     4,     0
00947 };
00948 
00949 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
00950    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
00951    means the default is an error.  */
00952 static const unsigned char yydefact[] =
00953 {
00954        2,     0,     0,     0,     3,     4,     0,     0,     1,     0,
00955        0,     0,     0,     5,    32,     9,    41,     0,    12,     0,
00956       50,    52,    54,     0,    72,    70,     0,     0,     0,     0,
00957       41,     0,     0,    41,    45,    44,    46,    47,    41,    41,
00958       41,    41,     0,     8,     0,     0,     0,     0,     0,     0,
00959        0,     0,     0,     0,    73,     0,     0,     0,    36,     0,
00960        0,    34,    35,    37,    40,    38,    39,     6,     0,     0,
00961       11,     7,     0,     0,    51,    53,    55,     0,     0,     0,
00962        0,    65,    86,     0,    77,    78,    33,     0,     0,     0,
00963        0,     0,     0,    43,    71,     0,    69,    86,     0,     0,
00964        0,     0,     0,     0,    10,    43,    62,     0,    42,    48,
00965       63,     0,    84,    74,    75,     0,     0,     0,    56,     0,
00966       68,    68,    66,    86,    86,    83,    20,    13,    68,    61,
00967        0,     0,     0,     0,    85,     0,     0,     0,     0,     0,
00968        0,     0,    20,    20,    20,    20,    86,     0,     0,     0,
00969       49,    64,     0,     0,     0,     0,     0,     0,     0,    16,
00970       17,    18,    19,     0,    57,     0,     0,    76,     0,     0,
00971        0,    79,     0,     0,     0,     0,    15,    14,     0,    67,
00972        0,     0,     0,     0,     0,     0,     0,     0,     0,    83,
00973       83,     0,     0,     0,    25,     0,     0,    80,    81,     0,
00974        0,     0,    28,     0,    83,    22,    21,    24,     0,     0,
00975        0,     0,    58,    82,    30,    27,     0,     0,    60,     0,
00976        0,    26,     0,     0,    30,     0,    59,     0,    29,    23,
00977       31
00978 };
00979 
00980 /* YYDEFGOTO[NTERM-NUM]. */
00981 static const short yydefgoto[] =
00982 {
00983       -1,     3,     4,    15,    17,    18,    30,    44,    70,   146,
00984       71,   141,   142,   143,   214,   144,   145,   202,   209,   220,
00985      224,     5,    16,    31,    32,   109,    33,    34,   120,    35,
00986       46,    47,    48,    74,   128,   212,   130,   107,    36,   121,
00987       37,    97,   132,    53,    51,    38,    82,    39,   124,    40,
00988       41,    61,   139,    99,   123
00989 };
00990 
00991 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
00992    STATE-NUM.  */
00993 #define YYPACT_NINF -185
00994 static const short yypact[] =
00995 {
00996       20,    -2,     8,     3,  -185,  -185,    18,    22,  -185,    33,
00997       44,    41,    42,  -185,  -185,  -185,     1,    43,    35,    40,
00998     -185,  -185,  -185,    45,    53,    54,    46,    47,    61,    62,
00999        1,    52,    34,     1,  -185,  -185,  -185,  -185,     1,     1,
01000        1,     1,    63,  -185,    23,    64,    51,    51,    51,    65,
01001       71,    55,    56,    57,  -185,    68,    73,    74,  -185,    75,
01002       70,  -185,  -185,  -185,  -185,  -185,  -185,  -185,    72,    77,
01003     -185,  -185,    80,    15,  -185,  -185,  -185,    84,    78,    81,
01004       82,  -185,    85,    79,  -185,  -185,  -185,    69,    76,    83,
01005       86,    91,    92,    87,  -185,    95,  -185,    85,    88,    93,
01006       89,    90,    94,    97,  -185,    87,  -185,    99,  -185,  -185,
01007     -185,    96,  -185,  -185,  -185,    98,   100,   101,  -185,   108,
01008      106,   106,  -185,    85,    85,   -19,   102,  -185,   106,  -185,
01009      107,   103,   110,   111,  -185,   104,   114,   112,   113,   115,
01010      122,   116,   102,   102,   102,   102,    85,   121,   108,   123,
01011     -185,  -185,   127,    59,   125,   126,   128,   -10,   129,  -185,
01012     -185,  -185,  -185,   130,  -185,   109,   117,  -185,   131,   133,
01013      134,  -185,   135,   136,   137,   138,  -185,  -185,    92,  -185,
01014      118,   140,   145,   119,   139,   150,   151,   132,   143,   -19,
01015      -19,   146,   144,   147,  -185,    92,   153,  -185,  -185,   155,
01016      154,   156,   158,    32,   -19,  -185,  -185,  -185,   159,   157,
01017       92,   160,  -185,  -185,   162,  -185,   163,   161,  -185,   120,
01018      164,  -185,   165,   166,   162,   167,  -185,   168,  -185,  -185,
01019     -185
01020 };
01021 
01022 /* YYPGOTO[NTERM-NUM].  */
01023 static const short yypgoto[] =
01024 {
01025     -185,  -185,  -185,  -185,  -185,  -185,   124,  -185,  -185,  -185,
01026     -185,   -92,  -185,  -185,  -185,  -185,  -185,  -185,  -185,  -125,
01027     -185,  -185,  -185,  -185,   -26,    60,  -185,  -185,  -185,  -185,
01028     -185,  -185,  -185,     7,  -185,  -185,    27,  -177,  -185,  -185,
01029     -185,  -185,  -104,  -185,  -185,  -185,  -185,  -185,  -185,  -185,
01030     -185,  -185,  -184,   -97,  -185
01031 };
01032 
01033 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
01034    positive, shift that token.  If negative, reduce the rule which
01035    number is the opposite.  If zero, do what YYDEFACT says.
01036    If YYTABLE_NINF, syntax error.  */
01037 #define YYTABLE_NINF -1
01038 static const unsigned char yytable[] =
01039 {
01040      111,   187,   136,     8,    58,   197,   198,    62,   172,   173,
01041      174,     6,    63,    64,    65,    66,   175,   133,   203,   137,
01042      213,     7,   138,    91,   147,    19,   134,   135,    92,    20,
01043       21,    22,    23,   217,    24,    25,    26,    27,   210,     9,
01044       28,    29,     1,    10,   211,    11,    68,     2,    69,   163,
01045      159,   160,   161,   162,    75,    76,    12,    13,    14,    19,
01046       42,    45,    50,    52,    56,    57,    49,    54,    55,    59,
01047       67,    60,    73,    77,    78,    72,    79,    80,    81,    83,
01048       84,    85,    86,    87,    90,    88,    89,    93,    94,    95,
01049      101,    98,    96,   104,   105,   100,   106,   102,   110,   228,
01050      113,   168,   115,   122,   103,   119,   116,   117,   108,   112,
01051      114,   129,   131,   148,   125,   178,   126,   150,   151,   153,
01052      179,   152,   127,   140,   149,   154,   155,   157,   164,   169,
01053      170,   166,   156,   158,   167,   171,   176,   177,   195,   188,
01054      191,   223,    43,   192,   180,   181,   182,   189,   183,   184,
01055      185,   186,   190,   193,   194,   196,   200,   199,   205,   201,
01056      204,   206,   215,   207,   208,   118,     0,   218,   219,   216,
01057      221,   230,   226,   222,   229,   165,   225,   227
01058 };
01059 
01060 static const short yycheck[] =
01061 {
01062       97,   178,    21,     0,    30,   189,   190,    33,    18,    19,
01063       20,    13,    38,    39,    40,    41,    26,   121,   195,    38,
01064      204,    13,    41,     8,   128,    24,   123,   124,    13,    28,
01065       29,    30,    31,   210,    33,    34,    35,    36,     6,    21,
01066       39,    40,    22,    21,    12,    12,    23,    27,    25,   146,
01067      142,   143,   144,   145,    47,    48,    12,    16,    16,    24,
01068       17,    21,     9,     9,     3,     3,    21,    21,    21,    17,
01069        7,    37,    21,     8,     3,    11,    21,    21,    21,    11,
01070        7,     7,     7,    13,     4,    13,     9,     3,    10,     8,
01071       21,     6,    10,     7,     3,    16,     4,    21,     3,   224,
01072        7,    42,    12,     7,    21,     6,    12,    10,    21,    21,
01073       21,     3,     6,     6,    16,     6,    16,     7,     7,     5,
01074        3,    17,    21,    21,    21,    13,    13,     5,     7,     4,
01075        4,     8,    17,    17,     7,     7,     7,     7,     6,    21,
01076       21,    21,    18,     4,    13,    12,    12,     7,    13,    13,
01077       13,    13,     7,     3,     3,    12,    12,    11,     3,    12,
01078        7,     7,     3,     7,     6,   105,    -1,     7,     6,    12,
01079        7,     3,     7,    12,     7,   148,    12,    11
01080 };
01081 
01082 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
01083    symbol of state STATE-NUM.  */
01084 static const unsigned char yystos[] =
01085 {
01086        0,    22,    27,    44,    45,    64,    13,    13,     0,    21,
01087       21,    12,    12,    16,    16,    46,    65,    47,    48,    24,
01088       28,    29,    30,    31,    33,    34,    35,    36,    39,    40,
01089       49,    66,    67,    69,    70,    72,    81,    83,    88,    90,
01090       92,    93,    17,    49,    50,    21,    73,    74,    75,    21,
01091        9,    87,     9,    86,    21,    21,     3,     3,    67,    17,
01092       37,    94,    67,    67,    67,    67,    67,     7,    23,    25,
01093       51,    53,    11,    21,    76,    76,    76,     8,     3,    21,
01094       21,    21,    89,    11,     7,     7,     7,    13,    13,     9,
01095        4,     8,    13,     3,    10,     8,    10,    84,     6,    96,
01096       16,    21,    21,    21,     7,     3,     4,    80,    21,    68,
01097        3,    96,    21,     7,    21,    12,    12,    10,    68,     6,
01098       71,    82,     7,    97,    91,    16,    16,    21,    77,     3,
01099       79,     6,    85,    85,    96,    96,    21,    38,    41,    95,
01100       21,    54,    55,    56,    58,    59,    52,    85,     6,    21,
01101        7,     7,    17,     5,    13,    13,    17,     5,    17,    54,
01102       54,    54,    54,    96,     7,    79,     8,     7,    42,     4,
01103        4,     7,    18,    19,    20,    26,     7,     7,     6,     3,
01104       13,    12,    12,    13,    13,    13,    13,    80,    21,     7,
01105        7,    21,     4,     3,     3,     6,    12,    95,    95,    11,
01106       12,    12,    60,    80,     7,     3,     7,     7,     6,    61,
01107        6,    12,    78,    95,    57,     3,    12,    80,     7,     6,
01108       62,     7,    12,    21,    63,    12,     7,    11,    62,     7,
01109        3
01110 };
01111 
01112 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
01113 # define YYSIZE_T __SIZE_TYPE__
01114 #endif
01115 #if ! defined (YYSIZE_T) && defined (size_t)
01116 # define YYSIZE_T size_t
01117 #endif
01118 #if ! defined (YYSIZE_T)
01119 # if defined (__STDC__) || defined (__cplusplus)
01120 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
01121 #  define YYSIZE_T size_t
01122 # endif
01123 #endif
01124 #if ! defined (YYSIZE_T)
01125 # define YYSIZE_T unsigned int
01126 #endif
01127 
01128 #define yyerrok         (yyerrstatus = 0)
01129 #define yyclearin       (yychar = YYEMPTY)
01130 #define YYEMPTY         (-2)
01131 #define YYEOF           0
01132 
01133 #define YYACCEPT        goto yyacceptlab
01134 #define YYABORT         goto yyabortlab
01135 #define YYERROR         goto yyerrlab1
01136 
01137 
01138 /* Like YYERROR except do call yyerror.  This remains here temporarily
01139    to ease the transition to the new meaning of YYERROR, for GCC.
01140    Once GCC version 2 has supplanted version 1, this can go.  */
01141 
01142 #define YYFAIL          goto yyerrlab
01143 
01144 #define YYRECOVERING()  (!!yyerrstatus)
01145 
01146 #define YYBACKUP(Token, Value)                                  \
01147 do                                                              \
01148   if (yychar == YYEMPTY && yylen == 1)                          \
01149     {                                                           \
01150       yychar = (Token);                                         \
01151       yylval = (Value);                                         \
01152       yytoken = YYTRANSLATE (yychar);                           \
01153       YYPOPSTACK;                                               \
01154       goto yybackup;                                            \
01155     }                                                           \
01156   else                                                          \
01157     {                                                           \
01158       yyerror ("syntax error: cannot back up");\
01159       YYERROR;                                                  \
01160     }                                                           \
01161 while (0)
01162 
01163 #define YYTERROR        1
01164 #define YYERRCODE       256
01165 
01166 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
01167    are run).  */
01168 
01169 #ifndef YYLLOC_DEFAULT
01170 # define YYLLOC_DEFAULT(Current, Rhs, N)         \
01171   Current.first_line   = Rhs[1].first_line;      \
01172   Current.first_column = Rhs[1].first_column;    \
01173   Current.last_line    = Rhs[N].last_line;       \
01174   Current.last_column  = Rhs[N].last_column;
01175 #endif
01176 
01177 /* YYLEX -- calling `yylex' with the right arguments.  */
01178 
01179 #ifdef YYLEX_PARAM
01180 # define YYLEX yylex (YYLEX_PARAM)
01181 #else
01182 # define YYLEX yylex ()
01183 #endif
01184 
01185 /* Enable debugging if requested.  */
01186 #if YYDEBUG
01187 
01188 # ifndef YYFPRINTF
01189 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
01190 #  define YYFPRINTF fprintf
01191 # endif
01192 
01193 # define YYDPRINTF(Args)                        \
01194 do {                                            \
01195   if (yydebug)                                  \
01196     YYFPRINTF Args;                             \
01197 } while (0)
01198 
01199 # define YYDSYMPRINT(Args)                      \
01200 do {                                            \
01201   if (yydebug)                                  \
01202     yysymprint Args;                            \
01203 } while (0)
01204 
01205 # define YYDSYMPRINTF(Title, Token, Value, Location)            \
01206 do {                                                            \
01207   if (yydebug)                                                  \
01208     {                                                           \
01209       YYFPRINTF (stderr, "%s ", Title);                         \
01210       yysymprint (stderr,                                       \
01211                   Token, Value);        \
01212       YYFPRINTF (stderr, "\n");                                 \
01213     }                                                           \
01214 } while (0)
01215 
01216 /*------------------------------------------------------------------.
01217 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
01218 | TOP (cinluded).                                                   |
01219 `------------------------------------------------------------------*/
01220 
01221 #if defined (__STDC__) || defined (__cplusplus)
01222 static void
01223 yy_stack_print (short *bottom, short *top)
01224 #else
01225 static void
01226 yy_stack_print (bottom, top)
01227     short *bottom;
01228     short *top;
01229 #endif
01230 {
01231   YYFPRINTF (stderr, "Stack now");
01232   for (/* Nothing. */; bottom <= top; ++bottom)
01233     YYFPRINTF (stderr, " %d", *bottom);
01234   YYFPRINTF (stderr, "\n");
01235 }
01236 
01237 # define YY_STACK_PRINT(Bottom, Top)                            \
01238 do {                                                            \
01239   if (yydebug)                                                  \
01240     yy_stack_print ((Bottom), (Top));                           \
01241 } while (0)
01242 
01243 
01244 /*------------------------------------------------.
01245 | Report that the YYRULE is going to be reduced.  |
01246 `------------------------------------------------*/
01247 
01248 #if defined (__STDC__) || defined (__cplusplus)
01249 static void
01250 yy_reduce_print (int yyrule)
01251 #else
01252 static void
01253 yy_reduce_print (yyrule)
01254     int yyrule;
01255 #endif
01256 {
01257   int yyi;
01258   unsigned int yylineno = yyrline[yyrule];
01259   YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
01260              yyrule - 1, yylineno);
01261   /* Print the symbols being reduced, and their result.  */
01262   for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
01263     YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
01264   YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
01265 }
01266 
01267 # define YY_REDUCE_PRINT(Rule)          \
01268 do {                                    \
01269   if (yydebug)                          \
01270     yy_reduce_print (Rule);             \
01271 } while (0)
01272 
01273 /* Nonzero means print parse trace.  It is left uninitialized so that
01274    multiple parsers can coexist.  */
01275 int yydebug;
01276 #else /* !YYDEBUG */
01277 # define YYDPRINTF(Args)
01278 # define YYDSYMPRINT(Args)
01279 # define YYDSYMPRINTF(Title, Token, Value, Location)
01280 # define YY_STACK_PRINT(Bottom, Top)
01281 # define YY_REDUCE_PRINT(Rule)
01282 #endif /* !YYDEBUG */
01283 
01284 
01285 /* YYINITDEPTH -- initial size of the parser's stacks.  */
01286 #ifndef YYINITDEPTH
01287 # define YYINITDEPTH 200
01288 #endif
01289 
01290 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
01291    if the built-in stack extension method is used).
01292 
01293    Do not make this value too large; the results are undefined if
01294    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
01295    evaluated with infinite-precision integer arithmetic.  */
01296 
01297 #if YYMAXDEPTH == 0
01298 # undef YYMAXDEPTH
01299 #endif
01300 
01301 #ifndef YYMAXDEPTH
01302 # define YYMAXDEPTH 10000
01303 #endif
01304 
01305 
01306 
01307 #if YYERROR_VERBOSE
01308 
01309 # ifndef yystrlen
01310 #  if defined (__GLIBC__) && defined (_STRING_H)
01311 #   define yystrlen strlen
01312 #  else
01313 /* Return the length of YYSTR.  */
01314 static YYSIZE_T
01315 #   if defined (__STDC__) || defined (__cplusplus)
01316 yystrlen (const char *yystr)
01317 #   else
01318 yystrlen (yystr)
01319      const char *yystr;
01320 #   endif
01321 {
01322   register const char *yys = yystr;
01323 
01324   while (*yys++ != '\0')
01325     continue;
01326 
01327   return yys - yystr - 1;
01328 }
01329 #  endif
01330 # endif
01331 
01332 # ifndef yystpcpy
01333 #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
01334 #   define yystpcpy stpcpy
01335 #  else
01336 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
01337    YYDEST.  */
01338 static char *
01339 #   if defined (__STDC__) || defined (__cplusplus)
01340 yystpcpy (char *yydest, const char *yysrc)
01341 #   else
01342 yystpcpy (yydest, yysrc)
01343      char *yydest;
01344      const char *yysrc;
01345 #   endif
01346 {
01347   register char *yyd = yydest;
01348   register const char *yys = yysrc;
01349 
01350   while ((*yyd++ = *yys++) != '\0')
01351     continue;
01352 
01353   return yyd - 1;
01354 }
01355 #  endif
01356 # endif
01357 
01358 #endif /* !YYERROR_VERBOSE */
01359 
01360 
01361 
01362 #if YYDEBUG
01363 /*--------------------------------.
01364 | Print this symbol on YYOUTPUT.  |
01365 `--------------------------------*/
01366 
01367 #if defined (__STDC__) || defined (__cplusplus)
01368 static void
01369 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
01370 #else
01371 static void
01372 yysymprint (yyoutput, yytype, yyvaluep)
01373     FILE *yyoutput;
01374     int yytype;
01375     YYSTYPE *yyvaluep;
01376 #endif
01377 {
01378   /* Pacify ``unused variable'' warnings.  */
01379   (void) yyvaluep;
01380 
01381   if (yytype < YYNTOKENS)
01382     {
01383       YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
01384 # ifdef YYPRINT
01385       YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
01386 # endif
01387     }
01388   else
01389     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
01390 
01391   switch (yytype)
01392     {
01393       default:
01394         break;
01395     }
01396   YYFPRINTF (yyoutput, ")");
01397 }
01398 
01399 #endif /* ! YYDEBUG */
01400 /*-----------------------------------------------.
01401 | Release the memory associated to this symbol.  |
01402 `-----------------------------------------------*/
01403 
01404 #if defined (__STDC__) || defined (__cplusplus)
01405 static void
01406 yydestruct (int yytype, YYSTYPE *yyvaluep)
01407 #else
01408 static void
01409 yydestruct (yytype, yyvaluep)
01410     int yytype;
01411     YYSTYPE *yyvaluep;
01412 #endif
01413 {
01414   /* Pacify ``unused variable'' warnings.  */
01415   (void) yyvaluep;
01416 
01417   switch (yytype)
01418     {
01419 
01420       default:
01421         break;
01422     }
01423 }
01424 
01425 
01426 /* Prevent warnings from -Wmissing-prototypes.  */
01427 
01428 #ifdef YYPARSE_PARAM
01429 # if defined (__STDC__) || defined (__cplusplus)
01430 int yyparse (void *YYPARSE_PARAM);
01431 # else
01432 int yyparse ();
01433 # endif
01434 #else /* ! YYPARSE_PARAM */
01435 #if defined (__STDC__) || defined (__cplusplus)
01436 int yyparse (void);
01437 #else
01438 int yyparse ();
01439 #endif
01440 #endif /* ! YYPARSE_PARAM */
01441 
01442 
01443 
01444 /* The lookahead symbol.  */
01445 int yychar;
01446 
01447 /* The semantic value of the lookahead symbol.  */
01448 YYSTYPE yylval;
01449 
01450 /* Number of syntax errors so far.  */
01451 int yynerrs;
01452 
01453 
01454 
01455 /*----------.
01456 | yyparse.  |
01457 `----------*/
01458 
01459 #ifdef YYPARSE_PARAM
01460 # if defined (__STDC__) || defined (__cplusplus)
01461 int yyparse (void *YYPARSE_PARAM)
01462 # else
01463 int yyparse (YYPARSE_PARAM)
01464   void *YYPARSE_PARAM;
01465 # endif
01466 #else /* ! YYPARSE_PARAM */
01467 #if defined (__STDC__) || defined (__cplusplus)
01468 int
01469 yyparse (void)
01470 #else
01471 int
01472 yyparse ()
01473 
01474 #endif
01475 #endif
01476 {
01477   
01478   register int yystate;
01479   register int yyn;
01480   int yyresult;
01481   /* Number of tokens to shift before error messages enabled.  */
01482   int yyerrstatus;
01483   /* Lookahead token as an internal (translated) token number.  */
01484   int yytoken = 0;
01485 
01486   /* Three stacks and their tools:
01487      `yyss': related to states,
01488      `yyvs': related to semantic values,
01489      `yyls': related to locations.
01490 
01491      Refer to the stacks thru separate pointers, to allow yyoverflow
01492      to reallocate them elsewhere.  */
01493 
01494   /* The state stack.  */
01495   short yyssa[YYINITDEPTH];
01496   short *yyss = yyssa;
01497   register short *yyssp;
01498 
01499   /* The semantic value stack.  */
01500   YYSTYPE yyvsa[YYINITDEPTH];
01501   YYSTYPE *yyvs = yyvsa;
01502   register YYSTYPE *yyvsp;
01503 
01504 
01505 
01506 #define YYPOPSTACK   (yyvsp--, yyssp--)
01507 
01508   YYSIZE_T yystacksize = YYINITDEPTH;
01509 
01510   /* The variables used to return semantic value and location from the
01511      action routines.  */
01512   YYSTYPE yyval;
01513 
01514 
01515   /* When reducing, the number of symbols on the RHS of the reduced
01516      rule.  */
01517   int yylen;
01518 
01519   YYDPRINTF ((stderr, "Starting parse\n"));
01520 
01521   yystate = 0;
01522   yyerrstatus = 0;
01523   yynerrs = 0;
01524   yychar = YYEMPTY;             /* Cause a token to be read.  */
01525 
01526   /* Initialize stack pointers.
01527      Waste one element of value and location stack
01528      so that they stay on the same level as the state stack.
01529      The wasted elements are never initialized.  */
01530 
01531   yyssp = yyss;
01532   yyvsp = yyvs;
01533 
01534   goto yysetstate;
01535 
01536 /*------------------------------------------------------------.
01537 | yynewstate -- Push a new state, which is found in yystate.  |
01538 `------------------------------------------------------------*/
01539  yynewstate:
01540   /* In all cases, when you get here, the value and location stacks
01541      have just been pushed. so pushing a state here evens the stacks.
01542      */
01543   yyssp++;
01544 
01545  yysetstate:
01546   *yyssp = yystate;
01547 
01548   if (yyss + yystacksize - 1 <= yyssp)
01549     {
01550       /* Get the current used size of the three stacks, in elements.  */
01551       YYSIZE_T yysize = yyssp - yyss + 1;
01552 
01553 #ifdef yyoverflow
01554       {
01555         /* Give user a chance to reallocate the stack. Use copies of
01556            these so that the &'s don't force the real ones into
01557            memory.  */
01558         YYSTYPE *yyvs1 = yyvs;
01559         short *yyss1 = yyss;
01560 
01561 
01562         /* Each stack pointer address is followed by the size of the
01563            data in use in that stack, in bytes.  This used to be a
01564            conditional around just the two extra args, but that might
01565            be undefined if yyoverflow is a macro.  */
01566         yyoverflow ("parser stack overflow",
01567                     &yyss1, yysize * sizeof (*yyssp),
01568                     &yyvs1, yysize * sizeof (*yyvsp),
01569 
01570                     &yystacksize);
01571 
01572         yyss = yyss1;
01573         yyvs = yyvs1;
01574       }
01575 #else /* no yyoverflow */
01576 # ifndef YYSTACK_RELOCATE
01577       goto yyoverflowlab;
01578 # else
01579       /* Extend the stack our own way.  */
01580       if (YYMAXDEPTH <= yystacksize)
01581         goto yyoverflowlab;
01582       yystacksize *= 2;
01583       if (YYMAXDEPTH < yystacksize)
01584         yystacksize = YYMAXDEPTH;
01585 
01586       {
01587         short *yyss1 = yyss;
01588         union yyalloc *yyptr =
01589           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
01590         if (! yyptr)
01591           goto yyoverflowlab;
01592         YYSTACK_RELOCATE (yyss);
01593         YYSTACK_RELOCATE (yyvs);
01594 
01595 #  undef YYSTACK_RELOCATE
01596         if (yyss1 != yyssa)
01597           YYSTACK_FREE (yyss1);
01598       }
01599 # endif
01600 #endif /* no yyoverflow */
01601 
01602       yyssp = yyss + yysize - 1;
01603       yyvsp = yyvs + yysize - 1;
01604 
01605 
01606       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01607                   (unsigned long int) yystacksize));
01608 
01609       if (yyss + yystacksize - 1 <= yyssp)
01610         YYABORT;
01611     }
01612 
01613   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
01614 
01615   goto yybackup;
01616 
01617 /*-----------.
01618 | yybackup.  |
01619 `-----------*/
01620 yybackup:
01621 
01622 /* Do appropriate processing given the current state.  */
01623 /* Read a lookahead token if we need one and don't already have one.  */
01624 /* yyresume: */
01625 
01626   /* First try to decide what to do without reference to lookahead token.  */
01627 
01628   yyn = yypact[yystate];
01629   if (yyn == YYPACT_NINF)
01630     goto yydefault;
01631 
01632   /* Not known => get a lookahead token if don't already have one.  */
01633 
01634   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
01635   if (yychar == YYEMPTY)
01636     {
01637       YYDPRINTF ((stderr, "Reading a token: "));
01638       yychar = YYLEX;
01639     }
01640 
01641   if (yychar <= YYEOF)
01642     {
01643       yychar = yytoken = YYEOF;
01644       YYDPRINTF ((stderr, "Now at end of input.\n"));
01645     }
01646   else
01647     {
01648       yytoken = YYTRANSLATE (yychar);
01649       YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
01650     }
01651 
01652   /* If the proper action on seeing token YYTOKEN is to reduce or to
01653      detect an error, take that action.  */
01654   yyn += yytoken;
01655   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
01656     goto yydefault;
01657   yyn = yytable[yyn];
01658   if (yyn <= 0)
01659     {
01660       if (yyn == 0 || yyn == YYTABLE_NINF)
01661         goto yyerrlab;
01662       yyn = -yyn;
01663       goto yyreduce;
01664     }
01665 
01666   if (yyn == YYFINAL)
01667     YYACCEPT;
01668 
01669   /* Shift the lookahead token.  */
01670   YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
01671 
01672   /* Discard the token being shifted unless it is eof.  */
01673   if (yychar != YYEOF)
01674     yychar = YYEMPTY;
01675 
01676   *++yyvsp = yylval;
01677 
01678 
01679   /* Count tokens shifted since error; after three, turn off error
01680      status.  */
01681   if (yyerrstatus)
01682     yyerrstatus--;
01683 
01684   yystate = yyn;
01685   goto yynewstate;
01686 
01687 
01688 /*-----------------------------------------------------------.
01689 | yydefault -- do the default action for the current state.  |
01690 `-----------------------------------------------------------*/
01691 yydefault:
01692   yyn = yydefact[yystate];
01693   if (yyn == 0)
01694     goto yyerrlab;
01695   goto yyreduce;
01696 
01697 
01698 /*-----------------------------.
01699 | yyreduce -- Do a reduction.  |
01700 `-----------------------------*/
01701 yyreduce:
01702   /* yyn is the number of a rule to reduce with.  */
01703   yylen = yyr2[yyn];
01704 
01705   /* If YYLEN is nonzero, implement the default value of the action:
01706      `$$ = $1'.
01707 
01708      Otherwise, the following line sets YYVAL to garbage.
01709      This behavior is undocumented and Bison
01710      users should not rely upon it.  Assigning to YYVAL
01711      unconditionally makes the parser a bit smaller, and it avoids a
01712      GCC warning that YYVAL may be used uninitialized.  */
01713   yyval = yyvsp[1-yylen];
01714 
01715 
01716   YY_REDUCE_PRINT (yyn);
01717   switch (yyn)
01718     {
01719         case 2:
01720 #line 589 "src/acpp/archc.bison"
01721     { printf("ArchC ERROR: No valid declaration provided.\n");;}
01722     break;
01723 
01724   case 3:
01725 #line 590 "src/acpp/archc.bison"
01726     { 
01727                               ;}
01728     break;
01729 
01730   case 4:
01731 #line 593 "src/acpp/archc.bison"
01732     { 
01733                               ;}
01734     break;
01735 
01736   case 5:
01737 #line 601 "src/acpp/archc.bison"
01738     {
01739                           descrp = ISA_D;
01740 
01741                 ;}
01742     break;
01743 
01744   case 9:
01745 #line 616 "src/acpp/archc.bison"
01746     {;}
01747     break;
01748 
01749   case 10:
01750 #line 620 "src/acpp/archc.bison"
01751     {
01752                           if( descrp == ISA_D )
01753                             add_format( &format_ins_list, &format_ins_list_tail, yyvsp[-3].text, yyvsp[-1].text);
01754                           else if( descrp == ARCH_D )
01755                             add_format( &format_reg_list, &format_reg_list_tail, yyvsp[-3].text, yyvsp[-1].text);
01756                           else
01757                             AC_ERROR("Internal Bug. Invalid description type. It should be ISA_D or ARCH_D");
01758                         ;}
01759     break;
01760 
01761   case 12:
01762 #line 636 "src/acpp/archc.bison"
01763     {;}
01764     break;
01765 
01766   case 13:
01767 #line 640 "src/acpp/archc.bison"
01768     {
01769                           /* Add to the  instruction declaration list. */
01770                           current_type = (char*) malloc( strlen(yyvsp[-2].text)+1);
01771                           strcpy(current_type,yyvsp[-2].text);
01772                           add_instr(yyvsp[0].text);
01773                           list_type = INSTR_L;
01774                         ;}
01775     break;
01776 
01777   case 14:
01778 #line 649 "src/acpp/archc.bison"
01779     {
01780                           free(current_type);
01781                         ;}
01782     break;
01783 
01784   case 20:
01785 #line 665 "src/acpp/archc.bison"
01786     {;}
01787     break;
01788 
01789   case 21:
01790 #line 669 "src/acpp/archc.bison"
01791     {
01792         for( pinstr = instr_list; pinstr != NULL && strcmp(pinstr->name, yyvsp[-6].text); pinstr = pinstr->next);
01793         if( pinstr == NULL ){
01794                  printf("ArchC ERROR: Line %d: Parse error, undeclared instruction: %s.\n", line_num, yyvsp[-6].text);
01795            YYERROR;
01796         }
01797         else{
01798           pinstr->asm_str = (char*) malloc( strlen(yyvsp[-2].text)+1);
01799           strcpy(pinstr->asm_str, yyvsp[-2].text);
01800           pinstr->mnemonic =(char*) malloc( strlen(yyvsp[-2].text)+1);
01801           strcpy(pinstr->mnemonic, yyvsp[-2].text);
01802           aux = pinstr->mnemonic;
01803           while(*aux != ' ' && *aux != '\0') aux++;
01804           *aux = '\0';
01805         }
01806       ;}
01807     break;
01808 
01809   case 22:
01810 #line 688 "src/acpp/archc.bison"
01811     { 
01812                   /* Middle rule action to look for the instr. */
01813       for( pinstr = instr_list; pinstr != NULL && strcmp(pinstr->name, yyvsp[-6].text); pinstr = pinstr->next);
01814            if( pinstr == NULL ){
01815                     printf("ArchC ERROR: Line %d: Parse error, undeclared instruction: %s.\n", line_num, yyvsp[-6].text);
01816               YYERROR;
01817            }
01818       else{
01819         /* Adding field to the end of the decoding sequence list */ 
01820         ac_dec_list *aux;
01821         pdec_list = (ac_dec_list*) malloc( sizeof(ac_dec_list));
01822         pdec_list->name = (char*) malloc( strlen(yyvsp[-2].text)+1);
01823         strcpy(pdec_list->name, yyvsp[-2].text);
01824         pdec_list->value = yyvsp[0].value;
01825         pdec_list->next = NULL;
01826         
01827         if( pinstr->dec_list == NULL )
01828           pinstr->dec_list = pdec_list;
01829         else{
01830           for(aux =pinstr->dec_list; aux->next != NULL; aux = aux->next);
01831           aux->next = pdec_list;                        
01832         }
01833       }
01834 
01835                 ;}
01836     break;
01837 
01838   case 24:
01839 #line 718 "src/acpp/archc.bison"
01840     {
01841                      for( pinstr = instr_list; pinstr != NULL && strcmp(pinstr->name, yyvsp[-6].text); pinstr = pinstr->next);
01842                      if( pinstr == NULL ){
01843                          printf("ArchC ERROR: Line %d: Parse error, undeclared instruction: %s.\n", line_num, yyvsp[-6].text);
01844                          YYERROR;
01845                      }
01846                      else{
01847                          pinstr->cycles = yyvsp[-2].value;
01848                          HaveMultiCycleIns = 1;
01849                      }
01850                    ;}
01851     break;
01852 
01853   case 25:
01854 #line 734 "src/acpp/archc.bison"
01855     {
01856                         for( pinstr = instr_list; pinstr != NULL && strcmp(pinstr->name, yyvsp[-4].text); pinstr = pinstr->next);
01857                         if( pinstr == NULL ){
01858                                 printf("ArchC ERROR: Line %d: Parse error, undeclared instruction: %s.\n", line_num, yyvsp[-4].text);
01859                                 YYERROR;
01860                         }
01861                         else{
01862                                 pinstr->min_latency = yyvsp[0].value;
01863                         }
01864 
01865       HaveCycleRange=1;
01866                 ;}
01867     break;
01868 
01869   case 27:
01870 #line 755 "src/acpp/archc.bison"
01871     {
01872                         if( pinstr == NULL ){
01873                                 printf("ArchC ERROR: Line %d: Parse error, undeclared instruction: %s.\n", line_num, yyvsp[-1].text);
01874                                 YYERROR;
01875                         }
01876                         else{
01877                                 pinstr->max_latency = yyvsp[0].value;
01878                         }
01879                 ;}
01880     break;
01881 
01882   case 28:
01883 #line 765 "src/acpp/archc.bison"
01884     { 
01885                         pinstr->max_latency = pinstr->min_latency;
01886                 
01887                 ;}
01888     break;
01889 
01890   case 29:
01891 #line 771 "src/acpp/archc.bison"
01892     {;}
01893     break;
01894 
01895   case 30:
01896 #line 772 "src/acpp/archc.bison"
01897     {;}
01898     break;
01899 
01900   case 31:
01901 #line 776 "src/acpp/archc.bison"
01902     {
01903      /* Adding field to the end of the decoding sequence list */ 
01904         ac_dec_list *aux;
01905         pdec_list = (ac_dec_list*) malloc( sizeof(ac_dec_list));
01906         pdec_list->name = (char*) malloc( strlen(yyvsp[-2].text)+1);
01907         strcpy(pdec_list->name, yyvsp[-2].text);
01908         pdec_list->value = yyvsp[0].value;
01909         pdec_list->next = NULL;
01910 
01911         if( pinstr->dec_list == NULL )
01912            pinstr->dec_list = pdec_list;
01913         else{
01914            for(aux =pinstr->dec_list; aux->next != NULL; aux = aux->next);
01915            aux->next = pdec_list;
01916         }
01917   ;}
01918     break;
01919 
01920   case 32:
01921 #line 798 "src/acpp/archc.bison"
01922     { 
01923 
01924                   /* Middle rule action to start emiting ARCH module declaration. */
01925                   project_name = malloc(strlen(yyvsp[-2].text)+1);
01926                   strcpy(project_name,yyvsp[-2].text);
01927 
01928                   /* Initializing Parser Variables */
01929 
01930                   const_count = 0;
01931                   descrp = ARCH_D;
01932                   instr_num = format_num = declist_num = stage_num = wordsize = fetchsize = 0;
01933                   instr_list_tail = instr_list = NULL;
01934                   format_ins_list_tail = format_ins_list = NULL;
01935                   storage_list_tail = storage_list = NULL;
01936                   parms_list_tail = parms_list = NULL;
01937                         fetch_device = NULL;
01938                   
01939                 ;}
01940     break;
01941 
01942   case 33:
01943 #line 818 "src/acpp/archc.bison"
01944     {
01945                   /* Closing module declaration. */
01946 
01947                 ;}
01948     break;
01949 
01950   case 41:
01951 #line 839 "src/acpp/archc.bison"
01952     {;}
01953     break;
01954 
01955   case 42:
01956 #line 848 "src/acpp/archc.bison"
01957     {
01958                 /* Identifying unit */
01959                 if( !strcmp( yyvsp[0].text, "K") || !strcmp( yyvsp[0].text, "k") )
01960                         current_unit = KBYTE;
01961                 else if( !strcmp( yyvsp[0].text, "M") || !strcmp( yyvsp[0].text, "m"))
01962                         current_unit = MBYTE;
01963                 else if( !strcmp( yyvsp[0].text, "G") || !strcmp( yyvsp[0].text, "g"))
01964                         current_unit = GBYTE;
01965                 else 
01966                   AC_ERROR("Invalid storage unit. It should be \"K\", \"M\", \"G\". ");
01967   ;}
01968     break;
01969 
01970   case 43:
01971 #line 860 "src/acpp/archc.bison"
01972     { 
01973                   current_unit = BYTE;
01974                 ;}
01975     break;
01976 
01977   case 48:
01978 #line 874 "src/acpp/archc.bison"
01979     {
01980                   /* Including device in storage list. */
01981                   add_storage( yyvsp[-3].text, yyvsp[-1].value, (ac_sto_types)MEM );
01982                   list_type = MEM_L;
01983                 ;}
01984     break;
01985 
01986   case 50:
01987 #line 884 "src/acpp/archc.bison"
01988     {cache_type = (ac_sto_types)CACHE;;}
01989     break;
01990 
01991   case 52:
01992 #line 885 "src/acpp/archc.bison"
01993     {cache_type = (ac_sto_types)ICACHE;;}
01994     break;
01995 
01996   case 54:
01997 #line 886 "src/acpp/archc.bison"
01998     {cache_type = (ac_sto_types)DCACHE;;}
01999     break;
02000 
02001   case 56:
02002 #line 891 "src/acpp/archc.bison"
02003     {
02004                   /* Including device in storage list. */
02005                   add_storage( yyvsp[-3].text, yyvsp[-1].value, cache_type );
02006                   list_type = CACHE_L;
02007                 ;}
02008     break;
02009 
02010   case 58:
02011 #line 906 "src/acpp/archc.bison"
02012     {
02013                         add_storage( yyvsp[-11].text, 0, cache_type );
02014                 ;}
02015     break;
02016 
02017   case 61:
02018 #line 919 "src/acpp/archc.bison"
02019     {
02020                         pparms = (ac_cache_parms*) malloc( sizeof(ac_cache_parms));
02021                         pparms->value = yyvsp[0].value;
02022                         pparms->next = NULL;
02023                         if( parms_list == NULL )
02024                                 parms_list = parms_list_tail= pparms;
02025                         else{
02026                                 parms_list_tail->next = pparms;
02027                                 parms_list_tail = pparms;
02028                         }                               
02029                 ;}
02030     break;
02031 
02032   case 62:
02033 #line 936 "src/acpp/archc.bison"
02034     {
02035                         pparms = (ac_cache_parms*) malloc( sizeof(ac_cache_parms));
02036                         pparms->str = (char*) malloc( strlen(yyvsp[0].text)+1); 
02037       strcpy(pparms->str, yyvsp[0].text);
02038                         pparms->next = NULL;
02039                         if( parms_list == NULL )
02040                                 parms_list = parms_list_tail= pparms;
02041                         else{
02042                                 parms_list_tail->next = pparms;
02043                                 parms_list_tail = pparms;
02044                         }                               
02045                 ;}
02046     break;
02047 
02048   case 63:
02049 #line 954 "src/acpp/archc.bison"
02050     {
02051                   /* Including device in storage list. */
02052                   add_storage( yyvsp[-2].text, yyvsp[0].value, (ac_sto_types)REGBANK );
02053                   list_type = REGBANK_L;
02054                 ;}
02055     break;
02056 
02057   case 65:
02058 #line 964 "src/acpp/archc.bison"
02059     {
02060                   /* Including device in storage list. */
02061                   add_storage( yyvsp[0].text, 0, (ac_sto_types)REG );
02062                   list_type = REG_L;
02063                 ;}
02064     break;
02065 
02066   case 66:
02067 #line 971 "src/acpp/archc.bison"
02068     {
02069                   if(current_type)
02070                     free(current_type);
02071                       ;}
02072     break;
02073 
02074   case 67:
02075 #line 980 "src/acpp/archc.bison"
02076     {
02077                   /* Including device in storage list. */
02078                   if( list_type == CACHE_L )
02079                      add_storage( yyvsp[-2].text, yyvsp[0].value, (ac_sto_types)CACHE );
02080                   else if( list_type == REGBANK_L )
02081                      add_storage( yyvsp[-2].text, yyvsp[0].value, (ac_sto_types)REGBANK );
02082                   else if( list_type == MEM_L )
02083                      add_storage( yyvsp[-2].text, yyvsp[0].value, (ac_sto_types)MEM );
02084                   else {
02085                     /* Should never enter here. */
02086                       AC_ERROR("Internal Bug. Invalid list type. It should be CACHE_L, REGBANK_L or MEM_L");
02087                   } 
02088                 ;}
02089     break;
02090 
02091   case 68:
02092 #line 994 "src/acpp/archc.bison"
02093     {;}
02094     break;
02095 
02096   case 69:
02097 #line 1001 "src/acpp/archc.bison"
02098     {
02099                   /* Assign a format to storage device. */
02100                   /* capturing format name */
02101                   current_type = (char*) malloc( strlen(yyvsp[-1].text)+1);
02102                   strcpy(current_type,yyvsp[-1].text);
02103                   HaveFormattedRegs = 1;
02104                 ;}
02105     break;
02106 
02107   case 70:
02108 #line 1010 "src/acpp/archc.bison"
02109     { 
02110                   current_type = NULL;
02111                 ;}
02112     break;
02113 
02114   case 71:
02115 #line 1018 "src/acpp/archc.bison"
02116     {
02117                   /* Getting register width. */
02118                   reg_width = yyvsp[-1].value;
02119                 ;}
02120     break;
02121 
02122   case 72:
02123 #line 1024 "src/acpp/archc.bison"
02124     { 
02125             reg_width = 0;
02126           ;}
02127     break;
02128 
02129   case 73:
02130 #line 1034 "src/acpp/archc.bison"
02131     {
02132                   /* Add to the stage list. */
02133                   add_stage(yyvsp[0].text, &stage_list);
02134                   list_type = STAGE_L;
02135                 ;}
02136     break;
02137 
02138   case 75:
02139 #line 1046 "src/acpp/archc.bison"
02140     {
02141                   /* Indicating to commalist that this is a pipe declaration */
02142                   list_type = PIPE_L;
02143 
02144                   /* Adding to the pipe list */
02145                   add_pipe( yyvsp[-3].text );
02146 
02147                   /* Adding the first stage to the pipe's stage list */
02148                   add_stage( yyvsp[0].text, &current_pipe->stages );
02149         
02150                 ;}
02151     break;
02152 
02153   case 77:
02154 #line 1065 "src/acpp/archc.bison"
02155     {
02156                   /* Declaring wordsize for the architecture */
02157                    wordsize = yyvsp[-1].value;
02158                 ;}
02159     break;
02160 
02161   case 78:
02162 #line 1072 "src/acpp/archc.bison"
02163     {
02164                   /* Declaring fetchsize for the architecture */
02165                    fetchsize = yyvsp[-1].value;
02166                 ;}
02167     break;
02168 
02169   case 80:
02170 #line 1086 "src/acpp/archc.bison"
02171     {
02172                   isa_filename = (char*) malloc( strlen(yyvsp[-3].text)+1);
02173                   strcpy(isa_filename ,yyvsp[-3].text);
02174                 ;}
02175     break;
02176 
02177   case 81:
02178 #line 1092 "src/acpp/archc.bison"
02179     {   
02180                         if( !strcmp( yyvsp[-3].text, "little") || !strcmp( yyvsp[-3].text, "LITTLE") )
02181                                 ac_tgt_endian = 0;
02182                         else if( !strcmp( yyvsp[-3].text, "big") || !strcmp( yyvsp[-3].text, "BIG") )
02183                                 ac_tgt_endian = 1;
02184                         else{
02185                                  //ERROR. Should never reach this point.
02186                                 AC_ERROR("Invalid endian initialization.");
02187                                 YYERROR;
02188       }
02189     ;}
02190     break;
02191 
02192   case 82:
02193 #line 1105 "src/acpp/archc.bison"
02194     {
02195                    ac_sto_list* plow;
02196 
02197        /* Warning acpp that a memory hierarchy was declared */
02198        HaveMemHier = 1;
02199 
02200                          /* Looking for the low level device */
02201                          for( pstorage = storage_list; pstorage != NULL && strcmp(pstorage->name, yyvsp[-7].text); pstorage = pstorage->next);
02202        if( pstorage == NULL ){
02203                  printf("ArchC ERROR: Line %d: Parse error, undeclared storage device: %s.\n", line_num, yyvsp[-7].text);
02204            YYERROR;
02205                    }
02206                          plow = pstorage;
02207 
02208                          /* Looking for the high level device */
02209                          for( pstorage = storage_list; pstorage != NULL && strcmp(pstorage->name, yyvsp[-3].text); pstorage = pstorage->next);
02210        if( pstorage == NULL ){
02211                  printf("ArchC ERROR: Line %d: Parse error, undeclared storage device: %s.\n", line_num, yyvsp[-3].text);
02212            YYERROR;
02213                    }
02214                          plow->higher = pstorage;
02215 
02216                          //Updating hierarchy level, from this level to the top.
02217                          for( pstorage = plow; pstorage->higher != NULL; pstorage = pstorage->higher)
02218                                  pstorage->higher->level = pstorage->level+1;
02219 
02220                 ;}
02221     break;
02222 
02223   case 83:
02224 #line 1133 "src/acpp/archc.bison"
02225     {;}
02226     break;
02227 
02228   case 84:
02229 #line 1140 "src/acpp/archc.bison"
02230     {
02231 
02232                           switch(list_type){
02233 
02234                           case INSTR_L:
02235                               add_instr( yyvsp[0].text);    /* Add to instruction list. */
02236                               break;
02237 
02238                           case STAGE_L:
02239             /* This case is reached when a pipe declaration like 
02240                ac_stages ST1, ST2, ST3;
02241                is used. So, add stage to  the generic stage list */
02242                               add_stage( yyvsp[0].text, &stage_list );
02243                               break;
02244 
02245                           case REG_L:
02246                               add_storage( yyvsp[0].text, 0, (ac_sto_types) REG);    /* Add to reg list. */
02247                               break;
02248 
02249                           case PIPE_L:
02250 
02251             /* In this case, IDs represent stage names, so
02252                add  stage to the pipe's stage list. */
02253             add_stage( yyvsp[0].text, &current_pipe->stages );
02254                               break;
02255 
02256                           default:
02257                               /* Should never enter here. */
02258                               AC_ERROR("Internal Bug. Unidentified list type.");
02259                               break;
02260                           }
02261                         ;}
02262     break;
02263 
02264   case 86:
02265 #line 1174 "src/acpp/archc.bison"
02266     {;}
02267     break;
02268 
02269 
02270     }
02271 
02272 /* Line 999 of yacc.c.  */
02273 #line 2273 "./src/acpp/archc.parser.c"
02274 
02275   yyvsp -= yylen;
02276   yyssp -= yylen;
02277 
02278 
02279   YY_STACK_PRINT (yyss, yyssp);
02280 
02281   *++yyvsp = yyval;
02282 
02283 
02284   /* Now `shift' the result of the reduction.  Determine what state
02285      that goes to, based on the state we popped back to and the rule
02286      number reduced by.  */
02287 
02288   yyn = yyr1[yyn];
02289 
02290   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
02291   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
02292     yystate = yytable[yystate];
02293   else
02294     yystate = yydefgoto[yyn - YYNTOKENS];
02295 
02296   goto yynewstate;
02297 
02298 
02299 /*------------------------------------.
02300 | yyerrlab -- here on detecting error |
02301 `------------------------------------*/
02302 yyerrlab:
02303   /* If not already recovering from an error, report this error.  */
02304   if (!yyerrstatus)
02305     {
02306       ++yynerrs;
02307 #if YYERROR_VERBOSE
02308       yyn = yypact[yystate];
02309 
02310       if (YYPACT_NINF < yyn && yyn < YYLAST)
02311         {
02312           YYSIZE_T yysize = 0;
02313           int yytype = YYTRANSLATE (yychar);
02314           char *yymsg;
02315           int yyx, yycount;
02316 
02317           yycount = 0;
02318           /* Start YYX at -YYN if negative to avoid negative indexes in
02319              YYCHECK.  */
02320           for (yyx = yyn < 0 ? -yyn : 0;
02321                yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
02322             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
02323               yysize += yystrlen (yytname[yyx]) + 15, yycount++;
02324           yysize += yystrlen ("syntax error, unexpected ") + 1;
02325           yysize += yystrlen (yytname[yytype]);
02326           yymsg = (char *) YYSTACK_ALLOC (yysize);
02327           if (yymsg != 0)
02328             {
02329               char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
02330               yyp = yystpcpy (yyp, yytname[yytype]);
02331 
02332               if (yycount < 5)
02333                 {
02334                   yycount = 0;
02335                   for (yyx = yyn < 0 ? -yyn : 0;
02336                        yyx < (int) (sizeof (yytname) / sizeof (char *));
02337                        yyx++)
02338                     if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
02339                       {
02340                         const char *yyq = ! yycount ? ", expecting " : " or ";
02341                         yyp = yystpcpy (yyp, yyq);
02342                         yyp = yystpcpy (yyp, yytname[yyx]);
02343                         yycount++;
02344                       }
02345                 }
02346               yyerror (yymsg);
02347               YYSTACK_FREE (yymsg);
02348             }
02349           else
02350             yyerror ("syntax error; also virtual memory exhausted");
02351         }
02352       else
02353 #endif /* YYERROR_VERBOSE */
02354         yyerror ("syntax error");
02355     }
02356 
02357 
02358 
02359   if (yyerrstatus == 3)
02360     {
02361       /* If just tried and failed to reuse lookahead token after an
02362          error, discard it.  */
02363 
02364       /* Return failure if at end of input.  */
02365       if (yychar == YYEOF)
02366         {
02367           /* Pop the error token.  */
02368           YYPOPSTACK;
02369           /* Pop the rest of the stack.  */
02370           while (yyss < yyssp)
02371             {
02372               YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
02373               yydestruct (yystos[*yyssp], yyvsp);
02374               YYPOPSTACK;
02375             }
02376           YYABORT;
02377         }
02378 
02379       YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
02380       yydestruct (yytoken, &yylval);
02381       yychar = YYEMPTY;
02382 
02383     }
02384 
02385   /* Else will try to reuse lookahead token after shifting the error
02386      token.  */
02387   goto yyerrlab1;
02388 
02389 
02390 /*----------------------------------------------------.
02391 | yyerrlab1 -- error raised explicitly by an action.  |
02392 `----------------------------------------------------*/
02393 yyerrlab1:
02394   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
02395 
02396   for (;;)
02397     {
02398       yyn = yypact[yystate];
02399       if (yyn != YYPACT_NINF)
02400         {
02401           yyn += YYTERROR;
02402           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
02403             {
02404               yyn = yytable[yyn];
02405               if (0 < yyn)
02406                 break;
02407             }
02408         }
02409 
02410       /* Pop the current state because it cannot handle the error token.  */
02411       if (yyssp == yyss)
02412         YYABORT;
02413 
02414       YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
02415       yydestruct (yystos[yystate], yyvsp);
02416       yyvsp--;
02417       yystate = *--yyssp;
02418 
02419       YY_STACK_PRINT (yyss, yyssp);
02420     }
02421 
02422   if (yyn == YYFINAL)
02423     YYACCEPT;
02424 
02425   YYDPRINTF ((stderr, "Shifting error token, "));
02426 
02427   *++yyvsp = yylval;
02428 
02429 
02430   yystate = yyn;
02431   goto yynewstate;
02432 
02433 
02434 /*-------------------------------------.
02435 | yyacceptlab -- YYACCEPT comes here.  |
02436 `-------------------------------------*/
02437 yyacceptlab:
02438   yyresult = 0;
02439   goto yyreturn;
02440 
02441 /*-----------------------------------.
02442 | yyabortlab -- YYABORT comes here.  |
02443 `-----------------------------------*/
02444 yyabortlab:
02445   yyresult = 1;
02446   goto yyreturn;
02447 
02448 #ifndef yyoverflow
02449 /*----------------------------------------------.
02450 | yyoverflowlab -- parser overflow comes here.  |
02451 `----------------------------------------------*/
02452 yyoverflowlab:
02453   yyerror ("parser stack overflow");
02454   yyresult = 2;
02455   /* Fall through.  */
02456 #endif
02457 
02458 yyreturn:
02459 #ifndef yyoverflow
02460   if (yyss != yyssa)
02461     YYSTACK_FREE (yyss);
02462 #endif
02463   return yyresult;
02464 }
02465 
02466 
02467 #line 1178 "src/acpp/archc.bison"
02468 
02469 
02470 
02471 /**********************
02472 
02473    File Structure
02474    ==============
02475 %{
02476 C declarations
02477 %}
02478 
02479 Bison declarations
02480 
02481 %%
02482 Grammar rules
02483 %%
02484 
02485 Additional C code
02486 ***********************/
02487 

Generated on Thu Jun 24 08:30:05 2004 for ArchC by doxygen 1.3.4