Skip to content

Commit

Permalink
Add refill method to mem access info ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
h0lyalg0rithm committed May 13, 2024
1 parent e00c124 commit 5d88b38
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
12 changes: 6 additions & 6 deletions core/DCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ namespace olympia
const auto stage_id = static_cast<uint32_t>(PipelineStage::LOOKUP);
const MemoryAccessInfoPtr & mem_access_info_ptr = cache_pipeline_[stage_id];
ILOG(mem_access_info_ptr << " in Lookup stage");
if (incoming_cache_refill_ == mem_access_info_ptr)
// If the mem request is a refill we dont do anything in the lookup stage
if (mem_access_info_ptr->isRefill())
{
ILOG("Incoming cache refill " << mem_access_info_ptr);
return;
Expand Down Expand Up @@ -201,7 +202,7 @@ namespace olympia
const auto stage_id = static_cast<uint32_t>(PipelineStage::DATA_READ);
const MemoryAccessInfoPtr & mem_access_info_ptr = cache_pipeline_[stage_id];
ILOG(mem_access_info_ptr << " in read stage");
if (incoming_cache_refill_ == mem_access_info_ptr)
if (mem_access_info_ptr->isRefill())
{
reloadCache_(mem_access_info_ptr->getPhyAddr());
return;
Expand Down Expand Up @@ -256,10 +257,8 @@ namespace olympia
const auto stage_id = static_cast<uint32_t>(PipelineStage::DEALLOCATE);
const MemoryAccessInfoPtr & mem_access_info_ptr = cache_pipeline_[stage_id];
ILOG(mem_access_info_ptr << " in deallocate stage");
if (incoming_cache_refill_ == mem_access_info_ptr)
if (mem_access_info_ptr->isRefill())
{
ILOG("Refill complete " << incoming_cache_refill_);
incoming_cache_refill_.reset();
const auto & mshr_it = mem_access_info_ptr->getMSHRInfoIterator();
if (mshr_it.isValid())
{
Expand Down Expand Up @@ -295,8 +294,9 @@ namespace olympia
void DCache::receiveRespFromL2Cache_(const MemoryAccessInfoPtr & memory_access_info_ptr)
{
ILOG("Received cache refill " << memory_access_info_ptr);
// We mark the mem access to refill, this could be moved to the lower level caches later
memory_access_info_ptr->setIsRefill(true);
l2cache_busy_ = false;
incoming_cache_refill_ = memory_access_info_ptr;
cache_pipeline_.append(memory_access_info_ptr);
cache_refill_selected_ = false;
uev_free_pipeline_.schedule(1);
Expand Down
4 changes: 0 additions & 4 deletions core/DCache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ namespace olympia

uint64_t getBlockAddr(const MemoryAccessInfoPtr & mem_access_info_ptr) const;

// To arbitrate between incoming request from LSU and Cache refills from BIU
// bool incoming_cache_refill_ = false;
MemoryAccessInfoPtr incoming_cache_refill_ = nullptr;

using MSHREntryInfoPtr = sparta::SpartaSharedPointer<MSHREntryInfo>;
using MSHREntryIterator = sparta::Buffer<MSHREntryInfoPtr>::const_iterator;
// Ongoing Refill request
Expand Down
7 changes: 7 additions & 0 deletions core/MemoryAccessInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ namespace olympia
// Construct the State object here
cache_access_state_(CacheState::NO_ACCESS),
cache_data_ready_(false),
is_refill_(false),
src_(ArchUnit::NO_ACCESS),
dest_(ArchUnit::NO_ACCESS)
{
Expand Down Expand Up @@ -141,6 +142,10 @@ namespace olympia

const LoadStoreInstIterator getIssueQueueIterator() const { return issue_queue_iterator_; }

bool isRefill() const { return is_refill_; }

void setIsRefill(bool is_refill) { is_refill_ = is_refill; }

void setIssueQueueIterator(const LoadStoreInstIterator & iter)
{
issue_queue_iterator_ = iter;
Expand Down Expand Up @@ -180,6 +185,8 @@ namespace olympia
CacheState cache_access_state_;

bool cache_data_ready_;

bool is_refill_;
// Src and destination unit name for the packet
ArchUnit src_ = ArchUnit::NO_ACCESS;
ArchUnit dest_ = ArchUnit::NO_ACCESS;
Expand Down

0 comments on commit 5d88b38

Please sign in to comment.