Files
DRAMSys/dram/src/core/TimingCalculation.h
2014-04-12 12:05:04 +02:00

44 lines
1.0 KiB
C++

/*
* Utils.h
*
* Created on: Mar 10, 2014
* Author: jonny
*/
#ifndef UTILS_H_
#define UTILS_H_
#include <systemc.h>
#include <tlm.h>
#include "../common/dramExtension.h"
#include "Command.h"
namespace core
{
sc_time getDistance(sc_time a, sc_time b);
struct TimeInterval
{
sc_time start,end;
TimeInterval() : start(SC_ZERO_TIME), end(SC_ZERO_TIME){}
TimeInterval(sc_time start,sc_time end) : start(start), end(end){}
sc_time getLength() {return getDistance(start,end);}
bool timeIsInInterval(sc_time time);
bool intersects(TimeInterval other);
};
sc_time getMinimalExecutionTime(Command command, tlm::tlm_generic_payload& payload);
sc_time getExecutionTime(Command command, tlm::tlm_generic_payload& payload);
sc_time getBurstLengthOnDataStrobe(unsigned int burstlength);
sc_time getDelayToMeetConstraint(sc_time previous, sc_time start, sc_time constraint);
enum Alignment {UP, DOWN};
const sc_time clkAlign(sc_time time, Alignment alignment = UP);
bool isClkAligned(sc_time time, sc_time clk);
};
#endif /* UTILS_H_ */