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

acsim.h

Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 
00003 /*  ArchC simulator generator generates simulators for the described arquitecture
00004     Copyright (C) 2002-2004  The ArchC Team
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 of the License, or
00009     (at your option) 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 
00017 /********************************************************/
00018 /* acsim.h: The ArchC simulator generator.              */
00019 /* Author: Sandro Rigo                                  */
00020 /* Date: 16-07-2002                                     */
00021 /*                                                      */
00022 /* The ArchC Team                                       */
00023 /* Computer Systems Laboratory (LSC)                    */
00024 /* IC-UNICAMP                                           */
00025 /* http://www.lsc.ic.unicamp.br                         */
00027 
00032 
00033 
00038 #ifndef _ACSIM_H_
00039 #define _ACSIM_H_
00040 
00041 #include <stdlib.h>
00042 #include <stdio.h>
00043 #include "ac_decoder.h"
00044 
00045 /*Defining indentation */
00046 #define INDENT0  ""
00047 #define INDENT1  "  "
00048 #define INDENT2  "    "
00049 #define INDENT3  "      "
00050 #define INDENT4  "        "
00051 #define INDENT5  "          "
00052 static const char *INDENT[]={"","  ","    ","      ","        ","          ","            ","              "};
00053 
00054 #define CONF_MAX_LINE 256   
00055 
00056 
00057 #define WRITE_THROUGH   0x01    
00058 #define WRITE_BACK      0x02    
00059 #define WRITE_AROUND    0x20    
00060 #define WRITE_ALLOCATE  0x10    
00061 
00062 
00068 char *ARCHC_PATH;     
00069 char *SYSTEMC_PATH;   
00070 char *TARGET_ARCH;    
00071 char *CC_PATH;        
00072 char *OPT_FLAGS;      
00073 char *DEBUG_FLAGS;    
00074 char *OTHER_FLAGS;    
00075 
00076 
00078 #define COMMENT( I, args... )   fprintf( output, "%s
00079 
00080 
00081 #define COMMENT_MAKE( args... ) fprintf( output, "# "); fprintf( output, args);fprintf( output, "\n");
00082 
00084 #define AC_INTERNAL_ERROR( str ) fprintf(stderr, "ArchC ERROR: %s. File: %s Line: %d\n", str, __FILE__, __LINE__);
00085 
00087 #define AC_ERROR( str, ...) fprintf(stderr, "ArchC ERROR: " str, ##__VA_ARGS__);
00088 //#define AC_ERROR( str ) fprintf(stderr, "ArchC ERROR: %s ", str );
00089 
00091 #define AC_MSG( str, ...) fprintf(stdout, "ArchC: " str, ##__VA_ARGS__);
00092 //#define AC_MSG( str ) printf("ArchC: ");printf str;
00093 
00095 enum _ac_cmd_options {
00096   OPABI,
00097   OPDasm,
00098   OPDebug,
00099   OPDelay,
00100   OPDDecoder,
00101   OPHelp,
00102   /*OPQuiet,*/
00103   OPDecCache,
00104   OPStats,
00105   OPVerbose,
00106   /*OPVerify,*/
00107   /*OPVerifyTimed,*/
00108   OPVersion,
00109   OPEncoder,
00110   OPGDBIntegration,
00111   ACNumberOfOptions
00112 };
00113 
00114 typedef enum  _ac_cmd_options_ ac_cmd_options;
00115 
00117 enum _ac_sto_types { MEM, CACHE, ICACHE, DCACHE, REG, REGBANK};
00118 
00119 typedef enum _ac_sto_types ac_sto_types;
00120 
00122 typedef struct _ac_cache_parms{
00123   char *str;                    
00124   unsigned value;                       
00125   struct _ac_cache_parms *next; 
00126 } ac_cache_parms;
00127 
00129 typedef struct _ac_sto_list{
00130   char *name;                   
00131   char *format;                 
00132   unsigned size;                
00133   unsigned width;               
00134   unsigned level;               
00135   ac_sto_types type;            
00136   struct _ac_sto_list* higher;  
00137   ac_cache_parms *parms;        
00138   struct _ac_sto_list *next;    
00139 } ac_sto_list;
00140 
00142 typedef struct _ac_stg_list{
00143   char *name;                   
00144   unsigned id;                  
00145   struct _ac_stg_list *next;    
00146 } ac_stg_list;
00147 
00149 typedef struct _ac_pipe_list{
00150   char *name;                   
00151   unsigned id;                  
00152   ac_stg_list *stages;          
00153   struct _ac_pipe_list *next;   
00154 } ac_pipe_list;
00155 
00157 typedef union  {
00158   int i;
00159   char c[4];
00160 }endian;
00161 
00163 
00165 // Function Prototypes               //
00167 
00168 void print_comment( FILE* output, char* description);
00169 
00180 void CreateResourceHeader(void);                  
00181 void CreateTypeHeader(void);                      
00182 void CreateISAHeader(void);                       
00183 void CreateARCHHeader(void);                      
00184 void CreateStgHeader(ac_stg_list* stage_list, char* pipe_name);  
00185 void CreateProcessorHeader(void);                 
00186 void CreateParmHeader(void);                      
00187 void CreateRegsHeader(void);                      
00188 void CreateCoverifHeader(void);                   
00189 void CreateStatsHeader(void);                     
00190 void CreateArchSyscallHeader(void);               
00191 void CreateMakefile(void);                        
00192 
00193 void CreateResourceImpl(void);                    
00194 void CreateStgImpl(ac_stg_list* stage_list, char* pipe_name); 
00195 void CreateRegsImpl(void);                        
00196 void CreateImplTmpl(void);                        
00197 void CreateMainTmpl(void);                        
00198 void CreateProcessorImpl(void);                   
00199 void CreateARCHImpl(void);                        
00200 
00201 
00207 void EmitGenInstrClass(FILE *output);             
00208 void EmitFormatClasses(FILE *output);             
00209 void EmitInstrClasses(FILE *output);              
00210 void EmitDecStruct( FILE* output);                
00211 void EmitPipeUpdateMethod( FILE *output);         
00212 void EmitMultiPipeUpdateMethod( FILE *output);    
00213 void EmitUpdateMethod( FILE *output);             
00214 void EmitMultiCycleProcessorBhv(FILE *output);    
00215 void EmitProcessorBhv( FILE *output);             
00216 void EmitProcessorBhv_ABI( FILE *output);         
00217 void EmitABIAddrList( FILE *output, int base_indent);           
00218 void EmitABIDefine( FILE *output);                
00219 void EmitPipeABIDefine( FILE *output);            
00220 void EmitInstrExec(FILE *output, int base_indent);              
00221 void EmitDecodification(FILE *output, int base_indent);         
00222 void EmitFetchInit(FILE *output, int base_indent);              
00223 void EmitCacheDeclaration(FILE *output, ac_sto_list* pstorage, int base_indent);       
00224 
00225 
00231 void ReadConfFile(void);                          
00232 
00233 
00234 
00235 #endif /*_ACSIM_H_*/
00236 
00237  
00239 //   This is used by DoxyGen !!! 
00241 
00269 

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