ruby: Import ruby and slicc from GEMS
[gem5.git] / src / mem / ruby / common / Global.hh
1
2 /*
3 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer;
10 * redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution;
13 * neither the name of the copyright holders nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30 /*
31 * $Id$
32 *
33 * */
34
35 #ifndef GLOBAL_H
36 #define GLOBAL_H
37
38 #ifdef SINGLE_LEVEL_CACHE
39 const bool TWO_LEVEL_CACHE = false;
40 #define L1I_CACHE_MEMBER_VARIABLE m_L1Cache_cacheMemory_vec[m_version] // currently all protocols require L1s == nodes
41 #define L1D_CACHE_MEMBER_VARIABLE m_L1Cache_cacheMemory_vec[m_version] // "
42 #define L2_CACHE_MEMBER_VARIABLE m_L1Cache_cacheMemory_vec[m_version] // "
43 #define L2_CACHE_VARIABLE m_L1Cache_cacheMemory_vec
44 #else
45 const bool TWO_LEVEL_CACHE = true;
46 #ifdef IS_CMP
47 #define L1I_CACHE_MEMBER_VARIABLE m_L1Cache_L1IcacheMemory_vec[m_version]
48 #define L1D_CACHE_MEMBER_VARIABLE m_L1Cache_L1DcacheMemory_vec[m_version]
49 #define L2_CACHE_MEMBER_VARIABLE m_L2Cache_L2cacheMemory_vec[m_version]
50 #define L2_CACHE_VARIABLE m_L2Cache_L2cacheMemory_vec
51 #else // not IS_CMP
52 #define L1I_CACHE_MEMBER_VARIABLE m_L1Cache_L1IcacheMemory_vec[m_version] // currently all protocols require L1s == nodes
53 #define L1D_CACHE_MEMBER_VARIABLE m_L1Cache_L1DcacheMemory_vec[m_version] // "
54 // #define L2_CACHE_MEMBER_VARIABLE m_L1Cache_L2cacheMemory_vec[m_version] // old exclusive caches don't support L2s != nodes
55 #define L2_CACHE_MEMBER_VARIABLE m_L1Cache_cacheMemory_vec[m_version] // old exclusive caches don't support L2s != nodes
56 #define L2_CACHE_VARIABLE m_L1Cache_L2cacheMemory_vec
57 #endif // IS_CMP
58 #endif //SINGLE_LEVEL_CACHE
59
60 #define DIRECTORY_MEMBER_VARIABLE m_Directory_directory_vec[m_version]
61 #define TBE_TABLE_MEMBER_VARIABLE m_L1Cache_TBEs_vec[m_version]
62
63 typedef unsigned char uint8;
64 typedef unsigned int uint32;
65 typedef unsigned long long uint64;
66
67 typedef signed char int8;
68 typedef int int32;
69 typedef long long int64;
70
71 typedef long long integer_t;
72 typedef unsigned long long uinteger_t;
73
74 typedef int64 Time;
75 typedef uint64 physical_address_t;
76 typedef uint64 la_t;
77 typedef uint64 pa_t;
78 typedef integer_t simtime_t;
79
80 // external includes for all classes
81 #include "std-includes.hh"
82 #include "Debug.hh"
83
84 // simple type declarations
85 typedef Time LogicalTime;
86 typedef int64 Index; // what the address bit ripper returns
87 typedef int word; // one word of a cache line
88 typedef unsigned int uint;
89 typedef int SwitchID;
90 typedef int LinkID;
91
92 class EventQueue;
93 extern EventQueue* g_eventQueue_ptr;
94
95 class System;
96 extern System* g_system_ptr;
97
98 class Debug;
99 extern Debug* g_debug_ptr;
100
101 // FIXME: this is required by the contructor of Directory_Entry.h. It can't go
102 // into slicc_util.h because it opens a can of ugly worms
103 extern inline int max_tokens()
104 {
105 return 1024;
106 }
107
108
109 #endif //GLOBAL_H
110