From c8bbfed93752c2c79d36bb9dedbc2208b856dae6 Mon Sep 17 00:00:00 2001 From: Somayeh Sardashti Date: Mon, 28 Mar 2011 10:49:45 -0500 Subject: This patch supports cache flushing in MOESI_hammer --- src/cpu/testers/rubytest/Check.cc | 35 ++++++++++++++++++++++++++++++++++ src/cpu/testers/rubytest/Check.hh | 1 + src/cpu/testers/rubytest/RubyTester.cc | 3 ++- src/cpu/testers/rubytest/RubyTester.hh | 2 ++ src/cpu/testers/rubytest/RubyTester.py | 1 + 5 files changed, 41 insertions(+), 1 deletion(-) (limited to 'src/cpu/testers/rubytest') 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) { @@ -123,6 +127,37 @@ Check::initiatePrefetch() } } +void +Check::initiateFlush() +{ + + DPRINTF(RubyTest, "initiating Flush\n"); + + int index = random() % m_num_cpu_sequencers; + RubyTester::CpuPort* port = + safe_cast(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() { 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") -- cgit v1.2.3