00001 /* 00002 * range.h - program execution range definitions and 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: range.h,v 1.1.1.1 2003/09/18 00:57:54 panalyzer Exp $ 00053 * 00054 * $Log: range.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:59 taustin 00069 * SimpleScalar Tool Set 00070 * 00071 * 00072 * Revision 1.2 1998/08/27 15:50:50 taustin 00073 * implemented host interface description in host.h 00074 * added target interface support 00075 * 00076 * Revision 1.1 1997/03/11 01:32:44 taustin 00077 * Initial revision 00078 * 00079 * 00080 */ 00081 00082 #ifndef RANGE_H 00083 #define RANGE_H 00084 00085 #include <stdio.h> 00086 00087 #include "host.h" 00088 #include "misc.h" 00089 #include "machine.h" 00090 00091 enum range_ptype_t { 00092 pt_addr = 0, /* address position */ 00093 pt_inst, /* instruction count position */ 00094 pt_cycle, /* cycle count position */ 00095 pt_NUM 00096 }; 00097 00098 /* 00099 * an execution position 00100 * 00101 * by addr: @<addr> 00102 * by inst count: <icnt> 00103 * by cycle count: #<cycle> 00104 * 00105 */ 00106 struct range_pos_t { 00107 enum range_ptype_t ptype; /* type of position */ 00108 counter_t pos; /* position */ 00109 }; 00110 00111 /* an execution range */ 00112 struct range_range_t { 00113 struct range_pos_t start; 00114 struct range_pos_t end; 00115 }; 00116 00117 /* parse execution position *PSTR to *POS */ 00118 char * /* error string, or NULL */ 00119 range_parse_pos(char *pstr, /* execution position string */ 00120 struct range_pos_t *pos); /* position return buffer */ 00121 00122 /* print execution position *POS */ 00123 void 00124 range_print_pos(struct range_pos_t *pos, /* execution position */ 00125 FILE *stream); /* output stream */ 00126 00127 /* parse execution range *RSTR to *RANGE */ 00128 char * /* error string, or NULL */ 00129 range_parse_range(char *rstr, /* execution range string */ 00130 struct range_range_t *range); /* range return buffer */ 00131 00132 /* print execution range *RANGE */ 00133 void 00134 range_print_range(struct range_range_t *range, /* execution range */ 00135 FILE *stream); /* output stream */ 00136 00137 /* determine if inputs match execution position */ 00138 int /* relation to position */ 00139 range_cmp_pos(struct range_pos_t *pos, /* execution position */ 00140 counter_t val); /* position value */ 00141 00142 /* determine if inputs are in range */ 00143 int /* relation to range */ 00144 range_cmp_range(struct range_range_t *range, /* execution range */ 00145 counter_t val); /* position value */ 00146 00147 00148 /* determine if inputs are in range, passes all possible info needed */ 00149 int /* relation to range */ 00150 range_cmp_range1(struct range_range_t *range, /* execution range */ 00151 md_addr_t addr, /* address value */ 00152 counter_t icount, /* instruction count */ 00153 counter_t cycle); /* cycle count */ 00154 00155 00156 /* 00157 * 00158 * <range> := {<start_val>}:{<end>} 00159 * <end> := <end_val> 00160 * | +<delta> 00161 * 00162 */ 00163 00164 #endif /* RANGE_H */