1d0
<
31,38c30,33
< * $Id$
< *
< * Description: Perfect switch, of course it is perfect and no latency or what
< * so ever. Every cycle it is woke up and perform all the
< * necessary routings that must be done. Note, this switch also
< * has number of input ports/output ports and has a routing table
< * as well.
< *
---
> * Perfect switch, of course it is perfect and no latency or what so
> * ever. Every cycle it is woke up and perform all the necessary
> * routings that must be done. Note, this switch also has number of
> * input ports/output ports and has a routing table as well.
41,42c36,37
< #ifndef PerfectSwitch_H
< #define PerfectSwitch_H
---
> #ifndef __MEM_RUBY_NETWORK_SIMPLE_PERFECTSWITCH_HH__
> #define __MEM_RUBY_NETWORK_SIMPLE_PERFECTSWITCH_HH__
46d40
< #include "mem/ruby/common/Global.hh"
48a43
> #include "mem/ruby/common/Global.hh"
55,58c50,53
< class LinkOrder {
< public:
< int m_link;
< int m_value;
---
> struct LinkOrder
> {
> int m_link;
> int m_value;
61,63c56,60
< class PerfectSwitch : public Consumer {
< public:
< // Constructors
---
> class PerfectSwitch : public Consumer
> {
> public:
> PerfectSwitch(SwitchID sid, SimpleNetwork* network_ptr);
> ~PerfectSwitch();
65,73c62,69
< // constructor specifying the number of ports
< PerfectSwitch(SwitchID sid, SimpleNetwork* network_ptr);
< void addInPort(const Vector<MessageBuffer*>& in);
< void addOutPort(const Vector<MessageBuffer*>& out, const NetDest& routing_table_entry);
< void clearRoutingTables();
< void clearBuffers();
< void reconfigureOutPort(const NetDest& routing_table_entry);
< int getInLinks() const { return m_in.size(); }
< int getOutLinks() const { return m_out.size(); }
---
> void addInPort(const Vector<MessageBuffer*>& in);
> void addOutPort(const Vector<MessageBuffer*>& out,
> const NetDest& routing_table_entry);
> void clearRoutingTables();
> void clearBuffers();
> void reconfigureOutPort(const NetDest& routing_table_entry);
> int getInLinks() const { return m_in.size(); }
> int getOutLinks() const { return m_out.size(); }
75,76c71
< // Destructor
< ~PerfectSwitch();
---
> void wakeup();
78,79c73,75
< // Public Methods
< void wakeup();
---
> void printStats(std::ostream& out) const;
> void clearStats();
> void printConfig(std::ostream& out) const;
81,83c77
< void printStats(std::ostream& out) const;
< void clearStats();
< void printConfig(std::ostream& out) const;
---
> void print(std::ostream& out) const;
85,86c79,82
< void print(std::ostream& out) const;
< private:
---
> private:
> // Private copy constructor and assignment operator
> PerfectSwitch(const PerfectSwitch& obj);
> PerfectSwitch& operator=(const PerfectSwitch& obj);
88,90c84
< // Private copy constructor and assignment operator
< PerfectSwitch(const PerfectSwitch& obj);
< PerfectSwitch& operator=(const PerfectSwitch& obj);
---
> SwitchID m_switch_id;
92,103c86,94
< // Data Members (m_ prefix)
< SwitchID m_switch_id;
<
< // vector of queues from the components
< Vector<Vector<MessageBuffer*> > m_in;
< Vector<Vector<MessageBuffer*> > m_out;
< Vector<NetDest> m_routing_table;
< Vector<LinkOrder> m_link_order;
< int m_virtual_networks;
< int m_round_robin_start;
< int m_wakeups_wo_switch;
< SimpleNetwork* m_network_ptr;
---
> // vector of queues from the components
> Vector<Vector<MessageBuffer*> > m_in;
> Vector<Vector<MessageBuffer*> > m_out;
> Vector<NetDest> m_routing_table;
> Vector<LinkOrder> m_link_order;
> int m_virtual_networks;
> int m_round_robin_start;
> int m_wakeups_wo_switch;
> SimpleNetwork* m_network_ptr;
106,113c97,98
< // Output operator declaration
< std::ostream& operator<<(std::ostream& out, const PerfectSwitch& obj);
<
< // ******************* Definitions *******************
<
< // Output operator definition
< extern inline
< std::ostream& operator<<(std::ostream& out, const PerfectSwitch& obj)
---
> inline std::ostream&
> operator<<(std::ostream& out, const PerfectSwitch& obj)
115,117c100,102
< obj.print(out);
< out << std::flush;
< return out;
---
> obj.print(out);
> out << std::flush;
> return out;
120c105
< #endif //PerfectSwitch_H
---
> #endif // __MEM_RUBY_NETWORK_SIMPLE_PERFECTSWITCH_HH__