Files
DRAMSys/DRAM/dram/core/scheduling/CommandBus.h
2014-03-15 18:31:16 +01:00

56 lines
1.7 KiB
C++

/*
* InternalScheduler.h
*
* Created on: Mar 6, 2014
* Author: jonny
*/
#ifndef INTERNALSCHEDULER_H_
#define INTERNALSCHEDULER_H_
#include "CommandSchedule.h"
#include "core/ControllerState.h"
#include "core/scheduling/Trigger.h"
#include "IInternalScheduler.h"
#include "core/Configuration.h"
#include "core/scheduling/checker/ICommandChecker.h"
#include <map>
#include <set>
namespace controller{
class CommandBus : public IInternalScheduler
{
public:
CommandBus(const Configuration& config, controller::ControllerState& state,std::vector<ICommandChecker*>& checker) : config(config), state(state), checker(checker) {}
virtual void schedule(const CommandSchedule& schedule);//TODO add to interface
virtual void scheduleCommand(const ScheduledCommand& command);
virtual void scheduleTrigger(const Trigger trigger, sc_time time);
void cleanUpBus(sc_time currentTime);
ScheduledCommand& getLastCommand(Command command, Bank bank);//TODO simple way to make it const?
ScheduledCommand& getLastCommand(Command command);
bool notYetScheduled(Command command) const;
bool notYetScheduled(Command command, Bank bank) const;
sc_time getEarliestStartTime(const ScheduledCommand& command) const;
const std::set<sc_time>& getPendingBusCommands() const {return pendingBusCommands;}
private:
const Configuration& config;
controller::ControllerState& state;
std::vector<ICommandChecker*>& checker;
std::map<Command,std::map<Bank, ScheduledCommand> > lastCommandsOnBus;
std::set<sc_time> pendingBusCommands;
void changeControllerState(const ScheduledCommand& command);
void refresh(const ScheduledCommand& command);
void precharge(const ScheduledCommand& command);
void activate(const ScheduledCommand& command);
};
}
#endif /* INTERNALSCHEDULER_H_ */