PerfectSwitch.hh (9117:49116b947194) PerfectSwitch.hh (9274:ba635023d4bb)
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 27 unchanged lines hidden (view full) ---

36#ifndef __MEM_RUBY_NETWORK_SIMPLE_PERFECTSWITCH_HH__
37#define __MEM_RUBY_NETWORK_SIMPLE_PERFECTSWITCH_HH__
38
39#include <iostream>
40#include <string>
41#include <vector>
42
43#include "mem/ruby/common/Consumer.hh"
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 27 unchanged lines hidden (view full) ---

36#ifndef __MEM_RUBY_NETWORK_SIMPLE_PERFECTSWITCH_HH__
37#define __MEM_RUBY_NETWORK_SIMPLE_PERFECTSWITCH_HH__
38
39#include <iostream>
40#include <string>
41#include <vector>
42
43#include "mem/ruby/common/Consumer.hh"
44#include "mem/ruby/common/Global.hh"
45
46class MessageBuffer;
47class NetDest;
48class SimpleNetwork;
44
45class MessageBuffer;
46class NetDest;
47class SimpleNetwork;
48class Switch;
49
50struct LinkOrder
51{
52 int m_link;
53 int m_value;
54};
55
56class PerfectSwitch : public Consumer
57{
58 public:
49
50struct LinkOrder
51{
52 int m_link;
53 int m_value;
54};
55
56class PerfectSwitch : public Consumer
57{
58 public:
59 PerfectSwitch(SwitchID sid, SimpleNetwork* network_ptr);
59 PerfectSwitch(SwitchID sid, Switch *, uint32_t);
60 ~PerfectSwitch();
61
62 std::string name()
63 { return csprintf("PerfectSwitch-%i", m_switch_id); }
64
60 ~PerfectSwitch();
61
62 std::string name()
63 { return csprintf("PerfectSwitch-%i", m_switch_id); }
64
65 void init(SimpleNetwork *);
65 void addInPort(const std::vector<MessageBuffer*>& in);
66 void addOutPort(const std::vector<MessageBuffer*>& out,
67 const NetDest& routing_table_entry);
68 void clearRoutingTables();
69 void clearBuffers();
70 void reconfigureOutPort(const NetDest& routing_table_entry);
71 int getInLinks() const { return m_in.size(); }
72 int getOutLinks() const { return m_out.size(); }

--- 12 unchanged lines hidden (view full) ---

85
86 SwitchID m_switch_id;
87
88 // vector of queues from the components
89 std::vector<std::vector<MessageBuffer*> > m_in;
90 std::vector<std::vector<MessageBuffer*> > m_out;
91 std::vector<NetDest> m_routing_table;
92 std::vector<LinkOrder> m_link_order;
66 void addInPort(const std::vector<MessageBuffer*>& in);
67 void addOutPort(const std::vector<MessageBuffer*>& out,
68 const NetDest& routing_table_entry);
69 void clearRoutingTables();
70 void clearBuffers();
71 void reconfigureOutPort(const NetDest& routing_table_entry);
72 int getInLinks() const { return m_in.size(); }
73 int getOutLinks() const { return m_out.size(); }

--- 12 unchanged lines hidden (view full) ---

86
87 SwitchID m_switch_id;
88
89 // vector of queues from the components
90 std::vector<std::vector<MessageBuffer*> > m_in;
91 std::vector<std::vector<MessageBuffer*> > m_out;
92 std::vector<NetDest> m_routing_table;
93 std::vector<LinkOrder> m_link_order;
93 int m_virtual_networks;
94
95 uint32_t m_virtual_networks;
94 int m_round_robin_start;
95 int m_wakeups_wo_switch;
96 int m_round_robin_start;
97 int m_wakeups_wo_switch;
98
96 SimpleNetwork* m_network_ptr;
97 std::vector<int> m_pending_message_count;
98};
99
100inline std::ostream&
101operator<<(std::ostream& out, const PerfectSwitch& obj)
102{
103 obj.print(out);
104 out << std::flush;
105 return out;
106}
107
108#endif // __MEM_RUBY_NETWORK_SIMPLE_PERFECTSWITCH_HH__
99 SimpleNetwork* m_network_ptr;
100 std::vector<int> m_pending_message_count;
101};
102
103inline std::ostream&
104operator<<(std::ostream& out, const PerfectSwitch& obj)
105{
106 obj.print(out);
107 out << std::flush;
108 return out;
109}
110
111#endif // __MEM_RUBY_NETWORK_SIMPLE_PERFECTSWITCH_HH__