Files
DRAMSys/dram/src/core/Controller.h
2014-04-02 22:59:12 +02:00

65 lines
1.6 KiB
C++

/*
* controller.h
*
* Created on: Mar 5, 2014
* Author: jonny
*/
#ifndef CONTROLLER_H_
#define CONTROLLER_H_
#include <tlm.h>
#include <map>
#include "IWrapperConnector.h"
#include "Configuration.h"
#include "powerdown/IPowerDownManager.h"
#include "refresh/IRefreshManager.h"
#include "scheduling/CommandSequenceGenerator.h"
#include "scheduling/checker/ICommandChecker.h"
#include "scheduling/CommandSequenceScheduler.h"
#include "../common/TlmRecorder.h"
namespace core {
class Controller
{
public:
Controller(IWrapperConnector& wrapper, TlmRecorder& recorder);
virtual ~Controller() ;
bool scheduleRequest(sc_time currentTime, tlm::tlm_generic_payload& payload);
bool isBusy(sc_time currentTime, Bank bank);
void scheduleRefresh(tlm::tlm_generic_payload& payload, sc_time time);
const ICommandChecker& getChecker(Command command) const;
const BankStates& getBankStates(){return state.bankStates;}
void saveState();
void resetState();
BankGroup getBankGroup(Bank bank) const;
std::vector<Bank> getBanks() const;
void send(const CommandSchedule& schedule, tlm::tlm_generic_payload& payload) const;
Configuration config;
ControllerState state;
IWrapperConnector& wrapper;
std::map<Command, ICommandChecker*> commandChecker;
TlmRecorder& recorder;
IPowerDownManager* powerDownManager;
IRefreshManager* refreshManager;
private:
ControllerState savedState;
CommandSequenceGenerator commandSequenceGenerator;
CommandSequenceScheduler commandSequenceScheduler;
void addCommandChecker(Command command, ICommandChecker* checker);
};
} /* namespace controller */
#endif /* CONTROLLER_H_ */