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