Skip to content

Commit

Permalink
cpu-o3: write request will block dcache one cycle
Browse files Browse the repository at this point in the history
Change-Id: Iafccda7d47bce2a2fe6fbe37b8fc84dc8cde1c2b
  • Loading branch information
tastynoob committed Jan 13, 2025
1 parent d6062b9 commit 449ae92
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/cpu/o3/lsq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ LSQ::clearAddresses(Tick time)
bool
LSQ::bankConflictedCheck(Addr vaddr)
{
if (dcacheWriteStall) {
return true;
}
bool now_bank_conflict = false;
// 64KB Dcache 8way 128sets
// [12:6] [5:3] [2:0]
Expand Down
5 changes: 5 additions & 0 deletions src/cpu/o3/lsq.hh
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,10 @@ class LSQ

bool bankConflictedCheck(Addr vaddr);

void setDcacheWriteStall(bool stall) { dcacheWriteStall = stall; }

bool getDcacheWriteStall() { return dcacheWriteStall; }

/** Is D-cache blocked? */
bool cacheBlocked() const;
/** Set D-cache blocked status */
Expand All @@ -975,6 +979,7 @@ class LSQ

Tick lastConflictCheckTick;

bool dcacheWriteStall = false;
std::vector<int64_t> l1dBankAddresses;
struct NullStruct {};
boost::compute::detail::lru_cache<uint64_t, NullStruct> recentlyloadAddr;
Expand Down
15 changes: 10 additions & 5 deletions src/cpu/o3/lsq_unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1404,16 +1404,20 @@ bool LSQUnit::insertStoreBuffer(Addr vaddr, Addr paddr, uint8_t* datas, uint64_t
void
LSQUnit::storeBufferEvictToCache()
{
if (isStoreBlocked) {
return;
}
if (storeBuffer.size() == 0) {
if (storeBufferFlushing && storeBuffer.size() == 0) [[unlikely]] {
assert(storeBuffer.unsentSize() == 0);
storeBufferFlushing = false;
cpu->activityThisCycle();
}

// write request will stall one cycle
// so 2 cycle send one write request
if (lsq->getDcacheWriteStall()) {
lsq->setDcacheWriteStall(false);
return;
}
if (storeBuffer.unsentSize() == 0) {

if (isStoreBlocked || storeBuffer.unsentSize() == 0) {
return;
}

Expand Down Expand Up @@ -1470,6 +1474,7 @@ LSQUnit::storeBufferEvictToCache()
}
DPRINTF(StoreBuffer, "send packet successed\n");
entry->sending = true;
lsq->setDcacheWriteStall(true);
storeBufferWritebackInactive = 0;
} else {
// Timeout
Expand Down

0 comments on commit 449ae92

Please sign in to comment.