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

ac_decoder.h

Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 
00003 /*  Generic decoder for arquitectures described in ArchC
00004     Copyright (C) 2002-2004  The ArchC Team
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Lesser General Public
00008     License as published by the Free Software Foundation; either
00009     version 2.1 of the License, or (at your option) any later version.
00010 
00011     This library 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 GNU
00014     Lesser General Public License for more details.
00015 */
00016 
00017 /********************************************************/
00018 /* The ArchC Decoder Generator                          */
00019 /* Author: Marcus Bartholomeu and Sandro Rigo           */
00020 /*                                                      */
00021 /*                                                      */
00022 /* The ArchC Team                                       */
00023 /* Computer Systems Laboratory (LSC)                    */
00024 /* IC-UNICAMP                                           */
00025 /* http://www.lsc.ic.unicamp.br                         */
00026 /********************************************************/
00027 
00034 #ifndef _AC_DECODER_H_
00035 #define _AC_DECODER_H_
00036 
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040 
00041 
00043 typedef struct _ac_dec_field{
00044   char *name;                 
00045   int size;                   
00046   int first_bit;              
00047   int id;                     
00048   long val;                   
00049   int sign;                   
00050   struct _ac_dec_field *next; 
00051 } ac_dec_field;
00052 
00054 typedef struct _ac_dec_format{
00055   char *name;                  
00056   int size;                    
00057   ac_dec_field *fields;        
00058   struct _ac_dec_format *next; 
00059 } ac_dec_format;
00060 
00062 typedef struct _ac_dec_list{
00063   char *name;                   
00064   int value;                    
00065   struct _ac_dec_list *next; 
00066 } ac_dec_list;
00067 
00069 typedef struct _ac_dec_instr{
00070   char *name;                 
00071   int size;                   
00072   char *mnemonic;             
00073   char *asm_str;              
00074   char *format;               
00075   unsigned id;                
00076   unsigned cycles;            
00077   unsigned min_latency;       
00078   unsigned max_latency;       
00079   ac_dec_list *dec_list;      
00080   struct _ac_dec_instr *next; 
00081 } ac_dec_instr;
00082 
00083 
00085 typedef struct _ac_decoder{
00086   ac_dec_list *check;           
00087   ac_dec_instr *found;          
00088   struct _ac_decoder *subcheck; 
00089   struct _ac_decoder *next;     
00090 } ac_decoder;
00091 
00092 
00093 typedef struct _ac_decoder_full{
00094   ac_decoder *decoder;
00095   ac_dec_format *formats;
00096   ac_dec_field *fields;
00097   ac_dec_instr *instructions;
00098   unsigned nFields;
00099 } ac_decoder_full;
00100   
00101 
00102 void MemoryError(char *fileName, long lineNumber, char *functionName);
00103 void ShowError(char *msg);
00104 void ShowDecField(ac_dec_field *f);
00105 void ShowDecFormat(ac_dec_format *f);
00106 void ShowDecodeList(ac_dec_list *l);
00107 void ShowDecInstr(ac_dec_instr *i);
00108 void ShowDecoder(ac_decoder *d, unsigned level);
00109 ac_decoder_full *CreateDecoder(ac_dec_format *formats, ac_dec_instr *instructions);
00110 
00111 ac_dec_format *FindFormat(ac_dec_format *formats, char *name);
00112 ac_dec_instr *GetInstrByID(ac_dec_instr *instr, int id);
00113 unsigned *Decode(ac_decoder_full *decoder, unsigned char *buffer, int quant);
00114 
00115 #ifdef __cplusplus
00116 }
00117 #endif
00118 
00119 #endif

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