Read before write in miss scenarios for FR_FCFS_RP
This commit is contained in:
@@ -49,8 +49,8 @@ std::pair<Command, gp*> FR_FCFS_RP::getNextRequest(Bank bank)
|
||||
// Order of Priority:
|
||||
// 1. Read Hits (Hazard Check)
|
||||
// 2. Write Hits
|
||||
// 3. Read Miss (Hazard Check) TODO
|
||||
// 4. Write Miss TODO
|
||||
// 3. Read Miss (Hazard Check)
|
||||
// 4. Write Miss
|
||||
|
||||
// 1. Seach for read hit:
|
||||
for(auto it = buffer[bank].begin(); it!=buffer[bank].end(); it++)
|
||||
@@ -66,13 +66,14 @@ std::pair<Command, gp*> FR_FCFS_RP::getNextRequest(Bank bank)
|
||||
if(hazardDetection(bank, it) == false)
|
||||
{
|
||||
buffer[bank].erase(it);
|
||||
printDebugMessage("Read Hit found");
|
||||
return pair<Command, gp*>(getReadWriteCommand(*read),read);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Seach for write hit:
|
||||
// 2. Search for write hit:
|
||||
for(auto it = buffer[bank].begin(); it!=buffer[bank].end(); it++)
|
||||
{
|
||||
gp* write = *it;
|
||||
@@ -84,14 +85,40 @@ std::pair<Command, gp*> FR_FCFS_RP::getNextRequest(Bank bank)
|
||||
== controllerCore.getRowBufferStates().getRowInRowBuffer(bank))
|
||||
{
|
||||
buffer[bank].erase(it);
|
||||
printDebugMessage("Write Hit found");
|
||||
return pair<Command, gp*>(getReadWriteCommand(*write),write);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// For now return the oldest request. TODO: do read first!
|
||||
return pair<Command, gp*>(getNextCommand(buffer[bank].front()),
|
||||
buffer[bank].front());
|
||||
// For now return the oldest request but prefere also reads before writes:
|
||||
|
||||
// 3. Search for read miss:
|
||||
for(auto it = buffer[bank].begin(); it!=buffer[bank].end(); it++)
|
||||
{
|
||||
gp* read = *it;
|
||||
|
||||
if(read->get_command() == tlm::TLM_READ_COMMAND)
|
||||
{
|
||||
if(hazardDetection(bank, it) == false)
|
||||
{
|
||||
printDebugMessage("Read miss found");
|
||||
return pair<Command, gp*>(getNextCommand(read),read);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Search for write miss:
|
||||
for(auto it = buffer[bank].begin(); it!=buffer[bank].end(); it++)
|
||||
{
|
||||
gp* write = *it;
|
||||
|
||||
if(write->get_command() == tlm::TLM_WRITE_COMMAND)
|
||||
{
|
||||
printDebugMessage("Write miss found");
|
||||
return pair<Command, gp*>(getNextCommand(write),write);
|
||||
}
|
||||
}
|
||||
|
||||
reportFatal("FR_FCFS_RP", "Never should go here ...");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user