Skip to content

Commit

Permalink
Adding flushing support to the vector uop generator
Browse files Browse the repository at this point in the history
  • Loading branch information
kathlenemagnus-mips committed Jul 15, 2024
1 parent 18c0475 commit 0a75b60
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
7 changes: 5 additions & 2 deletions core/Decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ namespace olympia
ILOG("Got a flush call for " << criteria);
fetch_queue_credits_outp_.send(fetch_queue_.size());
fetch_queue_.clear();

// Reset the vector uop generator
vec_uop_gen_->handleFlush(criteria);
}

// Decode instructions
Expand Down Expand Up @@ -268,9 +271,9 @@ namespace olympia
// Original instruction will act as the first UOp
inst->setUOpID(0); // set UOpID()

while(vec_uop_gen_->keepGoing())
while(vec_uop_gen_->getNumUopsRemaining() > 0)
{
const InstPtr uop = vec_uop_gen_->genUop();
const InstPtr uop = vec_uop_gen_->generateUop();
if (insts->size() < num_to_decode_)
{
insts->emplace_back(uop);
Expand Down
2 changes: 1 addition & 1 deletion core/IssueQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ namespace olympia
{
const auto srcs = ex_inst->getRenameData().getSourceList();
uint32_t ready = 0;
for(auto src : srcs)
for(const auto & src : srcs)
{
// vector-scalar operations have 1 vector src and 1 scalar src that
// need to be checked, so can't assume the register files are the
Expand Down
15 changes: 10 additions & 5 deletions core/VectorUopGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace olympia
}
}

const InstPtr VectorUopGenerator::genUop()
const InstPtr VectorUopGenerator::generateUop()
{
++num_uops_generated_;

Expand Down Expand Up @@ -82,13 +82,18 @@ namespace olympia
const uint32_t num_elems = current_VCSRs->vl / current_VCSRs->sew;
uop->setTail(num_elems < current_VCSRs->vlmax);

// Reset
current_inst_ = nullptr;
num_uops_generated_ = 0;
num_uops_to_generate_ = 0;
reset_();
}

ILOG("Generated uop: " << uop);
return uop;
}

void VectorUopGenerator::handleFlush(const FlushManager::FlushingCriteria & flush_criteria)
{
if(current_inst_ && flush_criteria.includedInFlush(current_inst_))
{
reset_();
}
}
} // namespace olympia
14 changes: 12 additions & 2 deletions core/VectorUopGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "sparta/simulation/ParameterSet.hpp"

#include "Inst.hpp"
#include "FlushManager.hpp"
#include "MavisUnit.hpp"

namespace olympia
Expand Down Expand Up @@ -41,9 +42,11 @@ namespace olympia

void setInst(const InstPtr & inst);

const InstPtr genUop();
const InstPtr generateUop();

bool keepGoing() const { return num_uops_to_generate_ > 1; }
uint64_t getNumUopsRemaining() const { return num_uops_to_generate_; }

void handleFlush(const FlushManager::FlushingCriteria &);

private:
MavisType * mavis_facade_;
Expand All @@ -53,5 +56,12 @@ namespace olympia

uint64_t num_uops_generated_ = 0;
uint64_t num_uops_to_generate_ = 0;

void reset_()
{
current_inst_ = nullptr;
num_uops_generated_ = 0;
num_uops_to_generate_ = 0;
}
};
} // namespace olympia

0 comments on commit 0a75b60

Please sign in to comment.