Encapsulated gem5-specific code into wrapper functions to separate the build process (Fail: CMake, gem5: scons). Added some gem5-related FIXMEs. Another CMake related FIXME added. +some cosmetics. Change-Id: Id84b480127b1f13aed6a0ee97f3583f410d531c5
56 lines
1.1 KiB
C++
56 lines
1.1 KiB
C++
#include "Gem5Controller.hpp"
|
|
//#include "Gem5Connector.hpp"
|
|
|
|
#include "../Listener.hpp"
|
|
|
|
#include "Gem5Wrapper.hpp"
|
|
|
|
namespace fail {
|
|
|
|
void Gem5Controller::startup()
|
|
{
|
|
// Assuming there is only one defined system should be sufficient for most cases. More systems
|
|
// are only used for switching cpu model or caches during a simulation run.
|
|
m_System = GetSystemObject();
|
|
m_Mem = new Gem5MemoryManager(m_System);
|
|
|
|
int numCtxs = GetNumberOfContexts(m_System);
|
|
for (int i = 0; i < numCtxs; i++) {
|
|
ConcreteCPU* cpu = new ConcreteCPU(GetCPUId(m_System, i), m_System);
|
|
addCPU(cpu);
|
|
}
|
|
|
|
// TODO pass on command-line parameters
|
|
SimulatorController::startup();
|
|
}
|
|
|
|
Gem5Controller::~Gem5Controller()
|
|
{
|
|
std::vector<ConcreteCPU*>::iterator it = m_CPUs.begin();
|
|
while (it != m_CPUs.end()) {
|
|
delete *it;
|
|
it = m_CPUs.erase(it);
|
|
}
|
|
delete m_Mem;
|
|
}
|
|
|
|
bool Gem5Controller::save(const std::string &path)
|
|
{
|
|
// connector.save(path); // FIXME: not working?!
|
|
|
|
return true;
|
|
}
|
|
|
|
void Gem5Controller::restore(const std::string &path)
|
|
{
|
|
// connector.restore(path); // FIXME: not working?!
|
|
}
|
|
|
|
// TODO: Implement reboot
|
|
void Gem5Controller::reboot()
|
|
{
|
|
|
|
}
|
|
|
|
} // end-of-namespace: fail
|