Deleted Added
sdiff udiff text old ( 6284:a63d1dc4c820 ) new ( 6285:ce086eca1ede )
full compact
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

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

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"
55#include "mem/ruby/network/Network.hh"
56#include "mem/protocol/PrefetchBit.hh"
57
58#include "mem/ruby/slicc_interface/RubySlicc_ComponentMapping.hh"
59
60class Set;
61class NetDest;
62
63extern inline int random(int n)
64{
65 return random() % n;
66}
67
68extern inline bool multicast_retry()
69{
70 if (RANDOMIZATION) {
71 return (random() & 0x1);
72 } else {
73 return true;
74 }
75}
76
77extern inline int cache_state_to_int(L1Cache_State state)
78{

--- 27 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
114extern inline int numberOfNodes()
115{
116 return RubyConfig::numberOfChips();
117}
118
119extern inline int numberOfL1CachePerChip()
120{
121 return RubyConfig::numberOfL1CachePerChip();
122}
123
124extern inline bool long_enough_ago(Time event)
125{
126 return ((get_time() - event) > 200);
127}
128
129extern inline int getAddThenMod(int addend1, int addend2, int modulus)
130{

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

144extern inline Time getTimeMinusTime(Time t1, Time t2)
145{
146 ASSERT(t1 >= t2);
147 return t1 - t2;
148}
149
150extern inline Time getPreviousDelayedCycles(Time t1, Time t2)
151{
152 if (RANDOMIZATION) { // when randomizing delayed
153 return 0;
154 } else {
155 return getTimeMinusTime(t1, t2);
156 }
157}
158
159extern inline void WARN_ERROR_TIME(Time time)
160{
161 WARN_EXPR(time);
162}
163
164// Return type for time_to_int is "Time" and not "int" so we get a 64-bit integer
165extern inline Time time_to_int(Time time)
166{
167 return time;
168}
169
170
171extern inline bool getFilteringEnabled()
172{
173 return g_FILTERING_ENABLED;
174}
175
176extern inline int getRetryThreshold()
177{
178 return g_RETRY_THRESHOLD;
179}
180
181extern inline int getFixedTimeoutLatency()
182{
183 return g_FIXED_TIMEOUT_LATENCY;
184}
185
186extern inline int N_tokens()
187{
188 // return N+1 to handle clean writeback
189 return g_PROCS_PER_CHIP + 1;
190 // return 1;
191}
192
193extern inline bool distributedPersistentEnabled()
194{
195 return g_DISTRIBUTED_PERSISTENT_ENABLED;
196}
197
198extern inline bool getDynamicTimeoutEnabled()
199{
200 return g_DYNAMIC_TIMEOUT_ENABLED;
201}
202
203// Appends an offset to an address
204extern inline Address setOffset(Address addr, int offset)
205{
206 Address result = addr;
207 result.setOffset(offset);
208 return result;
209}
210
211// Makes an address into a line address
212extern inline Address makeLineAddress(Address addr)
213{
214 Address result = addr;
215 result.makeLineAddress();
216 return result;
217}
218
219#endif //SLICC_UTIL_H