This patch supports cache flushing in MOESI_hammer

This commit is contained in:
Somayeh Sardashti
2011-03-28 10:49:45 -05:00
parent ef987a4064
commit c8bbfed937
14 changed files with 508 additions and 28 deletions

View File

@@ -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<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()
{

View File

@@ -58,6 +58,7 @@ class Check
void print(std::ostream& out) const;
private:
void initiateFlush();
void initiatePrefetch();
void initiateAction();
void initiateCheck();

View File

@@ -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;

View File

@@ -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&

View File

@@ -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")