summaryrefslogtreecommitdiff
path: root/src/mem
diff options
context:
space:
mode:
authorXianwei Zhang <xianwei.zhang@amd.com>2018-09-19 19:14:40 -0400
committerXianwei Zhang <xianwei.zhang@amd.com>2018-09-24 21:06:38 +0000
commit9556aa3232ac6f782d715c15d2b4b62f5e7cfb9e (patch)
treed08e5ed64bcdb841509b647cb7d0ceee865c49ca /src/mem
parent7bfb7f3a43f382eb49853f47b140bfd6caad0fb8 (diff)
downloadgem5-9556aa3232ac6f782d715c15d2b4b62f5e7cfb9e.tar.xz
mem-ruby: Fix a bug in MessageBuffer randomization
In the previous implementation, messages are randomly inserted with delays only if both RubySystem and MessageBuffer randomization flags are set true. However, to find race conditions and cover more slicc transitions, ruby random testers rely on setting RubySystem flag to turn on randomization on all message buffers. As a fix, this patch enables a message buffer to have randomization when either RubySystem or its own flag is set. Change-Id: I1e076908ff07e5846ebad4f4fc1c8f28d40bbfd4 Reviewed-on: https://gem5-review.googlesource.com/12784 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/mem')
-rw-r--r--src/mem/ruby/network/MessageBuffer.cc4
-rw-r--r--src/mem/ruby/network/MessageBuffer.py5
-rw-r--r--src/mem/ruby/system/RubySystem.py4
3 files changed, 10 insertions, 3 deletions
diff --git a/src/mem/ruby/network/MessageBuffer.cc b/src/mem/ruby/network/MessageBuffer.cc
index f4eca3b1e..560b69c63 100644
--- a/src/mem/ruby/network/MessageBuffer.cc
+++ b/src/mem/ruby/network/MessageBuffer.cc
@@ -156,7 +156,9 @@ MessageBuffer::enqueue(MsgPtr message, Tick current_time, Tick delta)
assert(delta > 0);
Tick arrival_time = 0;
- if (!RubySystem::getRandomization() || !m_randomization) {
+ // random delays are inserted if either RubySystem level randomization flag
+ // is turned on, or the buffer level randomization is set
+ if (!RubySystem::getRandomization() && !m_randomization) {
// No randomization
arrival_time = current_time + delta;
} else {
diff --git a/src/mem/ruby/network/MessageBuffer.py b/src/mem/ruby/network/MessageBuffer.py
index d8a028532..b8a44ba91 100644
--- a/src/mem/ruby/network/MessageBuffer.py
+++ b/src/mem/ruby/network/MessageBuffer.py
@@ -37,7 +37,10 @@ class MessageBuffer(SimObject):
ordered = Param.Bool(False, "Whether the buffer is ordered")
buffer_size = Param.Unsigned(0, "Maximum number of entries to buffer \
(0 allows infinite entries)")
- randomization = Param.Bool(False, "")
+ randomization = Param.Bool(False, "Insert random delays on message \
+ enqueue times (enforced to have \
+ random delays if RubySystem \
+ randomization flag is True)")
master = MasterPort("Master port to MessageBuffer receiver")
slave = SlavePort("Slave port from MessageBuffer sender")
diff --git a/src/mem/ruby/system/RubySystem.py b/src/mem/ruby/system/RubySystem.py
index 358f4dfca..5dcfe2f81 100644
--- a/src/mem/ruby/system/RubySystem.py
+++ b/src/mem/ruby/system/RubySystem.py
@@ -35,7 +35,9 @@ class RubySystem(ClockedObject):
type = 'RubySystem'
cxx_header = "mem/ruby/system/RubySystem.hh"
randomization = Param.Bool(False,
- "insert random delays on message enqueue times");
+ "insert random delays on message enqueue times (if True, all message \
+ buffers are enforced to have randomization; otherwise, a message \
+ buffer set its own flag to enable/disable randomization)");
block_size_bytes = Param.UInt32(64,
"default cache block size; must be a power of two");
memory_size_bits = Param.UInt32(64,