RubySlicc_Util.hh (6285:ce086eca1ede) RubySlicc_Util.hh (6372:f1a41ea3bbab)
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

--- 29 unchanged lines hidden (view full) ---

38
39#ifndef SLICC_UTIL_H
40#define SLICC_UTIL_H
41
42#include "mem/ruby/common/Global.hh"
43#include "mem/ruby/common/Address.hh"
44#include "mem/ruby/system/NodeID.hh"
45#include "mem/ruby/system/MachineID.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

--- 29 unchanged lines hidden (view full) ---

38
39#ifndef SLICC_UTIL_H
40#define SLICC_UTIL_H
41
42#include "mem/ruby/common/Global.hh"
43#include "mem/ruby/common/Address.hh"
44#include "mem/ruby/system/NodeID.hh"
45#include "mem/ruby/system/MachineID.hh"
46#include "mem/ruby/config/RubyConfig.hh"
47#include "mem/protocol/CacheMsg.hh"
48#include "mem/protocol/GenericRequestType.hh"
49#include "mem/protocol/CacheRequestType.hh"
50#include "mem/protocol/AccessType.hh"
51#include "mem/protocol/MachineType.hh"
52#include "mem/protocol/Directory_State.hh"
53#include "mem/protocol/L1Cache_State.hh"
54#include "mem/protocol/MessageSizeType.hh"

--- 52 unchanged lines hidden (view full) ---

107 return (int) addr.getLineAddress();
108}
109
110extern inline int MessageSizeTypeToInt(MessageSizeType size_type)
111{
112 return MessageSizeType_to_int(size_type);
113}
114
46#include "mem/protocol/CacheMsg.hh"
47#include "mem/protocol/GenericRequestType.hh"
48#include "mem/protocol/CacheRequestType.hh"
49#include "mem/protocol/AccessType.hh"
50#include "mem/protocol/MachineType.hh"
51#include "mem/protocol/Directory_State.hh"
52#include "mem/protocol/L1Cache_State.hh"
53#include "mem/protocol/MessageSizeType.hh"

--- 52 unchanged lines hidden (view full) ---

106 return (int) addr.getLineAddress();
107}
108
109extern inline int MessageSizeTypeToInt(MessageSizeType size_type)
110{
111 return MessageSizeType_to_int(size_type);
112}
113
115/*
116extern inline int numberOfNodes()
117{
118 return RubyConfig::numberOfChips();
119}
120*/
121/*
122extern inline int numberOfL1CachePerChip()
123{
124 return RubyConfig::getNumberOfCachesPerLevelPerChip(1,0);
125}
126*/
127
128extern inline bool long_enough_ago(Time event)
129{
130 return ((get_time() - event) > 200);
131}
132
133extern inline int getAddThenMod(int addend1, int addend2, int modulus)
134{
135 return (addend1 + addend2) % modulus;

--- 30 unchanged lines hidden (view full) ---

166}
167
168// Return type for time_to_int is "Time" and not "int" so we get a 64-bit integer
169extern inline Time time_to_int(Time time)
170{
171 return time;
172}
173
114extern inline bool long_enough_ago(Time event)
115{
116 return ((get_time() - event) > 200);
117}
118
119extern inline int getAddThenMod(int addend1, int addend2, int modulus)
120{
121 return (addend1 + addend2) % modulus;

--- 30 unchanged lines hidden (view full) ---

152}
153
154// Return type for time_to_int is "Time" and not "int" so we get a 64-bit integer
155extern inline Time time_to_int(Time time)
156{
157 return time;
158}
159
174/*
175extern inline bool getFilteringEnabled()
176{
177 return RubyConfig::getFilteringEnabled();
178}
179
180
181extern inline int getRetryThreshold()
182{
183 return RubyConfig::getRetryThreshold();
184}
185
186extern inline int getFixedTimeoutLatency()
187{
188 return RubyConfig::getFixedTimeoutLatency();
189}
190
191extern inline int N_tokens()
192{
193 // return N+1 to handle clean writeback
194 return RubyConfig::getProcsPerChip() + 1;
195 // return 1;
196}
197
198extern inline bool distributedPersistentEnabled()
199{
200 return RubyConfig::getDistributedPersistentEnabled();
201}
202
203extern inline bool getDynamicTimeoutEnabled()
204{
205 return RubyConfig::getDynamicTimeoutEnabled();
206}
207*/
208// Appends an offset to an address
209extern inline Address setOffset(Address addr, int offset)
210{
211 Address result = addr;
212 result.setOffset(offset);
213 return result;
214}
215
216// Makes an address into a line address
217extern inline Address makeLineAddress(Address addr)
218{
219 Address result = addr;
220 result.makeLineAddress();
221 return result;
222}
223
224#endif //SLICC_UTIL_H
160// Appends an offset to an address
161extern inline Address setOffset(Address addr, int offset)
162{
163 Address result = addr;
164 result.setOffset(offset);
165 return result;
166}
167
168// Makes an address into a line address
169extern inline Address makeLineAddress(Address addr)
170{
171 Address result = addr;
172 result.makeLineAddress();
173 return result;
174}
175
176#endif //SLICC_UTIL_H