diff options
author | Nathan Binkert <nate@binkert.org> | 2010-04-02 11:20:32 -0700 |
---|---|---|
committer | Nathan Binkert <nate@binkert.org> | 2010-04-02 11:20:32 -0700 |
commit | f1c3f3044b73d890ffdfdd113b3b37ae2809d21b (patch) | |
tree | 959d71e897a8d01868c8dea8a8b225cbd1b5ce2c /src/mem/ruby/network | |
parent | be10204729c107b41d5d7487323c732e9fa09df5 (diff) | |
download | gem5-f1c3f3044b73d890ffdfdd113b3b37ae2809d21b.tar.xz |
ruby: get "using namespace" out of headers
In addition to obvious changes, this required a slight change to the slicc
grammar to allow types with :: in them. Otherwise slicc barfs on std::string
which we need for the headers that slicc generates.
Diffstat (limited to 'src/mem/ruby/network')
40 files changed, 161 insertions, 132 deletions
diff --git a/src/mem/ruby/network/Network.hh b/src/mem/ruby/network/Network.hh index b79c6407e..fb56904db 100644 --- a/src/mem/ruby/network/Network.hh +++ b/src/mem/ruby/network/Network.hh @@ -40,6 +40,9 @@ #ifndef __MEM_RUBY_NETWORK_NETWORK_HH__ #define __MEM_RUBY_NETWORK_NETWORK_HH__ +#include <iostream> +#include <string> + #include "mem/protocol/MessageSizeType.hh" #include "mem/ruby/common/Global.hh" #include "mem/ruby/system/NodeID.hh" @@ -88,10 +91,10 @@ class Network : public SimObject virtual void reset() = 0; - virtual void printStats(ostream& out) const = 0; + virtual void printStats(std::ostream& out) const = 0; virtual void clearStats() = 0; - virtual void printConfig(ostream& out) const = 0; - virtual void print(ostream& out) const = 0; + virtual void printConfig(std::ostream& out) const = 0; + virtual void print(std::ostream& out) const = 0; protected: // Private copy constructor and assignment operator @@ -99,7 +102,7 @@ class Network : public SimObject Network& operator=(const Network& obj); protected: - const string m_name; + const std::string m_name; int m_nodes; int m_virtual_networks; int m_buffer_size; @@ -111,11 +114,11 @@ class Network : public SimObject int m_data_msg_size; }; -inline ostream& -operator<<(ostream& out, const Network& obj) +inline std::ostream& +operator<<(std::ostream& out, const Network& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/network/garnet/NetworkHeader.hh b/src/mem/ruby/network/garnet/NetworkHeader.hh index 1922df5ea..98c8024fa 100644 --- a/src/mem/ruby/network/garnet/NetworkHeader.hh +++ b/src/mem/ruby/network/garnet/NetworkHeader.hh @@ -34,9 +34,6 @@ #include "mem/ruby/common/Global.hh" #include "mem/ruby/system/NodeID.hh" -using namespace std; -using namespace __gnu_cxx; - enum flit_type {HEAD_, BODY_, TAIL_, HEAD_TAIL_, NUM_FLIT_TYPE_}; enum VC_state_type {IDLE_, VC_AB_, ACTIVE_, NUM_VC_STATE_TYPE_}; enum flit_stage {I_, VA_, SA_, ST_, LT_, NUM_FLIT_STAGE_}; diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc index 7e9fe0762..8bdea4894 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc @@ -38,6 +38,8 @@ #include "mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh" #include "mem/ruby/common/NetDest.hh" +using namespace std; + GarnetNetwork_d::GarnetNetwork_d(const Params *p) : BaseGarnetNetwork(p) { diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh index 8a36c1572..7cb87b21a 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh @@ -31,6 +31,8 @@ #ifndef GARNETNETWORK_D_H #define GARNETNETWORK_D_H +#include <iostream> + #include "mem/ruby/network/garnet/NetworkHeader.hh" #include "mem/gems_common/Vector.hh" #include "mem/ruby/network/garnet/BaseGarnetNetwork.hh" @@ -61,9 +63,9 @@ public: MessageBuffer* getFromNetQueue(NodeID id, bool ordered, int network_num); void clearStats(); - void printStats(ostream& out) const; - void printConfig(ostream& out) const; - void print(ostream& out) const; + void printStats(std::ostream& out) const; + void printConfig(std::ostream& out) const; + void print(std::ostream& out) const; inline void increment_injected_flits() { @@ -125,17 +127,12 @@ private: Time m_ruby_start; }; -// Output operator declaration -ostream& operator<<(ostream& out, const GarnetNetwork_d& obj); - -// ******************* Definitions ******************* -// Output operator definition -extern inline -ostream& operator<<(ostream& out, const GarnetNetwork_d& obj) +inline std::ostream& +operator<<(std::ostream& out, const GarnetNetwork_d& obj) { - obj.print(out); - out << flush; - return out; + obj.print(out); + out << std::flush; + return out; } #endif //GARNETNETWORK_D_H diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc index ce7a0152d..ea8f7789b 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc @@ -31,6 +31,8 @@ #include "mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh" #include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh" +using namespace std; + InputUnit_d::InputUnit_d(int id, Router_d *router) { m_id = id; diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh index bca7b10f0..05358bc8b 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh @@ -31,6 +31,8 @@ #ifndef INPUT_UNIT_D_H #define INPUT_UNIT_D_H +#include <iostream> + #include "mem/ruby/network/garnet/NetworkHeader.hh" #include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh" #include "mem/ruby/common/Consumer.hh" @@ -47,9 +49,9 @@ public: ~InputUnit_d(); void wakeup(); - void printConfig(ostream& out); + void printConfig(std::ostream& out); flitBuffer_d* getCreditQueue() { return creditQueue; } - void print(ostream& out) const {}; + void print(std::ostream& out) const {}; inline int get_inlink_id() { diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc index 6c61cef26..da86c32fa 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc @@ -335,14 +335,14 @@ void NetworkInterface_d::checkReschedule() } } -void NetworkInterface_d::printConfig(ostream& out) const +void NetworkInterface_d::printConfig(std::ostream& out) const { out << "[Network Interface " << m_id << "] - "; out << "[inLink " << inNetLink->get_id() << "] - "; - out << "[outLink " << outNetLink->get_id() << "]" << endl; + out << "[outLink " << outNetLink->get_id() << "]" << std::endl; } -void NetworkInterface_d::print(ostream& out) const +void NetworkInterface_d::print(std::ostream& out) const { out << "[Network Interface]"; } diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh index 1ca4a7a9c..88d882969 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh @@ -31,6 +31,8 @@ #ifndef NET_INTERFACE_D_H #define NET_INTERFACE_D_H +#include <iostream> + #include "mem/ruby/network/garnet/NetworkHeader.hh" #include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh" #include "mem/gems_common/Vector.hh" @@ -55,8 +57,8 @@ public: void wakeup(); void addNode(Vector<MessageBuffer *> &inNode, Vector<MessageBuffer *> &outNode); - void printConfig(ostream& out) const; - void print(ostream& out) const; + void printConfig(std::ostream& out) const; + void print(std::ostream& out) const; int get_vnet(int vc); private: diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh index b5c58baa2..c5f9f14d1 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh @@ -31,6 +31,8 @@ #ifndef NETWORK_LINK_D_H #define NETWORK_LINK_D_H +#include <iostream> + #include "mem/ruby/network/garnet/NetworkHeader.hh" #include "mem/ruby/common/Consumer.hh" #include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh" @@ -47,7 +49,7 @@ public: NetworkLink_d(int id, int link_latency, GarnetNetwork_d *net_ptr); void setLinkConsumer(Consumer *consumer); void setSourceQueue(flitBuffer_d *srcQueue); - void print(ostream& out) const{} + void print(std::ostream& out) const{} int getLinkUtilization(); Vector<int> getVcLoad(); int get_id(){return m_id;} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc index 7934dc9bd..99475cf69 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc @@ -31,6 +31,8 @@ #include "mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh" #include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh" +using namespace std; + OutputUnit_d::OutputUnit_d(int id, Router_d *router) { m_id = id; diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh index 25747a1f8..93cfd9d12 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh @@ -31,6 +31,8 @@ #ifndef OUTPUT_UNIT_D_H #define OUTPUT_UNIT_D_H +#include <iostream> + #include "mem/ruby/network/garnet/NetworkHeader.hh" #include "mem/ruby/common/Consumer.hh" #include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh" @@ -48,9 +50,9 @@ public: void set_credit_link(CreditLink_d *credit_link); void wakeup(); flitBuffer_d* getOutQueue(); - void printConfig(ostream& out); + void printConfig(std::ostream& out); void update_vc(int vc, int in_port, int in_vc); - void print(ostream& out) const {}; + void print(std::ostream& out) const {}; int get_credit_cnt(int vc) { return m_outvc_state[vc]->get_credit_count(); } void decrement_credit(int out_vc); diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc index 7185249e4..428ba3260 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc @@ -39,6 +39,8 @@ #include "mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh" #include "mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh" +using namespace std; + Router_d::Router_d(int id, GarnetNetwork_d *network_ptr) { m_id = id; diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh index 498a6cae1..91f79882c 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh @@ -31,6 +31,8 @@ #ifndef ROUTER_D_H #define ROUTER_D_H +#include <iostream> + #include "mem/ruby/network/garnet/NetworkHeader.hh" #include "mem/gems_common/Vector.hh" #include "mem/ruby/network/garnet/fixed-pipeline/flit_d.hh" @@ -60,7 +62,7 @@ public: int get_vc_per_vnet() {return m_vc_per_vnet; } int get_num_inports() { return m_input_unit.size(); } int get_num_outports() { return m_output_unit.size(); } - void printConfig(ostream& out); + void printConfig(std::ostream& out); int get_id() { return m_id; } GarnetNetwork_d* get_net_ptr() { return m_network_ptr; } diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh index a6c838e8a..95a7dad1c 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh @@ -31,6 +31,8 @@ #ifndef SW_ALLOCATOR_D_H #define SW_ALLOCATOR_D_H +#include <iostream> + #include "mem/ruby/network/garnet/NetworkHeader.hh" #include "mem/ruby/common/Consumer.hh" @@ -46,7 +48,7 @@ public: void clear_request_vector(); void check_for_wakeup(); int get_vnet (int invc); - void print(ostream& out) const {}; + void print(std::ostream& out) const {}; void arbitrate_inports(); void arbitrate_outports(); bool is_candidate_inport(int inport, int invc); diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh index 0e3c17b3b..09973b82d 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh @@ -31,6 +31,8 @@ #ifndef SWITCH_D_H #define SWITCH_D_H +#include <iostream> + #include "mem/ruby/network/garnet/NetworkHeader.hh" #include "mem/ruby/common/Consumer.hh" #include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh" @@ -45,7 +47,7 @@ public: void wakeup(); void init(); void check_for_wakeup(); - void print(ostream& out) const {}; + void print(std::ostream& out) const {}; inline void update_sw_winner(int inport, flit_d *t_flit) { m_switch_buffer[inport]->insert(t_flit); diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh index c9247c6d0..c6d06d1ae 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh @@ -31,6 +31,9 @@ #ifndef VC_ALLOCATOR_D_H #define VC_ALLOCATOR_D_H +#include <iostream> +#include <utility> + #include "mem/ruby/network/garnet/NetworkHeader.hh" #include "mem/ruby/common/Consumer.hh" @@ -46,7 +49,7 @@ public: void check_for_wakeup(); void clear_request_vector(); int get_vnet(int invc); - void print(ostream& out) const {}; + void print(std::ostream& out) const {}; void arbitrate_invcs(); void arbitrate_outvcs(); bool is_invc_candidate(int inport_iter, int invc_iter); @@ -69,7 +72,7 @@ private: Router_d *m_router; Vector<Vector <int > > m_round_robin_invc; // First stage of arbitration where all vcs select an output vc to content for - Vector<Vector <pair<int, int> > > m_round_robin_outvc; // Arbiter for every output vc + Vector<Vector <std::pair<int, int> > > m_round_robin_outvc; // Arbiter for every output vc Vector<Vector<Vector<Vector<bool > > > > m_outvc_req; // [outport][outvc][inpotr][invc]. set true in the first phase of allocation Vector<Vector<bool > > m_outvc_is_req; diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh index 2b4779038..645506af7 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh @@ -31,6 +31,8 @@ #ifndef VIRTUAL_CHANNEL_D_H #define VIRTUAL_CHANNEL_D_H +#include <utility> + #include "mem/ruby/network/garnet/NetworkHeader.hh" #include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh" @@ -105,7 +107,7 @@ public: private: int m_id; flitBuffer_d *m_input_buffer; - pair<VC_state_type, Time> m_vc_state; // I/R/V/A/C + std::pair<VC_state_type, Time> m_vc_state; // I/R/V/A/C int route; Time m_enqueue_time; int m_output_vc; diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc index 9578f0a8f..38510c758 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc @@ -67,10 +67,10 @@ bool flitBuffer_d::isReadyForNext() return false; } -void flitBuffer_d::print(ostream& out) const +void flitBuffer_d::print(std::ostream& out) const { out << "[flitBuffer: "; - out << m_buffer.size() << "] " << endl; + out << m_buffer.size() << "] " << std::endl; } bool flitBuffer_d::isFull() diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh index 11a3cda9c..976fa4053 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh @@ -31,6 +31,8 @@ #ifndef FLIT_BUFFER_D_H #define FLIT_BUFFER_D_H +#include <iostream> + #include "mem/ruby/network/garnet/NetworkHeader.hh" #include "mem/gems_common/PrioHeap.hh" #include "mem/ruby/network/garnet/fixed-pipeline/flit_d.hh" @@ -43,7 +45,7 @@ public: bool isReady(); bool isReadyForNext(); bool isEmpty(); - void print(ostream& out) const; + void print(std::ostream& out) const; bool isFull(); void setMaxSize(int maximum); @@ -65,17 +67,12 @@ private: int size, max_size; }; -ostream& operator<<(ostream& out, const flitBuffer_d& obj); - -// ******************* Definitions ******************* - -// Output operator definition -extern inline -ostream& operator<<(ostream& out, const flitBuffer_d& obj) +inline std::ostream& +operator<<(std::ostream& out, const flitBuffer_d& obj) { - obj.print(out); - out << flush; - return out; + obj.print(out); + out << std::flush; + return out; } #endif diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc index c6a58a839..2e73cdc72 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc @@ -117,7 +117,7 @@ void flit_d::advance_stage(flit_stage t_stage) m_stage.second = g_eventQueue_ptr->getTime() + 1; } */ -void flit_d::print(ostream& out) const +void flit_d::print(std::ostream& out) const { out << "[flit:: "; out << "Id=" << m_id << " "; diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh index 3f9afcdca..39bbe011d 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh @@ -31,6 +31,8 @@ #ifndef FLIT_D_H #define FLIT_D_H +#include <iostream> + #include "mem/ruby/network/garnet/NetworkHeader.hh" #include "mem/ruby/slicc_interface/Message.hh" @@ -40,7 +42,7 @@ public: flit_d(int vc, bool is_free_signal); void set_outport(int port) { m_outport = port; } int get_outport() {return m_outport; } - void print(ostream& out) const; + void print(std::ostream& out) const; bool is_free_signal() { return m_is_free_signal; @@ -99,7 +101,7 @@ public: m_stage.first = t_stage; m_stage.second = g_eventQueue_ptr->getTime() + 1; } - inline pair<flit_stage, Time> get_stage() + inline std::pair<flit_stage, Time> get_stage() { return m_stage; } @@ -126,7 +128,7 @@ private: MsgPtr m_msg_ptr; int m_outport; int src_delay; - pair<flit_stage, Time> m_stage; + std::pair<flit_stage, Time> m_stage; }; @@ -143,18 +145,12 @@ bool node_less_then_eq(flit_d* n1, flit_d* n2) } } -// Output operator declaration -ostream& operator<<(ostream& out, const flit_d& obj); - -// ******************* Definitions ******************* - -// Output operator definition -extern inline -ostream& operator<<(ostream& out, const flit_d& obj) +inline std::ostream& +operator<<(std::ostream& out, const flit_d& obj) { - obj.print(out); - out << flush; - return out; + obj.print(out); + out << std::flush; + return out; } #endif diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc index 82f664d26..e063e6a0e 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc @@ -39,6 +39,8 @@ #include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh" #include "mem/ruby/common/NetDest.hh" +using namespace std; + GarnetNetwork::GarnetNetwork(const Params *p) : BaseGarnetNetwork(p) { diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh index 3669799fa..c116a324b 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh @@ -31,6 +31,8 @@ #ifndef GARNET_NETWORK_H #define GARNET_NETWORK_H +#include <iostream> + #include "mem/ruby/network/garnet/NetworkHeader.hh" #include "mem/ruby/network/garnet/BaseGarnetNetwork.hh" #include "mem/gems_common/Vector.hh" @@ -58,9 +60,9 @@ public: MessageBuffer* getFromNetQueue(NodeID id, bool ordered, int network_num); void clearStats(); - void printStats(ostream& out) const; - void printConfig(ostream& out) const; - void print(ostream& out) const; + void printStats(std::ostream& out) const; + void printConfig(std::ostream& out) const; + void print(std::ostream& out) const; bool isVNetOrdered(int vnet) { return m_ordered[vnet]; } bool validVirtualNetwork(int vnet) { return m_in_use[vnet]; } @@ -101,17 +103,12 @@ private: Time m_ruby_start; }; -// Output operator declaration -ostream& operator<<(ostream& out, const GarnetNetwork& obj); - -// ******************* Definitions ******************* -// Output operator definition -extern inline -ostream& operator<<(ostream& out, const GarnetNetwork& obj) +inline std::ostream& +operator<<(std::ostream& out, const GarnetNetwork& obj) { - obj.print(out); - out << flush; - return out; + obj.print(out); + out << std::flush; + return out; } #endif //NETWORK_H diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc index 71c433aff..697f954ab 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc @@ -290,14 +290,14 @@ void NetworkInterface::checkReschedule() } } -void NetworkInterface::printConfig(ostream& out) const +void NetworkInterface::printConfig(std::ostream& out) const { out << "[Network Interface " << m_id << "] - "; out << "[inLink " << inNetLink->get_id() << "] - "; - out << "[outLink " << outNetLink->get_id() << "]" << endl; + out << "[outLink " << outNetLink->get_id() << "]" << std::endl; } -void NetworkInterface::print(ostream& out) const +void NetworkInterface::print(std::ostream& out) const { out << "[Network Interface]"; } diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh index 67bba5f04..bc2701125 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh +++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh @@ -31,6 +31,8 @@ #ifndef NET_INTERFACE_H #define NET_INTERFACE_H +#include <iostream> + #include "mem/ruby/network/garnet/NetworkHeader.hh" #include "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh" #include "mem/gems_common/Vector.hh" @@ -62,8 +64,8 @@ public: } void request_vc(int in_vc, int in_port, NetDest destination, Time request_time); - void printConfig(ostream& out) const; - void print(ostream& out) const; + void printConfig(std::ostream& out) const; + void print(std::ostream& out) const; private: /**************Data Members*************/ diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh index e371d9265..3f648ae14 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh +++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh @@ -31,6 +31,8 @@ #ifndef NETWORK_LINK_H #define NETWORK_LINK_H +#include <iostream> + #include "mem/ruby/network/garnet/NetworkHeader.hh" #include "mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh" #include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh" @@ -50,7 +52,7 @@ public: flit* peekLink(); flit* consumeLink(); - void print(ostream& out) const {} + void print(std::ostream& out) const {} bool is_vc_ready(flit *t_flit); diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc index 9963555cb..10696f1ad 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc @@ -34,6 +34,8 @@ #include "mem/ruby/network/garnet/flexible-pipeline/OutVcState.hh" #include "mem/ruby/network/garnet/flexible-pipeline/VCarbiter.hh" +using namespace std; + Router::Router(int id, GarnetNetwork *network_ptr) { m_id = id; diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh b/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh index 5ec7590a6..5d2610fae 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh +++ b/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh @@ -31,6 +31,8 @@ #ifndef ROUTER_H #define ROUTER_H +#include <iostream> + #include "mem/ruby/network/garnet/NetworkHeader.hh" #include "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh" #include "mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh" @@ -58,8 +60,8 @@ public: void release_vc(int out_port, int vc, Time release_time); void vc_arbitrate(); - void printConfig(ostream& out) const; - void print(ostream& out) const; + void printConfig(std::ostream& out) const; + void print(std::ostream& out) const; private: /***************Data Members******************/ diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.hh b/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.hh index 6a8c356f1..3f3223f29 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.hh +++ b/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.hh @@ -31,6 +31,8 @@ #ifndef VC_ARBITER_H #define VC_ARBITER_H +#include <iostream> + #include "mem/ruby/network/garnet/NetworkHeader.hh" #include "mem/ruby/common/Consumer.hh" @@ -41,7 +43,7 @@ public: VCarbiter(Router *router); ~VCarbiter() {} - void print(ostream& out) const {} + void print(std::ostream& out) const {} void wakeup(); private: diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc b/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc index e73a8b9b5..dd0525754 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc @@ -96,7 +96,7 @@ flit_type flit::get_type() return m_type; } -void flit::print(ostream& out) const +void flit::print(std::ostream& out) const { out << "[flit:: "; out << "Id=" << m_id << " "; diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh b/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh index 2cf3eaade..1cc8806e9 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh +++ b/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh @@ -28,6 +28,8 @@ * Authors: Niket Agarwal */ +#include <iostream> + #include "mem/ruby/network/garnet/NetworkHeader.hh" #include "mem/ruby/slicc_interface/Message.hh" @@ -48,7 +50,7 @@ public: void set_vc(int vc); MsgPtr& get_msg_ptr(); flit_type get_type(); - void print(ostream&out) const; + void print(std::ostream& out) const; private: /************Data Members*************/ @@ -75,18 +77,12 @@ bool node_less_then_eq(flit* n1, flit* n2) } } -// Output operator declaration -ostream& operator<<(ostream& out, const flit& obj); - -// ******************* Definitions ******************* - -// Output operator definition -extern inline -ostream& operator<<(ostream& out, const flit& obj) +inline std::ostream& +operator<<(std::ostream& out, const flit& obj) { - obj.print(out); - out << flush; - return out; + obj.print(out); + out << std::flush; + return out; } #endif diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc index d2f9244de..7f41d6f8c 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc @@ -92,8 +92,8 @@ void flitBuffer::insert(flit *flt) m_buffer.insert(flt); } -void flitBuffer::print(ostream& out) const +void flitBuffer::print(std::ostream& out) const { out << "[flitBuffer: "; - out << m_buffer.size() << "] " << endl; + out << m_buffer.size() << "] " << std::endl; } diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh index f8b34720c..646cd99c7 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh +++ b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh @@ -31,6 +31,8 @@ #ifndef FLIT_BUFFER_H #define FLIT_BUFFER_H +#include <iostream> + #include "mem/ruby/network/garnet/NetworkHeader.hh" #include "mem/gems_common/PrioHeap.hh" #include "mem/ruby/network/garnet/flexible-pipeline/flit.hh" @@ -48,7 +50,7 @@ public: flit *getTopFlit(); flit *peekTopFlit(); void insert(flit *flt); - void print(ostream& out) const; + void print(std::ostream& out) const; /**********Data Members*********/ private: @@ -56,17 +58,12 @@ private: int size, max_size; }; -ostream& operator<<(ostream& out, const flitBuffer& obj); - -// ******************* Definitions ******************* - -// Output operator definition -extern inline -ostream& operator<<(ostream& out, const flitBuffer& obj) +inline std::ostream& +operator<<(std::ostream& out, const flitBuffer& obj) { - obj.print(out); - out << flush; - return out; + obj.print(out); + out << std::flush; + return out; } #endif diff --git a/src/mem/ruby/network/simple/PerfectSwitch.cc b/src/mem/ruby/network/simple/PerfectSwitch.cc index bddcb8412..4555ef2b3 100644 --- a/src/mem/ruby/network/simple/PerfectSwitch.cc +++ b/src/mem/ruby/network/simple/PerfectSwitch.cc @@ -35,6 +35,8 @@ #include "mem/ruby/slicc_interface/NetworkMessage.hh" #include "mem/ruby/system/System.hh" +using namespace std; + const int PRIORITY_SWITCH_LIMIT = 128; // Operator for helper class diff --git a/src/mem/ruby/network/simple/SimpleNetwork.cc b/src/mem/ruby/network/simple/SimpleNetwork.cc index 26924c2e7..2940f19a1 100644 --- a/src/mem/ruby/network/simple/SimpleNetwork.cc +++ b/src/mem/ruby/network/simple/SimpleNetwork.cc @@ -38,6 +38,8 @@ #include "mem/ruby/profiler/Profiler.hh" #include "mem/ruby/system/System.hh" +using namespace std; + #if 0 // ***BIG HACK*** - This is actually code that _should_ be in Network.cc diff --git a/src/mem/ruby/network/simple/SimpleNetwork.hh b/src/mem/ruby/network/simple/SimpleNetwork.hh index d8ec89d49..f9cb22a6a 100644 --- a/src/mem/ruby/network/simple/SimpleNetwork.hh +++ b/src/mem/ruby/network/simple/SimpleNetwork.hh @@ -63,6 +63,8 @@ #ifndef __MEM_RUBY_NETWORK_SIMPLE_SIMPLENETWORK_HH__ #define __MEM_RUBY_NETWORK_SIMPLE_SIMPLENETWORK_HH__ +#include <iostream> + #include "mem/gems_common/Vector.hh" #include "mem/ruby/common/Global.hh" #include "mem/ruby/network/Network.hh" @@ -85,9 +87,9 @@ class SimpleNetwork : public Network void init(); - void printStats(ostream& out) const; + void printStats(std::ostream& out) const; void clearStats(); - void printConfig(ostream& out) const; + void printConfig(std::ostream& out) const; void reset(); @@ -112,7 +114,7 @@ class SimpleNetwork : public Network const NetDest& routing_table_entry, int link_latency, int link_weight, int bw_multiplier, bool isReconfiguration); - void print(ostream& out) const; + void print(std::ostream& out) const; private: void checkNetworkAllocation(NodeID id, bool ordered, int network_num); @@ -138,11 +140,11 @@ class SimpleNetwork : public Network Vector<Switch*> m_endpoint_switches; }; -inline ostream& -operator<<(ostream& out, const SimpleNetwork& obj) +inline std::ostream& +operator<<(std::ostream& out, const SimpleNetwork& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/network/simple/Switch.cc b/src/mem/ruby/network/simple/Switch.cc index 30403cd67..e88a24505 100644 --- a/src/mem/ruby/network/simple/Switch.cc +++ b/src/mem/ruby/network/simple/Switch.cc @@ -34,6 +34,8 @@ #include "mem/ruby/network/simple/Switch.hh" #include "mem/ruby/network/simple/Throttle.hh" +using namespace std; + Switch::Switch(SwitchID sid, SimpleNetwork* network_ptr) { m_perfect_switch_ptr = new PerfectSwitch(sid, network_ptr); @@ -129,8 +131,6 @@ Switch::getThrottles() const void Switch::printStats(std::ostream& out) const { - using namespace std; - ccprintf(out, "switch_%d_inlinks: %d\n", m_switch_id, m_perfect_switch_ptr->getInLinks()); ccprintf(out, "switch_%d_outlinks: %d\n", m_switch_id, diff --git a/src/mem/ruby/network/simple/Throttle.cc b/src/mem/ruby/network/simple/Throttle.cc index f749672e2..2d15b1141 100644 --- a/src/mem/ruby/network/simple/Throttle.cc +++ b/src/mem/ruby/network/simple/Throttle.cc @@ -34,6 +34,8 @@ #include "mem/ruby/slicc_interface/NetworkMessage.hh" #include "mem/ruby/system/System.hh" +using namespace std; + const int HIGH_RANGE = 256; const int ADJUST_INTERVAL = 50000; const int MESSAGE_SIZE_MULTIPLIER = 1000; @@ -43,7 +45,7 @@ const int PRIORITY_SWITCH_LIMIT = 128; static int network_message_to_size(NetworkMessage* net_msg_ptr); -extern std::ostream *debug_cout_ptr; +extern ostream *debug_cout_ptr; Throttle::Throttle(int sID, NodeID node, int link_latency, int link_bandwidth_multiplier) diff --git a/src/mem/ruby/network/simple/Throttle.hh b/src/mem/ruby/network/simple/Throttle.hh index 608754190..74cd7b356 100644 --- a/src/mem/ruby/network/simple/Throttle.hh +++ b/src/mem/ruby/network/simple/Throttle.hh @@ -38,6 +38,8 @@ #ifndef __MEM_RUBY_NETWORK_SIMPLE_THROTTLE_HH__ #define __MEM_RUBY_NETWORK_SIMPLE_THROTTLE_HH__ +#include <iostream> + #include "mem/gems_common/Vector.hh" #include "mem/ruby/common/Consumer.hh" #include "mem/ruby/common/Global.hh" @@ -59,9 +61,9 @@ class Throttle : public Consumer const Vector<MessageBuffer*>& out_vec); void wakeup(); - void printStats(ostream& out) const; + void printStats(std::ostream& out) const; void clearStats(); - void printConfig(ostream& out) const; + void printConfig(std::ostream& out) const; // The average utilization (a percent) since last clearStats() double getUtilization() const; int @@ -80,7 +82,7 @@ class Throttle : public Consumer void clear(); - void print(ostream& out) const; + void print(std::ostream& out) const; private: void init(NodeID node, int link_latency, int link_bandwidth_multiplier); @@ -107,11 +109,11 @@ class Throttle : public Consumer double m_links_utilized; }; -inline ostream& -operator<<(ostream& out, const Throttle& obj) +inline std::ostream& +operator<<(std::ostream& out, const Throttle& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/network/simple/Topology.cc b/src/mem/ruby/network/simple/Topology.cc index 3d7aa35d0..f21129255 100644 --- a/src/mem/ruby/network/simple/Topology.cc +++ b/src/mem/ruby/network/simple/Topology.cc @@ -36,6 +36,8 @@ #include "mem/ruby/slicc_interface/AbstractController.hh" #include "mem/ruby/system/System.hh" +using namespace std; + const int INFINITE_LATENCY = 10000; // Yes, this is a big hack const int DEFAULT_BW_MULTIPLIER = 1; // Just to be consistent with above :) @@ -276,8 +278,6 @@ Topology::clearStats() void Topology::printConfig(std::ostream& out) const { - using namespace std; - if (m_print_config == false) return; |