summaryrefslogtreecommitdiff
path: root/src/cpu
diff options
context:
space:
mode:
authorSomayeh Sardashti <somayeh@cs.wisc.edu>2011-03-28 10:49:45 -0500
committerSomayeh Sardashti <somayeh@cs.wisc.edu>2011-03-28 10:49:45 -0500
commitc8bbfed93752c2c79d36bb9dedbc2208b856dae6 (patch)
treec33a164e435603a4424f81f7f09ec50b5f01e455 /src/cpu
parentef987a4064f1e81fd1b61f3de03834a51658645f (diff)
downloadgem5-c8bbfed93752c2c79d36bb9dedbc2208b856dae6.tar.xz
This patch supports cache flushing in MOESI_hammer
Diffstat (limited to 'src/cpu')
-rw-r--r--src/cpu/testers/rubytest/Check.cc35
-rw-r--r--src/cpu/testers/rubytest/Check.hh1
-rw-r--r--src/cpu/testers/rubytest/RubyTester.cc3
-rw-r--r--src/cpu/testers/rubytest/RubyTester.hh2
-rw-r--r--src/cpu/testers/rubytest/RubyTester.py1
5 files changed, 41 insertions, 1 deletions
diff --git a/src/cpu/testers/rubytest/Check.cc b/src/cpu/testers/rubytest/Check.cc
index 9eed7270b..b536e2287 100644
--- a/src/cpu/testers/rubytest/Check.cc
+++ b/src/cpu/testers/rubytest/Check.cc
@@ -59,6 +59,10 @@ Check::initiate()
initiatePrefetch(); // Prefetch from random processor
}
+ if (m_tester_ptr->getCheckFlush() && (random() & 0xff) == 0) {
+ initiateFlush(); // issue a Flush request from random processor
+ }
+
if (m_status == TesterStatus_Idle) {
initiateAction();
} else if (m_status == TesterStatus_Ready) {
@@ -124,6 +128,37 @@ Check::initiatePrefetch()
}
void
+Check::initiateFlush()
+{
+
+ DPRINTF(RubyTest, "initiating Flush\n");
+
+ int index = random() % m_num_cpu_sequencers;
+ RubyTester::CpuPort* port =
+ safe_cast<RubyTester::CpuPort*>(m_tester_ptr->getCpuPort(index));
+
+ Request::Flags flags;
+
+ Request *req = new Request(m_address.getAddress(), CHECK_SIZE, flags, curTick(),
+ m_pc.getAddress());
+
+ Packet::Command cmd;
+
+ cmd = MemCmd::FlushReq;
+
+ PacketPtr pkt = new Packet(req, cmd, port->idx);
+
+ // push the subblock onto the sender state. The sequencer will
+ // update the subblock on the return
+ pkt->senderState =
+ new SenderState(m_address, req->getSize(), pkt->senderState);
+
+ if (port->sendTiming(pkt)) {
+ DPRINTF(RubyTest, "initiating Flush - successful\n");
+ }
+}
+
+void
Check::initiateAction()
{
DPRINTF(RubyTest, "initiating Action\n");
diff --git a/src/cpu/testers/rubytest/Check.hh b/src/cpu/testers/rubytest/Check.hh
index d16c10f57..6861a74d3 100644
--- a/src/cpu/testers/rubytest/Check.hh
+++ b/src/cpu/testers/rubytest/Check.hh
@@ -58,6 +58,7 @@ class Check
void print(std::ostream& out) const;
private:
+ void initiateFlush();
void initiatePrefetch();
void initiateAction();
void initiateCheck();
diff --git a/src/cpu/testers/rubytest/RubyTester.cc b/src/cpu/testers/rubytest/RubyTester.cc
index 1d477dad2..024cb741e 100644
--- a/src/cpu/testers/rubytest/RubyTester.cc
+++ b/src/cpu/testers/rubytest/RubyTester.cc
@@ -40,7 +40,8 @@ RubyTester::RubyTester(const Params *p)
: MemObject(p), checkStartEvent(this),
m_checks_to_complete(p->checks_to_complete),
m_deadlock_threshold(p->deadlock_threshold),
- m_wakeup_frequency(p->wakeup_frequency)
+ m_wakeup_frequency(p->wakeup_frequency),
+ m_check_flush(p->check_flush)
{
m_checks_completed = 0;
diff --git a/src/cpu/testers/rubytest/RubyTester.hh b/src/cpu/testers/rubytest/RubyTester.hh
index ac023b43f..4ea5bda73 100644
--- a/src/cpu/testers/rubytest/RubyTester.hh
+++ b/src/cpu/testers/rubytest/RubyTester.hh
@@ -99,6 +99,7 @@ class RubyTester : public MemObject
void printConfig(std::ostream& out) const {}
void print(std::ostream& out) const;
+ bool getCheckFlush() { return m_check_flush; }
protected:
class CheckStartEvent : public Event
@@ -134,6 +135,7 @@ class RubyTester : public MemObject
int m_deadlock_threshold;
int m_num_cpu_sequencers;
int m_wakeup_frequency;
+ bool m_check_flush;
};
inline std::ostream&
diff --git a/src/cpu/testers/rubytest/RubyTester.py b/src/cpu/testers/rubytest/RubyTester.py
index af37d2ff1..fd6e9aefd 100644
--- a/src/cpu/testers/rubytest/RubyTester.py
+++ b/src/cpu/testers/rubytest/RubyTester.py
@@ -36,3 +36,4 @@ class RubyTester(MemObject):
checks_to_complete = Param.Int(100, "checks to complete")
deadlock_threshold = Param.Int(50000, "how often to check for deadlock")
wakeup_frequency = Param.Int(10, "number of cycles between wakeups")
+ check_flush = Param.Bool(False, "check cache flushing")