00001 /* 00002 * sim.h - simulator main line interfaces 00003 * 00004 * This file is a part of the SimpleScalar tool suite written by 00005 * Todd M. Austin as a part of the Multiscalar Research Project. 00006 * 00007 * The tool suite is currently maintained by Doug Burger and Todd M. Austin. 00008 * 00009 * Copyright (C) 1994, 1995, 1996, 1997, 1998 by Todd M. Austin 00010 * 00011 * This source file is distributed "as is" in the hope that it will be 00012 * useful. The tool set comes with no warranty, and no author or 00013 * distributor accepts any responsibility for the consequences of its 00014 * use. 00015 * 00016 * Everyone is granted permission to copy, modify and redistribute 00017 * this tool set under the following conditions: 00018 * 00019 * This source code is distributed for non-commercial use only. 00020 * Please contact the maintainer for restrictions applying to 00021 * commercial use. 00022 * 00023 * Permission is granted to anyone to make or distribute copies 00024 * of this source code, either as received or modified, in any 00025 * medium, provided that all copyright notices, permission and 00026 * nonwarranty notices are preserved, and that the distributor 00027 * grants the recipient permission for further redistribution as 00028 * permitted by this document. 00029 * 00030 * Permission is granted to distribute this file in compiled 00031 * or executable form under the same conditions that apply for 00032 * source code, provided that either: 00033 * 00034 * A. it is accompanied by the corresponding machine-readable 00035 * source code, 00036 * B. it is accompanied by a written offer, with no time limit, 00037 * to give anyone a machine-readable copy of the corresponding 00038 * source code in return for reimbursement of the cost of 00039 * distribution. This written offer must permit verbatim 00040 * duplication by anyone, or 00041 * C. it is distributed by someone who received only the 00042 * executable form, and is accompanied by a copy of the 00043 * written offer of source code that they received concurrently. 00044 * 00045 * In other words, you are welcome to use, share and improve this 00046 * source file. You are forbidden to forbid anyone else to use, share 00047 * and improve what you give them. 00048 * 00049 * INTERNET: dburger@cs.wisc.edu 00050 * US Mail: 1210 W. Dayton Street, Madison, WI 53706 00051 * 00052 * $Id: sim.h,v 1.1.1.1 2003/09/18 00:57:54 panalyzer Exp $ 00053 * 00054 * $Log: sim.h,v $ 00055 * Revision 1.1.1.1 2003/09/18 00:57:54 panalyzer 00056 * 00057 * 00058 * Revision 1.1.1.1 2003/09/18 00:18:44 panalyzer 00059 * 00060 * 00061 * Revision 1.1.1.1 2003/09/16 18:48:14 gdm 00062 * 00063 * 00064 * Revision 1.1.1.1 2000/11/29 14:53:54 cu-cs 00065 * Grand unification of arm sources. 00066 * 00067 * 00068 * Revision 1.1.1.1 2000/05/26 15:18:58 taustin 00069 * SimpleScalar Tool Set 00070 * 00071 * 00072 * Revision 1.5 1998/08/27 16:38:54 taustin 00073 * implemented host interface description in host.h 00074 * added target interface support 00075 * added support for register and memory contexts 00076 * added simulator and program output redirection (via "-redir:sim" 00077 * and "redir:prog" options, respectively) 00078 * 00079 * Revision 1.4 1997/03/11 01:41:43 taustin 00080 * updated copyrights 00081 * 00082 * Revision 1.3 1996/12/27 15:54:47 taustin 00083 * updated comments 00084 * integrated support for options and stats packages 00085 * 00086 * Revision 1.1 1996/12/05 18:50:23 taustin 00087 * Initial revision 00088 * 00089 * 00090 */ 00091 00092 #ifndef SIM_H 00093 #define SIM_H 00094 00095 #include <stdio.h> 00096 #include <setjmp.h> 00097 #include <time.h> 00098 00099 #include "options.h" 00100 #include "stats.h" 00101 #include "regs.h" 00102 #include "memory.h" 00103 00104 /* set to non-zero when simulator should dump statistics */ 00105 extern int sim_dump_stats; 00106 00107 /* exit when this becomes non-zero */ 00108 extern int sim_exit_now; 00109 00110 /* longjmp here when simulation is completed */ 00111 extern jmp_buf sim_exit_buf; 00112 00113 /* byte/word swapping required to execute target executable on this host */ 00114 extern int sim_swap_bytes; 00115 extern int sim_swap_words; 00116 00117 /* execution instruction counter */ 00118 extern counter_t sim_num_insn; 00119 00120 /* execution start/end times */ 00121 extern time_t sim_start_time; 00122 extern time_t sim_end_time; 00123 extern int sim_elapsed_time; 00124 00125 /* options database */ 00126 extern struct opt_odb_t *sim_odb; 00127 00128 /* stats database */ 00129 extern struct stat_sdb_t *sim_sdb; 00130 00131 /* EIO interfaces */ 00132 extern char *sim_eio_fname; 00133 extern char *sim_chkpt_fname; 00134 extern FILE *sim_eio_fd; 00135 00136 /* redirected program/simulator output file names */ 00137 extern FILE *sim_progfd; 00138 00139 00140 /* 00141 * main simulator interfaces, called in the following order 00142 */ 00143 00144 /* register simulator-specific options */ 00145 void sim_reg_options(struct opt_odb_t *odb); 00146 00147 /* main() parses options next... */ 00148 00149 /* check simulator-specific option values */ 00150 void sim_check_options(struct opt_odb_t *odb, int argc, char **argv); 00151 00152 /* register simulator-specific statistics */ 00153 void sim_reg_stats(struct stat_sdb_t *sdb); 00154 00155 /* initialize the simulator */ 00156 void sim_init(void); 00157 00158 /* load program into simulated state */ 00159 void sim_load_prog(char *fname, int argc, char **argv, char **envp); 00160 00161 /* main() prints the option database values next... */ 00162 00163 /* print simulator-specific configuration information */ 00164 void sim_aux_config(FILE *stream); 00165 00166 /* start simulation, program loaded, processor precise state initialized */ 00167 void sim_main(void); 00168 00169 /* main() prints the stats database values next... */ 00170 00171 /* dump simulator-specific auxiliary simulator statistics */ 00172 void sim_aux_stats(FILE *stream); 00173 00174 /* un-initialize simulator-specific state */ 00175 void sim_uninit(void); 00176 00177 /* print all simulator stats */ 00178 void 00179 sim_print_stats(FILE *fd); /* output stream */ 00180 00181 00182 /*Added for SST*/ 00183 /*enum SSTpspec_component {alu,fpu,mult, 00184 bpred,rf,il1,il2,dl1,dl2, 00185 itlb,lv1_dtlb,clock,io,uarch 00186 }; 00187 */ 00188 00189 //void SSTlv2_panalyzer(enum SSTpspec_component pa_type,int user_data); 00190 00191 00192 #endif /* SIM_H */