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:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ public:
|
||||
|
||||
private:
|
||||
std::map<Thread, std::deque<gp*>> buffer;
|
||||
std::map<Bank, std::deque<gp*>> bankbuffer;
|
||||
|
||||
unsigned int SJFprobability;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user