tracerecorder, refresh and stuff

This commit is contained in:
robert
2014-03-29 00:26:21 +01:00
parent 35ba108cf7
commit 04e38d6663
40 changed files with 417 additions and 362 deletions

View File

@@ -14,43 +14,45 @@
namespace core {
DramController::DramController(IWrapperConnector& wrapperConnector):
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);
Controller::Controller(IWrapperConnector& wrapperConnector, TlmRecorder& recorder) :
config(), state(config.numberOfBanks, config.nActivate), busChecker(config, state), wrapper(
wrapperConnector), commandChecker(), recorder(recorder), savedState(
config.numberOfBanks, config.nActivate), commandSequenceGenerator(state), commandSequenceScheduler(
*this), refreshManager(*this)
commandChecker[Precharge] = new PrechargeChecker(config, state);
commandChecker[Read] = new ReadChecker(config, state);
commandChecker[Write] = new WriteChecker(config, state);
{
commandChecker[Command::Activate] = new ActivateChecker(config, state);
commandChecker[Command::Precharge] = new PrechargeChecker(config, state);
commandChecker[Command::Read] = new ReadChecker(config, state);
commandChecker[Command::Write] = new WriteChecker(config, state);
}
DramController::~DramController()
Controller::~Controller()
{
delete commandChecker[Activate];
delete commandChecker[Precharge];
delete commandChecker[Read];
delete commandChecker[Write];
delete commandChecker[Command::Activate];
delete commandChecker[Command::Precharge];
delete commandChecker[Command::Read];
delete commandChecker[Command::Write];
}
void DramController::saveState()
void Controller::saveState()
{
savedState = state;
}
void DramController::resetState()
void Controller::resetState()
{
state = savedState;
}
void DramController::scheduleRefresh(sc_time time)
void Controller::scheduleRefresh(tlm::tlm_generic_payload& payload, sc_time time)
{
cleanUpBus(time);
refreshManager.scheduleRefresh(time);
refreshManager.scheduleRefresh(payload, time);
}
bool DramController::schedule(sc_time start, tlm::tlm_generic_payload& payload)
bool Controller::schedule(sc_time start, tlm::tlm_generic_payload& payload)
{
cleanUpBus(start);
@@ -59,8 +61,7 @@ bool DramController::schedule(sc_time start, tlm::tlm_generic_payload& payload)
saveState();
CommandSequence sequence = commandSequenceGenerator.generateCommandSequence(
payload);
CommandSequence sequence = commandSequenceGenerator.generateCommandSequence(payload);
CommandSchedule schedule = commandSequenceScheduler.schedule(sequence, start, payload);
if (refreshManager.hasCollision(schedule))
@@ -70,21 +71,23 @@ bool DramController::schedule(sc_time start, tlm::tlm_generic_payload& payload)
}
else
{
schedule.record(recorder);
send(schedule);
return true;
}
}
bool DramController::isBusy(sc_time currentTime, Bank bank)
bool Controller::isBusy(sc_time currentTime, Bank bank)
{
ScheduledCommand lastScheduledCommand = state.getLastCommand(bank);
if(lastScheduledCommand.isNoCommand())
if (lastScheduledCommand.isNoCommand())
return false;
else if(lastScheduledCommand.getCommand() == Write || lastScheduledCommand.getCommand() == Read)
else if (lastScheduledCommand.getCommand() == Command::Write
|| lastScheduledCommand.getCommand() == Command::Read)
{
return (currentTime < lastScheduledCommand.getStart());
}
else if(lastScheduledCommand.getCommand() == Refresh)
else if (lastScheduledCommand.getCommand() == Command::AutoRefresh)
{
return (currentTime < lastScheduledCommand.getEnd());
}
@@ -96,16 +99,16 @@ bool DramController::isBusy(sc_time currentTime, Bank bank)
}
void DramController::send(const CommandSchedule& schedule) const
void Controller::send(const CommandSchedule& schedule) const
{
for(const ScheduledCommand& cmd : schedule.getScheduledCommands())
{
wrapper.send(cmd);
}
for (const ScheduledCommand& cmd : schedule.getScheduledCommands())
{
wrapper.send(cmd);
}
}
void DramController::cleanUpBus(sc_time currentTime)
void Controller::cleanUpBus(sc_time currentTime)
{
state.pendingBusCommands.erase(state.pendingBusCommands.begin(),
state.pendingBusCommands.lower_bound(currentTime));
@@ -113,4 +116,3 @@ void DramController::cleanUpBus(sc_time currentTime)
} /* namespace controller */