* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "base/intmath.hh"
#include "cpu/rubytest/Check.hh"
#include "cpu/rubytest/CheckTable.hh"
#include "cpu/rubytest/CheckTable.hh"
void
CheckTable::addCheck(const Address& address)
{
- if (log_int(CHECK_SIZE) != 0) {
+ if (floorLog2(CHECK_SIZE) != 0) {
if (address.bitSelect(0, CHECK_SIZE_BITS - 1) != 0) {
ERROR_MSG("Check not aligned");
}
if not env['RUBY']:
Return()
-Source('util.cc')
-
TraceFlag('GemsCommon')
+++ /dev/null
-/*
- * Copyright (c) 1999-2005 Mark D. Hill and David A. Wood
- * 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.
- */
-
-/*
- * $Id$
- */
-
-#include <cassert>
-#include <iomanip>
-#include <sstream>
-
-#include "mem/gems_common/util.hh"
-
-using namespace std;
-
-// Split a string into a head and tail strings on the specified
-// character. Return the head and the string passed in is modified by
-// removing the head, leaving just the tail.
-
-string string_split(string& str, char split_character)
-{
- string head = "";
- string tail = "";
-
- unsigned counter = 0;
- while(counter < str.size()) {
- if (str[counter] == split_character) {
- counter++;
- break;
- } else {
- head += str[counter];
- }
- counter++;
- }
-
- while(counter < str.size()) {
- tail += str[counter];
- counter++;
- }
- str = tail;
- return head;
-}
-
-string bool_to_string(bool value)
-{
- if (value) {
- return "true";
- } else {
- return "false";
- }
-}
-
-string int_to_string(int n, bool zero_fill, int width)
-{
- ostringstream sstr;
- if(zero_fill) {
- sstr << setw(width) << setfill('0') << n;
- } else {
- sstr << n;
- }
- string str = sstr.str();
- return str;
-}
-
-float string_to_float(string& str)
-{
- stringstream sstr(str);
- float ret;
- sstr >> ret;
- return ret;
-}
-
-bool string_to_bool(const string & str)
-{
- string lower(str);
- for (size_t i=0;i<str.length();i++)
- lower[i] = tolower(str[i]);
- if (lower == "true")
- return true;
- else if (lower == "false")
- return false;
- else
- assert(0);
-
- return false;
-}
-
-// Log functions
-int log_int(long long n)
-{
- assert(n > 0);
- int counter = 0;
- while (n >= 2) {
- counter++;
- n = n>>(long long)(1);
- }
- return counter;
-}
-
-bool is_power_of_2(long long n)
-{
- return (n == ((long long)(1) << log_int(n)));
-}
-
+++ /dev/null
-/*
- * Copyright (c) 1999-2005 Mark D. Hill and David A. Wood
- * 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.
- */
-
-/*
- * $Id$
- */
-
-#ifndef UTIL_H
-#define UTIL_H
-
-#include <string>
-
-std::string string_split(std::string& str, char split_character);
-std::string bool_to_string(bool value);
-std::string int_to_string(int n, bool zero_fill = false, int width = 0);
-float string_to_float(std::string& str);
-bool string_to_bool(const std::string & str);
-int log_int(long long n);
-bool is_power_of_2(long long n);
-
-// Min and Max functions (since they are extern inline, they are as
-// fast as macros)
-
-extern inline
-int max(int n1, int n2)
-{
- if (n1 > n2) {
- return n1;
- } else {
- return n2;
- }
-}
-
-extern inline
-int min(int n1, int n2)
-{
- if (n1 < n2) {
- return n1;
- } else {
- return n2;
- }
-}
-
-#endif //UTIL_H
* 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"
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();
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);
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);
#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"
#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"
* 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"
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);
* 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"
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;
* 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"
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);
* 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"
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();
* 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"
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();
* 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"
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();
* 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"
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);
* 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"
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();
#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"
* 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"
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));
}
}
}
* 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"
#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"
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;
}
* 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;
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")
* 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"
{
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;
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 {
}
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) {
<< 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
#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"
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
#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"
#include <string>
-#include "mem/gems_common/util.hh"
+#include "base/str.hh"
#include "mem/ruby/common/Global.hh"
typedef int NodeID;
inline std::string
NodeIDToString(NodeID node)
{
- return int_to_string(node);
+ return to_string(node);
}
#endif // __MEM_RUBY_SYSTEM_NODEID_HH__
* 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;
* 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"
* 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"
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;
#include <sstream>
#include <string>
-#include "mem/ruby/common/Global.hh"
-#include "mem/ruby/slicc_interface/RubySlicc_includes.hh"
+#include "base/cprintf.hh"
#include "mem/protocol/${ident}_Controller.hh"
#include "mem/protocol/${ident}_State.hh"
#include "mem/protocol/${ident}_Event.hh"
#include "mem/protocol/Types.hh"
+#include "mem/ruby/common/Global.hh"
+#include "mem/ruby/slicc_interface/RubySlicc_includes.hh"
#include "mem/ruby/system/System.hh"
using namespace std;
# set description (may be overriden later by port def)
code('''
-$vid->setDescription("[Version " + int_to_string(m_version) + ", ${ident}, name=${{var.c_ident}}]");
+$vid->setDescription("[Version " + to_string(m_version) + ", ${ident}, name=${{var.c_ident}}]");
''')
# Set the queue descriptions
code.insert_newline()
for port in self.in_ports:
- code('${{port.code}}.setDescription("[Version " + int_to_string(m_version) + ", $ident, $port]");')
+ code('${{port.code}}.setDescription("[Version " + to_string(m_version) + ", $ident, $port]");')
# Initialize the transition profiling
code.insert_newline()