changed project structure to qtcreator, added timed out powerdown

This commit is contained in:
robert
2014-05-07 17:22:20 +02:00
parent 00f95b1587
commit c5512389da
114 changed files with 2324 additions and 9246 deletions

View File

@@ -0,0 +1,144 @@
/*
* Utils.cpp
*
* Created on: Mar 12, 2014
* Author: jonny
*/
#include "TimingCalculation.h"
#include "configuration/TimingConfiguration.h"
#include "ControllerCore.h"
#include "../../common/DebugManager.h"
#include "configuration/Configuration.h"
#include "../../common/Utils.h"
namespace core {
sc_time getDistance(sc_time a, sc_time b)
{
if (a > b)
return a - b;
else
return b - a;
}
sc_time getDelayToMeetConstraint(sc_time previous, sc_time start, sc_time constraint)
{
if (previous + constraint > start)
return previous + constraint - start;
else
return SC_ZERO_TIME;
}
const sc_time clkAlign(sc_time time, Alignment alignment)
{
sc_time clk = Configuration::getInstance().Timings.clk;
if (alignment == UP)
return ceil(time / clk) * clk;
else
return floor(time / clk) * clk;
}
sc_time getExecutionTime(Command command, tlm::tlm_generic_payload& payload)
{
TimingConfiguration& config = Configuration::getInstance().Timings;
if (command == Command::Precharge || command == Command::PrechargeAll)
{
return config.tRP;
}
else if (command == Command::Activate)
{
return config.tRCD;
}
else if (command == Command::Read)
{
return config.tRL + getReadAccessTime();
}
else if (command == Command::ReadA)
{
return config.tRTP + config.tRP;
}
else if (command == Command::Write)
{
return config.tWL + getWriteAccessTime();
}
else if (command == Command::WriteA)
{
return config.tWL + getWriteAccessTime() + config.tWR + config.tRP;
}
else if (command == Command::PrechargeAll)
{
return config.tRP;
}
else if (command == Command::AutoRefresh)
{
return getElementFromMap(config.refreshTimings, DramExtension::getExtension(payload).getBank()).tRFC;
}
else if (command == Command::PDNAX || command == Command::PDNPX || command == Command::SREFX)
{
return config.clk;
}
else
{
SC_REPORT_FATAL("getExecutionTime", "command not known or command doesn't have a fixed execution time");
return SC_ZERO_TIME;
}
}
sc_time getMinimalExecutionTime(Command command, tlm::tlm_generic_payload& payload)
{
TimingConfiguration& config = Configuration::getInstance().Timings;
if (command == Command::PDNA || command == Command::PDNP)
{
return config.tCKE;
}
else if (command == Command::SREF)
{
return config.tCKESR;
}
else
{
SC_REPORT_FATAL("getMinimalExecutionTime", "command is not know or command has a fixed execution time");
return SC_ZERO_TIME;
}
}
bool isClkAligned(sc_time time, sc_time clk)
{
return !((time / clk) - ceil(time / clk));
}
bool TimeInterval::timeIsInInterval(sc_time time)
{
return (start < time && time < end);
}
bool TimeInterval::intersects(TimeInterval other)
{
return other.timeIsInInterval(this->start) || this->timeIsInInterval(other.start);
}
sc_time getReadAccessTime()
{
Configuration& config = Configuration::getInstance();
return config.BurstLength/config.DataRate*config.Timings.clk;
}
sc_time getWriteAccessTime()
{
Configuration& config = Configuration::getInstance();
if (config.DataRate == 1)
{
return config.Timings.clk * (config.BurstLength-1) ;
}
else
{
return config.Timings.clk * config.BurstLength / config.DataRate;
}
}
}