From eef3a2e142443d94b75de333ff3ccb69644a9831 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sun, 17 May 2009 14:34:50 -0700 Subject: types: Move stuff for global types into src/base/types.hh --HG-- rename : src/sim/host.hh => src/base/types.hh --- src/base/cp_annotate.hh | 2 +- src/base/crc.cc | 2 +- src/base/crc.hh | 2 +- src/base/fast_alloc.hh | 2 +- src/base/hashmap.hh | 2 +- src/base/hostinfo.cc | 2 +- src/base/hostinfo.hh | 2 +- src/base/inet.cc | 2 +- src/base/inet.hh | 2 +- src/base/intmath.hh | 2 +- src/base/loader/hex_file.hh | 2 +- src/base/loader/object_file.hh | 2 +- src/base/loader/symtab.cc | 2 +- src/base/loader/symtab.hh | 2 +- src/base/misc.cc | 2 +- src/base/pollevent.cc | 2 +- src/base/random.hh | 2 +- src/base/socket.cc | 2 +- src/base/statistics.hh | 2 +- src/base/stats/events.cc | 2 +- src/base/stats/mysql.cc | 2 +- src/base/stats/mysql_run.hh | 2 +- src/base/stats/output.cc | 2 +- src/base/stats/types.hh | 2 +- src/base/stats/visit.hh | 2 +- src/base/trace.hh | 2 +- src/base/types.hh | 71 ++++++++++++++++++++++++++++++++++++++++++ 27 files changed, 97 insertions(+), 26 deletions(-) create mode 100644 src/base/types.hh (limited to 'src/base') diff --git a/src/base/cp_annotate.hh b/src/base/cp_annotate.hh index 13ced82de..811f95f54 100644 --- a/src/base/cp_annotate.hh +++ b/src/base/cp_annotate.hh @@ -33,7 +33,7 @@ #include "base/loader/symtab.hh" #include "config/cp_annotate.hh" -#include "sim/host.hh" +#include "base/types.hh" #include "sim/serialize.hh" #include "sim/startup.hh" #include "sim/system.hh" diff --git a/src/base/crc.cc b/src/base/crc.cc index ce837a408..eb1f4b641 100644 --- a/src/base/crc.cc +++ b/src/base/crc.cc @@ -33,7 +33,7 @@ #include -#include "sim/host.hh" +#include "base/types.hh" #include "base/crc.hh" #define ETHER_CRC_POLY_LE 0xedb88320 diff --git a/src/base/crc.hh b/src/base/crc.hh index 16dce79aa..212be4f8a 100644 --- a/src/base/crc.hh +++ b/src/base/crc.hh @@ -31,7 +31,7 @@ #ifndef __BASE_CRC_HH__ #define __BASE_CRC_HH__ -#include "sim/host.hh" +#include "base/types.hh" uint32_t crc32be(const uint8_t *buf, size_t len); uint32_t crc32le(const uint8_t *buf, size_t len); diff --git a/src/base/fast_alloc.hh b/src/base/fast_alloc.hh index c6490174e..aa8fff130 100644 --- a/src/base/fast_alloc.hh +++ b/src/base/fast_alloc.hh @@ -75,7 +75,7 @@ class FastAlloc #else #if FAST_ALLOC_DEBUG -#include "sim/host.hh" // for Tick +#include "base/types.hh" #endif class FastAlloc diff --git a/src/base/hashmap.hh b/src/base/hashmap.hh index ff2aa151f..e8f525e4d 100644 --- a/src/base/hashmap.hh +++ b/src/base/hashmap.hh @@ -39,7 +39,7 @@ #include -#include "sim/host.hh" +#include "base/types.hh" #if defined(__GNUC__) && __GNUC__ >= 3 #define __hash_namespace __gnu_cxx diff --git a/src/base/hostinfo.cc b/src/base/hostinfo.cc index ef64feeb4..ffc2f93ff 100644 --- a/src/base/hostinfo.cc +++ b/src/base/hostinfo.cc @@ -39,7 +39,7 @@ #include #include "base/misc.hh" -#include "sim/host.hh" +#include "base/types.hh" using namespace std; diff --git a/src/base/hostinfo.hh b/src/base/hostinfo.hh index 70cd19203..ac7d40f13 100644 --- a/src/base/hostinfo.hh +++ b/src/base/hostinfo.hh @@ -33,7 +33,7 @@ #include -#include "sim/host.hh" +#include "base/types.hh" std::string &hostname(); diff --git a/src/base/inet.cc b/src/base/inet.cc index 8c3240fa6..84379b135 100644 --- a/src/base/inet.cc +++ b/src/base/inet.cc @@ -32,7 +32,7 @@ #include #include "base/cprintf.hh" -#include "sim/host.hh" +#include "base/types.hh" #include "base/inet.hh" using namespace std; diff --git a/src/base/inet.hh b/src/base/inet.hh index 59b05291d..61d432036 100644 --- a/src/base/inet.hh +++ b/src/base/inet.hh @@ -39,7 +39,7 @@ #include "base/range.hh" #include "dev/etherpkt.hh" -#include "sim/host.hh" +#include "base/types.hh" #include "dnet/os.h" #include "dnet/eth.h" diff --git a/src/base/intmath.hh b/src/base/intmath.hh index c536fda51..139f6bf15 100644 --- a/src/base/intmath.hh +++ b/src/base/intmath.hh @@ -33,7 +33,7 @@ #include -#include "sim/host.hh" +#include "base/types.hh" // Returns the prime number one less than n. int prevPrime(int n); diff --git a/src/base/loader/hex_file.hh b/src/base/loader/hex_file.hh index 40483e684..87a7eb0f3 100755 --- a/src/base/loader/hex_file.hh +++ b/src/base/loader/hex_file.hh @@ -35,7 +35,7 @@ #include #include -#include "sim/host.hh" // for Addr +#include "base/types.hh" class Port; diff --git a/src/base/loader/object_file.hh b/src/base/loader/object_file.hh index d363cde84..73df5caf6 100644 --- a/src/base/loader/object_file.hh +++ b/src/base/loader/object_file.hh @@ -35,7 +35,7 @@ #include #include -#include "sim/host.hh" // for Addr +#include "base/types.hh" class Port; class SymbolTable; diff --git a/src/base/loader/symtab.cc b/src/base/loader/symtab.cc index 3e73eb7a3..d137477f4 100644 --- a/src/base/loader/symtab.cc +++ b/src/base/loader/symtab.cc @@ -36,7 +36,7 @@ #include "base/loader/symtab.hh" #include "base/misc.hh" #include "base/str.hh" -#include "sim/host.hh" +#include "base/types.hh" #include "sim/serialize.hh" using namespace std; diff --git a/src/base/loader/symtab.hh b/src/base/loader/symtab.hh index cc1dc368f..2a2fd068e 100644 --- a/src/base/loader/symtab.hh +++ b/src/base/loader/symtab.hh @@ -36,7 +36,7 @@ #include #include -#include "sim/host.hh" // for Addr +#include "base/types.hh" class Checkpoint; class SymbolTable diff --git a/src/base/misc.cc b/src/base/misc.cc index 035282baf..55c324aaa 100644 --- a/src/base/misc.cc +++ b/src/base/misc.cc @@ -39,7 +39,7 @@ #include "base/output.hh" #include "base/trace.hh" #include "base/varargs.hh" -#include "sim/host.hh" +#include "base/types.hh" #include "sim/core.hh" using namespace std; diff --git a/src/base/pollevent.cc b/src/base/pollevent.cc index 331b5eac6..0f237566a 100644 --- a/src/base/pollevent.cc +++ b/src/base/pollevent.cc @@ -39,7 +39,7 @@ #include #include "sim/async.hh" -#include "sim/host.hh" +#include "base/types.hh" #include "base/misc.hh" #include "base/pollevent.hh" #include "sim/core.hh" diff --git a/src/base/random.hh b/src/base/random.hh index 401ba086f..b74a7c4a2 100644 --- a/src/base/random.hh +++ b/src/base/random.hh @@ -36,7 +36,7 @@ #include #include "base/range.hh" -#include "sim/host.hh" +#include "base/types.hh" class Checkpoint; diff --git a/src/base/socket.cc b/src/base/socket.cc index bcc5236b0..4ad8f5c93 100644 --- a/src/base/socket.cc +++ b/src/base/socket.cc @@ -37,7 +37,7 @@ #include #include -#include "sim/host.hh" +#include "base/types.hh" #include "base/misc.hh" #include "base/socket.hh" diff --git a/src/base/statistics.hh b/src/base/statistics.hh index 45cd5186c..243d56c3a 100644 --- a/src/base/statistics.hh +++ b/src/base/statistics.hh @@ -67,7 +67,7 @@ #include "base/stats/info.hh" #include "base/stats/types.hh" #include "base/stats/visit.hh" -#include "sim/host.hh" +#include "base/types.hh" class Callback; diff --git a/src/base/stats/events.cc b/src/base/stats/events.cc index dcf52e6d8..29117b1e2 100644 --- a/src/base/stats/events.cc +++ b/src/base/stats/events.cc @@ -32,7 +32,7 @@ #include "base/stats/events.hh" #include "base/stats/output.hh" -#include "sim/host.hh" +#include "base/types.hh" using namespace std; diff --git a/src/base/stats/mysql.cc b/src/base/stats/mysql.cc index d14904fb0..91bea4540 100644 --- a/src/base/stats/mysql.cc +++ b/src/base/stats/mysql.cc @@ -43,7 +43,7 @@ #include "base/stats/types.hh" #include "base/str.hh" #include "base/userinfo.hh" -#include "sim/host.hh" +#include "base/types.hh" using namespace std; diff --git a/src/base/stats/mysql_run.hh b/src/base/stats/mysql_run.hh index 7c606370e..7207cd841 100644 --- a/src/base/stats/mysql_run.hh +++ b/src/base/stats/mysql_run.hh @@ -34,7 +34,7 @@ #include #include "base/mysql.hh" -#include "sim/host.hh" +#include "base/types.hh" namespace Stats { diff --git a/src/base/stats/output.cc b/src/base/stats/output.cc index 31aa21c45..f3a549b44 100644 --- a/src/base/stats/output.cc +++ b/src/base/stats/output.cc @@ -33,7 +33,7 @@ #include "base/statistics.hh" #include "base/stats/output.hh" #include "sim/eventq.hh" -#include "sim/host.hh" +#include "base/types.hh" using namespace std; diff --git a/src/base/stats/types.hh b/src/base/stats/types.hh index e561f94ad..87cf91653 100644 --- a/src/base/stats/types.hh +++ b/src/base/stats/types.hh @@ -34,7 +34,7 @@ #include #include -#include "sim/host.hh" +#include "base/types.hh" namespace Stats { diff --git a/src/base/stats/visit.hh b/src/base/stats/visit.hh index 89dd57912..c9fab19a3 100644 --- a/src/base/stats/visit.hh +++ b/src/base/stats/visit.hh @@ -34,7 +34,7 @@ #include #include "base/time.hh" -#include "sim/host.hh" +#include "base/types.hh" namespace Stats { diff --git a/src/base/trace.hh b/src/base/trace.hh index fa24e9c48..6f8c196b0 100644 --- a/src/base/trace.hh +++ b/src/base/trace.hh @@ -38,7 +38,7 @@ #include "base/cprintf.hh" #include "base/match.hh" #include "base/traceflags.hh" -#include "sim/host.hh" +#include "base/types.hh" #include "sim/core.hh" namespace Trace { diff --git a/src/base/types.hh b/src/base/types.hh new file mode 100644 index 000000000..6d8d3095c --- /dev/null +++ b/src/base/types.hh @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2003-2005 The Regents of The University of Michigan + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Nathan Binkert + */ + +/** + * @file + * Defines global host-dependent types: + * Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t. + */ + +#ifndef __BASE_TYPES_HH__ +#define __BASE_TYPES_HH__ + +#include + +/** uint64_t constant */ +#define ULL(N) ((uint64_t)N##ULL) +/** int64_t constant */ +#define LL(N) ((int64_t)N##LL) + +/** Statistics counter type. Not much excuse for not using a 64-bit + * integer here, but if you're desperate and only run short + * simulations you could make this 32 bits. + */ +typedef int64_t Counter; + +/** + * Clock cycle count type. + * @note using an unsigned breaks the cache. + */ +typedef int64_t Tick; + +const Tick MaxTick = LL(0x7fffffffffffffff); + +/** + * Address type + * This will probably be moved somewhere else in the near future. + * This should be at least as big as the biggest address width in use + * in the system, which will probably be 64 bits. + */ +typedef uint64_t Addr; + +const Addr MaxAddr = (Addr)-1; + +#endif // __BASE_TYPES_HH__ -- cgit v1.2.3