Hello everyone,
I try to write back all dirty blocks from the last level cache to main memory
without evicting any dirty blocks from the last level cache (cleaning dirty
blocks in LLC). To accomplish this, I plan to use the memwriteback() function.
How can I ensure that only dirty blocks from the last level cache are written
back and dirty blocks from other cache levels are not written back?
void Cache::memWriteback()
{
CacheBlkVisitorWrapper visitor(\*this, &Cache::writebackVisitor);
tags->forEachBlk(visitor);
}
////
bool Cache::writebackVisitor(CacheBlk &blk)
{
if (blk.isDirty()) {
assert(blk.isValid());
Request request(tags->regenerateBlkAddr(blk.tag, blk.set),
blkSize, 0, Request::funcMasterId);
request.taskId(blk.task_id);
if (blk.isSecure()) {
request.setFlags(Request::SECURE);
}
Packet packet(&request, MemCmd::WriteReq);
packet.dataStatic(blk.data);
memSidePort->sendFunctional(&packet);
blk.status &= \~BlkDirty;
}
return true;
}
_______________________________________________
gem5-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]