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/garnet | |
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/garnet')
32 files changed, 124 insertions, 108 deletions
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 |