ruby: get rid of std-includes.hh

Do not use "using namespace std;" in headers
Include header files as needed
This commit is contained in:
Nathan Binkert 2010-03-10 18:33:11 -08:00
parent 1badec39a9
commit 140785d24c
45 changed files with 312 additions and 239 deletions

View file

@ -31,6 +31,8 @@
#ifndef CHECKTABLE_H #ifndef CHECKTABLE_H
#define CHECKTABLE_H #define CHECKTABLE_H
#include <iostream>
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Vector.hh" #include "mem/gems_common/Vector.hh"
@ -57,7 +59,7 @@ public:
// bool isTableFull() const; // bool isTableFull() const;
// Need a method to select a check or retrieve a check // Need a method to select a check or retrieve a check
void print(ostream& out) const; void print(std::ostream& out) const;
private: private:
// Private Methods // Private Methods
void addCheck(const Address& address); void addCheck(const Address& address);
@ -75,16 +77,16 @@ private:
}; };
// Output operator declaration // Output operator declaration
ostream& operator<<(ostream& out, const CheckTable& obj); std::ostream& operator<<(std::ostream& out, const CheckTable& obj);
// ******************* Definitions ******************* // ******************* Definitions *******************
// Output operator definition // Output operator definition
extern inline extern inline
ostream& operator<<(ostream& out, const CheckTable& obj) std::ostream& operator<<(std::ostream& out, const CheckTable& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -34,12 +34,19 @@
#ifndef MAP_H #ifndef MAP_H
#define MAP_H #define MAP_H
#include <iostream>
#include "base/hashmap.hh" #include "base/hashmap.hh"
#include "mem/gems_common/Vector.hh" #include "mem/gems_common/Vector.hh"
template <class KEY_TYPE, class VALUE_TYPE> template <class KEY_TYPE, class VALUE_TYPE>
class Map class Map
{ {
private:
typedef typename m5::hash_map<KEY_TYPE, VALUE_TYPE> MapType;
typedef typename MapType::iterator iterator;
typedef typename MapType::const_iterator const_iterator;
public: public:
Map() { /* empty */ } Map() { /* empty */ }
~Map() { /* empty */ } ~Map() { /* empty */ }
@ -54,7 +61,7 @@ public:
void deleteValues(); void deleteValues();
VALUE_TYPE& lookup(const KEY_TYPE& key) const; VALUE_TYPE& lookup(const KEY_TYPE& key) const;
void clear() { m_map.clear(); } void clear() { m_map.clear(); }
void print(ostream& out) const; void print(std::ostream& out) const;
// Synonyms // Synonyms
void remove(const KEY_TYPE& key) { erase(key); } void remove(const KEY_TYPE& key) { erase(key); }
@ -73,7 +80,8 @@ private:
}; };
template <class KEY_TYPE, class VALUE_TYPE> template <class KEY_TYPE, class VALUE_TYPE>
ostream& operator<<(ostream& out, const Map<KEY_TYPE, VALUE_TYPE>& map); std::ostream&
operator<<(std::ostream& out, const Map<KEY_TYPE, VALUE_TYPE>& map);
// ********************* // *********************
@ -94,7 +102,7 @@ template <class KEY_TYPE, class VALUE_TYPE>
VALUE_TYPE& Map<KEY_TYPE, VALUE_TYPE>::lookup(const KEY_TYPE& key) const VALUE_TYPE& Map<KEY_TYPE, VALUE_TYPE>::lookup(const KEY_TYPE& key) const
{ {
if (!exist(key)) if (!exist(key))
cerr << *this << " is looking for " << key << endl; std::cerr << *this << " is looking for " << key << std::endl;
assert(exist(key)); assert(exist(key));
return m_map[key]; return m_map[key];
} }
@ -103,7 +111,7 @@ template <class KEY_TYPE, class VALUE_TYPE>
Vector<KEY_TYPE> Map<KEY_TYPE, VALUE_TYPE>::keys() const Vector<KEY_TYPE> Map<KEY_TYPE, VALUE_TYPE>::keys() const
{ {
Vector<KEY_TYPE> keys; Vector<KEY_TYPE> keys;
typename hash_map<KEY_TYPE, VALUE_TYPE>::const_iterator iter; const_iterator iter;
for (iter = m_map.begin(); iter != m_map.end(); iter++) { for (iter = m_map.begin(); iter != m_map.end(); iter++) {
keys.insertAtBottom((*iter).first); keys.insertAtBottom((*iter).first);
} }
@ -114,8 +122,8 @@ template <class KEY_TYPE, class VALUE_TYPE>
Vector<VALUE_TYPE> Map<KEY_TYPE, VALUE_TYPE>::values() const Vector<VALUE_TYPE> Map<KEY_TYPE, VALUE_TYPE>::values() const
{ {
Vector<VALUE_TYPE> values; Vector<VALUE_TYPE> values;
typename hash_map<KEY_TYPE, VALUE_TYPE>::const_iterator iter; const_iterator iter;
pair<KEY_TYPE, VALUE_TYPE> p; std::pair<KEY_TYPE, VALUE_TYPE> p;
for (iter = m_map.begin(); iter != m_map.end(); iter++) { for (iter = m_map.begin(); iter != m_map.end(); iter++) {
p = *iter; p = *iter;
@ -127,8 +135,8 @@ Vector<VALUE_TYPE> Map<KEY_TYPE, VALUE_TYPE>::values() const
template <class KEY_TYPE, class VALUE_TYPE> template <class KEY_TYPE, class VALUE_TYPE>
void Map<KEY_TYPE, VALUE_TYPE>::deleteKeys() void Map<KEY_TYPE, VALUE_TYPE>::deleteKeys()
{ {
typename hash_map<KEY_TYPE, VALUE_TYPE>::const_iterator iter; const_iterator iter;
pair<KEY_TYPE, VALUE_TYPE> p; std::pair<KEY_TYPE, VALUE_TYPE> p;
for (iter = m_map.begin(); iter != m_map.end(); iter++) { for (iter = m_map.begin(); iter != m_map.end(); iter++) {
p = *iter; p = *iter;
@ -139,8 +147,8 @@ void Map<KEY_TYPE, VALUE_TYPE>::deleteKeys()
template <class KEY_TYPE, class VALUE_TYPE> template <class KEY_TYPE, class VALUE_TYPE>
void Map<KEY_TYPE, VALUE_TYPE>::deleteValues() void Map<KEY_TYPE, VALUE_TYPE>::deleteValues()
{ {
typename hash_map<KEY_TYPE, VALUE_TYPE>::const_iterator iter; const_iterator iter;
pair<KEY_TYPE, VALUE_TYPE> p; std::pair<KEY_TYPE, VALUE_TYPE> p;
for (iter = m_map.begin(); iter != m_map.end(); iter++) { for (iter = m_map.begin(); iter != m_map.end(); iter++) {
p = *iter; p = *iter;
@ -149,10 +157,10 @@ void Map<KEY_TYPE, VALUE_TYPE>::deleteValues()
} }
template <class KEY_TYPE, class VALUE_TYPE> template <class KEY_TYPE, class VALUE_TYPE>
void Map<KEY_TYPE, VALUE_TYPE>::print(ostream& out) const void Map<KEY_TYPE, VALUE_TYPE>::print(std::ostream& out) const
{ {
typename hash_map<KEY_TYPE, VALUE_TYPE>::const_iterator iter; const_iterator iter;
pair<KEY_TYPE, VALUE_TYPE> p; std::pair<KEY_TYPE, VALUE_TYPE> p;
out << "["; out << "[";
for (iter = m_map.begin(); iter != m_map.end(); iter++) { for (iter = m_map.begin(); iter != m_map.end(); iter++) {
@ -164,7 +172,8 @@ void Map<KEY_TYPE, VALUE_TYPE>::print(ostream& out) const
} }
template <class KEY_TYPE, class VALUE_TYPE> template <class KEY_TYPE, class VALUE_TYPE>
ostream& operator<<(ostream& out, const Map<KEY_TYPE, VALUE_TYPE>& map) std::ostream&
operator<<(std::ostream& out, const Map<KEY_TYPE, VALUE_TYPE>& map)
{ {
map.print(out); map.print(out);
return out; return out;

View file

@ -29,6 +29,8 @@
#ifndef PRIOHEAP_H #ifndef PRIOHEAP_H
#define PRIOHEAP_H #define PRIOHEAP_H
#include <iostream>
#include "mem/gems_common/Vector.hh" #include "mem/gems_common/Vector.hh"
typedef unsigned int HeapIndex; typedef unsigned int HeapIndex;
@ -49,7 +51,7 @@ public:
const TYPE& peekMin() const; const TYPE& peekMin() const;
const TYPE& peekElement(int index) const; const TYPE& peekElement(int index) const;
TYPE extractMin(); TYPE extractMin();
void print(ostream& out) const; void print(std::ostream& out) const;
private: private:
// Private Methods // Private Methods
bool verifyHeap() const; bool verifyHeap() const;
@ -67,7 +69,7 @@ private:
// Output operator declaration // Output operator declaration
template <class TYPE> template <class TYPE>
ostream& operator<<(ostream& out, const PrioHeap<TYPE>& obj); std::ostream& operator<<(std::ostream& out, const PrioHeap<TYPE>& obj);
// ******************* Helper Functions ******************* // ******************* Helper Functions *******************
inline inline
@ -210,7 +212,7 @@ void PrioHeap<TYPE>::heapify()
} }
template <class TYPE> template <class TYPE>
void PrioHeap<TYPE>::print(ostream& out) const void PrioHeap<TYPE>::print(std::ostream& out) const
{ {
Vector<TYPE> copyHeap(m_heap); Vector<TYPE> copyHeap(m_heap);
@ -239,10 +241,10 @@ void PrioHeap<TYPE>::print(ostream& out) const
// Output operator definition // Output operator definition
template <class TYPE> template <class TYPE>
ostream& operator<<(ostream& out, const PrioHeap<TYPE>& obj) std::ostream& operator<<(std::ostream& out, const PrioHeap<TYPE>& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -29,6 +29,8 @@
#ifndef REFCNT_H #ifndef REFCNT_H
#define REFCNT_H #define REFCNT_H
#include <iostream>
template <class TYPE> template <class TYPE>
class RefCnt { class RefCnt {
public: public:
@ -44,7 +46,7 @@ public:
TYPE* ref() { return m_data_ptr; } TYPE* ref() { return m_data_ptr; }
TYPE* mod_ref() const { return m_data_ptr; } TYPE* mod_ref() const { return m_data_ptr; }
void freeRef(); void freeRef();
void print(ostream& out) const; void print(std::ostream& out) const;
// Public copy constructor and assignment operator // Public copy constructor and assignment operator
RefCnt(const RefCnt& obj); RefCnt(const RefCnt& obj);
@ -61,7 +63,7 @@ private:
// Output operator declaration // Output operator declaration
template <class TYPE> template <class TYPE>
inline inline
ostream& operator<<(ostream& out, const RefCnt<TYPE>& obj); std::ostream& operator<<(std::ostream& out, const RefCnt<TYPE>& obj);
// ******************* Definitions ******************* // ******************* Definitions *******************
@ -103,7 +105,7 @@ void RefCnt<TYPE>::freeRef()
template <class TYPE> template <class TYPE>
inline inline
void RefCnt<TYPE>::print(ostream& out) const void RefCnt<TYPE>::print(std::ostream& out) const
{ {
if (m_data_ptr == NULL) { if (m_data_ptr == NULL) {
out << "[RefCnt: Null]"; out << "[RefCnt: Null]";
@ -150,10 +152,10 @@ RefCnt<TYPE>& RefCnt<TYPE>::operator=(const RefCnt<TYPE>& obj)
// Output operator definition // Output operator definition
template <class TYPE> template <class TYPE>
inline inline
ostream& operator<<(ostream& out, const RefCnt<TYPE>& obj) std::ostream& operator<<(std::ostream& out, const RefCnt<TYPE>& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -38,7 +38,9 @@
#ifndef VECTOR_H #ifndef VECTOR_H
#define VECTOR_H #define VECTOR_H
#include "mem/gems_common/std-includes.hh" #include <cassert>
#include <iostream>
#include <vector>
template <class TYPE> template <class TYPE>
class Vector class Vector
@ -63,7 +65,7 @@ public:
// elements and sets them to NULL, can only // elements and sets them to NULL, can only
// be used when the TYPE is a pointer type. // be used when the TYPE is a pointer type.
void removeFromTop(int num); // removes elements from top void removeFromTop(int num); // removes elements from top
void print(ostream& out) const; void print(std::ostream& out) const;
// Array Reference operator overloading // Array Reference operator overloading
@ -84,7 +86,7 @@ private:
}; };
template <class TYPE> template <class TYPE>
ostream& operator<<(ostream& out, const Vector<TYPE>& vec); std::ostream& operator<<(std::ostream& out, const Vector<TYPE>& vec);
// ********************* // *********************
@ -139,7 +141,7 @@ void Vector<TYPE>::setSize(int new_size)
{ {
// FIXME - this should also decrease or shrink the size of the array at some point. // FIXME - this should also decrease or shrink the size of the array at some point.
if (new_size > m_max_size) { if (new_size > m_max_size) {
grow(max((m_max_size+1)*2, new_size)); grow(std::max((m_max_size+1)*2, new_size));
} }
m_size = new_size; m_size = new_size;
#ifndef NO_VECTOR_BOUNDS_CHECKS #ifndef NO_VECTOR_BOUNDS_CHECKS
@ -154,7 +156,7 @@ void Vector<TYPE>::increaseSize(int new_size, const TYPE& reset)
{ {
assert(new_size >= m_size); assert(new_size >= m_size);
if (new_size >= m_max_size) { if (new_size >= m_max_size) {
grow(max((m_max_size+1)*2, new_size)); grow(std::max((m_max_size+1)*2, new_size));
} }
int old_size = m_size; int old_size = m_size;
m_size = new_size; m_size = new_size;
@ -243,7 +245,7 @@ void Vector<TYPE>::deletePointers()
} }
template <class TYPE> template <class TYPE>
void Vector<TYPE>::print(ostream& out) const void Vector<TYPE>::print(std::ostream& out) const
{ {
out << "[ "; out << "[ ";
for(int i=0; i<m_size; i++) { for(int i=0; i<m_size; i++) {
@ -253,7 +255,7 @@ void Vector<TYPE>::print(ostream& out) const
out << ref(i); out << ref(i);
} }
out << " ]"; out << " ]";
out << flush; out << std::flush;
} }
// Copy constructor // Copy constructor
@ -325,7 +327,7 @@ void Vector<TYPE>::grow(int new_max_size)
} }
template <class TYPE> template <class TYPE>
ostream& operator<<(ostream& out, const Vector<TYPE>& vec) std::ostream& operator<<(std::ostream& out, const Vector<TYPE>& vec)
{ {
vec.print(out); vec.print(out);
return out; return out;

View file

@ -1,57 +0,0 @@
/*
* 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: std-includes.hh,v 3.7 2003/02/24 21:05:24 xu Exp $
*/
#ifndef INCLUDES_H
#define INCLUDES_H
#include <cstring>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <ext/hash_map>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <cassert>
using namespace std;
using namespace __gnu_cxx;
typedef unsigned int uint;
#endif //INCLUDES_H

View file

@ -31,9 +31,13 @@
*/ */
#include <cassert> #include <cassert>
#include <iomanip>
#include <sstream>
#include "mem/gems_common/util.hh" #include "mem/gems_common/util.hh"
using namespace std;
// Split a string into a head and tail strings on the specified // Split a string into a head and tail strings on the specified
// character. Return the head and the string passed in is modified by // character. Return the head and the string passed in is modified by
// removing the head, leaving just the tail. // removing the head, leaving just the tail.
@ -43,7 +47,7 @@ string string_split(string& str, char split_character)
string head = ""; string head = "";
string tail = ""; string tail = "";
uint counter = 0; unsigned counter = 0;
while(counter < str.size()) { while(counter < str.size()) {
if (str[counter] == split_character) { if (str[counter] == split_character) {
counter++; counter++;

View file

@ -33,13 +33,13 @@
#ifndef UTIL_H #ifndef UTIL_H
#define UTIL_H #define UTIL_H
#include "mem/gems_common/std-includes.hh" #include <string>
string string_split(string& str, char split_character); std::string string_split(std::string& str, char split_character);
string bool_to_string(bool value); std::string bool_to_string(bool value);
string int_to_string(int n, bool zero_fill = false, int width = 0); std::string int_to_string(int n, bool zero_fill = false, int width = 0);
float string_to_float(string& str); float string_to_float(std::string& str);
bool string_to_bool(const string & str); bool string_to_bool(const std::string & str);
int log_int(long long n); int log_int(long long n);
bool is_power_of_2(long long n); bool is_power_of_2(long long n);

View file

@ -38,6 +38,9 @@
#ifndef MESSAGEBUFFER_H #ifndef MESSAGEBUFFER_H
#define MESSAGEBUFFER_H #define MESSAGEBUFFER_H
#include <iostream>
#include <string>
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "mem/ruby/buffers/MessageBufferNode.hh" #include "mem/ruby/buffers/MessageBufferNode.hh"
#include "mem/ruby/common/Consumer.hh" #include "mem/ruby/common/Consumer.hh"
@ -49,13 +52,13 @@
class MessageBuffer { class MessageBuffer {
public: public:
// Constructors // Constructors
MessageBuffer(const string &name = ""); MessageBuffer(const std::string &name = "");
// ~MessageBuffer() // ~MessageBuffer()
// Public Methods // Public Methods
static void printConfig(ostream& out) {} static void printConfig(std::ostream& out) {}
void setRecycleLatency(int recycle_latency) { m_recycle_latency = recycle_latency; } void setRecycleLatency(int recycle_latency) { m_recycle_latency = recycle_latency; }
// TRUE if head of queue timestamp <= SystemTime // TRUE if head of queue timestamp <= SystemTime
@ -73,8 +76,8 @@ public:
int getPriority() { return m_priority_rank; } int getPriority() { return m_priority_rank; }
void setPriority(int rank) { m_priority_rank = rank; } void setPriority(int rank) { m_priority_rank = rank; }
void setConsumer(Consumer* consumer_ptr) { ASSERT(m_consumer_ptr==NULL); m_consumer_ptr = consumer_ptr; } void setConsumer(Consumer* consumer_ptr) { ASSERT(m_consumer_ptr==NULL); m_consumer_ptr = consumer_ptr; }
void setDescription(const string& name) { m_name = name; } void setDescription(const std::string& name) { m_name = name; }
string getDescription() { return m_name;} std::string getDescription() { return m_name;}
Consumer* getConsumer() { return m_consumer_ptr; } Consumer* getConsumer() { return m_consumer_ptr; }
@ -102,8 +105,8 @@ public:
void clear(); void clear();
void print(ostream& out) const; void print(std::ostream& out) const;
void printStats(ostream& out); void printStats(std::ostream& out);
void clearStats() { m_not_avail_count = 0; m_msg_counter = 0; } void clearStats() { m_not_avail_count = 0; m_msg_counter = 0; }
private: private:
@ -120,7 +123,7 @@ private:
// Data Members (m_ prefix) // Data Members (m_ prefix)
Consumer* m_consumer_ptr; // Consumer to signal a wakeup(), can be NULL Consumer* m_consumer_ptr; // Consumer to signal a wakeup(), can be NULL
PrioHeap<MessageBufferNode> m_prio_heap; PrioHeap<MessageBufferNode> m_prio_heap;
string m_name; std::string m_name;
int m_max_size; int m_max_size;
int m_size; int m_size;
@ -145,16 +148,16 @@ private:
// Output operator declaration // Output operator declaration
//template <class TYPE> //template <class TYPE>
ostream& operator<<(ostream& out, const MessageBuffer& obj); std::ostream& operator<<(std::ostream& out, const MessageBuffer& obj);
// ******************* Definitions ******************* // ******************* Definitions *******************
// Output operator definition // Output operator definition
extern inline extern inline
ostream& operator<<(ostream& out, const MessageBuffer& obj) std::ostream& operator<<(std::ostream& out, const MessageBuffer& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -29,7 +29,8 @@
#include "mem/ruby/buffers/MessageBufferNode.hh" #include "mem/ruby/buffers/MessageBufferNode.hh"
void MessageBufferNode::print(ostream& out) const void
MessageBufferNode::print(std::ostream& out) const
{ {
out << "["; out << "[";
out << m_time << ", "; out << m_time << ", ";

View file

@ -30,6 +30,8 @@
#ifndef MESSAGEBUFFERNODE_H #ifndef MESSAGEBUFFERNODE_H
#define MESSAGEBUFFERNODE_H #define MESSAGEBUFFERNODE_H
#include <iostream>
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "mem/ruby/slicc_interface/Message.hh" #include "mem/ruby/slicc_interface/Message.hh"
@ -43,7 +45,7 @@ public:
//~MessageBufferNode(); //~MessageBufferNode();
// Public Methods // Public Methods
void print(ostream& out) const; void print(std::ostream& out) const;
private: private:
// Private Methods // Private Methods
@ -59,7 +61,7 @@ public:
}; };
// Output operator declaration // Output operator declaration
ostream& operator<<(ostream& out, const MessageBufferNode& obj); std::ostream& operator<<(std::ostream& out, const MessageBufferNode& obj);
// ******************* Definitions ******************* // ******************* Definitions *******************
@ -78,10 +80,10 @@ bool node_less_then_eq(const MessageBufferNode& n1, const MessageBufferNode& n2)
// Output operator definition // Output operator definition
extern inline extern inline
ostream& operator<<(ostream& out, const MessageBufferNode& obj) std::ostream& operator<<(std::ostream& out, const MessageBufferNode& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -35,6 +35,8 @@
#define ADDRESS_H #define ADDRESS_H
#include <iomanip> #include <iomanip>
#include "base/hashmap.hh"
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "mem/ruby/system/System.hh" #include "mem/ruby/system/System.hh"
#include "mem/ruby/system/NodeID.hh" #include "mem/ruby/system/NodeID.hh"
@ -223,11 +225,12 @@ ADDRESS_WIDTH MEMORY_SIZE_BITS PAGE_SIZE_BITS DATA_BLOCK_BITS
inline inline
void Address::print(ostream& out) const void Address::print(ostream& out) const
{ {
out << "[" << hex << "0x" << m_address << "," << " line 0x" << maskLowOrderBits(RubySystem::getBlockSizeBits()) << dec << "]" << flush; using namespace std;
out << "[" << hex << "0x" << m_address << "," << " line 0x" << maskLowOrderBits(RubySystem::getBlockSizeBits()) << dec << "]" << flush;
} }
class Address; class Address;
namespace __gnu_cxx { namespace __hash_namespace {
template <> struct hash<Address> template <> struct hash<Address>
{ {
size_t operator()(const Address &s) const { return (size_t) s.getAddress(); } size_t operator()(const Address &s) const { return (size_t) s.getAddress(); }

View file

@ -39,6 +39,8 @@
#ifndef CONSUMER_H #ifndef CONSUMER_H
#define CONSUMER_H #define CONSUMER_H
#include <iostream>
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "mem/ruby/eventqueue/RubyEventQueue.hh" #include "mem/ruby/eventqueue/RubyEventQueue.hh"
@ -56,7 +58,7 @@ public:
// void triggerWakeup() { Time time = g_eventQueue_ptr->getTime(); if (m_last_wakeup != time) { wakeup(); m_last_wakeup = time; }} // void triggerWakeup() { Time time = g_eventQueue_ptr->getTime(); if (m_last_wakeup != time) { wakeup(); m_last_wakeup = time; }}
void triggerWakeup(RubyEventQueue * eventQueue) { Time time = eventQueue->getTime(); if (m_last_wakeup != time) { wakeup(); m_last_wakeup = time; }} void triggerWakeup(RubyEventQueue * eventQueue) { Time time = eventQueue->getTime(); if (m_last_wakeup != time) { wakeup(); m_last_wakeup = time; }}
virtual void wakeup() = 0; virtual void wakeup() = 0;
virtual void print(ostream& out) const = 0; virtual void print(std::ostream& out) const = 0;
const Time& getLastScheduledWakeup() const { return m_last_scheduled_wakeup; } const Time& getLastScheduledWakeup() const { return m_last_scheduled_wakeup; }
void setLastScheduledWakeup(const Time& time) { m_last_scheduled_wakeup = time; } void setLastScheduledWakeup(const Time& time) { m_last_scheduled_wakeup = time; }
@ -70,16 +72,16 @@ private:
// Output operator declaration // Output operator declaration
inline extern inline extern
ostream& operator<<(ostream& out, const Consumer& obj); std::ostream& operator<<(std::ostream& out, const Consumer& obj);
// ******************* Definitions ******************* // ******************* Definitions *******************
// Output operator definition // Output operator definition
inline extern inline extern
ostream& operator<<(ostream& out, const Consumer& obj) std::ostream& operator<<(std::ostream& out, const Consumer& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -30,6 +30,9 @@
#ifndef DATABLOCK_H #ifndef DATABLOCK_H
#define DATABLOCK_H #define DATABLOCK_H
#include <iomanip>
#include <iostream>
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "mem/ruby/system/System.hh" #include "mem/ruby/system/System.hh"
#include "mem/gems_common/Vector.hh" #include "mem/gems_common/Vector.hh"
@ -63,7 +66,7 @@ class DataBlock {
void setData(uint8* data, int offset, int len); void setData(uint8* data, int offset, int len);
void copyPartial(const DataBlock & dblk, int offset, int len); void copyPartial(const DataBlock & dblk, int offset, int len);
bool equal(const DataBlock& obj) const; bool equal(const DataBlock& obj) const;
void print(ostream& out) const; void print(std::ostream& out) const;
private: private:
void alloc(); void alloc();
@ -73,7 +76,7 @@ private:
}; };
// Output operator declaration // Output operator declaration
ostream& operator<<(ostream& out, const DataBlock& obj); std::ostream& operator<<(std::ostream& out, const DataBlock& obj);
bool operator==(const DataBlock& obj1, const DataBlock& obj2); bool operator==(const DataBlock& obj1, const DataBlock& obj2);
@ -110,8 +113,10 @@ bool DataBlock::equal(const DataBlock& obj) const
} }
inline inline
void DataBlock::print(ostream& out) const void DataBlock::print(std::ostream& out) const
{ {
using namespace std;
int size = RubySystem::getBlockSizeBytes(); int size = RubySystem::getBlockSizeBytes();
out << "[ "; out << "[ ";
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
@ -157,10 +162,10 @@ void DataBlock::copyPartial(const DataBlock & dblk, int offset, int len)
// Output operator definition // Output operator definition
extern inline extern inline
ostream& operator<<(ostream& out, const DataBlock& obj) std::ostream& operator<<(std::ostream& out, const DataBlock& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -41,9 +41,11 @@
#include "mem/gems_common/util.hh" #include "mem/gems_common/util.hh"
#include "base/misc.hh" #include "base/misc.hh"
using namespace std;
class Debug; class Debug;
extern Debug* g_debug_ptr; extern Debug* g_debug_ptr;
std::ostream * debug_cout_ptr; ostream *debug_cout_ptr;
bool Debug::m_protocol_trace = false; bool Debug::m_protocol_trace = false;
struct DebugComponentData struct DebugComponentData
@ -328,7 +330,7 @@ void Debug::setDebugOutputFile (const char * filename)
if (m_fout.is_open() ) { if (m_fout.is_open() ) {
m_fout.close (); m_fout.close ();
} }
m_fout.open (filename, std::ios::out); m_fout.open (filename, ios::out);
if (! m_fout.is_open() ) { if (! m_fout.is_open() ) {
cerr << "setDebugOutputFile: can't open file " << filename << endl; cerr << "setDebugOutputFile: can't open file " << filename << endl;
} }

View file

@ -35,6 +35,8 @@
#define __MEM_RUBY_DEBUG_HH__ #define __MEM_RUBY_DEBUG_HH__
#include <unistd.h> #include <unistd.h>
#include <fstream>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <vector> #include <vector>
@ -133,7 +135,7 @@ extern inline
std::ostream& operator<<(std::ostream& out, const Debug& obj) std::ostream& operator<<(std::ostream& out, const Debug& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }
@ -151,6 +153,7 @@ const bool ASSERT_FLAG = true;
#undef ASSERT #undef ASSERT
#define ASSERT(EXPR)\ #define ASSERT(EXPR)\
{\ {\
using namespace std;\
if (ASSERT_FLAG) {\ if (ASSERT_FLAG) {\
if (!(EXPR)) {\ if (!(EXPR)) {\
cerr << "failed assertion '"\ cerr << "failed assertion '"\
@ -179,6 +182,7 @@ const bool ASSERT_FLAG = true;
#define BREAK(X)\ #define BREAK(X)\
{\ {\
using namespace std;\
cerr << "breakpoint '"\ cerr << "breakpoint '"\
<< #X << "' reached at fn "\ << #X << "' reached at fn "\
<< __PRETTY_FUNCTION__ << " in "\ << __PRETTY_FUNCTION__ << " in "\
@ -195,6 +199,7 @@ const bool ASSERT_FLAG = true;
#define ERROR_MSG(MESSAGE)\ #define ERROR_MSG(MESSAGE)\
{\ {\
using namespace std;\
if (ERROR_MESSAGE_FLAG) {\ if (ERROR_MESSAGE_FLAG) {\
cerr << "Fatal Error: in fn "\ cerr << "Fatal Error: in fn "\
<< __PRETTY_FUNCTION__ << " in "\ << __PRETTY_FUNCTION__ << " in "\
@ -212,6 +217,7 @@ const bool ASSERT_FLAG = true;
#define WARN_MSG(MESSAGE)\ #define WARN_MSG(MESSAGE)\
{\ {\
using namespace std;\
if (WARNING_MESSAGE_FLAG) {\ if (WARNING_MESSAGE_FLAG) {\
cerr << "Warning: in fn "\ cerr << "Warning: in fn "\
<< __PRETTY_FUNCTION__ << " in "\ << __PRETTY_FUNCTION__ << " in "\
@ -228,6 +234,7 @@ const bool ASSERT_FLAG = true;
#define WARN_EXPR(EXPR)\ #define WARN_EXPR(EXPR)\
{\ {\
using namespace std;\
if (WARNING_MESSAGE_FLAG) {\ if (WARNING_MESSAGE_FLAG) {\
cerr << "Warning: in fn "\ cerr << "Warning: in fn "\
<< __PRETTY_FUNCTION__ << " in "\ << __PRETTY_FUNCTION__ << " in "\
@ -246,6 +253,7 @@ const bool ASSERT_FLAG = true;
#define DEBUG_MSG(module, priority, MESSAGE)\ #define DEBUG_MSG(module, priority, MESSAGE)\
{\ {\
using namespace std;\
if (RUBY_DEBUG) {\ if (RUBY_DEBUG) {\
if (g_debug_ptr->validDebug(module, priority)) {\ if (g_debug_ptr->validDebug(module, priority)) {\
(* debug_cout_ptr) << "Debug: in fn "\ (* debug_cout_ptr) << "Debug: in fn "\
@ -259,6 +267,7 @@ const bool ASSERT_FLAG = true;
#define DEBUG_EXPR(module, priority, EXPR)\ #define DEBUG_EXPR(module, priority, EXPR)\
{\ {\
using namespace std;\
if (RUBY_DEBUG) {\ if (RUBY_DEBUG) {\
if (g_debug_ptr->validDebug(module, priority)) {\ if (g_debug_ptr->validDebug(module, priority)) {\
(* debug_cout_ptr) << "Debug: in fn "\ (* debug_cout_ptr) << "Debug: in fn "\
@ -273,6 +282,7 @@ const bool ASSERT_FLAG = true;
#define DEBUG_NEWLINE(module, priority)\ #define DEBUG_NEWLINE(module, priority)\
{\ {\
using namespace std;\
if (RUBY_DEBUG) {\ if (RUBY_DEBUG) {\
if (g_debug_ptr->validDebug(module, priority)) {\ if (g_debug_ptr->validDebug(module, priority)) {\
(* debug_cout_ptr) << endl << flush;\ (* debug_cout_ptr) << endl << flush;\
@ -282,6 +292,7 @@ const bool ASSERT_FLAG = true;
#define DEBUG_SLICC(priority, LINE, MESSAGE)\ #define DEBUG_SLICC(priority, LINE, MESSAGE)\
{\ {\
using namespace std;\
if (RUBY_DEBUG) {\ if (RUBY_DEBUG) {\
if (g_debug_ptr->validDebug(SLICC_COMP, priority)) {\ if (g_debug_ptr->validDebug(SLICC_COMP, priority)) {\
(* debug_cout_ptr) << (LINE) << (MESSAGE) << endl << flush;\ (* debug_cout_ptr) << (LINE) << (MESSAGE) << endl << flush;\
@ -291,6 +302,7 @@ const bool ASSERT_FLAG = true;
#define DEBUG_OUT( rest... ) \ #define DEBUG_OUT( rest... ) \
{\ {\
using namespace std;\
if (RUBY_DEBUG) {\ if (RUBY_DEBUG) {\
cout << "Debug: in fn "\ cout << "Debug: in fn "\
<< __PRETTY_FUNCTION__\ << __PRETTY_FUNCTION__\
@ -302,6 +314,7 @@ const bool ASSERT_FLAG = true;
#define ERROR_OUT( rest... ) \ #define ERROR_OUT( rest... ) \
{\ {\
using namespace std;\
if (ERROR_MESSAGE_FLAG) {\ if (ERROR_MESSAGE_FLAG) {\
cout << "error: in fn "\ cout << "error: in fn "\
<< __PRETTY_FUNCTION__ << " in "\ << __PRETTY_FUNCTION__ << " in "\

View file

@ -66,7 +66,6 @@ const bool TWO_LEVEL_CACHE = true;
// external includes for all classes // external includes for all classes
#include "mem/ruby/common/TypeDefines.hh" #include "mem/ruby/common/TypeDefines.hh"
#include "mem/gems_common/std-includes.hh"
#include "mem/ruby/common/Debug.hh" #include "mem/ruby/common/Debug.hh"
// simple type declarations // simple type declarations

View file

@ -32,8 +32,13 @@
* *
*/ */
#include <cmath>
#include <iomanip>
#include "mem/ruby/common/Histogram.hh" #include "mem/ruby/common/Histogram.hh"
using namespace std;
Histogram::Histogram(int binsize, int bins) Histogram::Histogram(int binsize, int bins)
{ {
m_binsize = binsize; m_binsize = binsize;

View file

@ -37,6 +37,8 @@
#ifndef HISTOGRAM_H #ifndef HISTOGRAM_H
#define HISTOGRAM_H #define HISTOGRAM_H
#include <iostream>
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Vector.hh" #include "mem/gems_common/Vector.hh"
@ -61,9 +63,9 @@ public:
int64 getTotal() const { return m_sumSamples; } int64 getTotal() const { return m_sumSamples; }
int64 getData(int index) const { return m_data[index]; } int64 getData(int index) const { return m_data[index]; }
void printWithMultiplier(ostream& out, double multiplier) const; void printWithMultiplier(std::ostream& out, double multiplier) const;
void printPercent(ostream& out) const; void printPercent(std::ostream& out) const;
void print(ostream& out) const; void print(std::ostream& out) const;
private: private:
// Private Methods // Private Methods
@ -88,16 +90,16 @@ private:
bool node_less_then_eq(const Histogram* n1, const Histogram* n2); bool node_less_then_eq(const Histogram* n1, const Histogram* n2);
// Output operator declaration // Output operator declaration
ostream& operator<<(ostream& out, const Histogram& obj); std::ostream& operator<<(std::ostream& out, const Histogram& obj);
// ******************* Definitions ******************* // ******************* Definitions *******************
// Output operator definition // Output operator definition
extern inline extern inline
ostream& operator<<(ostream& out, const Histogram& obj) std::ostream& operator<<(std::ostream& out, const Histogram& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -59,6 +59,8 @@
#ifndef RUBYEVENTQUEUE_H #ifndef RUBYEVENTQUEUE_H
#define RUBYEVENTQUEUE_H #define RUBYEVENTQUEUE_H
#include <iostream>
#include "config/no_vector_bounds_checks.hh" #include "config/no_vector_bounds_checks.hh"
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Vector.hh" #include "mem/gems_common/Vector.hh"
@ -82,7 +84,7 @@ public:
Tick getClock() const { return m_clock; } Tick getClock() const { return m_clock; }
void scheduleEvent(Consumer* consumer, Time timeDelta); void scheduleEvent(Consumer* consumer, Time timeDelta);
void scheduleEventAbsolute(Consumer* consumer, Time timeAbs); void scheduleEventAbsolute(Consumer* consumer, Time timeAbs);
void print(ostream& out) const; void print(std::ostream& out) const;
void triggerEvents(Time t) { assert(0); } void triggerEvents(Time t) { assert(0); }
void triggerAllEvents() { assert(0); } void triggerAllEvents() { assert(0); }
@ -99,16 +101,16 @@ private:
// Output operator declaration // Output operator declaration
inline extern inline extern
ostream& operator<<(ostream& out, const RubyEventQueue& obj); std::ostream& operator<<(std::ostream& out, const RubyEventQueue& obj);
// ******************* Definitions ******************* // ******************* Definitions *******************
// Output operator definition // Output operator definition
inline extern inline extern
ostream& operator<<(ostream& out, const RubyEventQueue& obj) std::ostream& operator<<(std::ostream& out, const RubyEventQueue& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -34,7 +34,7 @@
#include "mem/ruby/eventqueue/RubyEventQueueNode.hh" #include "mem/ruby/eventqueue/RubyEventQueueNode.hh"
void RubyEventQueueNode::print(ostream& out) const void RubyEventQueueNode::print(std::ostream& out) const
{ {
out << "["; out << "[";
if (m_consumer_ptr != NULL) { if (m_consumer_ptr != NULL) {

View file

@ -35,6 +35,8 @@
#ifndef RUBYEVENTQUEUENODE_H #ifndef RUBYEVENTQUEUENODE_H
#define RUBYEVENTQUEUENODE_H #define RUBYEVENTQUEUENODE_H
#include <iostream>
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "sim/eventq.hh" #include "sim/eventq.hh"
#include "mem/ruby/common/Consumer.hh" #include "mem/ruby/common/Consumer.hh"
@ -53,7 +55,7 @@ public:
//~RubyEventQueueNode(); //~RubyEventQueueNode();
// Public Methods // Public Methods
void print(ostream& out) const; void print(std::ostream& out) const;
virtual void process() { m_consumer_ptr->wakeup(); } virtual void process() { m_consumer_ptr->wakeup(); }
virtual const char *description() const { return "Ruby Event"; } virtual const char *description() const { return "Ruby Event"; }
@ -68,16 +70,16 @@ private:
}; };
// Output operator declaration // Output operator declaration
ostream& operator<<(ostream& out, const RubyEventQueueNode& obj); std::ostream& operator<<(std::ostream& out, const RubyEventQueueNode& obj);
// ******************* Definitions ******************* // ******************* Definitions *******************
// Output operator definition // Output operator definition
extern inline extern inline
ostream& operator<<(ostream& out, const RubyEventQueueNode& obj) std::ostream& operator<<(std::ostream& out, const RubyEventQueueNode& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -28,6 +28,8 @@
* Authors: Niket Agarwal * Authors: Niket Agarwal
*/ */
#include <cmath>
#include "mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh" #include "mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh"
#include "mem/ruby/buffers/MessageBuffer.hh" #include "mem/ruby/buffers/MessageBuffer.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh" #include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh"

View file

@ -28,6 +28,8 @@
* Authors: Niket Agarwal * Authors: Niket Agarwal
*/ */
#include <cmath>
#include "mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh" #include "mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh"
#include "mem/ruby/buffers/MessageBuffer.hh" #include "mem/ruby/buffers/MessageBuffer.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh" #include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh"

View file

@ -295,7 +295,7 @@ void PerfectSwitch::wakeup()
} }
} }
void PerfectSwitch::printStats(ostream& out) const void PerfectSwitch::printStats(std::ostream& out) const
{ {
out << "PerfectSwitch printStats" << endl; out << "PerfectSwitch printStats" << endl;
} }
@ -304,11 +304,11 @@ void PerfectSwitch::clearStats()
{ {
} }
void PerfectSwitch::printConfig(ostream& out) const void PerfectSwitch::printConfig(std::ostream& out) const
{ {
} }
void PerfectSwitch::print(ostream& out) const void PerfectSwitch::print(std::ostream& out) const
{ {
out << "[PerfectSwitch " << m_switch_id << "]"; out << "[PerfectSwitch " << m_switch_id << "]";
} }

View file

@ -41,6 +41,8 @@
#ifndef PerfectSwitch_H #ifndef PerfectSwitch_H
#define PerfectSwitch_H #define PerfectSwitch_H
#include <iostream>
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Vector.hh" #include "mem/gems_common/Vector.hh"
#include "mem/ruby/common/Consumer.hh" #include "mem/ruby/common/Consumer.hh"
@ -76,11 +78,11 @@ public:
// Public Methods // Public Methods
void wakeup(); void wakeup();
void printStats(ostream& out) const; void printStats(std::ostream& out) const;
void clearStats(); void clearStats();
void printConfig(ostream& out) const; void printConfig(std::ostream& out) const;
void print(ostream& out) const; void print(std::ostream& out) const;
private: private:
// Private copy constructor and assignment operator // Private copy constructor and assignment operator
@ -102,16 +104,16 @@ private:
}; };
// Output operator declaration // Output operator declaration
ostream& operator<<(ostream& out, const PerfectSwitch& obj); std::ostream& operator<<(std::ostream& out, const PerfectSwitch& obj);
// ******************* Definitions ******************* // ******************* Definitions *******************
// Output operator definition // Output operator definition
extern inline extern inline
ostream& operator<<(ostream& out, const PerfectSwitch& obj) std::ostream& operator<<(std::ostream& out, const PerfectSwitch& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -129,8 +129,10 @@ const Vector<Throttle*>* Switch::getThrottles() const
return &m_throttles; return &m_throttles;
} }
void Switch::printStats(ostream& out) const void Switch::printStats(std::ostream& out) const
{ {
using namespace std;
out << "switch_" << m_switch_id << "_inlinks: " << m_perfect_switch_ptr->getInLinks() << endl; out << "switch_" << m_switch_id << "_inlinks: " << m_perfect_switch_ptr->getInLinks() << endl;
out << "switch_" << m_switch_id << "_outlinks: " << m_perfect_switch_ptr->getOutLinks() << endl; out << "switch_" << m_switch_id << "_outlinks: " << m_perfect_switch_ptr->getOutLinks() << endl;
@ -188,7 +190,7 @@ void Switch::clearStats()
} }
} }
void Switch::printConfig(ostream& out) const void Switch::printConfig(std::ostream& out) const
{ {
m_perfect_switch_ptr->printConfig(out); m_perfect_switch_ptr->printConfig(out);
for (int i=0; i<m_throttles.size(); i++) { for (int i=0; i<m_throttles.size(); i++) {
@ -198,7 +200,7 @@ void Switch::printConfig(ostream& out) const
} }
} }
void Switch::print(ostream& out) const void Switch::print(std::ostream& out) const
{ {
// FIXME printing // FIXME printing
out << "[Switch]"; out << "[Switch]";

View file

@ -44,6 +44,8 @@
#ifndef Switch_H #ifndef Switch_H
#define Switch_H #define Switch_H
#include <iostream>
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Vector.hh" #include "mem/gems_common/Vector.hh"
@ -68,14 +70,14 @@ public:
void clearBuffers(); void clearBuffers();
void reconfigureOutPort(const NetDest& routing_table_entry); void reconfigureOutPort(const NetDest& routing_table_entry);
void printStats(ostream& out) const; void printStats(std::ostream& out) const;
void clearStats(); void clearStats();
void printConfig(ostream& out) const; void printConfig(std::ostream& out) const;
// Destructor // Destructor
~Switch(); ~Switch();
void print(ostream& out) const; void print(std::ostream& out) const;
private: private:
// Private copy constructor and assignment operator // Private copy constructor and assignment operator
@ -91,16 +93,16 @@ private:
}; };
// Output operator declaration // Output operator declaration
ostream& operator<<(ostream& out, const Switch& obj); std::ostream& operator<<(std::ostream& out, const Switch& obj);
// ******************* Definitions ******************* // ******************* Definitions *******************
// Output operator definition // Output operator definition
extern inline extern inline
ostream& operator<<(ostream& out, const Switch& obj) std::ostream& operator<<(std::ostream& out, const Switch& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -45,7 +45,6 @@
#include "mem/protocol/MachineType.hh" #include "mem/protocol/MachineType.hh"
#include "mem/protocol/Protocol.hh" #include "mem/protocol/Protocol.hh"
#include "mem/ruby/system/System.hh" #include "mem/ruby/system/System.hh"
#include <string>
static const int INFINITE_LATENCY = 10000; // Yes, this is a big hack static const int INFINITE_LATENCY = 10000; // Yes, this is a big hack
static const int DEFAULT_BW_MULTIPLIER = 1; // Just to be consistent with above :) static const int DEFAULT_BW_MULTIPLIER = 1; // Just to be consistent with above :)
@ -238,7 +237,7 @@ void Topology::makeLink(Network *net, SwitchID src, SwitchID dest, const NetDest
} }
} }
void Topology::printStats(ostream& out) const void Topology::printStats(std::ostream& out) const
{ {
for (int cntrl = 0; cntrl < m_controller_vector.size(); cntrl++) { for (int cntrl = 0; cntrl < m_controller_vector.size(); cntrl++) {
m_controller_vector[cntrl]->printStats(out); m_controller_vector[cntrl]->printStats(out);
@ -252,8 +251,10 @@ void Topology::clearStats()
} }
} }
void Topology::printConfig(ostream& out) const void Topology::printConfig(std::ostream& out) const
{ {
using namespace std;
if (m_print_config == false) return; if (m_print_config == false) return;
assert(m_component_latencies.size() > 0); assert(m_component_latencies.size() > 0);

View file

@ -47,6 +47,9 @@
#ifndef TOPOLOGY_H #ifndef TOPOLOGY_H
#define TOPOLOGY_H #define TOPOLOGY_H
#include <iostream>
#include <string>
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Vector.hh" #include "mem/gems_common/Vector.hh"
#include "mem/ruby/system/NodeID.hh" #include "mem/ruby/system/NodeID.hh"
@ -101,11 +104,11 @@ public:
void initNetworkPtr(Network* net_ptr); void initNetworkPtr(Network* net_ptr);
const string getName() { return m_name; } const std::string getName() { return m_name; }
void printStats(ostream& out) const; void printStats(std::ostream& out) const;
void clearStats(); void clearStats();
void printConfig(ostream& out) const; void printConfig(std::ostream& out) const;
void print(ostream& out) const { out << "[Topology]"; } void print(std::ostream& out) const { out << "[Topology]"; }
protected: protected:
// Private Methods // Private Methods
@ -117,13 +120,13 @@ protected:
// void makeSwitchesPerChip(Vector< Vector < SwitchID > > &nodePairs, Vector<int> &latencies, Vector<int> &bw_multis, int numberOfChips); // void makeSwitchesPerChip(Vector< Vector < SwitchID > > &nodePairs, Vector<int> &latencies, Vector<int> &bw_multis, int numberOfChips);
string getDesignStr(); std::string getDesignStr();
// Private copy constructor and assignment operator // Private copy constructor and assignment operator
Topology(const Topology& obj); Topology(const Topology& obj);
Topology& operator=(const Topology& obj); Topology& operator=(const Topology& obj);
// Data Members (m_ prefix) // Data Members (m_ prefix)
string m_name; std::string m_name;
bool m_print_config; bool m_print_config;
NodeID m_nodes; NodeID m_nodes;
int m_number_of_switches; int m_number_of_switches;
@ -141,16 +144,16 @@ protected:
}; };
// Output operator declaration // Output operator declaration
ostream& operator<<(ostream& out, const Topology& obj); std::ostream& operator<<(std::ostream& out, const Topology& obj);
// ******************* Definitions ******************* // ******************* Definitions *******************
// Output operator definition // Output operator definition
extern inline extern inline
ostream& operator<<(ostream& out, const Topology& obj) std::ostream& operator<<(std::ostream& out, const Topology& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -39,6 +39,9 @@
#ifndef CACHEPROFILER_H #ifndef CACHEPROFILER_H
#define CACHEPROFILER_H #define CACHEPROFILER_H
#include <iostream>
#include <string>
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "mem/ruby/system/NodeID.hh" #include "mem/ruby/system/NodeID.hh"
#include "mem/ruby/common/Histogram.hh" #include "mem/ruby/common/Histogram.hh"
@ -51,18 +54,18 @@ template <class TYPE> class Vector;
class CacheProfiler { class CacheProfiler {
public: public:
// Constructors // Constructors
CacheProfiler(const string& description); CacheProfiler(const std::string& description);
// Destructor // Destructor
~CacheProfiler(); ~CacheProfiler();
// Public Methods // Public Methods
void printStats(ostream& out) const; void printStats(std::ostream& out) const;
void clearStats(); void clearStats();
void addStatSample(CacheRequestType requestType, AccessModeType type, int msgSize, PrefetchBit pfBit); void addStatSample(CacheRequestType requestType, AccessModeType type, int msgSize, PrefetchBit pfBit);
void print(ostream& out) const; void print(std::ostream& out) const;
private: private:
// Private Methods // Private Methods
@ -71,7 +74,7 @@ private:
CacheProfiler& operator=(const CacheProfiler& obj); CacheProfiler& operator=(const CacheProfiler& obj);
// Data Members (m_ prefix) // Data Members (m_ prefix)
string m_description; std::string m_description;
Histogram m_requestSize; Histogram m_requestSize;
int64 m_misses; int64 m_misses;
int64 m_demand_misses; int64 m_demand_misses;
@ -84,16 +87,16 @@ private:
}; };
// Output operator declaration // Output operator declaration
ostream& operator<<(ostream& out, const CacheProfiler& obj); std::ostream& operator<<(std::ostream& out, const CacheProfiler& obj);
// ******************* Definitions ******************* // ******************* Definitions *******************
// Output operator definition // Output operator definition
extern inline extern inline
ostream& operator<<(ostream& out, const CacheProfiler& obj) std::ostream& operator<<(std::ostream& out, const CacheProfiler& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -29,6 +29,8 @@
#include "mem/ruby/profiler/MemCntrlProfiler.hh" #include "mem/ruby/profiler/MemCntrlProfiler.hh"
using namespace std;
MemCntrlProfiler::MemCntrlProfiler(const string& description, MemCntrlProfiler::MemCntrlProfiler(const string& description,
int banks_per_rank, int banks_per_rank,
int ranks_per_dimm, int ranks_per_dimm,

View file

@ -39,6 +39,9 @@
#ifndef MEM_CNTRL_PROFILER_H #ifndef MEM_CNTRL_PROFILER_H
#define MEM_CNTRL_PROFILER_H #define MEM_CNTRL_PROFILER_H
#include <iostream>
#include <string>
#include "mem/gems_common/Vector.hh" #include "mem/gems_common/Vector.hh"
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
@ -47,7 +50,7 @@ template <class TYPE> class Vector;
class MemCntrlProfiler { class MemCntrlProfiler {
public: public:
// Constructors // Constructors
MemCntrlProfiler(const string& description, MemCntrlProfiler(const std::string& description,
int banks_per_rank, int banks_per_rank,
int ranks_per_dimm, int ranks_per_dimm,
int dimms_per_channel); int dimms_per_channel);
@ -56,7 +59,7 @@ public:
~MemCntrlProfiler(); ~MemCntrlProfiler();
// Public Methods // Public Methods
void printStats(ostream& out) const; void printStats(std::ostream& out) const;
void clearStats(); void clearStats();
void profileMemReq(int bank); void profileMemReq(int bank);
@ -75,7 +78,7 @@ public:
void profileMemRandBusy(); void profileMemRandBusy();
void profileMemNotOld(); void profileMemNotOld();
void print(ostream& out) const; void print(std::ostream& out) const;
private: private:
// Private Methods // Private Methods
@ -84,7 +87,7 @@ private:
MemCntrlProfiler& operator=(const MemCntrlProfiler& obj); MemCntrlProfiler& operator=(const MemCntrlProfiler& obj);
// Data Members (m_ prefix) // Data Members (m_ prefix)
string m_description; std::string m_description;
uint64 m_memReq; uint64 m_memReq;
uint64 m_memBankBusy; uint64 m_memBankBusy;
uint64 m_memBusBusy; uint64 m_memBusBusy;
@ -107,16 +110,16 @@ private:
}; };
// Output operator declaration // Output operator declaration
ostream& operator<<(ostream& out, const MemCntrlProfiler& obj); std::ostream& operator<<(std::ostream& out, const MemCntrlProfiler& obj);
// ******************* Definitions ******************* // ******************* Definitions *******************
// Output operator definition // Output operator definition
extern inline extern inline
ostream& operator<<(ostream& out, const MemCntrlProfiler& obj) std::ostream& operator<<(std::ostream& out, const MemCntrlProfiler& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -51,6 +51,10 @@
* *
*/ */
// Allows use of times() library call, which determines virtual runtime
#include <sys/resource.h>
#include <sys/times.h>
#include "mem/ruby/profiler/Profiler.hh" #include "mem/ruby/profiler/Profiler.hh"
#include "mem/ruby/profiler/AddressProfiler.hh" #include "mem/ruby/profiler/AddressProfiler.hh"
#include "mem/ruby/system/System.hh" #include "mem/ruby/system/System.hh"
@ -65,9 +69,6 @@
#include "mem/ruby/system/System.hh" #include "mem/ruby/system/System.hh"
// Allows use of times() library call, which determines virtual runtime
#include <sys/times.h>
extern std::ostream * debug_cout_ptr; extern std::ostream * debug_cout_ptr;
static double process_memory_total(); static double process_memory_total();

View file

@ -38,11 +38,13 @@
#ifndef CACHERECORDER_H #ifndef CACHERECORDER_H
#define CACHERECORDER_H #define CACHERECORDER_H
#include "mem/ruby/libruby_internal.hh" #include <iostream>
#include <string>
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/system/NodeID.hh"
#include "mem/protocol/CacheRequestType.hh" #include "mem/protocol/CacheRequestType.hh"
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/libruby_internal.hh"
#include "mem/ruby/system/NodeID.hh"
template <class TYPE> class PrioHeap; template <class TYPE> class PrioHeap;
class Address; class Address;
@ -63,9 +65,9 @@ public:
const Address& pc_addr, const Address& pc_addr,
RubyRequestType type, RubyRequestType type,
Time time); Time time);
int dumpRecords(string filename); int dumpRecords(std::string filename);
void print(ostream& out) const; void print(std::ostream& out) const;
private: private:
// Private Methods // Private Methods
@ -78,16 +80,16 @@ private:
}; };
// Output operator declaration // Output operator declaration
ostream& operator<<(ostream& out, const CacheRecorder& obj); std::ostream& operator<<(std::ostream& out, const CacheRecorder& obj);
// ******************* Definitions ******************* // ******************* Definitions *******************
// Output operator definition // Output operator definition
extern inline extern inline
ostream& operator<<(ostream& out, const CacheRecorder& obj) std::ostream& operator<<(std::ostream& out, const CacheRecorder& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -62,7 +62,7 @@ void Tracer::init()
{ {
} }
void Tracer::startTrace(string filename) void Tracer::startTrace(std::string filename)
{ {
if (m_enabled) { if (m_enabled) {
stopTrace(); stopTrace();
@ -101,7 +101,7 @@ void Tracer::traceRequest(Sequencer* sequencer,
} }
// Class method // Class method
int Tracer::playbackTrace(string filename) int Tracer::playbackTrace(std::string filename)
{ {
igzstream in(filename.c_str()); igzstream in(filename.c_str());
if (in.fail()) { if (in.fail()) {
@ -147,7 +147,7 @@ int Tracer::playbackTrace(string filename)
return counter; return counter;
} }
void Tracer::print(ostream& out) const void Tracer::print(std::ostream& out) const
{ {
} }

View file

@ -38,6 +38,9 @@
#ifndef TRACER_H #ifndef TRACER_H
#define TRACER_H #define TRACER_H
#include <iostream>
#include <string>
#include "mem/ruby/libruby_internal.hh" #include "mem/ruby/libruby_internal.hh"
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
@ -65,7 +68,7 @@ public:
~Tracer(); ~Tracer();
// Public Methods // Public Methods
void startTrace(string filename); void startTrace(std::string filename);
void stopTrace(); void stopTrace();
bool traceEnabled() { return m_enabled; } bool traceEnabled() { return m_enabled; }
void traceRequest(Sequencer* sequencer, void traceRequest(Sequencer* sequencer,
@ -74,10 +77,10 @@ public:
RubyRequestType type, RubyRequestType type,
Time time); Time time);
void print(ostream& out) const; void print(std::ostream& out) const;
// Public Class Methods // Public Class Methods
int playbackTrace(string filename); int playbackTrace(std::string filename);
void init(); void init();
private: private:
// Private Methods // Private Methods
@ -95,16 +98,16 @@ private:
}; };
// Output operator declaration // Output operator declaration
ostream& operator<<(ostream& out, const Tracer& obj); std::ostream& operator<<(std::ostream& out, const Tracer& obj);
// ******************* Definitions ******************* // ******************* Definitions *******************
// Output operator definition // Output operator definition
extern inline extern inline
ostream& operator<<(ostream& out, const Tracer& obj) std::ostream& operator<<(std::ostream& out, const Tracer& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -34,6 +34,8 @@
#ifndef MESSAGE_H #ifndef MESSAGE_H
#define MESSAGE_H #define MESSAGE_H
#include <iostream>
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "mem/gems_common/RefCnt.hh" #include "mem/gems_common/RefCnt.hh"
#include "mem/gems_common/RefCountable.hh" #include "mem/gems_common/RefCountable.hh"
@ -53,7 +55,7 @@ public:
// Public Methods // Public Methods
virtual Message* clone() const = 0; virtual Message* clone() const = 0;
virtual void destroy() = 0; virtual void destroy() = 0;
virtual void print(ostream& out) const = 0; virtual void print(std::ostream& out) const = 0;
void setDelayedCycles(const int& cycles) { m_DelayedCycles = cycles; } void setDelayedCycles(const int& cycles) { m_DelayedCycles = cycles; }
const int& getDelayedCycles() const {return m_DelayedCycles;} const int& getDelayedCycles() const {return m_DelayedCycles;}
@ -75,16 +77,16 @@ private:
}; };
// Output operator declaration // Output operator declaration
ostream& operator<<(ostream& out, const Message& obj); std::ostream& operator<<(std::ostream& out, const Message& obj);
// ******************* Definitions ******************* // ******************* Definitions *******************
// Output operator definition // Output operator definition
extern inline extern inline
ostream& operator<<(ostream& out, const Message& obj) std::ostream& operator<<(std::ostream& out, const Message& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -39,6 +39,9 @@
#ifndef MACHINEID_H #ifndef MACHINEID_H
#define MACHINEID_H #define MACHINEID_H
#include <iostream>
#include <string>
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "mem/gems_common/util.hh" #include "mem/gems_common/util.hh"
#include "mem/protocol/MachineType.hh" #include "mem/protocol/MachineType.hh"
@ -49,7 +52,7 @@ struct MachineID {
}; };
extern inline extern inline
string MachineIDToString (MachineID machine) { std::string MachineIDToString (MachineID machine) {
return MachineType_to_string(machine.type)+"_"+int_to_string(machine.num); return MachineType_to_string(machine.type)+"_"+int_to_string(machine.num);
} }
@ -66,13 +69,13 @@ bool operator!=(const MachineID & obj1, const MachineID & obj2)
} }
// Output operator declaration // Output operator declaration
ostream& operator<<(ostream& out, const MachineID& obj); std::ostream& operator<<(std::ostream& out, const MachineID& obj);
// ******************* Definitions ******************* // ******************* Definitions *******************
// Output operator definition // Output operator definition
extern inline extern inline
ostream& operator<<(ostream& out, const MachineID& obj) std::ostream& operator<<(std::ostream& out, const MachineID& obj)
{ {
if ((obj.type < MachineType_NUM) && (obj.type >= MachineType_FIRST)) { if ((obj.type < MachineType_NUM) && (obj.type >= MachineType_FIRST)) {
out << MachineType_to_string(obj.type); out << MachineType_to_string(obj.type);
@ -81,7 +84,7 @@ ostream& operator<<(ostream& out, const MachineID& obj)
} }
out << "-"; out << "-";
out << obj.num; out << obj.num;
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -28,6 +28,8 @@
#include "mem/ruby/system/MemoryNode.hh" #include "mem/ruby/system/MemoryNode.hh"
using namespace std;
void MemoryNode::print(ostream& out) const void MemoryNode::print(ostream& out) const
{ {
out << "["; out << "[";

View file

@ -28,6 +28,8 @@
#ifndef MEMORYNODE_H #ifndef MEMORYNODE_H
#define MEMORYNODE_H #define MEMORYNODE_H
#include <iostream>
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "mem/ruby/slicc_interface/Message.hh" #include "mem/ruby/slicc_interface/Message.hh"
#include "mem/protocol/MemoryRequestType.hh" #include "mem/protocol/MemoryRequestType.hh"
@ -61,7 +63,7 @@ public:
~MemoryNode() {}; ~MemoryNode() {};
// Public Methods // Public Methods
void print(ostream& out) const; void print(std::ostream& out) const;
// Data Members (m_ prefix) (all public -- this is really more a struct) // Data Members (m_ prefix) (all public -- this is really more a struct)
@ -74,16 +76,16 @@ public:
}; };
// Output operator declaration // Output operator declaration
ostream& operator<<(ostream& out, const MemoryNode& obj); std::ostream& operator<<(std::ostream& out, const MemoryNode& obj);
// ******************* Definitions ******************* // ******************* Definitions *******************
// Output operator definition // Output operator definition
extern inline extern inline
ostream& operator<<(ostream& out, const MemoryNode& obj) std::ostream& operator<<(std::ostream& out, const MemoryNode& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }

View file

@ -39,12 +39,14 @@
#ifndef NODEID_H #ifndef NODEID_H
#define NODEID_H #define NODEID_H
#include <string>
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "mem/gems_common/util.hh" #include "mem/gems_common/util.hh"
typedef int NodeID; typedef int NodeID;
extern inline extern inline
string NodeIDToString (NodeID node) { return int_to_string(node); } std::string NodeIDToString (NodeID node) { return int_to_string(node); }
#endif //NODEID_H #endif //NODEID_H

View file

@ -2,6 +2,8 @@
#ifndef PSEUDOLRUPOLICY_H #ifndef PSEUDOLRUPOLICY_H
#define PSEUDOLRUPOLICY_H #define PSEUDOLRUPOLICY_H
#include <cmath>
#include "mem/ruby/system/AbstractReplacementPolicy.hh" #include "mem/ruby/system/AbstractReplacementPolicy.hh"
/** /**

View file

@ -196,6 +196,10 @@ class $py_ident(RubyController):
#ifndef ${ident}_CONTROLLER_H #ifndef ${ident}_CONTROLLER_H
#define ${ident}_CONTROLLER_H #define ${ident}_CONTROLLER_H
#include <iostream>
#include <sstream>
#include <string>
#include "params/$c_ident.hh" #include "params/$c_ident.hh"
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
@ -214,7 +218,7 @@ class $py_ident(RubyController):
# for adding information to the protocol debug trace # for adding information to the protocol debug trace
code(''' code('''
extern stringstream ${ident}_transitionComment; extern std::stringstream ${ident}_transitionComment;
class $c_ident : public AbstractController { class $c_ident : public AbstractController {
#ifdef CHECK_COHERENCE #ifdef CHECK_COHERENCE
@ -226,14 +230,14 @@ public:
void init(); void init();
MessageBuffer* getMandatoryQueue() const; MessageBuffer* getMandatoryQueue() const;
const int & getVersion() const; const int & getVersion() const;
const string toString() const; const std::string toString() const;
const string getName() const; const std::string getName() const;
const MachineType getMachineType() const; const MachineType getMachineType() const;
void initNetworkPtr(Network* net_ptr) { m_net_ptr = net_ptr; } void initNetworkPtr(Network* net_ptr) { m_net_ptr = net_ptr; }
void print(ostream& out) const; void print(std::ostream& out) const;
void printConfig(ostream& out) const; void printConfig(std::ostream& out) const;
void wakeup(); void wakeup();
void printStats(ostream& out) const; void printStats(std::ostream& out) const;
void clearStats(); void clearStats();
void blockOnQueue(Address addr, MessageBuffer* port); void blockOnQueue(Address addr, MessageBuffer* port);
void unblock(Address addr); void unblock(Address addr);
@ -253,11 +257,11 @@ int m_number_of_TBEs;
TransitionResult doTransition(${ident}_Event event, ${ident}_State state, const Address& addr); // in ${ident}_Transitions.cc TransitionResult doTransition(${ident}_Event event, ${ident}_State state, const Address& addr); // in ${ident}_Transitions.cc
TransitionResult doTransitionWorker(${ident}_Event event, ${ident}_State state, ${ident}_State& next_state, const Address& addr); // in ${ident}_Transitions.cc TransitionResult doTransitionWorker(${ident}_Event event, ${ident}_State state, ${ident}_State& next_state, const Address& addr); // in ${ident}_Transitions.cc
string m_name; std::string m_name;
int m_transitions_per_cycle; int m_transitions_per_cycle;
int m_buffer_size; int m_buffer_size;
int m_recycle_latency; int m_recycle_latency;
map< string, string > m_cfg; map<std::string, std::string> m_cfg;
NodeID m_version; NodeID m_version;
Network* m_net_ptr; Network* m_net_ptr;
MachineID m_machineID; MachineID m_machineID;
@ -312,6 +316,9 @@ static int m_num_controllers;
* Created by slicc definition of Module "${{self.short}}" * Created by slicc definition of Module "${{self.short}}"
*/ */
#include <sstream>
#include <string>
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "mem/ruby/slicc_interface/RubySlicc_includes.hh" #include "mem/ruby/slicc_interface/RubySlicc_includes.hh"
#include "mem/protocol/${ident}_Controller.hh" #include "mem/protocol/${ident}_Controller.hh"
@ -319,6 +326,8 @@ static int m_num_controllers;
#include "mem/protocol/${ident}_Event.hh" #include "mem/protocol/${ident}_Event.hh"
#include "mem/protocol/Types.hh" #include "mem/protocol/Types.hh"
#include "mem/ruby/system/System.hh" #include "mem/ruby/system/System.hh"
using namespace std;
''') ''')
# include object classes # include object classes
@ -863,6 +872,8 @@ if (!%s.areNSlotsAvailable(%s)) {
#ifndef ${ident}_PROFILER_H #ifndef ${ident}_PROFILER_H
#define ${ident}_PROFILER_H #define ${ident}_PROFILER_H
#include <iostream>
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "mem/protocol/${ident}_State.hh" #include "mem/protocol/${ident}_State.hh"
#include "mem/protocol/${ident}_Event.hh" #include "mem/protocol/${ident}_Event.hh"
@ -873,7 +884,7 @@ class ${ident}_Profiler {
void setVersion(int version); void setVersion(int version);
void countTransition(${ident}_State state, ${ident}_Event event); void countTransition(${ident}_State state, ${ident}_Event event);
void possibleTransition(${ident}_State state, ${ident}_Event event); void possibleTransition(${ident}_State state, ${ident}_Event event);
void dumpStats(ostream& out) const; void dumpStats(std::ostream& out) const;
void clearStats(); void clearStats();
private: private:
@ -935,8 +946,10 @@ void ${ident}_Profiler::possibleTransition(${ident}_State state, ${ident}_Event
{ {
m_possible[state][event] = true; m_possible[state][event] = true;
} }
void ${ident}_Profiler::dumpStats(ostream& out) const void ${ident}_Profiler::dumpStats(std::ostream& out) const
{ {
using namespace std;
out << " --- ${ident} " << m_version << " ---" << endl; out << " --- ${ident} " << m_version << " ---" << endl;
out << " - Event Counts -" << endl; out << " - Event Counts -" << endl;
for (int event = 0; event < ${ident}_Event_NUM; event++) { for (int event = 0; event < ${ident}_Event_NUM; event++) {

View file

@ -202,6 +202,8 @@ class Type(Symbol):
#ifndef ${{self.c_ident}}_H #ifndef ${{self.c_ident}}_H
#define ${{self.c_ident}}_H #define ${{self.c_ident}}_H
#include <iostream>
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Allocator.hh" #include "mem/gems_common/Allocator.hh"
''') ''')
@ -323,7 +325,7 @@ ${{dm.type.c_ident}}& get${{dm.ident}}() { return m_${{dm.ident}}; }
void set${{dm.ident}}(const ${{dm.type.c_ident}}& local_${{dm.ident}}) { m_${{dm.ident}} = local_${{dm.ident}}; } void set${{dm.ident}}(const ${{dm.type.c_ident}}& local_${{dm.ident}}) { m_${{dm.ident}} = local_${{dm.ident}}; }
''') ''')
code('void print(ostream& out) const;') code('void print(std::ostream& out) const;')
code.dedent() code.dedent()
code(' //private:') code(' //private:')
code.indent() code.indent()
@ -358,14 +360,14 @@ void set${{dm.ident}}(const ${{dm.type.c_ident}}& local_${{dm.ident}}) { m_${{dm
code(''' code('''
// Output operator declaration // Output operator declaration
ostream& operator<<(ostream& out, const ${{self.c_ident}}& obj); std::ostream& operator<<(std::ostream& out, const ${{self.c_ident}}& obj);
// Output operator definition // Output operator definition
extern inline extern inline
ostream& operator<<(ostream& out, const ${{self.c_ident}}& obj) std::ostream& operator<<(std::ostream& out, const ${{self.c_ident}}& obj)
{ {
obj.print(out); obj.print(out);
out << flush; out << std::flush;
return out; return out;
} }
@ -383,7 +385,11 @@ ostream& operator<<(ostream& out, const ${{self.c_ident}}& obj)
* Auto generated C++ code started by $__file__:$__line__ * Auto generated C++ code started by $__file__:$__line__
*/ */
#include <iostream>
#include "mem/protocol/${{self.c_ident}}.hh" #include "mem/protocol/${{self.c_ident}}.hh"
using namespace std;
''') ''')
if self.isMessage: if self.isMessage:
@ -421,6 +427,9 @@ void ${{self.c_ident}}::print(ostream& out) const
#ifndef ${{self.c_ident}}_H #ifndef ${{self.c_ident}}_H
#define ${{self.c_ident}}_H #define ${{self.c_ident}}_H
#include <iostream>
#include <string>
#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Global.hh"
/** \\enum ${{self.c_ident}} /** \\enum ${{self.c_ident}}
@ -443,8 +452,8 @@ enum ${{self.c_ident}} {
code(''' code('''
${{self.c_ident}}_NUM ${{self.c_ident}}_NUM
}; };
${{self.c_ident}} string_to_${{self.c_ident}}(const string& str); ${{self.c_ident}} string_to_${{self.c_ident}}(const std::string& str);
string ${{self.c_ident}}_to_string(const ${{self.c_ident}}& obj); std::string ${{self.c_ident}}_to_string(const ${{self.c_ident}}& obj);
${{self.c_ident}} &operator++(${{self.c_ident}} &e); ${{self.c_ident}} &operator++(${{self.c_ident}} &e);
''') ''')
@ -462,7 +471,7 @@ int ${{self.c_ident}}_base_count(const ${{self.c_ident}}& obj);
# Trailer # Trailer
code(''' code('''
ostream& operator<<(ostream& out, const ${{self.c_ident}}& obj); std::ostream& operator<<(std::ostream& out, const ${{self.c_ident}}& obj);
#endif // ${{self.c_ident}}_H #endif // ${{self.c_ident}}_H
''') ''')
@ -477,8 +486,13 @@ ostream& operator<<(ostream& out, const ${{self.c_ident}}& obj);
* Auto generated C++ code started by $__file__:$__line__ * Auto generated C++ code started by $__file__:$__line__
*/ */
#include <iostream>
#include <string>
#include "mem/protocol/${{self.c_ident}}.hh" #include "mem/protocol/${{self.c_ident}}.hh"
using namespace std;
''') ''')
if self.isMachineType: if self.isMachineType: