summaryrefslogtreecommitdiff
path: root/src/cpu/testers/rubytest/Check.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu/testers/rubytest/Check.cc')
-rw-r--r--src/cpu/testers/rubytest/Check.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/cpu/testers/rubytest/Check.cc b/src/cpu/testers/rubytest/Check.cc
index b2b679018..126deba6d 100644
--- a/src/cpu/testers/rubytest/Check.cc
+++ b/src/cpu/testers/rubytest/Check.cc
@@ -27,6 +27,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "base/random.hh"
#include "cpu/testers/rubytest/Check.hh"
#include "debug/RubyTest.hh"
#include "mem/ruby/common/SubBlock.hh"
@@ -46,7 +47,8 @@ Check::Check(const Address& address, const Address& pc,
pickInitiatingNode();
changeAddress(address);
m_pc = pc;
- m_access_mode = RubyAccessMode(random() % RubyAccessMode_NUM);
+ m_access_mode = RubyAccessMode(random_mt.random(0,
+ RubyAccessMode_NUM - 1));
m_store_count = 0;
}
@@ -57,11 +59,11 @@ Check::initiate()
debugPrint();
// currently no protocols support prefetches
- if (false && (random() & 0xf) == 0) {
+ if (false && (random_mt.random(0, 0xf) == 0)) {
initiatePrefetch(); // Prefetch from random processor
}
- if (m_tester_ptr->getCheckFlush() && (random() & 0xff) == 0) {
+ if (m_tester_ptr->getCheckFlush() && (random_mt.random(0, 0xff) == 0)) {
initiateFlush(); // issue a Flush request from random processor
}
@@ -81,7 +83,7 @@ Check::initiatePrefetch()
{
DPRINTF(RubyTest, "initiating prefetch\n");
- int index = random() % m_num_readers;
+ int index = random_mt.random(0, m_num_readers - 1);
MasterPort* port = m_tester_ptr->getReadableCpuPort(index);
Request::Flags flags;
@@ -90,7 +92,7 @@ Check::initiatePrefetch()
Packet::Command cmd;
// 1 in 8 chance this will be an exclusive prefetch
- if ((random() & 0x7) != 0) {
+ if (random_mt.random(0, 0x7) != 0) {
cmd = MemCmd::ReadReq;
// if necessary, make the request an instruction fetch
@@ -132,7 +134,7 @@ Check::initiateFlush()
DPRINTF(RubyTest, "initiating Flush\n");
- int index = random() % m_num_writers;
+ int index = random_mt.random(0, m_num_writers - 1);
MasterPort* port = m_tester_ptr->getWritableCpuPort(index);
Request::Flags flags;
@@ -161,7 +163,7 @@ Check::initiateAction()
DPRINTF(RubyTest, "initiating Action\n");
assert(m_status == TesterStatus_Idle);
- int index = random() % m_num_writers;
+ int index = random_mt.random(0, m_num_writers - 1);
MasterPort* port = m_tester_ptr->getWritableCpuPort(index);
Request::Flags flags;
@@ -222,7 +224,7 @@ Check::initiateCheck()
DPRINTF(RubyTest, "Initiating Check\n");
assert(m_status == TesterStatus_Ready);
- int index = random() % m_num_readers;
+ int index = random_mt.random(0, m_num_readers - 1);
MasterPort* port = m_tester_ptr->getReadableCpuPort(index);
Request::Flags flags;
@@ -339,7 +341,7 @@ Check::pickValue()
{
assert(m_status == TesterStatus_Idle);
m_status = TesterStatus_Idle;
- m_value = random() & 0xff; // One byte
+ m_value = random_mt.random(0, 0xff); // One byte
m_store_count = 0;
}
@@ -348,7 +350,7 @@ Check::pickInitiatingNode()
{
assert(m_status == TesterStatus_Idle || m_status == TesterStatus_Ready);
m_status = TesterStatus_Idle;
- m_initiatingNode = (random() % m_num_writers);
+ m_initiatingNode = (random_mt.random(0, m_num_writers - 1));
DPRINTF(RubyTest, "picked initiating node %d\n", m_initiatingNode);
m_store_count = 0;
}