summaryrefslogtreecommitdiff
path: root/src/mem/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/ruby')
-rw-r--r--src/mem/ruby/buffers/MessageBuffer.cc17
-rw-r--r--src/mem/ruby/buffers/MessageBuffer.hh1
-rw-r--r--src/mem/ruby/common/Debug.cc1
-rw-r--r--src/mem/ruby/filters/BlockBloomFilter.cc14
-rw-r--r--src/mem/ruby/filters/BulkBloomFilter.cc13
-rw-r--r--src/mem/ruby/filters/GenericBloomFilter.cc9
-rw-r--r--src/mem/ruby/filters/H3BloomFilter.cc27
-rw-r--r--src/mem/ruby/filters/LSB_CountingBloomFilter.cc14
-rw-r--r--src/mem/ruby/filters/MultiBitSelBloomFilter.cc34
-rw-r--r--src/mem/ruby/filters/MultiGrainBloomFilter.cc16
-rw-r--r--src/mem/ruby/filters/NonCountingBloomFilter.cc12
-rw-r--r--src/mem/ruby/network/garnet/BaseGarnetNetwork.hh1
-rw-r--r--src/mem/ruby/network/simple/PerfectSwitch.cc1
-rw-r--r--src/mem/ruby/network/simple/SimpleNetwork.cc8
-rw-r--r--src/mem/ruby/network/simple/Topology.cc1
-rw-r--r--src/mem/ruby/profiler/Profiler.cc11
-rw-r--r--src/mem/ruby/system/CacheMemory.cc3
-rw-r--r--src/mem/ruby/system/DirectoryMemory.cc10
-rw-r--r--src/mem/ruby/system/MachineID.hh4
-rw-r--r--src/mem/ruby/system/MemoryControl.hh1
-rw-r--r--src/mem/ruby/system/NodeID.hh4
-rw-r--r--src/mem/ruby/system/PersistentTable.cc1
-rw-r--r--src/mem/ruby/system/Sequencer.cc1
-rw-r--r--src/mem/ruby/system/System.cc7
24 files changed, 123 insertions, 88 deletions
diff --git a/src/mem/ruby/buffers/MessageBuffer.cc b/src/mem/ruby/buffers/MessageBuffer.cc
index 086f92ab7..e64e47cad 100644
--- a/src/mem/ruby/buffers/MessageBuffer.cc
+++ b/src/mem/ruby/buffers/MessageBuffer.cc
@@ -26,6 +26,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "base/cprintf.hh"
#include "mem/ruby/buffers/MessageBuffer.hh"
#include "mem/ruby/system/System.hh"
@@ -123,8 +124,8 @@ MessageBuffer::peekAtHeadOfQueue() const
DEBUG_NEWLINE(QUEUE_COMP, MedPrio);
DEBUG_MSG(QUEUE_COMP, MedPrio,
- "Peeking at head of queue " + m_name + " time: "
- + int_to_string(g_eventQueue_ptr->getTime()) + ".");
+ csprintf("Peeking at head of queue %s time: %d.",
+ m_name, g_eventQueue_ptr->getTime()));
assert(isReady());
msg_ptr = m_prio_heap.peekMin().m_msgptr.ref();
@@ -151,8 +152,9 @@ void
MessageBuffer::enqueue(const MsgPtr& message, Time delta)
{
DEBUG_NEWLINE(QUEUE_COMP, HighPrio);
- DEBUG_MSG(QUEUE_COMP, HighPrio, "enqueue " + m_name + " time: "
- + int_to_string(g_eventQueue_ptr->getTime()) + ".");
+ DEBUG_MSG(QUEUE_COMP, HighPrio,
+ csprintf("enqueue %s time: %d.", m_name,
+ g_eventQueue_ptr->getTime()));
DEBUG_EXPR(QUEUE_COMP, MedPrio, message);
DEBUG_NEWLINE(QUEUE_COMP, HighPrio);
@@ -228,10 +230,9 @@ MessageBuffer::enqueue(const MsgPtr& message, Time delta)
m_prio_heap.insert(thisNode);
DEBUG_NEWLINE(QUEUE_COMP, HighPrio);
- DEBUG_MSG(QUEUE_COMP, HighPrio, "enqueue " + m_name
- + " with arrival_time " + int_to_string(arrival_time)
- + " cur_time: " + int_to_string(g_eventQueue_ptr->getTime())
- + ".");
+ DEBUG_MSG(QUEUE_COMP, HighPrio,
+ csprintf("enqueue %s with arrival_time %d cur_time: %d.",
+ m_name, arrival_time, g_eventQueue_ptr->getTime()));
DEBUG_EXPR(QUEUE_COMP, MedPrio, message);
DEBUG_NEWLINE(QUEUE_COMP, HighPrio);
diff --git a/src/mem/ruby/buffers/MessageBuffer.hh b/src/mem/ruby/buffers/MessageBuffer.hh
index 8fc86af97..6b567d70d 100644
--- a/src/mem/ruby/buffers/MessageBuffer.hh
+++ b/src/mem/ruby/buffers/MessageBuffer.hh
@@ -38,7 +38,6 @@
#include <string>
#include "mem/gems_common/PrioHeap.hh"
-#include "mem/gems_common/util.hh"
#include "mem/ruby/buffers/MessageBufferNode.hh"
#include "mem/ruby/common/Consumer.hh"
#include "mem/ruby/common/Global.hh"
diff --git a/src/mem/ruby/common/Debug.cc b/src/mem/ruby/common/Debug.cc
index 2c1acc4ff..1bf7ae43b 100644
--- a/src/mem/ruby/common/Debug.cc
+++ b/src/mem/ruby/common/Debug.cc
@@ -30,7 +30,6 @@
#include <stdarg.h>
#include "base/misc.hh"
-#include "mem/gems_common/util.hh"
#include "mem/ruby/common/Debug.hh"
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/eventqueue/RubyEventQueue.hh"
diff --git a/src/mem/ruby/filters/BlockBloomFilter.cc b/src/mem/ruby/filters/BlockBloomFilter.cc
index 21d7921c6..875a0d015 100644
--- a/src/mem/ruby/filters/BlockBloomFilter.cc
+++ b/src/mem/ruby/filters/BlockBloomFilter.cc
@@ -26,6 +26,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "base/intmath.hh"
+#include "base/str.hh"
#include "mem/gems_common/Map.hh"
#include "mem/ruby/common/Address.hh"
#include "mem/ruby/filters/BlockBloomFilter.hh"
@@ -34,11 +36,17 @@ using namespace std;
BlockBloomFilter::BlockBloomFilter(string str)
{
- string tail(str);
- string head = string_split(tail, '_');
+ string head, tail;
+
+#ifndef NDEBUG
+ bool success =
+#endif
+ split_first(str, head, tail, '_');
+
+ assert(success);
m_filter_size = atoi(head.c_str());
- m_filter_size_bits = log_int(m_filter_size);
+ m_filter_size_bits = floorLog2(m_filter_size);
m_filter.setSize(m_filter_size);
diff --git a/src/mem/ruby/filters/BulkBloomFilter.cc b/src/mem/ruby/filters/BulkBloomFilter.cc
index 47cc386cd..a03cba37b 100644
--- a/src/mem/ruby/filters/BulkBloomFilter.cc
+++ b/src/mem/ruby/filters/BulkBloomFilter.cc
@@ -26,6 +26,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "base/intmath.hh"
+#include "base/str.hh"
#include "mem/gems_common/Map.hh"
#include "mem/ruby/common/Address.hh"
#include "mem/ruby/filters/BulkBloomFilter.hh"
@@ -34,11 +36,16 @@ using namespace std;
BulkBloomFilter::BulkBloomFilter(string str)
{
- string tail(str);
- string head = string_split(tail, '_');
+ string head, tail;
+
+#ifndef NDEBUG
+ bool success =
+#endif
+ split_first(str, head, tail, '_');
+ assert(success);
m_filter_size = atoi(head.c_str());
- m_filter_size_bits = log_int(m_filter_size);
+ m_filter_size_bits = floorLog2(m_filter_size);
// split the filter bits in half, c0 and c1
m_sector_bits = m_filter_size_bits - 1;
diff --git a/src/mem/ruby/filters/GenericBloomFilter.cc b/src/mem/ruby/filters/GenericBloomFilter.cc
index 8d6b18e9e..e04547fec 100644
--- a/src/mem/ruby/filters/GenericBloomFilter.cc
+++ b/src/mem/ruby/filters/GenericBloomFilter.cc
@@ -26,6 +26,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "base/str.hh"
#include "mem/ruby/common/Address.hh"
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/filters/BlockBloomFilter.hh"
@@ -41,8 +42,12 @@ using namespace std;
GenericBloomFilter::GenericBloomFilter(string config)
{
- string tail(config);
- string head = string_split(tail,'_');
+ string head, tail;
+#ifndef NDEBUG
+ bool success =
+#endif
+ split_first(config, head, tail, '_');
+ assert(success);
if (head == "LSB_Counting" ) {
m_filter = new LSB_CountingBloomFilter(tail);
diff --git a/src/mem/ruby/filters/H3BloomFilter.cc b/src/mem/ruby/filters/H3BloomFilter.cc
index 8018c7e38..d0a4f400d 100644
--- a/src/mem/ruby/filters/H3BloomFilter.cc
+++ b/src/mem/ruby/filters/H3BloomFilter.cc
@@ -26,6 +26,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "base/intmath.hh"
+#include "base/str.hh"
#include "mem/gems_common/Map.hh"
#include "mem/ruby/common/Address.hh"
#include "mem/ruby/filters/H3BloomFilter.hh"
@@ -378,29 +380,26 @@ H3BloomFilter::H3BloomFilter(string str)
adds_list[4] = 7777;
adds_list[5] = 65931;
- string tail(str);
- string head = string_split(tail, '_');
+ vector<string> items;
+ tokenize(items, str, '_');
+ assert(items.size() == 3);
// head contains filter size, tail contains bit offset from block number
- m_filter_size = atoi(head.c_str());
+ m_filter_size = atoi(items[0].c_str());
+ m_num_hashes = atoi(items[1].c_str());
- head = string_split(tail, '_');
- m_num_hashes = atoi(head.c_str());
-
- if(tail == "Regular") {
+ if (items[2] == "Regular") {
isParallel = false;
- } else if (tail == "Parallel") {
+ } else if (items[2] == "Parallel") {
isParallel = true;
} else {
- cout << "ERROR: Incorrect config string for MultiHash Bloom! :"
- << str << endl;
- assert(0);
+ panic("ERROR: Incorrect config string for MultiHash Bloom! :%s", str);
}
- m_filter_size_bits = log_int(m_filter_size);
+ m_filter_size_bits = floorLog2(m_filter_size);
- m_par_filter_size = m_filter_size/m_num_hashes;
- m_par_filter_size_bits = log_int(m_par_filter_size);
+ m_par_filter_size = m_filter_size / m_num_hashes;
+ m_par_filter_size_bits = floorLog2(m_par_filter_size);
m_filter.setSize(m_filter_size);
clear();
diff --git a/src/mem/ruby/filters/LSB_CountingBloomFilter.cc b/src/mem/ruby/filters/LSB_CountingBloomFilter.cc
index 7ec927d6c..029ce1501 100644
--- a/src/mem/ruby/filters/LSB_CountingBloomFilter.cc
+++ b/src/mem/ruby/filters/LSB_CountingBloomFilter.cc
@@ -26,6 +26,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "base/intmath.hh"
+#include "base/str.hh"
#include "mem/gems_common/Map.hh"
#include "mem/ruby/common/Address.hh"
#include "mem/ruby/filters/LSB_CountingBloomFilter.hh"
@@ -34,14 +36,18 @@ using namespace std;
LSB_CountingBloomFilter::LSB_CountingBloomFilter(string str)
{
- string tail(str);
- string head = string_split(tail, ':');
+ string head, tail;
+#ifndef NDEBUG
+ bool success =
+#endif
+ split_first(str, head, tail, '_');
+ assert(success);
m_filter_size = atoi(head.c_str());
- m_filter_size_bits = log_int(m_filter_size);
+ m_filter_size_bits = floorLog2(m_filter_size);
m_count = atoi(tail.c_str());
- m_count_bits = log_int(m_count);
+ m_count_bits = floorLog2(m_count);
m_filter.setSize(m_filter_size);
clear();
diff --git a/src/mem/ruby/filters/MultiBitSelBloomFilter.cc b/src/mem/ruby/filters/MultiBitSelBloomFilter.cc
index 90f299fb4..466e3fccb 100644
--- a/src/mem/ruby/filters/MultiBitSelBloomFilter.cc
+++ b/src/mem/ruby/filters/MultiBitSelBloomFilter.cc
@@ -26,6 +26,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <vector>
+
+#include "base/intmath.hh"
+#include "base/str.hh"
#include "mem/gems_common/Map.hh"
#include "mem/ruby/common/Address.hh"
#include "mem/ruby/filters/MultiBitSelBloomFilter.hh"
@@ -34,32 +38,28 @@ using namespace std;
MultiBitSelBloomFilter::MultiBitSelBloomFilter(string str)
{
- string tail(str);
- string head = string_split(tail, '_');
+ vector<string> items;
+ tokenize(items, str, '_');
+ assert(items.size() == 4);
// head contains filter size, tail contains bit offset from block number
- m_filter_size = atoi(head.c_str());
-
- head = string_split(tail, '_');
- m_num_hashes = atoi(head.c_str());
-
- head = string_split(tail, '_');
- m_skip_bits = atoi(head.c_str());
+ m_filter_size = atoi(items[0].c_str());
+ m_num_hashes = atoi(items[1].c_str());
+ m_skip_bits = atoi(items[2].c_str());
- if(tail == "Regular") {
+ if (items[3] == "Regular") {
isParallel = false;
- } else if (tail == "Parallel") {
+ } else if (items[3] == "Parallel") {
isParallel = true;
} else {
- cout << "ERROR: Incorrect config string for MultiBitSel Bloom! :"
- << str << endl;
- assert(0);
+ panic("ERROR: Incorrect config string for MultiBitSel Bloom! :%s",
+ str);
}
- m_filter_size_bits = log_int(m_filter_size);
+ m_filter_size_bits = floorLog2(m_filter_size);
- m_par_filter_size = m_filter_size/m_num_hashes;
- m_par_filter_size_bits = log_int(m_par_filter_size);
+ m_par_filter_size = m_filter_size / m_num_hashes;
+ m_par_filter_size_bits = floorLog2(m_par_filter_size);
m_filter.setSize(m_filter_size);
clear();
diff --git a/src/mem/ruby/filters/MultiGrainBloomFilter.cc b/src/mem/ruby/filters/MultiGrainBloomFilter.cc
index 24fcd7ead..7b3976473 100644
--- a/src/mem/ruby/filters/MultiGrainBloomFilter.cc
+++ b/src/mem/ruby/filters/MultiGrainBloomFilter.cc
@@ -26,6 +26,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "base/intmath.hh"
+#include "base/str.hh"
#include "mem/gems_common/Map.hh"
#include "mem/ruby/common/Address.hh"
#include "mem/ruby/filters/MultiGrainBloomFilter.hh"
@@ -34,19 +36,21 @@ using namespace std;
MultiGrainBloomFilter::MultiGrainBloomFilter(string str)
{
- string tail(str);
-
- // split into the 2 filter sizes
- string head = string_split(tail, '_');
+ string head, tail;
+#ifndef NDEBUG
+ bool success =
+#endif
+ split_first(str, head, tail, '_');
+ assert(success);
// head contains size of 1st bloom filter, tail contains size of
// 2nd bloom filter
m_filter_size = atoi(head.c_str());
- m_filter_size_bits = log_int(m_filter_size);
+ m_filter_size_bits = floorLog2(m_filter_size);
m_page_filter_size = atoi(tail.c_str());
- m_page_filter_size_bits = log_int(m_page_filter_size);
+ m_page_filter_size_bits = floorLog2(m_page_filter_size);
m_filter.setSize(m_filter_size);
m_page_filter.setSize(m_page_filter_size);
diff --git a/src/mem/ruby/filters/NonCountingBloomFilter.cc b/src/mem/ruby/filters/NonCountingBloomFilter.cc
index 2b3965927..909aaf76b 100644
--- a/src/mem/ruby/filters/NonCountingBloomFilter.cc
+++ b/src/mem/ruby/filters/NonCountingBloomFilter.cc
@@ -26,6 +26,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "base/intmath.hh"
+#include "base/str.hh"
#include "mem/gems_common/Map.hh"
#include "mem/ruby/common/Address.hh"
#include "mem/ruby/filters/NonCountingBloomFilter.hh"
@@ -34,13 +36,17 @@ using namespace std;
NonCountingBloomFilter::NonCountingBloomFilter(string str)
{
- string tail(str);
- string head = string_split(tail, '_');
+ string head, tail;
+#ifndef NDEBUG
+ bool success =
+#endif
+ split_first(str, head, tail, '_');
+ assert(success);
// head contains filter size, tail contains bit offset from block number
m_filter_size = atoi(head.c_str());
m_offset = atoi(tail.c_str());
- m_filter_size_bits = log_int(m_filter_size);
+ m_filter_size_bits = floorLog2(m_filter_size);
m_filter.setSize(m_filter_size);
clear();
diff --git a/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh b/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh
index 1c90c2ca2..a8eca11a4 100644
--- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh
+++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh
@@ -37,7 +37,6 @@
#define BASEGARNETNETWORK_H
#include "mem/ruby/network/garnet/NetworkHeader.hh"
-#include "mem/gems_common/util.hh"
#include "mem/ruby/network/Network.hh"
#include "params/BaseGarnetNetwork.hh"
diff --git a/src/mem/ruby/network/simple/PerfectSwitch.cc b/src/mem/ruby/network/simple/PerfectSwitch.cc
index 4555ef2b3..cf3a5af9c 100644
--- a/src/mem/ruby/network/simple/PerfectSwitch.cc
+++ b/src/mem/ruby/network/simple/PerfectSwitch.cc
@@ -26,7 +26,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "mem/gems_common/util.hh"
#include "mem/protocol/Protocol.hh"
#include "mem/ruby/buffers/MessageBuffer.hh"
#include "mem/ruby/network/simple/PerfectSwitch.hh"
diff --git a/src/mem/ruby/network/simple/SimpleNetwork.cc b/src/mem/ruby/network/simple/SimpleNetwork.cc
index 2940f19a1..47404ad01 100644
--- a/src/mem/ruby/network/simple/SimpleNetwork.cc
+++ b/src/mem/ruby/network/simple/SimpleNetwork.cc
@@ -75,10 +75,10 @@ SimpleNetwork::SimpleNetwork(const Params *p)
m_toNetQueues[node].setSize(m_virtual_networks);
m_fromNetQueues[node].setSize(m_virtual_networks);
for (int j = 0; j < m_virtual_networks; j++) {
- m_toNetQueues[node][j] = new MessageBuffer(
- "toNet node "+int_to_string(node)+" j "+int_to_string(j));
- m_fromNetQueues[node][j] = new MessageBuffer(
- "fromNet node "+int_to_string(node)+" j "+int_to_string(j));
+ m_toNetQueues[node][j] =
+ new MessageBuffer(csprintf("toNet node %d j %d", node, j));
+ m_fromNetQueues[node][j] =
+ new MessageBuffer(csprintf("fromNet node %d j %d", node, j));
}
}
}
diff --git a/src/mem/ruby/network/simple/Topology.cc b/src/mem/ruby/network/simple/Topology.cc
index f21129255..18618580a 100644
--- a/src/mem/ruby/network/simple/Topology.cc
+++ b/src/mem/ruby/network/simple/Topology.cc
@@ -26,7 +26,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "mem/gems_common/util.hh"
#include "mem/protocol/MachineType.hh"
#include "mem/protocol/Protocol.hh"
#include "mem/protocol/TopologyType.hh"
diff --git a/src/mem/ruby/profiler/Profiler.cc b/src/mem/ruby/profiler/Profiler.cc
index fc67f0052..aa23388ee 100644
--- a/src/mem/ruby/profiler/Profiler.cc
+++ b/src/mem/ruby/profiler/Profiler.cc
@@ -46,9 +46,9 @@
#include <sys/resource.h>
#include <sys/times.h>
+#include "base/str.hh"
#include "mem/gems_common/Map.hh"
#include "mem/gems_common/PrioHeap.hh"
-#include "mem/gems_common/util.hh"
#include "mem/protocol/CacheMsg.hh"
#include "mem/protocol/MachineType.hh"
#include "mem/protocol/Protocol.hh"
@@ -360,9 +360,12 @@ Profiler::printStats(ostream& out, bool short_stats)
int temp_int =
m_requestProfileMap_ptr->lookup(requestProfileKeys[i]);
double percent = (100.0 * double(temp_int)) / double(m_requests);
- while (requestProfileKeys[i] != "") {
- out << setw(10) << string_split(requestProfileKeys[i], ':');
- }
+ vector<string> items;
+ tokenize(items, requestProfileKeys[i], ':');
+ vector<string>::iterator i = items.begin();
+ vector<string>::iterator end = items.end();
+ for (; i != end; ++i)
+ out << setw(10) << *i;
out << setw(11) << temp_int;
out << setw(14) << percent << endl;
}
diff --git a/src/mem/ruby/system/CacheMemory.cc b/src/mem/ruby/system/CacheMemory.cc
index 1e188fb60..62aa1e25d 100644
--- a/src/mem/ruby/system/CacheMemory.cc
+++ b/src/mem/ruby/system/CacheMemory.cc
@@ -26,6 +26,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "base/intmath.hh"
#include "mem/ruby/system/CacheMemory.hh"
using namespace std;
@@ -60,7 +61,7 @@ CacheMemory::init()
m_cache_num_sets = (m_cache_size / m_cache_assoc) /
RubySystem::getBlockSizeBytes();
assert(m_cache_num_sets > 1);
- m_cache_num_set_bits = log_int(m_cache_num_sets);
+ m_cache_num_set_bits = floorLog2(m_cache_num_sets);
assert(m_cache_num_set_bits > 0);
if (m_policy == "PSEUDO_LRU")
diff --git a/src/mem/ruby/system/DirectoryMemory.cc b/src/mem/ruby/system/DirectoryMemory.cc
index b3999fb3f..65b61c935 100644
--- a/src/mem/ruby/system/DirectoryMemory.cc
+++ b/src/mem/ruby/system/DirectoryMemory.cc
@@ -26,7 +26,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "mem/gems_common/util.hh"
+#include "base/intmath.hh"
#include "mem/ruby/slicc_interface/RubySlicc_Util.hh"
#include "mem/ruby/system/DirectoryMemory.hh"
#include "mem/ruby/system/System.hh"
@@ -43,7 +43,7 @@ DirectoryMemory::DirectoryMemory(const Params *p)
{
m_version = p->version;
m_size_bytes = p->size;
- m_size_bits = log_int(m_size_bytes);
+ m_size_bits = floorLog2(m_size_bytes);
m_num_entries = 0;
m_use_map = p->use_map;
m_map_levels = p->map_levels;
@@ -56,7 +56,7 @@ DirectoryMemory::init()
m_num_entries = m_size_bytes / RubySystem::getBlockSizeBytes();
if (m_use_map) {
- int entry_bits = log_int(m_num_entries);
+ int entry_bits = floorLog2(m_num_entries);
assert(entry_bits >= m_map_levels);
m_sparseMemory = new SparseMemory(entry_bits, m_map_levels);
} else {
@@ -67,7 +67,7 @@ DirectoryMemory::init()
}
m_num_directories++;
- m_num_directories_bits = log_int(m_num_directories);
+ m_num_directories_bits = floorLog2(m_num_directories);
m_total_size_bytes += m_size_bytes;
if (m_numa_high_bit == 0) {
@@ -116,7 +116,7 @@ DirectoryMemory::printGlobalConfig(ostream & out)
<< endl;
}
out << " total memory size bytes: " << m_total_size_bytes << endl;
- out << " total memory bits: " << log_int(m_total_size_bytes) << endl;
+ out << " total memory bits: " << floorLog2(m_total_size_bytes) << endl;
}
uint64
diff --git a/src/mem/ruby/system/MachineID.hh b/src/mem/ruby/system/MachineID.hh
index 716196248..567d1f004 100644
--- a/src/mem/ruby/system/MachineID.hh
+++ b/src/mem/ruby/system/MachineID.hh
@@ -32,7 +32,7 @@
#include <iostream>
#include <string>
-#include "mem/gems_common/util.hh"
+#include "base/cprintf.hh"
#include "mem/protocol/MachineType.hh"
#include "mem/ruby/common/Global.hh"
@@ -45,7 +45,7 @@ struct MachineID
inline std::string
MachineIDToString(MachineID machine)
{
- return MachineType_to_string(machine.type)+"_"+int_to_string(machine.num);
+ return csprintf("%s_%d", MachineType_to_string(machine.type), machine.num);
}
inline bool
diff --git a/src/mem/ruby/system/MemoryControl.hh b/src/mem/ruby/system/MemoryControl.hh
index 73646f623..839fd007c 100644
--- a/src/mem/ruby/system/MemoryControl.hh
+++ b/src/mem/ruby/system/MemoryControl.hh
@@ -34,7 +34,6 @@
#include <string>
#include "mem/gems_common/Map.hh"
-#include "mem/gems_common/util.hh"
#include "mem/protocol/MemoryMsg.hh"
#include "mem/ruby/common/Address.hh"
#include "mem/ruby/common/Consumer.hh"
diff --git a/src/mem/ruby/system/NodeID.hh b/src/mem/ruby/system/NodeID.hh
index 4ce8d8a8d..ed3486aaf 100644
--- a/src/mem/ruby/system/NodeID.hh
+++ b/src/mem/ruby/system/NodeID.hh
@@ -31,7 +31,7 @@
#include <string>
-#include "mem/gems_common/util.hh"
+#include "base/str.hh"
#include "mem/ruby/common/Global.hh"
typedef int NodeID;
@@ -39,7 +39,7 @@ typedef int NodeID;
inline std::string
NodeIDToString(NodeID node)
{
- return int_to_string(node);
+ return to_string(node);
}
#endif // __MEM_RUBY_SYSTEM_NODEID_HH__
diff --git a/src/mem/ruby/system/PersistentTable.cc b/src/mem/ruby/system/PersistentTable.cc
index 64730ee29..a8e6b0323 100644
--- a/src/mem/ruby/system/PersistentTable.cc
+++ b/src/mem/ruby/system/PersistentTable.cc
@@ -26,7 +26,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "mem/gems_common/util.hh"
#include "mem/ruby/system/PersistentTable.hh"
using namespace std;
diff --git a/src/mem/ruby/system/Sequencer.cc b/src/mem/ruby/system/Sequencer.cc
index 42bf7ebb5..dd8cec967 100644
--- a/src/mem/ruby/system/Sequencer.cc
+++ b/src/mem/ruby/system/Sequencer.cc
@@ -26,6 +26,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "base/str.hh"
#include "cpu/rubytest/RubyTester.hh"
#include "mem/gems_common/Map.hh"
#include "mem/protocol/CacheMsg.hh"
diff --git a/src/mem/ruby/system/System.cc b/src/mem/ruby/system/System.cc
index 418b31bf0..d28d74a89 100644
--- a/src/mem/ruby/system/System.cc
+++ b/src/mem/ruby/system/System.cc
@@ -26,6 +26,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "base/intmath.hh"
#include "base/output.hh"
#include "mem/ruby/buffers/MessageBuffer.hh"
#include "mem/ruby/common/Address.hh"
@@ -63,14 +64,14 @@ RubySystem::RubySystem(const Params *p)
m_clock = p->clock;
m_block_size_bytes = p->block_size_bytes;
- assert(is_power_of_2(m_block_size_bytes));
- m_block_size_bits = log_int(m_block_size_bytes);
+ assert(isPowerOf2(m_block_size_bytes));
+ m_block_size_bits = floorLog2(m_block_size_bytes);
m_memory_size_bytes = p->mem_size;
if (m_memory_size_bytes == 0) {
m_memory_size_bits = 0;
} else {
- m_memory_size_bits = log_int(m_memory_size_bytes);
+ m_memory_size_bits = floorLog2(m_memory_size_bytes);
}
m_network_ptr = p->network;