Bankwise Refresh Manager and some minor refactoring fun
This commit is contained in:
@@ -15,8 +15,8 @@
|
||||
namespace core {
|
||||
|
||||
DramController::DramController(IWrapperConnector& wrapperConnector):
|
||||
config(),state(config.numberOfBanks, config.nActivate), savedState(config.numberOfBanks, config.nActivate), commandSequenceGenerator(state), commandChecker(), commandSequenceScheduler(
|
||||
bus, commandChecker), bus(wrapperConnector, config, state), refreshManager(bus, config.Timings.refreshTimings)
|
||||
config(),state(config.numberOfBanks, config.nActivate), savedState(config.numberOfBanks, config.nActivate), commandSequenceGenerator(state), commandChecker(), busChecker(config, state), commandSequenceScheduler(
|
||||
*this), refreshManager(*this), wrapper(wrapperConnector)
|
||||
{
|
||||
commandChecker[Activate] = new ActivateChecker(config, state);
|
||||
|
||||
@@ -46,12 +46,13 @@ void DramController::resetState()
|
||||
|
||||
void DramController::scheduleRefresh(sc_time time)
|
||||
{
|
||||
cleanUpBus(time);
|
||||
refreshManager.scheduleRefresh(time);
|
||||
}
|
||||
|
||||
bool DramController::schedule(sc_time start, tlm::tlm_generic_payload& payload)
|
||||
{
|
||||
bus.cleanUpBus(start);
|
||||
cleanUpBus(start);
|
||||
|
||||
start = clkAlign(start, config.Timings.clk);
|
||||
payload.set_streaming_width(config.burstlength);
|
||||
@@ -69,12 +70,12 @@ bool DramController::schedule(sc_time start, tlm::tlm_generic_payload& payload)
|
||||
}
|
||||
else
|
||||
{
|
||||
bus.send(schedule);
|
||||
send(schedule);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool core::DramController::isBusy(sc_time currentTime, Bank bank)
|
||||
bool DramController::isBusy(sc_time currentTime, Bank bank)
|
||||
{
|
||||
ScheduledCommand lastScheduledCommand = state.getLastCommand(bank);
|
||||
if(lastScheduledCommand.isNoCommand())
|
||||
@@ -95,6 +96,21 @@ bool core::DramController::isBusy(sc_time currentTime, Bank bank)
|
||||
|
||||
}
|
||||
|
||||
void DramController::send(const CommandSchedule& schedule) const
|
||||
{
|
||||
for(const ScheduledCommand& cmd : schedule.getScheduledCommands())
|
||||
{
|
||||
wrapper.send(cmd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DramController::cleanUpBus(sc_time currentTime)
|
||||
{
|
||||
state.pendingBusCommands.erase(state.pendingBusCommands.begin(),
|
||||
state.pendingBusCommands.lower_bound(currentTime));
|
||||
}
|
||||
|
||||
} /* namespace controller */
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user