Implement getNextRequest

# Explain what has been changed

# Explain why this change is being made

# Provide links to any relevant tickets, articles or other resources
This commit is contained in:
Thanh C. Tran
2017-02-23 21:14:30 +01:00
parent 4ed7ff420b
commit 2cfa7114af
2 changed files with 21 additions and 3 deletions

View File

@@ -2,12 +2,28 @@
using namespace std;
void SMS::schedule (gp *payload)
void SMS::schedule(gp *payload)
{
buffer[DramExtension::getExtension(payload).getThread()].emplace_back(payload);
buffer[DramExtension::getExtension(payload).getThread()].emplace_back(payload);
}
std::pair<Command, gp*> SMS::getNextRequest(Bank bank)
{
return pair<Command, tlm::tlm_generic_payload*>(Command::NOP, NULL);
if (bankbuffer[bank].empty())
{
return pair<Command, tlm::tlm_generic_payload*>(Command::NOP, NULL);
}
else
{
gp* payload = bankbuffer[bank].front();
Command command = IScheduler::getNextCommand(*payload);
if (command == Command::Read || command == Command::ReadA || command == Command::Write
|| command == Command::WriteA)
{
bankbuffer[bank].pop_front();
}
return pair<Command, tlm::tlm_generic_payload*>(command, payload);
}
}

View File

@@ -18,6 +18,8 @@ public:
private:
std::map<Thread, std::deque<gp*>> buffer;
std::map<Bank, std::deque<gp*>> bankbuffer;
unsigned int SJFprobability;
};