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/fixed-pipeline | |
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/fixed-pipeline')
19 files changed, 74 insertions, 57 deletions
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 |