00001 /* 00002 * host.h - host-dependent 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) 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 00047 * source file. You are forbidden to forbid anyone else to use, share 00048 * and improve what you give them. 00049 * 00050 * INTERNET: dburger@cs.wisc.edu 00051 * US Mail: 1210 W. Dayton Street, Madison, WI 53706 00052 * 00053 * $Id: host.h,v 1.2 2007-07-09 18:37:50 wcmclen Exp $ 00054 * 00055 * $Log: not supported by cvs2svn $ 00056 * Revision 1.1.1.1.4.4 2007/04/12 21:04:31 wcmclen 00057 * updated checkin. 00058 * 00059 * Revision 1.1.1.1.4.3 2007/04/11 22:42:22 wcmclen 00060 * ! 00061 * 00062 * Revision 1.1.1.1 2006/01/31 16:35:46 afrodri 00063 * first entry 00064 * 00065 * Revision 1.1 2004/04/22 16:37:36 arodrig6 00066 * ppc backend 00067 * 00068 * Revision 1.2 2000/04/10 23:46:29 karu 00069 * converted all quad to qword. NO OTHER change made. 00070 * the tag specfp95-before-quad-qword is a snapshow before this change was made 00071 * 00072 * Revision 1.1.1.1 2000/03/07 05:15:17 karu 00073 * this is the repository created for my own maintanence. 00074 * created when spec95 (lisp and compress worked). 00075 * compress still had the scanf("%i") problem 00076 * DIFF from the repository I am using alongwith ramdass on /projects 00077 * need to merge the two sometime :-) 00078 * 00079 * Revision 1.1.1.1 2000/02/25 21:02:50 karu 00080 * creating cvs repository for ss3-ppc 00081 * 00082 * Revision 1.1 1998/08/27 08:28:46 taustin 00083 * Initial revision 00084 * 00085 * 00086 */ 00087 00088 #ifndef HOST_H 00089 #define HOST_H 00090 #include <stdlib.h> 00091 00092 /* make sure host compiler supports ANSI-C */ 00093 #ifndef __STDC__ /* an ansi C compiler is required */ 00094 #error The SimpleScalar simulators must be compiled with an ANSI C compiler. 00095 #endif /* __STDC__ */ 00096 00097 /* enable inlining here, if supported by host compiler */ 00098 #undef INLINE 00099 #if defined(__GNUC__) 00100 #define INLINE inline 00101 #else 00102 #define INLINE 00103 #endif 00104 00105 /* bind together two symbols, at preprocess time */ 00106 #ifdef __GNUC__ 00107 /* this works on all GNU GCC targets (that I've seen...) */ 00108 #define SYMCAT(X,Y) X##Y 00109 #define ANSI_SYMCAT 00110 #else /* !__GNUC__ */ 00111 #ifdef OLD_SYMCAT 00112 #define SYMCAT(X,Y) X/**/Y 00113 #else /* !OLD_SYMCAT */ 00114 #define SYMCAT(X,Y) X##Y 00115 #define ANSI_SYMCAT 00116 #endif /* OLD_SYMCAT */ 00117 #endif /* __GNUC__ */ 00118 00119 /* host-dependent canonical type definitions */ 00120 // wcm: not portable to 64-bit / 32-bit architectures 00121 //typedef int bool_t; /* generic boolean type */ 00122 //typedef unsigned char byte_t; /* byte - 8 bits */ 00123 //typedef signed char sbyte_t; 00124 //typedef unsigned short half_t; /* half - 16 bits */ 00125 //typedef signed short shalf_t; 00126 //typedef unsigned int word_t; /* word - 32 bits */ 00127 //typedef signed int sword_t; 00128 typedef float sfloat_t; /* single-precision float - 32 bits */ 00129 typedef double dfloat_t; /* double-precision float - 64 bits */ 00130 /* wcm: float and double are 32 and 64 bits respectively on PPC */ 00131 00132 typedef int bool_t; /* generic boolean type */ 00133 typedef uint8_t byte_t; /* byte - 8 bits */ 00134 typedef int8_t sbyte_t; 00135 typedef uint16_t half_t; /* half - 16 bits */ 00136 typedef int16_t shalf_t; 00137 typedef uint32_t word_t; /* word - 32 bits */ 00138 typedef int32_t sword_t; 00139 00140 00141 /* quadword defs, note: not all targets support quadword types */ 00142 #if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__CC_C89) || defined(__CC_XLC) 00143 #define HOST_HAS_QWORD 00144 #if !defined(__FreeBSD__) 00145 //typedef unsigned long long qword_t; /* quad - 64 bits */ 00146 //typedef signed long long sqword_t; 00147 typedef uint64_t qword_t; /* quad - 64 bits */ 00148 typedef int64_t sqword_t; 00149 #else /* __FreeBSD__ */ 00150 //#define qword_t unsigned long long 00151 //#define sqword_t signed long long 00152 #define qword_t uint64_t 00153 #define word_t int64_t 00154 #endif /* __FreeBSD__ */ 00155 #ifdef ANSI_SYMCAT 00156 #define ULL(N) N##ULL /* qword_t constant */ 00157 #define LL(N) N##LL /* sqword_t constant */ 00158 #else /* OLD_SYMCAT */ 00159 #define ULL(N) N/**/ULL /* qword_t constant */ 00160 #define LL(N) N/**/LL /* sqword_t constant */ 00161 #endif 00162 #elif defined(__alpha) 00163 #define HOST_HAS_QWORD 00164 //typedef unsigned long qword_t; /* quad - 64 bits */ 00165 //typedef signed long sqword_t; 00166 typedef uint64_t qword_t; 00167 typedef int64_t sqword_t; 00168 #ifdef ANSI_SYMCAT 00169 #define ULL(N) N##UL /* qword_t constant */ 00170 #define LL(N) N##L /* sqword_t constant */ 00171 #else /* OLD_SYMCAT */ 00172 #define ULL(N) N/**/UL /* qword_t constant */ 00173 #define LL(N) N/**/L /* sqword_t constant */ 00174 #endif 00175 #elif defined(_MSC_VER) 00176 #define HOST_HAS_QWORD 00177 typedef unsigned __int64 qword_t; /* quad - 64 bits */ 00178 typedef signed __int64 sqword_t; 00179 #define ULL(N) ((qword_t)(N)) 00180 #define LL(N) ((sqword_t)(N)) 00181 #else /* !__GNUC__ && !__alpha */ 00182 #undef HOST_HAS_QWORD 00183 #endif 00184 00185 /* statistical counter types, use largest counter type available */ 00186 #ifdef HOST_HAS_QWORD 00187 typedef sqword_t counter_t; 00188 typedef sqword_t tick_t; /* NOTE: unsigned breaks caches */ 00189 #else /* !HOST_HAS_QWORD */ 00190 typedef dfloat_t counter_t; 00191 typedef dfloat_t tick_t; 00192 #endif /* HOST_HAS_QWORD */ 00193 00194 #endif /* HOST_H */