diff options
Diffstat (limited to 'src/mem/ruby/network')
-rw-r--r-- | src/mem/ruby/network/MessageBuffer.cc | 7 | ||||
-rw-r--r-- | src/mem/ruby/network/simple/PerfectSwitch.cc | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/mem/ruby/network/MessageBuffer.cc b/src/mem/ruby/network/MessageBuffer.cc index 1961765c5..1bc55c2c9 100644 --- a/src/mem/ruby/network/MessageBuffer.cc +++ b/src/mem/ruby/network/MessageBuffer.cc @@ -30,6 +30,7 @@ #include "base/cprintf.hh" #include "base/misc.hh" +#include "base/random.hh" #include "base/stl_helpers.hh" #include "debug/RubyQueue.hh" #include "mem/ruby/network/MessageBuffer.hh" @@ -133,9 +134,9 @@ Cycles random_time() { Cycles time(1); - time += Cycles(random() & 0x3); // [0...3] - if ((random() & 0x7) == 0) { // 1 in 8 chance - time += Cycles(100 + (random() % 0xf)); // 100 + [1...15] + time += Cycles(random_mt.random(0, 3)); // [0...3] + if (random_mt.random(0, 7) == 0) { // 1 in 8 chance + time += Cycles(100 + random_mt.random(1, 15)); // 100 + [1...15] } return time; } diff --git a/src/mem/ruby/network/simple/PerfectSwitch.cc b/src/mem/ruby/network/simple/PerfectSwitch.cc index fa0709496..caf07b3cf 100644 --- a/src/mem/ruby/network/simple/PerfectSwitch.cc +++ b/src/mem/ruby/network/simple/PerfectSwitch.cc @@ -29,6 +29,7 @@ #include <algorithm> #include "base/cast.hh" +#include "base/random.hh" #include "debug/RubyNetwork.hh" #include "mem/ruby/network/MessageBuffer.hh" #include "mem/ruby/network/simple/PerfectSwitch.hh" @@ -169,7 +170,8 @@ PerfectSwitch::operateVnet(int vnet) out_queue_length += m_out[out][v]->getSize(); } int value = - (out_queue_length << 8) | (random() & 0xff); + (out_queue_length << 8) | + random_mt.random(0, 0xff); m_link_order[out].m_link = out; m_link_order[out].m_value = value; } |