...
This commit is contained in:
@@ -13,7 +13,7 @@ namespace core {
|
||||
|
||||
const ScheduledCommand ControllerState::getLastCommand(Command command, Bank bank) //TODO const reference? and make const
|
||||
{
|
||||
return lastCommandsOnBus[command][bank];
|
||||
return lastScheduledByCommandAndBank[command][bank];
|
||||
}
|
||||
|
||||
const ScheduledCommand ControllerState::getLastCommand(Command command)
|
||||
@@ -26,6 +26,7 @@ const ScheduledCommand ControllerState::getLastCommand(Command command)
|
||||
if (current.getStart() > max.getStart())
|
||||
max = current;
|
||||
}
|
||||
|
||||
return max;
|
||||
}
|
||||
|
||||
@@ -37,7 +38,7 @@ const ScheduledCommand ControllerState::getLastScheduledCommand()
|
||||
{
|
||||
for(Bank bank : Configuration::getInstance().getBanks())
|
||||
{
|
||||
ScheduledCommand& current = lastCommandsOnBus[cmd][bank];
|
||||
ScheduledCommand& current = lastScheduledByCommandAndBank[cmd][bank];
|
||||
if (current.getStart() > lastCommand.getStart())
|
||||
lastCommand = current;
|
||||
}
|
||||
@@ -52,7 +53,7 @@ const ScheduledCommand ControllerState::getLastScheduledCommand(Bank bank)
|
||||
|
||||
for(Command cmd : getAllCommands())
|
||||
{
|
||||
ScheduledCommand& current = lastCommandsOnBus[cmd][bank];
|
||||
ScheduledCommand& current = lastScheduledByCommandAndBank[cmd][bank];
|
||||
if (current.getStart() > lastCommand.getStart())
|
||||
lastCommand = current;
|
||||
}
|
||||
@@ -64,7 +65,13 @@ void ControllerState::change(const ScheduledCommand& scheduledCommand)
|
||||
{
|
||||
//TODO double check if slot free?
|
||||
bus.blockSlot(scheduledCommand.getStart());
|
||||
lastCommandsOnBus[scheduledCommand.getCommand()][scheduledCommand.getBank()] = scheduledCommand;
|
||||
|
||||
// if(getLastCommand(scheduledCommand.getCommand()).getStart() > scheduledCommand.getStart())
|
||||
// cout << commandToString(scheduledCommand.getCommand()) << " wurde vorgezogen! " << std::endl;
|
||||
|
||||
lastScheduledByCommandAndBank[scheduledCommand.getCommand()][scheduledCommand.getBank()] = scheduledCommand;
|
||||
//lastScheduledByBank[scheduledCommand.getCommand()] = scheduledCommand;
|
||||
|
||||
|
||||
switch (scheduledCommand.getCommand())
|
||||
{
|
||||
@@ -100,12 +107,22 @@ void ControllerState::change(const ScheduledCommand& scheduledCommand)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// cout << "Last Data Strobe Commands Size: " << lastDataStrobeCommands.size() << std::endl;
|
||||
// cout << "Last Activates Size: " << lastActivates.size() << std::endl;
|
||||
// cout << "Bus Slots: " << bus.slotSet.size();
|
||||
}
|
||||
|
||||
void ControllerState::cleanUp(sc_time time)
|
||||
{
|
||||
bus.cleanUpSlots(time);
|
||||
lastDataStrobeCommands.remove_if([&](ScheduledCommand command){return command.getEnd() < time && getDistance(command.getEnd(), time) > config->Timings.tDataStrobeHistory();});
|
||||
vector<ScheduledCommand> tmp;
|
||||
for(ScheduledCommand& command: lastDataStrobeCommands)
|
||||
{
|
||||
if(command.getEnd() >= time || getDistance(command.getEnd(), time) <= config->Timings.tDataStrobeHistory())
|
||||
tmp.push_back(command);
|
||||
}
|
||||
lastDataStrobeCommands = tmp;
|
||||
lastActivates.erase(lastActivates.begin(), lastActivates.lower_bound(time - config->Timings.tActHistory()));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user