PerfectSwitch.cc (10312:08f4deeb5b48) PerfectSwitch.cc (10348:c91b23c72d5e)
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;

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

24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <algorithm>
30
31#include "base/cast.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;

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

24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <algorithm>
30
31#include "base/cast.hh"
32#include "base/random.hh"
32#include "debug/RubyNetwork.hh"
33#include "mem/ruby/network/MessageBuffer.hh"
34#include "mem/ruby/network/simple/PerfectSwitch.hh"
35#include "mem/ruby/network/simple/SimpleNetwork.hh"
36#include "mem/ruby/network/simple/Switch.hh"
37#include "mem/ruby/slicc_interface/NetworkMessage.hh"
38
39using namespace std;

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

164 } else {
165 // Find how clogged each link is
166 for (int out = 0; out < m_out.size(); out++) {
167 int out_queue_length = 0;
168 for (int v = 0; v < m_virtual_networks; v++) {
169 out_queue_length += m_out[out][v]->getSize();
170 }
171 int value =
33#include "debug/RubyNetwork.hh"
34#include "mem/ruby/network/MessageBuffer.hh"
35#include "mem/ruby/network/simple/PerfectSwitch.hh"
36#include "mem/ruby/network/simple/SimpleNetwork.hh"
37#include "mem/ruby/network/simple/Switch.hh"
38#include "mem/ruby/slicc_interface/NetworkMessage.hh"
39
40using namespace std;

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

165 } else {
166 // Find how clogged each link is
167 for (int out = 0; out < m_out.size(); out++) {
168 int out_queue_length = 0;
169 for (int v = 0; v < m_virtual_networks; v++) {
170 out_queue_length += m_out[out][v]->getSize();
171 }
172 int value =
172 (out_queue_length << 8) | (random() & 0xff);
173 (out_queue_length << 8) |
174 random_mt.random(0, 0xff);
173 m_link_order[out].m_link = out;
174 m_link_order[out].m_value = value;
175 }
176
177 // Look at the most empty link first
178 sort(m_link_order.begin(), m_link_order.end());
179 }
180 }

--- 138 unchanged lines hidden ---
175 m_link_order[out].m_link = out;
176 m_link_order[out].m_value = value;
177 }
178
179 // Look at the most empty link first
180 sort(m_link_order.begin(), m_link_order.end());
181 }
182 }

--- 138 unchanged lines hidden ---